[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZjkuzKEt2aiHIwg_@surfacebook.localdomain>
Date: Mon, 6 May 2024 22:26:04 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Sean Anderson <sean.anderson@...ux.dev>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Michal Simek <michal.simek@....com>, linux-gpio@...r.kernel.org,
Krishna Potthuri <sai.krishna.potthuri@....com>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 2/2] pinctrl: zynqmp: Support muxing individual pins
Fri, May 03, 2024 at 12:22:17PM -0400, Sean Anderson kirjoitti:
> While muxing groups of pins at once can be convenient for large
> interfaces, it can also be rigid. This is because the group is set to
> all pins which support a particular function, even though not all pins
> may be used. For example, the sdhci0 function may be used with a 8-bit
> eMMC, 4-bit SD card, or even a 1-bit SD card. In these cases, the extra
> pins may be repurposed for other uses, but this is not currently
> allowed.
>
> Add a new group for each pin which can be muxed. These groups are part
> of each function the pin can be muxed to. We treat group selectors
> beyond the number of groups as "pin" groups. To set this up, we
> initialize groups before functions, and then create a bitmap of used
> pins for each function. These used pins are appended to the function's
> list of groups.
..
> + for (pin = 0; pin < groups[resp[i]].npins; pin++)
> + set_bit(groups[resp[i]].pins[pin], used_pins);
Why atomic bit operation?
..
> + fgroups = devm_kcalloc(dev, func->ngroups + npins, sizeof(*fgroups),
size_add() from overflow.h.
> + GFP_KERNEL);
> + if (!fgroups)
> + return -ENOMEM;
..
> + for (i = 0; i < func->ngroups; i++) {
> + fgroups[i] = devm_kasprintf(dev, GFP_KERNEL, "%s_%d_grp",
> + func->name, i);
> + if (!fgroups[i])
> + return -ENOMEM;
> + }
Hmm... Can this benefit from devm_kasprintf_strarray()?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists