max77663-rtc: pass rtc address from device tree node if exists
PATCH 1/1 max77663-rtc: pass rtc address from device tree node if exists
MAX77663 PMIC can have RTC on both 0x63 i2c address (like grouper) which is main address but on some devices RTC is located on 0x48 i2c address (like p880 and p895 from LG). Lets add property to be able to use alternative address if needed without breaking existing bindings.
--- drivers/rtc/rtc-max77686.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/rtc/rtc-max77686.c +7 -1
@@ -691,6 +691,7 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) {struct device *parent = info->dev->parent;struct i2c_client *parent_i2c =to_i2c_client (parent); +int rtc_i2c_addr;int ret;if (info->drv_data->rtc_irq_from_platform) {
@@ -714,8 +715,13 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) goto add_rtc_irq; } + ret =device_property_read_u32 (parent,"maxim,rtc-i2c-address" , + &rtc_i2c_addr); +if (ret) + rtc_i2c_addr = info->drv_data->rtc_i2c_addr; + info->rtc =devm_i2c_new_dummy_device (info->dev, parent_i2c->adapter, - info->drv_data->rtc_i2c_addr); + rtc_i2c_addr);if (IS_ERR (info->rtc)) {dev_err (info->dev,"Failed to allocate I2C device for RTC\n" );return PTR_ERR (info->rtc);
Signature · 1 line
2.37.2
Alexandre Belloni
maintainerHello,
the subject is not correct, please use the subsystem style
Quoted 24 lines · Svyatoslav Ryhel
MAX77663 PMIC can have RTC on both
0x63i2c address (like grouper) which is main address but on some devices RTC is located on0x48i2c address (like p880 and p895 from LG). Lets add property to be able to use alternative address if needed without breaking existing bindings.Signed-off-by Svyatoslav Ryhel <[email protected]>--- drivers/rtc/rtc-max77686.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/rtc/rtc-max77686.c +1
-0@@ -691,6 +691,7 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) {struct device *parent = info->dev->parent;struct i2c_client *parent_i2c =to_i2c_client (parent); +int rtc_i2c_addr;int ret;if (info->drv_data->rtc_irq_from_platform) {
drivers/rtc/rtc-max77686.c static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) · line 719
Quoted 5 lines
drivers/rtc/rtc-max77686.c +2
-0@@ -714,8 +715,13 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) goto add_rtc_irq; } + ret =device_property_read_u32 (parent,"maxim,rtc-i2c-address" , + &rtc_i2c_addr);
This property needs to be documented
Quoted 12 lines
drivers/rtc/rtc-max77686.c +4
-1+if (ret) + rtc_i2c_addr = info->drv_data->rtc_i2c_addr; + info->rtc =devm_i2c_new_dummy_device (info->dev, parent_i2c->adapter, - info->drv_data->rtc_i2c_addr); + rtc_i2c_addr);if (IS_ERR (info->rtc)) {dev_err (info->dev,"Failed to allocate I2C device for RTC\n" );return PTR_ERR (info->rtc);Signature · 1 line
2.37.2
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
ср, 8 бер. 2023 р. о 10:44 Alexandre Belloni
<[email protected]> пише:
Quoted 33 lines
Hello,
the subject is not correct, please use the subsystem style
Quoted 27 lines · Svyatoslav Ryhel
MAX77663 PMIC can have RTC on both
0x63i2c address (like grouper) which is main address but on some devices RTC is located on0x48i2c address (like p880 and p895 from LG). Lets add property to be able to use alternative address if needed without breaking existing bindings.Signed-off-by Svyatoslav Ryhel <[email protected]>--- drivers/rtc/rtc-max77686.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/rtc/rtc-max77686.c +1
-0@@ -691,6 +691,7 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) {struct device *parent = info->dev->parent;struct i2c_client *parent_i2c =to_i2c_client (parent); +int rtc_i2c_addr;int ret;if (info->drv_data->rtc_irq_from_platform) {@@ -714,8 +715,13 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) goto add_rtc_irq; }
Quoted 5 lines
drivers/rtc/rtc-max77686.c static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) · line 719
Quoted 2 lines
drivers/rtc/rtc-max77686.c +2
-0+ ret =device_property_read_u32 (parent,"maxim,rtc-i2c-address" , + &rtc_i2c_addr);This property needs to be documented
max776xx pmic has no yaml to document
Quoted 17 lines
Quoted 10 lines
drivers/rtc/rtc-max77686.c +4
-2+if (ret) + rtc_i2c_addr = info->drv_data->rtc_i2c_addr; + info->rtc =devm_i2c_new_dummy_device (info->dev, parent_i2c->adapter, - info->drv_data->rtc_i2c_addr); + rtc_i2c_addr);if (IS_ERR (info->rtc)) {dev_err (info->dev,"Failed to allocate I2C device for RTC\n" );return PTR_ERR (info->rtc); --Quoted 2 lines
2.37.2
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Quoted 35 lines · Svyatoslav Ryhel
ср, 8 бер. 2023 р. о 10:44 Alexandre Belloni
<[email protected]> пише:Quoted 33 lines
Hello,
the subject is not correct, please use the subsystem style
Quoted 27 lines · Svyatoslav Ryhel
MAX77663 PMIC can have RTC on both
0x63i2c address (like grouper) which is main address but on some devices RTC is located on0x48i2c address (like p880 and p895 from LG). Lets add property to be able to use alternative address if needed without breaking existing bindings.Signed-off-by Svyatoslav Ryhel <[email protected]>--- drivers/rtc/rtc-max77686.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/rtc/rtc-max77686.c +1
-0@@ -691,6 +691,7 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) {struct device *parent = info->dev->parent;struct i2c_client *parent_i2c =to_i2c_client (parent); +int rtc_i2c_addr;int ret;if (info->drv_data->rtc_irq_from_platform) {@@ -714,8 +715,13 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) goto add_rtc_irq; }
Quoted 7 lines
Quoted 5 lines
drivers/rtc/rtc-max77686.c static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) · line 719
Quoted 2 lines
drivers/rtc/rtc-max77686.c +2
-0+ ret =device_property_read_u32 (parent,"maxim,rtc-i2c-address" , + &rtc_i2c_addr);This property needs to be documented
max776xx pmic has no yaml to document
Of course it has, otherwise on what did I work?
git grep max77686
Best regards,
Krzysztof
Ooof, my bad. I will resend v2 with fix asap.
ср, 8 бер. 2023 р. о 10:49 Krzysztof Kozlowski
<[email protected]> пише:
Quoted 53 lines · Svyatoslav Ryhel
Quoted 35 lines
ср, 8 бер. 2023 р. о 10:44 Alexandre Belloni
<[email protected]> пише:Quoted 33 lines
Hello,
the subject is not correct, please use the subsystem style
Quoted 27 lines · Svyatoslav Ryhel
MAX77663 PMIC can have RTC on both
0x63i2c address (like grouper) which is main address but on some devices RTC is located on0x48i2c address (like p880 and p895 from LG). Lets add property to be able to use alternative address if needed without breaking existing bindings.Signed-off-by Svyatoslav Ryhel <[email protected]>--- drivers/rtc/rtc-max77686.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/rtc/rtc-max77686.c +1
-0@@ -691,6 +691,7 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) {struct device *parent = info->dev->parent;struct i2c_client *parent_i2c =to_i2c_client (parent); +int rtc_i2c_addr;int ret;if (info->drv_data->rtc_irq_from_platform) {@@ -714,8 +715,13 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) goto add_rtc_irq; }Quoted 7 lines
Quoted 5 lines
drivers/rtc/rtc-max77686.c static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) · line 719
Quoted 2 lines
drivers/rtc/rtc-max77686.c +2
-0+ ret =device_property_read_u32 (parent,"maxim,rtc-i2c-address" , + &rtc_i2c_addr);This property needs to be documented
max776xx pmic has no yaml to document
Of course it has, otherwise on what did I work?
git grep max77686
Best regards,
Krzysztof
Quoted 1 line · Svyatoslav Ryhel
Ooof, my bad. I will resend v2 with fix asap.
This was for max77686. Other PMICs have their own. None of them is max77663, but that's another topic.
Best regards,
Krzysztof
Quoted 5 lines · Svyatoslav Ryhel
MAX77663 PMIC can have RTC on both
0x63i2c address (like grouper) which is main address but on some devices RTC is located on0x48i2c address (like p880 and p895 from LG). Lets add property to be able to use alternative address if needed without breaking existing bindings.
Use subject prefixes matching the subsystem (which you can get for example with git log --oneline -- DIRECTORY_OR_FILE on the directory your patch is touching).
Anyway this is not max77663 driver.
The property does not make sense in the context of max77686. Maybe for max77802/77620 and 77714 would have... but still max77663 is not there. Don't add properties for unrelated and unsupported devices.
Best regards,
Krzysztof
I would love to, but max77663 uses max77686 rtc
https://github.com/torvalds/linux/blob/master/drivers/mfd/max77620.c#L123
how to handle this?
ср, 8 бер. 2023 р. о 10:54 Krzysztof Kozlowski
<[email protected]> пише:
Quoted 21 lines · Svyatoslav Ryhel
Quoted 5 lines
MAX77663 PMIC can have RTC on both
0x63i2c address (like grouper) which is main address but on some devices RTC is located on0x48i2c address (like p880 and p895 from LG). Lets add property to be able to use alternative address if needed without breaking existing bindings.Use subject prefixes matching the subsystem (which you can get for example with
git log --oneline -- DIRECTORY_OR_FILEon the directory your patch is touching).Anyway this is not max77663 driver.
The property does not make sense in the context of max77686. Maybe for max77802/77620 and 77714 would have... but still max77663 is not there. Don't add properties for unrelated and unsupported devices.
Best regards,
Krzysztof
Quoted 3 lines · Svyatoslav Ryhel
I would love to, but max77663 uses max77686 rtc
https://github.com/torvalds/linux/blob/master/drivers/mfd/max77620.c#L123
how to handle this?
Don't top post.
Hm, so it seems max7763 is already documented via max77620. I missed that. Add the new property to max77620, not to max77686 RTC. It does not look like RTC's property, but the PMIC's.
Best regards,
Krzysztof
Quoted 10 lines · Krzysztof Kozlowski
Quoted 3 lines · Svyatoslav Ryhel
I would love to, but max77663 uses max77686 rtc
https://github.com/torvalds/linux/blob/master/drivers/mfd/max77620.c#L123
how to handle this?Don't top post.
Hm, so it seems max7763 is already documented via max77620. I missed that. Add the new property to max77620, not to max77686 RTC. It does not look like RTC's property, but the PMIC's.
To clarify - the I2C address selection for regmap is in max77686 RTC, but I meant DT property.
Different thing is that we do not pass addresses as property fields. These should be devices on the I2C bus rather... unless you are aware of existing property like this?
Best regards,
Krzysztof
Alexandre Belloni
maintainerQuoted 12 lines · Krzysztof Kozlowski
Quoted 10 lines · Krzysztof Kozlowski
Quoted 3 lines · Svyatoslav Ryhel
I would love to, but max77663 uses max77686 rtc
https://github.com/torvalds/linux/blob/master/drivers/mfd/max77620.c#L123
how to handle this?Don't top post.
Hm, so it seems max7763 is already documented via max77620. I missed that. Add the new property to max77620, not to max77686 RTC. It does not look like RTC's property, but the PMIC's.
Quoted 7 lines
To clarify - the I2C address selection for regmap is in max77686 RTC, but I meant DT property.
Different thing is that we do not pass addresses as property fields. These should be devices on the I2C bus rather... unless you are aware of existing property like this?
I'd say that the RTC should have been modeled as a discrete component from the beginning instead of using an i2c dummy device
Quoted 3 lines
Best regards,
Krzysztof
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 16 lines · Alexandre Belloni
Quoted 15 lines · Krzysztof Kozlowski
Quoted 10 lines · Krzysztof Kozlowski
Quoted 3 lines · Svyatoslav Ryhel
I would love to, but max77663 uses max77686 rtc
https://github.com/torvalds/linux/blob/master/drivers/mfd/max77620.c#L123
how to handle this?Don't top post.
Hm, so it seems max7763 is already documented via max77620. I missed that. Add the new property to max77620, not to max77686 RTC. It does not look like RTC's property, but the PMIC's.
To clarify - the I2C address selection for regmap is in max77686 RTC, but I meant DT property.
Quoted 7 lines
Quoted 4 lines
Different thing is that we do not pass addresses as property fields. These should be devices on the I2C bus rather... unless you are aware of existing property like this?
I'd say that the RTC should have been modeled as a discrete component from the beginning instead of using an i2c dummy device
Yeah, exactly. Current design was working for existing use cases/devices, but has limits, thus RTC should be reworked. Actually even for oldest PMIC max77686, the RTC was a separate device on I2C bus. We just made it for simplicity part of PMIC.
Best regards,
Krzysztof
ср, 8 бер. 2023 р. о 11:11 Krzysztof Kozlowski
<[email protected]> пише:
Quoted 11 lines · Svyatoslav Ryhel
Quoted 3 lines
I would love to, but max77663 uses max77686 rtc
https://github.com/torvalds/linux/blob/master/drivers/mfd/max77620.c#L123
how to handle this?Don't top post.
Hm, so it seems max7763 is already documented via max77620. I missed that. Add the new property to max77620, not to max77686 RTC. It does not look like RTC's property, but the PMIC's.
There is no max77620 yaml, only txt. Add property to txt?
Quoted 3 lines
Best regards,
Krzysztof
Quoted 8 lines · Svyatoslav Ryhel
ср, 8 бер. 2023 р. о 11:11 Krzysztof Kozlowski
<[email protected]> пише:Quoted 6 lines · Svyatoslav Ryhel
Quoted 3 lines
I would love to, but max77663 uses max77686 rtc
https://github.com/torvalds/linux/blob/master/drivers/mfd/max77620.c#L123
how to handle this?
Quoted 7 lines
Quoted 5 lines
Don't top post.
Hm, so it seems max7763 is already documented via max77620. I missed that. Add the new property to max77620, not to max77686 RTC. It does not look like RTC's property, but the PMIC's.
There is no max77620 yaml, only txt. Add property to txt?
If property was to accept, then unfortunately no, you need to convert first.
Best regards,
Krzysztof