Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1601041 > unrolled thread
| Started by | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| First post | 2017-03-15 05:50 +0100 |
| Last post | 2017-03-19 12:00 +0100 |
| Articles | 17 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v2 00/17] iio: Add OF device table to I2C drivers that are missing it Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-15 05:50 +0100
[PATCH v2 11/17] iio: dac: max5821: Set .of_match_table to OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-15 05:50 +0100
Re: [PATCH v2 11/17] iio: dac: max5821: Set .of_match_table to OF device ID table Jonathan Cameron <jic23@kernel.org> - 2017-03-19 12:00 +0100
[PATCH v2 02/17] iio: mlx96014: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-15 05:50 +0100
Re: [PATCH v2 02/17] iio: mlx96014: Add OF device ID table Crt Mori <cmo@melexis.com> - 2017-03-15 11:50 +0100
Re: [PATCH v2 02/17] iio: mlx96014: Add OF device ID table Jonathan Cameron <jic23@kernel.org> - 2017-03-19 12:00 +0100
[PATCH v2 13/17] iio: magnetometer: mag3110: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-15 05:50 +0100
Re: [PATCH v2 13/17] iio: magnetometer: mag3110: Add OF device ID table Jonathan Cameron <jic23@kernel.org> - 2017-03-19 12:00 +0100
[PATCH v2 04/17] iio: dac: mcp4725: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-15 05:50 +0100
Re: [PATCH v2 04/17] iio: dac: mcp4725: Add OF device ID table Jonathan Cameron <jic23@kernel.org> - 2017-03-19 12:00 +0100
[PATCH v2 15/17] iio: pressure: mpl3115: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-15 05:50 +0100
Re: [PATCH v2 15/17] iio: pressure: mpl3115: Add OF device ID table Jonathan Cameron <jic23@kernel.org> - 2017-03-19 12:00 +0100
[PATCH v2 07/17] iio: pressure: hp03: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-15 05:50 +0100
[PATCH v2 10/17] iio: light: apds9960: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-15 05:50 +0100
[PATCH v2 08/17] iio: imu: inv_mpu6050: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-15 05:50 +0100
[PATCH v2 03/17] iio: magnetometer: bmc150_magn_i2c: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-15 05:50 +0100
Re: [PATCH v2 03/17] iio: magnetometer: bmc150_magn_i2c: Add OF device ID table Jonathan Cameron <jic23@kernel.org> - 2017-03-19 12:00 +0100
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-15 05:50 +0100 |
| Subject | [PATCH v2 00/17] iio: Add OF device table to I2C drivers that are missing it |
| Message-ID | <tl92N-2mK-3@gated-at.bofh.it> |
Hello, This series add OF device ID tables to IIO I2C drivers whose devices are either used in Device Tree source files or are listed in binding docs as a compatible string. That's done because the plan is to change the I2C core to report proper OF modaliases instead of always reporting a MODALIAS=i2c:<foo> regardless if a device was registered via DT or using the legacy platform data mechanism. So these patches will make sure that IIO I2C drivers modules will continue to be autoloaded once the I2C core is changed to report proper OF modalias. Changes in v2: - Avoid using of_match_ptr() macro which leads to build warnings when CONFIG_OF is not enabled (Arnd Bergmann). Best regards, Javier Javier Martinez Canillas (17): iio: adc: ina2xx: Add OF device ID table iio: mlx96014: Add OF device ID table iio: magnetometer: bmc150_magn_i2c: Add OF device ID table iio: dac: mcp4725: Add OF device ID table iio: light: us5182d: Add OF device ID table iio: light: tsl2563: Add OF device ID table iio: pressure: hp03: Add OF device ID table iio: imu: inv_mpu6050: Add OF device ID table iio: accel: bma180: Add OF device ID table iio: light: apds9960: Add OF device ID table iio: dac: max5821: Set .of_match_table to OF device ID table iio: adc: ti-ads1015: Add OF device ID table iio: magnetometer: mag3110: Add OF device ID table iio: accel: mma7455_i2c: Add OF device ID table iio: pressure: mpl3115: Add OF device ID table iio: accel: mma7660: Add OF device ID table iio: gyro: itg3200: Add OF device ID table drivers/iio/accel/bma180.c | 24 +++++++++++++++++-- drivers/iio/accel/mma7455_i2c.c | 8 +++++++ drivers/iio/accel/mma7660.c | 7 ++++++ drivers/iio/adc/ina2xx-adc.c | 34 +++++++++++++++++++++++++- drivers/iio/adc/ti-ads1015.c | 24 +++++++++++++++++-- drivers/iio/dac/max5821.c | 1 + drivers/iio/dac/mcp4725.c | 24 +++++++++++++++++-- drivers/iio/gyro/itg3200_core.c | 7 ++++++ drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 38 ++++++++++++++++++++++++++---- drivers/iio/light/apds9960.c | 7 ++++++ drivers/iio/light/tsl2563.c | 10 ++++++++ drivers/iio/light/us5182d.c | 7 ++++++ drivers/iio/magnetometer/bmc150_magn_i2c.c | 9 +++++++ drivers/iio/magnetometer/mag3110.c | 7 ++++++ drivers/iio/pressure/hp03.c | 7 ++++++ drivers/iio/pressure/mpl3115.c | 7 ++++++ drivers/iio/temperature/mlx90614.c | 7 ++++++ 17 files changed, 217 insertions(+), 11 deletions(-) -- 2.9.3
[toc] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-15 05:50 +0100 |
| Subject | [PATCH v2 11/17] iio: dac: max5821: Set .of_match_table to OF device ID table |
| Message-ID | <tl92O-2mK-33@gated-at.bofh.it> |
| In reply to | #1601041 |
The driver has a OF device ID table but the struct i2c_driver
.of_match_table field is not set.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/iio/dac/max5821.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/iio/dac/max5821.c b/drivers/iio/dac/max5821.c
index 86e9e112f554..193fac3059a3 100644
--- a/drivers/iio/dac/max5821.c
+++ b/drivers/iio/dac/max5821.c
@@ -392,6 +392,7 @@ MODULE_DEVICE_TABLE(of, max5821_of_match);
static struct i2c_driver max5821_driver = {
.driver = {
.name = "max5821",
+ .of_match_table = max5821_of_match,
.pm = MAX5821_PM_OPS,
},
.probe = max5821_probe,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Date | 2017-03-19 12:00 +0100 |
| Subject | Re: [PATCH v2 11/17] iio: dac: max5821: Set .of_match_table to OF device ID table |
| Message-ID | <tmGJ4-4r7-9@gated-at.bofh.it> |
| In reply to | #1601042 |
On 15/03/17 04:44, Javier Martinez Canillas wrote:
> The driver has a OF device ID table but the struct i2c_driver
> .of_match_table field is not set.
>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
applied.
> ---
>
> drivers/iio/dac/max5821.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iio/dac/max5821.c b/drivers/iio/dac/max5821.c
> index 86e9e112f554..193fac3059a3 100644
> --- a/drivers/iio/dac/max5821.c
> +++ b/drivers/iio/dac/max5821.c
> @@ -392,6 +392,7 @@ MODULE_DEVICE_TABLE(of, max5821_of_match);
> static struct i2c_driver max5821_driver = {
> .driver = {
> .name = "max5821",
> + .of_match_table = max5821_of_match,
> .pm = MAX5821_PM_OPS,
> },
> .probe = max5821_probe,
>
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-15 05:50 +0100 |
| Subject | [PATCH v2 02/17] iio: mlx96014: Add OF device ID table |
| Message-ID | <tl92O-2mK-25@gated-at.bofh.it> |
| In reply to | #1601041 |
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.
But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/iio/temperature/mlx90614.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/mlx90614.c
index 4b645fc672aa..2077eef4095c 100644
--- a/drivers/iio/temperature/mlx90614.c
+++ b/drivers/iio/temperature/mlx90614.c
@@ -585,6 +585,12 @@ static const struct i2c_device_id mlx90614_id[] = {
};
MODULE_DEVICE_TABLE(i2c, mlx90614_id);
+static const struct of_device_id mlx90614_of_match[] = {
+ { .compatible = "melexis,mlx90614" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, mlx90614_of_match);
+
#ifdef CONFIG_PM_SLEEP
static int mlx90614_pm_suspend(struct device *dev)
{
@@ -644,6 +650,7 @@ static const struct dev_pm_ops mlx90614_pm_ops = {
static struct i2c_driver mlx90614_driver = {
.driver = {
.name = "mlx90614",
+ .of_match_table = mlx90614_of_match,
.pm = &mlx90614_pm_ops,
},
.probe = mlx90614_probe,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Crt Mori <cmo@melexis.com> |
|---|---|
| Date | 2017-03-15 11:50 +0100 |
| Subject | Re: [PATCH v2 02/17] iio: mlx96014: Add OF device ID table |
| Message-ID | <tleFc-6nm-21@gated-at.bofh.it> |
| In reply to | #1601043 |
Hi,
Thanks for the patch. If the assumption will not be there than this
fix is needed. I tested it on BeagleBoneBlack and it does not effect
anything.
Tested-by: Crt Mori <cmo@melexis.com>
Acked-by: Crt Mori <cmo@melexis.com>
Best regards,
Crt
On 15 March 2017 at 05:44, Javier Martinez Canillas
<javier@osg.samsung.com> wrote:
> The driver doesn't have a struct of_device_id table but supported devices
> are registered via Device Trees. This is working on the assumption that a
> I2C device registered via OF will always match a legacy I2C device ID and
> that the MODALIAS reported will always be of the form i2c:<device>.
>
> But this could change in the future so the correct approach is to have an
> OF device ID table if the devices are registered via OF.
>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> ---
>
> drivers/iio/temperature/mlx90614.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/mlx90614.c
> index 4b645fc672aa..2077eef4095c 100644
> --- a/drivers/iio/temperature/mlx90614.c
> +++ b/drivers/iio/temperature/mlx90614.c
> @@ -585,6 +585,12 @@ static const struct i2c_device_id mlx90614_id[] = {
> };
> MODULE_DEVICE_TABLE(i2c, mlx90614_id);
>
> +static const struct of_device_id mlx90614_of_match[] = {
> + { .compatible = "melexis,mlx90614" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, mlx90614_of_match);
> +
> #ifdef CONFIG_PM_SLEEP
> static int mlx90614_pm_suspend(struct device *dev)
> {
> @@ -644,6 +650,7 @@ static const struct dev_pm_ops mlx90614_pm_ops = {
> static struct i2c_driver mlx90614_driver = {
> .driver = {
> .name = "mlx90614",
> + .of_match_table = mlx90614_of_match,
> .pm = &mlx90614_pm_ops,
> },
> .probe = mlx90614_probe,
> --
> 2.9.3
>
[toc] | [prev] | [next] | [standalone]
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Date | 2017-03-19 12:00 +0100 |
| Subject | Re: [PATCH v2 02/17] iio: mlx96014: Add OF device ID table |
| Message-ID | <tmGJ4-4r7-19@gated-at.bofh.it> |
| In reply to | #1601264 |
On 15/03/17 10:46, Crt Mori wrote:
> Hi,
> Thanks for the patch. If the assumption will not be there than this
> fix is needed. I tested it on BeagleBoneBlack and it does not effect
> anything.
>
> Tested-by: Crt Mori <cmo@melexis.com>
> Acked-by: Crt Mori <cmo@melexis.com>
Applied.
Thanks,
Jonathan
>
> Best regards,
> Crt
>
>
> On 15 March 2017 at 05:44, Javier Martinez Canillas
> <javier@osg.samsung.com> wrote:
>> The driver doesn't have a struct of_device_id table but supported devices
>> are registered via Device Trees. This is working on the assumption that a
>> I2C device registered via OF will always match a legacy I2C device ID and
>> that the MODALIAS reported will always be of the form i2c:<device>.
>>
>> But this could change in the future so the correct approach is to have an
>> OF device ID table if the devices are registered via OF.
>>
>> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
>> ---
>>
>> drivers/iio/temperature/mlx90614.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/mlx90614.c
>> index 4b645fc672aa..2077eef4095c 100644
>> --- a/drivers/iio/temperature/mlx90614.c
>> +++ b/drivers/iio/temperature/mlx90614.c
>> @@ -585,6 +585,12 @@ static const struct i2c_device_id mlx90614_id[] = {
>> };
>> MODULE_DEVICE_TABLE(i2c, mlx90614_id);
>>
>> +static const struct of_device_id mlx90614_of_match[] = {
>> + { .compatible = "melexis,mlx90614" },
>> + { }
>> +};
>> +MODULE_DEVICE_TABLE(of, mlx90614_of_match);
>> +
>> #ifdef CONFIG_PM_SLEEP
>> static int mlx90614_pm_suspend(struct device *dev)
>> {
>> @@ -644,6 +650,7 @@ static const struct dev_pm_ops mlx90614_pm_ops = {
>> static struct i2c_driver mlx90614_driver = {
>> .driver = {
>> .name = "mlx90614",
>> + .of_match_table = mlx90614_of_match,
>> .pm = &mlx90614_pm_ops,
>> },
>> .probe = mlx90614_probe,
>> --
>> 2.9.3
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-15 05:50 +0100 |
| Subject | [PATCH v2 13/17] iio: magnetometer: mag3110: Add OF device ID table |
| Message-ID | <tl92O-2mK-31@gated-at.bofh.it> |
| In reply to | #1601041 |
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.
But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/iio/magnetometer/mag3110.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c
index b4f643fb3b1e..dad8d57f7402 100644
--- a/drivers/iio/magnetometer/mag3110.c
+++ b/drivers/iio/magnetometer/mag3110.c
@@ -441,9 +441,16 @@ static const struct i2c_device_id mag3110_id[] = {
};
MODULE_DEVICE_TABLE(i2c, mag3110_id);
+static const struct of_device_id mag3110_of_match[] = {
+ { .compatible = "fsl,mag3110" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, mag3110_of_match);
+
static struct i2c_driver mag3110_driver = {
.driver = {
.name = "mag3110",
+ .of_match_table = mag3110_of_match,
.pm = MAG3110_PM_OPS,
},
.probe = mag3110_probe,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Date | 2017-03-19 12:00 +0100 |
| Subject | Re: [PATCH v2 13/17] iio: magnetometer: mag3110: Add OF device ID table |
| Message-ID | <tmGJ4-4r7-15@gated-at.bofh.it> |
| In reply to | #1601044 |
On 15/03/17 04:45, Javier Martinez Canillas wrote:
> The driver doesn't have a struct of_device_id table but supported devices
> are registered via Device Trees. This is working on the assumption that a
> I2C device registered via OF will always match a legacy I2C device ID and
> that the MODALIAS reported will always be of the form i2c:<device>.
>
> But this could change in the future so the correct approach is to have an
> OF device ID table if the devices are registered via OF.
>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Applied.
> ---
>
> drivers/iio/magnetometer/mag3110.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c
> index b4f643fb3b1e..dad8d57f7402 100644
> --- a/drivers/iio/magnetometer/mag3110.c
> +++ b/drivers/iio/magnetometer/mag3110.c
> @@ -441,9 +441,16 @@ static const struct i2c_device_id mag3110_id[] = {
> };
> MODULE_DEVICE_TABLE(i2c, mag3110_id);
>
> +static const struct of_device_id mag3110_of_match[] = {
> + { .compatible = "fsl,mag3110" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, mag3110_of_match);
> +
> static struct i2c_driver mag3110_driver = {
> .driver = {
> .name = "mag3110",
> + .of_match_table = mag3110_of_match,
> .pm = MAG3110_PM_OPS,
> },
> .probe = mag3110_probe,
>
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-15 05:50 +0100 |
| Subject | [PATCH v2 04/17] iio: dac: mcp4725: Add OF device ID table |
| Message-ID | <tl92O-2mK-35@gated-at.bofh.it> |
| In reply to | #1601041 |
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.
But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/iio/dac/mcp4725.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c
index db109f0cdd8c..6ab1f23e5a79 100644
--- a/drivers/iio/dac/mcp4725.c
+++ b/drivers/iio/dac/mcp4725.c
@@ -19,6 +19,7 @@
#include <linux/err.h>
#include <linux/delay.h>
#include <linux/regulator/consumer.h>
+#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/iio/iio.h>
@@ -199,7 +200,7 @@ static ssize_t mcp4725_write_powerdown(struct iio_dev *indio_dev,
return len;
}
-enum {
+enum chip_id {
MCP4725,
MCP4726,
};
@@ -406,7 +407,10 @@ static int mcp4725_probe(struct i2c_client *client,
data = iio_priv(indio_dev);
i2c_set_clientdata(client, indio_dev);
data->client = client;
- data->id = id->driver_data;
+ if (client->dev.of_node)
+ data->id = (enum chip_id)of_device_get_match_data(&client->dev);
+ else
+ data->id = id->driver_data;
pdata = dev_get_platdata(&client->dev);
if (!pdata) {
@@ -525,9 +529,25 @@ static const struct i2c_device_id mcp4725_id[] = {
};
MODULE_DEVICE_TABLE(i2c, mcp4725_id);
+#ifdef CONFIG_OF
+static const struct of_device_id mcp4725_of_match[] = {
+ {
+ .compatible = "microchip,mcp4725",
+ .data = (void *)MCP4725
+ },
+ {
+ .compatible = "microchip,mcp4726",
+ .data = (void *)MCP4726
+ },
+ { }
+};
+MODULE_DEVICE_TABLE(of, mcp4725_of_match);
+#endif
+
static struct i2c_driver mcp4725_driver = {
.driver = {
.name = MCP4725_DRV_NAME,
+ .of_match_table = of_match_ptr(mcp4725_of_match),
.pm = MCP4725_PM_OPS,
},
.probe = mcp4725_probe,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Date | 2017-03-19 12:00 +0100 |
| Subject | Re: [PATCH v2 04/17] iio: dac: mcp4725: Add OF device ID table |
| Message-ID | <tmGJ3-4r7-1@gated-at.bofh.it> |
| In reply to | #1601045 |
On 15/03/17 04:44, Javier Martinez Canillas wrote:
> The driver doesn't have a struct of_device_id table but supported devices
> are registered via Device Trees. This is working on the assumption that a
> I2C device registered via OF will always match a legacy I2C device ID and
> that the MODALIAS reported will always be of the form i2c:<device>.
>
> But this could change in the future so the correct approach is to have an
> OF device ID table if the devices are registered via OF.
>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Applied.
Thanks,
> ---
>
> drivers/iio/dac/mcp4725.c | 24 ++++++++++++++++++++++--
> 1 file changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c
> index db109f0cdd8c..6ab1f23e5a79 100644
> --- a/drivers/iio/dac/mcp4725.c
> +++ b/drivers/iio/dac/mcp4725.c
> @@ -19,6 +19,7 @@
> #include <linux/err.h>
> #include <linux/delay.h>
> #include <linux/regulator/consumer.h>
> +#include <linux/of_device.h>
> #include <linux/of.h>
>
> #include <linux/iio/iio.h>
> @@ -199,7 +200,7 @@ static ssize_t mcp4725_write_powerdown(struct iio_dev *indio_dev,
> return len;
> }
>
> -enum {
> +enum chip_id {
> MCP4725,
> MCP4726,
> };
> @@ -406,7 +407,10 @@ static int mcp4725_probe(struct i2c_client *client,
> data = iio_priv(indio_dev);
> i2c_set_clientdata(client, indio_dev);
> data->client = client;
> - data->id = id->driver_data;
> + if (client->dev.of_node)
> + data->id = (enum chip_id)of_device_get_match_data(&client->dev);
> + else
> + data->id = id->driver_data;
> pdata = dev_get_platdata(&client->dev);
>
> if (!pdata) {
> @@ -525,9 +529,25 @@ static const struct i2c_device_id mcp4725_id[] = {
> };
> MODULE_DEVICE_TABLE(i2c, mcp4725_id);
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id mcp4725_of_match[] = {
> + {
> + .compatible = "microchip,mcp4725",
> + .data = (void *)MCP4725
> + },
> + {
> + .compatible = "microchip,mcp4726",
> + .data = (void *)MCP4726
> + },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, mcp4725_of_match);
> +#endif
> +
> static struct i2c_driver mcp4725_driver = {
> .driver = {
> .name = MCP4725_DRV_NAME,
> + .of_match_table = of_match_ptr(mcp4725_of_match),
> .pm = MCP4725_PM_OPS,
> },
> .probe = mcp4725_probe,
>
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-15 05:50 +0100 |
| Subject | [PATCH v2 15/17] iio: pressure: mpl3115: Add OF device ID table |
| Message-ID | <tl92O-2mK-39@gated-at.bofh.it> |
| In reply to | #1601041 |
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.
But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/iio/pressure/mpl3115.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iio/pressure/mpl3115.c b/drivers/iio/pressure/mpl3115.c
index 525644a7442d..619b963714c7 100644
--- a/drivers/iio/pressure/mpl3115.c
+++ b/drivers/iio/pressure/mpl3115.c
@@ -321,9 +321,16 @@ static const struct i2c_device_id mpl3115_id[] = {
};
MODULE_DEVICE_TABLE(i2c, mpl3115_id);
+static const struct of_device_id mpl3115_of_match[] = {
+ { .compatible = "fsl,mpl3115" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, mpl3115_of_match);
+
static struct i2c_driver mpl3115_driver = {
.driver = {
.name = "mpl3115",
+ .of_match_table = mpl3115_of_match,
.pm = MPL3115_PM_OPS,
},
.probe = mpl3115_probe,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Date | 2017-03-19 12:00 +0100 |
| Subject | Re: [PATCH v2 15/17] iio: pressure: mpl3115: Add OF device ID table |
| Message-ID | <tmGJ4-4r7-23@gated-at.bofh.it> |
| In reply to | #1601046 |
On 15/03/17 04:45, Javier Martinez Canillas wrote:
> The driver doesn't have a struct of_device_id table but supported devices
> are registered via Device Trees. This is working on the assumption that a
> I2C device registered via OF will always match a legacy I2C device ID and
> that the MODALIAS reported will always be of the form i2c:<device>.
>
> But this could change in the future so the correct approach is to have an
> OF device ID table if the devices are registered via OF.
>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Applied.
> ---
>
> drivers/iio/pressure/mpl3115.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/iio/pressure/mpl3115.c b/drivers/iio/pressure/mpl3115.c
> index 525644a7442d..619b963714c7 100644
> --- a/drivers/iio/pressure/mpl3115.c
> +++ b/drivers/iio/pressure/mpl3115.c
> @@ -321,9 +321,16 @@ static const struct i2c_device_id mpl3115_id[] = {
> };
> MODULE_DEVICE_TABLE(i2c, mpl3115_id);
>
> +static const struct of_device_id mpl3115_of_match[] = {
> + { .compatible = "fsl,mpl3115" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, mpl3115_of_match);
> +
> static struct i2c_driver mpl3115_driver = {
> .driver = {
> .name = "mpl3115",
> + .of_match_table = mpl3115_of_match,
> .pm = MPL3115_PM_OPS,
> },
> .probe = mpl3115_probe,
>
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-15 05:50 +0100 |
| Subject | [PATCH v2 07/17] iio: pressure: hp03: Add OF device ID table |
| Message-ID | <tl92O-2mK-29@gated-at.bofh.it> |
| In reply to | #1601041 |
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.
But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/iio/pressure/hp03.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iio/pressure/hp03.c b/drivers/iio/pressure/hp03.c
index ac76515d5d49..8c7b3ec3d84a 100644
--- a/drivers/iio/pressure/hp03.c
+++ b/drivers/iio/pressure/hp03.c
@@ -297,9 +297,16 @@ static const struct i2c_device_id hp03_id[] = {
};
MODULE_DEVICE_TABLE(i2c, hp03_id);
+static const struct of_device_id hp03_of_match[] = {
+ { .compatible = "hoperf,hp03" },
+ { },
+};
+MODULE_DEVICE_TABLE(of, hp03_of_match);
+
static struct i2c_driver hp03_driver = {
.driver = {
.name = "hp03",
+ .of_match_table = hp03_of_match,
},
.probe = hp03_probe,
.remove = hp03_remove,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-15 05:50 +0100 |
| Subject | [PATCH v2 10/17] iio: light: apds9960: Add OF device ID table |
| Message-ID | <tl92O-2mK-43@gated-at.bofh.it> |
| In reply to | #1601041 |
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.
But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/iio/light/apds9960.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
index a4304edc3e0f..90bc98df362b 100644
--- a/drivers/iio/light/apds9960.c
+++ b/drivers/iio/light/apds9960.c
@@ -1122,9 +1122,16 @@ static const struct i2c_device_id apds9960_id[] = {
};
MODULE_DEVICE_TABLE(i2c, apds9960_id);
+static const struct of_device_id apds9960_of_match[] = {
+ { .compatible = "avago,apds9960" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, apds9960_of_match);
+
static struct i2c_driver apds9960_driver = {
.driver = {
.name = APDS9960_DRV_NAME,
+ .of_match_table = apds9960_of_match,
.pm = &apds9960_pm_ops,
},
.probe = apds9960_probe,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-15 05:50 +0100 |
| Subject | [PATCH v2 08/17] iio: imu: inv_mpu6050: Add OF device ID table |
| Message-ID | <tl92O-2mK-37@gated-at.bofh.it> |
| In reply to | #1601041 |
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.
But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 38 +++++++++++++++++++++++++++----
1 file changed, 34 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
index 2c3f8964a3ea..a8e6330cb906 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
@@ -17,6 +17,7 @@
#include <linux/i2c.h>
#include <linux/iio/iio.h>
#include <linux/module.h>
+#include <linux/of_device.h>
#include "inv_mpu_iio.h"
static const struct regmap_config inv_mpu_regmap_config = {
@@ -69,7 +70,8 @@ static int inv_mpu6050_deselect_bypass(struct i2c_mux_core *muxc, u32 chan_id)
return 0;
}
-static const char *inv_mpu_match_acpi_device(struct device *dev, int *chip_id)
+static const char *inv_mpu_match_acpi_device(struct device *dev,
+ enum inv_devices *chip_id)
{
const struct acpi_device_id *id;
@@ -93,7 +95,8 @@ static int inv_mpu_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct inv_mpu6050_state *st;
- int result, chip_type;
+ int result;
+ enum inv_devices chip_type;
struct regmap *regmap;
const char *name;
@@ -101,8 +104,13 @@ static int inv_mpu_probe(struct i2c_client *client,
I2C_FUNC_SMBUS_I2C_BLOCK))
return -EOPNOTSUPP;
- if (id) {
- chip_type = (int)id->driver_data;
+ if (client->dev.of_node) {
+ chip_type = (enum inv_devices)
+ of_device_get_match_data(&client->dev);
+ name = client->name;
+ } else if (id) {
+ chip_type = (enum inv_devices)
+ id->driver_data;
name = id->name;
} else if (ACPI_HANDLE(&client->dev)) {
name = inv_mpu_match_acpi_device(&client->dev, &chip_type);
@@ -176,6 +184,27 @@ static const struct i2c_device_id inv_mpu_id[] = {
MODULE_DEVICE_TABLE(i2c, inv_mpu_id);
+static const struct of_device_id inv_of_match[] = {
+ {
+ .compatible = "invensense,mpu6050",
+ .data = (void *)INV_MPU6050
+ },
+ {
+ .compatible = "invensense,mpu6500",
+ .data = (void *)INV_MPU6500
+ },
+ {
+ .compatible = "invensense,mpu9150",
+ .data = (void *)INV_MPU9150
+ },
+ {
+ .compatible = "invensense,icm20608",
+ .data = (void *)INV_ICM20608
+ },
+ { }
+};
+MODULE_DEVICE_TABLE(of, inv_of_match);
+
static const struct acpi_device_id inv_acpi_match[] = {
{"INVN6500", INV_MPU6500},
{ },
@@ -188,6 +217,7 @@ static struct i2c_driver inv_mpu_driver = {
.remove = inv_mpu_remove,
.id_table = inv_mpu_id,
.driver = {
+ .of_match_table = inv_of_match,
.acpi_match_table = ACPI_PTR(inv_acpi_match),
.name = "inv-mpu6050-i2c",
.pm = &inv_mpu_pmops,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-15 05:50 +0100 |
| Subject | [PATCH v2 03/17] iio: magnetometer: bmc150_magn_i2c: Add OF device ID table |
| Message-ID | <tl92O-2mK-41@gated-at.bofh.it> |
| In reply to | #1601041 |
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.
But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/iio/magnetometer/bmc150_magn_i2c.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/iio/magnetometer/bmc150_magn_i2c.c b/drivers/iio/magnetometer/bmc150_magn_i2c.c
index ee05722587aa..57e40dd1222e 100644
--- a/drivers/iio/magnetometer/bmc150_magn_i2c.c
+++ b/drivers/iio/magnetometer/bmc150_magn_i2c.c
@@ -63,9 +63,18 @@ static const struct i2c_device_id bmc150_magn_i2c_id[] = {
};
MODULE_DEVICE_TABLE(i2c, bmc150_magn_i2c_id);
+static const struct of_device_id bmc150_magn_of_match[] = {
+ { .compatible = "bosch,bmc150_magn" },
+ { .compatible = "bosch,bmc156_magn" },
+ { .compatible = "bosch,bmm150_magn" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, bmc150_magn_of_match);
+
static struct i2c_driver bmc150_magn_driver = {
.driver = {
.name = "bmc150_magn_i2c",
+ .of_match_table = bmc150_magn_of_match,
.acpi_match_table = ACPI_PTR(bmc150_magn_acpi_match),
.pm = &bmc150_magn_pm_ops,
},
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Date | 2017-03-19 12:00 +0100 |
| Subject | Re: [PATCH v2 03/17] iio: magnetometer: bmc150_magn_i2c: Add OF device ID table |
| Message-ID | <tmGJ4-4r7-11@gated-at.bofh.it> |
| In reply to | #1601050 |
On 15/03/17 04:44, Javier Martinez Canillas wrote:
> The driver doesn't have a struct of_device_id table but supported devices
> are registered via Device Trees. This is working on the assumption that a
> I2C device registered via OF will always match a legacy I2C device ID and
> that the MODALIAS reported will always be of the form i2c:<device>.
>
> But this could change in the future so the correct approach is to have an
> OF device ID table if the devices are registered via OF.
>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Applied.
> ---
>
> drivers/iio/magnetometer/bmc150_magn_i2c.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/iio/magnetometer/bmc150_magn_i2c.c b/drivers/iio/magnetometer/bmc150_magn_i2c.c
> index ee05722587aa..57e40dd1222e 100644
> --- a/drivers/iio/magnetometer/bmc150_magn_i2c.c
> +++ b/drivers/iio/magnetometer/bmc150_magn_i2c.c
> @@ -63,9 +63,18 @@ static const struct i2c_device_id bmc150_magn_i2c_id[] = {
> };
> MODULE_DEVICE_TABLE(i2c, bmc150_magn_i2c_id);
>
> +static const struct of_device_id bmc150_magn_of_match[] = {
> + { .compatible = "bosch,bmc150_magn" },
> + { .compatible = "bosch,bmc156_magn" },
> + { .compatible = "bosch,bmm150_magn" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, bmc150_magn_of_match);
> +
> static struct i2c_driver bmc150_magn_driver = {
> .driver = {
> .name = "bmc150_magn_i2c",
> + .of_match_table = bmc150_magn_of_match,
> .acpi_match_table = ACPI_PTR(bmc150_magn_acpi_match),
> .pm = &bmc150_magn_pm_ops,
> },
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web