Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1599748 > unrolled thread
| Started by | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| First post | 2017-03-13 21:00 +0100 |
| Last post | 2017-03-13 21:10 +0100 |
| Articles | 18 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 00/17] iio: Add OF device table to I2C drivers that are missing it Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:00 +0100
[PATCH 07/17] iio: pressure: hp03: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 14/17] iio: accel: mma7455_i2c: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 01/17] iio: adc: ina2xx: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 03/17] iio: magnetometer: bmc150_magn_i2c: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 16/17] iio: accel: mma7660: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 12/17] iio: adc: ti-ads1015: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 13/17] iio: magnetometer: mag3110: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 06/17] iio: light: tsl2563: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 15/17] iio: pressure: mpl3115: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 17/17] iio: gyro: itg3200: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 10/17] iio: light: apds9960: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 02/17] iio: mlx96014: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 09/17] iio: accel: bma180: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 11/17] iio: dac: max5821: Set .of_match_table to OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 05/17] iio: light: us5182d: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 04/17] iio: dac: mcp4725: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
[PATCH 08/17] iio: imu: inv_mpu6050: Add OF device ID table Javier Martinez Canillas <javier@osg.samsung.com> - 2017-03-13 21:10 +0100
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:00 +0100 |
| Subject | [PATCH 00/17] iio: Add OF device table to I2C drivers that are missing it |
| Message-ID | <tkEin-5lT-35@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. 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 | 28 +++++++++++++++++++++++- 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, 210 insertions(+), 8 deletions(-) -- 2.9.3
[toc] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 07/17] iio: pressure: hp03: Add OF device ID table |
| Message-ID | <tkEs1-5H9-3@gated-at.bofh.it> |
| In reply to | #1599748 |
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..0f3824cf1278 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 = of_match_ptr(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-13 21:10 +0100 |
| Subject | [PATCH 14/17] iio: accel: mma7455_i2c: Add OF device ID table |
| Message-ID | <tkEs2-5H9-13@gated-at.bofh.it> |
| In reply to | #1599748 |
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/accel/mma7455_i2c.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/iio/accel/mma7455_i2c.c b/drivers/iio/accel/mma7455_i2c.c
index 3cab5fb4a3c4..00913a7a99e1 100644
--- a/drivers/iio/accel/mma7455_i2c.c
+++ b/drivers/iio/accel/mma7455_i2c.c
@@ -41,12 +41,20 @@ static const struct i2c_device_id mma7455_i2c_ids[] = {
};
MODULE_DEVICE_TABLE(i2c, mma7455_i2c_ids);
+static const struct of_device_id mma7455_of_match[] = {
+ { .compatible = "fsl,mma7455" },
+ { .compatible = "fsl,mma7456" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, mma7455_of_match);
+
static struct i2c_driver mma7455_i2c_driver = {
.probe = mma7455_i2c_probe,
.remove = mma7455_i2c_remove,
.id_table = mma7455_i2c_ids,
.driver = {
.name = "mma7455-i2c",
+ .of_match_table = of_match_ptr(mma7455_of_match),
},
};
module_i2c_driver(mma7455_i2c_driver);
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 01/17] iio: adc: ina2xx: Add OF device ID table |
| Message-ID | <tkEs2-5H9-27@gated-at.bofh.it> |
| In reply to | #1599748 |
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/adc/ina2xx-adc.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c
index 3263231276ca..9affc8e95f1d 100644
--- a/drivers/iio/adc/ina2xx-adc.c
+++ b/drivers/iio/adc/ina2xx-adc.c
@@ -28,6 +28,7 @@
#include <linux/iio/sysfs.h>
#include <linux/kthread.h>
#include <linux/module.h>
+#include <linux/of_device.h>
#include <linux/regmap.h>
#include <linux/util_macros.h>
@@ -635,6 +636,7 @@ static int ina2xx_probe(struct i2c_client *client,
struct iio_dev *indio_dev;
struct iio_buffer *buffer;
unsigned int val;
+ enum ina2xx_ids type;
int ret;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
@@ -652,7 +654,11 @@ static int ina2xx_probe(struct i2c_client *client,
return PTR_ERR(chip->regmap);
}
- chip->config = &ina2xx_config[id->driver_data];
+ if (client->dev.of_node)
+ type = (enum ina2xx_ids)of_device_get_match_data(&client->dev);
+ else
+ type = id->driver_data;
+ chip->config = &ina2xx_config[type];
mutex_init(&chip->state_lock);
@@ -726,9 +732,35 @@ static const struct i2c_device_id ina2xx_id[] = {
};
MODULE_DEVICE_TABLE(i2c, ina2xx_id);
+static const struct of_device_id ina2xx_of_match[] = {
+ {
+ .compatible = "ti,ina219",
+ .data = (void *)ina219
+ },
+ {
+ .compatible = "ti,ina220",
+ .data = (void *)ina219
+ },
+ {
+ .compatible = "ti,ina226",
+ .data = (void *)ina226
+ },
+ {
+ .compatible = "ti,ina230",
+ .data = (void *)ina226
+ },
+ {
+ .compatible = "ti,ina231",
+ .data = (void *)ina226
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(of, ina2xx_of_match);
+
static struct i2c_driver ina2xx_driver = {
.driver = {
.name = KBUILD_MODNAME,
+ .of_match_table = of_match_ptr(ina2xx_of_match),
},
.probe = ina2xx_probe,
.remove = ina2xx_remove,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 03/17] iio: magnetometer: bmc150_magn_i2c: Add OF device ID table |
| Message-ID | <tkEs2-5H9-19@gated-at.bofh.it> |
| In reply to | #1599748 |
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..6842cc5d9e59 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 = of_match_ptr(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 | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 16/17] iio: accel: mma7660: Add OF device ID table |
| Message-ID | <tkEs2-5H9-21@gated-at.bofh.it> |
| In reply to | #1599748 |
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/accel/mma7660.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iio/accel/mma7660.c b/drivers/iio/accel/mma7660.c
index 3a40774cca74..a53469f7bbab 100644
--- a/drivers/iio/accel/mma7660.c
+++ b/drivers/iio/accel/mma7660.c
@@ -253,6 +253,12 @@ static const struct i2c_device_id mma7660_i2c_id[] = {
};
MODULE_DEVICE_TABLE(i2c, mma7660_i2c_id);
+static const struct of_device_id mma7660_of_match[] = {
+ { .compatible = "fsl,mma7660" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, mma7660_of_match);
+
static const struct acpi_device_id mma7660_acpi_id[] = {
{"MMA7660", 0},
{}
@@ -264,6 +270,7 @@ static struct i2c_driver mma7660_driver = {
.driver = {
.name = "mma7660",
.pm = MMA7660_PM_OPS,
+ .of_match_table = of_match_ptr(mma7660_of_match),
.acpi_match_table = ACPI_PTR(mma7660_acpi_id),
},
.probe = mma7660_probe,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 12/17] iio: adc: ti-ads1015: Add OF device ID table |
| Message-ID | <tkEs2-5H9-15@gated-at.bofh.it> |
| In reply to | #1599748 |
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/adc/ti-ads1015.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index 422b314f5a3f..3302270ab6b1 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -15,6 +15,7 @@
*/
#include <linux/module.h>
+#include <linux/of_device.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
@@ -55,7 +56,7 @@
#define ADS1015_DEFAULT_DATA_RATE 4
#define ADS1015_DEFAULT_CHAN 0
-enum {
+enum chip_ids {
ADS1015,
ADS1115,
};
@@ -578,6 +579,7 @@ static int ads1015_probe(struct i2c_client *client,
struct iio_dev *indio_dev;
struct ads1015_data *data;
int ret;
+ enum chip_ids chip;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
if (!indio_dev)
@@ -593,7 +595,11 @@ static int ads1015_probe(struct i2c_client *client,
indio_dev->name = ADS1015_DRV_NAME;
indio_dev->modes = INDIO_DIRECT_MODE;
- switch (id->driver_data) {
+ if (client->dev.of_node)
+ chip = (enum chip_ids)of_device_get_match_data(&client->dev);
+ else
+ chip = id->driver_data;
+ switch (chip) {
case ADS1015:
indio_dev->channels = ads1015_channels;
indio_dev->num_channels = ARRAY_SIZE(ads1015_channels);
@@ -698,9 +704,23 @@ static const struct i2c_device_id ads1015_id[] = {
};
MODULE_DEVICE_TABLE(i2c, ads1015_id);
+static const struct of_device_id ads1015_of_match[] = {
+ {
+ .compatible = "ti,ads1015",
+ .data = (void *)ADS1015
+ },
+ {
+ .compatible = "ti,ads1115",
+ .data = (void *)ADS1115
+ },
+ {}
+};
+MODULE_DEVICE_TABLE(of, ads1015_of_match);
+
static struct i2c_driver ads1015_driver = {
.driver = {
.name = ADS1015_DRV_NAME,
+ .of_match_table = of_match_ptr(ads1015_of_match),
.pm = &ads1015_pm_ops,
},
.probe = ads1015_probe,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 13/17] iio: magnetometer: mag3110: Add OF device ID table |
| Message-ID | <tkEs3-5H9-39@gated-at.bofh.it> |
| In reply to | #1599748 |
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..06830358a175 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 = of_match_ptr(mag3110_of_match),
.pm = MAG3110_PM_OPS,
},
.probe = mag3110_probe,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 06/17] iio: light: tsl2563: Add OF device ID table |
| Message-ID | <tkEs3-5H9-53@gated-at.bofh.it> |
| In reply to | #1599748 |
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/tsl2563.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
index 04598ae993d4..9e5cd09a329f 100644
--- a/drivers/iio/light/tsl2563.c
+++ b/drivers/iio/light/tsl2563.c
@@ -884,9 +884,19 @@ static const struct i2c_device_id tsl2563_id[] = {
};
MODULE_DEVICE_TABLE(i2c, tsl2563_id);
+static const struct of_device_id tsl2563_of_match[] = {
+ { .compatible = "amstaos,tsl2560" },
+ { .compatible = "amstaos,tsl2561" },
+ { .compatible = "amstaos,tsl2562" },
+ { .compatible = "amstaos,tsl2563" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, tsl2563_of_match);
+
static struct i2c_driver tsl2563_i2c_driver = {
.driver = {
.name = "tsl2563",
+ .of_match_table = of_match_ptr(tsl2563_of_match),
.pm = TSL2563_PM_OPS,
},
.probe = tsl2563_probe,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 15/17] iio: pressure: mpl3115: Add OF device ID table |
| Message-ID | <tkEs3-5H9-57@gated-at.bofh.it> |
| In reply to | #1599748 |
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..2eaef486a9bf 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 = of_match_ptr(mpl3115_of_match),
.pm = MPL3115_PM_OPS,
},
.probe = mpl3115_probe,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 17/17] iio: gyro: itg3200: Add OF device ID table |
| Message-ID | <tkEs4-5H9-71@gated-at.bofh.it> |
| In reply to | #1599748 |
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/gyro/itg3200_core.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iio/gyro/itg3200_core.c b/drivers/iio/gyro/itg3200_core.c
index c102a6325bb0..a718166d16f0 100644
--- a/drivers/iio/gyro/itg3200_core.c
+++ b/drivers/iio/gyro/itg3200_core.c
@@ -377,9 +377,16 @@ static const struct i2c_device_id itg3200_id[] = {
};
MODULE_DEVICE_TABLE(i2c, itg3200_id);
+static const struct of_device_id itg3200_of_match[] = {
+ { .compatible = "invensense,itg3200" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, itg3200_of_match);
+
static struct i2c_driver itg3200_driver = {
.driver = {
.name = "itg3200",
+ .of_match_table = of_match_ptr(itg3200_of_match),
.pm = &itg3200_pm_ops,
},
.id_table = itg3200_id,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 10/17] iio: light: apds9960: Add OF device ID table |
| Message-ID | <tkEs3-5H9-61@gated-at.bofh.it> |
| In reply to | #1599748 |
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..0e4a739af9d6 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 = of_match_ptr(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-13 21:10 +0100 |
| Subject | [PATCH 02/17] iio: mlx96014: Add OF device ID table |
| Message-ID | <tkEs4-5H9-63@gated-at.bofh.it> |
| In reply to | #1599748 |
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..c82d49b85cdc 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 = of_match_ptr(mlx90614_of_match),
.pm = &mlx90614_pm_ops,
},
.probe = mlx90614_probe,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 09/17] iio: accel: bma180: Add OF device ID table |
| Message-ID | <tkEs4-5H9-67@gated-at.bofh.it> |
| In reply to | #1599748 |
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/accel/bma180.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index 0890934ef66f..099de757abbf 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -18,6 +18,7 @@
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
+#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/bitops.h>
#include <linux/slab.h>
@@ -32,7 +33,7 @@
#define BMA180_DRV_NAME "bma180"
#define BMA180_IRQ_NAME "bma180_event"
-enum {
+enum chip_ids {
BMA180,
BMA250,
};
@@ -707,6 +708,7 @@ static int bma180_probe(struct i2c_client *client,
{
struct bma180_data *data;
struct iio_dev *indio_dev;
+ enum chip_ids chip;
int ret;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
@@ -716,7 +718,11 @@ static int bma180_probe(struct i2c_client *client,
data = iio_priv(indio_dev);
i2c_set_clientdata(client, indio_dev);
data->client = client;
- data->part_info = &bma180_part_info[id->driver_data];
+ if (client->dev.of_node)
+ chip = (enum chip_ids)of_device_get_match_data(&client->dev);
+ else
+ chip = id->driver_data;
+ data->part_info = &bma180_part_info[chip];
ret = data->part_info->chip_config(data);
if (ret < 0)
@@ -844,10 +850,24 @@ static struct i2c_device_id bma180_ids[] = {
MODULE_DEVICE_TABLE(i2c, bma180_ids);
+static const struct of_device_id bma180_of_match[] = {
+ {
+ .compatible = "bosch,bma180",
+ .data = (void *)BMA180
+ },
+ {
+ .compatible = "bosch,bma250",
+ .data = (void *)BMA250
+ },
+ { }
+};
+MODULE_DEVICE_TABLE(of, bma180_of_match);
+
static struct i2c_driver bma180_driver = {
.driver = {
.name = "bma180",
.pm = BMA180_PM_OPS,
+ .of_match_table = of_match_ptr(bma180_of_match),
},
.probe = bma180_probe,
.remove = bma180_remove,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 11/17] iio: dac: max5821: Set .of_match_table to OF device ID table |
| Message-ID | <tkEs3-5H9-59@gated-at.bofh.it> |
| In reply to | #1599748 |
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..6bc1835b899d 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 = of_match_ptr(max5821_of_match),
.pm = MAX5821_PM_OPS,
},
.probe = max5821_probe,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 05/17] iio: light: us5182d: Add OF device ID table |
| Message-ID | <tkEs4-5H9-69@gated-at.bofh.it> |
| In reply to | #1599748 |
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/us5182d.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c
index 18cf2e29e4d5..eefdbf4a6495 100644
--- a/drivers/iio/light/us5182d.c
+++ b/drivers/iio/light/us5182d.c
@@ -972,10 +972,17 @@ static const struct i2c_device_id us5182d_id[] = {
MODULE_DEVICE_TABLE(i2c, us5182d_id);
+static const struct of_device_id us5182d_of_match[] = {
+ { .compatible = "upisemi,usd5182" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, us5182d_of_match);
+
static struct i2c_driver us5182d_driver = {
.driver = {
.name = US5182D_DRV_NAME,
.pm = &us5182d_pm_ops,
+ .of_match_table = of_match_ptr(us5182d_of_match),
.acpi_match_table = ACPI_PTR(us5182d_acpi_match),
},
.probe = us5182d_probe,
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 04/17] iio: dac: mcp4725: Add OF device ID table |
| Message-ID | <tkEs4-5H9-73@gated-at.bofh.it> |
| In reply to | #1599748 |
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 | Javier Martinez Canillas <javier@osg.samsung.com> |
|---|---|
| Date | 2017-03-13 21:10 +0100 |
| Subject | [PATCH 08/17] iio: imu: inv_mpu6050: Add OF device ID table |
| Message-ID | <tkEs4-5H9-75@gated-at.bofh.it> |
| In reply to | #1599748 |
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 | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
index 2c3f8964a3ea..a7e0547e4413 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 = {
@@ -101,7 +102,10 @@ static int inv_mpu_probe(struct i2c_client *client,
I2C_FUNC_SMBUS_I2C_BLOCK))
return -EOPNOTSUPP;
- if (id) {
+ if (client->dev.of_node) {
+ chip_type = (int)of_device_get_match_data(&client->dev);
+ name = client->name;
+ } else if (id) {
chip_type = (int)id->driver_data;
name = id->name;
} else if (ACPI_HANDLE(&client->dev)) {
@@ -176,6 +180,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 +213,7 @@ static struct i2c_driver inv_mpu_driver = {
.remove = inv_mpu_remove,
.id_table = inv_mpu_id,
.driver = {
+ .of_match_table = of_match_ptr(inv_of_match),
.acpi_match_table = ACPI_PTR(inv_acpi_match),
.name = "inv-mpu6050-i2c",
.pm = &inv_mpu_pmops,
--
2.9.3
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web