From: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
To: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: lrg-l0cyMroinI0@public.gmane.org,
jedu-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
gg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH V2] regulator: tps65910: Sleep control through external inputs
Date: Wed, 25 Jan 2012 12:42:50 +0000 [thread overview]
Message-ID: <20120125124250.GH3687@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1327489068-9460-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1402 bytes --]
On Wed, Jan 25, 2012 at 04:27:48PM +0530, Laxman Dewangan wrote:
> @@ -450,6 +489,29 @@ static int tps65910_set_mode(struct regulator_dev *dev, unsigned int mode)
> struct tps65910 *mfd = pmic->mfd;
> int reg, value, id = rdev_get_id(dev);
>
> + /*
> + * If regulator is controlled through external control then
> + * mode can be identified by the input level of EN1/EN2/EN3.
> + * If it is HIGH then regulators is on, full power.
> + * If it is LOW then:
> + * - the regulator is set off if its corresponding Control
> + * bit = 0 in SLEEP_KEEP_XXX_ON.
> + * - the regulator is set in low-power mode if its corresponding
> + * control bit = 1 in SLEEP_KEEP_XXX_ON register.
> + */
This really isn't what the set_mode() API is for - especially the fact
that it supports turning the regulator off which really isn't what
set_mode() is supposed to do. A generic driver using this API isn't
going to play too well.
> + if (pmic->board_ext_control[id]) {
> + u8 regoffs = (pmic->ext_sleep_control[id] >> 8) & 0xFF;
> + u8 bit_pos = (1 << pmic->ext_sleep_control[id] & 0xFF);
> + int ret = 0;
> + if ((mode == REGULATOR_MODE_IDLE) ||
> + (mode == REGULATOR_MODE_STANDBY))
> + ret = tps65910_set_bits(mfd,
> + TPS65910_SLEEP_KEEP_LDO_ON + regoffs, bit_pos);
As a coding style thing this should be a switch statement.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Laxman Dewangan <ldewangan@nvidia.com>
Cc: lrg@ti.com, jedu@slimlogic.co.uk, sameo@linux.intel.com,
gg@slimlogic.co.uk, linux-kernel@vger.kernel.org,
linux-tegra@vger.kernel.org
Subject: Re: [PATCH V2] regulator: tps65910: Sleep control through external inputs
Date: Wed, 25 Jan 2012 12:42:50 +0000 [thread overview]
Message-ID: <20120125124250.GH3687@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1327489068-9460-1-git-send-email-ldewangan@nvidia.com>
[-- Attachment #1: Type: text/plain, Size: 1402 bytes --]
On Wed, Jan 25, 2012 at 04:27:48PM +0530, Laxman Dewangan wrote:
> @@ -450,6 +489,29 @@ static int tps65910_set_mode(struct regulator_dev *dev, unsigned int mode)
> struct tps65910 *mfd = pmic->mfd;
> int reg, value, id = rdev_get_id(dev);
>
> + /*
> + * If regulator is controlled through external control then
> + * mode can be identified by the input level of EN1/EN2/EN3.
> + * If it is HIGH then regulators is on, full power.
> + * If it is LOW then:
> + * - the regulator is set off if its corresponding Control
> + * bit = 0 in SLEEP_KEEP_XXX_ON.
> + * - the regulator is set in low-power mode if its corresponding
> + * control bit = 1 in SLEEP_KEEP_XXX_ON register.
> + */
This really isn't what the set_mode() API is for - especially the fact
that it supports turning the regulator off which really isn't what
set_mode() is supposed to do. A generic driver using this API isn't
going to play too well.
> + if (pmic->board_ext_control[id]) {
> + u8 regoffs = (pmic->ext_sleep_control[id] >> 8) & 0xFF;
> + u8 bit_pos = (1 << pmic->ext_sleep_control[id] & 0xFF);
> + int ret = 0;
> + if ((mode == REGULATOR_MODE_IDLE) ||
> + (mode == REGULATOR_MODE_STANDBY))
> + ret = tps65910_set_bits(mfd,
> + TPS65910_SLEEP_KEEP_LDO_ON + regoffs, bit_pos);
As a coding style thing this should be a switch statement.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-01-25 12:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-25 10:57 [PATCH V2] regulator: tps65910: Sleep control through external inputs Laxman Dewangan
2012-01-25 10:57 ` Laxman Dewangan
[not found] ` <1327489068-9460-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-01-25 12:42 ` Mark Brown [this message]
2012-01-25 12:42 ` Mark Brown
[not found] ` <20120125124250.GH3687-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-01-25 12:47 ` Laxman Dewangan
2012-01-25 12:47 ` Laxman Dewangan
[not found] ` <4F1FF9EF.9000004-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-01-25 12:50 ` Mark Brown
2012-01-25 12:50 ` Mark Brown
[not found] ` <20120125125020.GI3687-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-01-25 14:07 ` Laxman Dewangan
2012-01-25 14:07 ` Laxman Dewangan
[not found] ` <4F200C93.30502-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-01-25 14:36 ` Mark Brown
2012-01-25 14:36 ` Mark Brown
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=20120125124250.GH3687@opensource.wolfsonmicro.com \
--to=broonie-yzvpicuk2aatku/dhu1wvuem+bqzidxxqq4iyu8u01e@public.gmane.org \
--cc=gg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org \
--cc=jedu-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org \
--cc=ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lrg-l0cyMroinI0@public.gmane.org \
--cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.