Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1530863 > unrolled thread

Re: [PATCH 1/3] iio: st_sensors: match sensors using ACPI handle

Started byJonathan Cameron <jic23@kernel.org>
First post2016-11-27 12:30 +0100
Last post2016-11-27 12:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/3] iio: st_sensors: match sensors using ACPI handle Jonathan Cameron <jic23@kernel.org> - 2016-11-27 12:30 +0100

#1530863 — Re: [PATCH 1/3] iio: st_sensors: match sensors using ACPI handle

FromJonathan Cameron <jic23@kernel.org>
Date2016-11-27 12:30 +0100
SubjectRe: [PATCH 1/3] iio: st_sensors: match sensors using ACPI handle
Message-ID<sI5OF-3En-17@gated-at.bofh.it>
On 24/11/16 05:33, Shrirang Bagul wrote:
> Add support to match st sensors using information passed from ACPI DST
> tables.
> 
> Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders
to play with it.

Presumably at somepoint this will need extending to cover the spi parts, but we 
can do that when it is relevant.

Thanks,

Jonathan
> ---
>  drivers/iio/common/st_sensors/st_sensors_i2c.c | 20 ++++++++++++++++++++
>  include/linux/iio/common/st_sensors_i2c.h      |  9 +++++++++
>  2 files changed, 29 insertions(+)
> 
> diff --git a/drivers/iio/common/st_sensors/st_sensors_i2c.c b/drivers/iio/common/st_sensors/st_sensors_i2c.c
> index b43aa36..c83df4d 100644
> --- a/drivers/iio/common/st_sensors/st_sensors_i2c.c
> +++ b/drivers/iio/common/st_sensors/st_sensors_i2c.c
> @@ -13,6 +13,7 @@
>  #include <linux/slab.h>
>  #include <linux/iio/iio.h>
>  #include <linux/of_device.h>
> +#include <linux/acpi.h>
>  
>  #include <linux/iio/common/st_sensors_i2c.h>
>  
> @@ -107,6 +108,25 @@ void st_sensors_of_i2c_probe(struct i2c_client *client,
>  EXPORT_SYMBOL(st_sensors_of_i2c_probe);
>  #endif
>  
> +#ifdef CONFIG_ACPI
> +int st_sensors_match_acpi_device(struct device *dev)
> +{
> +	const struct acpi_device_id *acpi_id;
> +	kernel_ulong_t driver_data = 0;
> +
> +	if (ACPI_HANDLE(dev)) {
> +		acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
> +		if (!acpi_id) {
> +			dev_err(dev, "No driver data\n");
> +			return -EINVAL;
> +		}
> +		driver_data = acpi_id->driver_data;
> +	}
> +	return driver_data;
> +}
> +EXPORT_SYMBOL(st_sensors_match_acpi_device);
> +#endif
> +
>  MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
>  MODULE_DESCRIPTION("STMicroelectronics ST-sensors i2c driver");
>  MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/iio/common/st_sensors_i2c.h b/include/linux/iio/common/st_sensors_i2c.h
> index 1796af0..254de3c 100644
> --- a/include/linux/iio/common/st_sensors_i2c.h
> +++ b/include/linux/iio/common/st_sensors_i2c.h
> @@ -28,4 +28,13 @@ static inline void st_sensors_of_i2c_probe(struct i2c_client *client,
>  }
>  #endif
>  
> +#ifdef CONFIG_ACPI
> +int st_sensors_match_acpi_device(struct device *dev);
> +#else
> +static inline int st_sensors_match_acpi_device(struct device *dev)
> +{
> +	return -ENODEV;
> +}
> +#endif
> +
>  #endif /* ST_SENSORS_I2C_H */
> 

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web