Skip to contentSkip to conversation

rtq2208: Remove the unnecessary MTP_SEL property

PATCH Superseded [email protected] 3 participants 5 messages Jun 25

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover rtq2208: Remove the unnecessary MTP_SEL property

From: ChiYuan Huang <[email protected]>

This patch series remove the 'richtek,mtp-sel-high' property usage.

ChiYuan Huang (2):
regulator: dt-bindings: rtq2208: Label mtp-sel-high property as
deprecated
regualtor: rtq2208: Initiate the default MTP_SEL state by hardware
register

 .../devicetree/bindings/regulator/richtek,rtq2208.yaml     | 3 +++
 drivers/regulator/rtq2208-regulator.c                      | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 regulator: dt-bindings: rtq2208: Label mtp-sel-high property as deprecated

From: ChiYuan Huang <[email protected]>

Since it can be identified by hardware register, label the unnecessary property 'richtek,mtp-sel-high' as deprecated.

---
 .../devicetree/bindings/regulator/richtek,rtq2208.yaml         | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/regulator/richtek,rtq2208.yaml +3 -0
index 022c1f197364..08648916e1fb 100644
@@ -42,11 +42,14 @@ properties:
 
   richtek,mtp-sel-high:
     type: boolean
+    deprecated: true
     description:
       vout register selection based on this boolean value.
       false - Using DVS0 register setting to adjust vout
       true - Using DVS1 register setting to adjust vout
 
+      The property is now deprecated. Will be identified by RG HW register.
+
   regulators:
     type: object
     additionalProperties: false
Signature · 1 line
2.43.0
#4 lore raw

PATCH 2/2 regualtor: rtq2208: Initiate the default MTP_SEL state by hardware register

In reply to [email protected]

From: ChiYuan Huang <[email protected]>

Read the initial MTP_SEL state by hardware register to prevent the wrong specified property value from the conflict of hardware pin assignment.

---
 drivers/regulator/rtq2208-regulator.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/regulator/rtq2208-regulator.c +6 -1
index f669a562f036..7fe082def494 100644
@@ -12,6 +12,7 @@
 #include <linux/mod_devicetable.h>
 
 /* Register */
+#define RTQ2208_REG_FSOUTB_CNTL			0x11
 #define RTQ2208_REG_GLOBAL_INT1			0x12
 #define RTQ2208_REG_FLT_RECORDBUCK_CB		0x18
 #define RTQ2208_REG_GLOBAL_INT1_MASK		0x1D
@@ -34,6 +35,7 @@
 #define RTQ2208_REG_HIDDEN1			0xFF
 
 /* Mask */
+#define RTQ2208_MTP_SEL_RO_MASK			BIT(7)
 #define RTQ2208_BUCK_NR_MTP_SEL_MASK		GENMASK(7, 0)
 #define RTQ2208_BUCK_EN_NR_MTP_SEL0_MASK	BIT(0)
 #define RTQ2208_BUCK_EN_NR_MTP_SEL1_MASK	BIT(1)
@@ -465,10 +467,13 @@ static int rtq2208_parse_regulator_dt_data(int n_regulator, const unsigned int *
 		struct rtq2208_regulator_desc *rdesc[RTQ2208_LDO_MAX], struct device *dev,
 		unsigned int ldo1_fixed, unsigned int ldo2_fixed)
 {
+	struct regmap *regmap = dev_get_regmap(dev, NULL);
 	int mtp_sel, i, idx;
 
 	/* get mtp_sel0 or mtp_sel1 */
-	mtp_sel = device_property_read_bool(dev, "richtek,mtp-sel-high");
+	mtp_sel = regmap_test_bits(regmap, RTQ2208_REG_FSOUTB_CNTL, RTQ2208_MTP_SEL_RO_MASK);
+	if (mtp_sel < 0)
+		return dev_err_probe(dev, mtp_sel, "Failed to init mtp_sel state\n");
 
 	for (i = 0; i < n_regulator; i++) {
 		idx = regulator_idx_table[i];
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH 1/2] regulator: dt-bindings: rtq2208: Label mtp-sel-high property as deprecated

In reply to [email protected]
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The deprecated property `richtek,mtp-sel-high` remains in the YAML example block. --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The deprecated property richtek,mtp-sel-high remains in the YAML example block. --

commit 34889eeeff15702a135fa4ac9e6b9f3ab88ee425
Author: ChiYuan Huang <[email protected]>

regulator: dt-bindings: rtq2208: Label mtp-sel-high property as deprecated

Since it can be identified by hardware register, label the unnecessary property 'richtek,mtp-sel-high' as deprecated.

Quoted 6 lines
Documentation/devicetree/bindings/regulator/richtek,rtq2208.yaml +0 -0
@@ -42,11 +42,14 @@ properties:
 
   richtek,mtp-sel-high:

Documentation/devicetree/bindings/regulator/richtek,rtq2208.yaml properties: · line 53

Quoted 10 lines
Documentation/devicetree/bindings/regulator/richtek,rtq2208.yaml +3 -0
     type: boolean
+    deprecated: true
     description:
       vout register selection based on this boolean value.
       false - Using DVS0 register setting to adjust vout
       true - Using DVS1 register setting to adjust vout
 
+      The property is now deprecated. Will be identified by RG HW register.
+
   regulators:

[Severity: Low]
Since this property is now marked as deprecated, should it also be removed from the example device tree in this binding?

Documentation/devicetree/bindings/regulator/richtek,rtq2208.yaml:examples:

    ...
      pmic@10 {
        compatible = "richtek,rtq2208";
        reg = <0x10>;
        interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>;
        richtek,mtp-sel-high;

        regulators {
    ...

Leaving the deprecated property in the example encourages its continued use by developers who might copy and paste binding examples into their device trees.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1