Re: [PATCH v3 2/2] pinctrl: samsung: support a bus clock

From: André Draszik
Date: Fri May 03 2024 - 05:30:17 EST


Hi Krzysztof,

On Fri, 2024-05-03 at 11:13 +0200, Krzysztof Kozlowski wrote:
> On 02/05/2024 12:41, André Draszik wrote:
> > I was initially thinking the same, but the clock seems to be required for
> > register access only, interrupts are still being received and triggered
> > with pclk turned off as per my testing.
>
> Probably we could simplify this all and keep the clock enabled always,
> when device is not suspended. Toggling clock on/off for every pin change
> is also an overhead. Anyway, I merged the patches for now, because it
> addresses real problem and seems like one of reasonable solutions.

I had contemplated a global enable of the clock on driver instantiation
as well, but in the end for me the reasons why I chose the fine-grained
approach here instead were:

* Since the clock is only needed for register access, it seems only
natural to enable it during register accesses only. (The same would
happen if we had support for automatic clock gating in Linux).
* If we think about external GPIO interrupts, they are likely to occur
very rarely (think button press by operator on some external keys or
I2C interrupts), it seems a waste to have the clock running all the
time.
* drivers/i2c/busses/i2c-exynos5.c and drivers/soc/samsung/exynos-usi.c
also kinda do it this way. Bus clocks are only enabled when needed
(e.g. during transfer) (granted, the IPs (IP clocks) are also fully
enabled/disabled in those drivers when idle, and there is no such
thing here)


Cheers,
Andre'