[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d8c5be11-5c5d-459e-8563-d9ca41c31295@kernel.org>
Date: Fri, 16 Aug 2024 12:00:58 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Artur Weber <aweber.kernel@...il.com>,
Chanwoo Choi <cw00.choi@...sung.com>
Cc: Sebastian Reichel <sre@...nel.org>, Rob Herring <robh@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Lee Jones <lee@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Alim Akhtar <alim.akhtar@...sung.com>, linux-pm@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-samsung-soc@...r.kernel.org,
~postmarketos/upstreaming@...ts.sr.ht, Henrik Grimler <henrik@...mler.se>,
Wolfgang Wiedmeyer <wolfgit@...dmeyer.de>,
Denis 'GNUtoo' Carikli <GNUtoo@...erdimension.org>
Subject: Re: [PATCH v4 06/10] power: supply: max77693: Add support for
detecting and enabling OTG
On 16/08/2024 10:19, Artur Weber wrote:
> Building upon the newly added extcon detection support, add detection
> for USB OTG cables (EXTCON_USB_HOST type), and enable/disable the OTG
> bits as needed.
>
> Acked-by: Lee Jones <lee@...nel.org>
> Tested-by: Henrik Grimler <henrik@...mler.se>
> Signed-off-by: Artur Weber <aweber.kernel@...il.com>
> ---
> Changes in v3:
> - Dropped CHARGER regulator in favor of enabling charging directly
>
> Changes in v2:
> - Added CHGIN OTG current limit value
> - Squashed MFD header register changes into this commit
> ---
> drivers/power/supply/max77693_charger.c | 53 ++++++++++++++++++++++++++-------
> include/linux/mfd/max77693-private.h | 5 ++++
> 2 files changed, 48 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/power/supply/max77693_charger.c b/drivers/power/supply/max77693_charger.c
> index d67857d2aa0b..bf156544fe1b 100644
> --- a/drivers/power/supply/max77693_charger.c
> +++ b/drivers/power/supply/max77693_charger.c
> @@ -692,11 +692,30 @@ static int max77693_set_charging(struct max77693_charger *chg, bool enable)
> data);
> }
>
> +static int max77693_set_otg(struct max77693_charger *chg, bool enable)
> +{
> + unsigned int data;
> +
> + if (enable)
> + data = CHG_CNFG_00_OTG_MASK | CHG_CNFG_00_BOOST_MASK |
> + CHG_CNFG_00_DIS_MUIC_CTRL_MASK;
> + else
> + data = ~(CHG_CNFG_00_OTG_MASK | CHG_CNFG_00_BOOST_MASK |
> + CHG_CNFG_00_DIS_MUIC_CTRL_MASK);
> +
> + return regmap_update_bits(chg->max77693->regmap,
> + MAX77693_CHG_REG_CHG_CNFG_00,
> + CHG_CNFG_00_OTG_MASK | CHG_CNFG_00_BOOST_MASK |
> + CHG_CNFG_00_DIS_MUIC_CTRL_MASK,
> + data);
> +}
> +
> static void max77693_charger_extcon_work(struct work_struct *work)
> {
> struct max77693_charger *chg = container_of(work, struct max77693_charger,
> cable.work);
> struct extcon_dev *edev = chg->cable.edev;
> + bool set_charging, set_otg;
> int connector, state;
> int ret;
>
> @@ -715,25 +734,39 @@ static void max77693_charger_extcon_work(struct work_struct *work)
> case EXTCON_CHG_USB_FAST:
> case EXTCON_CHG_USB_SLOW:
> case EXTCON_CHG_USB_PD:
> - ret = max77693_set_charging(chg, true);
> - if (ret) {
> - dev_err(chg->dev, "failed to enable charging\n");
> - break;
> - }
> + set_charging = true;
> + set_otg = false;
> +
> dev_info(chg->dev, "charging. connector type: %d\n",
> connector);
Same comments as for other patch - dev_dbg.
Best regards,
Krzysztof
Powered by blists - more mailing lists