Skip to content

Commit 3538a2c

Browse files
abresticTomasz Figa
authored andcommitted
clk: exynos-audss: add support for Exynos 5420
The AudioSS block on Exynos 5420 has an additional clock gate for the ADMA bus clock. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Acked-by: Mike Turquette <mturquette@linaro.org> Acked-by: Kukjin Kim <kgene.kim@samsung.com> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
1 parent c08ceea commit 3538a2c

File tree

3 files changed

+40
-10
lines changed

3 files changed

+40
-10
lines changed

Documentation/devicetree/bindings/clock/clk-exynos-audss.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ Required Properties:
88

99
- compatible: should be one of the following:
1010
- "samsung,exynos4210-audss-clock" - controller compatible with all Exynos4 SoCs.
11-
- "samsung,exynos5250-audss-clock" - controller compatible with all Exynos5 SoCs.
12-
11+
- "samsung,exynos5250-audss-clock" - controller compatible with Exynos5250
12+
SoCs.
13+
- "samsung,exynos5420-audss-clock" - controller compatible with Exynos5420
14+
SoCs.
1315
- reg: physical base address and length of the controller's register set.
1416

1517
- #clock-cells: should be 1.
@@ -49,6 +51,7 @@ i2s_bus 6
4951
sclk_i2s 7
5052
pcm_bus 8
5153
sclk_pcm 9
54+
adma 10 Exynos5420
5255

5356
Example 1: An example of a clock controller node using the default input
5457
clock names is listed below.

drivers/clk/samsung/clk-exynos-audss.c

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919

2020
#include <dt-bindings/clk/exynos-audss-clk.h>
2121

22+
enum exynos_audss_clk_type {
23+
TYPE_EXYNOS4210,
24+
TYPE_EXYNOS5250,
25+
TYPE_EXYNOS5420,
26+
};
27+
2228
static DEFINE_SPINLOCK(lock);
2329
static struct clk **clk_table;
2430
static void __iomem *reg_base;
@@ -59,6 +65,16 @@ static struct syscore_ops exynos_audss_clk_syscore_ops = {
5965
};
6066
#endif /* CONFIG_PM_SLEEP */
6167

68+
static const struct of_device_id exynos_audss_clk_of_match[] = {
69+
{ .compatible = "samsung,exynos4210-audss-clock",
70+
.data = (void *)TYPE_EXYNOS4210, },
71+
{ .compatible = "samsung,exynos5250-audss-clock",
72+
.data = (void *)TYPE_EXYNOS5250, },
73+
{ .compatible = "samsung,exynos5420-audss-clock",
74+
.data = (void *)TYPE_EXYNOS5420, },
75+
{},
76+
};
77+
6278
/* register exynos_audss clocks */
6379
static int exynos_audss_clk_probe(struct platform_device *pdev)
6480
{
@@ -68,6 +84,13 @@ static int exynos_audss_clk_probe(struct platform_device *pdev)
6884
const char *mout_i2s_p[] = {"mout_audss", "cdclk0", "sclk_audio0"};
6985
const char *sclk_pcm_p = "sclk_pcm0";
7086
struct clk *pll_ref, *pll_in, *cdclk, *sclk_audio, *sclk_pcm_in;
87+
const struct of_device_id *match;
88+
enum exynos_audss_clk_type variant;
89+
90+
match = of_match_node(exynos_audss_clk_of_match, pdev->dev.of_node);
91+
if (!match)
92+
return -EINVAL;
93+
variant = (enum exynos_audss_clk_type)match->data;
7194

7295
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
7396
reg_base = devm_ioremap_resource(&pdev->dev, res);
@@ -83,7 +106,10 @@ static int exynos_audss_clk_probe(struct platform_device *pdev)
83106
return -ENOMEM;
84107

85108
clk_data.clks = clk_table;
86-
clk_data.clk_num = EXYNOS_AUDSS_MAX_CLKS;
109+
if (variant == TYPE_EXYNOS5420)
110+
clk_data.clk_num = EXYNOS_AUDSS_MAX_CLKS;
111+
else
112+
clk_data.clk_num = EXYNOS_AUDSS_MAX_CLKS - 1;
87113

88114
pll_ref = devm_clk_get(&pdev->dev, "pll_ref");
89115
pll_in = devm_clk_get(&pdev->dev, "pll_in");
@@ -142,6 +168,12 @@ static int exynos_audss_clk_probe(struct platform_device *pdev)
142168
sclk_pcm_p, CLK_SET_RATE_PARENT,
143169
reg_base + ASS_CLK_GATE, 5, 0, &lock);
144170

171+
if (variant == TYPE_EXYNOS5420) {
172+
clk_table[EXYNOS_ADMA] = clk_register_gate(NULL, "adma",
173+
"dout_srp", CLK_SET_RATE_PARENT,
174+
reg_base + ASS_CLK_GATE, 9, 0, &lock);
175+
}
176+
145177
for (i = 0; i < clk_data.clk_num; i++) {
146178
if (IS_ERR(clk_table[i])) {
147179
dev_err(&pdev->dev, "failed to register clock %d\n", i);
@@ -188,12 +220,6 @@ static int exynos_audss_clk_remove(struct platform_device *pdev)
188220
return 0;
189221
}
190222

191-
static const struct of_device_id exynos_audss_clk_of_match[] = {
192-
{ .compatible = "samsung,exynos4210-audss-clock", },
193-
{ .compatible = "samsung,exynos5250-audss-clock", },
194-
{},
195-
};
196-
197223
static struct platform_driver exynos_audss_clk_driver = {
198224
.driver = {
199225
.name = "exynos-audss-clk",

include/dt-bindings/clk/exynos-audss-clk.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
#define EXYNOS_SCLK_I2S 7
2020
#define EXYNOS_PCM_BUS 8
2121
#define EXYNOS_SCLK_PCM 9
22+
#define EXYNOS_ADMA 10
2223

23-
#define EXYNOS_AUDSS_MAX_CLKS 10
24+
#define EXYNOS_AUDSS_MAX_CLKS 11
2425

2526
#endif

0 commit comments

Comments
 (0)