[PATCH 0/2] clk: add a clk_hw helpers to get the clock device or device_node

Jerome Brunet posted 2 patches 8 months ago
drivers/clk/Makefile                          |   1 +
drivers/clk/clk.c                             |  12 ++
drivers/clk/clk_test.c                        | 215 ++++++++++++++++++++++++--
drivers/clk/kunit_clk_hw_get_dev_of_node.dtso |  10 ++
include/linux/clk-provider.h                  |  26 ++++
5 files changed, 247 insertions(+), 17 deletions(-)
[PATCH 0/2] clk: add a clk_hw helpers to get the clock device or device_node
Posted by Jerome Brunet 8 months ago
This patchset adds helpers to get the device or device_node associated with
clk_hw. This can be used by clock drivers to access various device related
functionality. The 2nd changes adds kunit test coverage for the new helpers

This patchset is the v4 of the series previously sent here [1], with the
amlogic patches dropped for now. I'll resume the work on the amlogic
changes when the helpers are available in CCF core.

Added tests run example:
     KTAP version 1
     # Subtest: clk_hw_register_get_dev_of_node_test_suite
     # module: clk_test
     1..2
         KTAP version 1
         # Subtest: clk_hw_register_get_dev_test
         ok 1 clock with device reference
         ok 2 clock missing device reference
     # clk_hw_register_get_dev_test: pass:2 fail:0 skip:0 total:2
     ok 1 clk_hw_register_get_dev_test
         KTAP version 1
         # Subtest: clk_hw_register_get_of_node_test
         ok 1 clock with device reference
         ok 2 clock missing device reference
     # clk_hw_register_get_of_node_test: pass:2 fail:0 skip:0 total:2
     ok 2 clk_hw_register_get_of_node_test
 # clk_hw_register_get_dev_of_node_test_suite: pass:2 fail:0 skip:0 total:2
 # Totals: pass:4 fail:0 skip:0 total:4
 ok 17 clk_hw_register_get_dev_of_node_test_suite
     KTAP version 1
     # Subtest: of_clk_hw_register_get_dev_of_node_test_suite
     # module: clk_test
     1..2
         KTAP version 1
         # Subtest: of_clk_hw_register_get_dev_test
         ok 1 clock with of_node reference
         ok 2 clock missing of_node reference
     # of_clk_hw_register_get_dev_test: pass:2 fail:0 skip:0 total:2
     ok 1 of_clk_hw_register_get_dev_test
         KTAP version 1
         # Subtest: of_clk_hw_register_get_of_node_test
         ok 1 clock with of_node reference
         ok 2 clock missing of_node reference
     # of_clk_hw_register_get_of_node_test: pass:2 fail:0 skip:0 total:2
     ok 2 of_clk_hw_register_get_of_node_test
 # of_clk_hw_register_get_dev_of_node_test_suite: pass:2 fail:0 skip:0 total:2
 # Totals: pass:4 fail:0 skip:0 total:4

[1]: https://lore.kernel.org/linux-clk/20250120-amlogic-clk-drop-clk-regmap-tables-v3-0-126244146947@baylibre.com

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
Jerome Brunet (2):
      clk: add a clk_hw helpers to get the clock device or device_node
      clk: tests: add clk_hw_get_dev() and clk_hw_get_of_node() tests

 drivers/clk/Makefile                          |   1 +
 drivers/clk/clk.c                             |  12 ++
 drivers/clk/clk_test.c                        | 215 ++++++++++++++++++++++++--
 drivers/clk/kunit_clk_hw_get_dev_of_node.dtso |  10 ++
 include/linux/clk-provider.h                  |  26 ++++
 5 files changed, 247 insertions(+), 17 deletions(-)
---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250415-clk-hw-get-helpers-c2344d404f3c

Best regards,
-- 
Jerome
Re: [PATCH 0/2] clk: add a clk_hw helpers to get the clock device or device_node
Posted by Stephen Boyd 5 months, 3 weeks ago
Quoting Jerome Brunet (2025-04-17 06:44:21)
> This patchset adds helpers to get the device or device_node associated with
> clk_hw. This can be used by clock drivers to access various device related
> functionality. The 2nd changes adds kunit test coverage for the new helpers
> 

I've pushed this to clk-hw-device, splitting the test patch into two and
reworking it. Let me know if you see anything off.
Re: [PATCH 0/2] clk: add a clk_hw helpers to get the clock device or device_node
Posted by Jerome Brunet 5 months, 3 weeks ago
On Fri 20 Jun 2025 at 00:20, Stephen Boyd <sboyd@kernel.org> wrote:

> Quoting Jerome Brunet (2025-04-17 06:44:21)
>> This patchset adds helpers to get the device or device_node associated with
>> clk_hw. This can be used by clock drivers to access various device related
>> functionality. The 2nd changes adds kunit test coverage for the new helpers
>> 
>
> I've pushed this to clk-hw-device, splitting the test patch into two and
> reworking it. Let me know if you see anything off.

Thanks a lot Stephen !

You could keep the authorship of the 2nd patch I think, it is more a
rewrite than a rework. Either way, it is fine by me. Thanks again.

-- 
Jerome
Re: [PATCH 0/2] clk: add a clk_hw helpers to get the clock device or device_node
Posted by Jerome Brunet 6 months, 2 weeks ago
On Thu 17 Apr 2025 at 15:44, Jerome Brunet <jbrunet@baylibre.com> wrote:

> This patchset adds helpers to get the device or device_node associated with
> clk_hw. This can be used by clock drivers to access various device related
> functionality. The 2nd changes adds kunit test coverage for the new helpers
>
> This patchset is the v4 of the series previously sent here [1], with the
> amlogic patches dropped for now. I'll resume the work on the amlogic
> changes when the helpers are available in CCF core.

Hi Stephen,

Gentle reminder.
We have been stuck on this for a few months now. Could please take patch
#1 at least. There is a significant amount queued on this on and it
would really help.

Thanks

>
> Added tests run example:
>      KTAP version 1
>      # Subtest: clk_hw_register_get_dev_of_node_test_suite
>      # module: clk_test
>      1..2
>          KTAP version 1
>          # Subtest: clk_hw_register_get_dev_test
>          ok 1 clock with device reference
>          ok 2 clock missing device reference
>      # clk_hw_register_get_dev_test: pass:2 fail:0 skip:0 total:2
>      ok 1 clk_hw_register_get_dev_test
>          KTAP version 1
>          # Subtest: clk_hw_register_get_of_node_test
>          ok 1 clock with device reference
>          ok 2 clock missing device reference
>      # clk_hw_register_get_of_node_test: pass:2 fail:0 skip:0 total:2
>      ok 2 clk_hw_register_get_of_node_test
>  # clk_hw_register_get_dev_of_node_test_suite: pass:2 fail:0 skip:0 total:2
>  # Totals: pass:4 fail:0 skip:0 total:4
>  ok 17 clk_hw_register_get_dev_of_node_test_suite
>      KTAP version 1
>      # Subtest: of_clk_hw_register_get_dev_of_node_test_suite
>      # module: clk_test
>      1..2
>          KTAP version 1
>          # Subtest: of_clk_hw_register_get_dev_test
>          ok 1 clock with of_node reference
>          ok 2 clock missing of_node reference
>      # of_clk_hw_register_get_dev_test: pass:2 fail:0 skip:0 total:2
>      ok 1 of_clk_hw_register_get_dev_test
>          KTAP version 1
>          # Subtest: of_clk_hw_register_get_of_node_test
>          ok 1 clock with of_node reference
>          ok 2 clock missing of_node reference
>      # of_clk_hw_register_get_of_node_test: pass:2 fail:0 skip:0 total:2
>      ok 2 of_clk_hw_register_get_of_node_test
>  # of_clk_hw_register_get_dev_of_node_test_suite: pass:2 fail:0 skip:0 total:2
>  # Totals: pass:4 fail:0 skip:0 total:4
>
> [1]: https://lore.kernel.org/linux-clk/20250120-amlogic-clk-drop-clk-regmap-tables-v3-0-126244146947@baylibre.com
>
> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
> ---
> Jerome Brunet (2):
>       clk: add a clk_hw helpers to get the clock device or device_node
>       clk: tests: add clk_hw_get_dev() and clk_hw_get_of_node() tests
>
>  drivers/clk/Makefile                          |   1 +
>  drivers/clk/clk.c                             |  12 ++
>  drivers/clk/clk_test.c                        | 215 ++++++++++++++++++++++++--
>  drivers/clk/kunit_clk_hw_get_dev_of_node.dtso |  10 ++
>  include/linux/clk-provider.h                  |  26 ++++
>  5 files changed, 247 insertions(+), 17 deletions(-)
> ---
> base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
> change-id: 20250415-clk-hw-get-helpers-c2344d404f3c
>
> Best regards,

-- 
Jerome