2013-10-23 21:51:23

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCH] iio:light:tsl2563: Add DT support

Add Device Tree support for the TSL2563 driver
and document the binding.

Signed-off-by: Sebastian Reichel <[email protected]>
---
.../devicetree/bindings/iio/light/tsl2563.txt | 19 +++++++++++++++++++
drivers/iio/light/tsl2563.c | 4 ++++
2 files changed, 23 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/light/tsl2563.txt

diff --git a/Documentation/devicetree/bindings/iio/light/tsl2563.txt b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
new file mode 100644
index 0000000..b52cf4b
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
@@ -0,0 +1,19 @@
+* TAOS TSL2563 ambient light sensor
+
+Required properties:
+
+ - compatible : should be "taos,tsl2563"
+ - reg : the I2C address of the sensor
+
+Optional properties:
+
+ - cover-comp-gain : integer used as multiplier for gain
+ compensation (default = 1)
+
+Example:
+
+tsl2563@29 {
+ compatible = "taos,tsl2563";
+ reg = <0x29>;
+ cover-comp-gain = <16>;
+};
diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
index ebb962c..bd30b1d 100644
--- a/drivers/iio/light/tsl2563.c
+++ b/drivers/iio/light/tsl2563.c
@@ -699,6 +699,7 @@ static int tsl2563_probe(struct i2c_client *client,
struct iio_dev *indio_dev;
struct tsl2563_chip *chip;
struct tsl2563_platform_data *pdata = client->dev.platform_data;
+ struct device_node *np = client->dev.of_node;
int err = 0;
u8 id = 0;

@@ -735,6 +736,9 @@ static int tsl2563_probe(struct i2c_client *client,

if (pdata)
chip->cover_comp_gain = pdata->cover_comp_gain;
+ else if (np)
+ of_property_read_u32_index(np, "cover-comp-gain", 0,
+ &chip->cover_comp_gain);
else
chip->cover_comp_gain = 1;

--
1.8.4.rc3


2013-10-24 07:29:03

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH] iio:light:tsl2563: Add DT support

On 10/23/13 22:51, Sebastian Reichel wrote:
> Add Device Tree support for the TSL2563 driver
> and document the binding.
>
> Signed-off-by: Sebastian Reichel <[email protected]>
> ---
> .../devicetree/bindings/iio/light/tsl2563.txt | 19 +++++++++++++++++++
> drivers/iio/light/tsl2563.c | 4 ++++
> 2 files changed, 23 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/iio/light/tsl2563.txt
>
> diff --git a/Documentation/devicetree/bindings/iio/light/tsl2563.txt b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
> new file mode 100644
> index 0000000..b52cf4b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
> @@ -0,0 +1,19 @@
> +* TAOS TSL2563 ambient light sensor
> +
> +Required properties:
> +
> + - compatible : should be "taos,tsl2563"
> + - reg : the I2C address of the sensor
> +
> +Optional properties:
> +
So two options for this one. Either pitch it as a possible general parameter, or
mark it with a vendor prefix. It seems like something fairly general, but in that case it
probably needs a more detailed proposal and explanation of exactly what it is.

Also, is taos listed in vendor-prefixes.txt? Jon, is that the right vendor prefix to use?
I'm guessing you have some non mainline bindings out there already so it would be good
to match those...

> + - cover-comp-gain : integer used as multiplier for gain
> + compensation (default = 1)
> +
> +Example:
> +
> +tsl2563@29 {
> + compatible = "taos,tsl2563";
> + reg = <0x29>;
> + cover-comp-gain = <16>;
> +};
> diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
> index ebb962c..bd30b1d 100644
> --- a/drivers/iio/light/tsl2563.c
> +++ b/drivers/iio/light/tsl2563.c
> @@ -699,6 +699,7 @@ static int tsl2563_probe(struct i2c_client *client,
> struct iio_dev *indio_dev;
> struct tsl2563_chip *chip;
> struct tsl2563_platform_data *pdata = client->dev.platform_data;
> + struct device_node *np = client->dev.of_node;
> int err = 0;
> u8 id = 0;
>
> @@ -735,6 +736,9 @@ static int tsl2563_probe(struct i2c_client *client,
>
> if (pdata)
> chip->cover_comp_gain = pdata->cover_comp_gain;
> + else if (np)
> + of_property_read_u32_index(np, "cover-comp-gain", 0,
> + &chip->cover_comp_gain);
> else
> chip->cover_comp_gain = 1;
>
>

2013-10-24 13:43:13

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCH] iio:light:tsl2563: Add DT support

On Thu, Oct 24, 2013 at 09:29:42AM +0100, Jonathan Cameron wrote:
> On 10/23/13 22:51, Sebastian Reichel wrote:
> > Add Device Tree support for the TSL2563 driver
> > and document the binding.
> >
> > Signed-off-by: Sebastian Reichel <[email protected]>
> > ---
> > .../devicetree/bindings/iio/light/tsl2563.txt | 19 +++++++++++++++++++
> > drivers/iio/light/tsl2563.c | 4 ++++
> > 2 files changed, 23 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/iio/light/tsl2563.txt
> >
> > diff --git a/Documentation/devicetree/bindings/iio/light/tsl2563.txt b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
> > new file mode 100644
> > index 0000000..b52cf4b
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
> > @@ -0,0 +1,19 @@
> > +* TAOS TSL2563 ambient light sensor
> > +
> > +Required properties:
> > +
> > + - compatible : should be "taos,tsl2563"
> > + - reg : the I2C address of the sensor
> > +
> > +Optional properties:
> > +
> So two options for this one. Either pitch it as a possible general parameter, or
> mark it with a vendor prefix. It seems like something fairly general, but in that case it
> probably needs a more detailed proposal and explanation of exactly what it is.

OK, I will add a vendor prefix in a PATCHv2. When I converted the driver
to DT I had a look how this is used and I don't think it's "fairly general".

> Also, is taos listed in vendor-prefixes.txt? Jon, is that the right vendor prefix to use?
> I'm guessing you have some non mainline bindings out there already so it would be good
> to match those...

taos is currently not listed in the vendor-prefixes.txt file. Also
it seems that "TAOS Inc." has been absorbed by "ams AG" in 2011.
So how to proceed with the patch?

-- Sebastian


Attachments:
(No filename) (1.78 kB)
signature.asc (836.00 B)
Digital signature
Download all attachments

2013-10-24 14:12:25

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH] iio:light:tsl2563: Add DT support


On 10/24/13 14:58, Jon Brenner wrote:
> AMS-TAOS

amstaos

so lowercase, and based on their being no other hyphenated
names (ST-Ericson is ste for example)


>
> -----Original Message-----
> From: Sebastian Reichel [mailto:[email protected]]
> Sent: Thursday, October 24, 2013 8:43 AM
> To: Jonathan Cameron
> Cc: [email protected]; Rob Herring; Pawel Moll; Mark Rutland; Stephen Warren; Ian Campbell; Rob Landley; Jonathan Cameron; Peter Meerwald; Greg Kroah-Hartman; Bill Pemberton; Sachin Kamat; [email protected]; [email protected]; [email protected]; Jon Brenner
> Subject: Re: [PATCH] iio:light:tsl2563: Add DT support
>
> On Thu, Oct 24, 2013 at 09:29:42AM +0100, Jonathan Cameron wrote:
>> On 10/23/13 22:51, Sebastian Reichel wrote:
>>> Add Device Tree support for the TSL2563 driver and document the
>>> binding.
>>>
>>> Signed-off-by: Sebastian Reichel <[email protected]>
>>> ---
>>> .../devicetree/bindings/iio/light/tsl2563.txt | 19 +++++++++++++++++++
>>> drivers/iio/light/tsl2563.c | 4 ++++
>>> 2 files changed, 23 insertions(+)
>>> create mode 100644
>>> Documentation/devicetree/bindings/iio/light/tsl2563.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/iio/light/tsl2563.txt
>>> b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
>>> new file mode 100644
>>> index 0000000..b52cf4b
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
>>> @@ -0,0 +1,19 @@
>>> +* TAOS TSL2563 ambient light sensor
>>> +
>>> +Required properties:
>>> +
>>> + - compatible : should be "taos,tsl2563"
>>> + - reg : the I2C address of the sensor
>>> +
>>> +Optional properties:
>>> +
>> So two options for this one. Either pitch it as a possible general
>> parameter, or mark it with a vendor prefix. It seems like something
>> fairly general, but in that case it probably needs a more detailed proposal and explanation of exactly what it is.
>
> OK, I will add a vendor prefix in a PATCHv2. When I converted the driver to DT I had a look how this is used and I don't think it's "fairly general".
>
>> Also, is taos listed in vendor-prefixes.txt? Jon, is that the right vendor prefix to use?
>> I'm guessing you have some non mainline bindings out there already so
>> it would be good to match those...
>
> taos is currently not listed in the vendor-prefixes.txt file. Also it seems that "TAOS Inc." has been absorbed by "ams AG" in 2011.
> So how to proceed with the patch?
>
> -- Sebastian
>

2013-10-24 14:27:25

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv2] iio:light:tsl2563: Add DT support

Add Device Tree support for the TSL2563 driver
and document the binding.

Signed-off-by: Sebastian Reichel <[email protected]>
---
.../devicetree/bindings/iio/light/tsl2563.txt | 19 +++++++++++++++++++
Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
drivers/iio/light/tsl2563.c | 4 ++++
3 files changed, 24 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/light/tsl2563.txt

diff --git a/Documentation/devicetree/bindings/iio/light/tsl2563.txt b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
new file mode 100644
index 0000000..f91e809
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
@@ -0,0 +1,19 @@
+* AMS TAOS TSL2563 ambient light sensor
+
+Required properties:
+
+ - compatible : should be "amstaos,tsl2563"
+ - reg : the I2C address of the sensor
+
+Optional properties:
+
+ - amstaos,cover-comp-gain : integer used as multiplier for gain
+ compensation (default = 1)
+
+Example:
+
+tsl2563@29 {
+ compatible = "amstaos,tsl2563";
+ reg = <0x29>;
+ amstaos,cover-comp-gain = <16>;
+};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 2cc3dad..d26c834 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -9,6 +9,7 @@ aeroflexgaisler Aeroflex Gaisler AB
ak Asahi Kasei Corp.
altr Altera Corp.
amcc Applied Micro Circuits Corporation (APM, formally AMCC)
+amstaos AMS Taos Inc.
apm Applied Micro Circuits Corporation (APM)
arm ARM Ltd.
atmel Atmel Corporation
diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
index ebb962c..261660a 100644
--- a/drivers/iio/light/tsl2563.c
+++ b/drivers/iio/light/tsl2563.c
@@ -699,6 +699,7 @@ static int tsl2563_probe(struct i2c_client *client,
struct iio_dev *indio_dev;
struct tsl2563_chip *chip;
struct tsl2563_platform_data *pdata = client->dev.platform_data;
+ struct device_node *np = client->dev.of_node;
int err = 0;
u8 id = 0;

@@ -735,6 +736,9 @@ static int tsl2563_probe(struct i2c_client *client,

if (pdata)
chip->cover_comp_gain = pdata->cover_comp_gain;
+ else if (np)
+ of_property_read_u32_index(np, "amstaos,cover-comp-gain", 0,
+ &chip->cover_comp_gain);
else
chip->cover_comp_gain = 1;

--
1.8.4.rc3

2013-10-24 14:50:14

by Jon Brenner

[permalink] [raw]
Subject: RE: [PATCH] iio:light:tsl2563: Add DT support

AMS-TAOS

-----Original Message-----
From: Sebastian Reichel [mailto:[email protected]]
Sent: Thursday, October 24, 2013 8:43 AM
To: Jonathan Cameron
Cc: [email protected]; Rob Herring; Pawel Moll; Mark Rutland; Stephen Warren; Ian Campbell; Rob Landley; Jonathan Cameron; Peter Meerwald; Greg Kroah-Hartman; Bill Pemberton; Sachin Kamat; [email protected]; [email protected]; [email protected]; Jon Brenner
Subject: Re: [PATCH] iio:light:tsl2563: Add DT support

On Thu, Oct 24, 2013 at 09:29:42AM +0100, Jonathan Cameron wrote:
> On 10/23/13 22:51, Sebastian Reichel wrote:
> > Add Device Tree support for the TSL2563 driver and document the
> > binding.
> >
> > Signed-off-by: Sebastian Reichel <[email protected]>
> > ---
> > .../devicetree/bindings/iio/light/tsl2563.txt | 19 +++++++++++++++++++
> > drivers/iio/light/tsl2563.c | 4 ++++
> > 2 files changed, 23 insertions(+)
> > create mode 100644
> > Documentation/devicetree/bindings/iio/light/tsl2563.txt
> >
> > diff --git a/Documentation/devicetree/bindings/iio/light/tsl2563.txt
> > b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
> > new file mode 100644
> > index 0000000..b52cf4b
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
> > @@ -0,0 +1,19 @@
> > +* TAOS TSL2563 ambient light sensor
> > +
> > +Required properties:
> > +
> > + - compatible : should be "taos,tsl2563"
> > + - reg : the I2C address of the sensor
> > +
> > +Optional properties:
> > +
> So two options for this one. Either pitch it as a possible general
> parameter, or mark it with a vendor prefix. It seems like something
> fairly general, but in that case it probably needs a more detailed proposal and explanation of exactly what it is.

OK, I will add a vendor prefix in a PATCHv2. When I converted the driver to DT I had a look how this is used and I don't think it's "fairly general".

> Also, is taos listed in vendor-prefixes.txt? Jon, is that the right vendor prefix to use?
> I'm guessing you have some non mainline bindings out there already so
> it would be good to match those...

taos is currently not listed in the vendor-prefixes.txt file. Also it seems that "TAOS Inc." has been absorbed by "ams AG" in 2011.
So how to proceed with the patch?

-- Sebastian

2013-10-25 03:32:30

by Kumar Gala

[permalink] [raw]
Subject: Re: [PATCHv2] iio:light:tsl2563: Add DT support


On Oct 24, 2013, at 9:27 AM, Sebastian Reichel wrote:

> Add Device Tree support for the TSL2563 driver
> and document the binding.
>
> Signed-off-by: Sebastian Reichel <[email protected]>
> ---
> .../devicetree/bindings/iio/light/tsl2563.txt | 19 +++++++++++++++++++
> Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
> drivers/iio/light/tsl2563.c | 4 ++++
> 3 files changed, 24 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/iio/light/tsl2563.txt
>
> diff --git a/Documentation/devicetree/bindings/iio/light/tsl2563.txt b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
> new file mode 100644
> index 0000000..f91e809
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
> @@ -0,0 +1,19 @@
> +* AMS TAOS TSL2563 ambient light sensor
> +
> +Required properties:
> +
> + - compatible : should be "amstaos,tsl2563"
> + - reg : the I2C address of the sensor
> +
> +Optional properties:
> +
> + - amstaos,cover-comp-gain : integer used as multiplier for gain
> + compensation (default = 1)
> +
> +Example:
> +
> +tsl2563@29 {
> + compatible = "amstaos,tsl2563";
> + reg = <0x29>;
> + amstaos,cover-comp-gain = <16>;
> +};

For the Binding, assuming another patch to add amstoas to the vendor list

Acked-by: Kumar Gala <[email protected]>

- k

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

2013-10-25 08:23:53

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCHv2] iio:light:tsl2563: Add DT support

On Thu, Oct 24, 2013 at 10:32:36PM -0500, Kumar Gala wrote:
> On Oct 24, 2013, at 9:27 AM, Sebastian Reichel wrote:
> > Add Device Tree support for the TSL2563 driver
> > and document the binding.
> >
> > Signed-off-by: Sebastian Reichel <[email protected]>
> > ---
> > .../devicetree/bindings/iio/light/tsl2563.txt | 19 +++++++++++++++++++
> > Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
> > drivers/iio/light/tsl2563.c | 4 ++++
>
> For the Binding, assuming another patch to add amstoas to the vendor list

I embedded the vendor list update into this patch.
Should I split this into its own patch?

-- Sebastian


Attachments:
(No filename) (665.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments

2013-10-25 08:37:22

by Kumar Gala

[permalink] [raw]
Subject: Re: [PATCHv2] iio:light:tsl2563: Add DT support


On Oct 25, 2013, at 3:23 AM, Sebastian Reichel wrote:

> On Thu, Oct 24, 2013 at 10:32:36PM -0500, Kumar Gala wrote:
>> On Oct 24, 2013, at 9:27 AM, Sebastian Reichel wrote:
>>> Add Device Tree support for the TSL2563 driver
>>> and document the binding.
>>>
>>> Signed-off-by: Sebastian Reichel <[email protected]>
>>> ---
>>> .../devicetree/bindings/iio/light/tsl2563.txt | 19 +++++++++++++++++++
>>> Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
>>> drivers/iio/light/tsl2563.c | 4 ++++
>>
>> For the Binding, assuming another patch to add amstoas to the vendor list
>
> I embedded the vendor list update into this patch.
> Should I split this into its own patch?
>
> -- Sebastian

Its fine, but do update the commit comment about that.

- k

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

2013-10-25 09:10:32

by Sebastian Reichel

[permalink] [raw]
Subject: [PATCHv3] iio:light:tsl2563: Add DT support

Add Device Tree support for the TSL2563 driver,
document the binding and add AMS-TAOS Inc. to the
list of vendor prefixes.

Signed-off-by: Sebastian Reichel <[email protected]>
Acked-by: Kumar Gala <[email protected]>
---
.../devicetree/bindings/iio/light/tsl2563.txt | 19 +++++++++++++++++++
Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
drivers/iio/light/tsl2563.c | 4 ++++
3 files changed, 24 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/light/tsl2563.txt

diff --git a/Documentation/devicetree/bindings/iio/light/tsl2563.txt b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
new file mode 100644
index 0000000..f91e809
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
@@ -0,0 +1,19 @@
+* AMS TAOS TSL2563 ambient light sensor
+
+Required properties:
+
+ - compatible : should be "amstaos,tsl2563"
+ - reg : the I2C address of the sensor
+
+Optional properties:
+
+ - amstaos,cover-comp-gain : integer used as multiplier for gain
+ compensation (default = 1)
+
+Example:
+
+tsl2563@29 {
+ compatible = "amstaos,tsl2563";
+ reg = <0x29>;
+ amstaos,cover-comp-gain = <16>;
+};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 2cc3dad..8cf3edf 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -9,6 +9,7 @@ aeroflexgaisler Aeroflex Gaisler AB
ak Asahi Kasei Corp.
altr Altera Corp.
amcc Applied Micro Circuits Corporation (APM, formally AMCC)
+amstaos AMS-Taos Inc.
apm Applied Micro Circuits Corporation (APM)
arm ARM Ltd.
atmel Atmel Corporation
diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
index ebb962c..261660a 100644
--- a/drivers/iio/light/tsl2563.c
+++ b/drivers/iio/light/tsl2563.c
@@ -699,6 +699,7 @@ static int tsl2563_probe(struct i2c_client *client,
struct iio_dev *indio_dev;
struct tsl2563_chip *chip;
struct tsl2563_platform_data *pdata = client->dev.platform_data;
+ struct device_node *np = client->dev.of_node;
int err = 0;
u8 id = 0;

@@ -735,6 +736,9 @@ static int tsl2563_probe(struct i2c_client *client,

if (pdata)
chip->cover_comp_gain = pdata->cover_comp_gain;
+ else if (np)
+ of_property_read_u32_index(np, "amstaos,cover-comp-gain", 0,
+ &chip->cover_comp_gain);
else
chip->cover_comp_gain = 1;

--
1.8.4.rc3

2013-10-25 22:52:16

by Grant Likely

[permalink] [raw]
Subject: Re: [PATCH] iio:light:tsl2563: Add DT support

On Wed, 23 Oct 2013 23:51:03 +0200, Sebastian Reichel <[email protected]> wrote:
> Add Device Tree support for the TSL2563 driver
> and document the binding.
>
> Signed-off-by: Sebastian Reichel <[email protected]>
> ---
> .../devicetree/bindings/iio/light/tsl2563.txt | 19 +++++++++++++++++++
> drivers/iio/light/tsl2563.c | 4 ++++
> 2 files changed, 23 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/iio/light/tsl2563.txt
>
> diff --git a/Documentation/devicetree/bindings/iio/light/tsl2563.txt b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
> new file mode 100644
> index 0000000..b52cf4b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/light/tsl2563.txt
> @@ -0,0 +1,19 @@
> +* TAOS TSL2563 ambient light sensor
> +
> +Required properties:
> +
> + - compatible : should be "taos,tsl2563"
> + - reg : the I2C address of the sensor
> +
> +Optional properties:
> +
> + - cover-comp-gain : integer used as multiplier for gain
> + compensation (default = 1)

Should be taos,cover-comp-gain

Otherwise looks fine to me.

> +
> +Example:
> +
> +tsl2563@29 {
> + compatible = "taos,tsl2563";
> + reg = <0x29>;
> + cover-comp-gain = <16>;
> +};
> diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
> index ebb962c..bd30b1d 100644
> --- a/drivers/iio/light/tsl2563.c
> +++ b/drivers/iio/light/tsl2563.c
> @@ -699,6 +699,7 @@ static int tsl2563_probe(struct i2c_client *client,
> struct iio_dev *indio_dev;
> struct tsl2563_chip *chip;
> struct tsl2563_platform_data *pdata = client->dev.platform_data;
> + struct device_node *np = client->dev.of_node;
> int err = 0;
> u8 id = 0;
>
> @@ -735,6 +736,9 @@ static int tsl2563_probe(struct i2c_client *client,
>
> if (pdata)
> chip->cover_comp_gain = pdata->cover_comp_gain;
> + else if (np)
> + of_property_read_u32_index(np, "cover-comp-gain", 0,
> + &chip->cover_comp_gain);

of_property_read_u32() should be sufficient. You don't need the _index
variant.

> else
> chip->cover_comp_gain = 1;
>
> --
> 1.8.4.rc3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

2013-10-25 23:09:41

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCH] iio:light:tsl2563: Add DT support

Hi Grant,

On Fri, Oct 25, 2013 at 08:10:28PM +0100, Grant Likely wrote:
> > + - cover-comp-gain : integer used as multiplier for gain
> > + compensation (default = 1)
>
> Should be taos,cover-comp-gain

Has been updated to "amstaos,cover-comp-gain" in the latest
patches, see https://lkml.org/lkml/2013/10/25/59

> Otherwise looks fine to me.

Is this an acked-by?

> > + else if (np)
> > + of_property_read_u32_index(np, "cover-comp-gain", 0,
> > + &chip->cover_comp_gain);
>
> of_property_read_u32() should be sufficient. You don't need the _index
> variant.

ah, I missed the function when skipping over linux/of.h.
I will sent another update.

-- Sebastian


Attachments:
(No filename) (693.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments