Skip to contentSkip to conversation

extcon-intel-mrfld: initialize mrfld_extcon status

PATCH In review Ferry Toth 4 participants 4 messages Apr 24, 2021 – May 18, 2021

Subsystems (2)
lore
Share & tools
lore

Ferry Toth

author
#0 lore raw

PATCH 1/1 extcon-intel-mrfld: initialize mrfld_extcon status

extcon driver for Basin Cove PMIC shadows the switch status used for dwc3 DRD to detect a change in the switch position. This change initializes the status at probe time.

Fixes 492929c54791 ("extcon: mrfld: Introduce extcon driver for Basin Cove PMIC")
---
 drivers/extcon/extcon-intel-mrfld.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/extcon/extcon-intel-mrfld.c +9 -0
index f47016fb28a8..cd1a5f230077 100644
@@ -197,6 +197,7 @@ static int mrfld_extcon_probe(struct platform_device *pdev)
 	struct intel_soc_pmic *pmic = dev_get_drvdata(dev->parent);
 	struct regmap *regmap = pmic->regmap;
 	struct mrfld_extcon_data *data;
+	unsigned int status;
 	unsigned int id;
 	int irq, ret;
 
@@ -244,6 +245,14 @@ static int mrfld_extcon_probe(struct platform_device *pdev)
 	/* Get initial state */
 	mrfld_extcon_role_detect(data);
 
+	/*
+	 * Cached status value is used for cable detection, see comments
+	 * in mrfld_extcon_cable_detect(), we need to sync cached value
+	 * with a real state of the hardware.
+	 */
+	regmap_read(regmap, BCOVE_SCHGRIRQ1, &status);
+	data->status = status;
+
 	mrfld_extcon_clear(data, BCOVE_MIRQLVL1, BCOVE_LVL1_CHGR);
 	mrfld_extcon_clear(data, BCOVE_MCHGRIRQ1, BCOVE_CHGRIRQ_ALL);
 
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Ferry Toth

extcon driver for Basin Cove PMIC shadows the switch status used for dwc3 DRD to detect a change in the switch position. This change initializes the status at probe time.

Thanks for catching and fixing this issue!

Quoted 36 lines
Fixes 492929c54791 ("extcon: mrfld: Introduce extcon driver for Basin Cove PMIC")
---
 drivers/extcon/extcon-intel-mrfld.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/extcon/extcon-intel-mrfld.c +9 -1
index f47016fb28a8..cd1a5f230077 100644
@@ -197,6 +197,7 @@ static int mrfld_extcon_probe(struct platform_device *pdev)
        struct intel_soc_pmic *pmic = dev_get_drvdata(dev->parent);
        struct regmap *regmap = pmic->regmap;
        struct mrfld_extcon_data *data;
+       unsigned int status;
        unsigned int id;
        int irq, ret;
 
@@ -244,6 +245,14 @@ static int mrfld_extcon_probe(struct platform_device *pdev)
        /* Get initial state */
        mrfld_extcon_role_detect(data);
 
+       /*
+        * Cached status value is used for cable detection, see comments
+        * in mrfld_extcon_cable_detect(), we need to sync cached value
+        * with a real state of the hardware.
+        */
+       regmap_read(regmap, BCOVE_SCHGRIRQ1, &status);
+       data->status = status;
+
        mrfld_extcon_clear(data, BCOVE_MIRQLVL1, BCOVE_LVL1_CHGR);
        mrfld_extcon_clear(data, BCOVE_MCHGRIRQ1, BCOVE_CHGRIRQ_ALL);
 
--

2.27.0

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
In reply to Ferry Toth
Quoted 3 lines · Ferry Toth

extcon driver for Basin Cove PMIC shadows the switch status used for dwc3 DRD to detect a change in the switch position. This change initializes the status at probe time.

Chanwoo, can we get this fix in?

Quoted 36 lines
Fixes 492929c54791 ("extcon: mrfld: Introduce extcon driver for Basin Cove PMIC")
---
 drivers/extcon/extcon-intel-mrfld.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/extcon/extcon-intel-mrfld.c +9 -0
index f47016fb28a8..cd1a5f230077 100644
@@ -197,6 +197,7 @@ static int mrfld_extcon_probe(struct platform_device *pdev)
 	struct intel_soc_pmic *pmic = dev_get_drvdata(dev->parent);
 	struct regmap *regmap = pmic->regmap;
 	struct mrfld_extcon_data *data;
+	unsigned int status;
 	unsigned int id;
 	int irq, ret;
 
@@ -244,6 +245,14 @@ static int mrfld_extcon_probe(struct platform_device *pdev)
 	/* Get initial state */
 	mrfld_extcon_role_detect(data);
 
+	/*
+	 * Cached status value is used for cable detection, see comments
+	 * in mrfld_extcon_cable_detect(), we need to sync cached value
+	 * with a real state of the hardware.
+	 */
+	regmap_read(regmap, BCOVE_SCHGRIRQ1, &status);
+	data->status = status;
+
 	mrfld_extcon_clear(data, BCOVE_MIRQLVL1, BCOVE_LVL1_CHGR);
 	mrfld_extcon_clear(data, BCOVE_MCHGRIRQ1, BCOVE_CHGRIRQ_ALL);
 
Signature · 1 line
2.27.0
Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#3 lore raw
In reply to Ferry Toth
Quoted 28 lines · Ferry Toth

extcon driver for Basin Cove PMIC shadows the switch status used for dwc3 DRD to detect a change in the switch position. This change initializes the status at probe time.

Fixes 492929c54791 ("extcon: mrfld: Introduce extcon driver for Basin Cove PMIC")
---
 drivers/extcon/extcon-intel-mrfld.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/extcon/extcon-intel-mrfld.c +2 -0
index f47016fb28a8..cd1a5f230077 100644
@@ -197,6 +197,7 @@ static int mrfld_extcon_probe(struct platform_device *pdev)
 	struct intel_soc_pmic *pmic = dev_get_drvdata(dev->parent);
 	struct regmap *regmap = pmic->regmap;
 	struct mrfld_extcon_data *data;
+	unsigned int status;
 	unsigned int id;
 	int irq, ret;
 
@@ -244,6 +245,14 @@ static int mrfld_extcon_probe(struct platform_device *pdev)
 	/* Get initial state */
 	mrfld_extcon_role_detect(data);
 
+	/*

drivers/extcon/extcon-intel-mrfld.c static int mrfld_extcon_probe(struct platform_device *pdev) · line 258

Quoted 10 lines
drivers/extcon/extcon-intel-mrfld.c +7 -0
+	 * Cached status value is used for cable detection, see comments
+	 * in mrfld_extcon_cable_detect(), we need to sync cached value
+	 * with a real state of the hardware.
+	 */
+	regmap_read(regmap, BCOVE_SCHGRIRQ1, &status);
+	data->status = status;
+
 	mrfld_extcon_clear(data, BCOVE_MIRQLVL1, BCOVE_LVL1_CHGR);
 	mrfld_extcon_clear(data, BCOVE_MCHGRIRQ1, BCOVE_CHGRIRQ_ALL);
 

Looks good. But need to change the patch title as following:
I can change the patch title before merge. But, this fixes patch should be applied to both extcon tree and stable tree. So that the author better to change the patch title to keep the consistent patch title naming as following:

If possible, need to specify what to fix on title for the readability. IMO, this patch title doesn't seems the fix patch.

- before : extcon-intel-mrfld: initialize mrfld_extcon status
- after : extcon: intel-mrfld: Initialize mrfld_extcon status

Signature · 3 lines
Best Regards,
Chanwoo Choi
Samsung Electronics