Re: [PATCH v2 2/3] power: supply: Add driver for Microchip UCS1002

From: Andrey Smirnov
Date: Mon Apr 29 2019 - 15:10:41 EST


On Mon, Apr 29, 2019 at 3:27 AM Lucas Stach <l.stach@xxxxxxxxxxxxxx> wrote:
>
> 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@xxxxxxxxxxxxx>
> > > Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
> > > Cc: Chris Healy <cphealy@xxxxxxxxx>
> > > Cc: Lucas Stach <l.stach@xxxxxxxxxxxxxx>
> > > Cc: Fabio Estevam <fabio.estevam@xxxxxxx>
> > > Cc: Guenter Roeck <linux@xxxxxxxxxxxx>
> > > Cc: Sebastian Reichel <sre@xxxxxxxxxx>
> > Cc: linux-kernel@xxxxxxxxxxxxxxx
> > Cc: linux-pm@xxxxxxxxxxxxxxx
> > ---
> [...]
> > + /* 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:
>

Ugh, I missed this since pins on my board are set properly. Thanks for
catching that and sorry about the bug. Will fix in v3.

Thanks,
Andrey Smirnov