587dd448 | 13-Jun-2023 |
Stephen Boyd <sboyd@kernel.org> |
clk: sprd: composite: Simplify determine_rate implementation
The sprd_div_helper_round_rate() function calls divider_round_rate() which calls divider_round_rate_parent() which calls divider_determin
clk: sprd: composite: Simplify determine_rate implementation
The sprd_div_helper_round_rate() function calls divider_round_rate() which calls divider_round_rate_parent() which calls divider_determine_rate(). This call chain converts back and forth from the rate request structure to make a determine_rate clk_op fit with a round_rate clk_op. Simplify the code here by directly calling divider_determine_rate() instead.
This fixes a smatch warning where an unsigned long is compared to less than zero, which is impossible. This makes sprd_div_helper_round_rate() unnecessary as well so simply remove it and fold it into the only caller left.
Reported-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Closes: https://lore.kernel.org/r/45fdc54e-7ab6-edd6-d55a-473485608473@oracle.com Cc: Maxime Ripard <maxime@cerno.tech> Fixes: 302d2f836d78 ("clk: sprd: composite: Switch to determine_rate") Signed-off-by: Stephen Boyd <sboyd@kernel.org> Link: https://lore.kernel.org/r/20230613195443.1555132-1-sboyd@kernel.org Reviewed-by: Maxime Ripard <mripard@kernel.org>
show more ...
|
2c1c9696 | 27-May-2020 |
Chunyan Zhang <chunyan.zhang@unisoc.com> |
clk: sprd: add mipi_csi_xx gate clocks
mipi_csi_xx clocks are used by camera sensors.
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Link: https://lkml.kernel.org/r/20200527053638.31439-5-
clk: sprd: add mipi_csi_xx gate clocks
mipi_csi_xx clocks are used by camera sensors.
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Link: https://lkml.kernel.org/r/20200527053638.31439-5-zhang.lyra@gmail.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
show more ...
|
8b4f6b8d | 27-May-2020 |
Chunyan Zhang <chunyan.zhang@unisoc.com> |
clk: sprd: check its parent status before reading gate clock
Some clocks only can be accessed if their parent is enabled. mipi_csi_xx clocks on SC9863A are an examples. We have to ensure the parent
clk: sprd: check its parent status before reading gate clock
Some clocks only can be accessed if their parent is enabled. mipi_csi_xx clocks on SC9863A are an examples. We have to ensure the parent clock is enabled when reading those clocks.
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Link: https://lkml.kernel.org/r/20200527053638.31439-2-zhang.lyra@gmail.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
show more ...
|
c2f30986 | 18-May-2020 |
Chunyan Zhang <chunyan.zhang@unisoc.com> |
clk: sprd: return correct type of value for _sprd_pll_recalc_rate
The function _sprd_pll_recalc_rate() defines return value to unsigned long, but it would return a negative value when malloc fail, c
clk: sprd: return correct type of value for _sprd_pll_recalc_rate
The function _sprd_pll_recalc_rate() defines return value to unsigned long, but it would return a negative value when malloc fail, changing to return its parent_rate makes more sense, since if the callback .recalc_rate() is not set, the framework returns the parent_rate as well.
Fixes: 3e37b005580b ("clk: sprd: add adjustable pll support") Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Link: https://lkml.kernel.org/r/20200519030036.1785-2-zhang.lyra@gmail.com Reviewed-by: Baolin Wang <baolin.wang7@gmail.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
show more ...
|
39d1c906 | 29-Mar-2020 |
Chunyan Zhang <chunyan.zhang@unisoc.com> |
clk: sprd: fix to get a correct ibias of pll
The current driver is getting a wrong ibias index of pll clocks from number 1. This patch fix that issue, then getting ibias index from 0.
Fixes: 3e37b0
clk: sprd: fix to get a correct ibias of pll
The current driver is getting a wrong ibias index of pll clocks from number 1. This patch fix that issue, then getting ibias index from 0.
Fixes: 3e37b005580b ("clk: sprd: add adjustable pll support") Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Link: https://lkml.kernel.org/r/20200330021640.14133-1-zhang.lyra@gmail.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
show more ...
|
0e4b8a23 | 04-Mar-2020 |
Chunyan Zhang <chunyan.zhang@unisoc.com> |
clk: sprd: add clocks support for SC9863A
Add the list of clocks for the Unisoc SC9863A, along with clock initialization.
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Link: https://lkml.
clk: sprd: add clocks support for SC9863A
Add the list of clocks for the Unisoc SC9863A, along with clock initialization.
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Link: https://lkml.kernel.org/r/20200304072730.9193-8-zhang.lyra@gmail.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
show more ...
|
f95e8c79 | 04-Mar-2020 |
Chunyan Zhang <chunyan.zhang@unisoc.com> |
clk: sprd: support to get regmap from parent node
Some SC9863a clock nodes would be the child of a syscon node, clocks can use the regmap of syscon device directly for this kind of cases.
Signed-of
clk: sprd: support to get regmap from parent node
Some SC9863a clock nodes would be the child of a syscon node, clocks can use the regmap of syscon device directly for this kind of cases.
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Link: https://lkml.kernel.org/r/20200304072730.9193-7-zhang.lyra@gmail.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
show more ...
|
ea8ca310 | 04-Mar-2020 |
Chunyan Zhang <chunyan.zhang@unisoc.com> |
clk: sprd: Add macros for referencing parents without strings
With the new clk parenting code, clk_init_data was expanded to include .parent_hws and .parent_data, for clk drivers to specify parents
clk: sprd: Add macros for referencing parents without strings
With the new clk parenting code, clk_init_data was expanded to include .parent_hws and .parent_data, for clk drivers to specify parents without name strings of clocks.
Also some macros were added for using these two items to reference clock parents. Based on that to expand macros for sprd clocks:
- SPRD_*_DATA, take an array of struct clk_parent_data * as its parents which should be a combination of .fw_name (devicetree clock-names), .hw (pointers to a local struct clk_hw).
- SPRD_*_HW, take a local struct clk_hw pointer, instead of a string, as its parent.
- SPRD_*_FW_NAME, take a string of clock-names decleared in the device tree as the clock parent.
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Link: https://lkml.kernel.org/r/20200304072730.9193-6-zhang.lyra@gmail.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
show more ...
|
c974c48d | 21-May-2019 |
Chunyan Zhang <zhang.chunyan@linaro.org> |
clk: sprd: Add check for return value of sprd_clk_regmap_init()
sprd_clk_regmap_init() doesn't always return success, adding check for its return value should make the code more strong.
Signed-off-
clk: sprd: Add check for return value of sprd_clk_regmap_init()
sprd_clk_regmap_init() doesn't always return success, adding check for its return value should make the code more strong.
Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org> Reviewed-by: Baolin Wang <baolin.wang@linaro.org> [sboyd@kernel.org: Add a missing int ret] Signed-off-by: Stephen Boyd <sboyd@kernel.org>
show more ...
|