2019-01-25 18:44:31

by Paweł Chmiel

[permalink] [raw]
Subject: [PATCH 0/3] input: misc: bma150: Add support for device tree

This small patchset adds support for device tree to Bosch BMA150 Accelerometer
Sensor driver.

It was tested on s5pv210-galaxys and s5pv210-fascinate4g.

Jonathan Bakker (3):
input: misc: bma150: Use managed resources helpers
input: misc: bma150: Add support for device tree
input: dt-bindings: Add binding for bma150 sensor

.../bindings/input/bosch,bma150.txt | 20 ++++++++
drivers/input/misc/bma150.c | 50 +++++++++----------
2 files changed, 44 insertions(+), 26 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/bosch,bma150.txt

--
2.17.1



2019-01-25 18:44:42

by Paweł Chmiel

[permalink] [raw]
Subject: [PATCH 1/3] input: misc: bma150: Use managed resources helpers

From: Jonathan Bakker <[email protected]>

The driver can be cleaned up by using managed resource helpers

Signed-off-by: Jonathan Bakker <[email protected]>
Signed-off-by: Paweł Chmiel <[email protected]>
---
drivers/input/misc/bma150.c | 40 +++++++++++++------------------------
1 file changed, 14 insertions(+), 26 deletions(-)

diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c
index 1efcfdf9f8a8..d101bb0a33d6 100644
--- a/drivers/input/misc/bma150.c
+++ b/drivers/input/misc/bma150.c
@@ -471,7 +471,7 @@ static int bma150_register_input_device(struct bma150_data *bma150)
struct input_dev *idev;
int error;

- idev = input_allocate_device();
+ idev = devm_input_allocate_device(&bma150->client->dev);
if (!idev)
return -ENOMEM;

@@ -482,10 +482,8 @@ static int bma150_register_input_device(struct bma150_data *bma150)
input_set_drvdata(idev, bma150);

error = input_register_device(idev);
- if (error) {
- input_free_device(idev);
+ if (error)
return error;
- }

bma150->input = idev;
return 0;
@@ -496,7 +494,7 @@ static int bma150_register_polled_device(struct bma150_data *bma150)
struct input_polled_dev *ipoll_dev;
int error;

- ipoll_dev = input_allocate_polled_device();
+ ipoll_dev = devm_input_allocate_polled_device(&bma150->client->dev);
if (!ipoll_dev)
return -ENOMEM;

@@ -511,10 +509,8 @@ static int bma150_register_polled_device(struct bma150_data *bma150)
bma150_init_input_device(bma150, ipoll_dev->input);

error = input_register_polled_device(ipoll_dev);
- if (error) {
- input_free_polled_device(ipoll_dev);
+ if (error)
return error;
- }

bma150->input_polled = ipoll_dev;
bma150->input = ipoll_dev->input;
@@ -543,7 +539,8 @@ static int bma150_probe(struct i2c_client *client,
return -EINVAL;
}

- bma150 = kzalloc(sizeof(struct bma150_data), GFP_KERNEL);
+ bma150 = devm_kzalloc(&client->dev, sizeof(struct bma150_data),
+ GFP_KERNEL);
if (!bma150)
return -ENOMEM;

@@ -556,7 +553,7 @@ static int bma150_probe(struct i2c_client *client,
dev_err(&client->dev,
"IRQ GPIO conf. error %d, error %d\n",
client->irq, error);
- goto err_free_mem;
+ return error;
}
}
cfg = &pdata->cfg;
@@ -566,14 +563,14 @@ static int bma150_probe(struct i2c_client *client,

error = bma150_initialize(bma150, cfg);
if (error)
- goto err_free_mem;
+ return error;

if (client->irq > 0) {
error = bma150_register_input_device(bma150);
if (error)
- goto err_free_mem;
+ return error;

- error = request_threaded_irq(client->irq,
+ error = devm_request_threaded_irq(&client->dev, client->irq,
NULL, bma150_irq_thread,
IRQF_TRIGGER_RISING | IRQF_ONESHOT,
BMA150_DRIVER, bma150);
@@ -582,12 +579,12 @@ static int bma150_probe(struct i2c_client *client,
"irq request failed %d, error %d\n",
client->irq, error);
input_unregister_device(bma150->input);
- goto err_free_mem;
+ return error;
}
} else {
error = bma150_register_polled_device(bma150);
if (error)
- goto err_free_mem;
+ return error;
}

i2c_set_clientdata(client, bma150);
@@ -595,10 +592,6 @@ static int bma150_probe(struct i2c_client *client,
pm_runtime_enable(&client->dev);

return 0;
-
-err_free_mem:
- kfree(bma150);
- return error;
}

static int bma150_remove(struct i2c_client *client)
@@ -607,15 +600,10 @@ static int bma150_remove(struct i2c_client *client)

pm_runtime_disable(&client->dev);

- if (client->irq > 0) {
- free_irq(client->irq, bma150);
+ if (client->irq > 0)
input_unregister_device(bma150->input);
- } else {
+ else
input_unregister_polled_device(bma150->input_polled);
- input_free_polled_device(bma150->input_polled);
- }
-
- kfree(bma150);

return 0;
}
--
2.17.1


2019-01-25 18:44:45

by Paweł Chmiel

[permalink] [raw]
Subject: [PATCH 3/3] input: dt-bindings: Add binding for bma150 sensor

From: Jonathan Bakker <[email protected]>

Add device tree bindings for Bosch BMA150 Accelerometer Sensor

Signed-off-by: Jonathan Bakker <[email protected]>
Signed-off-by: Paweł Chmiel <[email protected]>
---
.../bindings/input/bosch,bma150.txt | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 Documentation/devicetree/bindings/input/bosch,bma150.txt

diff --git a/Documentation/devicetree/bindings/input/bosch,bma150.txt b/Documentation/devicetree/bindings/input/bosch,bma150.txt
new file mode 100644
index 000000000000..290c60e38c70
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/bosch,bma150.txt
@@ -0,0 +1,20 @@
+* Bosch BMA150 Accelerometer Sensor
+
+Also works for the SMB380 and BMA023 accelerometers
+
+Required properties:
+- compatible : Should be "bosch,bma150"
+- reg : The I2C address of the sensor
+
+Optional properties:
+- interrupt-parent : should be the phandle for the interrupt controller
+- interrupts : Interrupt mapping for IRQ. If not present device will be polled
+
+Example:
+
+bma150@38 {
+ compatible = "bosch,bma150";
+ reg = <0x38>;
+ interrupt-parent = <&gph0>;
+ interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
+};
--
2.17.1


2019-01-25 18:45:48

by Paweł Chmiel

[permalink] [raw]
Subject: [PATCH 2/3] input: misc: bma150: Add support for device tree

From: Jonathan Bakker <[email protected]>

Add basic of_match table to enable bma150 to be probed via DT

Signed-off-by: Jonathan Bakker <[email protected]>
Signed-off-by: Paweł Chmiel <[email protected]>
---
drivers/input/misc/bma150.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c
index d101bb0a33d6..c26a118d89fa 100644
--- a/drivers/input/misc/bma150.c
+++ b/drivers/input/misc/bma150.c
@@ -31,6 +31,7 @@
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/slab.h>
+#include <linux/of.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/bma150.h>
@@ -628,6 +629,14 @@ static int bma150_resume(struct device *dev)

static UNIVERSAL_DEV_PM_OPS(bma150_pm, bma150_suspend, bma150_resume, NULL);

+#if IS_ENABLED(CONFIG_OF)
+static const struct of_device_id bma150_of_match[] = {
+ { .compatible = "bosch,bma150" },
+ { },
+};
+MODULE_DEVICE_TABLE(of, bma150_of_match);
+#endif
+
static const struct i2c_device_id bma150_id[] = {
{ "bma150", 0 },
{ "smb380", 0 },
@@ -640,6 +649,7 @@ MODULE_DEVICE_TABLE(i2c, bma150_id);
static struct i2c_driver bma150_driver = {
.driver = {
.name = BMA150_DRIVER,
+ .of_match_table = of_match_ptr(bma150_of_match),
.pm = &bma150_pm,
},
.class = I2C_CLASS_HWMON,
--
2.17.1


2019-01-26 01:29:56

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 3/3] input: dt-bindings: Add binding for bma150 sensor

On Fri, Jan 25, 2019 at 07:44:00PM +0100, Paweł Chmiel wrote:
> From: Jonathan Bakker <[email protected]>
>
> Add device tree bindings for Bosch BMA150 Accelerometer Sensor
>
> Signed-off-by: Jonathan Bakker <[email protected]>
> Signed-off-by: Paweł Chmiel <[email protected]>
> ---
> .../bindings/input/bosch,bma150.txt | 20 +++++++++++++++++++
> 1 file changed, 20 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/input/bosch,bma150.txt
>
> diff --git a/Documentation/devicetree/bindings/input/bosch,bma150.txt b/Documentation/devicetree/bindings/input/bosch,bma150.txt
> new file mode 100644
> index 000000000000..290c60e38c70
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/bosch,bma150.txt
> @@ -0,0 +1,20 @@
> +* Bosch BMA150 Accelerometer Sensor
> +
> +Also works for the SMB380 and BMA023 accelerometers
> +
> +Required properties:
> +- compatible : Should be "bosch,bma150"
> +- reg : The I2C address of the sensor
> +
> +Optional properties:
> +- interrupt-parent : should be the phandle for the interrupt controller
> +- interrupts : Interrupt mapping for IRQ. If not present device will be polled
> +
> +Example:
> +
> +bma150@38 {
> + compatible = "bosch,bma150";
> + reg = <0x38>;
> + interrupt-parent = <&gph0>;
> + interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;

Hmm, here you say that IRQ_TYPE_LEVEL_HIGH, so it is level interrupts,
but the driver overrides to rising edge unconditionally. Since you are
the first to add DT support please make separate patch to driver to drop
the ORQ trigger from request_theraded_irq() leaving only IRQF_ONESHOT.

Also please create patch removing platform data support as noone is
using it upstream.

What about the rest of config parameters from bma150_cfg? They should be
handled as device properties too.

Thanks.

--
Dmitry

2019-01-26 01:30:18

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 1/3] input: misc: bma150: Use managed resources helpers

On Fri, Jan 25, 2019 at 07:43:58PM +0100, Paweł Chmiel wrote:
> From: Jonathan Bakker <[email protected]>
>
> The driver can be cleaned up by using managed resource helpers
>
> Signed-off-by: Jonathan Bakker <[email protected]>
> Signed-off-by: Paweł Chmiel <[email protected]>
> ---
> drivers/input/misc/bma150.c | 40 +++++++++++++------------------------
> 1 file changed, 14 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c
> index 1efcfdf9f8a8..d101bb0a33d6 100644
> --- a/drivers/input/misc/bma150.c
> +++ b/drivers/input/misc/bma150.c
> @@ -471,7 +471,7 @@ static int bma150_register_input_device(struct bma150_data *bma150)
> struct input_dev *idev;
> int error;
>
> - idev = input_allocate_device();
> + idev = devm_input_allocate_device(&bma150->client->dev);
> if (!idev)
> return -ENOMEM;
>
> @@ -482,10 +482,8 @@ static int bma150_register_input_device(struct bma150_data *bma150)
> input_set_drvdata(idev, bma150);
>
> error = input_register_device(idev);
> - if (error) {
> - input_free_device(idev);
> + if (error)
> return error;
> - }
>
> bma150->input = idev;
> return 0;
> @@ -496,7 +494,7 @@ static int bma150_register_polled_device(struct bma150_data *bma150)
> struct input_polled_dev *ipoll_dev;
> int error;
>
> - ipoll_dev = input_allocate_polled_device();
> + ipoll_dev = devm_input_allocate_polled_device(&bma150->client->dev);
> if (!ipoll_dev)
> return -ENOMEM;
>
> @@ -511,10 +509,8 @@ static int bma150_register_polled_device(struct bma150_data *bma150)
> bma150_init_input_device(bma150, ipoll_dev->input);
>
> error = input_register_polled_device(ipoll_dev);
> - if (error) {
> - input_free_polled_device(ipoll_dev);
> + if (error)
> return error;
> - }
>
> bma150->input_polled = ipoll_dev;
> bma150->input = ipoll_dev->input;
> @@ -543,7 +539,8 @@ static int bma150_probe(struct i2c_client *client,
> return -EINVAL;
> }
>
> - bma150 = kzalloc(sizeof(struct bma150_data), GFP_KERNEL);
> + bma150 = devm_kzalloc(&client->dev, sizeof(struct bma150_data),
> + GFP_KERNEL);
> if (!bma150)
> return -ENOMEM;
>
> @@ -556,7 +553,7 @@ static int bma150_probe(struct i2c_client *client,
> dev_err(&client->dev,
> "IRQ GPIO conf. error %d, error %d\n",
> client->irq, error);
> - goto err_free_mem;
> + return error;
> }
> }
> cfg = &pdata->cfg;
> @@ -566,14 +563,14 @@ static int bma150_probe(struct i2c_client *client,
>
> error = bma150_initialize(bma150, cfg);
> if (error)
> - goto err_free_mem;
> + return error;
>
> if (client->irq > 0) {
> error = bma150_register_input_device(bma150);
> if (error)
> - goto err_free_mem;
> + return error;
>
> - error = request_threaded_irq(client->irq,
> + error = devm_request_threaded_irq(&client->dev, client->irq,
> NULL, bma150_irq_thread,
> IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> BMA150_DRIVER, bma150);
> @@ -582,12 +579,12 @@ static int bma150_probe(struct i2c_client *client,
> "irq request failed %d, error %d\n",
> client->irq, error);
> input_unregister_device(bma150->input);

No need to unregister manually if you are using devm.

> - goto err_free_mem;
> + return error;
> }
> } else {
> error = bma150_register_polled_device(bma150);
> if (error)
> - goto err_free_mem;
> + return error;
> }
>
> i2c_set_clientdata(client, bma150);
> @@ -595,10 +592,6 @@ static int bma150_probe(struct i2c_client *client,
> pm_runtime_enable(&client->dev);
>
> return 0;
> -
> -err_free_mem:
> - kfree(bma150);
> - return error;
> }
>
> static int bma150_remove(struct i2c_client *client)
> @@ -607,15 +600,10 @@ static int bma150_remove(struct i2c_client *client)
>
> pm_runtime_disable(&client->dev);
>
> - if (client->irq > 0) {
> - free_irq(client->irq, bma150);
> + if (client->irq > 0)
> input_unregister_device(bma150->input);

Here as well.

> - } else {
> + else
> input_unregister_polled_device(bma150->input_polled);

And here.

> - input_free_polled_device(bma150->input_polled);
> - }
> -
> - kfree(bma150);
>
> return 0;
> }
> --
> 2.17.1
>

Thanks.

--
Dmitry

2019-01-26 03:40:59

by Jonathan Bakker

[permalink] [raw]
Subject: Re: [PATCH 3/3] input: dt-bindings: Add binding for bma150 sensor



On 2019-01-25 5:28 p.m., Dmitry Torokhov wrote:
> On Fri, Jan 25, 2019 at 07:44:00PM +0100, Paweł Chmiel wrote:
>> From: Jonathan Bakker <[email protected]>
>>
>> Add device tree bindings for Bosch BMA150 Accelerometer Sensor
>>
>> Signed-off-by: Jonathan Bakker <[email protected]>
>> Signed-off-by: Paweł Chmiel <[email protected]>
>> ---
>> .../bindings/input/bosch,bma150.txt | 20 +++++++++++++++++++
>> 1 file changed, 20 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/input/bosch,bma150.txt
>>
>> diff --git a/Documentation/devicetree/bindings/input/bosch,bma150.txt b/Documentation/devicetree/bindings/input/bosch,bma150.txt
>> new file mode 100644
>> index 000000000000..290c60e38c70
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/input/bosch,bma150.txt
>> @@ -0,0 +1,20 @@
>> +* Bosch BMA150 Accelerometer Sensor
>> +
>> +Also works for the SMB380 and BMA023 accelerometers
>> +
>> +Required properties:
>> +- compatible : Should be "bosch,bma150"
>> +- reg : The I2C address of the sensor
>> +
>> +Optional properties:
>> +- interrupt-parent : should be the phandle for the interrupt controller
>> +- interrupts : Interrupt mapping for IRQ. If not present device will be polled
>> +
>> +Example:
>> +
>> +bma150@38 {
>> + compatible = "bosch,bma150";
>> + reg = <0x38>;
>> + interrupt-parent = <&gph0>;
>> + interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
>
> Hmm, here you say that IRQ_TYPE_LEVEL_HIGH, so it is level interrupts,
> but the driver overrides to rising edge unconditionally. Since you are
> the first to add DT support please make separate patch to driver to drop
> the ORQ trigger from request_theraded_irq() leaving only IRQF_ONESHOT.
>
This was simply an oversight on my part, my device was using the the polled method as opposed to an interrupt. I'll correct this in v2.
> Also please create patch removing platform data support as noone is
> using it upstream.
>
Will do.
> What about the rest of config parameters from bma150_cfg? They should be
> handled as device properties too.
>
Ok, I can add them as well. I didn't bother as the comment in the source code says that the default values are the ones recommended by Bosch.
> Thanks.
>
Thanks,
Jonathan

2019-01-26 03:43:01

by Jonathan Bakker

[permalink] [raw]
Subject: Re: [PATCH 1/3] input: misc: bma150: Use managed resources helpers



On 2019-01-25 5:29 p.m., Dmitry Torokhov wrote:
> On Fri, Jan 25, 2019 at 07:43:58PM +0100, Paweł Chmiel wrote:
>> From: Jonathan Bakker <[email protected]>
>>
>> The driver can be cleaned up by using managed resource helpers
>>
>> Signed-off-by: Jonathan Bakker <[email protected]>
>> Signed-off-by: Paweł Chmiel <[email protected]>
>> ---
>> drivers/input/misc/bma150.c | 40 +++++++++++++------------------------
>> 1 file changed, 14 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c
>> index 1efcfdf9f8a8..d101bb0a33d6 100644
>> --- a/drivers/input/misc/bma150.c
>> +++ b/drivers/input/misc/bma150.c
>> @@ -471,7 +471,7 @@ static int bma150_register_input_device(struct bma150_data *bma150)
>> struct input_dev *idev;
>> int error;
>>
>> - idev = input_allocate_device();
>> + idev = devm_input_allocate_device(&bma150->client->dev);
>> if (!idev)
>> return -ENOMEM;
>>
>> @@ -482,10 +482,8 @@ static int bma150_register_input_device(struct bma150_data *bma150)
>> input_set_drvdata(idev, bma150);
>>
>> error = input_register_device(idev);
>> - if (error) {
>> - input_free_device(idev);
>> + if (error)
>> return error;
>> - }
>>
>> bma150->input = idev;
>> return 0;
>> @@ -496,7 +494,7 @@ static int bma150_register_polled_device(struct bma150_data *bma150)
>> struct input_polled_dev *ipoll_dev;
>> int error;
>>
>> - ipoll_dev = input_allocate_polled_device();
>> + ipoll_dev = devm_input_allocate_polled_device(&bma150->client->dev);
>> if (!ipoll_dev)
>> return -ENOMEM;
>>
>> @@ -511,10 +509,8 @@ static int bma150_register_polled_device(struct bma150_data *bma150)
>> bma150_init_input_device(bma150, ipoll_dev->input);
>>
>> error = input_register_polled_device(ipoll_dev);
>> - if (error) {
>> - input_free_polled_device(ipoll_dev);
>> + if (error)
>> return error;
>> - }
>>
>> bma150->input_polled = ipoll_dev;
>> bma150->input = ipoll_dev->input;
>> @@ -543,7 +539,8 @@ static int bma150_probe(struct i2c_client *client,
>> return -EINVAL;
>> }
>>
>> - bma150 = kzalloc(sizeof(struct bma150_data), GFP_KERNEL);
>> + bma150 = devm_kzalloc(&client->dev, sizeof(struct bma150_data),
>> + GFP_KERNEL);
>> if (!bma150)
>> return -ENOMEM;
>>
>> @@ -556,7 +553,7 @@ static int bma150_probe(struct i2c_client *client,
>> dev_err(&client->dev,
>> "IRQ GPIO conf. error %d, error %d\n",
>> client->irq, error);
>> - goto err_free_mem;
>> + return error;
>> }
>> }
>> cfg = &pdata->cfg;
>> @@ -566,14 +563,14 @@ static int bma150_probe(struct i2c_client *client,
>>
>> error = bma150_initialize(bma150, cfg);
>> if (error)
>> - goto err_free_mem;
>> + return error;
>>
>> if (client->irq > 0) {
>> error = bma150_register_input_device(bma150);
>> if (error)
>> - goto err_free_mem;
>> + return error;
>>
>> - error = request_threaded_irq(client->irq,
>> + error = devm_request_threaded_irq(&client->dev, client->irq,
>> NULL, bma150_irq_thread,
>> IRQF_TRIGGER_RISING | IRQF_ONESHOT,
>> BMA150_DRIVER, bma150);
>> @@ -582,12 +579,12 @@ static int bma150_probe(struct i2c_client *client,
>> "irq request failed %d, error %d\n",
>> client->irq, error);
>> input_unregister_device(bma150->input);
>
> No need to unregister manually if you are using devm.
Ok, got it, will fix. I seemed to do this a lot :)
>
>> - goto err_free_mem;
>> + return error;
>> }
>> } else {
>> error = bma150_register_polled_device(bma150);
>> if (error)
>> - goto err_free_mem;
>> + return error;
>> }
>>
>> i2c_set_clientdata(client, bma150);
>> @@ -595,10 +592,6 @@ static int bma150_probe(struct i2c_client *client,
>> pm_runtime_enable(&client->dev);
>>
>> return 0;
>> -
>> -err_free_mem:
>> - kfree(bma150);
>> - return error;
>> }
>>
>> static int bma150_remove(struct i2c_client *client)
>> @@ -607,15 +600,10 @@ static int bma150_remove(struct i2c_client *client)
>>
>> pm_runtime_disable(&client->dev);
>>
>> - if (client->irq > 0) {
>> - free_irq(client->irq, bma150);
>> + if (client->irq > 0)
>> input_unregister_device(bma150->input);
>
> Here as well.
>
>> - } else {
>> + else
>> input_unregister_polled_device(bma150->input_polled);
>
> And here.
>
>> - input_free_polled_device(bma150->input_polled);
>> - }
>> -
>> - kfree(bma150);
>>
>> return 0;
>> }
>> --
>> 2.17.1
>>
>
> Thanks.
>
Thanks,
Jonathan

2019-01-28 19:32:10

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 3/3] input: dt-bindings: Add binding for bma150 sensor

On Sat, Jan 26, 2019 at 03:39:17AM +0000, Jonathan Bakker wrote:
>
>
> On 2019-01-25 5:28 p.m., Dmitry Torokhov wrote:
> > On Fri, Jan 25, 2019 at 07:44:00PM +0100, Paweł Chmiel wrote:
> >> From: Jonathan Bakker <[email protected]>
> >>
> >> Add device tree bindings for Bosch BMA150 Accelerometer Sensor
> >>
> >> Signed-off-by: Jonathan Bakker <[email protected]>
> >> Signed-off-by: Paweł Chmiel <[email protected]>
> >> ---
> >> .../bindings/input/bosch,bma150.txt | 20 +++++++++++++++++++
> >> 1 file changed, 20 insertions(+)
> >> create mode 100644 Documentation/devicetree/bindings/input/bosch,bma150.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/input/bosch,bma150.txt b/Documentation/devicetree/bindings/input/bosch,bma150.txt
> >> new file mode 100644
> >> index 000000000000..290c60e38c70
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/input/bosch,bma150.txt
> >> @@ -0,0 +1,20 @@
> >> +* Bosch BMA150 Accelerometer Sensor
> >> +
> >> +Also works for the SMB380 and BMA023 accelerometers
> >> +
> >> +Required properties:
> >> +- compatible : Should be "bosch,bma150"
> >> +- reg : The I2C address of the sensor
> >> +
> >> +Optional properties:
> >> +- interrupt-parent : should be the phandle for the interrupt controller
> >> +- interrupts : Interrupt mapping for IRQ. If not present device will be polled
> >> +
> >> +Example:
> >> +
> >> +bma150@38 {
> >> + compatible = "bosch,bma150";
> >> + reg = <0x38>;
> >> + interrupt-parent = <&gph0>;
> >> + interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
> >
> > Hmm, here you say that IRQ_TYPE_LEVEL_HIGH, so it is level interrupts,
> > but the driver overrides to rising edge unconditionally. Since you are
> > the first to add DT support please make separate patch to driver to drop
> > the ORQ trigger from request_theraded_irq() leaving only IRQF_ONESHOT.
> >
> This was simply an oversight on my part, my device was using the the polled method as opposed to an interrupt. I'll correct this in v2.
> > Also please create patch removing platform data support as noone is
> > using it upstream.
> >
> Will do.
> > What about the rest of config parameters from bma150_cfg? They should be
> > handled as device properties too.
> >
> Ok, I can add them as well. I didn't bother as the comment in the source code says that the default values are the ones recommended by Bosch.

OK, if you do not need to handle them then we can leave this task to the
next user ;)

Thanks.

--
Dmitry