pandora-kernel.git
9 years agoiio: light: cm32181: Use devm_* APIs
Beomho Seo [Wed, 18 Jun 2014 06:21:00 +0000 (07:21 +0100)]
iio: light: cm32181: Use devm_* APIs

This patch changes API from iio_device_register() to devm_* API.
Using API make code simpler.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: dac: mcp4902/mcp4912/mcp4922 dac driver
Michael Welling [Sun, 15 Jun 2014 21:17:00 +0000 (22:17 +0100)]
iio: dac: mcp4902/mcp4912/mcp4922 dac driver

This patch provides an iio device driver for the Microchip
MCP49x2 series DACs.

Signed-off-by: Michael Welling <mwelling@ieee.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: accel: kxcjk1013 Fix missing unlock errors
Srinivas Pandruvada [Mon, 16 Jun 2014 19:00:00 +0000 (20:00 +0100)]
iio: accel: kxcjk1013 Fix missing unlock errors

Fix unlock at two places. One when i2c error occurs and other
when trigger set state when raw read is in progress.

kbuild test robot errors:
>> >> drivers/iio/accel/kxcjk-1013.c:531:3-9: preceding lock on line 524
>> >> drivers/iio/accel/kxcjk-1013.c:376:4-10: preceding lock on line 368

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: AK09911 : 3 axis compass support
Srinivas Pandruvada [Thu, 6 Nov 2014 23:06:00 +0000 (23:06 +0000)]
iio: AK09911 : 3 axis compass support

Added IIO magnetometer driver for AK09911. In functionality is resembles
AK8975 or AK8963. But there are several differences, so instead of
modifying existing AK8975 driver and keep it clean, implemented as
a separate driver.
The key differences are:
- Register map is different and have different indexes
- AK09911 is a very compact interface with no DRDY pin. So no support
 of interrupt or GPIO poll
- Even for polled mode no mention on ST2 register, which is required in
ak8975 driver
- mode values are different for fuse access

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: accel: kxcjk1013 3-axis accelerometer driver
Srinivas Pandruvada [Thu, 6 Nov 2014 23:07:00 +0000 (23:07 +0000)]
iio: accel: kxcjk1013 3-axis accelerometer driver

This patch adds IIO driver for KXCJK 1013 triaxis accelerometer sensor.
The specifications for this driver is downloaded from:
http://www.kionix.com/sites/default/files/KXCJK-1013%20Specifications%20Rev%202.pdf

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: Remove timestamp argument from iio_trigger_poll() and iio_trigger_poll_chained()
Peter Meerwald [Sat, 6 Dec 2014 06:46:00 +0000 (06:46 +0000)]
iio: Remove timestamp argument from iio_trigger_poll() and iio_trigger_poll_chained()

argument has been ignored; adjust drivers accordingly

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agostaging: iio: fix coding style by adding blank lines in iio_simple_dummy
Jimmy Picard [Fri, 13 Jun 2014 05:56:00 +0000 (06:56 +0100)]
staging: iio: fix coding style by adding blank lines in iio_simple_dummy

This patch fixes coding style reported by checkpatch.pl that missing
a blank line after declarations.

Signed-off-by: Jimmy Picard <jimmyp11f155@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agostaging:iio-trig-periodic-rtc: Allow to reset frequency to 0
Peter Meerwald [Sat, 6 Dec 2014 06:00:00 +0000 (06:00 +0000)]
staging:iio-trig-periodic-rtc: Allow to reset frequency to 0

periodic rtc trigger initially has frequency 0

it is possible to change trigger frequency on-the-fly, but it is not
possible to set frequency back to 0

this patch allows to set trigger frequency to 0, thereby disabling
the rtc interrupt

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agostaging:iio-trig-periodic-rtc: Cleanup
Peter Meerwald [Sat, 6 Dec 2014 06:00:00 +0000 (06:00 +0000)]
staging:iio-trig-periodic-rtc: Cleanup

Fix extra space in module description
Silence output about trigger frequency when trigger gets enabled/disabled

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agostaging:iio: Fix error handling in generic_buffer example
Peter Meerwald [Sat, 6 Dec 2014 06:00:00 +0000 (06:00 +0000)]
staging:iio: Fix error handling in generic_buffer example

read() does not return -EAGAIN
read() returns -1 and the errno value needs to be checked for -EAGAIN

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agostaging:iio: Fix mention of INDIO_RING_TRIGGERED to INDIO_BUFFER_TRIGGERED
Peter Meerwald [Sat, 6 Dec 2014 06:00:00 +0000 (06:00 +0000)]
staging:iio: Fix mention of INDIO_RING_TRIGGERED to INDIO_BUFFER_TRIGGERED

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agostaging:iio: Fix iio_utils.h function prototypes
Peter Meerwald [Sat, 6 Dec 2014 06:00:00 +0000 (06:00 +0000)]
staging:iio: Fix iio_utils.h function prototypes

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agostaging:iio: Update iio_event_monitor program
Peter Meerwald [Sat, 6 Dec 2014 06:00:00 +0000 (06:00 +0000)]
staging:iio: Update iio_event_monitor program

add types recently added

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: Move documentation of iio-trig-sysfs to ABI/testing
Peter Meerwald [Sat, 6 Dec 2014 06:00:00 +0000 (06:00 +0000)]
iio: Move documentation of iio-trig-sysfs to ABI/testing

iio-trig-sysfs has left staging with commit e64e7d5c

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio:adc:ad7298: Use BIT() and GENMASK() macros
Peter Meerwald [Sat, 6 Dec 2014 06:00:00 +0000 (06:00 +0000)]
iio:adc:ad7298: Use BIT() and GENMASK() macros

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio:adc:ad7476: Use GENMASK() macro
Peter Meerwald [Sat, 6 Dec 2014 06:00:00 +0000 (06:00 +0000)]
iio:adc:ad7476: Use GENMASK() macro

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio:adc:ad7887: Use BIT() and GENMASK() macros
Peter Meerwald [Sat, 6 Dec 2014 06:00:00 +0000 (06:00 +0000)]
iio:adc:ad7887: Use BIT() and GENMASK() macros

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio:adc:ad5504: Use BIT() and GENMASK() macros
Peter Meerwald [Sat, 6 Dec 2014 06:00:00 +0000 (06:00 +0000)]
iio:adc:ad5504: Use BIT() and GENMASK() macros

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio:adc:ad5791: Use BIT() and GENMASK() macros
Peter Meerwald [Sat, 6 Dec 2014 06:00:00 +0000 (06:00 +0000)]
iio:adc:ad5791: Use BIT() and GENMASK() macros

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio:adc:ad799x: Fix ad799x_chip_info kerneldoc
Peter Meerwald [Sat, 6 Dec 2014 05:54:00 +0000 (05:54 +0000)]
iio:adc:ad799x: Fix ad799x_chip_info kerneldoc

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9 years agoiio: Add t5403 barometric pressure sensor driver
Peter Meerwald [Thu, 6 Feb 2014 20:44:00 +0000 (20:44 +0000)]
iio: Add t5403 barometric pressure sensor driver

16-bit pressure and temperature sensor

the chip can do I2C and SPI, only the I2C interface is supported
by the driver at the moment

datasheet: http://www.epcos.com/inf/57/ds/T5400.pdf
application note: http://www.epcos.com/blob/993154/download/1/t5403-applicationnote.pdf

an out-of-tree driver targetting the input subsystem is at
https://github.com/unixphere/t5400, it was rejected here:
http://comments.gmane.org/gmane.linux.kernel.input/28107

v2: (thanks Hartmut Knaack)
* fix MODE_HIGH, equals 2
* check INT_TIME mask in write_raw()

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Stefan Nilsson <stefan.nilsson@unixphere.com>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: Add ABI documentation for proximity
Peter Meerwald [Wed, 5 Mar 2014 11:57:00 +0000 (11:57 +0000)]
iio: Add ABI documentation for proximity

has been in use for a long time, but never documented
proximity is unit-less, except otherwise stated, see e.g.
the as3935 driver where it is meter

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agofix format string missmatch in staging/iio/Documentation/iio_utils.h
Toralf Förster [Sat, 24 May 2014 13:25:00 +0000 (14:25 +0100)]
fix format string missmatch in staging/iio/Documentation/iio_utils.h

spotted by cppcheck

Signed-off-by: Toralf Förster <toralf.foerster@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio:adc:max1363 incorrect resolutions for max11604, max11605, max11610 and max11611.
Jonathan Cameron [Sat, 24 May 2014 11:52:10 +0000 (12:52 +0100)]
iio:adc:max1363 incorrect resolutions for max11604, max11605, max11610 and max11611.

Cc: Stable@vger.kernel.org>
Reported-by: Erik Habbinga <Erik.Habbinga@schneider-electric.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
10 years agoiio: hid-sensors: Set default unit of measure for report interval
Archana Patni [Tue, 5 Aug 2014 13:36:00 +0000 (14:36 +0100)]
iio: hid-sensors: Set default unit of measure for report interval

For PROP_REPORT_INTERVAL, the spec does not mandate the presence
of the report interval unit in the feature report and expects the
default unit of measure to be used as milliseconds.

Currently, when the unit is not present, it gets set as zero leading
to issues in sampling frequency.

This patch sets the unit of measure to the default unit if it
is not defined by firmware.

Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio:adc: at91 requires the input subsystem
Arnd Bergmann [Wed, 9 Apr 2014 15:18:10 +0000 (17:18 +0200)]
iio:adc: at91 requires the input subsystem

Building the at91 adc driver with CONFIG_INPUT disabled results in this
build error:

ERROR: "input_event" [drivers/iio/adc/at91_adc.ko] undefined!
ERROR: "input_unregister_device" [drivers/iio/adc/at91_adc.ko] undefined!
ERROR: "input_free_device" [drivers/iio/adc/at91_adc.ko] undefined!
ERROR: "input_register_device" [drivers/iio/adc/at91_adc.ko] undefined!
ERROR: "input_set_abs_params" [drivers/iio/adc/at91_adc.ko] undefined!
ERROR: "input_allocate_device" [drivers/iio/adc/at91_adc.ko] undefined!

To make sure we can build random configurations, this adds a Kconfig
dependency on CONFIG_INPUT, as we do for other similar drivers.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: linux-iio@vger.kernel.org
Cc: Josh Wu <josh.wu@atmel.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: always select ANON_INODES
Arnd Bergmann [Tue, 5 Aug 2014 14:56:00 +0000 (15:56 +0100)]
iio: always select ANON_INODES

Without ANON_INODES, we get this build error:

drivers/built-in.o: In function `iio_event_getfd':
:(.text+0x14bf18): undefined reference to `anon_inode_getfd'

All other users explicitly select this symbol, so we should
do the same thing here.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: typo leads to potential forever loop
Dan Carpenter [Fri, 5 Sep 2014 11:56:00 +0000 (12:56 +0100)]
iio: hid-sensors: typo leads to potential forever loop

The "i < " was missing in this condition.

Fixes: 5d02edfc3957 ('iio: hid-sensors: Convert units and exponent')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoMerge branch 'imx-drm-fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm into stagin...
Greg Kroah-Hartman [Tue, 6 May 2014 13:26:31 +0000 (06:26 -0700)]
Merge branch 'imx-drm-fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm into staging-next

imx-drm fixes from Russell

10 years agoMerge tag 'iio-for-3.16b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Mon, 5 May 2014 23:40:54 +0000 (16:40 -0700)]
Merge tag 'iio-for-3.16b' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second set of IIO new drivers, cleanups and functionality for the 3.16 cycle.

This set contains a change to the ABI for the hid-sensors drivers to bring them
in line with the long published documentation.  Unfortunately, rather than
reporting true scale and offset values via sysfs they were reporting
some magic numbers that could only be converted to anything useful using
the HID sensors specification. I missed this entirely through the introduction
of a number of drivers, only picking up on it recently.  Srinivas has had
user feedback about this as well. The patch set is too large to go as a fix
at this stage in the cycle and is not a regression fix as this was never
right and so will have to wait for the next merge window. Srinivas assures
me that there are relatively few pieces of hardware out there and he has
had a number of people contact him to point out that the drivers did not
obey the ABI.  Hence hopefully the fallout of this, if any will be minor.
If we don't fix it now, it will only get worse going forward. There is no
sensible way of maintaining the incorrect ABI as it is simply returning
the wrong values through the standard interfaces.

Non IIO elements
* Introduce devm_kmemdup.  Does what it says on the tin.

New drivers:
* hid-sensors rotation devices (output as quaternion)
* Freescale MPL115A2 presure and temperature sensor.
* Melexis mlx90614 contactless infrared sensor.
* Freescale MMA8452Q 3-axis accelerometer.

New functionality:
* Addition of multiple element callback to allow for sysfs interfaces to access
  elements such as quaternions which have no useful meaning if all 4 elements
  are not presented together.  Other future usecases for this include
  rotation matrices.
* Support for multiple element buffer entries for exactly the same uses as
  the sysfs related elements described above.
* Quaternion support via the quaternion IIO modifier.
* TEMP_AMBIENT and TEMP_OBJECT modifiers to distinguish cases with thermopile
  devices.
* hid-sensors gain sysfs access to the sensor readings. Previously these
  drivers used the buffered interface only.  This change involves some
  additional hid-sensors core support to read poll values back from the devices
  to allow the drivers to know roughly how long to wait for a result when
  polling the sensor.  There is also an associated hid-sensors abi to allow
  the devices to be turned off between reads and powered up on demand.

Cleanups and fixes
* Hid sensors fix as described above. Result is to make the _scale and _offset
  attributes applicable in the same way as for all other IIO drivers.
* Some additional documentation - mostly covering stuff that graduated from
  staging without managing to take it's ABI docs with it.
* A series of little tidy ups to the exynos_adc driver that make the code
  nicer to read and improve handling of some corner cases.
* A tidy up to mag3110 (logical fix rather than a real one ;). Also enable
  user offset calibration for this device.
* Drop some left over IS_ERR() checks from ad799x that snuck through during
  the cleanup in the last IIO patch set.
* Fix a naming issue from clashing patches in ak8975 - note the clash only
  occured in the last IIO patch set, hence the fix needs to go through this
  tree.
* A format string missmatch fix in ad7280.c. Unlikely to have ever had an
  impact so not worth rushing through.

10 years agoiio: hid-sensors: Pressure: Raw read support
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: Pressure: Raw read support

Added support for raw reading of channel. If the sensor is powered
off, it will turn on for reading value.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Inclinometer 3D: Raw read support
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: Inclinometer 3D: Raw read support

Added support for raw reading of channel. If the sensor is powered
off, it will turn on for reading value.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Compass 3D: Raw read support
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: Compass 3D: Raw read support

Added support for raw reading of channel. If the sensor is powered
off, it will turn on for reading value

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Proximity: Raw read support
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: Proximity: Raw read support

Added support for raw reading of channel. If the sensor is powered
off, it will turn on for reading value.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: ALS: Raw read support
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: ALS: Raw read support

Added support for raw reading of channel. If the sensor is powered
off, it will turn on for reading value.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Gyro 3D: Raw read support
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: Gyro 3D: Raw read support

Added support for raw reading of channel. If the sensor is powered
off, it will turn on for reading value.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Accelerometer 3D: Raw read support
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: Accelerometer 3D: Raw read support

Added support for raw reading of channel. If the sensor is powered
off, it will turn on for reading value.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Add API to power on/off
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: Add API to power on/off

Added an API to allow client drivers to turn ON and OFF sensors for
quick read. Added data_read as counting varaible instead of boolean,
so that sensor is powered off only when last user released it.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Pressure: adjust scale and offset
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: Pressure: adjust scale and offset

Using units and unit exponent to calculate scale which is compliant
to IIO ABI.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Inclinometer 3D: adjust scale and offset
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: Inclinometer 3D: adjust scale and offset

Using units and unit exponent to calculate scale which is compliant
to IIO ABI.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Compass 3D: adjust scale and offset
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: Compass 3D: adjust scale and offset

Using units and unit exponent to calculate scale which is compliant
to IIO ABI.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: ALS: adjust scale and offset
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: ALS: adjust scale and offset

Using units and unit exponent to calculate scale which is compliant
to IIO ABI.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Gyro 3D : adjust scale and offset
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: Gyro 3D : adjust scale and offset

Using units and unit exponent to calculate scale which is compliant
to IIO ABI.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Accelerometer 3D: adjust scale and offset
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: Accelerometer 3D: adjust scale and offset

Using units and unit exponent to calculate scale which is compliant
to IIO ABI.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Add api to get poll value
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: Add api to get poll value

Added interface to get poll value in milli-seconds. This value is
changed by changing sampling frequency. This API allows clients
to wait for at least some poll milli seconds before reading a new sample.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: hid-sensors: Convert units and exponent
Srinivas Pandruvada [Fri, 18 Apr 2014 23:22:00 +0000 (00:22 +0100)]
iio: hid-sensors: Convert units and exponent

HID sensor hub specify a default unit and alternative units. This
along with unit exponent can be used adjust scale. This change
change HID sensor data units to IIO defined units for each
sensor type. So in this way user space can use a simply use:
"(data + offset) * scale" to get final result.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agostaging: rtl8188eu: Remove 'u8 *pbuf' from struct recv_buf
navin patidar [Sat, 3 May 2014 11:45:32 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove 'u8 *pbuf' from struct recv_buf

Instead of using pbuf to pass sbk data pointer to usb_fill_bulk_urb(),
we can use precvbuf->pskb->data to do that.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove rtl8188eu_init_recvbuf() function
navin patidar [Sat, 3 May 2014 11:45:31 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove rtl8188eu_init_recvbuf() function

rtl8188eu_init_recvbuf() function definition is empty now,
so remove it.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove 'u32 ref_cnt' from struct recv_buf
navin patidar [Sat, 3 May 2014 11:45:30 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove 'u32 ref_cnt' from struct recv_buf

Driver isn't making any use of value stored in variable ref_cnt.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove 'u32 len' from struct recv_buf
navin patidar [Sat, 3 May 2014 11:45:29 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove 'u32 len' from struct recv_buf

Remove unused variable 'u32 len'.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove 'alloc_sz' from struct recv_buf
navin patidar [Sat, 3 May 2014 11:45:28 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove 'alloc_sz' from struct recv_buf

Driver isn't making any use of value stored in alloc_sz variable.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove 'pallocated_buf' from struct recv_buf
navin patidar [Sat, 3 May 2014 11:45:27 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove 'pallocated_buf' from struct recv_buf

pallocated_buf is not being used by driver.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove 'irp_pending' from struct recv_buf
navin patidar [Sat, 3 May 2014 11:45:26 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove 'irp_pending' from struct recv_buf

irp_pending is initialized to false inside rtw_os_recvbuf_resource_alloc()
and value of irq_pending never changed after that, so 'if (!precvbuf->irp_pending)'
inside rtw_os_read_port() function will be always true.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove pdata, phead, ptail and pend from struct recv_buf
navin patidar [Sat, 3 May 2014 11:45:25 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove pdata, phead, ptail and pend from struct recv_buf

Driver is not making use of value stored in removed variables.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove 'int transfer_len' from struct recv_buf
navin patidar [Sat, 3 May 2014 11:45:24 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove 'int transfer_len' from struct recv_buf

Driver is not making any use of value stored in this variable.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove 'dma_addr_t dma_transfer_addr' from struct recv_buf
navin patidar [Sat, 3 May 2014 11:45:23 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove 'dma_addr_t dma_transfer_addr' from struct recv_buf

Remove unused variable dma_transfer_addr.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove 'spinlock_t recvbuf_lock' from struct recv_buf
navin patidar [Sat, 3 May 2014 11:45:22 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove 'spinlock_t recvbuf_lock' from struct recv_buf

recvbuf_lock is initialized inside rtl8188eu_init_recv_priv() but never used.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove 'struct list_head list' from struct recv_buf
navin patidar [Sat, 3 May 2014 11:45:21 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove 'struct list_head list' from struct recv_buf

Users of 'struct list_head list' variable e.g. rtw_enqueue_recvbuf(),
rtw_enqueue_recvbuf_to_head() and rtw_dequeue_recvbuf() are
already removed.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove function rtw_enqueue_recvbuf()
navin patidar [Sat, 3 May 2014 11:45:20 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove function rtw_enqueue_recvbuf()

rtw_enqueue_recvbuf() is not being used by driver.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove function rtw_enqueue_recvbuf_to_head()
navin patidar [Sat, 3 May 2014 11:45:19 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove function rtw_enqueue_recvbuf_to_head()

rtw_enqueue_recvbuf_to_head() is not being used by driver.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove function rtw_dequeue_recvbuf()
navin patidar [Sat, 3 May 2014 11:45:18 +0000 (17:15 +0530)]
staging: rtl8188eu: Remove function rtw_dequeue_recvbuf()

rtw_dequeue_recvbuf() is not being used by driver.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agortl8821ae: fixed defined-not-used warning
Jan Moskyto Matejka [Wed, 30 Apr 2014 13:22:17 +0000 (15:22 +0200)]
rtl8821ae: fixed defined-not-used warning

by cleaning up BT_AUTO_REPORT_ONLY_8192E_2ANT
(always set to 0, never used as constant)

halbtc8192e2ant_iswifi_status_changed was called only from the unused code

Signed-off-by: Jan Moskyto Matejka <mq@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8192u: fix checkpatch braces warning
Rui Miguel Silva [Mon, 28 Apr 2014 11:12:54 +0000 (12:12 +0100)]
staging: rtl8192u: fix checkpatch braces warning

fix some code style related to the use of braces in a one statement block

Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/rtl8192e: Erroneous return codes (types and values)
Dominique van den Broeck [Sun, 27 Apr 2014 17:11:15 +0000 (19:11 +0200)]
staging/rtl8192e: Erroneous return codes (types and values)

This function returns a bool, that is supposed to be false when something
goes wrong. It's assumed this way by its lone calling function (which is
SetRFPowerState8190(), line 1445 of rtl8192e/rtl8192e/r8192E_phy.c)

Despite of this, this procedure returns non-null enumerations values or
negative codes instead. This patch fixes this.

Signed-off-by: Dominique van den Broeck <domdevlin@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Use USB subsystem functions to check endpoint type
navin patidar [Tue, 29 Apr 2014 01:25:13 +0000 (06:55 +0530)]
staging: rtl8188eu: Use USB subsystem functions to check endpoint type

Use inline functions provided by USB subsystem to check endpoint type,
instead of inline functions implemented by driver to do the same.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: rtl8188eu: Remove debugging messages from usb_dvobj_init()
navin patidar [Tue, 29 Apr 2014 01:25:12 +0000 (06:55 +0530)]
staging: rtl8188eu: Remove debugging messages from usb_dvobj_init()

Unnecessary debugging messages are removed from usb_dvobj_init().

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: serqt_usb2: Clean up initializations of variables
Thomas Vegas [Tue, 1 Apr 2014 16:29:37 +0000 (18:29 +0200)]
staging: serqt_usb2: Clean up initializations of variables

Use a more common kernel coding style.

Signed-off-by: Thomas Vegas <thomas_75@safe-mail.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: serqt_usb2: Add blank line after declaration
Thomas Vegas [Tue, 1 Apr 2014 16:28:33 +0000 (18:28 +0200)]
staging: serqt_usb2: Add blank line after declaration

Use a more common kernel coding style.

Signed-off-by: Thomas Vegas <thomas_75@safe-mail.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: serqt_usb2: Remove useless variable
Thomas Vegas [Tue, 1 Apr 2014 16:27:34 +0000 (18:27 +0200)]
staging: serqt_usb2: Remove useless variable

Use a more common kernel coding style.

Signed-off-by: Thomas Vegas <thomas_75@safe-mail.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: remove async parameter from resize_async_buffer()
Ian Abbott [Fri, 2 May 2014 12:50:14 +0000 (13:50 +0100)]
staging: comedi: remove async parameter from resize_async_buffer()

The `struct comedi_async *async` parameter of `resize_async_buffer()` is
redundant as its value can be easily derived from the `struct
comedi_subdevice *s` parameter as `s->async`.  Remove the parameter.

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>
10 years agostaging: comedi: remove redundant pointer dereference in comedi_poll()
Ian Abbott [Fri, 2 May 2014 12:50:13 +0000 (13:50 +0100)]
staging: comedi: remove redundant pointer dereference in comedi_poll()

`s->async->subdevice` in `comedi_poll()` points to the same `struct
comedi_subdevice` as `s`, so the double pointer reference is redundant.
Just use `s`.

(`s->async->subdevice` is initialized by
`__comedi_device_postconfig_async()` in
"drivers/staging/comedi/drivers.c" and doesn't change.)

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>
10 years agostaging: comedi: amplc_dio200_common: correct bound on counter mode
Ian Abbott [Thu, 1 May 2014 16:38:24 +0000 (17:38 +0100)]
staging: comedi: amplc_dio200_common: correct bound on counter mode

For the mode configured by the `INSN_CONFIG_SET_COUNTER_MODE` comedi
instruction for the counter subdevice channels supported by this module,
the upper bound should be `I8254_MODE5 | I8254_BCD` ((5 << 1) | 1)
rather than `I8254_MODE5 | I8254_BINARY` ((5 << 1) | 0).  Fix it.

Reported-by: Hartley Sweeten <HartleyS@visionengravers.com>
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>
10 years agostaging: comedi: drivers: correct mode check for i8254_set_mode()
Ian Abbott [Thu, 1 May 2014 16:38:23 +0000 (17:38 +0100)]
staging: comedi: drivers: correct mode check for i8254_set_mode()

The upper bound check on the `mode` parameter of `i8254_set_mode()` and
`i8254_mm_set_mode()` is incorrect.  The `mode` parameter value consists
of a mode number in the range 0 to 5 in bits 3..1 {represented by the
constants `I8254_MODE0` (0 << 1) through to `I8254_MODE5` (2 << 1)} ORed
with a BCD/binary flag in bit 0 {represented by the constants
`I8254_BINARY` (0) and `I8254_BCD` (1)}.  The maximum allowed value
ought to be `I8254_MODE5 | I8254_BCD` ((5 << 1) | 1), but is currently
`I8254_MODE5 | I8254_BINARY` ((5 << 1) | 0).  Fix it.

None of the comedi drivers use `I8254_BCD` but some of the low-level
drivers allow user-space to configure the counter mode, so all legal
values ought to be allowed.  However, it's pretty unlikely anyone would
want to set the counters to count in BCD (binary coded decimal) so the
bug is not that significant.

Reported-by: Hartley Sweeten <HartleyS@visionengravers.com>
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>
10 years agostaging: comedi: fix checkpatch warnings
Luca Ellero [Wed, 30 Apr 2014 09:22:07 +0000 (11:22 +0200)]
staging: comedi: fix checkpatch warnings

Signed-off-by: Luca Ellero <luca.ellero@brickedbrain.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: das16: clarify 8254 timer programming
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:59 +0000 (12:59 -0700)]
staging: comedi: das16: clarify 8254 timer programming

Refactor the 8254 timer programming to use the i8254_set_mode()
and i8254_write() helpers instead of i8254_load(). This allows
us to use the I8254_MODE* defines to clarify the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: das16m1: clarify 8254 timer programming
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:58 +0000 (12:59 -0700)]
staging: comedi: das16m1: clarify 8254 timer programming

Refactor the 8254 timer programming to use the i8254_set_mode()
and i8254_write() helpers instead of i8254_load(). This allows
us to use the I8254_MODE* defines to clarify the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: ni_at_a2150: clarify 8254 timer programming
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:57 +0000 (12:59 -0700)]
staging: comedi: ni_at_a2150: clarify 8254 timer programming

Refactor the 8254 timer programming to use the i8254_set_mode()
and i8254_write() helpers instead of i8254_load(). This allows
us to use the I8254_MODE* defines to clarify the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: ni_labpc: fix 8254 timer programming
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:56 +0000 (12:59 -0700)]
staging: comedi: ni_labpc: fix 8254 timer programming

As pointed out by Ian Abbott, the i8254_load() function does not
use the I8254_MODE* values to specify the "mode".

The labpc_counter_load() function in this driver is passed an
I8254_MODE* value so we need to use the i8254_set_mode() and
i8254_write() helpers instead of i8254_load() to program the
timers.

The calls to labpc_counter_load() will not fail so change the
return to void and remove all the unnecessary error handling.

Similarly, change the return type of labpc_counter_set_mode() to
void and remove the unnecessary error handling.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: das800: clarify 8254 timer programming
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:55 +0000 (12:59 -0700)]
staging: comedi: das800: clarify 8254 timer programming

Refactor the 8254 timer programming to use the i8254_set_mode()
and i8254_write() helpers instead of i8254_load(). This allows
us to use the I8254_MODE* defines to clarify the code.

The das800_set_frequency() function will not fail. For aesthetics
change the return to a void and remove the error handling.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci244: clarify 8254 timer programming
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:54 +0000 (12:59 -0700)]
staging: comedi: amplc_pci244: clarify 8254 timer programming

Refactor the 8254 timer programming to use the i8254_set_mode()
and i8254_write() helpers instead of i8254_load(). This allows
us to use the I8254_MODE* defines to clarify the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: me4000: fix 8254 timer programming
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:53 +0000 (12:59 -0700)]
staging: comedi: me4000: fix 8254 timer programming

As pointed out by Ian Abbott, the i8254_load() function does not
use the I8254_MODE* values to specify the "mode".

Refactor the 8254 timer programming to use the i8254_set_mode()
and i8254_write() helpers instead of i8254_load(). This allows
us to use the I8254_MODE* defines to clarify the code.

Also, use the CR_CHAN() macro to make sure the only the channel is
used in the insh->chanspec to specify the counter number.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: ni_at_ao: fix 8254 timer programming
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:52 +0000 (12:59 -0700)]
staging: comedi: ni_at_ao: fix 8254 timer programming

As pointed out by Ian Abbott, the i8254_load() function does not
use the I8254_MODE* values to specify the "mode".

Refactor the 8254 timer programming to use the i8254_set_mode()
and i8254_write() helpers instead of i8254_load(). This allows
us to use the I8254_MODE* defines to clarify the code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl711: fix 8254 timer programming
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:51 +0000 (12:59 -0700)]
staging: comedi: pcl711: fix 8254 timer programming

As pointed out by Ian Abbott, the i8254_load() function does not
use the I8254_MODE* values to specify the "mode".

Refactor the 8254 timer programming to use the i8254_set_mode()
and i8254_write() helpers instead of i8254_load(). This allows
us to use the I8254_MODE* defines to clarify the code.

For aesthetics, factor the timer programming out as a separate
function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: hwdrv_apci3120: remove clearing of 'b_OutputMemoryStatus'
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:50 +0000 (12:59 -0700)]
staging: comedi: hwdrv_apci3120: remove clearing of 'b_OutputMemoryStatus'

This private data member is not used by this driver. Remove the unnecessary
clearing of it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: hwdrv_apci3120: fix 'b_AiCyclicAcquisition' usage
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:49 +0000 (12:59 -0700)]
staging: comedi: hwdrv_apci3120: fix 'b_AiCyclicAcquisition' usage

This private data member is set when an analog input async command is
started by apci3120_cyclic_ai() and cleared when the command finishes
or is canceled.

Rename the CamelCase member to 'ai_running' and convert it to a
bit-field flag.

Remove the unnecessary clearing of the flag before or after calling
apci3120_cancel().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: hwdrv_apci3120: cmd->convert_src is always TRIG_TIMER
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:48 +0000 (12:59 -0700)]
staging: comedi: hwdrv_apci3120: cmd->convert_src is always TRIG_TIMER

The (*do_cmdtest) validates that the cmd->convert_src can only be
TRIG_TIMER. Remove the unnecessay checks.

THis also simplifies the (*do_cmd) a bit since "mode 3" (whatever that
is) is never a valid mode.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_common.h: remove 'b_AiContinuous' from private data
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:47 +0000 (12:59 -0700)]
staging: comedi: addi_common.h: remove 'b_AiContinuous' from private data

This member of the private data can be determined by checking the cmd->stop_src.
Do that instead.

Fix the b_AiContinuous check in apci3120_ai_cmd(). The (*do_cmdtest) validates
that the cmd->stop_arg os >= 1 for TRIG_COUNT and 0 for TRIG_NONE. The correct
test to set this flag is (cmd->stop_src == TRIG_NONE).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_common.h: remove 'ui_AiNbrofScans' from private data
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:46 +0000 (12:59 -0700)]
staging: comedi: addi_common.h: remove 'ui_AiNbrofScans' from private data

This member of the private data is a copy of the cmd->stop_arg. Use that
instead.

Fix the b_AiContinuous check in apci3120_ai_cmd(). The (*do_cmdtest) validates
that the cmd->stop_arg os >= 1 for TRIG_COUNT and 0 for TRIG_NONE. The correct
test to set this flag is (cmd->stop_src == TRIG_NONE).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_common.h: remove 'ui_AiDataLength' from private data
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:45 +0000 (12:59 -0700)]
staging: comedi: addi_common.h: remove 'ui_AiDataLength' from private data

This member of the private data is a copy of the s->async->prealloc_bufsz.
Use that instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_common.h: remove 'ui_AiTimer1' from private data
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:44 +0000 (12:59 -0700)]
staging: comedi: addi_common.h: remove 'ui_AiTimer1' from private data

This member of the private data is a copy of the cmd->scan_begin_arg.
Use that instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_common.h: remove 'ui_AiTimer0' from private data
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:43 +0000 (12:59 -0700)]
staging: comedi: addi_common.h: remove 'ui_AiTimer0' from private data

This member of the private data is a copy of the cmd->convert_arg. Use
that instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_common.h: remove 'pui_AiChannelList' from private data
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:42 +0000 (12:59 -0700)]
staging: comedi: addi_common.h: remove 'pui_AiChannelList' from private data

This member of the private data is a copy of the cmd->chanlist. Use that
instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_common.h: remove 'ui_AiScanLength' from private data
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:41 +0000 (12:59 -0700)]
staging: comedi: addi_common.h: remove 'ui_AiScanLength' from private data

This member of the private data is a copy of the cmd->scan_end_arg. Use that
instead.

Use a local variable in apci3120_cyclic_ai() for the DMA 'scan_bytes', which
is the cmd->scan_end_arg * 2. Replace the open-coded '2' with sizeof(short).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_common.h: remove 'ui_AiFlags' from private data
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:40 +0000 (12:59 -0700)]
staging: comedi: addi_common.h: remove 'ui_AiFlags' from private data

This member of the private data is a copy of the cmd->flags. Use that instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: remove 'ao_continuous' from private data
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:39 +0000 (12:59 -0700)]
staging: comedi: amplc_pci230: remove 'ao_continuous' from private data

This member of the private data can be determined by checking the cmd->stop_src.
Do that instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: remove 'ai_continuous' from private data
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:38 +0000 (12:59 -0700)]
staging: comedi: amplc_pci230: remove 'ai_continuous' from private data

This member of the private data can be determined by checking the cmd->stop_src.
Do that instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci224: remove 'ai_stop_continuous' from private data
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:37 +0000 (12:59 -0700)]
staging: comedi: amplc_pci224: remove 'ai_stop_continuous' from private data

This member of the private data can be determined by checking the cmd->stop_src.
Do that instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_apci_2032: tidy up cmd use in apci2032_interrupt()
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:36 +0000 (12:59 -0700)]
staging: comedi: addi_apci_2032: tidy up cmd use in apci2032_interrupt()

Use a local variable for the comedi_cmd and tidy up this function a bit.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adl_pci9111: tidy up (*do_cmdtest) Step 4
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:35 +0000 (12:59 -0700)]
staging: comedi: adl_pci9111: tidy up (*do_cmdtest) Step 4

This step in the (*do_cmdtest) fixes the comedi_cmd arguments, usually
for TRIG_TIMER sources.

Tidy up this step to clarify the code and remove the extra local
variables. All the arguments are unsigned long so change the 'tmp'
local variable type and rename it for aesthetics.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: 8253.h: remove the unused i8253_cascade_ns_to_timer_*()
H Hartley Sweeten [Tue, 29 Apr 2014 19:59:34 +0000 (12:59 -0700)]
staging: comedi: 8253.h: remove the unused i8253_cascade_ns_to_timer_*()

None of the comedi drivers use the i8253_cascade_ns_to_timer_2div_old()
or i8253_cascade_ns_to_timer_power() helpers to calculate the cascaded
divisors. Remove them to avoid any confusion.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>