From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: Himanshu Jha <himanshujha199640@gmail.com>
Cc: <jic23@kernel.org>, <linux-iio@vger.kernel.org>,
<lars@metafoo.de>, <pmeerw@pmeerw.net>, <daniel.baluta@gmail.com>
Subject: Re: [RFC 3/3] iio: imu: bme680: Add ACPI support
Date: Fri, 22 Jun 2018 14:44:35 +0100 [thread overview]
Message-ID: <20180622144435.0000613b@huawei.com> (raw)
In-Reply-To: <1529562877-9357-4-git-send-email-himanshujha199640@gmail.com>
On Thu, 21 Jun 2018 12:04:37 +0530
Himanshu Jha <himanshujha199640@gmail.com> wrote:
> Add support to probe the bme680 sensor on the i2c bus using
> ACPI.
>
> Cc: Daniel Baluta <daniel.baluta@gmail.com>
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
This looks fine. Do we know for sure that they use that ACPI
ID? For these sorts of devices, it's fairly common to have entirely
random ids presented. Also, I'm a little curious to know, what
ACPI based device has one of these?
Jonathan
> ---
> drivers/iio/imu/bme680/bme680_core.c | 15 +++++++++++++++
> drivers/iio/imu/bme680/bme680_i2c.c | 6 ++++++
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/iio/imu/bme680/bme680_core.c b/drivers/iio/imu/bme680/bme680_core.c
> index 05712de..a891b1f 100644
> --- a/drivers/iio/imu/bme680/bme680_core.c
> +++ b/drivers/iio/imu/bme680/bme680_core.c
> @@ -3,6 +3,7 @@
> *
> * IIO core driver - I2C & SPI bus support
> */
> +#include <linux/acpi.h>
> #include <linux/iio/iio.h>
> #include <linux/module.h>
> #include <linux/regmap.h>
> @@ -445,6 +446,17 @@ static int bme680_chip_init(struct bme680_data *data, bool use_spi)
> return 0;
> }
>
> +static const char *bme680_match_acpi_device(struct device *dev)
> +{
> + const struct acpi_device_id *id;
> +
> + id = acpi_match_device(dev->driver->acpi_match_table, dev);
> + if (!id)
> + return NULL;
> +
> + return dev_name(dev);
> +}
> +
> static const struct bme680_chip_info bme680_chip_info = {
> .oversampling_temp_avail = bme680_oversampling_avail,
> .num_oversampling_temp_avail = ARRAY_SIZE(bme680_oversampling_avail),
> @@ -480,6 +492,9 @@ int bme680_core_probe(struct device *dev, struct regmap *regmap,
> if (ret < 0)
> return ret;
>
> + if (!name && ACPI_HANDLE(dev))
> + name = bme680_match_acpi_device(dev);
> +
> indio_dev->dev.parent = dev;
> indio_dev->name = name;
> indio_dev->channels = bme680_channels;
> diff --git a/drivers/iio/imu/bme680/bme680_i2c.c b/drivers/iio/imu/bme680/bme680_i2c.c
> index 1c8223e..2807085 100644
> --- a/drivers/iio/imu/bme680/bme680_i2c.c
> +++ b/drivers/iio/imu/bme680/bme680_i2c.c
> @@ -3,6 +3,7 @@
> * - 0x76 if SDO is pulled to GND
> * - 0x77 if SDO is pulled to VDDIO
> */
> +#include <linux/acpi.h>
> #include <linux/i2c.h>
> #include <linux/module.h>
> #include <linux/regmap.h>
> @@ -41,6 +42,11 @@ static const struct i2c_device_id bme680_i2c_id[] = {
> };
> MODULE_DEVICE_TABLE(i2c, bme680_i2c_id);
>
> +static const struct acpi_device_id bme680_acpi_match[] = {
> + {"BME0680", 0},
> + {},
> +};
> +
> static struct i2c_driver bme680_i2c_driver = {
> .driver = {
> .name = "bme680_i2c",
next prev parent reply other threads:[~2018-06-22 13:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-21 6:34 [RFC 0/3] Bosch BME680 Driver Himanshu Jha
2018-06-21 6:34 ` [RFC 1/3] iio: imu: bme680: Add initial support for Bosch BME680 Himanshu Jha
2018-06-21 13:23 ` Jonathan Cameron
2018-06-21 6:34 ` [RFC 2/3] iio: imu: bme680: Add temperaure, pressure & humidity channels Himanshu Jha
2018-06-22 13:42 ` Jonathan Cameron
2018-06-22 14:24 ` Himanshu Jha
2018-06-21 6:34 ` [RFC 3/3] iio: imu: bme680: Add ACPI support Himanshu Jha
2018-06-22 13:44 ` Jonathan Cameron [this message]
2018-06-25 7:40 ` Daniel Baluta
2018-06-25 10:06 ` Jonathan Cameron
2018-06-29 13:02 ` Daniel Baluta
2018-06-30 17:48 ` Jonathan Cameron
2018-06-22 6:38 ` [RFC 0/3] Bosch BME680 Driver Matt Ranostay
2018-06-22 9:04 ` Himanshu Jha
2018-06-22 14:24 ` Matt Ranostay
2018-06-22 14:01 ` Jonathan Cameron
2018-06-22 14:14 ` Himanshu Jha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180622144435.0000613b@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=daniel.baluta@gmail.com \
--cc=himanshujha199640@gmail.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.