summaryrefslogtreecommitdiff
path: root/drivers/iio/pressure/st_pressure_core.c
AgeCommit message (Collapse)Author
2017-10-10iio: st_sensors: split open-drain parameters for irq1 and irq2Lorenzo Bianconi
Define st_sensor_int_drdy structure in st_sensor_data_ready_irq in order to contain irq line parameters of the device. Moreover separate data-ready open-drain configuration parameters for INT1 and INT2 pins in st_sensor_data_ready_irq data structure. That change will be used to properly support LIS3DHH accel sensor. Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-10iio: pressure: st_pressure: add SPI-3wire support to st_pressure frameworkLorenzo Bianconi
Add SPI Serial Interface Mode (SIM) register information to STM pressure framework Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09iio: st_sensors: decouple irq1 configuration parameters from the irq2 onesLorenzo Bianconi
Separate data-ready configuration parameters for INT1 and INT2 pins in st_sensor_data_ready_irq data structure. That change will be use to properly support LIS2DW12 accel sensor. Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09iio: st_sensors: add register mask for status registerLorenzo Bianconi
Introduce register mask for data-ready status register since pressure sensors (e.g. LPS22HB) export just two channels (BIT(0) and BIT(1)) and BIT(2) is marked reserved while in st_sensors_new_samples_available() value read from status register is masked using 0x7. Moreover do not mask status register using active_scan_mask since now status value is properly masked and if the result is not zero the interrupt has to be consumed by the driver. This fix an issue on LPS25H and LPS331AP where channel definition is swapped respect to status register. Furthermore that change allows to properly support new devices (e.g LIS2DW12) that report just ZYXDA (data-ready) field in status register to figure out if the interrupt has been generated by the device. Fixes: 97865fe41322 (iio: st_sensors: verify interrupt event to status) Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-09-03iio: pressure: add support to LPS33HW and LPS35HWLorenzo Bianconi
add support to STMicroelectronics LPS33HW and LPS35HW pressure sensors to st_pressure framework http://www.st.com/resource/en/datasheet/lps33hw.pdf http://www.st.com/resource/en/datasheet/lps35hw.pdf Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-08-22iio:pressure: drop assign iio_info.driver_module and iio_trigger_ops.ownerJonathan Cameron
The equivalent of both of these are now done via macro magic when the relevant register calls are made. The actual structure elements will shortly go away. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-08-20Merge tag 'iio-for-4.14b' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: Second set of IIO new device support, features and cleanup for the 4.14 cycle. New device support: * ak8974 - support the AMI306. * st_magnetometer - add support for the LIS2MDL with bindings. * rockchip-saradc - add binding for rv1108 SoC (no driver change). * srf08 - add srf02 (i2c only) and srf10 support. * stm32-timer - support for the STM32H7 to existing driver. Features: * tools - move over to the tools buildsystem rather than hand rolling. - add an install section to the build. * ak8974 - use serial number to add device randomness. - add AMI306 calibration data output. * ccs811 - triggered buffer support. * srf08 - add a device tree table as the old style i2c probing is going away, - add triggered buffer support * st32-adc - add optional st,min-sample-time-nsecs binding to allow control of sampling against analog circuitry. * stm32-timer - add output compare triggers. * ti-ads1015 - add threshold event support. * ti-ads7950 - Allow use on ACPI platforms including providing a default reference voltage as there is no way to obtain this on ACPI currently. Cleanup and fixes: * ad7606 - fix an error return code in probe. * ads1015 - fix incorrect data rate setting update when capture in progress, - fix wrong scale information for the ADS1115, - make conversions work when CONFIG_PM is not set, - make sure we don't get a stale result after a runtime resume by ensuring we wait long enough, - avoid returning a false error form the buffer setup callbacks, - add enough wait time to get the correct conversion, - remove an unnecessary config register update, - add a helper to set conversion mode reducing repeated boilerplate, - use devm_iio_triggered_buffer_setup to simplify error and remove paths, - use iio_device_claim_direct_mode instead of opencoding the same. * ak8974 - mark the INT_CLEAR register as precious to prevent debugfs access. * apds9300 - constify the i2c_device_id. * at91-sama5 adc - add missing Kconfig dependency. * bma180 accel - constify the i2c_device_id. * rockchip_saradc - explicitly request exclusive reset control as part of the reset rework on going throughout the kernel. * st_accel - fix drdy configuration for a load of accelerometers that only have the int1 line. Fix is unimportant as presumably no deviec tree actually used the non existent hardware line. * st_pressure - fix drdy configuration for LPS22HB and LPS25H by dropping int2 support as they don't have this. Fix is unimportant as presumably no device tree actually used the non existent hardware line. * stm32-dac - explicitly request exclusive reset control (part of reset being reworked). * tsl2583 - constify the i2c_device_id. * xadc - coding style fixes.
2017-08-12iio: pressure: st_pressure: fix drdy configuration for LPS22HB and LPS25HLorenzo Bianconi
Remove int2 configuration parameter for LPS22HB and LPS25H since these devices export just int1 as data-ready line Fixes: 931878405b86 (iio:pressure: Add support for LPS25H pressure sensor) Fixes: e039e2f5b4da (iio:st_pressure:initial lps22hb sensor support) Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-23Merge tag 'iio-fixes-for-4.13a' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus Jonathan writes: First set of IIO fixes for the 4.13 cycle. * ad2s1210 - Fix negative angular velocity reads (identified by a gcc 7 warning) * aspeed-adc - Wait for initialization sequence to finish before enabling channels. Without it no channels work. * axp288 - Revert a patch that dropped some bogus register mods. No one is entirely sure why but it breaks charging on some devices. - Fix GPADC pin read returning 0. Turns out a small sleep is needed. * bmc150 - Make sure device is restored to normal state after suspend / resume cycle. Otherwise, simple sysfs reads are broken. * tsl2563 - fix wrong event code. * st-accel - add spi 3-wire support. Needed to fix the lsm303agr accelerometer which only had 3 wires in all cases. Side effect is to enable optional 3-wire support for other devices. * st-pressure - disable multiread by default for LPS22HB (only effects SPI) * sun4i-gpadc-iio - fix unbalanced irq enable / disable * vf610 - Fix VALT slection for REFSEL bits - ensures we are using the right reference pins.
2017-06-24iio: pressure: st_pressure_core: disable multiread by default for LPS22HBLorenzo Bianconi
Set multiread variable to false for LPS22HB pressure sensor since it is already enabled in CTRL_REG2. Previous configuration does not cause any issue in I2C communication since SUB Msb has no meaning whereas it breaks register address in SPI communication Fixes: e039e2f5b4da (iio:st_pressure:initial lps22hb sensor support) Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-26iio: st_pressure: st_accel: Initialise sensor platform data properlyShrirang Bagul
This patch fixes the sensor platform data initialisation for st_pressure and st_accel device drivers. Without this patch, the driver fails to register the sensors when the user removes and re-loads the driver. 1. Unload the kernel modules for st_pressure $ sudo rmmod st_pressure_i2c $ sudo rmmod st_pressure 2. Re-load the driver $ sudo insmod st_pressure $ sudo insmod st_pressure_i2c Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Linus Walleij <linus.walleij@linaro.org>
2017-04-02iio: st_pressure: initialize lps22hb bootimeShrirang Bagul
This patch initializes the bootime in struct st_sensor_settings for lps22hb sensor. Without this, sensor channels read from sysfs always report stale values. Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-30iio: st_pressure: Export sampling frequency for lps25h and lps331apMarcin Niestroj
Both devices are using the same iio_chan_spec to define which settings are exported with sysfs. Both are properly configured to set/get sampling frequency for pressure and temperature. They also properly export available sampling frequencies. The only missing thing is sampling_frequency sysfs file, which allows to set/get this property from userspace. Add sampling frequency to iio channel info mask, so sampling_frequency file is properly exported using sysfs. Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-30iio: st_pressure: Fix data signMarcin Niestroj
Datasheet of each device (lps331ap, lps25h, lps001wp, lps22hb) says that the pressure and temperature data is a 2's complement. I'm sending this the slow way, as negative pressures on these are pretty unusual and the nature of the fixing of multiple device introduction patches will make it hard to apply to older kernels - Jonathan. Fixes: 217494e5b780 ("iio:pressure: Add STMicroelectronics pressures driver") Fixes: 2f5effcbd097 ("iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor") Fixes: 7885a8ce6800 ("iio: pressure: st: Add support for new LPS001WP pressure sensor") Fixes: e039e2f5b4da ("iio:st_pressure:initial lps22hb sensor support") Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-12iio: pressure: st_pressure: inline per-sensor dataLinus Walleij
We have #defines for all the individual sensor registers and value/mask pairs #defined at the top of the file and used at exactly one spot. This is usually good if the #defines give a meaning to the opaque magic numbers. However in this case, the semantic meaning is inherent in the name of the C99-addressable fields, and that means duplication of information, and only makes the code hard to maintain since you every time have to add a new #define AND update the site where it is to be used. Get rid of the #defines and just open code the values into the appropriate struct elements. Make sure to explicitly address the .hz and .value fields in the st_sensor_odr_avl struct so that the meaning of all values is clear. This patch is purely syntactic should have no semantic effect. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-04iio:st_pressure: clean useless static channel initializersGregor Boirie
Some static channels are explicitly initialized with default values. Remove them to enhance readability. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-04iio:st_pressure:lps22hb: temperature supportGregor Boirie
Implement lps22hb temperature sampling channel. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-04iio:st_pressure:lps22hb: open drain supportGregor Boirie
Add support for open drain interrupt line. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-04iio:st_pressure: temperature triggered bufferingGregor Boirie
Enable support for triggered buffering of temperature samples. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-04iio:st_pressure: document sampling gainsGregor Boirie
Details scaling factors and offsets applied to raw temperature and pressure samples. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-04iio:st_pressure: align storagebits on power of 2Gregor Boirie
Sampled pressure data are 24 bits long and should be stored in a 32 bits word. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-20Merge 4.7-rc4 into staging-nextGreg Kroah-Hartman
We want the fixes in here, and we can resolve a merge issue in drivers/iio/industrialio-trigger.c Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-29iio: st_sensors: switch to a threaded interruptLinus Walleij
commit 98ad8b41f58dff6b30713d7f09ae3834b8df7ded ("iio: st_sensors: verify interrupt event to status") caused a regression when reading ST sensors from a HRTimer trigger rather than the intrinsic interrupts: the HRTimer may trigger faster than the sensor provides new values, and as the check against new values available as a cause of the interrupt trigger was done in the poll function, this would bail out of the HRTimer interrupt with IRQ_NONE. So clearly we need to only check the new values available from the proper interrupt handler and not from the poll function, which should rather just read the raw values from the registers, put them into the buffer and be happy. To achieve this: switch the ST Sensors over to using a true threaded interrupt handler. In the interrupt thread, check if new values are available, else yield to the (potential) next device on the same interrupt line to check the registers. If the interrupt was ours, proceed to poll the values. Instead of relying on iio_trigger_generic_data_rdy_poll() as a top half to wake up the thread that polls the sensor for new data, have the thread call iio_trigger_poll_chained() after determining that is is the proper source of the interrupt. This is modelled on drivers/iio/accel/mma8452.c which is already using a properly threaded interrupt handler. In order to get the same precision in timestamps as previously, where samples would be timestamped in the poll function pf->timestamp when calling iio_trigger_generic_data_rdy_poll() we introduce a local timestamp in the sensor data, set it in the top half (fastpath) of the interrupt handler and provide that to the core when calling iio_push_to_buffers_with_timestamp(). Additionally: if the active scanmask is not set for the sensor no IRQs should be enabled and we need to bail out with IRQ_NONE. This can happen if spurious IRQs fire when installing the threaded interrupt handler. Tested with hard interrupt triggers on LIS331DL, then also tested with hrtimers on the same sensor by creating a 75Hz HRTimer and using it to poll the sensor. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Cc: Giuseppe Barba <giuseppe.barba@st.com> Cc: Denis Ciocca <denis.ciocca@st.com> Reported-by: Crestez Dan Leonard <cdleonard@gmail.com> Tested-by: Crestez Dan Leonard <cdleonard@gmail.com> Tested-by: Jonathan Cameron <jic23@kernel.org> Fixes: 97865fe41322 ("iio: st_sensors: verify interrupt event to status") Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-29iio:st_sensors: fix power regulator usageGregor Boirie
Ensure failure to enable power regulators is properly handled. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-29iio:st_pressure: fix sampling gains (bring inline with ABI)Gregor Boirie
Temperature channels report scaled samples in Celsius although expected as milli degree Celsius in Documentation/ABI/testing/sysfs-bus-iio. Gains are not implemented at all for LPS001WP pressure and temperature channels. This patch ensures that proper offsets and scales are exposed to userpace for both pressure and temperature channels. Also fix a NULL pointer exception when userspace reads content of sysfs scale attribute when gains are not defined. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-29iio:st_pressure:initial lps22hb sensor supportGregor Boirie
Initial support for ST LPS22HB pressure sensor. Datasheet: http://www2.st.com/resource/en/datasheet/lps22hb.pdf Features: * pressure data and timestamping channels * sampling frequency selection * interrupt based trigger * over I2C or SPI Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-19iio: st_sensors: support open drain modeLinus Walleij
Some types of ST Sensors can be connected to the same IRQ line as other peripherals using open drain. Add a device tree binding and a sensor data property to flip the right bit in the interrupt control register to enable open drain mode on the INT line. If the line is set to be open drain, also tag on IRQF_SHARED to the IRQ flags when requesting the interrupt, as the whole point of using open drain interrupt lines is to share them with more than one peripheral (wire-or). Cc: devicetree@vger.kernel.org Cc: Giuseppe Barba <giuseppe.barba@st.com> Cc: Denis Ciocca <denis.ciocca@st.com> Acked-by: Rob Herring <rob@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-19iio: st_sensors: verify interrupt event to statusLinus Walleij
This makes all ST sensor drivers check that they actually have new data available for the requested channel(s) before claiming an IRQ, by reading the status register (which is conveniently the same for all ST sensors) and check that the channel has new data before proceeding to read it and fill the buffer. This way sensors can share an interrupt line: it can be flaged as shared and then the sensor that did not fire will return NO_IRQ, and the sensor that fired will handle the IRQ and return IRQ_HANDLED. Cc: Giuseppe Barba <giuseppe.barba@st.com> Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-10iio: st_sensors: support active-low interruptsLinus Walleij
Most ST MEMS Sensors that support interrupts can also handle sending an active low interrupt, i.e. going from high to low on data ready (or other interrupt) and thus triggering on a falling edge to the interrupt controller. Set up logic to inspect the interrupt line we get for a sensor: if it is triggering on rising edge, leave everything alone, but if it triggers on falling edges, set up active low, and if unsupported configurations appear: warn with errors and reconfigure the interrupt to a rising edge, which all interrupt generating sensors support. Create a local header for st_sensors_core.h to share functions between the sensor core and the trigger setup code. Cc: Giuseppe Barba <giuseppe.barba@st.com> Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-16iio: st_sensors: add debugfs register read hookLinus Walleij
This adds a debugfs hook to read/write registers in the ST sensors using debugfs. Proved to be awesome help when trying to debug why IRQs do not arrive. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-23iio: st-sensors: add configuration for WhoAmI addressGiuseppe Barba
This patch permits to configure the WhoAmI register address because some device could have not a standard address for this register. Signed-off-by: Giuseppe Barba <giuseppe.barba@st.com> Reviewed-by: Denis Ciocca <denis.ciocca@st.com> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26iio:st_sensors: Fix oops when probing SPI devicesAlban Bedel
In SPI mode the transfer buffer is locked with a mutex. However this mutex is only initilized after the probe, but some transfer needs to be done in the probe. To fix this bug we move the mutex initialization at the beginning of the device probe. Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de> Acked-by: Denis Ciocca <denis.ciocca@st.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-04iio:pressure: Changed pressure data variable name to press_dataDenis CIOCCA
This patch fix pressure data variable name. Usually pdata name it is used for platform data. Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-04iio:pressure: Removed unnecessary parameter on common_probe functionDenis CIOCCA
Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-04iio:imu: changed structure name from st_sensors to st_sensor_settingsDenis CIOCCA
This patch change structure name and related variables names. Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-07-07iio:st sensors: remove custom sampling frequence attribute in favour of core ↵Jonathan Cameron
support. This allows in kernel client drivers to access this Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: Denis Ciocca <denis.ciocca@st.com> Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
2014-04-26iio: st_sensors: move regulator retrieveal to coreLinus Walleij
Currently the pressure sensor has code to retrieve and enable two regulators for Vdd and Vdd IO, but actually these voltage inputs are found on all of these ST sensors, so move the regulator handling to the core and make sure all the ST sensors call these functions on probe() and remove() to enable/disable power. Here also mover over to obtaining the regulator from the *parent* device of the IIO device, as the IIO device is created on-the-fly in this very subsystem it very unlikely evert have any regulators attached to it whatsoever. It is much more likely that the parent is a platform device, possibly instantiated from a device tree, which in turn have Vdd and Vdd IO supplied assigned to it. Cc: Lee Jones <lee.jones@linaro.org> Cc: Denis CIOCCA <denis.ciocca@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-04-26iio: st_sensors: announce registered sensorsLinus Walleij
It is pretty helpful to know already from dmesg that a certain device is successfully registered, instead of having to browse sysfs to see if it's actually there. Cc: Lee Jones <lee.jones@linaro.org> Cc: Denis CIOCCA <denis.ciocca@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-22iio:pressure: Add support for LPS25H pressure sensorDenis CIOCCA
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>
2013-09-23iio: pressure-core: st: Provide support for the Vdd_IO power supplyLee Jones
The power to some of the sensors are controlled by regulators. In most cases these are 'always on', but if not they will fail to work until the regulator is enabled using the relevant APIs. This patch allows for the Vdd_IO power supply to be specified by either platform data or Device Tree. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-23iio: pressure-core: st: Provide support for the Vdd power supplyLee Jones
The power to some of the sensors are controlled by regulators. In most cases these are 'always on', but if not they will fail to work until the regulator is enabled using the relevant APIs. This patch allows for the Vdd power supply to be specified by either platform data or Device Tree. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-21iio:press: Register buffer also without specific triggerDenis CIOCCA
This patch fix buffer registration that allows to use generic IIO trigger. Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-21iio: pressure: st: Add support for new LPS001WP pressure sensorLee Jones
Here we use existing practices to introduce support for another pressure/temperature sensor, the LPS001WP. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-21iio: pressure-core: st: Clean-up probe() functionLee Jones
This patch contains some pretty basic clean-ups in probe() pertaining to the simplification of error handling and a couple of readability adaptions. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-21iio: sensors-core: st: Support sensors which don't have a Data Ready pinLee Jones
Not all ST's sensors support data ready, so let's make the declaration of one conditional. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-14iio: pressure-core: st: Allow for number of channels to varyLee Jones
At the moment the number of channels specified is dictated by the first sensor supported by the driver. As we add support for more sensors this is likely to vary. Instead of using the ARRAY_SIZE() of the LPS331AP's channel specifier we'll use a new adaptable 'struct st_sensors' element instead. Signed-off-by: Lee Jones <lee.jones@linaro.org> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-14iio: pressure-core: st: Expand and rename LPS331AP's channel descriptorLee Jones
Due to the MACRO used, the task of reading, understanding and maintaining the LPS331AP's channel descriptor is substantially difficult. This patch is based on the view that it's better to have easy to read, maintainable code than to save a few lines here and there. For that reason we're expanding the array so initialisation is completed in full. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-14iio: pressure-core: st: Describe LPS331AP defines by nameLee Jones
They're currently named *_1_*, for 'Sensor 1', but the code will be much more readable if we use the naming convention *_LPS331AP_* instead. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-14iio: sensors-core: st: Allow full-scale to be an optional featureLee Jones
Some chips either don't support it or fail to provide adequate documentation, so sometimes it's impossible to enable the feature even if it is supported. Signed-off-by: Lee Jones <lee.jones@linaro.org> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03iio: pressure: st_pressure: Use devm_iio_device_allocSachin Kamat
Using devm_iio_device_alloc makes code simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>