2020-05-22 06:50:07

by Marek Szyprowski

[permalink] [raw]
Subject: [PATCH v2 1/3] regulator: max14577: Add proper dt-compatible strings

Add device tree compatible strings and create proper modalias structures
to let this driver load automatically if compiled as module, because
max14577 MFD driver creates MFD cells with such compatible strings.

Signed-off-by: Marek Szyprowski <[email protected]>
---
v2:
- added .of_match_table pointer
---
drivers/regulator/max14577-regulator.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/max14577-regulator.c b/drivers/regulator/max14577-regulator.c
index 07a150c9bbf2..4c9ae52b9e87 100644
--- a/drivers/regulator/max14577-regulator.c
+++ b/drivers/regulator/max14577-regulator.c
@@ -238,10 +238,20 @@ static const struct platform_device_id max14577_regulator_id[] = {
};
MODULE_DEVICE_TABLE(platform, max14577_regulator_id);

+static const struct of_device_id of_max14577_regulator_dt_match[] = {
+ { .compatible = "maxim,max77836-regulator",
+ .data = (void *)MAXIM_DEVICE_TYPE_MAX77836, },
+ { .compatible = "maxim,max14577-regulator",
+ .data = (void *)MAXIM_DEVICE_TYPE_MAX14577, },
+ { },
+};
+MODULE_DEVICE_TABLE(of, of_max14577_regulator_dt_match);
+
static struct platform_driver max14577_regulator_driver = {
.driver = {
- .name = "max14577-regulator",
- },
+ .name = "max14577-regulator",
+ .of_match_table = of_max14577_regulator_dt_match,
+ },
.probe = max14577_regulator_probe,
.id_table = max14577_regulator_id,
};
--
2.17.1


2020-05-22 06:50:52

by Marek Szyprowski

[permalink] [raw]
Subject: [PATCH v2 2/3] extcon: max14577: Add proper dt-compatible strings

Add device tree compatible strings and create proper modalias structures
to let this driver load automatically if compiled as module, because
max14577 MFD driver creates MFD cells with such compatible strings.

Signed-off-by: Marek Szyprowski <[email protected]>
---
v2:
- added .of_match_table pointer
---
drivers/extcon/extcon-max14577.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
index 32f663436e6e..03af678ddeba 100644
--- a/drivers/extcon/extcon-max14577.c
+++ b/drivers/extcon/extcon-max14577.c
@@ -782,9 +782,19 @@ static const struct platform_device_id max14577_muic_id[] = {
};
MODULE_DEVICE_TABLE(platform, max14577_muic_id);

+static const struct of_device_id of_max14577_muic_dt_match[] = {
+ { .compatible = "maxim,max77836-muic",
+ .data = (void *)MAXIM_DEVICE_TYPE_MAX77836, },
+ { .compatible = "maxim,max14577-muic",
+ .data = (void *)MAXIM_DEVICE_TYPE_MAX14577, },
+ { },
+};
+MODULE_DEVICE_TABLE(of, of_max14577_muic_dt_match);
+
static struct platform_driver max14577_muic_driver = {
.driver = {
.name = "max14577-muic",
+ .of_match_table = of_max14577_muic_dt_match,
},
.probe = max14577_muic_probe,
.remove = max14577_muic_remove,
--
2.17.1

2020-05-22 07:00:07

by Chanwoo Choi

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] extcon: max14577: Add proper dt-compatible strings

On 5/22/20 3:48 PM, Marek Szyprowski wrote:
> Add device tree compatible strings and create proper modalias structures
> to let this driver load automatically if compiled as module, because
> max14577 MFD driver creates MFD cells with such compatible strings.
>
> Signed-off-by: Marek Szyprowski <[email protected]>
> ---
> v2:
> - added .of_match_table pointer
> ---
> drivers/extcon/extcon-max14577.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
> index 32f663436e6e..03af678ddeba 100644
> --- a/drivers/extcon/extcon-max14577.c
> +++ b/drivers/extcon/extcon-max14577.c
> @@ -782,9 +782,19 @@ static const struct platform_device_id max14577_muic_id[] = {
> };
> MODULE_DEVICE_TABLE(platform, max14577_muic_id);
>
> +static const struct of_device_id of_max14577_muic_dt_match[] = {
> + { .compatible = "maxim,max77836-muic",
> + .data = (void *)MAXIM_DEVICE_TYPE_MAX77836, },
> + { .compatible = "maxim,max14577-muic",
> + .data = (void *)MAXIM_DEVICE_TYPE_MAX14577, },
> + { },

How about changing the order between max77836 and max14577 as already added structure
like platform_device_id if there are no specific reason as following:?


static const struct of_device_id of_max14577_muic_dt_match[] = {
{ .compatible = "maxim,max14577-muic",
.data = (void *)MAXIM_DEVICE_TYPE_MAX14577, },
{ .compatible = "maxim,max77836-muic",
.data = (void *)MAXIM_DEVICE_TYPE_MAX77836, },
{ },



> +};
> +MODULE_DEVICE_TABLE(of, of_max14577_muic_dt_match);
> +
> static struct platform_driver max14577_muic_driver = {
> .driver = {
> .name = "max14577-muic",
> + .of_match_table = of_max14577_muic_dt_match,
> },
> .probe = max14577_muic_probe,
> .remove = max14577_muic_remove,
>


--
Best Regards,
Chanwoo Choi
Samsung Electronics

2020-05-22 08:33:16

by Marek Szyprowski

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] extcon: max14577: Add proper dt-compatible strings

Hi Chanwoo,

On 22.05.2020 09:08, Chanwoo Choi wrote:
> On 5/22/20 3:48 PM, Marek Szyprowski wrote:
>> Add device tree compatible strings and create proper modalias structures
>> to let this driver load automatically if compiled as module, because
>> max14577 MFD driver creates MFD cells with such compatible strings.
>>
>> Signed-off-by: Marek Szyprowski <[email protected]>
>> ---
>> v2:
>> - added .of_match_table pointer
>> ---
>> drivers/extcon/extcon-max14577.c | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c
>> index 32f663436e6e..03af678ddeba 100644
>> --- a/drivers/extcon/extcon-max14577.c
>> +++ b/drivers/extcon/extcon-max14577.c
>> @@ -782,9 +782,19 @@ static const struct platform_device_id max14577_muic_id[] = {
>> };
>> MODULE_DEVICE_TABLE(platform, max14577_muic_id);
>>
>> +static const struct of_device_id of_max14577_muic_dt_match[] = {
>> + { .compatible = "maxim,max77836-muic",
>> + .data = (void *)MAXIM_DEVICE_TYPE_MAX77836, },
>> + { .compatible = "maxim,max14577-muic",
>> + .data = (void *)MAXIM_DEVICE_TYPE_MAX14577, },
>> + { },
> How about changing the order between max77836 and max14577 as already added structure
> like platform_device_id if there are no specific reason as following:?
>
>
> static const struct of_device_id of_max14577_muic_dt_match[] = {
> { .compatible = "maxim,max14577-muic",
> .data = (void *)MAXIM_DEVICE_TYPE_MAX14577, },
> { .compatible = "maxim,max77836-muic",
> .data = (void *)MAXIM_DEVICE_TYPE_MAX77836, },
> { },

Sure. I will swap them and send updated patch. This order comes from
drivers/power/supply/max14577_charger.c, which also lacks
.of_match_table, so I will also fix it.

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland

2020-05-22 09:22:29

by Marek Szyprowski

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] extcon: max14577: Add proper dt-compatible strings

Hi

On 22.05.2020 10:30, Marek Szyprowski wrote:
> Hi Chanwoo,
>
> On 22.05.2020 09:08, Chanwoo Choi wrote:
>> On 5/22/20 3:48 PM, Marek Szyprowski wrote:
>>> Add device tree compatible strings and create proper modalias
>>> structures
>>> to let this driver load automatically if compiled as module, because
>>> max14577 MFD driver creates MFD cells with such compatible strings.
>>>
>>> Signed-off-by: Marek Szyprowski <[email protected]>
>>> ---
>>> v2:
>>> - added .of_match_table pointer
>>> ---
>>>   drivers/extcon/extcon-max14577.c | 10 ++++++++++
>>>   1 file changed, 10 insertions(+)
>>>
>>> diff --git a/drivers/extcon/extcon-max14577.c
>>> b/drivers/extcon/extcon-max14577.c
>>> index 32f663436e6e..03af678ddeba 100644
>>> --- a/drivers/extcon/extcon-max14577.c
>>> +++ b/drivers/extcon/extcon-max14577.c
>>> @@ -782,9 +782,19 @@ static const struct platform_device_id
>>> max14577_muic_id[] = {
>>>   };
>>>   MODULE_DEVICE_TABLE(platform, max14577_muic_id);
>>>   +static const struct of_device_id of_max14577_muic_dt_match[] = {
>>> +    { .compatible = "maxim,max77836-muic",
>>> +      .data = (void *)MAXIM_DEVICE_TYPE_MAX77836, },
>>> +    { .compatible = "maxim,max14577-muic",
>>> +      .data = (void *)MAXIM_DEVICE_TYPE_MAX14577, },
>>> +    { },
>> How about changing the order between max77836 and max14577 as already
>> added structure
>> like platform_device_id if there are no specific reason as following:?
>>
>>
>> static const struct of_device_id of_max14577_muic_dt_match[] = {
>>     { .compatible = "maxim,max14577-muic",
>>       .data = (void *)MAXIM_DEVICE_TYPE_MAX14577, },
>>     { .compatible = "maxim,max77836-muic",
>>       .data = (void *)MAXIM_DEVICE_TYPE_MAX77836, },
>>     { },
>
> Sure. I will swap them and send updated patch. This order comes from
> drivers/power/supply/max14577_charger.c, which also lacks
> .of_match_table, so I will also fix it.
It looks that I've checked a wrong tree. I will send v3 with
of_match_table sorted. I have no idea why the order is reversed.

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland