* [PATCH 1/2] clk: mediatek: clk-gate: Shrink by adding clockgating bit check helper
@ 2022-01-03 14:37 AngeloGioacchino Del Regno
2022-01-03 14:37 ` [PATCH 2/2] clk: mediatek: clk-gate: Use regmap_{set/clear}_bits helpers AngeloGioacchino Del Regno
2022-01-07 2:27 ` [PATCH 1/2] clk: mediatek: clk-gate: Shrink by adding clockgating bit check helper Stephen Boyd
0 siblings, 2 replies; 5+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-03 14:37 UTC (permalink / raw)
To: mturquette
Cc: sboyd, matthias.bgg, angelogioacchino.delregno, miles.chen,
linux-clk, linux-kernel, linux-arm-kernel, linux-mediatek,
kernel
Add a clockgating bit check helper and use it in functions
mtk_cg_bit_is_cleared(), mtk_cg_bit_is_set() to shrink the
file size.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/clk/mediatek/clk-gate.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/clk/mediatek/clk-gate.c b/drivers/clk/mediatek/clk-gate.c
index b02d2f74dd0d..957fa1d68f07 100644
--- a/drivers/clk/mediatek/clk-gate.c
+++ b/drivers/clk/mediatek/clk-gate.c
@@ -16,28 +16,24 @@
#include "clk-mtk.h"
#include "clk-gate.h"
-static int mtk_cg_bit_is_cleared(struct clk_hw *hw)
+static u32 mtk_get_clockgating(struct clk_hw *hw)
{
struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
u32 val;
regmap_read(cg->regmap, cg->sta_ofs, &val);
- val &= BIT(cg->bit);
+ return val & BIT(cg->bit);
+}
- return val == 0;
+static int mtk_cg_bit_is_cleared(struct clk_hw *hw)
+{
+ return mtk_get_clockgating(hw) == 0;
}
static int mtk_cg_bit_is_set(struct clk_hw *hw)
{
- struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
- u32 val;
-
- regmap_read(cg->regmap, cg->sta_ofs, &val);
-
- val &= BIT(cg->bit);
-
- return val != 0;
+ return mtk_get_clockgating(hw) != 0;
}
static void mtk_cg_set_bit(struct clk_hw *hw)
--
2.33.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] clk: mediatek: clk-gate: Use regmap_{set/clear}_bits helpers
2022-01-03 14:37 [PATCH 1/2] clk: mediatek: clk-gate: Shrink by adding clockgating bit check helper AngeloGioacchino Del Regno
@ 2022-01-03 14:37 ` AngeloGioacchino Del Regno
2022-01-04 8:06 ` Chen-Yu Tsai
2022-01-07 2:27 ` Stephen Boyd
2022-01-07 2:27 ` [PATCH 1/2] clk: mediatek: clk-gate: Shrink by adding clockgating bit check helper Stephen Boyd
1 sibling, 2 replies; 5+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-01-03 14:37 UTC (permalink / raw)
To: mturquette
Cc: sboyd, matthias.bgg, angelogioacchino.delregno, miles.chen,
linux-clk, linux-kernel, linux-arm-kernel, linux-mediatek,
kernel
Appropriately change calls to regmap_update_bits() with regmap_set_bits()
and regmap_clear_bits() for improved readability.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/clk/mediatek/clk-gate.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/mediatek/clk-gate.c b/drivers/clk/mediatek/clk-gate.c
index 957fa1d68f07..5d88b428565b 100644
--- a/drivers/clk/mediatek/clk-gate.c
+++ b/drivers/clk/mediatek/clk-gate.c
@@ -53,17 +53,15 @@ static void mtk_cg_clr_bit(struct clk_hw *hw)
static void mtk_cg_set_bit_no_setclr(struct clk_hw *hw)
{
struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
- u32 cgbit = BIT(cg->bit);
- regmap_update_bits(cg->regmap, cg->sta_ofs, cgbit, cgbit);
+ regmap_set_bits(cg->regmap, cg->sta_ofs, BIT(cg->bit));
}
static void mtk_cg_clr_bit_no_setclr(struct clk_hw *hw)
{
struct mtk_clk_gate *cg = to_mtk_clk_gate(hw);
- u32 cgbit = BIT(cg->bit);
- regmap_update_bits(cg->regmap, cg->sta_ofs, cgbit, 0);
+ regmap_clear_bits(cg->regmap, cg->sta_ofs, BIT(cg->bit));
}
static int mtk_cg_enable(struct clk_hw *hw)
--
2.33.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] clk: mediatek: clk-gate: Use regmap_{set/clear}_bits helpers
2022-01-03 14:37 ` [PATCH 2/2] clk: mediatek: clk-gate: Use regmap_{set/clear}_bits helpers AngeloGioacchino Del Regno
@ 2022-01-04 8:06 ` Chen-Yu Tsai
2022-01-07 2:27 ` Stephen Boyd
1 sibling, 0 replies; 5+ messages in thread
From: Chen-Yu Tsai @ 2022-01-04 8:06 UTC (permalink / raw)
To: AngeloGioacchino Del Regno
Cc: mturquette, sboyd, matthias.bgg, miles.chen, linux-clk,
linux-kernel, linux-arm-kernel, linux-mediatek, kernel
On Mon, Jan 3, 2022 at 10:38 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Appropriately change calls to regmap_update_bits() with regmap_set_bits()
> and regmap_clear_bits() for improved readability.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] clk: mediatek: clk-gate: Shrink by adding clockgating bit check helper
2022-01-03 14:37 [PATCH 1/2] clk: mediatek: clk-gate: Shrink by adding clockgating bit check helper AngeloGioacchino Del Regno
2022-01-03 14:37 ` [PATCH 2/2] clk: mediatek: clk-gate: Use regmap_{set/clear}_bits helpers AngeloGioacchino Del Regno
@ 2022-01-07 2:27 ` Stephen Boyd
1 sibling, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2022-01-07 2:27 UTC (permalink / raw)
To: AngeloGioacchino Del Regno, mturquette
Cc: matthias.bgg, angelogioacchino.delregno, miles.chen, linux-clk,
linux-kernel, linux-arm-kernel, linux-mediatek, kernel
Quoting AngeloGioacchino Del Regno (2022-01-03 06:37:11)
> Add a clockgating bit check helper and use it in functions
> mtk_cg_bit_is_cleared(), mtk_cg_bit_is_set() to shrink the
> file size.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] clk: mediatek: clk-gate: Use regmap_{set/clear}_bits helpers
2022-01-03 14:37 ` [PATCH 2/2] clk: mediatek: clk-gate: Use regmap_{set/clear}_bits helpers AngeloGioacchino Del Regno
2022-01-04 8:06 ` Chen-Yu Tsai
@ 2022-01-07 2:27 ` Stephen Boyd
1 sibling, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2022-01-07 2:27 UTC (permalink / raw)
To: AngeloGioacchino Del Regno, mturquette
Cc: matthias.bgg, angelogioacchino.delregno, miles.chen, linux-clk,
linux-kernel, linux-arm-kernel, linux-mediatek, kernel
Quoting AngeloGioacchino Del Regno (2022-01-03 06:37:12)
> Appropriately change calls to regmap_update_bits() with regmap_set_bits()
> and regmap_clear_bits() for improved readability.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-07 2:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-03 14:37 [PATCH 1/2] clk: mediatek: clk-gate: Shrink by adding clockgating bit check helper AngeloGioacchino Del Regno
2022-01-03 14:37 ` [PATCH 2/2] clk: mediatek: clk-gate: Use regmap_{set/clear}_bits helpers AngeloGioacchino Del Regno
2022-01-04 8:06 ` Chen-Yu Tsai
2022-01-07 2:27 ` Stephen Boyd
2022-01-07 2:27 ` [PATCH 1/2] clk: mediatek: clk-gate: Shrink by adding clockgating bit check helper Stephen Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).