From: Haojian Zhuang <haojian.zhuang@gmail.com>
To: Axel Lin <axel.lin@ingics.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
"Jett.Zhou" <jtzhou@marvell.com>,
Liam Girdwood <lgirdwood@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC/RFT][PATCH 1/3] regulator: core: Add enable_pulldown flag to indicate pulldown on EN input
Date: Sat, 16 Feb 2013 10:51:52 +0800 [thread overview]
Message-ID: <CAN1soZw5k7DBrPOi4iMhsoiGJ_Z5EsYQuFLAjhUiCYsuGxa6ig@mail.gmail.com> (raw)
In-Reply-To: <1360919961.23894.2.camel@phoenix>
On Fri, Feb 15, 2013 at 5:19 PM, Axel Lin <axel.lin@ingics.com> wrote:
> Add enable_pulldown flag to indicate pulldown on EN input when using
> regulator_enable_regmap and friends APIs.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/regulator/core.c | 24 ++++++++++++++++++++----
> include/linux/regulator/driver.h | 3 +++
> 2 files changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index da9782b..aff977f 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -1794,7 +1794,10 @@ int regulator_is_enabled_regmap(struct regulator_dev *rdev)
> if (ret != 0)
> return ret;
>
> - return (val & rdev->desc->enable_mask) != 0;
> + if (rdev->desc->enable_pulldown)
> + return (val & rdev->desc->enable_mask) == 0;
> + else
> + return (val & rdev->desc->enable_mask) != 0;
> }
> EXPORT_SYMBOL_GPL(regulator_is_enabled_regmap);
>
> @@ -1809,9 +1812,15 @@ EXPORT_SYMBOL_GPL(regulator_is_enabled_regmap);
> */
> int regulator_enable_regmap(struct regulator_dev *rdev)
> {
> + unsigned int val;
> +
> + if (rdev->desc->enable_pulldown)
> + val = 0;
> + else
> + val = rdev->desc->enable_mask;
> +
I think that enable_pulldown is a little hard to understand. How about change
the name, like set_to_disable or something else?
> return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
> - rdev->desc->enable_mask,
> - rdev->desc->enable_mask);
> + rdev->desc->enable_mask, val);
> }
> EXPORT_SYMBOL_GPL(regulator_enable_regmap);
>
> @@ -1826,8 +1835,15 @@ EXPORT_SYMBOL_GPL(regulator_enable_regmap);
> */
> int regulator_disable_regmap(struct regulator_dev *rdev)
> {
> + unsigned int val;
> +
> + if (rdev->desc->enable_pulldown)
> + val = rdev->desc->enable_mask;
> + else
> + val = 0;
> +
> return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
> - rdev->desc->enable_mask, 0);
> + rdev->desc->enable_mask, val);
> }
> EXPORT_SYMBOL_GPL(regulator_disable_regmap);
>
> diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
> index 23070fd..7ce1d0c 100644
> --- a/include/linux/regulator/driver.h
> +++ b/include/linux/regulator/driver.h
> @@ -199,6 +199,8 @@ enum regulator_type {
> * output when using regulator_set_voltage_sel_regmap
> * @enable_reg: Register for control when using regmap enable/disable ops
> * @enable_mask: Mask for control when using regmap enable/disable ops
> + * @enable_pulldown: A flag to indicate pulldown on EN input when using
> + * regulator_enable_regmap and friends APIs.
> *
> * @enable_time: Time taken for initial enable of regulator (in uS).
> */
> @@ -226,6 +228,7 @@ struct regulator_desc {
> unsigned int apply_bit;
> unsigned int enable_reg;
> unsigned int enable_mask;
> + bool enable_pulldown;
> unsigned int bypass_reg;
> unsigned int bypass_mask;
>
> --
> 1.7.9.5
>
>
>
next prev parent reply other threads:[~2013-02-16 2:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-15 9:19 [RFC/RFT][PATCH 1/3] regulator: core: Add enable_pulldown flag to indicate pulldown on EN input Axel Lin
2013-02-15 9:20 ` [RFC/RFT][PATCH 2/3] regulator: 88pm8607: Use enable_pulldown flag with regulator_enable_regmap and friends APIs Axel Lin
2013-02-15 9:21 ` [RFC/RFT][PATCH 3/3] regulator: max8649: " Axel Lin
2013-02-16 2:51 ` Haojian Zhuang [this message]
[not found] ` <CAFRkauBxV6sqN7w-YSE_tMZAJAOF2YANGzrU51btRT2Mz+fsNQ@mail.gmail.com>
2013-02-16 5:57 ` [RFC/RFT][PATCH 1/3] regulator: core: Add enable_pulldown flag to indicate pulldown on EN input Haojian Zhuang
2013-03-01 9:22 ` 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=CAN1soZw5k7DBrPOi4iMhsoiGJ_Z5EsYQuFLAjhUiCYsuGxa6ig@mail.gmail.com \
--to=haojian.zhuang@gmail.com \
--cc=axel.lin@ingics.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=jtzhou@marvell.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).