diff mbox

[2/2] hwmon: add dt binding for max1619

Message ID 20170911191649.3344-2-atull@kernel.org (mailing list archive)
State Accepted
Headers show

Commit Message

Alan Tull Sept. 11, 2017, 7:16 p.m. UTC
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(+)

Comments

Alan Tull Sept. 11, 2017, 7:32 p.m. UTC | #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 linux-hwmon" 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. UTC | #2
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 linux-hwmon" 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. UTC | #3
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 linux-hwmon" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rob Herring (Arm) Sept. 18, 2017, 9:11 p.m. UTC | #4
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 linux-hwmon" 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. UTC | #5
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 linux-hwmon" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rob Herring (Arm) Sept. 19, 2017, 7:35 p.m. UTC | #6
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 linux-hwmon" 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. UTC | #7
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 linux-hwmon" 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:13 p.m. UTC | #8
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>
> 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>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>  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,
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alan Tull Oct. 2, 2017, 2:30 p.m. UTC | #9
On Sun, Oct 1, 2017 at 9:13 AM, 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>
>> 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>
>
> Applied to hwmon-next.

Thanks!
Alan

>
> Thanks,
> Guenter
>
>> ---
>>  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,
--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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,