[1/2] dt-bindings: hwmon: add compatible for max1619

Message ID 20170911191649.3344-1-atull@kernel.org
State Not Applicable
Headers show
Series
  • [1/2] dt-bindings: hwmon: add compatible for max1619
Related show

Commit Message

Alan Tull Sept. 11, 2017, 7:16 p.m.
Add new device tree bindings document for max1619 device
including a new compatible string.

Signed-off-by: Alan Tull <atull@kernel.org>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
---
 Documentation/devicetree/bindings/hwmon/max1619.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/max1619.txt

Comments

Alan Tull Sept. 11, 2017, 7:32 p.m. | #1
On Mon, Sep 11, 2017 at 2:16 PM, Alan Tull <atull@kernel.org> wrote:

Add Oleksij Rempel <bug-track@fisher-privat.net>

> Add new device tree binding for max1619.
>
> Signed-off-by: Alan Tull <atull@kernel.org>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> ---
>  drivers/hwmon/max1619.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c
> index a182789..76d9669 100644
> --- a/drivers/hwmon/max1619.c
> +++ b/drivers/hwmon/max1619.c
> @@ -303,10 +303,20 @@ static const struct i2c_device_id max1619_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, max1619_id);
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id max1619_of_match[] = {
> +       { .compatible = "maxim,max1619", },
> +       {},
> +};
> +
> +MODULE_DEVICE_TABLE(of, max1619_of_match);
> +#endif
> +
>  static struct i2c_driver max1619_driver = {
>         .class          = I2C_CLASS_HWMON,
>         .driver = {
>                 .name   = "max1619",
> +               .of_match_table = of_match_ptr(max1619_of_match),
>         },
>         .probe          = max1619_probe,
>         .id_table       = max1619_id,
> --
> 2.7.4
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alan Tull Sept. 11, 2017, 7:33 p.m. | #2
On Mon, Sep 11, 2017 at 2:16 PM, Alan Tull <atull@kernel.org> wrote:

Add Oleksij Rempel

> Add new device tree bindings document for max1619 device
> including a new compatible string.
>
> Signed-off-by: Alan Tull <atull@kernel.org>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> ---
>  Documentation/devicetree/bindings/hwmon/max1619.txt | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/hwmon/max1619.txt
>
> diff --git a/Documentation/devicetree/bindings/hwmon/max1619.txt b/Documentation/devicetree/bindings/hwmon/max1619.txt
> new file mode 100644
> index 0000000..c70dbbe
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/max1619.txt
> @@ -0,0 +1,12 @@
> +Bindings for MAX1619 Temperature Sensor
> +
> +Required properties:
> +- compatible : "maxim,max1619"
> +- reg        : I2C address, one of 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, or
> +               0x4d, 0x4e
> +
> +Example:
> +       temp@4c {
> +               compatible = "maxim,max1619";
> +               reg = <0x4c>;
> +       };
> --
> 2.7.4
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Guenter Roeck Sept. 11, 2017, 7:58 p.m. | #3
On Mon, Sep 11, 2017 at 02:16:49PM -0500, Alan Tull wrote:
> Add new device tree binding for max1619.
> 
> Signed-off-by: Alan Tull <atull@kernel.org>

Technically that should already work, without explicit binding,
or did the i2c core change lately ?

Guenter

> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> ---
>  drivers/hwmon/max1619.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c
> index a182789..76d9669 100644
> --- a/drivers/hwmon/max1619.c
> +++ b/drivers/hwmon/max1619.c
> @@ -303,10 +303,20 @@ static const struct i2c_device_id max1619_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, max1619_id);
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id max1619_of_match[] = {
> +	{ .compatible = "maxim,max1619", },
> +	{},
> +};
> +
> +MODULE_DEVICE_TABLE(of, max1619_of_match);
> +#endif
> +
>  static struct i2c_driver max1619_driver = {
>  	.class		= I2C_CLASS_HWMON,
>  	.driver = {
>  		.name	= "max1619",
> +		.of_match_table = of_match_ptr(max1619_of_match),
>  	},
>  	.probe		= max1619_probe,
>  	.id_table	= max1619_id,
> -- 
> 2.7.4
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alan Tull Sept. 11, 2017, 9:12 p.m. | #4
On Mon, Sep 11, 2017 at 2:58 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> On Mon, Sep 11, 2017 at 02:16:49PM -0500, Alan Tull wrote:
>> Add new device tree binding for max1619.
>>
>> Signed-off-by: Alan Tull <atull@kernel.org>
>
> Technically that should already work, without explicit binding,
> or did the i2c core change lately ?

OK I see that now.  Yep, this change is not needed.  Thanks!

>
> Guenter
>
>> Cc: Jean Delvare <jdelvare@suse.com>
>> Cc: Guenter Roeck <linux@roeck-us.net>
>> Cc: Rob Herring <robh+dt@kernel.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> ---
>>  drivers/hwmon/max1619.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c
>> index a182789..76d9669 100644
>> --- a/drivers/hwmon/max1619.c
>> +++ b/drivers/hwmon/max1619.c
>> @@ -303,10 +303,20 @@ static const struct i2c_device_id max1619_id[] = {
>>  };
>>  MODULE_DEVICE_TABLE(i2c, max1619_id);
>>
>> +#ifdef CONFIG_OF
>> +static const struct of_device_id max1619_of_match[] = {
>> +     { .compatible = "maxim,max1619", },
>> +     {},
>> +};
>> +
>> +MODULE_DEVICE_TABLE(of, max1619_of_match);
>> +#endif
>> +
>>  static struct i2c_driver max1619_driver = {
>>       .class          = I2C_CLASS_HWMON,
>>       .driver = {
>>               .name   = "max1619",
>> +             .of_match_table = of_match_ptr(max1619_of_match),
>>       },
>>       .probe          = max1619_probe,
>>       .id_table       = max1619_id,
>> --
>> 2.7.4
>>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alan Tull Sept. 11, 2017, 9:18 p.m. | #5
On Mon, Sep 11, 2017 at 2:33 PM, Alan Tull <atull@kernel.org> wrote:

Forget this - Guenter has pointed out that this patch is not needed,
as the i2c layer handles this without needing the compatible added.

Alan

> On Mon, Sep 11, 2017 at 2:16 PM, Alan Tull <atull@kernel.org> wrote:
>
> Add Oleksij Rempel
>
>> Add new device tree bindings document for max1619 device
>> including a new compatible string.
>>
>> Signed-off-by: Alan Tull <atull@kernel.org>
>> Cc: Jean Delvare <jdelvare@suse.com>
>> Cc: Guenter Roeck <linux@roeck-us.net>
>> Cc: Rob Herring <robh+dt@kernel.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> ---
>>  Documentation/devicetree/bindings/hwmon/max1619.txt | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/hwmon/max1619.txt
>>
>> diff --git a/Documentation/devicetree/bindings/hwmon/max1619.txt b/Documentation/devicetree/bindings/hwmon/max1619.txt
>> new file mode 100644
>> index 0000000..c70dbbe
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/hwmon/max1619.txt
>> @@ -0,0 +1,12 @@
>> +Bindings for MAX1619 Temperature Sensor
>> +
>> +Required properties:
>> +- compatible : "maxim,max1619"
>> +- reg        : I2C address, one of 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, or
>> +               0x4d, 0x4e
>> +
>> +Example:
>> +       temp@4c {
>> +               compatible = "maxim,max1619";
>> +               reg = <0x4c>;
>> +       };
>> --
>> 2.7.4
>>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rob Herring Sept. 18, 2017, 9:11 p.m. | #6
On Mon, Sep 11, 2017 at 12:58:57PM -0700, Guenter Roeck wrote:
> On Mon, Sep 11, 2017 at 02:16:49PM -0500, Alan Tull wrote:
> > Add new device tree binding for max1619.
> > 
> > Signed-off-by: Alan Tull <atull@kernel.org>
> 
> Technically that should already work, without explicit binding,
> or did the i2c core change lately ?

There was some work in that direction IIRC.

We don't really want to rely on that behavior and should have DT match 
strings.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rob Herring Sept. 18, 2017, 9:12 p.m. | #7
On Mon, Sep 11, 2017 at 04:18:22PM -0500, Alan Tull wrote:
> On Mon, Sep 11, 2017 at 2:33 PM, Alan Tull <atull@kernel.org> wrote:
> 
> Forget this - Guenter has pointed out that this patch is not needed,
> as the i2c layer handles this without needing the compatible added.

The binding is needed regardless.

This could be in trivial-devices.txt instead. Either way,

Acked-by: Rob Herring <robh@kernel.org>

Rob

> 
> Alan
> 
> > On Mon, Sep 11, 2017 at 2:16 PM, Alan Tull <atull@kernel.org> wrote:
> >
> > Add Oleksij Rempel
> >
> >> Add new device tree bindings document for max1619 device
> >> including a new compatible string.
> >>
> >> Signed-off-by: Alan Tull <atull@kernel.org>
> >> Cc: Jean Delvare <jdelvare@suse.com>
> >> Cc: Guenter Roeck <linux@roeck-us.net>
> >> Cc: Rob Herring <robh+dt@kernel.org>
> >> Cc: Mark Rutland <mark.rutland@arm.com>
> >> ---
> >>  Documentation/devicetree/bindings/hwmon/max1619.txt | 12 ++++++++++++
> >>  1 file changed, 12 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/hwmon/max1619.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/hwmon/max1619.txt b/Documentation/devicetree/bindings/hwmon/max1619.txt
> >> new file mode 100644
> >> index 0000000..c70dbbe
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/hwmon/max1619.txt
> >> @@ -0,0 +1,12 @@
> >> +Bindings for MAX1619 Temperature Sensor
> >> +
> >> +Required properties:
> >> +- compatible : "maxim,max1619"
> >> +- reg        : I2C address, one of 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, or
> >> +               0x4d, 0x4e
> >> +
> >> +Example:
> >> +       temp@4c {
> >> +               compatible = "maxim,max1619";
> >> +               reg = <0x4c>;
> >> +       };
> >> --
> >> 2.7.4
> >>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alan Tull Sept. 19, 2017, 6:11 p.m. | #8
On Mon, Sep 18, 2017 at 4:11 PM, Rob Herring <robh@kernel.org> wrote:
> On Mon, Sep 11, 2017 at 12:58:57PM -0700, Guenter Roeck wrote:
>> On Mon, Sep 11, 2017 at 02:16:49PM -0500, Alan Tull wrote:
>> > Add new device tree binding for max1619.
>> >
>> > Signed-off-by: Alan Tull <atull@kernel.org>
>>
>> Technically that should already work, without explicit binding,
>> or did the i2c core change lately ?
>
> There was some work in that direction IIRC.

Yes, after Guenter replied I tried it without this patch and it
worked.  i2c drivers can have a 'detect' function that can check part
id, etc.  If detection succeeds, it will fill in the device name in
i2c_board_info->type and the i2c-core will enumerate using that.

Alan

>
> We don't really want to rely on that behavior and should have DT match
> strings.
>
> Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rob Herring Sept. 19, 2017, 7:35 p.m. | #9
On Tue, Sep 19, 2017 at 1:11 PM, Alan Tull <atull@kernel.org> wrote:
> On Mon, Sep 18, 2017 at 4:11 PM, Rob Herring <robh@kernel.org> wrote:
>> On Mon, Sep 11, 2017 at 12:58:57PM -0700, Guenter Roeck wrote:
>>> On Mon, Sep 11, 2017 at 02:16:49PM -0500, Alan Tull wrote:
>>> > Add new device tree binding for max1619.
>>> >
>>> > Signed-off-by: Alan Tull <atull@kernel.org>
>>>
>>> Technically that should already work, without explicit binding,
>>> or did the i2c core change lately ?
>>
>> There was some work in that direction IIRC.
>
> Yes, after Guenter replied I tried it without this patch and it
> worked.  i2c drivers can have a 'detect' function that can check part
> id, etc.  If detection succeeds, it will fill in the device name in
> i2c_board_info->type and the i2c-core will enumerate using that.

Right, I expected it still worked, but am saying we don't want to rely
on that behavior and introduce new places relying on it. Otherwise,
the driver will match on say "rob,max1619" as well. The detect
function is the really old way to probe devices IIRC. The function to
look at is i2c_of_match_device. We want OF style match, not a match
with i2c_of_match_device_sysfs which strips the vendor prefix from the
compatible.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alan Tull Sept. 28, 2017, 6:12 p.m. | #10
On Tue, Sep 19, 2017 at 2:35 PM, Rob Herring <robh@kernel.org> wrote:
> On Tue, Sep 19, 2017 at 1:11 PM, Alan Tull <atull@kernel.org> wrote:
>> On Mon, Sep 18, 2017 at 4:11 PM, Rob Herring <robh@kernel.org> wrote:
>>> On Mon, Sep 11, 2017 at 12:58:57PM -0700, Guenter Roeck wrote:
>>>> On Mon, Sep 11, 2017 at 02:16:49PM -0500, Alan Tull wrote:
>>>> > Add new device tree binding for max1619.
>>>> >
>>>> > Signed-off-by: Alan Tull <atull@kernel.org>
>>>>
>>>> Technically that should already work, without explicit binding,
>>>> or did the i2c core change lately ?
>>>
>>> There was some work in that direction IIRC.
>>
>> Yes, after Guenter replied I tried it without this patch and it
>> worked.  i2c drivers can have a 'detect' function that can check part
>> id, etc.  If detection succeeds, it will fill in the device name in
>> i2c_board_info->type and the i2c-core will enumerate using that.
>
> Right, I expected it still worked, but am saying we don't want to rely
> on that behavior and introduce new places relying on it. Otherwise,
> the driver will match on say "rob,max1619" as well. The detect
> function is the really old way to probe devices IIRC. The function to
> look at is i2c_of_match_device. We want OF style match, not a match
> with i2c_of_match_device_sysfs which strips the vendor prefix from the
> compatible.

OK, well my patch is out there if someone wants to take it.

Alan

>
> Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Guenter Roeck Oct. 1, 2017, 2:11 p.m. | #11
On Mon, Sep 11, 2017 at 02:16:48PM -0500, Alan Tull wrote:
> Add new device tree bindings document for max1619 device
> including a new compatible string.
> 
> Signed-off-by: Alan Tull <atull@kernel.org>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Acked-by: Rob Herring <robh@kernel.org>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>  Documentation/devicetree/bindings/hwmon/max1619.txt | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/hwmon/max1619.txt
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/max1619.txt b/Documentation/devicetree/bindings/hwmon/max1619.txt
> new file mode 100644
> index 0000000..c70dbbe
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/max1619.txt
> @@ -0,0 +1,12 @@
> +Bindings for MAX1619 Temperature Sensor
> +
> +Required properties:
> +- compatible : "maxim,max1619"
> +- reg        : I2C address, one of 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, or
> +               0x4d, 0x4e
> +
> +Example:
> +	temp@4c {
> +		compatible = "maxim,max1619";
> +		reg = <0x4c>;
> +	};
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/Documentation/devicetree/bindings/hwmon/max1619.txt b/Documentation/devicetree/bindings/hwmon/max1619.txt
new file mode 100644
index 0000000..c70dbbe
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/max1619.txt
@@ -0,0 +1,12 @@ 
+Bindings for MAX1619 Temperature Sensor
+
+Required properties:
+- compatible : "maxim,max1619"
+- reg        : I2C address, one of 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, 0x4c, or
+               0x4d, 0x4e
+
+Example:
+	temp@4c {
+		compatible = "maxim,max1619";
+		reg = <0x4c>;
+	};