1
0
Fork 0
Commit Graph

809 Commits (c757cbafd6afe8e47d12320aa05edcd1b1d97186)

Author SHA1 Message Date
Lars-Peter Clausen bdc8cda1d0 iio:adc: Add Xilinx XADC driver
The Xilinx XADC is a ADC that can be found in the series 7 FPGAs from Xilinx.
The XADC has a DRP interface for communication. Currently two different
frontends for the DRP interface exist. One that is only available on the ZYNQ
family as a hardmacro in the SoC portion of the ZYNQ. The other one is available
on all series 7 platforms and is a softmacro with a AXI interface. This driver
supports both interfaces and internally has a small abstraction layer that hides
the specifics of these interfaces from the main driver logic.

The ADC has a couple of internal channels which are used for voltage and
temperature monitoring of the FPGA as well as one primary and up to 16 channels
auxiliary channels for measuring external voltages. The external auxiliary
channels can either be directly connected each to one physical pin on the FPGA
or they can make use of an external multiplexer which is responsible for
multiplexing the external signals onto one pair of physical pins.

The voltage and temperature monitoring channels also have an event capability
which allows to generate a interrupt when their value falls below or raises
above a set threshold.

Buffered sampling mode is supported by the driver, but only for AXI-XADC since
the ZYNQ XADC interface does not have capabilities for supporting buffer mode
(no end-of-conversion interrupt). If buffered mode is supported the driver will
register two triggers. One "xadc-samplerate" trigger which will generate samples
with the configured samplerate. And one "xadc-convst" trigger which will
generate one sample each time the CONVST (conversion start) signal is asserted.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-03-01 21:04:29 +00:00
Johannes Thumshirn 74aeac4da6 iio: adc: Add MEN 16z188 ADC driver
Add support for MEN 16z188 ADC IP Core on MCB FPGAs.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-28 15:47:57 -08:00
Peter Meerwald b2addb4a11 iio:magnetometer:mag3110: Fix unreachable code
drivers/iio/magnetometer/mag3110.c:197 mag3110_read_raw()
        info: ignoring unreachable code.

drivers/iio/magnetometer/mag3110.c
   185          case IIO_CHAN_INFO_SCALE:
   186                  switch (chan->type) {
   187                  case IIO_MAGN:
   188                          *val = 0;
   189                          *val2 = 1000;
   190                          return IIO_VAL_INT_PLUS_MICRO;
   191                  case IIO_TEMP:
   192                          *val = 1000;
   193                          return IIO_VAL_INT;
   194                  default:
   195                          return -EINVAL;
   196                  }
   197                  return IIO_VAL_INT_PLUS_MICRO;
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

introduced by f9279d3a, mag3110: Scale factor missing

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-25 20:45:58 +00:00
Lars-Peter Clausen b91accafbb iio:event: Fix and cleanup locking
The event code currently holds a spinlock with IRQs disabled while calling
kfifo_to_user(). kfifo_to_user() can generate a page fault though, which means
we have to be able to sleep, which is not possible if the interrupts are
disabled. The good thing is that kfifo handles concurrent read and write access
just fine as long as there is only one reader and one writer, so we do not any
locking to protect against concurrent access from the read and writer thread. It
is possible though that userspace is trying to read from the event FIFO from
multiple concurrent threads, so we need to add locking to protect against this.
This is done using a mutex. The mutex will only protect the kfifo_to_user()
call, it will not protect the waitqueue. This means that multiple threads can be
waiting for new data and once a new event is added to the FIFO all waiting
threads will be woken up. If one of those threads is unable to read any data
(because another thread already read all the data) it will go back to sleep. The
only remaining issue is that now that the clearing of the BUSY flag and the
emptying of the FIFO does no longer happen in one atomic step it is possible
that a event is added to the FIFO after it has been emptied and this sample will
be visible the next time a new event file descriptor is created. To avoid this
rather move the emptying of the FIFO from iio_event_chrdev_release to
iio_event_getfd().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-23 15:53:25 +00:00
Denis CIOCCA 931878405b iio:pressure: Add support for LPS25H pressure sensor
This patch adds support for the new barometer sensor: LPS25H.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-22 13:09:53 +00:00
Archana Patni f64a799b8a iio: hid-sensors: Added Pressure Sensor driver
Added usage id processing for Pressure Sensor. This uses IIO
interfaces for triggered buffer to present data to user
mode. This uses HID sensor framework for registering callback
events from the sensor hub.

Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-22 13:07:06 +00:00
Archana Patni 39a3a0138f iio: hid-sensors: Added Proximity Sensor Driver
Added usage id processing for Proximity (Human Presence).
This uses IIO interfaces for triggered buffer to present data
to user mode. This uses HID sensor framework for registering
callback events from the sensor hub.

Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-22 13:07:01 +00:00
Lars-Peter Clausen 7bbcf7e136 iio: Avoid unnecessary kasprintf
name_format already contains the final name and no format characters. So the
code basically reads:

	dev_attr->attr.name = kstrdup(GFP_KERNEL, name_format);
	if (dev_attr->attr.name == NULL)
		...
	kfree(name_format);

Which means we can save one alloc and free pair per attribute name if we
directly assign name_format to dev_attr->attr.name.

The patch also renames name_format to name to denote that this is indeed the
final name and has no format characters in it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-18 10:31:11 +00:00
Lars-Peter Clausen 77bfa8baa0 iio: Don't include extended name in shared attributes
The extended name is channel specific and should not be included in shared
attributes.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-18 10:26:55 +00:00
Denis CIOCCA a065771641 iio:gyro: bug on L3GD20H gyroscope support
The driver was not able to manage the sensor: during probe function
and wai check, the driver stops and writes: "device name and WhoAmI mismatch."
The correct value of L3GD20H wai is 0xd7 instead of 0xd4.
Dropped support for the sensor.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-18 10:24:49 +00:00
Beomho Seo 1463a166b4 iio: cm32181: Change cm32181 ambient light sensor driver
Integration time of cm32181 is guessed about milliseconds.
But cm32181_read_als_it function return IIO_VAL_INT.
So fixed to return IIO_VAL_INT_PLUS_MICRO.
Next, add .write_raw_get_fmt callback function for call iio_str_to_fixpoint.

v2: cm32181_write_als_id function fixed as it was.

Cc: Kevin Tsai <ktsai@capellamicro.com>
Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-18 10:22:30 +00:00
Beomho Seo 26c17a1c56 iio: cm36651: Fix read/write integration time function.
This patch is fixed [read/write] integration time function.
cm36651 have integration time from 1 to 640 milliseconds.
But, print more then the thousand second. when call *_integration_time attribute.
Because read_integration_time function return IIO_VAL_INT.
read integration time function is changed return IIO_VAL_INT_PLUS_MICRO;
And then .write_raw_get_fmt callback function for parse a fixed-point number from a string.
Some description is revised milliseconds unit.

v2: cm36651_write_int_time function fixed as it was.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-18 10:22:29 +00:00
Hartmut Knaack 92825ff974 iio get rid of unneccessary error_ret
Get rid of obsolete uses of goto error_ret and some empty lines.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-18 08:46:36 +00:00
Hartmut Knaack b8a70aef04 iio:max1363 fix typos of int_vref_mv
This patch fixes some typos in max1363_chip_info_tbl[].

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-18 08:44:11 +00:00
Srinivas Pandruvada 1a214ae5d1 iio: hid-sensor-hub: Remove hard coded indexes
Remove the hard coded indexes, instead search for usage id and
use the index to set the power and report state.
This will fix issue, where the report descriptor doesn't contain
the full list of possible selector for power and report state.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-17 15:09:47 +01:00
Peter Meerwald 5c1449d41e iio:accel:bma180: Make LOW_PASS_FILTER_3DB_FREQUENCY shared_by_type
the property is not per-channel, but shared by type

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Kravchenko Oleksandr <x0199363@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-15 11:05:02 +00:00
Fugang Duan a775427632 iio:adc:imx: add Freescale Vybrid vf610 adc driver
Add Freescale Vybrid vf610 adc driver. The driver only support
ADC software trigger.

VF610 ADC device documentation is available at below reference manual
(chapter 37):
http://cache.freescale.com/files/32bit/doc/ref_manual/VYBRIDRM.pdf?
fpsp=1&WT_TYPE=Reference%20Manuals&WT_VENDOR=FREESCALE&WT_FILE_FORMAT
=pdf&WT_ASSET=Documentation

CC: Shawn Guo <shawn.guo@linaro.org>
CC: Jonathan Cameron <jic23@kernel.org>
CC: Mark Rutland <mark.rutland@arm.com>
CC: Otavio Salvador <otavio@ossystems.com.br>
CC: Peter Meerwald <pmeerw@pmeerw.net>
CC: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-15 10:29:11 +00:00
Peter Meerwald f9279d3a8c iio:magnetometer:mag3110: Scale factor missing for temperature
temperature is reported in milli-Celsius

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-15 09:54:46 +00:00
Greg Kroah-Hartman e5b9c05772 First set of new drivers and cleanups for IIO in the 3.15 cycle.
New drivers:
 * si7005 relative humidity and temperature sensor
 * Lite-on ltr501 ambient light and proximity sensor
 
 Cleanups
 * Clean up some dead comments in max1363
 * Drop some obsolete variables in adjd_s311 and tcs3472 left over from
   the introduction of iio_push_to_buffers_with_timestamp.
 * Drop some unneeded linux/init.h includes
 * Squish a sparse warning in mpl3115 by correctly specifying a be32 variable.
 * A number of cleanups and fixes for sca3000
 * Drop an unneed checks in mxs-lradc, ad7303 and adis16400.
 * Drop a platform_set_drvdata in viperboard after the only use of it was
   removed during a devm conversion.
 * Add a missing device name for ak8975 to comply with the ABI.
 * Put mpu6050 into the IMU menu as it slipped out into the main menu.
 * Fix a typo and some comment formatting in mpu6050.
 * Document at91 ADC clock properties.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJS+R3TAAoJEFSFNJnE9BaILtoP/RiZaeAQe5hKVtS7DBNmtbvH
 NVrk4SDl8F5WH6O6MKvRn54aBWyPj3axyMb0WLv9oGQycxlflT/420Q1UaayG4oX
 W1IOS/X2JNrWpt/xlNPi8crqpcRZbLVjKoRGhw0BMR9OTD+x6U+NTNGpr9WJUNAB
 CjmYpa6MhouQMd59+HMroSf1PIvBfvG2fkAMg2AoRSQ6TU19q5Yi0zzqwS17iZf3
 VTazh63dVKYyt3MJimjnGcA4A2kv5YOrfK59qYfHPIVR4AfKNVKlwVQlu8TlBaXE
 eYr2G1Jbd/GRkUe5FRGL9Nlnl8exnUU8JGCTpeXSJSmDWAe2xVkjTNbDDyrT5Gem
 6c02ms0xYeIxqzYpZVZs8OueuZhs2DztcT0e+p7ByvjBZ+XvMEp9t00DnsV3rSEa
 Y9X1vpeZei5bRW+woKCniEhV/89seUe1ASyj/g8yiPYc5b1mKhcUQKFs1vCToWjV
 v0MEp15569jeqX+6igOAloArxykrdmS4hAeMfyKoijApd97n5hkK2jwjFxRv9rZs
 2Q+2qTDA/3E9+wRjLrx4v+Bu6EKH44K5Z5H5rPmnsgRe8/0UQx4xvhI6Bv2Krx0v
 CKdwNAo6Z5iePAtmaMU46l9h1AygOAzub9V2L36Irxd4BFLLYUj1zSW2hN1zgfCX
 4YTgPtTGZ/lBfNsvBy9b
 =nSiE
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-3.15a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

First set of new drivers and cleanups for IIO in the 3.15 cycle.

New drivers:
* si7005 relative humidity and temperature sensor
* Lite-on ltr501 ambient light and proximity sensor

Cleanups
* Clean up some dead comments in max1363
* Drop some obsolete variables in adjd_s311 and tcs3472 left over from
  the introduction of iio_push_to_buffers_with_timestamp.
* Drop some unneeded linux/init.h includes
* Squish a sparse warning in mpl3115 by correctly specifying a be32 variable.
* A number of cleanups and fixes for sca3000
* Drop an unneed checks in mxs-lradc, ad7303 and adis16400.
* Drop a platform_set_drvdata in viperboard after the only use of it was
  removed during a devm conversion.
* Add a missing device name for ak8975 to comply with the ABI.
* Put mpu6050 into the IMU menu as it slipped out into the main menu.
* Fix a typo and some comment formatting in mpu6050.
* Document at91 ADC clock properties.
2014-02-11 14:12:12 -08:00
Manuel Stahl 7da773e618 iio: imu: inv_mpu6050: Fix typo and formatting
Signed-off-by: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-08 12:29:40 +00:00
Manuel Stahl ed10557fce iio: imu: mpu6050: Move config entry into IMU menu
Signed-off-by: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-08 12:27:30 +00:00
Guenter Roeck 55b40d3731 iio: max1363: Use devm_regulator_get_optional for optional regulator
In kernel version 3.13, devm_regulator_get() may return no error
if a regulator is undeclared. regulator_get_voltage() will return
-EINVAL if this happens. This causes the driver to fail loading if
the vref regulator is not declared.

Since vref is optional, call devm_regulator_get_optional instead.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Cc: Stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-08 11:46:00 +00:00
Peter Meerwald 5585215b6d iio:accel:bma180: Use modifier instead of index in channel specification
This driver was not complying with the ABI and the purpose of this patch
is to bring it inline so that userspace will correctly identify the channels.

Should use channel modifiers (X/Y/Z), not channel indices
timestamp channel has scan index 3, not 4

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Kravchenko Oleksandr <x0199363@ti.com>
Cc: Stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-08 11:31:50 +00:00
Marcus Folkesson c76782d151 iio: adis16400: Set timestamp as the last element in chan_spec
This is necessary since timestamp is calculated as the last element
in iio_compute_scan_bytes().

Without this fix any userspace code reading the layout of the buffer via
sysfs will incorrectly interpret the data leading some nasty corruption.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-08 11:26:06 +00:00
Beomho Seo 54ab3e244d iio: ak8975: Add device name
This patch add device name.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-08 10:31:29 +00:00
Beomho Seo bef44abccb iio: ak8975: Fix calculation formula for convert micro tesla to gauss unit
This effects the reported scale of the raw values, and thus userspace
applications that use this value.

One micro tesla equal 0.01 gauss. So I have fixed calculation formula And add RAW_TO_GAUSS macro.
ASA is in the range of 0 to 255. If multiply 0.003, calculation result(in_magn_[*]_scale) is
always 0. So multiply 3000 and return and IIO_VAL_INT_PLUS_MICRO.
As a result, read_raw call back function return accurate scale value.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-08 10:28:05 +00:00
Peter Meerwald 71bd89454d iio:magnetometer:mag3110: Fix output of decimal digits in show_int_plus_micros()
need to print leading zeros, hence "%d.%06d"

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-08 10:06:27 +00:00
Peter Meerwald f25330f63e iio:magnetometer:mag3110: Report busy in _read_raw() / write_raw() when buffer is enabled
individual reads are not permitted concurrently with buffered reads

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-08 10:06:22 +00:00
Greg Kroah-Hartman 81e990bbde First set of IIO fixes for the 3.14 cycle.
Included is the patch previously set as the fourth round for 3.13 which was
 to late to be appropriate.
 
 * Another endian fix (ad799x adc) due to missuse of the IIO_ST macro (which
   is going away very shortly)
 * A reversed error check in ad5933 which will make the probe fail.
 * A buffer overflow in the example code in the documentation.
 * ad799x was freeing an irq that might or might not have been requested.
 * tsl2563 was checking the wrong element of chan_spec for modifiers. Thus some
   sysfs reads would give the wrong values.
 * A missing dependency on HAS_IOMEM in spear_adc and lpc32xx was causing some
   test build failures (on s390 and perhaps elsewhere).
 
 I also have a few fixes queued up for things that went in during the 3.14
 merge window which will follow as a separate pull request (to avoid rebasing
 my tree).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJS7+bmAAoJEFSFNJnE9BaIBEIP/Ry6x7SbKwjP71dO0gSrCmbf
 WLO7yE+jy3MRkua/vhRn2nRx76Mk4N0NfZ7aSxja3gE/UMIgDUG0QC5tJgVm+Sol
 rUr+TOn9vrBhvJWoaOuZerkfdEiP1AUE034sQ4BXPm8M+zpf/1t2nRXslFPGx0hw
 bq+XBhBpB2pBlmn8Z6q9DK279elh1cmhuJyFK4BEEa98/fLCfkLoKPWD3L/uDS6/
 ne33LqvcKPgCkEToX5FoSeCibnQI673LgR2zuxfljxVYnkO7y8IqdzwJDExpsNzW
 mGYIrnuGM6ocXe8vIqkqknD9x8xST+mCGrpIUC0MD9eq5AIRzttxZoYKclq3kTTQ
 bukrbuqkiGyC2Hwe50A4+bWM06I8yu/NDUuGxCvKfy26wqwAtXlKGTzwJUg6jHBU
 rssMhYbBLSKmyl0sFlH1xwaHGDZKDNHWz60GpdO2OS516U37JkGvRvRg2bkgomps
 w4OoqXgspE5F1CCnRgy2NYIbN+UlJWY4SGO/boCor5JonYkWnmTq+0sQ4XxehAqc
 sTPW7vXITTkGJmrAgRWmBReI0iE03sC2CDZIOLlGOczJ4tDj7iRh1EN1tAB7gGV8
 n3rIZaE5AfAGKNgLcgF5WaVbnxm/Pd9dr+JdjcFv+I8imKiLCCnj/U23WaD27kUt
 RnMueM0Uu7I1hD3BSbDx
 =otUr
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-3.14a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

Jonathan writes:

First set of IIO fixes for the 3.14 cycle.

Included is the patch previously set as the fourth round for 3.13 which was
to late to be appropriate.

* Another endian fix (ad799x adc) due to missuse of the IIO_ST macro (which
  is going away very shortly)
* A reversed error check in ad5933 which will make the probe fail.
* A buffer overflow in the example code in the documentation.
* ad799x was freeing an irq that might or might not have been requested.
* tsl2563 was checking the wrong element of chan_spec for modifiers. Thus some
  sysfs reads would give the wrong values.
* A missing dependency on HAS_IOMEM in spear_adc and lpc32xx was causing some
  test build failures (on s390 and perhaps elsewhere).

I also have a few fixes queued up for things that went in during the 3.14
merge window which will follow as a separate pull request (to avoid rebasing
my tree).
2014-02-07 08:57:00 -08:00
Dan Carpenter a04cf55a52 iio: dac: ad7303: remove an unneeded check
"ret" is zero here.  There is no need to check again.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-03 21:44:42 +00:00
Dan Carpenter 7638c2ed9c iio:imu:adis16400 remove an unneeded check
We know "ret" is zero here so there is no need to check.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-03 21:43:22 +00:00
Johannes Thumshirn 97b6ee5253 iio: adc: viperboard: Drop platform_set_drvdata call
Drop call to platform_set_drvdata as driver data is not used anywhere in the
driver

Signed-off-by: Johannes Thumshirn <morbidrsa@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-03 19:27:59 +00:00
Linus Torvalds bb1281f2aa Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree updates from Jiri Kosina:
 "Usual rocket science stuff from trivial.git"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits)
  neighbour.h: fix comment
  sched: Fix warning on make htmldocs caused by wait.h
  slab: struct kmem_cache is protected by slab_mutex
  doc: Fix typo in USB Gadget Documentation
  of/Kconfig: Spelling s/one/once/
  mkregtable: Fix sscanf handling
  lp5523, lp8501: comment improvements
  thermal: rcar: comment spelling
  treewide: fix comments and printk msgs
  IXP4xx: remove '1 &&' from a condition check in ixp4xx_restart()
  Documentation: update /proc/uptime field description
  Documentation: Fix size parameter for snprintf
  arm: fix comment header and macro name
  asm-generic: uaccess: Spelling s/a ny/any/
  mtd: onenand: fix comment header
  doc: driver-model/platform.txt: fix a typo
  drivers: fix typo in DEVTMPFS_MOUNT Kconfig help text
  doc: Fix typo (acces_process_vm -> access_process_vm)
  treewide: Fix typos in printk
  drivers/gpu/drm/qxl/Kconfig: reformat the help text
  ...
2014-01-22 21:21:55 -08:00
Linus Torvalds ac26663572 MFD changes due for the v3.14 merge window
New drivers
  - Samsung Maxim 14577; Micro USB, Regulator, IRQ Controller and Battery Charger
  - TI/National Semiconductor LP3943 I2C GPIO Expander and PWM Generator
 
 Existing driver adaptions
  - Expansion of Wolfson Arizona DSP and High-Pass filter controls
  - TI TWL6040 default Regmap support and Regcache addition/bypass
  - Some nice Smatch catch fixes
  - Conversion of TI OMAP-USB and TI TWL6030 to endian neutralness
  - ChromeOS EC timing (delay) adaptions and added dependency on OF
  - Many constifications of 'struct {mfd_cell,regmap_irq,et. al}'
  - Watchdog support added for NVIDIA AS3722
  - Convert functions to static in TI AM335x
  - Realigned previously defeated functionality in TI AM335x
  - IIO ADC-TSC concurrency dead-lock/timeout resolution
  - Addition of Power Management and Clock support for Samsung core
  - DEFINE_PCI_DEVICE_TABLE macro removal from MFD Subsystem
  - Greater use of irqdomain functionality in ST-E AB8500
  - Removal of 'include/linux/mfd/abx500/ab8500-gpio.h'
  - Wolfson WM831x PMIC Power Management changes s/poweroff/shutdown/
  - Device Tree documentation added for TI/Nat Semi LP3943
  - Version detection and voltage tables for TI TPS6586x PMIC devices
  - Simplification of Freescale MC13XXX (de-)initialisation routines
  - Clean-up and simplification of the Realtek parent driver
  - Added support for RTL8402 Realtek PCI-Express card reader
  - Resource leak fix for Maxim 77686
  - Possible suspend BUG() fix in OMAP USB TLL
  - Support for new Wolfson WM5110 Revision (D)
  - Testing of automatic assignment of of_node in mfd_add_device()
    - Reversion of the above when it started to cause issues
  - Remove legacy Platform Data from;
               TI TWL Core, Qualcomm SSBI and ST-E ABx500 Pinctrl
  - Clean-ups; tabbing issues, function name changes, 'drvdata = NULL' removal,
               unused uninitialised warning mitigation, error message clarity,
               removal of redundant/duplicate checks, licensing (GPL -> GPL2),
               coding consistency, duplicate function declaration, ret checks,
               commit corrections, redundant of_match_ptr() helper removal,
               spelling, #if-deffery removal and header guards name changes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.14 (GNU/Linux)
 
 iQIbBAABAgAGBQJS3pLGAAoJEFGvii+H/HdhmkkP93Hrd9FBjVpmUQcOrghFDd//
 vte2LVDovXDcwm7i+BdZNG3+2aWtliTQXIw8PaAziUTwMlDNtT2B6GBFnIff4aXB
 Em/Oh6Je7r1gom1gMPCuefRrInTk0xEXy9Oazp4Hn4in71T+8PHNlEHdxEojakEm
 H5FnjAfgISEsA5twSyO9efVLNqPd3UQqg3O571oKwfuSED70YSCW2Yyaoiz4pnE5
 0WwZ9cel+sP7CIuyuR4TumUSDeBIAnYnZWqjqXZ1ueMWcm2RNVqeFrt/w0uoZjOA
 yBg8ZMfkBcePd6qnifqVqagRW/jW1bxmUeIHkp0bWeMqWN6Yyypitz8ZW+Qi7Swa
 OcmgM9V7OW1WG9FF7HoLbYHIPzmBb6duGtcCfAir4m8HJjyPfTuJpOshBW1F3+VG
 yEf5a1fj2NO34kvIbLec2f7MveIMmZxzWaoOx+ET9/WPknilifgyp7eDH24pQwI4
 5Lo5Z5uAfBCT3roOzHxCLl2nVXQoC66iTwdnneiEOn4rB/ApjfGVvGGd0VT6TD+g
 z3RqxpTdkd0AtjfeF778uTDBEKu7HZkqmlBP8HKWCBEAzqcKg7BpjYw0ajgmVwKr
 QiuBuWcEZ/2vVt8Qot7y5Vx89Q4AQwOqc24SldtQLu46iPAuKt+GizzHRw3IxBiQ
 VU9Aq/VoaTHBLS91tDE=
 =PuTE
 -----END PGP SIGNATURE-----

Merge tag 'mfd-3.14-1' of git://git.linaro.org/people/ljones/mfd

Pull MFD changes from Lee Jones:
 "New drivers
   - Samsung Maxim 14577; Micro USB, Regulator, IRQ Controller and
     Battery Charger
   - TI/National Semiconductor LP3943 I2C GPIO Expander and PWM
     Generator

  Existing driver adaptions
   - Expansion of Wolfson Arizona DSP and High-Pass filter controls
   - TI TWL6040 default Regmap support and Regcache addition/bypass
   - Some nice Smatch catch fixes
   - Conversion of TI OMAP-USB and TI TWL6030 to endian neutralness
   - ChromeOS EC timing (delay) adaptions and added dependency on OF
   - Many constifications of 'struct {mfd_cell,regmap_irq,et.al}'
   - Watchdog support added for NVIDIA AS3722
   - Convert functions to static in TI AM335x
   - Realigned previously defeated functionality in TI AM335x
   - IIO ADC-TSC concurrency dead-lock/timeout resolution
   - Addition of Power Management and Clock support for Samsung core
   - DEFINE_PCI_DEVICE_TABLE macro removal from MFD Subsystem
   - Greater use of irqdomain functionality in ST-E AB8500
   - Removal of 'include/linux/mfd/abx500/ab8500-gpio.h'
   - Wolfson WM831x PMIC Power Management changes s/poweroff/shutdown/
   - Device Tree documentation added for TI/Nat Semi LP3943
   - Version detection and voltage tables for TI TPS6586x PMIC devices
   - Simplification of Freescale MC13XXX (de-)initialisation routines
   - Clean-up and simplification of the Realtek parent driver
   - Added support for RTL8402 Realtek PCI-Express card reader
   - Resource leak fix for Maxim 77686
   - Possible suspend BUG() fix in OMAP USB TLL
   - Support for new Wolfson WM5110 Revision (D)
   - Testing of automatic assignment of of_node in mfd_add_device()
   - Reversion of the above when it started to cause issues
   - Remove legacy Platform Data from;
              TI TWL Core, Qualcomm SSBI and ST-E ABx500 Pinctrl
   - Clean-ups; tabbing issues, function name changes, 'drvdata = NULL'
              removal, unused uninitialised warning mitigation, error
              message clarity, removal of redundant/duplicate checks,
              licensing (GPL -> GPL2), coding consistency, duplicate
              function declaration, ret checks, commit corrections,
              redundant of_match_ptr() helper removal, spelling,
              #if-deffery removal and header guards name changes"

* tag 'mfd-3.14-1' of git://git.linaro.org/people/ljones/mfd: (78 commits)
  mfd: wm5110: Add register patch for rev D chip
  mfd: omap-usb-tll: Don't hold lock during pm_runtime_get/put_sync()
  gpio: lp3943: Remove redundant of_match_ptr helper
  mfd: sta2x11-mfd: Use named constants for pci_power_t values
  Documentation: mfd: Fix LDO index in s2mps11.txt
  mfd: Cleanup mfd-mcp-sa11x0.h header
  mfd: max8997: Use "IS_ENABLED(CONFIG_OF)" for DT code.
  mfd: twl6030: Fix endianness problem in IRQ handler
  mfd: sec-core: Add cells for S5M8767-clocks
  mfd: max14577: Remove redundant of_match_ptr helper
  mfd: twl6040: Fix sparse non static symbol warning
  mfd: Revert "mfd: Always assign of_node in mfd_add_device()"
  mfd: rtsx: Fix sparse non static symbol warning
  mfd: max77693: Set proper maximum register for MUIC regmap
  mfd: max77686: Fix regmap resource leak on driver remove
  mfd: Represent correct filenames in file headers
  mfd: rtsx: Add support for card reader rtl8402
  mfd: rtsx: Add set pull control macro and simplify rtl8411
  mfd: max8997: Enforce mfd_add_devices() return value check
  mfd: mc13xxx: Simplify probe() & remove()
  ...
2014-01-21 10:58:17 -08:00
Lee Jones 28b4c2948f Immutable branch for IIO and Input
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJSy79CAAoJEFGvii+H/Hdh3ZcQALTHjbU85CljM+tDsQUC3ugi
 uMQZxf2YEWDmLE1epcGbQ22EVdI2s59jFs8tEUBSOqbUXm+Oyuf8zdjenibnOoht
 epKvlRgUGXZA4A90YsJjVLSkn2Nl/QvyKhjU7n9KTH6rnPFGOw2Ja5n7cLy3DtNY
 vsSwHRtOrV5tWMSJQbGamz9cGujhAli5kHQ+hPUKNeaztSGFbpl02SsV8oJ/Dlbg
 juzjY9QDMnKjiSjA0ZtvUIJoyU5yJuRtrBM02SsvXAVPTZpMEaM5P7dO3lqPSXzK
 jUZuMszrB8gV0NxeSkdiWYUZ89rpoSVYv6EW/pg87OvTxukHyB4oi1+/3YXYdNgj
 8kDVhL/BKPdqLw9vo7WbvnZJz99qNyh7R4ZOf90Yv+3BOAPue0WdDQjZw/5p41Ur
 8+VRc1SvOSzXDuNIon97DmpKk477i3ylMiAeqi+b7ynzgvJqGayFf0KUHlUHmKjM
 ZNKHl2sd9qvft5WUX1P02ihc9/j8LMF5h8WX8Et1/a05SXn1LvfK5HJQk9ZHB94m
 ZaXwEOirbHAVyTlQre1zYncBWtlsLlOJT+c0G+HjFX99+79u0KxFyUTpXgfypJUe
 5UGQjM/w+CcVpl6h58k65PjyGRRweVUkqnoAnOpVGCRvIx4sU1g5nF9usEb8omDA
 PODxF76LVgohEozCwGpq
 =Tc4K
 -----END PGP SIGNATURE-----

Merge tag 'ib-iio-input-3.13-1' into for-mfd-next

Immutable branch for IIO and Input
2014-01-21 08:26:55 +00:00
Ivaylo Dimitrov 3b5c1635d1 iio: tsl2563: Use the correct channel2 member
Use the correct channel2 member instead of channel when dealing with sysfs
reads/writes

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Acked-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-01-18 11:36:04 +00:00
Peter Meerwald 2690be9051 iio: Add Lite-On ltr501 ambient light / proximity sensor driver
combined ambient light (two channels) and proximity sensor with I2C
interface; the ALS channels are visible+IR and IR

datasheet is here
http://optoelectronics.liteon.com/upload/download/DS86-2012-0006/P_100_LTR-501ALS-01_PrelimDS_ver1.1.pdf

v3:
* fix use of sizeof in _read_als()
v2: (thanks to Lars-Peter Clausen)
* cannot use devm_iio_device_register() due to cleanup order in _remove()
* mutex around data wait/read
* turn info message in _probe() into check for part number
* change copyright year to 2014

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-01-12 18:15:40 +00:00
Peter Meerwald 4a2bbdb45e iio:pressure:mpl3115: Fix sparse cast to restricted __be32 warning
>> >> drivers/iio/pressure/mpl3115.c:101:46: sparse: cast to restricted __be32
>> >> drivers/iio/pressure/mpl3115.c:115:46: sparse: cast to restricted __be32

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-01-11 16:15:32 +00:00
Paul Gortmaker 36eb8cc2ce iio: delete non-required instances of include <linux/init.h>
None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>.  Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-01-11 11:59:00 +00:00
Peter Meerwald 92a18a841b iio: Remove obsolete variable in tcs3472 driver
len variable became obsolete with
iio_push_to_buffers_with_timestamp()

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-01-11 11:51:33 +00:00
Peter Meerwald 4f38521b38 iio: Remove obsolete variable in adjd_s311 driver
len variable become obsolete with
iio_push_to_buffers_with_timestamp()

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-01-11 11:51:33 +00:00
Vivien Didelot 82b7afbc8a iio:adc:max1363 clear list of missing features
Remove "Control of internal reference" from the list of unimplemented
features, since as of commit a405b00, external reference is supported if
the device has a regulator and falls back to internal if it doesn't.

While we are modifying the header, let's make it more concise and remove
a redundant filename.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-01-11 11:33:36 +00:00
Peter Meerwald 049973b23a iio: Add si7005 relative humidity and temperature sensor driver
sensor provides 12-bit relative humidity and 14-bit temperature
via I2C interface; temperature and linearity compensation is not
implemented (yet)

driver also supports the Si7015, but not the 2nd generation
sensors Si7013/Si7020/Si7021

datasheet is here
http://www.silabs.com/Support%20Documents/TechnicalDocs/Si7005.pdf

v2: (thanks to Lars-Peter Clausen)
* fix coding style
* use devm_iio_device_register()
* change copyright year to 2014

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-01-11 11:12:44 +00:00
Sebastian Andrzej Siewior 7ca6740cd1 mfd: input: iio: ti_amm335x: Rework TSC/ADC synchronization
The ADC driver always programs all possible ADC values and discards
them except for the value IIO asked for. On the am335x-evm the driver
programs four values and it takes 500us to gather them. Reducing the number
of conversations down to the (required) one also reduces the busy loop down
to 125us.

This leads to another error, namely the FIFOCOUNT register is sometimes
(like one out of 10 attempts) not updated in time leading to EBUSY.
The next read has the FIFOCOUNT register updated.
Checking for the ADCSTAT register for being idle isn't a good choice either.
The problem is that if TSC is used at the same time, the HW completes the
conversation for ADC *and* before the driver noticed it, the HW begins to
perform a TSC conversation and so the driver never seen the HW idle. The
next time we would have two values in the FIFO but since the driver reads
everything we always see the current one.
So instead of polling for the IDLE bit in ADCStatus register, we should
check the FIFOCOUNT register. It should be one instead of zero because we
request one value.

This change in turn leads to another error. Sometimes if TSC & ADC are
used together the TSC starts generating interrupts even if nobody
actually touched the touchscreen. The interrupts seem valid because TSC's
FIFO is filled with values for each channel of the TSC. This condition stops
after a few ADC reads but will occur again. Not good.

On top of this (even without the changes I just mentioned) there is a ADC
& TSC lockup condition which was reported to me by Jeff Lance including the
following test case:
A busy loop of "cat /sys/bus/iio/devices/iio\:device0/in_voltage4_raw"
and a mug on touch screen. With this setup, the hardware will lockup after
something between 20 minutes and it could take up to a couple of hours.
During that lockup, the ADCSTAT register says 0x30 (or 0x70) which means
STEP_ID = IDLE and FSM_BUSY = yes. That means the hardware says that it is
idle and busy at the same time which is an invalid condition.

For all this reasons I decided to rework this TSC/ADC part and add a
handshake / synchronization here:
First the ADC signals that it needs the HW and writes a 0 mask into the
SE register. The HW (if active) will complete the current conversation
and become idle. The TSC driver will gather the values from the FIFO
(woken up by an interrupt) and won't "enable" another conversation.
Instead it will wake up the ADC driver which is already waiting. The ADC
driver will start "its" conversation and once it is done, it will
enable the TSC steps so the TSC will work again.

After this rework I haven't observed the lockup so far. Plus the busy
loop has been reduced from 500us to 125us.

The continues-read mode remains unchanged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-01-07 08:45:00 +00:00
Sebastian Andrzej Siewior 3954b7bfc6 mfd: ti_am335x: Drop am335x_tsc_se_update() from resume path
The update of the SE register in MFD doesn't look right as it has
nothing to do with it. The better place to do it is in TSC driver (which
is already doing it) and in the ADC driver which needs this only in the
continues mode.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-01-07 08:42:38 +00:00
Sebastian Andrzej Siewior 7e170c6e4f mfd: ti_am335x_tscadc: Don't read back REG_SE
The purpose of reg_se_cache has been defeated. It should avoid the
read-back of the register to avoid the latency and the fact that the
bits are reset to 0 after the individual conversation took place.

The reason why this is required like this to work, is that read-back of
the register removes the bits of the ADC so they do not start another
conversation after the register is re-written from the TSC side for the
update.
To avoid the not required read-back I introduce a "set once" variant which
does not update the cache mask. After the conversation completes, the
bit is removed from the SE register anyway and we don't plan a new
conversation "any time soon". The current set function is renamed to
set_cache to distinguish the two operations.
This is a small preparation for a larger sync-rework.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-01-07 08:41:15 +00:00
Sebastian Andrzej Siewior fb7f8ce3bc iio: ti_am335x_adc: Adjust the closing bracket in tiadc_read_raw()
It somehow looks like the ending bracket belongs to the if statement but
it does belong to the while loop. This patch moves the bracket where it
belongs.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-01-07 08:37:18 +00:00
Kevin Tsai 971672c0b3 iio: add Capella CM32181 ambient light sensor driver.
Add Capella Microsystem CM32181 Ambient Light Sensor IIO driver.
This driver will convert raw data to lux value under open-air
condition. Change the calibscale based on the cover material.

Signed-off-by: Kevin Tsai <ktsai@capellamicro.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-01-01 12:03:32 +00:00
Greg Kroah-Hartman a6e8e3a470 2nd round of new IIO drivers, features and cleanups for the 3.14 cycle.
New drivers
 
 * HID inclinometer driver.
 
 * DHT11 humidity driver.  Note that previous humidity drivers have been in
   hwmon, but no one was ever entirely happy with that, and they should find
   a more comfortable home in IIO (their original placement in hwmon was my
   fault - oops).  As this is our first humidity driver, core support is also
   added.
 
 New features
 
 * Two of mxs-lradc channels are internally wired to a temperature sensor,
   make this explicit in the driver by providing the relevant temperature
   channel.
 
 * Add support for blocking IO on buffers.
 
 * Add a data_available call back to the interface between buffer implementations
   and the core.  This is much cleaner than the old, 'stufftoread' flag.
   Implemented in the kfifo buffer.
 
 Cleanups
 
 * Last user of the old event configuration interface is converted and the
   old interface dropped.  Nice to be rid of this thanks to Lars-Peter's hard
   work!
 
 * Replace all remaining instances of the IIO_ST macro with explicit filling
   of the scan_type structure within struct iio_chan_spec.  This macro was a
   bad idea, that rapidly ceased to cover all elements of the structure.
   Miss reading of the macro arguements has led to a number of bugs so lets
   just get rid of it. The final removal patch is awaiting for some fixes
   to make their way into mainline.
   In a couple of drivers, no elements of scan_type were even being used so
   in those case, it has been dropped entirely.
 
 * Drop a couple of of_match_ptr helper uses in drivers where devicetree is
   not optional and hence the structures being protected by this always exist.
 
 * Fix up some cases where data was read from a device in a particular
   byte order, but he code placed it into a s16 or similar.  These were
   highlighted by Sparse.
 
 * Use the new ATTRIBUTE_GROUPS macro to drop some boiler plate in the triggers
   core code.
 
 * ad7746 and ad7280a - stop storing buffers on the stack, giving cleaner code
   and possibly avoiding issues with i2c bus drivers that assume they can dma
   directly into the buffer.  Note that this cannot currently happen as the the
   i2c_smbus_read_i2c_block_data function has a memcpy from the buffer actually
   passed to the bus driver.  I missed this element of the commit message
   and don't think it is major enough to rebase the iio tree.
 
 * ad5791 and ad5504 stop storing buffers on the stack for an SPI driver.
   Unlike the i2c drivers, this is a real issue for SPI drivers which can dma
   directly into the buffer supplied.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJStyIbAAoJEFSFNJnE9BaI1goQAL0hKYCYuIl3d1fAy65u2I4h
 5mzJs/oJmomq/4BqAopfEQ8CbhZhksAYoR4JndOzZH7n4jVY/fRgyY/bH/Ymj0oI
 OpCtfee6IeeBLA0p8CMeEPem/pnwxRhSDzul9jsiwpTrTRKAIC1BPZwrmLpaoUfc
 obD8r1ocVZStzfsYBr3DUwkcIpcTQTCVy/Pl8HoKLKKsdYoFhTpNwEHJFOoZdiFi
 KKGRkeL9Q8VRWt/otWU0L0VFGZFwI1PWlxrqnbisVcGwSs8FF4wGcQvijfC0mUMg
 BdKDM7J4GrourZhj3og566B/8WMtGo6YTJXAe/QvvPp768rQncccDHem4V0Tnu49
 OJbjgD4ZGVXt3uBFaYddBIbMEIB8SfA2VYur/MW3gnZ7saSAtDk6TllsvC6CxIkR
 +LOOxWylhEGeJFIjyMrFPqRVhrrRNkuDRxPz8ZGTiDc8ovo6DWuTLsJrLSX8EJyZ
 O6TN6EEk8TCJaf8V63uTFW0Dlom4IQHyQei6LKhfhzwUQq/ri0esBp5P8lGzI3Uq
 wtOSdCDuYyoUEYPYbwjohFmQJ27w1rx9KcS4Y9BGmhTIRXslUg3hr+wA/gKMSDZ0
 /AUkLQajcv9otupfGzsp5mIWkthKKsGt/Y50xc5zIodnFtnM3nQGq4AqlP6t8nzP
 jucVwVMQLj5KaNH13P6K
 =Whfv
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-3.14b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

2nd round of new IIO drivers, features and cleanups for the 3.14 cycle.

New drivers

* HID inclinometer driver.

* DHT11 humidity driver.  Note that previous humidity drivers have been in
  hwmon, but no one was ever entirely happy with that, and they should find
  a more comfortable home in IIO (their original placement in hwmon was my
  fault - oops).  As this is our first humidity driver, core support is also
  added.

New features

* Two of mxs-lradc channels are internally wired to a temperature sensor,
  make this explicit in the driver by providing the relevant temperature
  channel.

* Add support for blocking IO on buffers.

* Add a data_available call back to the interface between buffer implementations
  and the core.  This is much cleaner than the old, 'stufftoread' flag.
  Implemented in the kfifo buffer.

Cleanups

* Last user of the old event configuration interface is converted and the
  old interface dropped.  Nice to be rid of this thanks to Lars-Peter's hard
  work!

* Replace all remaining instances of the IIO_ST macro with explicit filling
  of the scan_type structure within struct iio_chan_spec.  This macro was a
  bad idea, that rapidly ceased to cover all elements of the structure.
  Miss reading of the macro arguements has led to a number of bugs so lets
  just get rid of it. The final removal patch is awaiting for some fixes
  to make their way into mainline.
  In a couple of drivers, no elements of scan_type were even being used so
  in those case, it has been dropped entirely.

* Drop a couple of of_match_ptr helper uses in drivers where devicetree is
  not optional and hence the structures being protected by this always exist.

* Fix up some cases where data was read from a device in a particular
  byte order, but he code placed it into a s16 or similar.  These were
  highlighted by Sparse.

* Use the new ATTRIBUTE_GROUPS macro to drop some boiler plate in the triggers
  core code.

* ad7746 and ad7280a - stop storing buffers on the stack, giving cleaner code
  and possibly avoiding issues with i2c bus drivers that assume they can dma
  directly into the buffer.  Note that this cannot currently happen as the the
  i2c_smbus_read_i2c_block_data function has a memcpy from the buffer actually
  passed to the bus driver.  I missed this element of the commit message
  and don't think it is major enough to rebase the iio tree.

* ad5791 and ad5504 stop storing buffers on the stack for an SPI driver.
  Unlike the i2c drivers, this is a real issue for SPI drivers which can dma
  directly into the buffer supplied.
2013-12-24 10:30:57 -08:00
Greg Kroah-Hartman 912cbd4952 Merge 3.13-rc5 into staging-next
This resolves a merge issue with drivers/staging/imx-drm/imx-drm-core.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-24 10:06:37 -08:00
Sachin Kamat a451521d22 iio: cm36651: Remove redundant of_match_ptr helper
'cm36651_of_match' is always compiled in. Hence the
helper macro is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-22 16:01:54 +00:00
Masanari Iida 77d84ff87e treewide: Fix typos in printk
Correct spelling typo in various part of kernel

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-12-19 15:10:49 +01:00
Jonathan Cameron 6b25f6e6b7 iio:light:tcs3472 replaces IIO_ST macro with explicit entries to struct scan_type
IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 21:39:02 +00:00
Jonathan Cameron 80ac4b8aa1 iio:light:adjd_s311 replaces IIO_ST macro with explicit entries to struct scan_type
IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 21:08:56 +00:00
Jonathan Cameron cb4417f9db iio:dac:mcp4725 drop specification of scan type as unused in this driver.
IIO_ST is going away as it is a pain to maintain so the simplest path with
this driver is to not specify the unused scan type.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 21:08:19 +00:00
Jonathan Cameron 5247362453 iio:dac:max517 drop specification of scan type as unused in this driver.
IIO_ST is going away as it is a pain to maintain so the simplest path with
this driver is to not specify the unused scan type.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 21:07:37 +00:00
Jonathan Cameron cb9d90f1e3 iio:dac:ad5791 replaces IIO_ST macro with explicit entries to struct scan_type
IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 21:06:57 +00:00
Jonathan Cameron 560101de92 iio:dac:ad5764 replaces IIO_ST macro with explicit entries to struct scan_type
IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 21:05:53 +00:00
Jonathan Cameron 64665dd373 iio:dac:ad5755 replaces IIO_ST macro with explicit entries to struct scan_type
IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 21:04:47 +00:00
Jonathan Cameron 44ba1593ac iio:dac:ad5686 replaces IIO_ST macro with explicit entries to struct scan_type
IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 21:03:52 +00:00
Jonathan Cameron 4974600bbf iio:dac:ad5624r replaces IIO_ST macro with explicit entries to struct scan_type
IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 21:02:46 +00:00
Jonathan Cameron 73d3a77583 iio:dac:ad5504 replaces IIO_ST macro with explicit entries to struct scan_type
IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 21:01:58 +00:00
Jonathan Cameron 3d42e148e3 iio:dac:ad5449 replaces IIO_ST macro with explicit entries to struct scan_type
IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 21:00:46 +00:00
Jonathan Cameron e3019c21de iio:dac:ad5446 replaces IIO_ST macro with explicit entries to struct scan_type
IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 21:00:09 +00:00
Jonathan Cameron 49f8289795 iio:dac:ad5421 replaces IIO_ST macro with explicit entries to struct scan_type
IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 20:59:39 +00:00
Jonathan Cameron da9b1a2170 iio:dac:ad5380 replaces IIO_ST macro with explicit entries to struct scan_type
IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 20:58:34 +00:00
Jonathan Cameron c865b537e9 iio:dac:ad5360 replaces IIO_ST macro with explicit entries to struct scan_type
IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 20:57:31 +00:00
Jonathan Cameron 81d49bc622 iio:dac:ad5064 replaces IIO_ST macro with explicit entries to struct scan_type
IIO_ST is going away as it is a pain to maintain.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 20:56:33 +00:00
Jonathan Cameron e5687979eb iio🔍mag3110 replaces IIO_ST macro with explicit entries to struct scan_type
The IIO_ST macro no longer covers all the elements of struct scan_type
and has this has lead to some bugs being introduced.

The drivers are easier to follow with this structure being directly
filled so that is now preferred.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 20:55:50 +00:00
Jonathan Cameron 7d7feae706 iio:accel:bma180 replaces IIO_ST macro with explicit entries to struct scan_type
The IIO_ST macro no longer covers all the elements of struct scan_type
and has this has lead to some bugs being introduced.

The drivers are easier to follow with this structure being directly
filled so that is now preferred.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-12-17 20:55:01 +00:00
Jonathan Cameron e39d99059a iio:adc:ad7887 Fix channel reported endianness from cpu to big endian
Note this also sets the endianness to big endian whereas it would
previously have defaulted to the cpu endian.  Hence technically
this is a bug fix on LE platforms.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: stable@vger.kernel.org
2013-12-17 20:37:14 +00:00
Jonathan Cameron 3425c0f7ac iio:imu:adis16400 fix pressure channel scan type
A single channel in this driver was using the IIO_ST macro.
This does not provide a parameter for setting the endianness of
the channel.  Thus this channel will have been reported as whatever
is the native endianness of the cpu rather than big endian. This
means it would be incorrect on little endian platforms.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: stable@vger.kernel.org
2013-12-17 20:34:18 +00:00
Greg Kroah-Hartman 5c5bccb76c Merge 3.13-rc4 into staging-next.
We want the fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-16 17:12:04 -08:00
Beomho Seo 128d6637cc iio: cm36651: Changed return value of read function
A return value of callback have been changed to IIO_VAL_INT.
If not IIO_VAL_INT, driver will print wrong value(*_read_int_time).

A follow up patch will deal with a related bug in the new event handling
code.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-15 17:38:02 +00:00
Lars-Peter Clausen cb955852a4 iio: Remove support for the legacy event config interface
Now that all drivers have been converted to the new event config interface we
can remove for the legacy event config interface. Also drop the '_new' suffix
for the event config interface callbacks, since those are the only callbacks
now.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-08 13:13:52 +00:00
Lars-Peter Clausen bb7f9d90a5 iio:cm36651: Convert to new event config interface
Switch the cm36651 driver to the new IIO event config interface as the old one
is going to be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-08 13:11:09 +00:00
Srinivas Pandruvada 098d3beccf iio: hid-sensors: Added Inclinometer 3D
Added usage id processing for Inclinometer 3D. This uses IIO
interfaces for triggered buffer to present data to user
mode.This uses HID sensor framework for registering callback
events from the sensor hub.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:31:59 +00:00
Harald Geyer 091a121b04 iio: Add new driver dht11
This driver handles DHT11 and DHT22 sensors.

Signed-off-by: Harald Geyer <harald@ccbib.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:30 +00:00
Harald Geyer ac216aa290 iio: Add support for humidity sensors
There are already humidity sensors in the hwmon subsystem,
so we use their unit (milli percent) here as well.

Signed-off-by: Harald Geyer <harald@ccbib.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:29 +00:00
Axel Lin f59c2576c1 iio:trigger: Convert to use ATTRIBUTE_GROUPS
Use new ATTRIBUTE_GROUPS macro to declare attribute groups.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:29 +00:00
Lars-Peter Clausen ee551a1000 iio: Add support for blocking IO on buffers
Currently the IIO buffer interface only allows non-blocking reads. This patch
adds support for blocking IO. In blocking mode the thread will go to sleep if no
data is available and will wait for the buffer implementation to signal that new
data is available by waking up the buffers waitqueue.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:29 +00:00
Lars-Peter Clausen 355c1a14d4 iio: kfifo_buf: Implement data_available() callback
This patch implements the data_available() callback for the kfifo buffer instead
of using the stufftoread flag. The kfifo used by the buffer already knows
whether it is empty or not based on the position of its read and write pointer.
Using this makes it a lot easier to tell whether data is available or not and it
is not necessary to take special measures to ensure that no race conditions
between reading and writing from the buffer occur.

Note, that we still have to take the buffers lock to protect against concurrent
resizeing of the kfifo.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:28 +00:00
Lars-Peter Clausen 647cc7b9be iio: Add data_available callback for buffers
This patch adds a new data_available() callback to the iio_buffer_access_funcs
struct. The callback is used to indicate whether data is available in the buffer
for reading. It is meant to replace the stufftoread flag from the iio_buffer
struct. The reasoning for this is that the buffer implementation usually can
determine whether data is available rather easily based on its state, on the
other hand it can be rather tricky to update the stufftoread flag in a race free
way.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:28 +00:00
Lars-Peter Clausen 91f197e0c0 iio:vcnl4000: Mark transfer buffer as __be16
Fixes the following warnings from sparse:
	drivers/iio/light/vcnl4000.c:88:16: warning: cast to restricted __be16
	drivers/iio/light/vcnl4000.c:88:16: warning: cast to restricted __be16
	drivers/iio/light/vcnl4000.c:88:16: warning: cast to restricted __be16
	drivers/iio/light/vcnl4000.c:88:16: warning: cast to restricted __be16

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:27 +00:00
Lars-Peter Clausen 54e018da31 iio:ad7266: Mark transfer buffer as __be16
Fixes the following warnings from sparse:
	drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16
	drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16
	drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16
	drivers/iio/adc/ad7266.c:140:16: warning: cast to restricted __be16

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:27 +00:00
Lars-Peter Clausen 791bb52a0c iio:ad5791: Do not store transfer buffers on the stack
Some SPI controllers may not be able to handle transfer buffers that are placed
on the stack.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:26 +00:00
Lars-Peter Clausen ae8bb9b101 iio:ad5791: Mark transfer buffers as __be32
Fixes the following warnings from sparse:
	drivers/iio/dac/ad5791.c:114:18: warning: incorrect type in assignment (different base types)
	drivers/iio/dac/ad5791.c:114:18:    expected unsigned int [unsigned] [usertype] d32
	drivers/iio/dac/ad5791.c:114:18:    got restricted __be32 [usertype] <noident>
	drivers/iio/dac/ad5791.c:142:21: warning: incorrect type in assignment (different base types)
	drivers/iio/dac/ad5791.c:142:21:    expected unsigned int [unsigned] [usertype] d32
	drivers/iio/dac/ad5791.c:142:21:    got restricted __be32 [usertype] <noident>
	drivers/iio/dac/ad5791.c:144:21: warning: incorrect type in assignment (different base types)
	drivers/iio/dac/ad5791.c:144:21:    expected unsigned int [unsigned] [usertype] d32
	drivers/iio/dac/ad5791.c:144:21:    got restricted __be32 [usertype] <noident>
	drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32
	drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32
	drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32
	drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32
	drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32
	drivers/iio/dac/ad5791.c:148:16: warning: cast to restricted __be32

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:26 +00:00
Lars-Peter Clausen edc05f2614 iio:ad5755: Mark transfer buffer as __be32
Fixes the following warnings from sparse:
	drivers/iio/dac/ad5755.c:117:25: warning: incorrect type in assignment (different base types)
	drivers/iio/dac/ad5755.c:117:25:    expected unsigned int [unsigned] [usertype] d32
	drivers/iio/dac/ad5755.c:117:25:    got restricted __be32 [usertype] <noident>
	drivers/iio/dac/ad5755.c:171:25: warning: incorrect type in assignment (different base types)
	drivers/iio/dac/ad5755.c:171:25:    expected unsigned int [unsigned] [usertype] d32
	drivers/iio/dac/ad5755.c:171:25:    got restricted __be32 [usertype] <noident>
	drivers/iio/dac/ad5755.c:172:25: warning: incorrect type in assignment (different base types)
	drivers/iio/dac/ad5755.c:172:25:    expected unsigned int [unsigned] [usertype] d32
	drivers/iio/dac/ad5755.c:172:25:    got restricted __be32 [usertype] <noident>
	drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32
	drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32
	drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32
	drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32
	drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32
	drivers/iio/dac/ad5755.c:176:23: warning: cast to restricted __be32

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:26 +00:00
Lars-Peter Clausen cf87534b6f iio:ad5686: Mark transfer buffer as __be32
Fixes the following warnings from sparse:
	drivers/iio/dac/ad5686.c💯25: warning: incorrect type in assignment (different base types)
	drivers/iio/dac/ad5686.c💯25:    expected unsigned int [unsigned] [usertype] d32
	drivers/iio/dac/ad5686.c💯25:    got restricted __be32 [usertype] <noident>
	drivers/iio/dac/ad5686.c:122:25: warning: incorrect type in assignment (different base types)
	drivers/iio/dac/ad5686.c:122:25:    expected unsigned int [unsigned] [usertype] d32
	drivers/iio/dac/ad5686.c:122:25:    got restricted __be32 [usertype] <noident>
	drivers/iio/dac/ad5686.c:124:25: warning: incorrect type in assignment (different base types)
	drivers/iio/dac/ad5686.c:124:25:    expected unsigned int [unsigned] [usertype] d32
	drivers/iio/dac/ad5686.c:124:25:    got restricted __be32 [usertype] <noident>
	drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32
	drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32
	drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32
	drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32
	drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32
	drivers/iio/dac/ad5686.c:130:16: warning: cast to restricted __be32

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:26 +00:00
Lars-Peter Clausen 8ef411b78b iio:ad5421: Mark transfer buffer as __be32
Fixes the following warnings from sparse:
	drivers/iio/dac/ad5421.c:134:25: warning: incorrect type in assignment (different base types)
	drivers/iio/dac/ad5421.c:134:25:    expected unsigned int [unsigned] [usertype] d32
	drivers/iio/dac/ad5421.c:134:25:    got restricted __be32 [usertype] <noident>
	drivers/iio/dac/ad5421.c:168:25: warning: incorrect type in assignment (different base types)
	drivers/iio/dac/ad5421.c:168:25:    expected unsigned int [unsigned] [usertype] d32
	drivers/iio/dac/ad5421.c:168:25:    got restricted __be32 [usertype] <noident>
	drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32
	drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32
	drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32
	drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32
	drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32
	drivers/iio/dac/ad5421.c:172:23: warning: cast to restricted __be32

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:25 +00:00
Lars-Peter Clausen 0dbe59c7a7 iio:ad5504: Do not store transfer buffers on the stack
Some SPI controllers may not be able to handle transfer buffers that are placed
on the stack.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:25 +00:00
Lars-Peter Clausen 61c358e3bc iio:ad5504: Mark transfer buffers as __be16
Fixes the following warnings from sparse:
	drivers/iio/dac/ad5504.c:71:19: warning: incorrect type in initializer (different base types)
	drivers/iio/dac/ad5504.c:71:19:    expected unsigned short [unsigned] [usertype] tmp
	drivers/iio/dac/ad5504.c:71:19:    got restricted __be16 [usertype] <noident>
	drivers/iio/dac/ad5504.c:80:19: warning: incorrect type in initializer (different base types)
	drivers/iio/dac/ad5504.c:80:19:    expected unsigned short [unsigned] [usertype] tmp
	drivers/iio/dac/ad5504.c:80:19:    got restricted __be16 [usertype] <noident>
	drivers/iio/dac/ad5504.c:93:16: warning: cast to restricted __be16
	drivers/iio/dac/ad5504.c:93:16: warning: cast to restricted __be16
	drivers/iio/dac/ad5504.c:93:16: warning: cast to restricted __be16
	drivers/iio/dac/ad5504.c:93:16: warning: cast to restricted __be16

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-03 20:22:25 +00:00
Greg Kroah-Hartman 06749f192b Merge v3.13-rc2 into staging-next
we want these fixes in here.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-02 16:39:07 -08:00
Russell King - ARM Linux 419a4aaeb0 Fix build failure for gp2ap020a00f.c
drivers/built-in.o: In function `gp2ap020a00f_thresh_event_handler':
powercap_sys.c:(.text+0x15f90c): undefined reference to `irq_work_queue'
make[1]: *** [vmlinux] Error 1
make[1]: Target `uImage' not remade because of errors.
make: *** [sub-make] Error 2
make: Target `uImage' not remade because of errors.

You need the IRQ work support, but GP2AP020A00F is not selecting this
symbol.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-02 21:11:30 +00:00
Srinivas Pandruvada 751d17e23a iio: hid-sensors: Fix power and report state
In the original HID sensor hub firmwares all Named array enums were
to 0-based. But the most recent hub implemented as 1-based,
because of the implementation by one of the major OS vendor.
Using logical minimum for the field as the base of enum. So we add
logical minimum to the selector values before setting those fields.
Some sensor hub FWs already changed logical minimum from 0 to 1
to reflect this and hope every other vendor will follow.
There is no easy way to add a common HID quirk for NAry elements,
even if the standard specifies these field as NAry, the collection
used to describe selectors is still just "logical".

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-02 21:05:32 +00:00
Greg Kroah-Hartman 3ce5ae8d46 First set of new features, drivers and cleanups for IIO in the 3.14 cycle.
This mostly consists of patches that didn't quite make the last cycle. Lots
 of interesting things under review currently.
 
 Core:
 - Add devm_iio_device_register/unregister.  I took some convincing on whether
   there would be many devices that really were simple enough to need no
   explicit actions on removal.  Turns out there are some.
 - Move some stray docs to above the relevant implemenation.
 - Drop a redundant repeated check on the fact the trigger has actually changed
   when there is a userspace attempt change it.
 
 Drivers:
 New drivers
 - Freescale MPL3115A2 Pressure / temperature sensor
 
 New functionality
 - hid_sensors: add sensitivity support.
 
 DT bindings
 - tsl2563
 - hmc5843
 
 Cleanups
 - Drop unused scan_type from viperboard adc driver.
 - devm_iio_device_register used in viperboard, ad5421, ad5755, adis16130,
   adxrs450, vcnl4000, adis16220, ad7816, lpc32xx, adt7316, adis16060, isl29018
   and ad2s1200.  Note that this was proposed in a number of other drivers
   and this revealed a number of missorderings in remove functions.  Also for
   now I have blocked this on any device that any hardware suspend suport on
   the basis that we probably want to power down devices if they have no driver
   support loaded.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJSk7pfAAoJEFSFNJnE9BaINEAP/2LKNkK/65BI8DOb3DQcRQWw
 yQAjYd43c7OWTW6clx3DRZiESI1qR7B1LeIV3P+jF1kvOS5qdE1WfYI9pQCLW+JL
 yRQgqLJknuHnrs+Bzw5CrGRcPDl5Zk31megcs0CcOt76LbQsaQ+w/blq9EiuVioW
 s2HfopsbVPQBe/IRA5ajLRG5gQYR4FIEIdzifzmv3Zydzhg9yFy5sk6vpSnzN6zM
 bh1Q8OooMDCqrCsKwzG1z5ZT4ki6oEILVQsiCblI9kcbw+GyKb95d63E0ZdlH72o
 ymowmRGujB+gS1zBh+1zLVjuaUytLHBUxAcQIFYwpOtbqaAYo68J5HFEyXWh5QpH
 aeMWnN4Cd54h83SsBofF05aFPGGK3iM6rioDpPJaLjBzJgFuRvIV87O3t0j1/3/Q
 VfXKYboGH4EVHsbARoUaQ4UP/0WlXoDQwX5XfBbsSlL9/U58JmrKAx6+HvmSyvcG
 5HKzOsVQNKbZMrSlBlvFzPXtRdJwRuv9TwWLLUatQKZAt66rdBgWcycOvlQv1m/9
 Neo/2b22vqoAN1AfyW32Hz7rQCnKxVczbTdex9I5ikNJmIPUfbZ6TAE/660HSVE2
 J70ZA6SHGU9Edhm0fkJNBhRanO3my4vQFUwcl457JY9O/BeC0xBhU1ZjvkFGysG0
 D/9TEiSaLoURkhxeeN0M
 =KZou
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-3.14a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

First set of new features, drivers and cleanups for IIO in the 3.14 cycle.
This mostly consists of patches that didn't quite make the last cycle. Lots
of interesting things under review currently.

Core:
- Add devm_iio_device_register/unregister.  I took some convincing on whether
  there would be many devices that really were simple enough to need no
  explicit actions on removal.  Turns out there are some.
- Move some stray docs to above the relevant implemenation.
- Drop a redundant repeated check on the fact the trigger has actually changed
  when there is a userspace attempt change it.

Drivers:
New drivers
- Freescale MPL3115A2 Pressure / temperature sensor

New functionality
- hid_sensors: add sensitivity support.

DT bindings
- tsl2563
- hmc5843

Cleanups
- Drop unused scan_type from viperboard adc driver.
- devm_iio_device_register used in viperboard, ad5421, ad5755, adis16130,
  adxrs450, vcnl4000, adis16220, ad7816, lpc32xx, adt7316, adis16060, isl29018
  and ad2s1200.  Note that this was proposed in a number of other drivers
  and this revealed a number of missorderings in remove functions.  Also for
  now I have blocked this on any device that any hardware suspend suport on
  the basis that we probably want to power down devices if they have no driver
  support loaded.
2013-11-25 18:42:40 -08:00
Greg Kroah-Hartman 1676587bca First round of fixes for IIO in the 3.13 cycle.
The usual mixed bag of fixes.
 
 * 3 cases where kconfig dependencies were missing.  We need to keep a closer
   eye on this in new drivers.
 
 * hid_sensors was abusing the iio_dev->trigger pointer.  We had a round
   of clearing this out some time ago but this driver clearly slipped through.
 
 * A misuse of the IIO_ST macro, in mcp3422, which we should really make a
   concertive effort to finish removing.
 
 * Avoid a double free introduced by recent buffer reference counting in the
   one driver that (quite reasonably!) does things differently (am335x)
 
 * A missing mutex_unlock in kxsd9 that means that driver has been non
   functional for some time and no one noticed (including me who for once
   actually has one of the supported devices).
 
 * An incorrect assumption about the parameters of sign_extend32 in mcp3422.
 
 So nothing controversial.  The only substantial patch is the hid_sensors
 one and that is actually just adding a new pointer to the devices private
 state then moving the code over to it.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJSk7SvAAoJEFSFNJnE9BaIRNsQAJnM/WiH1ghfA5nuc0V7JrnB
 2Z6Qtm3Stoq4Ul5LYiEMxumo6ckL17YFddxejUF9X4Eq5N8YyAxdPd8JdDJgS2OL
 yCM2x6izd9drIGA3YUMMOvZ1BScSK1e5DmXJHp4nuF68uHtf2TM4TGF/2zuqt3TN
 2bL7blNF3/5O/TiBRB4XjkH4Sy5c4G2kke+0SckRnWohTn8oE7tWihr84nYPciqt
 mu11Nrv9S+sr/5GzRwN8d5SU33yU2/ML32QU/4oQzb/XxBW0W759NJflqY5sSZ89
 JQnHcCKKZD7IWBFT0VAMiuEjBpSRGc4vxBbYjsVHtEHzW7v3L0fvob5YqfSrzMlD
 rVUiTQJm7fC/4hn7iJUPrxkWsSGsjCvVrLZmZFOK3OYONUfd+Cqg0nliihRZo65s
 054/yi4v8xd6OUzqSxtWKIK/ZQjDxa5W2BlRoryShCrUAo/e3Djy+jH32v4Mmgfe
 D9aEwdUqa8kPlq6pyQC2QRgWWU1K5+RRrzW5nNNLlmjYtVlfF+8OgcQYGHW8iMur
 8AaDXNZwQLEYA4409T/Ar9lNg4gDqc0YZsvNibu0q4Kxfp13dJOwra+xmF+ktECr
 KcIFxu5v89SgpE1Rra74OXYFWQ1I4Qy+sJxhQKymthPzmw4nuUidK33mxjtcojwz
 TvQJu8f3us8Ea5vQLZo0
 =cIMc
 -----END PGP SIGNATURE-----

Merge tag 'fixes-for-3.13a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

Jonathan writes:

First round of fixes for IIO in the 3.13 cycle.

The usual mixed bag of fixes.

* 3 cases where kconfig dependencies were missing.  We need to keep a closer
  eye on this in new drivers.

* hid_sensors was abusing the iio_dev->trigger pointer.  We had a round
  of clearing this out some time ago but this driver clearly slipped through.

* A misuse of the IIO_ST macro, in mcp3422, which we should really make a
  concertive effort to finish removing.

* Avoid a double free introduced by recent buffer reference counting in the
  one driver that (quite reasonably!) does things differently (am335x)

* A missing mutex_unlock in kxsd9 that means that driver has been non
  functional for some time and no one noticed (including me who for once
  actually has one of the supported devices).

* An incorrect assumption about the parameters of sign_extend32 in mcp3422.

So nothing controversial.  The only substantial patch is the hid_sensors
one and that is actually just adding a new pointer to the devices private
state then moving the code over to it.
2013-11-25 12:50:11 -08:00
Sachin Kamat 691dab4291 iio: light: vcnl4000: Use devm_iio_device_register
devm_iio_device_register simplifies the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-24 21:07:18 +00:00
Sachin Kamat 9bcbf02ae3 iio: gyro: adxrs450: Use devm_iio_device_register
devm_iio_device_register simplifies the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-24 21:07:18 +00:00
Sachin Kamat 79788b7c44 iio: gyro: adis16130: Use devm_iio_device_register
devm_iio_device_register simplifies the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-24 21:07:17 +00:00
Sachin Kamat 1baeec9c37 iio: dac: ad5755: Use devm_iio_device_register
devm_iio_device_register simplifies the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-24 21:07:17 +00:00
Sachin Kamat 365736e77c iio: dac: ad5421: Use devm_iio_device_register
devm_iio_device_register simplifies the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-24 21:07:16 +00:00
Sachin Kamat 2191d0fba7 iio: adc: viperboard: Use devm_iio_device_register
devm_iio_device_register simplifies the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-24 21:07:15 +00:00
Sebastian Reichel 8175bff5b4 iio:light:tsl2563: Add DT support
Add Device Tree support for the TSL2563 driver,
document the binding and add AMS-TAOS Inc. to the
list of vendor prefixes.

Signed-off-by: Sebastian Reichel <sre@debian.org>
Acked-by: Kumar Gala <galak@codeaurora.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-24 21:07:14 +00:00
Peter Meerwald cc26ad455f iio: Add Freescale MPL3115A2 pressure / temperature sensor driver
I2C-controlled MEMS sensor with 20-bit pressure measurement (pascal) and
12-bit temperature measurement

driver only exposes basic functionality, see TODO remarks
datasheet: http://cache.freescale.com/files/sensors/doc/data_sheet/MPL3115A2.pdf

v2:
* store 20-bit value in 32-bit buffer element (instead of 24-bit)
* zero buffer to prevent kernel data leak to userspace
* fix mutex unlock in trigger handler (thanks Andi Shyti)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reviewed-by: Andi Shyti <andi@etezian.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-24 21:07:13 +00:00
Peter Meerwald a35e1fd268 iio: Remove redundant check that new trigger is different from old
same check is performed a new lines above

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-24 21:07:13 +00:00
Peter Meerwald 17666ef3c7 iio: Minor kerneldoc fix for iio_trigger_write_current()
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-24 21:07:12 +00:00
Sachin Kamat 2842d4cc72 iio: adc: mcp3422: Use devm_iio_device_register
devm_iio_device_register simplifies the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-24 21:07:12 +00:00
Sachin Kamat a7e57dce02 iio: core: Move kernel doc to the right location
Documentation related to function should be placed above
its implementation. Move it accordingly.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-24 21:07:11 +00:00
Sachin Kamat 8caa07c0e5 iio: core: Implement devm_iio_device_{register,unregister}
Add device managed devm_iio_device_{register,unregister}()
to automatically unregister IIO drivers thus leading to
simplified IIO driver code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-24 21:07:09 +00:00
Frank Zago 0ee005c7dc iio:accel:kxsd9 fix missing mutex unlock
This will leave a lock held after reading from the device, preventing
any further reads.

Signed-off-by: Frank Zago <frank@zago.net>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-17 15:22:00 +00:00
Stefani Seibold 498d319bb5 kfifo API type safety
This patch enhances the type safety for the kfifo API.  It is now safe
to put const data into a non const FIFO and the API will now generate a
compiler warning when reading from the fifo where the destination
address is pointing to a const variable.

As a side effect the kfifo_put() does now expect the value of an element
instead a pointer to the element.  This was suggested Russell King.  It
make the handling of the kfifo_put easier since there is no need to
create a helper variable for getting the address of a pointer or to pass
integers of different sizes.

IMHO the API break is okay, since there are currently only six users of
kfifo_put().

The code is also cleaner by kicking out the "if (0)" expressions.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Stefani Seibold <stefani@seibold.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-11-15 09:32:23 +09:00
Wolfram Sang 16735d022f tree-wide: use reinit_completion instead of INIT_COMPLETION
Use this new function to make code more comprehensible, since we are
reinitialzing the completion, not initializing.

[akpm@linux-foundation.org: linux-next resyncs]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org> (personally at LCE13)
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-11-15 09:32:21 +09:00
Srinivas Pandruvada 2461fc9f3f iio: hid-sensors: magnetometer : Add sensitivity
A number of Properties that can be applied to Data Fields are per data
field basis or for all data fields. Adding sensitivity field for all
magnetometer fields, which is most commonly used in currently available
sensor hubs.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-09 13:51:23 +00:00
Peter Meerwald f227c13259 iio: Drop scan_type from viperboard adc driver
the driver does not support buffering, hence scan_type is not needed

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-09 13:51:23 +00:00
Lars-Peter Clausen fe26980e03 iio: adc: ti_am335x_adc: avoid double free of buffer.
The driver is missing the iio_buffer_attach() call. As such it will attempt
to free the buffer twice on removal.

Introduced in commit 9e69c9 ("iio: Add reference counting for buffers").

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-09 12:33:24 +00:00
Peter Meerwald 089b54bd69 iio: Fix tcs3472 Kconfig dependencies
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-09 12:15:57 +00:00
Peter Meerwald 50619cb173 iio: Fix mag3110 Kconfig dependencies
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-09 12:15:34 +00:00
Peter Meerwald 911bdc68ec iio: Fix mag3110 scan_type
last argument of IIO_ST is shift, not endianness

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-09 12:12:33 +00:00
Srinivas Pandruvada f87ee1bd88 iio: hid-sensors: light/als : Add sensitivity
A number of Properties that can be applied to Data Fields are per data
field basis or for all data fields. Adding sensitivity field for all
als fields, which is most commonly used in currently available
sensor hubs.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-05 23:03:11 +00:00
Srinivas Pandruvada 2371aebf02 iio: hid-sensors: gyro : Add sensitivity
A number of Properties that can be applied to Data Fields are per data
field basis or for all data fields. Adding sensitivity field for all
gyro fields, which is most commonly used in currently available
sensor hubs.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-05 23:02:53 +00:00
Srinivas Pandruvada 64528d03d7 iio: hid-sensors: accelerometer: Add sensitivity
A number of Properties that can be applied to Data Fields are per data
field basis or for all data fields. Adding sensitivity field for all
accelerometer fields, which is most commonly used in currently
available sensor hubs.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-05 23:02:43 +00:00
Peter Meerwald a5a3e43111 iio: Fix sign extension table in mcp3422 driver
the index argument to sign_extend32() gives the bit position (from 0)
to the sign bit

so e.g. if the measurement has 16-bit resolution, we need to pass 15;
a measurement of 0x8000 should be reported as -32768, not 32768

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Acked-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-05 22:45:25 +00:00
Srinivas Pandruvada ec7f68e07b iio: hid_Sensors: fix crash during trigger unregister
We can't store the trigger instance created by iio_trigger_alloc, in
trig field of iio_device structure. This needs to be stored in the
driver private data. Othewise it can result in crash during module
unload. Hence created a trig_ptr in the common data structure
for each HID sensor IIO driver and storing here.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-02 19:07:06 +00:00
Wei Yongjun 00582bf8e7 iio: at91: fix error return code in at91_adc_probe()
Fix to return -ENODEV instead of 0 if non-TSMR adc don't
support, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-02 12:07:54 +00:00
Sachin Kamat e020325541 iio: light: vcnl4000: Remove redundant code
The if check is redundant as the value obtained from
iio_device_register() is already in the required format.
Hence return the function directly.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-24 14:48:14 +01:00
Sachin Kamat a9b6851100 iio: dac: mcp4725: Remove redundant code
Remove an inconsequential print message and return directly
thereby cleaning up some code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-24 14:47:49 +01:00
Sachin Kamat 345d4f92e7 iio: dac: max517: Remove redundant variable
Remove an inconsequential print message and return directly
thereby eliminating an intermediate variable.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-24 14:47:15 +01:00
Sachin Kamat e2f5543a73 iio: dac: ad5755: Remove redundant code
The if check is redundant as the value obtained from
iio_device_register() is already in the required format.
Error messages are already printed by iio_device_register();
hence not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-24 14:46:33 +01:00
Sachin Kamat 35b9c0b18e iio: dac: ad5421: Remove redundant code
The if check is redundant as the value obtained from
iio_device_register() is already in the required format.
Hence return the function directly. Error messages are already
printed by iio_device_register(); hence not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-24 14:46:00 +01:00
Sachin Kamat ae0f29d159 iio: adc: twl6030-gpadc: Remove redundant code
The if check is redundant as the value obtained from
iio_device_register() is already in the required format.
Hence return the function directly.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-24 14:45:09 +01:00
Sachin Kamat dcf5272cac iio: accel: kxsd9: Remove redundant variable
Return directly thereby eliminating an intermediate variable.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-24 14:43:24 +01:00
Sachin Kamat 670c11033d iio: core: Add misssing braces
Silences the following checkpatch warning:
WARNING: sizeof *iio_attr should be sizeof(*iio_attr)

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-24 14:42:44 +01:00
Sachin Kamat 3176dd5d3b iio: core: Use pr_err instead of printk
Use of pr_err is preferred to printk.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-24 14:39:48 +01:00
Denis CIOCCA d141ab776b iio:pressure: Adds LPS001WP support also on spi interface and Kconfig fix
Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-23 17:55:14 +01:00
Sachin Kamat de06b344ac iio: adc: ti_am335x_adc: Remove redundant of_match_ptr
ti_adc_dt_ids is always compiled in. Hence of_match_ptr is not
needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-23 17:52:25 +01:00
Sachin Kamat d453a4ab11 iio: adc: nau7802: Remove redundant of_match_ptr
nau7802_dt_ids is always compiled in. Hence of_match_ptr is not
needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-23 17:52:25 +01:00
Sachin Kamat fc21acc471 iio: adc: twl6030-gpadc: Remove redundant of_match_ptr
of_twl6030_match_tbl is always compiled in. Hence of_match_ptr is
not necessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-23 17:51:24 +01:00
Peter Meerwald 39631b5f95 iio: Add Freescale mag3110 magnetometer driver
three-axis digital magnetometer with I2C interface

datasheet is available from
http://cache.freescale.com/files/sensors/doc/data_sheet/MAG3110.pdf

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-23 17:43:11 +01:00
Vivien Didelot 61bdda6922 iio:adc:max1363 support SMBus for 8-bit devices
The driver currently supports only I2C access. But supported devices with an
accuracy of 8-bit are compatible with the SMBus byte access routines.

This patch wraps the send and receive routines depending on the chip
accuracy and fonctionnalities of its adapter.

For instance, this allows us to use a MAX11603 on a ICH7 controller.

This patch also simplifies the max1363_write_basic_config() routine to
use the struct max1363_state fields directly.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-20 22:36:21 +01:00
Peter Meerwald eb03610a9c iio: Correct description how to convert microtesla to gauss
this just fixes the comment; however, I'm not sure if the driver reports
measurements correctly; the raw values are 0.3 uT / LSB; IIO is supposed
to report magnetic fields in Gauss, so the scale should be around 1/300
(ignoring ASA) -- but value and scale are returned as VAL_INT

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-20 22:36:13 +01:00
Greg Kroah-Hartman f7a0fd56e4 Merge 3.12-rc6 into staging-next.
We want these fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-19 13:14:34 -07:00
Sachin Kamat 43e01beda4 iio: light: gp2ap020a00f: Include linux/of.h header
'of_match_ptr' is defined in linux/of.h. Include it explicitly to
avoid build breakage in the future.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-18 20:05:57 +01:00
Sachin Kamat 1f100e80bb iio: adc: ti-adc081c: Include linux/of.h header
'of_match_ptr' is defined in linux/of.h. Include it explicitly to
avoid build breakage in the future.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-18 20:05:56 +01:00
Sachin Kamat 62ba493ea4 iio: adc: nau7802: Include linux/of.h header
'of_match_ptr' is defined in linux/of.h. Include it explicitly to
avoid build breakage in the future.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-18 20:05:56 +01:00
Sachin Kamat de36d817b4 iio: adc: mcp3422: Include linux/of.h header
'of_match_ptr' is defined in linux/of.h. Include it explicitly to
avoid build breakage in the future.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-18 20:05:56 +01:00
Josh Wu c8b11de040 iio: at91: introduce touch screen support in iio adc driver
AT91 ADC hardware integrate touch screen support. So this patch add touch
screen support for at91 adc iio driver.
To enable touch screen support in adc, you need to add the dt parameters:
  1. which type of touch are used? (4 or 5 wires), sample period time.
  2. correct pressure detect threshold value.

In the meantime, since touch screen will use a interal period trigger of adc,
so it is conflict to other hardware triggers. Driver will disable the hardware
trigger support if touch screen is enabled.

This driver has been tested in AT91SAM9X5-EK and SAMA5D3x-EK.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
CC: devicetree@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-17 23:57:10 +01:00
Beomho Seo e590d45190 iio: cm36651: Add CM36651 proximity/light sensor
This patch adds a new driver for Capella CM36651 proximity and RGB sensor.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-17 23:40:19 +01:00
Lars-Peter Clausen bf741c08af iio: Remove unused iio_sw_buffer_preenable()
The functionality implemented by iio_sw_buffer_preenable() is now done directly
in the IIO core and previous users of iio_sw_buffer_preenable() have all been
updated to not use it anymore. It is unused now and can be remove.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-16 19:17:06 +01:00
Lars-Peter Clausen 1e61fb7b19 iio:gp2ap020a00f: Remove redundant call to iio_sw_buffer_preenable()
The equivalent of iio_sw_buffer_preenable() is now done in the IIO buffer core,
so there is no need to do this from the driver anymore.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-16 19:13:57 +01:00