Add the "atlas" vendor prefix for Atlas Scientific LLC
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch adds support for Hoperf th06 humidity and
temperature sensor as it uses same register definitions
as si7020
th06 Datasheet: http://www.hoperf.com/upload/sensor/TH06.pdf
Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch adds support for Hoperf th02 humidity and
temperature sensor as it uses same register definitions
as si7005
th02 Datasheet: http://www.anglia-live.com/netalogue/pdfs/hrf/datasheets/TH02_V1.1.pdf
Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Clearly a high degree of cut and paste has gone on in this file, propogating
a particularly random combination of tabs and spaces. This patch at least
should make it all consistent going forward.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The new algorithm uses a 'one size fits em all' threshold, which should
be easier to understand and debug. I believe there are no regressions
compared to the old adaptive threshold algorithm. I don't remember why
I chose the old algorithm when I initially wrote the driver.
Signed-off-by: Harald Geyer <harald@ccbib.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Instead of guessing where the data starts, we now just try to decode from
every possible start position. This causes no additional overhead if we
properly received the full preamble and only costs a few extra CPU cycles
in the case where the preamble is corrupted. This is much more efficient
than to return an error to userspace and start over again.
Signed-off-by: Harald Geyer <harald@ccbib.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
mpl115 driver currently supports i2c interface (MPL115A2).
There is also SPI version (MPL115A1). The difference between them
is only physical transport so we can easily support both while sharing
most of the code.
Split the driver into a core support module and one module each for I2C
and SPI support.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
mpl115 sets i2c clientdata, but it is not used anywhere. So remove it.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch removes the unused sysfs attributes range, range_available,
adc_resolution and adc_resolution_available.
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Enable operation of the TI OPT3001 light sensor without having an
interrupt line available to connect the INT pin to.
In this operation mode, we issue a conversion request and simply wait
for the conversion time available as timeout value, determined from
integration time configuration and the worst-case time given in the data
sheet (sect. 6.5, table on p. 5):
short integration time (100ms): 110ms + 3ms = 113ms
long integration time (800ms): 880ms + 3ms = 883ms
This change is transparent as behaviour defaults to using the interrupt
method if an interrupt no. is configured via device tree. Interrupt-less
operation mode is performed when no valid interrupt no. is given.
Signed-off-by: Alexander Koch <mail@alexanderkoch.net>
Signed-off-by: Michael Hornung <mhornung.linux@gmail.com>
Tested-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Change variable type of struct opt3001 members 'ok_to_ignore_lock' and
'result_ready' uint16-bitfield of length one to bool.
They are used as bool, let the compiler do the optimization.
Signed-off-by: Alexander Koch <mail@alexanderkoch.net>
Signed-off-by: Michael Hornung <mhornung.linux@gmail.com>
Tested-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Extract integration times as #define constants. This prepares using them
for delay/timeout length determination.
Signed-off-by: Alexander Koch <mail@alexanderkoch.net>
Signed-off-by: Michael Hornung <mhornung.linux@gmail.com>
Tested-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Fix indent warning when building with gcc 6:
drivers/staging/iio/adc/ad7192.c:239:4: warning: statement is indented
as if it were guarded by... [-Wmisleading-indentation]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
ad5761 is a 1-channel DAC with configurable output range.
The driver uses the regulator interface for its voltage ref.
It shares its register layout with ad5761r, ad5721 and ad5721r.
Differences:
ad5761* are 16 bit, ad5721* are 12 bits.
ad57*1r have an internal reference.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
duplicate const can be removed, it is redundant. Found by static
analysis using smatch.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This adds support for this series' 14 bit accelerometer chip, MMA8451Q.
It's datasheet is available at the vendor's website:
https://cache.freescale.com/files/sensors/doc/data_sheet/MMA8451Q.pdf
Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This adds freefall event detection to the supported devices. It adds
the in_accel_x&y&z_mag_falling_en iio event attribute, which activates
freefall mode.
In freefall mode, the current acceleration magnitude (AND combination
of all axis values) is compared to the specified threshold.
If it falls under the threshold (in_accel_mag_falling_value),
the appropriate IIO event code is generated.
This is what the sysfs "events" directory for these devices looks
like after this change:
-rw-r--r-- 4096 Oct 23 08:45 in_accel_mag_falling_period
-rw-r--r-- 4096 Oct 23 08:45 in_accel_mag_falling_value
-rw-r--r-- 4096 Oct 23 08:45 in_accel_mag_rising_period
-rw-r--r-- 4096 Oct 23 08:45 in_accel_mag_rising_value
-r--r--r-- 4096 Oct 23 08:45 in_accel_scale
-rw-r--r-- 4096 Oct 23 08:45 in_accel_x&y&z_mag_falling_en
-rw-r--r-- 4096 Oct 23 08:45 in_accel_x_mag_rising_en
-rw-r--r-- 4096 Oct 23 08:45 in_accel_y_mag_rising_en
-rw-r--r-- 4096 Oct 23 08:45 in_accel_z_mag_rising_en
Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Use var type for sizeof argument instead of the struct name.
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
vref_uv has to be an int.
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
mcp320x driver supports the pseudo-differential mode by
in_voltage'IN+'-voltage'IN-'_raw where (IN+, IN-) = (0, 1), (2, 3), ...
mcp320x chips except MCP3X01 can also select swapped IN+ and IN-
pairs in the pseudo-differential mode.
i.e. in_voltage'IN+'-voltage'IN-'_raw where (IN+, IN-) = (1, 0),
(3, 2), ...
If the voltage level of IN+ is equal to or less than IN-, the
resultant code will be 000h. So it is useful to provide these, too.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Oskar Andero <oskar.andero@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This driver supports the new version of the Atmel ADC device introduced
with the SAMA5D2 SoC family.
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The ak_def structures are never modified, so declare them as const.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Most ST MEMS Sensors that support interrupts can also handle sending
an active low interrupt, i.e. going from high to low on data ready
(or other interrupt) and thus triggering on a falling edge to the
interrupt controller.
Set up logic to inspect the interrupt line we get for a sensor: if
it is triggering on rising edge, leave everything alone, but if it
triggers on falling edges, set up active low, and if unsupported
configurations appear: warn with errors and reconfigure the interrupt
to a rising edge, which all interrupt generating sensors support.
Create a local header for st_sensors_core.h to share functions
between the sensor core and the trigger setup code.
Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Fix the checkpatch warning of alignment should match open
parenthesis.
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Replace bit shifting on 1 with the BIT(x) macro
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Allow the current for both RED and IR LEDs to be set via an device tree
property setting.
This is an optional setting that is useful for applications that have a
known glass attenuation factor.
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
MCP4726 is a single channel 12-bit DAC. We can support MCP4726 with
a little changes to mcp4725 driver. In power-down mode, they have
different selection of VOUT pull-down registers.
MCP4726 also has features:
- Output gain options: 1x, 2x
- Voltage reference selection: VDD, VREF (Unbuffered or Buffered)
But these are not supported in this change. (1x gain, VDD is selected)
datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/22272C.pdf
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The MCP3425 is a single channel up to 16-bit A/D converter which has
features:
- On-Board Programmable Gain Amplifier (PGA):
- Gains of 1, 2, 4 or 8
- Programmable Data Rate Options:
- 15 SPS (16 bits), 60 SPS (14 bits), 240 SPS (12 bits)
The mcp3422 driver also supports the MCP3421 which is a single channel.
So we can support MCP3425 with a little changes to mcp3422 driver.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
New driver features
- us5182
* Add interrupt support and rising / falling threshold events.
Cleanups / fixes to new stuff / minor additions
* Expose the IIO value formatting function for drivers to
make use of internally.
- ina2xx
* Fix wrong channel order
* Fix incorrect reporting of endianness
* Adding documentation of ABI unique to this device
- mma8452
* Drop an unused register description
* Use an enum for the channel index to aid readability
- sca3000
* Use standard NULL comparison style
- us5182
* fix an inconsistency in status of enable (a bug with no real effect until
above patches are applied)
* refactor the read_raw function to improve maintainability / readability.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAABCAAGBQJWeZ3IAAoJEFSFNJnE9BaIT2UP/3+VlQzBFrg1pBqLCR4xqMHB
9gUBInzgBwmzpmAqD9pkvyG5f9fTz7hSqX2IGkAA1V6I91H2cunEROSGyhFd4VBW
vhUhpz9WpRyx+8yLE3fQKUU/UmZJWTI7Xyladwrk3k87OOdcfn3wjtUdTuAhD5SW
OWzW9txC5dAgSEC5yhqD8VdXN6tRL/eEOEFawHlf9f7bBr9DuyhECp6aIP79gKAS
pynUPe3R5Uk/GuXdKX6zEWim4XZxhQR0oRmtrdCPIbauK6/ENDOWcaAvgS3mcN8i
KJ/L27hQGc5zjR8VzysZzZw+7Edc4EqY2UvhA19+0RN93064s0qvR8hoEMp0bHP/
MKGtwHv8MiqKfdCqIdimf6aT2GILTVWWx8WjyrM0O0+h444ba3ETRPGQ4mYNohuN
Gt7FFv345aiFh2lQw8Rb54H2d19KV2hwUar3CTpRcl9OhOEnD3ulfDvQghzNlbXl
nUh5dSOK+yDmXPPMEeZU4pYKG8rNaNZ1FxvVFy/yvUgytD1uqQDnWZ3b1gR0DiV9
56ucUcrSg74LSqC8R/D6BXb+73LPBTmpu60iGvOQsUYcnmJSdnmEobWCnSXGjFXR
I2e/H/ZOL4+dyHVpoyfQIiDpe6rGgYQHxyQ/kojWn2NxCJpgUufuR6jPTJ9GMF7k
eckCq5cDb0nmmg45EQq0
=aiE2
-----END PGP SIGNATURE-----
Merge tag 'iio-for-4.5c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Third set of new stuff for IIO in the 4.5 cycle.
New driver features
- us5182
* Add interrupt support and rising / falling threshold events.
Cleanups / fixes to new stuff / minor additions
* Expose the IIO value formatting function for drivers to
make use of internally.
- ina2xx
* Fix wrong channel order
* Fix incorrect reporting of endianness
* Adding documentation of ABI unique to this device
- mma8452
* Drop an unused register description
* Use an enum for the channel index to aid readability
- sca3000
* Use standard NULL comparison style
- us5182
* fix an inconsistency in status of enable (a bug with no real effect until
above patches are applied)
* refactor the read_raw function to improve maintainability / readability.
The big one here is the configfs support which has been a long time in the
works but should allow for cleaner ways to do instantiation of those elements
of IIO that aren't directly connected to specific hardware. Lots of cool new
stuff we can use this for in the works!
New core stuff (basically all configfs support related)
* Configfs support
- Core support (was waiting for a configfs patch that went in around 4.4rc2)
- A little fixlet to add a configfs.h to contain a reference to the
configfs_subsystem structure.
* Some infrastructure to simplify handling of software based triggers
(i.e. ones with no actual hardware associated with them)
* A high resolution timer based trigger. This has been around for years
but until the configfs support was ready we didn't have a sensible way
of instantiating instances of it (the method used for the sysfs_trigger
has never been really satisfactory)
New Device Support
* AMS iAQ Volatile Organic Compounds sensor support.
* Freescale imx7d ADC driver
* Maxim MAX30100 oximeter driver (note that for these devices most of the
smart stuff will be in userspace - effectively they are just light sensors
with some interesting led synchronization as far as the kernel is concerned).
* Microchip mcp3421 support added to the mcp3422 driver.
* TI adc124s021 support added to the adc128s052 driver.
* TI ina219, inda226 power monitors. Note that there is an existing hwmon driver
for these parts, the usecase is somewhat different so it is unclear at this
point if the hwmon driver will eventually be replaced by a bridge from
this driver. In the meantime the Kconfig dependencies should prevent both
from being built.
New driver functionality
* us8152d power management support.
Cleanups, fixups
* Use list_for_each_entry_safe instead of list_for_each_safe with the entry
bit coded longhand.
* Select IRQ_WORK for IIO_DUMMY_EVGEN. This is a fix that somehow got lost
when the driver was moved so lets do it again.
* st-accel - drop an unused define.
* vz89x, lidar - optimize i2c transactions by using a single i2c tranfers
instead of multiple calls where supported (fall back to smbus calls as
before if not).
* Use dev_get_platdata() in staging drivers: tsl2x7x, adcs and frequency
drivers instead of direct access to the structure element.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAABCAAGBQJWbX6IAAoJEFSFNJnE9BaI6E4QAIvGXHn4ew8ZH+IF3UP+n47C
WWtgeh7dEvhqpmXN3eWVo9bxA1JdwbE4/purWttszoJjzqowT0qAt6PuIUME+Md4
3jOQ41Sc99YjttIwkLpWTqq3H5c3Tn3q9guZ3Imiz9rmpgHRePQ8aatMGUpOp53m
AEY5JQHqCoWHLMEbEy/5w8RJdNf3cy3Re4kjtwrtp7CMynC4ob7dKE7kcZRvywEw
6m4hVOQusLvygg1j235czwBDnf79qYOo96z93Pk/auQlqKX3ce/7yQW3GXvWl97a
8FOmse3FNzX3jwWHELOdAZWIQSLBSqP9N4716qa4orVSihzqAZQ5CSEBPB0r2LS2
cgK4BL6+xjDkwXn9ui4FiyLdUeUjz/zRhvwFZdjwP63hGf5n9ggZO3RuVslc6/8z
DOHY5mLdg8CFlMlZUCnCc+1BjU8lgf90+a46Vx4ACJJiqIJrvNRxRKGQZyY/C9sO
O8h0Ep5mWovcK1+SWdQSsfxdcWcdb0nJFG/VQeJVxMeJR+5mD5lCYmIj5xFkOxJU
WP9xm+7rsCqSPW+vp8hlY3EWunIQB4gWROvLzWCTS2bKW7B12t1UapLZBrI1f6vK
JuqHrjKkK7RBRAEldKz6cWCToEaHE+I/k+uIRhlp0of2IPEvGpnm3NoPN1XH3RID
9boPy/eHuShq8EVg0WUt
=54PR
-----END PGP SIGNATURE-----
Merge tag 'iio-for-4.5b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Second set of IIO new drivers, functionality and cleanups for the 4.5 cycle.
The big one here is the configfs support which has been a long time in the
works but should allow for cleaner ways to do instantiation of those elements
of IIO that aren't directly connected to specific hardware. Lots of cool new
stuff we can use this for in the works!
New core stuff (basically all configfs support related)
* Configfs support
- Core support (was waiting for a configfs patch that went in around 4.4rc2)
- A little fixlet to add a configfs.h to contain a reference to the
configfs_subsystem structure.
* Some infrastructure to simplify handling of software based triggers
(i.e. ones with no actual hardware associated with them)
* A high resolution timer based trigger. This has been around for years
but until the configfs support was ready we didn't have a sensible way
of instantiating instances of it (the method used for the sysfs_trigger
has never been really satisfactory)
New Device Support
* AMS iAQ Volatile Organic Compounds sensor support.
* Freescale imx7d ADC driver
* Maxim MAX30100 oximeter driver (note that for these devices most of the
smart stuff will be in userspace - effectively they are just light sensors
with some interesting led synchronization as far as the kernel is concerned).
* Microchip mcp3421 support added to the mcp3422 driver.
* TI adc124s021 support added to the adc128s052 driver.
* TI ina219, inda226 power monitors. Note that there is an existing hwmon driver
for these parts, the usecase is somewhat different so it is unclear at this
point if the hwmon driver will eventually be replaced by a bridge from
this driver. In the meantime the Kconfig dependencies should prevent both
from being built.
New driver functionality
* us8152d power management support.
Cleanups, fixups
* Use list_for_each_entry_safe instead of list_for_each_safe with the entry
bit coded longhand.
* Select IRQ_WORK for IIO_DUMMY_EVGEN. This is a fix that somehow got lost
when the driver was moved so lets do it again.
* st-accel - drop an unused define.
* vz89x, lidar - optimize i2c transactions by using a single i2c tranfers
instead of multiple calls where supported (fall back to smbus calls as
before if not).
* Use dev_get_platdata() in staging drivers: tsl2x7x, adcs and frequency
drivers instead of direct access to the structure element.
This was extracted from a reposting of the driver after it had been applied
to the IIO tree. I have fast tracked it as the driver will be in 4.5 and
it would be nice to fix this trivial issue before it is.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
A bit of refactoring for better readability.
Moved and slightly reorganized all the activity necessary for reading als
and proximity into a different function. This way the switch in read raw
becomes clearer and more compact.
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add interrupt support for proximity.
Add two threshold events to signal rising and falling directions.
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
When setting als only or proximity only modes make sure that we mark the
other component as disabled. This fix is in preparation of adding event
support because that will make it possible to switch between one-shot and
continuous modes and not tracking these correctly may cause faulty
behaviour (e.g wrongfully considering px enabled and not setting an
appropriate mode in the chip).
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Make IIO value formating function globally available to allow IIO drivers
to output values as the core does.
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
ARCH_SHMOBILE is coming to arm64, which creates new warnings in allmodconfig:
drivers/staging/emxx_udc/emxx_udc.c: In function '_nbu2ss_out_dma':
drivers/staging/emxx_udc/emxx_udc.c:843:45: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
_nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)pBuffer);
This is clearly a mistake from confusing a dma_addr_t with a pointer,
so the fix is to use the correct types in two places.
The third warning of this kind is a check for an unaligned pointer,
which should be done by casting the pointer to uintptr_t, not int.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch makes plx9080.h use kernel types.
Signed-off-by: Moritz König <moritz.koenig@fau.de>
Signed-off-by: Fabian Lang <fabian.lang@fau.de>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Acked-by: Moritz Fischer <moritz.fischer@ettus.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch adds spaces around binary operators in plx9080.h.
Signed-off-by: Moritz König <moritz.koenig@fau.de>
Signed-off-by: Fabian Lang <fabian.lang@fau.de>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch fixes the format of comments in plx9080.h.
Signed-off-by: Moritz König <moritz.koenig@fau.de>
Signed-off-by: Fabian Lang <fabian.lang@fau.de>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch is to comedilib.h file that fixes up following warnings
reported by checkpatch.pl :
I) Block comments use * on subsequent lines.
Apart from it I have remove header file path by base file name as
suggested by community.
Signed-off-by: Jitendra Kumar Khasdev <jkhasdev@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The driver writes a couple of literal values to the counter
control/status register, 0x8000 to reset the counter, and 0x4000 to load
the counter from preload register 0. Add a bunch of macros to define
these values and other values for the register, based on the Sensoray
526 manual.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The driver uses `struct counter_mode_register_t` to describe the 16-bit
counter mode register as a sequence of bitfield members. The struct
appears as the type of one of the members of `union cmReg`, the other
member of which is of type `unsigned short`, so the driver can
manipulate the register value as a whole, or as individual fields.
Although this is fairly convenient, it's not that conventional. The
code also needs to define the bitfield members in ascending or
descending order of the physical bits, depending on whether bitfields
are little- or big-endian.
Rip all that out and replace it with a bunch of macros to set and mask
out bits of the register value, as that's the more conventional way to
do it. A bonus is that we get rid of a load of CamelCase definitions in
the process.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
If the "write" file operation handler, `comedi_write()` is passed 0 for
the amount to write, some error conditions are currently skipped and the
function just returns 0. Change it to check those error conditions and
return an error value if appropriate. The trickiest case is the check
for when the previously set up asynchronous command has terminated with
an error. In that case, `-EPIPE` is returned (as it is for a write of
non-zero length) and the subdevice gets marked as non-busy.
A zero-length write that returns 0 has no other effects, in particular,
it does not cause the subdevice to be marked as non-busy.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In order to perform a "write" file operation, an asynchronous COMEDI
command in the "write" direction needs to have been set up by the
current file object on the COMEDI "write" subdevice associated with the
file object. If there is a "write" subdevice, but a command has not
been set up by the file object (or is has been set-up in the wrong
direction), `comedi_write()` currently returns one of two error values
`-EINVAL` or `-EACCES`. `-EACCES` is returned if the command was set up
by a different subdevice, or somewhat randomly, if a COMEDI
"instruction" is currently being processed. `-EINVAL` is returned in
other cases. Simplify it by returning `-EINVAL` for all these cases.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The "write" file operation handler, `comedi_write()` returns an error
for pretty much any condition that prevents a "write" going ahead. One
of the conditions that prevents a "write" going ahead is that no
asynchronous command has been set up, but that currently results in a
return value of 0 (unless COMEDI instructions are being processed or an
asynchronous command has been set up by a different file object).
Change it to return `-EINVAL` in this case.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
`comedi_write()` copies data from the user buffer to the acquisition
data buffer, which is cyclic, using a single call to `copy_from_user()`.
It currently avoids having to deal with wraparound of the cyclic buffer
by limiting the amount it copies (and the amount returned to the user).
Change it to deal with the wraparound using two calls to
`copy_from_user()` if necessary.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>