Commit Graph

1485 Commits

Author SHA1 Message Date
Sachin Kamat
0eab65c64a staging: iio: ad7746: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-28 20:21:34 +01:00
Sachin Kamat
538ee7cbff staging: iio: ad7152: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-28 20:21:33 +01:00
Sachin Kamat
d15b73c5bf staging: iio: ad7150: Use devm_* APIs
devm_* APIs are device managed and make code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-28 20:21:33 +01:00
Sachin Kamat
0189d93fdf staging: iio: sca3000: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-28 20:20:26 +01:00
Sachin Kamat
4c24747053 staging: iio: lis3l02dq: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-28 20:20:25 +01:00
Sachin Kamat
e8cac7f614 staging: iio: adis16240: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-28 20:20:25 +01:00
Sachin Kamat
1868171c5c staging: iio: adis16220: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-28 20:20:25 +01:00
Sachin Kamat
864bf5cd86 staging: iio: adis16209: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-28 20:20:24 +01:00
Sachin Kamat
cdfb09a40d staging: iio: adis16204: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-28 20:20:24 +01:00
Sachin Kamat
69fad8aa4d staging: iio: adis16203: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-28 20:20:23 +01:00
Sachin Kamat
f744834960 staging: iio: adis16201: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-28 20:20:23 +01:00
Hector Palacios
1eb70a9745 iio: mxs-lradc: change the realbits to 12
The LRADC virtual channels have an 18 bit field to store the sum of up
to 2^5 accumulated samples. The read_raw function however only operates
over a single sample (12 bit resolution).
In order to use this field for scaling operations, we need it to be the
exact resolution value of the LRADC.
Besides, the driver was using an 18 bit mask (LRADC_CH_VALUE_MASK) to
report touch coordinates to userland. A 12 bit mask should be used instead
or else the touch libraries will expect a coordinates range between 0
and 0x3ffff (18 bits), instead of between 0 and 0xfff (12 bits).

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-17 15:50:57 +01:00
Sachin Kamat
1f5ac52798 iio: gyro: adis16060_core: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-17 15:50:56 +01:00
Peter Meerwald
cd6fe06588 staging:iio:hmc5843: Use i2c_smbus_read_word_swapped()
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-04 11:22:55 +01:00
Peter Meerwald
f70d6694ed staging:iio:hmc5843: Drop unneeded #includes
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-04 11:17:20 +01:00
Peter Meerwald
f9e1170967 staging:iio:hmc5843: Device has 3 channels, no need to store separately
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Shubhrajyoti Datta <shubhrajyoti@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-04 11:08:17 +01:00
Peter Meerwald
e050b35b09 staging:iio:hmc5843: 'add' is a poor abbreviation for address
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Shubhrajyoti Datta <shubhrajyoti@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-04 11:08:17 +01:00
Peter Meerwald
4dedf31cd1 staging:iio:hmc5843: Implement timeout in read function
avoid polling data ready bit forever; msleep() may be too long
for high sampling frequencies but the driver interface does not
support buffering

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Shubhrajyoti Datta <shubhrajyoti@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-04 11:08:16 +01:00
Peter Meerwald
a34778f3a7 staging:iio:hmc5843: Remove id register #defines, not used anymore
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Shubhrajyoti Datta <shubhrajyoti@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-04 11:08:16 +01:00
Peter Meerwald
7561c30141 staging:iio:hmc5843: Drop I2C detection code
I2C is generally not probed for devices other than those commonly found
on architectures where device treeor board files are not used.  Note also
that this implementation does not fill in the name field of the
i2c_board_info structure as the documentation states it must.  Hence
it is unlikely anyone is actually using it.

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Shubhrajyoti Datta <shubhrajyoti@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-04 11:04:58 +01:00
Lars-Peter Clausen
555d5a9f17 staging:iio:adis16260: Move out of staging
The drivers is in more or less good shape, conforms to the IIO ABI and none of
the default static code checker report any problems, so move it out of staging.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:22 +01:00
Lars-Peter Clausen
446e0ee16d staging:iio:adis16260: Remove sampling_frequency_available attribute
The values presented here are completely bogus. Also ..._available attributes
are supposed to be used for properties that only support discrete sets of
values, but we accept continuous values and will round to the next supported
frequency.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:22 +01:00
Lars-Peter Clausen
e4ddf314e2 staging:iio:adis16260: Add proper range checks to write_frequency()
A negative sampling frequency is obviously invalid, so use kstrtouint() instead
of strict_strtoul. Also when setting a sampling frequency smaller than the
minimum supported frequency set the frequency to the minimum supported frequency
instead of just cutting off the upper bits of the raw register value.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:22 +01:00
Lars-Peter Clausen
2a34013509 staging:iio:adis16260: Remove unused includes
Remove some unused includes from the driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:21 +01:00
Lars-Peter Clausen
ebdee941e2 staging:iio:adis16260: Add scale for the inclination channel
While the inclination channel claims to support reading the scale the driver did
not implement this, so trying to read the scale results in a -EINVAL. This patch
fixes it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:21 +01:00
Lars-Peter Clausen
9aa5aad872 staging:iio:adis16260: Remove 'SPS' suffix from samplerate attribute
This is not part of the ABI.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:21 +01:00
Lars-Peter Clausen
8aa55d103c staging:iio:adis16260: Fix minor style issue
Delete some extra whitespace.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:21 +01:00
Lars-Peter Clausen
73149badce staging:iio:adis16260: Simplify calibscale and caliboffset reading
All channels for this device have the same number of bits for calibscale and
caliboffset, there is no need to determine it dynamically based on the channel
type. Also there is no locking required since adis_read_reg_16() will take care
of proper locking on its own.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:20 +01:00
Lars-Peter Clausen
b45ae32bd0 staging:iio:adis16260: Use sign_extend32() instead of open-coding it
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:20 +01:00
Lars-Peter Clausen
f4f87d0411 staging:iio:adis16260: Add value range check for calibscale/-bias
Instead of just cutting of the upper bits of the value make sure that the value
is in the valid range and return an error if it is not.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:20 +01:00
Lars-Peter Clausen
988c79a95e staging:iio:adis16260: Remove separate header
The header is only used by a single C file, just put the register defines
directly into that C file and remove the header.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:20 +01:00
Lars-Peter Clausen
4dcef4af52 staging:iio:adis16260: Don't set default scan mask
The recomentation for IIO driver is to leave all scan elements off by default
and let userspace decide which channels need to be enabled.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:20 +01:00
Lars-Peter Clausen
e1b83f43eb staging:iio:adis16260: Remove support for orientation mapping
The adis16260 driver implements a unique feature in that it allows to change the
orientation of the gyroscope channel by specifying the orientation in platform
data. This feature is as far as I can see unused though and makes the driver
unnecessarily complex. So this patch removes the support for it. If it turns
out we need this, the cleanest approach to implement it is by adding support for
orientation mapping inside the IIO core so it is available to all drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:20 +01:00
Lars-Peter Clausen
63892165fc staging:iio:adis16260: Drop unused 'negate' property
Remove the unused 'negate' property from the driver state struct. This also
means we can now use the adis struct directly as the driver data.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:19 +01:00
Lars-Peter Clausen
f15304143e staging:iio:adis16260: Fix reading calibscale
Return the actual value read from the device and not just the mask.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:19 +01:00
Sachin Kamat
80cab1da70 staging: iio: light: isl29028: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:12 +01:00
Sachin Kamat
e434dcf391 staging: iio: light: isl29018: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:08 +01:00
Sachin Kamat
8c7f6d562e staging: iio: spear_adc: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Stefan Roese <sr@denx.de>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:41:03 +01:00
Sachin Kamat
073c33d552 staging: iio: mxs-lradc: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:40:59 +01:00
Lars-Peter Clausen
661a60b143 staging:iio:ade7xxx: Don't expose the chip reset to userspace
There is no reason why userspace should want to trigger a manual reset of the
device, so remove this functionality.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:40:37 +01:00
Lars-Peter Clausen
aae6e9eb95 staging:iio:adt7316: Don't expose the chip reset to userspace
There is no reason why userspace should want to trigger a manual reset of the
device, so remove this functionality.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:40:36 +01:00
Lars-Peter Clausen
be8309d699 staging:iio:ad2s1210: Don't expose the chip reset to userspace
There is no reason why userspace should want to trigger a manual reset of the
device, so remove this functionality.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:40:36 +01:00
Fabio Estevam
947123d53f iio: mxs-lradc: Check the return value from stmp_reset_block()
stmp_reset_block() may fail, so let's check its return value and propagate it in
the case of error.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:40:33 +01:00
Peter Meerwald
7d241b2714 iio: staging: fix typo in ade758_ring.c
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:40:32 +01:00
Peter Meerwald
7f7ce433ba iio: staging: fix device.txt documentation
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:40:32 +01:00
Peter Meerwald
8f6817a0a5 iio staging: fix lis3l02dq, read error handling
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-07-09 22:11:53 +01:00
Wei Yongjun
bb37796102 staging:iio:ad7291: add missing .driver_module to struct iio_info
Add missing .driver_module of struct iio_info. This prevents the
module from being removed from underneath its users.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-07-06 10:39:26 +01:00
Marek Vasut
2a961d0995 iio: mxs-lradc: Remove useless check in read_raw
The removed check in the read_raw implementation was always true,
therefore remove it. This also fixes a bug, by closely inspecting
the code, one can notice the iio_validate_scan_mask_onehot() will
always return 1 and therefore the subsequent condition will always
succeed, therefore making the mxs_lradc_read_raw() function always
return -EINVAL; .

Signed-off-by: Marek Vasut <marex@denx.de>
Tested-by: Otavio Salvador <otavio@ossystems.com.br>
Acked-by: Hector Palacios <hector.palacios@digi.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-07-06 10:34:51 +01:00
Marek Vasut
e1b1fa66a0 iio: mxs-lradc: Fix misuse of iio->trig
The struct iio_dev .trig field is to be used only by the IIO core,
the driver shall not fill this field. This fixes ugly crash when
the driver is compiled as a module and the module is rmmod'd.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-07-03 20:48:53 +01:00
Lars-Peter Clausen
1df9d1d4a1 staging:iio:ad7291: Rework regulator handling
Add platform_data for the driver which allows to specify whether an external
reference voltage is used or not. It is not possible to use the return value of
regulator_get() for this since the regulator framework is able to return a dummy
regulator in case no regulator has been specified. In this case the driver will
always get a valid regulator, no matter if it has been specified or not.  Also
make the regulator non-optional if platform_data states that an external
reference voltage should be used.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-06-14 21:55:17 +01:00