Linux Power Management development
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: Mike Looijmans <mike.looijmans@topic.nl>
Cc: linux-pm@vger.kernel.org,
	Javier Martinez Canillas <javier@osg.samsung.com>
Subject: Re: [PATCH 1/2] power: supply: ltc2941-battery-gauge: Define LTC2942 registers
Date: Mon, 12 Jun 2017 19:59:25 +0200	[thread overview]
Message-ID: <20170612175925.fblyzaewuuoivt55@lenoch> (raw)
In-Reply-To: <8d97cccb-fef7-428d-b075-b0e59a590d80@topic.nl>

On Mon, Jun 12, 2017 at 06:26:17PM +0200, Mike Looijmans wrote:
> On 12-6-2017 17:03, Ladislav Michl wrote:
> > Add LTC2942 registers definitions. No functional changes.
> > 
> > Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> > ---
> >  drivers/power/supply/ltc2941-battery-gauge.c | 27 +++++++++++++--------------
> >  1 file changed, 13 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/power/supply/ltc2941-battery-gauge.c b/drivers/power/supply/ltc2941-battery-gauge.c
> > index 7efb908f4451..0a1b69bbca7f 100644
> > --- a/drivers/power/supply/ltc2941-battery-gauge.c
> > +++ b/drivers/power/supply/ltc2941-battery-gauge.c
> > @@ -34,16 +34,14 @@ enum ltc294x_reg {
> >  	LTC294X_REG_CONTROL		= 0x01,
> >  	LTC294X_REG_ACC_CHARGE_MSB	= 0x02,
> >  	LTC294X_REG_ACC_CHARGE_LSB	= 0x03,
> > -	LTC294X_REG_THRESH_HIGH_MSB	= 0x04,
> > -	LTC294X_REG_THRESH_HIGH_LSB	= 0x05,
> > -	LTC294X_REG_THRESH_LOW_MSB	= 0x06,
> > -	LTC294X_REG_THRESH_LOW_LSB	= 0x07,
> > -	LTC294X_REG_VOLTAGE_MSB	= 0x08,
> > -	LTC294X_REG_VOLTAGE_LSB	= 0x09,
> > -	LTC294X_REG_CURRENT_MSB	= 0x0E,
> > -	LTC294X_REG_CURRENT_LSB	= 0x0F,
> > -	LTC294X_REG_TEMPERATURE_MSB	= 0x14,
> > -	LTC294X_REG_TEMPERATURE_LSB	= 0x15,
> > +	LTC294X_REG_VOLTAGE_MSB		= 0x08,
> > +	LTC294X_REG_VOLTAGE_LSB		= 0x09,
> > +	LTC2942_REG_TEMPERATURE_MSB	= 0x0C,
> > +	LTC2942_REG_TEMPERATURE_LSB	= 0x0D,
> > +	LTC2943_REG_CURRENT_MSB		= 0x0E,
> > +	LTC2943_REG_CURRENT_LSB		= 0x0F,
> > +	LTC2943_REG_TEMPERATURE_MSB	= 0x14,
> > +	LTC2943_REG_TEMPERATURE_LSB	= 0x15,
> >  };
> 
> I don't see the advantage of renaming these, I'd rather see the LTC294X
> naming throughout, making it easier to locate them in the enum as they all
> share the exact same prefix.

LTC2942 and LTC2943 are using different register offsets for temperature
and current register is LTC2943 specific. Hence the rename, otherwise you
won't be able to distinguish between temperature registers in different chips.

> But if you do want this renaming, I guess you should also rename the LTC2941
> registers.

Well, naming convention is to use LTC294X prefix only for registers common
to all chips. Chip specific registers are using chip specific prefixes. Also
I'm not big fan of having register offsets as enums - offset is a number and
should be represented as such.

> I'm neutral to either naming, linux-pm maintainer will have the final word I
> guess.

I have no problem rolling change back with exception of tepmerature registers
(LTC294X_LTC2942_REG_TEMPERATURE_MSB would probably be an option, but such a
long identifier hurts my eyes).

Let's wait for maintainer's comment.

Best regards,
	ladis

  reply	other threads:[~2017-06-12 17:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-12 15:02 [PATCH 0/2] power: supply: ltc2941-battery-gauge: Support LTC2942 Ladislav Michl
2017-06-12 15:03 ` [PATCH 1/2] power: supply: ltc2941-battery-gauge: Define LTC2942 registers Ladislav Michl
2017-06-12 16:26   ` Mike Looijmans
2017-06-12 17:59     ` Ladislav Michl [this message]
2017-06-12 15:04 ` [PATCH 2/2] power: supply: ltc2941-battery-gauge: Add support for LTC2942 Ladislav Michl
2017-06-12 16:29   ` Mike Looijmans
2017-06-12 18:07     ` Ladislav Michl
2017-06-14  0:08     ` Ladislav Michl

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=20170612175925.fblyzaewuuoivt55@lenoch \
    --to=ladis@linux-mips.org \
    --cc=javier@osg.samsung.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=mike.looijmans@topic.nl \
    /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