devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javier.martinez-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>
To: amit daniel kachhap
	<amit.daniel-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Mike Turquette
	<mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Alessandro Zummo
	<a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org>,
	Kukjin Kim <kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	Tomeu Vizoso
	<tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>,
	Krzysztof Kozlowski
	<k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Yadwinder Singh Brar
	<yadi.brar01-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Tushar Behera <trblinux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Andreas Farber <afaerber-l3A5Bk7waGM@public.gmane.org>,
	LAK
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v6 15/23] regulator: max77686: Setup DVS-related GPIOs on probe
Date: Fri, 11 Jul 2014 04:03:00 +0200	[thread overview]
Message-ID: <53BF45D4.2000302@collabora.co.uk> (raw)
In-Reply-To: <CADGdYn4EURaHinWVksQSPzVr=CkZYcrqvWsO7mKDz_gY9XB__Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hello Amit,

On 07/10/2014 12:08 PM, amit daniel kachhap wrote:
> On Fri, Jul 4, 2014 at 3:25 PM, Javier Martinez Canillas
> <javier.martinez-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org> wrote:
>> MAX77686 PMIC support Dyamic Voltage Scaling (DVS) on a set
>> of Buck regulators. A number of GPIO are connected to these
>> lines and are requested by the mfd driver. Setup the GPIO
>> pins from the regulator driver.
> If possible merge this patch with patch 8. Both are adding DVS
> support. Put regmap_copy dependency patch in very beginning.

As Lee already said, I split the changes to minimize the cross-subsystem churn.

>>
>> Signed-off-by: Javier Martinez Canillas <javier.martinez-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>
>> ---
>>  drivers/regulator/max77686.c | 34 ++++++++++++++++++++++++++++++++++
>>  1 file changed, 34 insertions(+)
>>
>> diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c
>> index ef1af2d..ecce77a 100644
>> --- a/drivers/regulator/max77686.c
>> +++ b/drivers/regulator/max77686.c
>> @@ -435,6 +435,12 @@ static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev,
>>  }
>>  #endif /* CONFIG_OF */
>>
>> +static inline bool max77686_is_dvs_buck(int id)
>> +{
>> +       /* BUCK 2,3 and 4 support DVS */
>> +       return (id >= MAX77686_BUCK2 && id <= MAX77686_BUCK4);
> I am just wondering if along with above check, SELB gpios (if present)
> can be used to confirm if BUCK's are DVS based or not.

I don't know if SELB gpios being present or not should be used to determine
whether a BUCK includes the DVS feature. AFAIK boards could have some of these
lines hardwired and pulled high or low instead of using a GPIO.

>> +}
>> +
>>  static int max77686_pmic_probe(struct platform_device *pdev)
>>  {
>>         struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
>> @@ -442,6 +448,9 @@ static int max77686_pmic_probe(struct platform_device *pdev)
>>         struct max77686_data *max77686;
>>         int i, ret = 0;
>>         struct regulator_config config = { };
>> +       unsigned int reg;
>> +       int buck_default_idx;
>> +       int buck_old_idx;
>>
>>         dev_dbg(&pdev->dev, "%s\n", __func__);
>>
>> @@ -472,13 +481,34 @@ static int max77686_pmic_probe(struct platform_device *pdev)
>>         config.driver_data = max77686;
>>         platform_set_drvdata(pdev, max77686);
>>
>> +       buck_default_idx = pdata->buck_default_idx;
>> +       buck_old_idx = max77686_read_gpios(pdata);
>> +
>>         for (i = 0; i < MAX77686_REGULATORS; i++) {
>>                 struct regulator_dev *rdev;
>> +               int id = pdata->regulators[i].id;
>>
>>                 config.init_data = pdata->regulators[i].initdata;
>>                 config.of_node = pdata->regulators[i].of_node;
>>
>>                 max77686->opmode[i] = regulators[i].enable_mask;
>> +
>> +               if (max77686_is_dvs_buck(id)) {
>> +                       /* Try to copy over data so we keep firmware settings */
>> +                       reg = regulators[i].vsel_reg;
>> +
>> +                       ret = regmap_reg_copy(iodev->regmap,
>> +                                             reg + buck_default_idx,
>> +                                             reg + buck_old_idx);
>> +
>> +                       if (ret)
>> +                               dev_warn(&pdev->dev, "Copy err %d => %d (%d)\n",
>> +                                        reg + buck_old_idx,
>> +                                        reg + buck_default_idx, ret);
>> +
>> +                       regulators[i].vsel_reg += buck_default_idx;
>> +               }
>> +
>>                 rdev = devm_regulator_register(&pdev->dev,
>>                                                 &regulators[i], &config);
>>                 if (IS_ERR(rdev)) {
>> @@ -488,6 +518,10 @@ static int max77686_pmic_probe(struct platform_device *pdev)
>>                 }
>>         }
>>
>> +       ret = max77686_setup_gpios(iodev->dev);
>> +       if (ret)
>> +               return ret;
>> +
>>         return 0;
>>  }
>>
>> --
>> 2.0.0.rc2
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
>> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

Best regards,
Javier
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-07-11  2:03 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-04  9:54 [PATCH v6 00/23] Add Maxim 77802 PMIC support Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 01/23] mfd: max77686: Convert to use regmap_irq Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 02/23] mfd: max77686: Add power management support Javier Martinez Canillas
2014-07-04 10:51   ` Krzysztof Kozlowski
2014-07-04  9:55 ` [PATCH v6 03/23] mfd: max77686: Don't define dummy function if OF isn't enabled Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 04/23] mfd: max77686: Make platform data over-rule DT Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 05/23] mfd: max77686: Return correct error when pdata isn't found Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 06/23] mfd: max77686: Make error checking consistent Javier Martinez Canillas
2014-07-04 10:54   ` Krzysztof Kozlowski
2014-07-04  9:55 ` [PATCH v6 07/23] mfd: max77686: Remove unneeded OOM error message Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 08/23] mfd: max77686: Add Dynamic Voltage Scaling (DVS) support Javier Martinez Canillas
2014-07-04 11:15   ` Krzysztof Kozlowski
2014-07-04 11:32     ` Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 09/23] rtc: max77686: Allow the max77686 rtc to wakeup the system Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 10/23] clk: max77686: Add DT include for MAX77686 PMIC clock Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 11/23] clk: Add generic driver for Maxim PMIC clocks Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 12/23] clk: max77686: Convert to the generic max clock driver Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 13/23] clk: max77686: Improve Maxim 77686 PMIC clocks binding Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 14/23] regmap: Add regmap_reg_copy function Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 15/23] regulator: max77686: Setup DVS-related GPIOs on probe Javier Martinez Canillas
2014-07-10 10:08   ` amit daniel kachhap
     [not found]     ` <CADGdYn4EURaHinWVksQSPzVr=CkZYcrqvWsO7mKDz_gY9XB__Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-10 13:25       ` Lee Jones
2014-07-11  2:03       ` Javier Martinez Canillas [this message]
2014-07-11  9:31         ` amit daniel kachhap
2014-07-04  9:55 ` [PATCH v6 16/23] mfd: max77686: Add documentation for DVS bindings Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 17/23] mfd: max77686: Add Maxim 77802 PMIC support Javier Martinez Canillas
2014-07-04 11:30   ` Krzysztof Kozlowski
2014-07-04 11:35     ` Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 18/23] mfd: max77802: Add DT binding documentation Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 19/23] regulator: Add driver for Maxim 77802 PMIC regulators Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 20/23] clk: Add driver for Maxim 77802 PMIC clocks Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 21/23] clk: max77802: Add DT binding documentation Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 22/23] rtc: Add driver for Maxim 77802 PMIC Real-Time-Clock Javier Martinez Canillas
2014-07-04 11:56   ` Krzysztof Kozlowski
2014-07-04 12:52     ` Javier Martinez Canillas
2014-07-04 13:11       ` Krzysztof Kozlowski
2014-07-04 13:23         ` Javier Martinez Canillas
2014-07-04  9:55 ` [PATCH v6 23/23] ARM: dts: Add max77802 to exynos5420-peach-pit and exynos5800-peach-pi Javier Martinez Canillas

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=53BF45D4.2000302@collabora.co.uk \
    --to=javier.martinez-zgy8ohtn/8ppycu2f3hruq@public.gmane.org \
    --cc=a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org \
    --cc=afaerber-l3A5Bk7waGM@public.gmane.org \
    --cc=amit.daniel-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=tomeu.vizoso-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org \
    --cc=trblinux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=yadi.brar01-Re5JQEeQqe8AvxtiuMwx3w@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 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).