* [PATCH v2 1/1] extcon: intel-mrfld: Sync hardware and software state on init
@ 2021-05-18 21:27 ` Ferry Toth
2021-05-20 1:40 ` Chanwoo Choi
0 siblings, 1 reply; 2+ messages in thread
From: Ferry Toth @ 2021-05-18 21:27 UTC (permalink / raw)
To: linux-kernel
Cc: MyungJoo Ham, Chanwoo Choi, Ferry Toth, Andy Shevchenko, stable
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.
Signed-off-by: Ferry Toth <ftoth@exalondelft.nl>
Fixes: 492929c54791 ("extcon: mrfld: Introduce extcon driver for Basin Cove PMIC")
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: stable@vger.kernel.org
---
v2:
- Clarified patch title (Chanwoo)
---
drivers/extcon/extcon-intel-mrfld.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/extcon/extcon-intel-mrfld.c b/drivers/extcon/extcon-intel-mrfld.c
index f47016fb28a8..cd1a5f230077 100644
--- a/drivers/extcon/extcon-intel-mrfld.c
+++ b/drivers/extcon/extcon-intel-mrfld.c
@@ -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.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 1/1] extcon: intel-mrfld: Sync hardware and software state on init
2021-05-18 21:27 ` [PATCH v2 1/1] extcon: intel-mrfld: Sync hardware and software state on init Ferry Toth
@ 2021-05-20 1:40 ` Chanwoo Choi
0 siblings, 0 replies; 2+ messages in thread
From: Chanwoo Choi @ 2021-05-20 1:40 UTC (permalink / raw)
To: Ferry Toth, linux-kernel; +Cc: MyungJoo Ham, Andy Shevchenko, stable
On 5/19/21 6:27 AM, Ferry Toth wrote:
> 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.
>
> Signed-off-by: Ferry Toth <ftoth@exalondelft.nl>
> Fixes: 492929c54791 ("extcon: mrfld: Introduce extcon driver for Basin Cove PMIC")
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Cc: stable@vger.kernel.org
> ---
>
> v2:
> - Clarified patch title (Chanwoo)
> ---
> drivers/extcon/extcon-intel-mrfld.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/extcon/extcon-intel-mrfld.c b/drivers/extcon/extcon-intel-mrfld.c
> index f47016fb28a8..cd1a5f230077 100644
> --- a/drivers/extcon/extcon-intel-mrfld.c
> +++ b/drivers/extcon/extcon-intel-mrfld.c
> @@ -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);
>
>
Applied it. Thanks.
--
Best Regards,
Chanwoo Choi
Samsung Electronics
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-20 1:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20210518212900epcas1p1ee28319630a51ab22ebf938c5bc222b3@epcas1p1.samsung.com>
2021-05-18 21:27 ` [PATCH v2 1/1] extcon: intel-mrfld: Sync hardware and software state on init Ferry Toth
2021-05-20 1:40 ` Chanwoo Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).