mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>, linux-pm@vger.kernel.org
Cc: Enric Balletbo Serra <enric.balletbo@collabora.com>,
	Chris Healy <cphealy@gmail.com>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Sebastian Reichel <sre@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] power: supply: Add driver for Microchip UCS1002
Date: Mon, 29 Apr 2019 12:27:36 +0200	[thread overview]
Message-ID: <1556533656.2560.7.camel@pengutronix.de> (raw)
In-Reply-To: <20190429054741.7286-3-andrew.smirnov@gmail.com>

Hi Andrey,

Am Sonntag, den 28.04.2019, 22:47 -0700 schrieb Andrey Smirnov:
> Add driver for Microchip UCS1002 Programmable USB Port Power
> Controller with Charger Emulation. The driver exposed a power supply
> device to control/monitor various parameter of the device as well as a
> regulator to allow controlling VBUS line.
> 
> > Signed-off-by: Enric Balletbo Serra <enric.balletbo@collabora.com>
> > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> > Cc: Chris Healy <cphealy@gmail.com>
> > Cc: Lucas Stach <l.stach@pengutronix.de>
> > Cc: Fabio Estevam <fabio.estevam@nxp.com>
> > Cc: Guenter Roeck <linux@roeck-us.net>
> > Cc: Sebastian Reichel <sre@kernel.org>
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-pm@vger.kernel.org
> ---
[...]
> +	/* Enable charge rationing by default */
> > +	ret = regmap_update_bits(info->regmap, UCS1002_REG_GENERAL_CFG,
> > +				 F_RATION_EN, F_RATION_EN);
> > +	if (ret) {
> > +		dev_err(dev, "Failed to read general config: %d\n", ret);
> > +		return ret;
> > +	}
> +
> > +	/*
> > +	 * Ignore the M1, M2, PWR_EN, and EM_EN pin states. Set active
> > +	 * mode selection to BC1.2 CDP.
> > +	 */
> > +	ret = regmap_update_bits(info->regmap, UCS1002_REG_SWITCH_CFG,
> > +				 V_SET_ACTIVE_MODE_MASK,
> +				 V_SET_ACTIVE_MODE_BC12_CDP);

This doesn't work as the F_PIN_IGNORE bit isn't set, so the the
external strap settings are applied. I had to apply the following diff
to make the driver behave as expected again:

--- a/drivers/power/supply/ucs1002_power.c
+++ b/drivers/power/supply/ucs1002_power.c
@@ -548,8 +548,8 @@ static int ucs1002_probe(struct i2c_client *client,
         * mode selection to BC1.2 CDP.
         */
        ret = regmap_update_bits(info->regmap, UCS1002_REG_SWITCH_CFG,
-                                V_SET_ACTIVE_MODE_MASK,
-                                V_SET_ACTIVE_MODE_BC12_CDP);
+                                V_SET_ACTIVE_MODE_MASK | F_PIN_IGNORE,
+                                V_SET_ACTIVE_MODE_BC12_CDP | F_PIN_IGNORE);

Regards,
Lucas

  reply	other threads:[~2019-04-29 10:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29  5:47 [PATCH v2 0/3] Driver for UCS1002 Andrey Smirnov
2019-04-29  5:47 ` [PATCH v2 1/3] power: supply: core: Add POWER_SUPPLY_HEALTH_OVERCURRENT constant Andrey Smirnov
2019-04-29  5:47 ` [PATCH v2 2/3] power: supply: Add driver for Microchip UCS1002 Andrey Smirnov
2019-04-29 10:27   ` Lucas Stach [this message]
2019-04-29 19:10     ` Andrey Smirnov
2019-04-29  5:47 ` [PATCH v2 3/3] dt-bindings: power: supply: Add bindings " Andrey Smirnov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1556533656.2560.7.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=andrew.smirnov@gmail.com \
    --cc=cphealy@gmail.com \
    --cc=enric.balletbo@collabora.com \
    --cc=fabio.estevam@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®