Regmap support for common clocks

From: Matti Vaittinen
Date: Thu Dec 20 2018 - 06:49:04 EST

Hello Mike, Stephen & All,

I am working with device drivers for some ROHM components. Recently I
clk did a driver for bd71837/bd71847 PMICs. The PMIC is connected using
i2c and contains a simple clk gate. If the connecting bus could be mmap'd
I would have used the clk-gate provided by common clk framework. But as
it is i2c I ended up making the driver and enable/disable functions myself.

I am now working with next PMIC - which once again has similar clk gate
in it. I could write new driver again - but it feels a bit stupid as it
would be mostly just a copy-paste of bd71837/bd71847 - driver.

I first thought of doing regmap based 'clk-gate, clk-div and clk-mux'.
But after some googling I found

and reading comments makes me to assume there would be more...

Current way seems to be that we have vendor/platform specific sub
folders which all seem to more or less implement own regmap-based basic
clocks. (Well, I randonly skimmed through the qcom and meson subfolders
and aty least they did - I guess same holds with others).

I sure could create 'rohm' subfolder and build up the 'basic clocks
using regmap' there - and put ROHM component related drivers in it. But
that does feel really stupid. Maybe the series worked by Matthias (last
link in the mail) could be reworked - or maybe we could drop one of the
platform specific regmap implementatios from subfolder to generic
portion? I think that for example moving the

drivers/clk/qcom/clk-regmap.c to
drivers/clk/clk-regmap.c so that it could be used without enabling
qualcomm clk configs would be a good start.

Seeing the number of chips connected with i2c/spi/... increasing - and
seeing the comments from community when Matthias sent his patch series
- I'd say the basic clocks supporting regmap would be very welcome...

But maybe I am missing something? I would like to start working with the
clk driver for the new ROHM PMIC - but I would like to take sane
approach. Any good adviece on how to proceed?

Best Regards
Matti Vaittinen

Matti Vaittinen
ROHM Semiconductors

~~~ "I don't think so," said Rene Descartes. Just then, he vanished ~~~