From: linus.walleij@linaro.org (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] drivers: create a pinmux subsystem v2
Date: Wed, 18 May 2011 07:56:59 +0200 [thread overview]
Message-ID: <BANLkTimMHjUFN8NqAxoF5h_eXgmJP+znSg@mail.gmail.com> (raw)
In-Reply-To: <74CDBE0F657A3D45AFBB94109FB122FF0498A478E6@HQMAIL01.nvidia.com>
2011/5/18 Stephen Warren <swarren@nvidia.com>:
>> +static struct foo_pmx_func myfuncs[] = {
>> + ? ? {
>> + ? ? ? ? ? ? .name = "spi0-0",
>> + ? ? ? ? ? ? .pins = spi0_0_pins,
>> + ? ? ? ? ? ? .num_pins = ARRAY_SIZE(spi0_1_pins),
>> + ? ? },
>> + ? ? {
>> + ? ? ? ? ? ? .name = "i2c0",
>> + ? ? ? ? ? ? .pins = i2c0_pins,
>> + ? ? ? ? ? ? .num_pins = ARRAY_SIZE(i2c0_pins),
>> + ? ? },
>> + ? ? {
>> + ? ? ? ? ? ? .name = "spi0-1",
>> + ? ? ? ? ? ? .pins = spi0_1_pins,
>> + ? ? ? ? ? ? .num_pins = ARRAY_SIZE(spi0_1_pins),
>> + ? ? },
>> +};
>
> Rather than defining a custom type (foo_pmx_func) for this array inside
> each driver, and then having to implement _list, _get_fname, _get_pins
> below, how about:
>
> * pinmux core defines a basic structure containing all the information
> ?that the core needs from the specific implementation.
>
> * This structure would need a field to point at the implementation-
> ?specific data.
>
> * We could get rid of _list, _get_fname, _get_pins completely from
> ?pinmux_ops.
>
> pinmux.h:
>
> struct pinmux_function {
> ? ? ? ?char *name;
> ? ? ? ?const unsigned int *pins;
> ? ? ? ?const unsigned num_pins;
> ? ? ?void *driver_data;
> };
>
> driver source:
>
> struct foo_pmx_func {
> ? ? ? ?int register;
> ? ? ? ?int mask;
> ? ? ? ?int value;
> };
>
> static struct foo_pmx_func spi0_0_func = {
> ? ? ? ?FOO_REG_PMX_A,
> ? ? ? ?0x30,
> ? ? ? ?0x10,
> };
> ...
> static struct pinmux_function myfuncs[] = {
> ? ? ? ?{
> ? ? ? ? ? ? ? ?.name = "spi0-0",
> ? ? ? ? ? ? ? ?.pins = spi0_0_pins,
> ? ? ? ? ? ? ? ?.num_pins = ARRAY_SIZE(spi0_1_pins),
> ? ? ? ? ? ? ? ?.driver_data = &spi0_0_func,
> ? ? ? ?},
> ? ? ? ?{
> ? ? ? ? ? ? ? ?.name = "i2c0",
> ? ? ? ? ? ? ? ?.pins = i2c0_pins,
> ? ? ? ? ? ? ? ?.num_pins = ARRAY_SIZE(i2c0_pins),
> ? ? ? ? ? ? ? ?.driver_data = &i2c0_func,
> ? ? ? ?},
> ? ? ? ?{
> ? ? ? ? ? ? ? ?.name = "spi0-1",
> ? ? ? ? ? ? ? ?.pins = spi0_1_pins,
> ? ? ? ? ? ? ? ?.num_pins = ARRAY_SIZE(spi0_1_pins),
> ? ? ? ? ? ? ? ?.driver_data = &spi0_1_func,
> ? ? ? ?},
> };
>
> This would remove some boiler-plate code from the SoC drivers,
> although it might be considered a bad breaking of abstraction barriers?
Yes it does, however I didn't want to make the initial submission
feature creepy. So I would like this to go in as is, then refactor
drivers to get help from the framework later on, if we see that
it is needed. (So the solution would evolve gradually rather
than being too much designed-in from the beginning.)
Do you think the driver support functions are needed from start?
I could do it I think...
Yours,
Linus Walleij
next prev parent reply other threads:[~2011-05-18 5:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-10 23:39 [PATCH] drivers: create a pinmux subsystem v2 Linus Walleij
2011-05-10 23:58 ` Jamie Iles
2011-05-16 0:09 ` Linus Walleij
2011-05-16 9:36 ` Jamie Iles
2011-05-18 5:31 ` Linus Walleij
2011-05-11 0:15 ` Joe Perches
2011-05-13 21:29 ` Stephen Warren
2011-05-16 0:36 ` Linus Walleij
2011-05-17 21:48 ` Stephen Warren
2011-05-18 5:47 ` Linus Walleij
2011-05-19 17:42 ` Stephen Warren
2011-05-17 22:01 ` Stephen Warren
2011-05-18 5:56 ` Linus Walleij [this message]
2011-05-19 17:19 ` Stephen Warren
2011-05-19 17:38 ` Linus Walleij
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=BANLkTimMHjUFN8NqAxoF5h_eXgmJP+znSg@mail.gmail.com \
--to=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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).