public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Laxman Dewangan <ldewangan@nvidia.com>
To: Ian Lartey <ian@slimlogic.co.uk>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"broonie@opensource.wolfsonmicro.com" 
	<broonie@opensource.wolfsonmicro.com>, "lrg@ti.com" <lrg@ti.com>,
	"sameo@linux.intel.com" <sameo@linux.intel.com>,
	Graeme Gregory <gg@slimlogic.co.uk>
Subject: Re: [PATCH 2/2] mfd: palmas add variant and OTP detection
Date: Fri, 22 Feb 2013 16:00:55 +0530	[thread overview]
Message-ID: <512748DF.8080401@nvidia.com> (raw)
In-Reply-To: <1361494325-4416-2-git-send-email-ian@slimlogic.co.uk>

On Friday 22 February 2013 06:22 AM, Ian Lartey wrote:
> From: Graeme Gregory <gg@slimlogic.co.uk>
>
> Read the chip varient and the OTP information from the chip and display
> this on probe to aid in debugging of issues.
>

>   
> +	/* Read varient info from the device */
> +	slave = PALMAS_BASE_TO_SLAVE(PALMAS_ID_BASE);
> +	addr = PALMAS_BASE_TO_REG(PALMAS_ID_BASE, PALMAS_PRODUCT_ID_LSB);
> +	ret = regmap_read(palmas->regmap[slave], addr, &reg);
> +	if (ret < 0) {
> +		dev_err(palmas->dev, "Unable to read ID err: %d\n", ret);
> +		goto err;
> +	}
> +

Can you please use the api palmas_* for reading register which I added 
recently. This will reduce the calc of slave and addr and done in single 
call?
Same of following code also.


Also can we move all these new code to one function where we read id and 
diaplay. To keep probe() smaller.


> +	palmas->id = reg;
> +
> +	slave = PALMAS_BASE_TO_SLAVE(PALMAS_ID_BASE);
> +	addr = PALMAS_BASE_TO_REG(PALMAS_ID_BASE, PALMAS_PRODUCT_ID_MSB);
> +	ret = regmap_read(palmas->regmap[slave], addr, &reg);
> +	if (ret < 0) {
> +		dev_err(palmas->dev, "Unable to read ID err: %d\n", ret);
> +		goto err;
> +	}
> +
> +	palmas->id |= reg << 8;

Is it possible to change variable name id to product_id and then update 
to have more meaningful name?
We can add for vendor_id also if require.

> +
> +	dev_info(palmas->dev, "Product ID %x\n", palmas->id);
> +
> +	slave = PALMAS_BASE_TO_SLAVE(PALMAS_DESIGNREV_BASE);
> +	addr = PALMAS_BASE_TO_REG(PALMAS_DESIGNREV_BASE, PALMAS_DESIGNREV);
> +	ret = regmap_read(palmas->regmap[slave], addr, &reg);
> +	if (ret < 0) {
> +		dev_err(palmas->dev, "Unable to read DESIGNREV err: %d\n", ret);
> +		goto err;
> +	}
> +
> +	palmas->designrev = reg & PALMAS_DESIGNREV_DESIGNREV_MASK;
> +
> +	dev_info(palmas->dev, "Product Design Rev %x\n", palmas->designrev);
> +
> +	slave = PALMAS_BASE_TO_SLAVE(PALMAS_PMU_CONTROL_BASE);
> +	addr = PALMAS_BASE_TO_REG(PALMAS_PMU_CONTROL_BASE, PALMAS_SW_REVISION);
> +	ret = regmap_read(palmas->regmap[slave], addr, &reg);
> +	if (ret < 0) {
> +		dev_err(palmas->dev, "Unable to read SW_REVISION err: %d\n",
> +				ret);
> +		goto err;
> +	}
> +
> +	palmas->sw_revision = reg;
> +
> +	dev_info(palmas->dev, "Product SW Rev %x\n", palmas->sw_revision);
> +


Here designrev also says the ES version and sw revision says the OTP SW 
revision.
TI has make the design revision as ES1.0, ES2.0, ES2.1, ES2.2 like this 
and other technical names are 0xA0, 0xB0, 0xB1, 0xB2 etc.

Probably I will add this in follow on patch becasue we have some errata 
which we need to implement based on the version number.





  reply	other threads:[~2013-02-22 10:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-22  0:52 [PATCH 1/2] regulator: palmas fix SMPS no voltages Ian Lartey
2013-02-22  0:52 ` [PATCH 2/2] mfd: palmas add variant and OTP detection Ian Lartey
2013-02-22 10:30   ` Laxman Dewangan [this message]
2013-02-22 15:52     ` Ian Lartey
2013-02-22 10:41 ` [PATCH 1/2] regulator: palmas fix SMPS no voltages Laxman Dewangan

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=512748DF.8080401@nvidia.com \
    --to=ldewangan@nvidia.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=gg@slimlogic.co.uk \
    --cc=ian@slimlogic.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=sameo@linux.intel.com \
    /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