diff options
author | Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com> | 2018-03-16 03:08:13 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-03-18 20:57:54 -0400 |
commit | 7c3c20f2bec1e8bdaadd551a4b75f1834a7cb974 (patch) | |
tree | 020714b15ea8c8d115f43396bacc7b5edf33d676 | |
parent | 8bde8fd64d1b8f8bc1577e28ff412553597b6adb (diff) |
ASoC: uniphier: add syscon property for UniPhier sound system
This patch adds syscon property for specifying soc-glue core.
Currently, soc-glue core is used for changing the state of S/PDIF
signal output pin to signal output state or Hi-Z state. After
resetting of SoC Hi-Z state is selected. This driver set to signal
output state when syscon property is available.
Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/uniphier/aio-core.c | 21 | ||||
-rw-r--r-- | sound/soc/uniphier/aio-cpu.c | 11 | ||||
-rw-r--r-- | sound/soc/uniphier/aio-reg.h | 3 | ||||
-rw-r--r-- | sound/soc/uniphier/aio.h | 2 |
4 files changed, 37 insertions, 0 deletions
diff --git a/sound/soc/uniphier/aio-core.c b/sound/soc/uniphier/aio-core.c index 1711361fc0c2..6d50042a4571 100644 --- a/sound/soc/uniphier/aio-core.c +++ b/sound/soc/uniphier/aio-core.c | |||
@@ -84,6 +84,27 @@ u64 aio_rb_space_to_end(struct uniphier_aio_sub *sub) | |||
84 | } | 84 | } |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * aio_iecout_set_enable - setup IEC output via SoC glue | ||
88 | * @chip: the AIO chip pointer | ||
89 | * @enable: false to stop the output, true to start | ||
90 | * | ||
91 | * Set enabled or disabled S/PDIF signal output to out of SoC via AOnIEC pins. | ||
92 | * This function need to call at driver startup. | ||
93 | * | ||
94 | * The regmap of SoC glue is specified by 'socionext,syscon' optional property | ||
95 | * of DT. This function has no effect if no property. | ||
96 | */ | ||
97 | void aio_iecout_set_enable(struct uniphier_aio_chip *chip, bool enable) | ||
98 | { | ||
99 | struct regmap *r = chip->regmap_sg; | ||
100 | |||
101 | if (!r) | ||
102 | return; | ||
103 | |||
104 | regmap_write(r, SG_AOUTEN, (enable) ? ~0 : 0); | ||
105 | } | ||
106 | |||
107 | /** | ||
87 | * aio_chip_set_pll - set frequency to audio PLL | 108 | * aio_chip_set_pll - set frequency to audio PLL |
88 | * @chip : the AIO chip pointer | 109 | * @chip : the AIO chip pointer |
89 | * @source: PLL | 110 | * @source: PLL |
diff --git a/sound/soc/uniphier/aio-cpu.c b/sound/soc/uniphier/aio-cpu.c index 7cf2316c69a2..1e5eb8e6f8c7 100644 --- a/sound/soc/uniphier/aio-cpu.c +++ b/sound/soc/uniphier/aio-cpu.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
21 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/mfd/syscon.h> | ||
23 | #include <linux/module.h> | 24 | #include <linux/module.h> |
24 | #include <linux/of.h> | 25 | #include <linux/of.h> |
25 | #include <linux/of_platform.h> | 26 | #include <linux/of_platform.h> |
@@ -387,6 +388,7 @@ int uniphier_aio_dai_probe(struct snd_soc_dai *dai) | |||
387 | sub->spec = spec; | 388 | sub->spec = spec; |
388 | } | 389 | } |
389 | 390 | ||
391 | aio_iecout_set_enable(aio->chip, true); | ||
390 | aio_chip_init(aio->chip); | 392 | aio_chip_init(aio->chip); |
391 | aio->chip->active = 1; | 393 | aio->chip->active = 1; |
392 | 394 | ||
@@ -431,6 +433,7 @@ int uniphier_aio_dai_resume(struct snd_soc_dai *dai) | |||
431 | if (ret) | 433 | if (ret) |
432 | goto err_out_clock; | 434 | goto err_out_clock; |
433 | 435 | ||
436 | aio_iecout_set_enable(aio->chip, true); | ||
434 | aio_chip_init(aio->chip); | 437 | aio_chip_init(aio->chip); |
435 | 438 | ||
436 | for (i = 0; i < ARRAY_SIZE(aio->sub); i++) { | 439 | for (i = 0; i < ARRAY_SIZE(aio->sub); i++) { |
@@ -477,6 +480,14 @@ int uniphier_aio_probe(struct platform_device *pdev) | |||
477 | if (!chip->chip_spec) | 480 | if (!chip->chip_spec) |
478 | return -EINVAL; | 481 | return -EINVAL; |
479 | 482 | ||
483 | chip->regmap_sg = syscon_regmap_lookup_by_phandle(dev->of_node, | ||
484 | "socionext,syscon"); | ||
485 | if (IS_ERR(chip->regmap_sg)) { | ||
486 | if (PTR_ERR(chip->regmap_sg) == -EPROBE_DEFER) | ||
487 | return -EPROBE_DEFER; | ||
488 | chip->regmap_sg = NULL; | ||
489 | } | ||
490 | |||
480 | chip->clk = devm_clk_get(dev, "aio"); | 491 | chip->clk = devm_clk_get(dev, "aio"); |
481 | if (IS_ERR(chip->clk)) | 492 | if (IS_ERR(chip->clk)) |
482 | return PTR_ERR(chip->clk); | 493 | return PTR_ERR(chip->clk); |
diff --git a/sound/soc/uniphier/aio-reg.h b/sound/soc/uniphier/aio-reg.h index eaf2c65acf14..136d3563cf44 100644 --- a/sound/soc/uniphier/aio-reg.h +++ b/sound/soc/uniphier/aio-reg.h | |||
@@ -23,6 +23,9 @@ | |||
23 | 23 | ||
24 | #include <linux/bitops.h> | 24 | #include <linux/bitops.h> |
25 | 25 | ||
26 | /* soc-glue */ | ||
27 | #define SG_AOUTEN 0x1c04 | ||
28 | |||
26 | /* SW view */ | 29 | /* SW view */ |
27 | #define A2CHNMAPCTR0(n) (0x00000 + 0x40 * (n)) | 30 | #define A2CHNMAPCTR0(n) (0x00000 + 0x40 * (n)) |
28 | #define A2RBNMAPCTR0(n) (0x01000 + 0x40 * (n)) | 31 | #define A2RBNMAPCTR0(n) (0x01000 + 0x40 * (n)) |
diff --git a/sound/soc/uniphier/aio.h b/sound/soc/uniphier/aio.h index 793334675cb3..8cab4a553a97 100644 --- a/sound/soc/uniphier/aio.h +++ b/sound/soc/uniphier/aio.h | |||
@@ -296,6 +296,7 @@ struct uniphier_aio_chip { | |||
296 | struct clk *clk; | 296 | struct clk *clk; |
297 | struct reset_control *rst; | 297 | struct reset_control *rst; |
298 | struct regmap *regmap; | 298 | struct regmap *regmap; |
299 | struct regmap *regmap_sg; | ||
299 | int active; | 300 | int active; |
300 | }; | 301 | }; |
301 | 302 | ||
@@ -323,6 +324,7 @@ u64 aio_rbt_cnt_to_end(struct uniphier_aio_sub *sub); | |||
323 | u64 aio_rb_space(struct uniphier_aio_sub *sub); | 324 | u64 aio_rb_space(struct uniphier_aio_sub *sub); |
324 | u64 aio_rb_space_to_end(struct uniphier_aio_sub *sub); | 325 | u64 aio_rb_space_to_end(struct uniphier_aio_sub *sub); |
325 | 326 | ||
327 | void aio_iecout_set_enable(struct uniphier_aio_chip *chip, bool enable); | ||
326 | int aio_chip_set_pll(struct uniphier_aio_chip *chip, int pll_id, | 328 | int aio_chip_set_pll(struct uniphier_aio_chip *chip, int pll_id, |
327 | unsigned int freq); | 329 | unsigned int freq); |
328 | void aio_chip_init(struct uniphier_aio_chip *chip); | 330 | void aio_chip_init(struct uniphier_aio_chip *chip); |