diff options
Diffstat (limited to 'patches.tizen/0260-iio-st_gyro-Add-DT-bindings.patch')
-rw-r--r-- | patches.tizen/0260-iio-st_gyro-Add-DT-bindings.patch | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/patches.tizen/0260-iio-st_gyro-Add-DT-bindings.patch b/patches.tizen/0260-iio-st_gyro-Add-DT-bindings.patch new file mode 100644 index 00000000000..fb2eebbb0dc --- /dev/null +++ b/patches.tizen/0260-iio-st_gyro-Add-DT-bindings.patch @@ -0,0 +1,149 @@ +From ee241f53a6803d8d7b362e76c388d84076436a5c Mon Sep 17 00:00:00 2001 +From: Lukasz Czerwinski <l.czerwinski@samsung.com> +Date: Mon, 17 Jun 2013 15:49:49 +0200 +Subject: [PATCH 0260/1302] iio: st_gyro: Add DT bindings + +Signed-off-by: Lukasz Czerwinski <l.czerwinski@samsung.com> +Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> +--- + .../devicetree/bindings/iio/gyroscope/st_gyroscope | 44 ++++++++++++++++++++++ + drivers/iio/gyro/st_gyro.h | 10 ++--- + drivers/iio/gyro/st_gyro_i2c.c | 14 +++++++ + drivers/iio/gyro/st_gyro_spi.c | 14 +++++++ + 4 files changed, 77 insertions(+), 5 deletions(-) + create mode 100644 Documentation/devicetree/bindings/iio/gyroscope/st_gyroscope + +diff --git a/Documentation/devicetree/bindings/iio/gyroscope/st_gyroscope b/Documentation/devicetree/bindings/iio/gyroscope/st_gyroscope +new file mode 100644 +index 0000000..f45d62f +--- /dev/null ++++ b/Documentation/devicetree/bindings/iio/gyroscope/st_gyroscope +@@ -0,0 +1,44 @@ ++STMicroelectronics 3D gyroscope ++ ++Required properties: ++ ++ - compatible : should be one from ++ "st,l3g4200d" ++ "st,lsm330d_gyro" ++ "st,lsm330dl_gyro" ++ "st,lsm330dlc_gyro" ++ "st,l3gd20" ++ "st,l3gd20h" ++ "st,l3g4is_ui" ++ "st,lsm330_gyro" ++ ++ - reg : the I2C address of the accelerometer ++ ++Optional properties: ++ ++ - irq-map-policy: irqs from interrupt-map assigment policy ++ 0: no irqs ++ 1: map first irq to irq_data_ready ++ 2: map first irq to irq_event ++ 3..n: future improvements ++ - interrupt-parent: should contain interrupt map ++ ++Example: ++ ++ lsm330dlc_gyro@6b { ++ compatible = "st,lsm330dlc_gyro"; ++ reg = <0x6b>; ++ irq-map-policy = <0>; ++ interrupt-controller; ++ #interrups-cells = <2>; ++ interrupt-parent = <&lsm330dlc_gyro_map>; ++ interrupts= <1 0>; ++ ++ lsm330dlc_gyro_map: lsm330dlc-gyro-map { ++ compatible = "samsung,lsm330dlc-gyro-map"; ++ #interrupt-cells = <2>; ++ #address-cells = <0>; ++ #size-cells = <0>; ++ interrupt-map = <0x1 0 &gpf0 3 0>; ++ }; ++ }; +diff --git a/drivers/iio/gyro/st_gyro.h b/drivers/iio/gyro/st_gyro.h +index 3ad9907..7fdfa8f 100644 +--- a/drivers/iio/gyro/st_gyro.h ++++ b/drivers/iio/gyro/st_gyro.h +@@ -15,13 +15,13 @@ + #include <linux/iio/common/st_sensors.h> + + #define L3G4200D_GYRO_DEV_NAME "l3g4200d" +-#define LSM330D_GYRO_DEV_NAME "lsm330d_gyro" +-#define LSM330DL_GYRO_DEV_NAME "lsm330dl_gyro" +-#define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro" ++#define LSM330D_GYRO_DEV_NAME "lsm330d-gyro" ++#define LSM330DL_GYRO_DEV_NAME "lsm330dl-gyro" ++#define LSM330DLC_GYRO_DEV_NAME "lsm330dlc-gyro" + #define L3GD20_GYRO_DEV_NAME "l3gd20" + #define L3GD20H_GYRO_DEV_NAME "l3gd20h" +-#define L3G4IS_GYRO_DEV_NAME "l3g4is_ui" +-#define LSM330_GYRO_DEV_NAME "lsm330_gyro" ++#define L3G4IS_GYRO_DEV_NAME "l3g4is-ui" ++#define LSM330_GYRO_DEV_NAME "lsm330-gyro" + + int st_gyro_common_probe(struct iio_dev *indio_dev); + void st_gyro_common_remove(struct iio_dev *indio_dev); +diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c +index 8a31050..02ae61b 100644 +--- a/drivers/iio/gyro/st_gyro_i2c.c ++++ b/drivers/iio/gyro/st_gyro_i2c.c +@@ -68,10 +68,24 @@ static const struct i2c_device_id st_gyro_id_table[] = { + }; + MODULE_DEVICE_TABLE(i2c, st_gyro_id_table); + ++#ifdef CONFIG_OF ++static struct of_device_id st_gyro_dt_match[] = { ++ { .compatible = "st,l3g4200d" }, ++ { .compatible = "st,lsm330d-gyro" }, ++ { .compatible = "st,lsm330dl-gyro" }, ++ { .compatible = "st,lsm330dlc-gyro" }, ++ { .compatible = "st,l3gd20" }, ++ { .compatible = "st,l3gd20h" }, ++ { .compatible = "st,l3g4is-ui" }, ++ { .compatible = "st,lsm330-gyro" }, ++}; ++#endif ++ + static struct i2c_driver st_gyro_driver = { + .driver = { + .owner = THIS_MODULE, + .name = "st-gyro-i2c", ++ .of_match_table = of_match_ptr(st_gyro_dt_match), + }, + .probe = st_gyro_i2c_probe, + .remove = st_gyro_i2c_remove, +diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c +index f354039..e82a868 100644 +--- a/drivers/iio/gyro/st_gyro_spi.c ++++ b/drivers/iio/gyro/st_gyro_spi.c +@@ -67,10 +67,24 @@ static const struct spi_device_id st_gyro_id_table[] = { + }; + MODULE_DEVICE_TABLE(spi, st_gyro_id_table); + ++#ifdef CONFIG_OF ++static struct of_device_id st_gyro_dt_match[] = { ++ { .compatible = "st,l3g4200d" }, ++ { .compatible = "st,lsm330d-gyro" }, ++ { .compatible = "st,lsm330dl-gyro" }, ++ { .compatible = "st,lsm330dlc-gyro" }, ++ { .compatible = "st,l3gd20" }, ++ { .compatible = "st,l3gd20h" }, ++ { .compatible = "st,l3g4is-ui" }, ++ { .compatible = "st,lsm330-gyro" }, ++}; ++#endif ++ + static struct spi_driver st_gyro_driver = { + .driver = { + .owner = THIS_MODULE, + .name = "st-gyro-spi", ++ .of_match_table = of_match_ptr(st_gyro_dt_match), + }, + .probe = st_gyro_spi_probe, + .remove = st_gyro_spi_remove, +-- +1.8.3.2 + |