From: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
To: Saurabh Singh <saurabh1.s-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: "lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
<lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
<broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org"
<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
"rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org"
<rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"celinux-dev-VxL1A5FK7jA05z2xGA6PZHhyD016LWXt@public.gmane.org"
<celinux-dev-VxL1A5FK7jA05z2xGA6PZHhyD016LWXt@public.gmane.org>,
"srevatsa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org"
<srevatsa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
"bp.praveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org"
<bp.praveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Subject: Re: [PATCH] Parse missing regulator constraints from device tree blob
Date: Thu, 16 Jan 2014 10:28:01 +0000 [thread overview]
Message-ID: <20140116102800.GA19578@e106331-lin.cambridge.arm.com> (raw)
In-Reply-To: <23745449.572421389854083634.JavaMail.weblogic@epml20>
Hi,
On Thu, Jan 16, 2014 at 06:34:46AM +0000, Saurabh Singh wrote:
> This patch adds support for parsing following regulator contraints from device tree blob.
> 1. valid modes mask (valid_modes_mask)
> 2. input microvolt(input_uV)
> 3. initial mode (initial_mode)
> 4. initial state (initial_state)
> 5. state mem (state_mem)
> 6. state disk (state_disk)
> 7. state standby (state_standby)
>
> This patch is currently against a linux 3.12.6 kernel.
>
> diffstat for this patch is:
> of_regulator.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 63 insertions(+)
>
> To apply the patch, in the root of a kernel tree use:
> patch -p1 < of_regulator.patch
>
> Please let me know any feedback you have on this patch or the approach used.
There are several issues with this patch:
* None of these properties are documented. Documentation is required so
that the contract is defined. That allows people to learn how to use
the properties, and makes clear what we can and cannot change
kernel-side.
* It leaks Linux internal details (e.g. suspend_state_t values,
valid_mode_mask) without any attempt at abstraction, in violation of
dt principles.
* Accessors are used poorly. Endianness conversion is done manually
rather than being left to accessors, and property lengths aren't
checked.
>
> Regards,
> =====================
> Saurabh Singh Sengar
> Lead Engineer
> Samsung R&D Institute
> India
> Samsung
> =====================
> Signed-off-by: Saurabh Singh Sengar <saurabh1.s-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
>
> --------------------------------------------------------------------------------
> --- linux-3.12.6/drivers/regulator/of_regulator.c.orig 2014-01-08 17:19:43.085903573 +0530
> +++ linux-3.12.6/drivers/regulator/of_regulator.c 2014-01-15 20:12:22.146543128 +0530
> @@ -16,11 +16,40 @@
> #include <linux/regulator/machine.h>
> #include <linux/regulator/of_regulator.h>
>
> +/**
> + * set_regulator_state_constraints - set regulator state for low power system states
> + * @np: device node for the low power regulator state
> + * @regulator_state: regulator_state structure need to be filled
> + */
> +static void set_regulator_state_constraints(struct device_node *np,
> + struct regulator_state *regulator_state)
> +{
> + const __be32 *uV, *mode;
> +
> + uV = of_get_property(np, "regulator-state-uV", NULL);
Typically properties are all lower-case.
> + if (uV)
> + regulator_state->uV = be32_to_cpu(*uV);
As an example, to use accessors correctly, here you should have:
u32 uv;
of_property_read_u32(np, "regulator-state-uv", &uv);
However, as far as I can see this value should come from an input supply
anyway.
Thanks,
Mark.
--
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
next prev parent reply other threads:[~2014-01-16 10:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-16 6:34 [PATCH] Parse missing regulator constraints from device tree blob Saurabh Singh
2014-01-16 10:28 ` Mark Rutland [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-01-16 13:43 Saurabh Singh
2014-01-16 14:07 ` Mark Brown
2014-01-17 15:04 Saurabh Singh
2014-01-17 15:11 Saurabh Singh
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=20140116102800.GA19578@e106331-lin.cambridge.arm.com \
--to=mark.rutland-5wv7dgnigg8@public.gmane.org \
--cc=bp.praveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=celinux-dev-VxL1A5FK7jA05z2xGA6PZHhyD016LWXt@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
--cc=saurabh1.s-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=srevatsa-Sze3O3UU22JBDgjK7y7TUQ@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).