Commit Graph
8 Commits
Author SHA1 Message Date
Bjorn Andersson 7f81c24265 clk: Make clk_bulk_get_all() return a valid "id"
The adreno driver expects the "id" field of the returned clk_bulk_data
to be filled in with strings from the clock-names property.

But due to the use of kmalloc_array() in of_clk_bulk_get_all() it
receives a list of bogus pointers instead.

Zero-initialize the "id" field and attempt to populate with strings from
the clock-names property to resolve both these issues.

Fixes: 616e45df7c ("clk: add new APIs to operate on all available clocks")
Fixes: 8e3e791d20 ("drm/msm: Use generic bulk clock function")
Cc: Dong Aisheng <[email protected]>
Cc: Jordan Crouse <[email protected]>
Signed-off-by: Bjorn Andersson <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Reviewed-by: Jordan Crouse <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
2019-09-17 13:26:31 -07:00
Sylwester Nawrocki 2f25528e4e clk: Add clk_bulk_get_optional() function
clk_bulk_get_optional() allows to get a group of clocks where one
or more is optional.  For a not available clock, e.g. not specifed
in the clock consumer node in DT, its respective struct clk pointer
will be NULL.  This allows for operating on a group of returned
clocks (struct clk_bulk_data array) with existing clk_bulk* APIs.

Signed-off-by: Sylwester Nawrocki <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
2019-06-25 14:28:01 -07:00
Stephen Boyd ebafb63dc7 clk: Tag clk core files with SPDX
These are all GPL-2.0 files per the existing license text. Replace the
boiler plate with the tag.

Signed-off-by: Stephen Boyd <[email protected]>
2018-12-11 09:57:47 -08:00
Dong Aisheng 616e45df7c clk: add new APIs to operate on all available clocks
This patch introduces of_clk_bulk_get_all and clk_bulk_x_all APIs
to users who just want to handle all available clocks from device tree
without need to know the detailed clock information likes clock numbers
and names. This is useful in writing some generic drivers to handle clock
part.

Cc: Stephen Boyd <[email protected]>
Cc: Masahiro Yamada <[email protected]>
Tested-by: Thor Thayer <[email protected]>
Signed-off-by: Dong Aisheng <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
2018-10-16 15:42:48 -07:00
Dong Aisheng cfdc0411cf clk: bulk: add of_clk_bulk_get()
'clock-names' property is optional in DT, so of_clk_bulk_get() is
introduced here to handle this for DT users without 'clock-names'
specified. Later clk_bulk_get_all() will be implemented on top of
it and this API will be kept private until someone proves they need
it because they don't have a struct device pointer.

Cc: Stephen Boyd <[email protected]>
Cc: Michael Turquette <[email protected]>
Cc: Russell King <[email protected]>
Reported-by: Shawn Guo <[email protected]>
Tested-by: Thor Thayer <[email protected]>
Signed-off-by: Dong Aisheng <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
2018-10-16 15:42:47 -07:00
Jerome Brunet 329470f2d5 clk: bulk: silently error out on EPROBE_DEFER
In clk_bulk_get(), if we fail to get the clock due to probe deferal, we
shouldn't print an error message. Just be silent in this case.

Signed-off-by: Jerome Brunet <[email protected]>
Reviewed-by: Shawn Lin <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
2018-05-15 15:16:13 -07:00
Bjorn Andersson 9792bf5ad5 clk: Export clk_bulk_prepare()
Allow clk_bulk_prepare() to be referenced by kernel modules by adding
the missing EXPORT_SYMBOL_GPL().

Fixes: 266e4e9d91 ("clk: add clk_bulk_get accessories")
Reported-by: Ulf Hansson <[email protected]>
Signed-off-by: Bjorn Andersson <[email protected]>
Reviewed-by: Ulf Hansson <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
2017-09-29 14:17:17 -07:00
Dong Aisheng 266e4e9d91 clk: add clk_bulk_get accessories
These helper function allows drivers to get several clk consumers in
one operation. If any of the clk cannot be acquired then any clks
that were got will be put before returning to the caller.

This can relieve the driver owners' life who needs to handle many clocks,
as well as each clock error reporting.

Cc: Michael Turquette <[email protected]>
Cc: Stephen Boyd <[email protected]>
Cc: Russell King <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Viresh Kumar <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Anson Huang <[email protected]>
Cc: Robin Gong <[email protected]>
Cc: Bai Ping <[email protected]>
Cc: Leonard Crestez <[email protected]>
Cc: Octavian Purdila <[email protected]>
Signed-off-by: Dong Aisheng <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
2017-06-02 15:37:45 -07:00