Hi Andy
On 28/02/2022 11:55, Andy Shevchenko wrote:
On Fri, Feb 25, 2022 at 10:04:29PM +0000, Daniel Scally wrote:
On 25/02/2022 17:09, Andy Shevchenko wrote:
On Fri, Feb 25, 2022 at 12:07:49AM +0000, Daniel Scally wrote:
...
/* get system clock (xclk) */
- ov7251->xclk = devm_clk_get(dev, "xclk");
+ ov7251->xclk = devm_clk_get(dev, NULL);
Why a clock doesn't have a name anymore?
Shouldn't you rather switch to _optional()?
The problem is since we could have a the clock coming from some dt file with
it named xclk, as this driver is obviously designed for, but it also can be
created by the int3472-tps68470 or int3472-discrete drivers which don't use
that name. Without knowing what it's called, best thing I could think to do
was remove the name and rely on device matching.
So, then the Q is why it's not called the same in the other drivers?
If I'm honest this is one of those areas I'm still sketchy on, in
drivers/media/i2c I see calls to clk_get with clock names like so:
eclk
extclk
mclk
refclk
xclk
xti
xvclk
But those only work if the firmware (I.E. dt) for the device defines
that name for the clock which means they need to define the dt in a
particular way. So if I make the int3472-discrete driver (which is sort
of playing the part of dt here) register the clocks called "xclk" that
means the drivers all need to have that name too, which breaks the dt
entries if they weren't originally called that. On the other hand, if
the driver has no name but relies on device matching it will work for
both the original dt and also for the int3472-discrete driver's clock
Basically it seems better to me to just let it match by device rather
than have the names. The only advantage I can see for the names is if a
device has multiple clocks assigned to it...but there are no instances
of that in media/i2c.
Broken ACPI compensated for by the cio2-bridge - it creates the
clock-frequency property which ordinarily wouldn't be there on ACPI systems
AIUI.
In the current practice we have CLK priority over property, this means we may do:
1) unconditional reading of the property;
2) trying CLK.
Can it be done here?
Er, can you point me to an example?