lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1556533656.2560.7.camel@pengutronix.de>
Date:   Mon, 29 Apr 2019 12:27:36 +0200
From:   Lucas Stach <l.stach@...gutronix.de>
To:     Andrey Smirnov <andrew.smirnov@...il.com>, linux-pm@...r.kernel.org
Cc:     Enric Balletbo Serra <enric.balletbo@...labora.com>,
        Chris Healy <cphealy@...il.com>,
        Fabio Estevam <fabio.estevam@....com>,
        Guenter Roeck <linux@...ck-us.net>,
        Sebastian Reichel <sre@...nel.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/3] power: supply: Add driver for Microchip UCS1002

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@...labora.com>
> > Signed-off-by: Andrey Smirnov <andrew.smirnov@...il.com>
> > Cc: Chris Healy <cphealy@...il.com>
> > Cc: Lucas Stach <l.stach@...gutronix.de>
> > Cc: Fabio Estevam <fabio.estevam@....com>
> > Cc: Guenter Roeck <linux@...ck-us.net>
> > Cc: Sebastian Reichel <sre@...nel.org>
> Cc: linux-kernel@...r.kernel.org
> Cc: linux-pm@...r.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ