mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh@nvidia.com>
To: Laxman Dewangan <ldewangan@nvidia.com>,
	<linus.walleij@linaro.org>, <robh+dt@kernel.org>,
	<mark.rutland@arm.com>, <swarren@wwwdotorg.org>,
	<thierry.reding@gmail.com>
Cc: <gnurou@gmail.com>, <yamada.masahiro@socionext.com>,
	<linux-gpio@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2 2/2] pinctrl: tegra: Add driver to configure voltage and power of io pads
Date: Mon, 21 Nov 2016 20:37:13 +0000	[thread overview]
Message-ID: <2d442ccc-c438-cf3a-24c4-032d6c906f26@nvidia.com> (raw)
In-Reply-To: <5832ED69.3090903@nvidia.com>


On 21/11/16 12:49, Laxman Dewangan wrote:
> 
> On Monday 21 November 2016 04:38 PM, Jon Hunter wrote:
>>>
>>> I had a discussion with the ASIC on this and as per them
>>>      1.8 V nominal is (1.62V, 1.98V)
>>>      3.3 V nominal is (2.97V,3.63V)
>>>
>>> I am working with them to update the TRM document but we can assume that
>>> this information will be there in TRM.
>> My feeling is that if all use-cases today are using either 1.8V or 3.3V,
>> then may be we should not worry about this and only support either 1.8V
>> or 3.3V. I would be more in favour of supporting other voltages if there
>> is a real need.
> 
> Sometimes, the regulator will not return exact 1.8V or 3.3V due to the
> PMIC rail resolution. On such cases, it returns nearest voltage to 1.8V
> or 3.3V.
> That's why the PMIC resolution is considered through IO pad voltage
> tolerances.

Ok, gotcha. I can see that would be the case for when you call
regulator_get_voltage() (ie. in the probe), but what about the notifier?
I imagine that in the notifier, at least for the pre-change case, that
the voltage is the target and not the actual. So I am wondering if we
need to check for a range in the notifier?

>>>>> +    const struct pinctrl_pin_desc *pins_desc;
>>>>> +    int num_pins_desc;
>>>>> +};
>>>>> +
>>>>> +struct tegra_io_pads_regulator_info {
>>>>> +    struct device *dev;
>>>>> +    const struct tegra_io_pads_cfg_info *pads_cfg;
>>>>> +    struct regulator *regulator;
>>>>> +    struct notifier_block regulator_nb;
>>>>> +};
>>>> Is this struct necessary? Seems to be a lot of duplicated information
>>>> from the other structs. Why not add the regulator and regulator_nb to
>>>> the main struct? OK, not all io_pads have a regulator but you are only
>>>> saving one pointer.
>>> Yes, some of IO pads support multi-voltage.
>> Yes, but I am saying why not put this information in the main struct and
>> not bother having yet another struct where half of the information is
>> duplicated.
> 
> For regulator notifier callback, we will need the driver data. If I keep
> this in the main structure then I will not able to get proper structure
> until I make that as global.
> 
> The notifier registration is
>                 ret = devm_regulator_register_notifier(regulator,
> &rinfo->regulator_nb);
> 
> 
> and from the pointer of rinfo->regulator_nb, I will get the rinfo as
> 
>         rinfo = container_of(nb, struct tegra_io_pads_regulator_info,
>                                      regulator_nb);
> 
> if I use this in main structure then I will not be able to get the
> driver data.

Ah yes, you have an array of regulators. Make sense. However, shame to
duplicate some of this data and also would be good to avoid allocating
so much memory in probe for these structs if only a few rails actually
have regulators ...

  tiopi->rinfo = devm_kzalloc(dev, sizeof(*tiopi->rinfo) *
				soc_data->num_pads_cfg, GFP_KERNEL);

Cheers
Jon

-- 
nvpublic

  reply	other threads:[~2016-11-21 20:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09 13:06 [PATCH V2 0/2] pinctrl: tegra: Add support for IO pad control Laxman Dewangan
2016-11-09 13:06 ` [PATCH V2 1/2] pinctrl: tegra: Add DT binding for io pads control Laxman Dewangan
2016-11-14 19:34   ` Rob Herring
2016-11-15 11:45     ` Laxman Dewangan
2016-11-15 18:48   ` Jon Hunter
2016-11-21  9:16     ` Laxman Dewangan
2016-11-09 13:06 ` [PATCH V2 2/2] pinctrl: tegra: Add driver to configure voltage and power of io pads Laxman Dewangan
2016-11-15  8:59   ` Linus Walleij
2016-11-15 15:07   ` Jon Hunter
2016-11-21  9:36     ` Laxman Dewangan
2016-11-21 11:08       ` Jon Hunter
2016-11-21 12:49         ` Laxman Dewangan
2016-11-21 20:37           ` Jon Hunter [this message]
2016-11-22  8:13             ` Laxman Dewangan
2016-11-21  6:04   ` kbuild test robot
2016-11-21 21:01   ` Jon Hunter
2016-11-22  8:15     ` Laxman Dewangan
2016-11-22  9:45       ` Joe Perches
2016-11-22  9:32         ` 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=2d442ccc-c438-cf3a-24c4-032d6c906f26@nvidia.com \
    --to=jonathanh@nvidia.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gnurou@gmail.com \
    --cc=ldewangan@nvidia.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=swarren@wwwdotorg.org \
    --cc=thierry.reding@gmail.com \
    --cc=yamada.masahiro@socionext.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

all inboxes | Powered by JetHome®