History log of /linux-master/drivers/iio/pressure/st_pressure_i2c.c
Revision Date Author Comments
# 042ffa6d 31-Dec-2023 Jonathan Cameron <Jonathan.Cameron@huawei.com>

iio: st_sensors: drop ACPI_PTR() and CONFIG_ACPI guards

The complexity of config guards needed for ACPI_PTR() is not worthwhile
for the small amount of saved data. This example was doing it correctly
but I am proposing dropping this so as to reduce chance of cut and paste
where it is done wrong. Also drop now unneeded linux/acpi.h include.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Denis CIOCCA <denis.ciocca@st.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231231183514.566609-22-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 7cf15f42 15-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

iio: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230515205048.19561-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# a52833a5 18-Nov-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

iio: pressure: st_pressure_i2c: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20221118224540.619276-177-uwe@kleine-koenig.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 92ba0ab9 09-Sep-2022 Martyn Welch <martyn.welch@collabora.co.uk>

iio: pressure: st_pressure: Add support for LPS22DF

Add support for ST LPS22DF pressure sensor.

Datasheet: https://www.st.com/resource/en/datasheet/lps22df.pdf
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Link: https://lore.kernel.org/r/20220909161611.780720-2-martyn.welch@collabora.co.uk
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 0805b512 16-Jan-2022 Jonathan Cameron <Jonathan.Cameron@huawei.com>

iio:st-sensors: Move exports into IIO_ST_SENSORS namespace

To avoid unnecessary pollution of the global symbol namespace move the
driver core and type specific core exports into their a new namespace
and import that where needed.

For more info see https://lwn.net/Articles/760045/

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Denis Ciocca <denis.ciocca@st.com>
Link: https://lore.kernel.org/r/20220116180535.2367780-14-jic23@kernel.org


# 6b658c31 23-Aug-2021 Alexandru Ardelean <aardelean@deviqon.com>

iio: st_sensors: remove all driver remove functions

At this point all ST driver remove functions do iio_device_unregister().
This change removes them from them and replaces all iio_device_register()
with devm_iio_device_register().

This can be done in a single change relatively easy, since all these remove
functions are define in st_sensors.h.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210823112204.243255-5-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 5363c6c1 23-Aug-2021 Alexandru Ardelean <aardelean@deviqon.com>

iio: st_sensors: remove st_sensors_power_disable() function

This change converts the st_sensors_power_enable() function to use
devm_add_action_or_reset() handlers to register regulator_disable hooks for
when the drivers get unloaded.

The parent device of the IIO device object is used. This is based on the
assumption that all other devm_ calls in the ST sensors use this reference.

This makes the st_sensors_power_disable() un-needed.
Removing this also changes unload order a bit, as all ST drivers would call
st_sensors_power_disable() first and iio_device_unregister() after that.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210823112204.243255-4-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 9f0b3e0c 23-Aug-2021 Alexandru Ardelean <aardelean@deviqon.com>

iio: st_sensors: disable regulators after device unregistration

Up until commit ea7e586bdd331 ("iio: st_sensors: move regulator retrieveal
to core") only the ST pressure driver seems to have had any regulator
disable. After that commit, the regulator handling was moved into the
common st_sensors logic.

In all instances of this regulator handling, the regulators were disabled
before unregistering the IIO device.
This can cause issues where the device would be powered down and still be
available to userspace, allowing it to send invalid/garbage data.

This change moves the st_sensors_power_disable() after the common probe
functions. These common probe functions also handle unregistering the IIO
device.

Fixes: 774487611c949 ("iio: pressure-core: st: Provide support for the Vdd power supply")
Fixes: ea7e586bdd331 ("iio: st_sensors: move regulator retrieveal to core")
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Denis CIOCCA <denis.ciocca@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210823112204.243255-2-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 9c6cd755 08-Jun-2021 Jonathan Cameron <Jonathan.Cameron@huawei.com>

iio: st-sensors: Remove some unused includes and add some that should be there

The st-sensors drivers have changed in structure over time, and includes
have not always kept up with this. Let's bring them back to nearer
the ideal.

Identified with the include-what-you-use tool and careful checking of
its suggestions.

Note I haven't been particularly aggressive here, so this is just the
cases where the include obviously isn't needed rather than the more
subtle corners.

Note I took the opportunity to add mod_devicetable.h as I generally
prefer to see that when acpi or of match tables are present.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Denis Ciocca <denis.ciocca@st.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210608175149.4019289-1-jic23@kernel.org


# 7db4f2ca 14-Apr-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

iio: st_sensors: Call st_sensors_power_enable() from bus drivers

In case we would initialize two IIO devices from one physical device,
we shouldn't have a clash on regulators. That's why move
st_sensors_power_enable() call from core to bus drivers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210414195454.84183-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# ecb27c5e 16-Dec-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

iio: st_sensors: Make use of device properties

Device property API allows to gather device resources from different sources,
such as ACPI. Convert the drivers to unleash the power of device property API.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# efc78983 16-Dec-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

iio: st_sensors: Drop redundant parameter from st_sensors_of_name_probe()

Since we have access to the struct device_driver and thus to the ID table,
there is no need to supply special parameters to st_sensors_of_name_probe().

Besides that we have a common API to get driver match data, there is
no need to do matching separately for OF and ACPI.

Taking into consideration above, simplify the ST sensors code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 40ca77d5 16-Dec-2019 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

iio: pressure: st_press: Drop unnecessary #else branch for ACPI

ACPI_PTR() takes care of the argument in case of !CONFIG_ACPI.
Remove unnecessary #else branch.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 062809ef 18-Jul-2019 Denis Ciocca <denis.ciocca@st.com>

iio: make st_sensors drivers use regmap

This patch is meant to replace the i2c/spi transfer functions with
regmap. SPI framework requires DMA safe buffers so let's add GFP_DMA
flag for memory allocation used by bulk_read functions.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# 570c2c55 18-Jul-2019 Denis Ciocca <denis.ciocca@st.com>

iio:pressure: device settings are set immediately during probe

This patch set pressure settings right after probe start. This is
done in preparation of regmap that needs different configuration
based on multiread bit value.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# fda8d26e 28-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 177

Based on 1 normalized pattern(s):

licensed under the gpl 2

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 135 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Steve Winslow <swinslow@gmail.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190528170026.071193225@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e5aab7b0 14-Jan-2019 mario tesi <mario.tesi@st.com>

iio:st_pressure:initial lps22hh sensor support

Initial support for ST LPS22HH pressure sensor. Datasheet:
http://www2.st.com/resource/en/datasheet/lps22hh.pdf

Features:
* pressure, temperature data and timestamping channels
* sampling frequency selection [1..200] Hz
* interrupt based trigger
* over I2C or SPI interface

Signed-off-by: mario tesi <mario.tesi@st.com>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# cd570e6f 12-Jul-2018 Dominique Martinet <asmadeus@codewreck.org>

iio: change strncpy+truncation to strlcpy

Generated by scripts/coccinelle/misc/strncpy_truncation.cocci

Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


# b954d77a 02-Sep-2017 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

iio: pressure: add support to LPS33HW and LPS35HW

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>


# 250bbbdb 20-Jun-2017 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>

iio: common: st_sensors: move st_sensors_of_i2c_probe() in common code

Move st_sensors_of_i2c_probe() in st_sensors_core and rename it in
st_sensors_of_name_probe(). That change is necessary to add device-tree
support in spi code otherwise the rest of the autodetection will fail
since spi->modalias (and indio_dev->name) will be set using compatible
string value that differs from standard sensor name

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 9d317724 23-Nov-2016 Shrirang Bagul <shrirang.bagul@canonical.com>

iio: st_pressure: Support i2c probe using acpi

Compatible strings are not available on ACPI based systems. This patch adds
support to use DSDT information read from platform BIOS instead for probing
st pressure sensors.

Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# e039e2f5 19-Apr-2016 Gregor Boirie <gregor.boirie@parrot.com>

iio:st_pressure:initial lps22hb sensor support

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>


# 2155971a 09-Jul-2015 Krzysztof Kozlowski <krzk@kernel.org>

iio: Drop owner assignment from i2c_driver

i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 7be178bb 03-Oct-2014 Denis CIOCCA <denis.ciocca@st.com>

iio:common: Set the device pointer into ST common sensors library

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# a1dcf429 03-Oct-2014 Denis CIOCCA <denis.ciocca@st.com>

iio:pressure: Changed pressure data variable name to press_data

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>


# 0baa3fc1 03-Oct-2014 Denis CIOCCA <denis.ciocca@st.com>

iio:pressure: Removed unnecessary parameter on common_probe function

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 2d7768a8 07-Aug-2014 Linus Walleij <linus.walleij@linaro.org>

iio: st_sensors: add devicetree probing support

The I2C devices that make up the STMicroelectronics MEMS sensors
may be sneakily enabled by cleverly giving the device node the same
name as a string match from the platform device ID table. However
the right method is to use the compatible string.

On detection, the ST sensors use the ID string to probe and
instatiate the right sensor driver, so pass the kernel-internal ID
string in the .data field of the OF match table, and set the I2C
client name to this name when a compatible match is used.

This avoids having misc Linux-specific strings floating around in
the device tree.

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>


# 93187840 20-Feb-2014 Denis CIOCCA <denis.ciocca@st.com>

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>


# 7885a8ce 16-Sep-2013 Lee Jones <lee.jones@linaro.org>

iio: pressure: st: Add support for new LPS001WP pressure sensor

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>


# d0fe8c8b 30-Jul-2013 Sachin Kamat <sachin.kamat@linaro.org>

iio: pressure: st_pressure: Use devm_iio_device_alloc

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>


# 23cde4d6 19-Jun-2013 Denis CIOCCA <denis.ciocca@st.com>

iio: Added ST-sensors platform data to select the DRDY interrupt pin

This patch add support to redirect the DRDY interrupt on INT1 or INT2
on accelerometer and pressure sensors.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>


# 217494e5 03-Jun-2013 Denis CIOCCA <denis.ciocca@st.com>

iio:pressure: Add STMicroelectronics pressures driver

This patch adds a generic pressure driver for STMicroelectronics
pressure sensors, currently it supports: LPS331AP.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>