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] [day] [month] [year] [list]
Message-ID: <20200115205055.f5dgjeenj3r2l2f4@earth.universe>
Date:   Wed, 15 Jan 2020 21:50:55 +0100
From:   Sebastian Reichel <sre@...nel.org>
To:     Yauhen Kharuzhy <jekhor@...il.com>
Cc:     linux-pm@...r.kernel.org, Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] power: supply: bq25890_charger: Add support of
 BQ25892 and BQ25896 chips

Hi,

Thanks, queued to power-supply's for-next branch.

On Thu, Jan 02, 2020 at 04:53:35PM +0300, Yauhen Kharuzhy wrote:
> On Thu, Jan 02, 2020 at 01:46:25AM +0300, Yauhen Kharuzhy wrote:
> > Support BQ25892 and BQ25896 chips by this driver. They shared one chip
> > ID 0, so distinquish them by device revisions (2 for 25896 and 1 for
> > 25892).
> > 
> > Signed-off-by: Yauhen Kharuzhy <jekhor@...il.com>
> > ---
> >  drivers/power/supply/bq25890_charger.c | 97 ++++++++++++++++++++------
> >  1 file changed, 76 insertions(+), 21 deletions(-)
> > 
> > diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
> > index 9d1ec8d677de..a3dcd4eb1287 100644
> > --- a/drivers/power/supply/bq25890_charger.c
> > +++ b/drivers/power/supply/bq25890_charger.c
> > @@ -25,12 +25,20 @@
> >  #define BQ25895_ID			7
> >  #define BQ25896_ID			0
> >  
> > +enum bq25890_chip_version {
> > +	BQ25890,
> > +	BQ25892,
> > +	BQ25895,
> > +	BQ25896,
> > +};
> > +
> ...
> > +static int bq25890_get_chip_version(struct bq25890_device *bq)
> > +{
> > +	int id, rev;
> > +
> > +	id = bq25890_field_read(bq, F_PN);
> > +	if (id < 0) {
> > +		dev_err(bq->dev, "Cannot read chip ID.\n");
> > +		return id;
> > +	}
> > +
> > +	rev = bq25890_field_read(bq, F_DEV_REV);
> > +	if (rev < 0) {
> > +		dev_err(bq->dev, "Cannot read chip revision.\n");
> > +		return id;
> > +	}
> > +
> > +	switch (id) {
> > +	case BQ25890_ID:
> > +		bq->chip_version = BQ25890;
> > +		break;
> > +
> > +	/* BQ25892 and BQ25896 share same ID 0 */
> > +	case BQ25896_ID:
> > +		switch (rev) {
> > +		case 0:
> Sorry, typo here: should be 2 for 25896, I will fix this in v2.

I fixed this while applying.

-- Sebastian

> > +			bq->chip_version = BQ25896;
> > +			break;
> > +		case 1:
> > +			bq->chip_version = BQ25892;
> > +			break;
> > +		default:
> > +			dev_err(bq->dev,
> > +				"Unknown device revision %d, assume BQ25892\n",
> > +				rev);
> > +			bq->chip_version = BQ25892;
> > +		}
> > +		break;
> > +
> > +	case BQ25895_ID:
> > +		bq->chip_version = BQ25895;
> > +		break;
> > +
> > +	default:
> > +		dev_err(bq->dev, "Unknown chip ID %d\n", id);
> > +		return -ENODEV;
> > +	}
> > +
> > +	return 0;
> > +}
> ...
> 
> -- 
> Yauhen Kharuzhy

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ