All of lore.kernel.org
 help / color / mirror / Atom feed
From: Balaji T K <balajitk@ti.com>
To: Michael Trimarchi <michael@amarulasolutions.com>
Cc: Linux OMAP Mailing List <linux-omap@vger.kernel.org>,
	Benoit Cousson <bcousson@baylibre.com>,
	devicetree@vger.kernel.org, linux-mmc@vger.kernel.org,
	Chris Ball <cjb@laptop.org>, Mark Brown <broonie@kernel.org>,
	Tony Lindgren <tony@atomide.com>
Subject: Re: [PATCH v7 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator
Date: Mon, 23 Dec 2013 19:12:48 +0530	[thread overview]
Message-ID: <52B83DD8.1060402@ti.com> (raw)
In-Reply-To: <CAOf5uw=QO9ePDxQfZYpJPd9Fa4Cud54+NL2CtkJvsF5dz3MXvA@mail.gmail.com>

On Friday 20 December 2013 11:45 PM, Michael Trimarchi wrote:
> Hi
>
> On Fri, Dec 20, 2013 at 6:35 PM, Balaji T K <balajitk@ti.com> wrote:
>> In DT case, PBAIS registers are programmed via regulator,
>> use regulator APIs to control PBIAS.
>>
>> Signed-off-by: Balaji T K <balajitk@ti.com>
>> ---
>>   drivers/mmc/host/omap_hsmmc.c |   39 +++++++++++++++++++++++++++++++++++++++
>>   1 files changed, 39 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>> index 342be25..0a390f8 100644
>> --- a/drivers/mmc/host/omap_hsmmc.c
>> +++ b/drivers/mmc/host/omap_hsmmc.c
>> @@ -126,6 +126,10 @@
>>   #define OMAP_MMC_MAX_CLOCK     52000000
>>   #define DRIVER_NAME            "omap_hsmmc"
>>
>> +#define VDD_1V8                        1800000         /* 180000 uV */
>> +#define VDD_3V0                        3000000         /* 300000 uV */
>> +#define VDD_165_195            (ffs(MMC_VDD_165_195) - 1)
>> +
>>   /*
>>    * One controller can have multiple slots, like on some omap boards using
>>    * omap.c controller driver. Luckily this is not currently done on any known
>> @@ -164,6 +168,8 @@ struct omap_hsmmc_host {
>>           */
>>          struct  regulator       *vcc;
>>          struct  regulator       *vcc_aux;
>> +       struct  regulator       *pbias;
>> +       bool                    pbias_enabled;
>>          int                     pbias_disable;
>>          void    __iomem         *base;
>>          resource_size_t         mapbase;
>> @@ -272,6 +278,15 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
>>          if (mmc_slot(host).before_set_reg)
>>                  mmc_slot(host).before_set_reg(dev, slot, power_on, vdd);
>>
>> +       if (host->pbias) {
>> +               if (host->pbias_enabled == 1) {
>> +                       ret = regulator_disable(host->pbias);
>> +                       if (!ret)
>> +                               host->pbias_enabled = 0;
>
> you should return error?
>
>> +               }
>> +               regulator_set_voltage(host->pbias, VDD_3V0, VDD_3V0);
>> +       }
>> +
>>          /*
>>           * Assume Vcc regulator is used only to power the card ... OMAP
>>           * VDDS is used to power the pins, optionally with a transceiver to
>> @@ -306,9 +321,29 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
>>                  }
>>          }
>>
>> +       if (host->pbias) {
>> +               if (vdd <= VDD_165_195)
>> +                       ret = regulator_set_voltage(host->pbias, VDD_1V8,
>> +                                                               VDD_1V8);
>> +               else
>> +                       ret = regulator_set_voltage(host->pbias, VDD_3V0,
>> +                                                               VDD_3V0);
>> +               if (ret < 0)
>> +                       goto error_set_power;
>> +
>> +               if (host->pbias_enabled == 0) {
>> +                       ret = regulator_enable(host->pbias);
>> +                       if (!ret) {
>> +                               host->pbias_enabled = 1;
>> +                               goto error_set_power;
>
> Is this an error condition? Do you need this flag?
>
Hi,

pbias_enabled flag is used to balance regulator_enable/regulator_disable, otherwise
regulator might be kept enabled base on to use count.

  reply	other threads:[~2013-12-23 13:42 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20 17:35 [PATCH v7 0/7] mmc: omap_hsmmc: pbias dt and cleanup Balaji T K
2013-12-20 17:35 ` [PATCH v7 1/7] mmc: omap_hsmmc: use devm_regulator API Balaji T K
2013-12-20 18:38   ` Tony Lindgren
2013-12-20 17:35 ` [PATCH v7 2/7] mmc: omap_hsmmc: handle vcc and vcc_aux independently Balaji T K
2013-12-20 18:40   ` Tony Lindgren
2013-12-20 17:35 ` [PATCH v7 3/7] regulator: add pbias regulator support Balaji T K
2013-12-20 23:39   ` Tony Lindgren
2013-12-24 16:11     ` Balaji T K
2014-01-06 18:16   ` Mark Rutland
2014-01-07 10:09     ` Balaji T K
2013-12-20 17:35 ` [PATCH v7 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator Balaji T K
2013-12-20 18:15   ` Michael Trimarchi
2013-12-23 13:42     ` Balaji T K [this message]
2013-12-20 17:35 ` [PATCH v7 5/7] ARM: dts: add pbias dt node Balaji T K
2013-12-21  0:32   ` Tony Lindgren
2014-01-06 18:19   ` Mark Rutland
2014-01-07 10:18     ` Balaji T K
2014-01-07 10:57       ` Mark Rutland
2014-01-07 12:23         ` Balaji T K
2014-01-08 14:51           ` Balaji T K
2014-01-10 11:32             ` Mark Rutland
2014-01-10 17:00               ` Balaji T K
2013-12-20 17:35 ` [PATCH v7 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig Balaji T K
2013-12-21  0:33   ` Tony Lindgren
2013-12-20 17:35 ` [PATCH v7 7/7] mmc: omap_hsmmc: remove pbias workaround Balaji T K
2013-12-21  0:33   ` Tony Lindgren
2014-01-09 14:50 ` [PATCH v8 0/7] mmc: omap_hsmmc: pbias dt and cleanup Balaji T K
2014-01-09 14:50   ` [PATCH v8 1/7] mmc: omap_hsmmc: use devm_regulator API Balaji T K
2014-01-09 15:18     ` Felipe Balbi
2014-01-10 15:55       ` Balaji T K
2014-01-10 15:58         ` Felipe Balbi
2014-01-09 14:50   ` [PATCH v8 2/7] mmc: omap_hsmmc: handle vcc and vcc_aux independently Balaji T K
2014-01-09 14:50   ` [PATCH v8 3/7] regulator: add pbias regulator support Balaji T K
2014-01-09 17:27     ` Mark Brown
2014-01-09 14:50   ` [PATCH v8 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator Balaji T K
2014-01-09 14:51   ` [PATCH v8 5/7] ARM: dts: add pbias dt node Balaji T K
2014-01-09 14:51   ` [PATCH v8 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig Balaji T K
2014-01-09 14:51   ` [PATCH v8 7/7] mmc: omap_hsmmc: remove pbias workaround Balaji T K
2014-01-10 17:30   ` [PATCH v9 0/7] mmc: omap_hsmmc: pbias dt and cleanup Balaji T K
2014-01-10 17:30     ` [PATCH v9 1/7] mmc: omap_hsmmc: use devm_regulator API Balaji T K
2014-01-10 17:30     ` [PATCH v9 2/7] mmc: omap_hsmmc: handle vcc and vcc_aux independently Balaji T K
2014-01-10 17:30     ` [PATCH v9 3/7] regulator: add pbias regulator support Balaji T K
2014-01-10 17:30     ` [PATCH v9 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator Balaji T K
2014-01-10 18:21       ` Michael Trimarchi
2014-01-13 13:29         ` Balaji T K
2014-01-10 17:30     ` [PATCH v9 5/7] ARM: dts: add pbias dt node Balaji T K
2014-01-10 17:30     ` [PATCH v9 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig Balaji T K
2014-01-10 17:30     ` [PATCH v9 7/7] mmc: omap_hsmmc: remove pbias workaround Balaji T K
2014-01-13 15:36   ` [PATCH v10 0/7] mmc: omap_hsmmc: pbias dt and cleanup Balaji T K
2014-01-13 15:36     ` [PATCH v10 1/7] mmc: omap_hsmmc: use devm_regulator API Balaji T K
2014-01-13 15:36     ` [PATCH v10 2/7] mmc: omap_hsmmc: handle vcc and vcc_aux independently Balaji T K
2014-01-13 15:36     ` [PATCH v10 3/7] regulator: add pbias regulator support Balaji T K
2014-01-13 15:36     ` [PATCH v10 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator Balaji T K
2014-01-13 15:36     ` [PATCH v10 5/7] ARM: dts: add pbias dt node Balaji T K
2014-01-15 15:09       ` Balaji T K
2014-01-13 15:36     ` [PATCH v10 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig Balaji T K
2014-01-13 15:36     ` [PATCH v10 7/7] mmc: omap_hsmmc: remove pbias workaround Balaji T K
2014-02-04  8:32     ` [PATCH v10 0/7] mmc: omap_hsmmc: pbias dt and cleanup Balaji T K
2014-02-19 14:56     ` [PATCH RESEND " Balaji T K
2014-02-19 14:56       ` [PATCH RESEND v11 1/7] mmc: omap_hsmmc: use devm_regulator API Balaji T K
2014-02-19 14:56       ` [PATCH RESEND v11 2/7] mmc: omap_hsmmc: handle vcc and vcc_aux independently Balaji T K
2014-02-19 14:56       ` [PATCH RESEND v11 3/7] regulator: add pbias regulator support Balaji T K
2014-02-19 14:56       ` [PATCH RESEND v11 4/7] mmc: omap_hsmmc: adapt hsmmc to use pbias regulator Balaji T K
2014-02-19 14:56       ` [PATCH RESEND v11 5/7] ARM: dts: add pbias dt node Balaji T K
2014-02-19 14:56       ` [PATCH RESEND v11 6/7] ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig Balaji T K
2014-02-26 17:01         ` Tony Lindgren
2014-03-03 14:33           ` Balaji T K
2014-02-19 14:56       ` [PATCH RESEND v11 7/7] mmc: omap_hsmmc: remove pbias workaround Balaji T K
2014-02-26  8:51       ` [PATCH RESEND v10 0/7] mmc: omap_hsmmc: pbias dt and cleanup Stefan Roese
2014-02-26 14:04       ` Florian Vaussard
2014-02-26 14:43         ` Balaji T K

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=52B83DD8.1060402@ti.com \
    --to=balajitk@ti.com \
    --cc=bcousson@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=cjb@laptop.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=michael@amarulasolutions.com \
    --cc=tony@atomide.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 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.