diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-01-23 20:43:19 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-01-26 06:25:47 -0500 |
commit | f17c13ca52d5c5a6a164536244a6debb8cd17983 (patch) | |
tree | a3a9a1fd3a0ed7cf1bb49f6c8c8591826fa58940 /include | |
parent | d7c5762bc72ea4184c413166c063899dffae7385 (diff) |
ASoC: sh: fsi: modify selection method of I2S/PCM/SPDIF format
Current format selection of FSI-codecs depended on platform information for FSI,
and chip default settings for codecs. It is not understandable/formal method.
This patch modify FSI and FSI-codecs to use snd_soc_dai_set_fmt.
But FSI can use I2S/PCM and SPDIF format today.
It can be selected to I2S/PCM by snd_soc_dai_set_fmt, but can not select SPDIF.
So, this patch change FSI platform information to have DAI/SPDIF mode.
If platform selects DAI mode (default),
FSI-codecs can select I2S/PCM by snd_soc_dai_set_fmt,
and if it is SPDIF mode, FSI become SPDIF format.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/sound/sh_fsi.h | 70 |
1 files changed, 19 insertions, 51 deletions
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h index 18e43279f70f..9a155f9d0a12 100644 --- a/include/sound/sh_fsi.h +++ b/include/sound/sh_fsi.h | |||
@@ -15,61 +15,29 @@ | |||
15 | #define FSI_PORT_A 0 | 15 | #define FSI_PORT_A 0 |
16 | #define FSI_PORT_B 1 | 16 | #define FSI_PORT_B 1 |
17 | 17 | ||
18 | /* flags format | ||
19 | |||
20 | * 0xABC0EEFF | ||
21 | * | ||
22 | * A: channel size for TDM (input) | ||
23 | * B: channel size for TDM (ooutput) | ||
24 | * C: inversion | ||
25 | * E: input format | ||
26 | * F: output format | ||
27 | */ | ||
28 | |||
29 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
30 | #include <sound/soc.h> | 19 | #include <sound/soc.h> |
31 | 20 | ||
32 | /* TDM channel */ | 21 | /* |
33 | #define SH_FSI_SET_CH_I(x) ((x & 0xF) << 28) | 22 | * flags format |
34 | #define SH_FSI_SET_CH_O(x) ((x & 0xF) << 24) | 23 | * |
35 | 24 | * 0x000000BA | |
36 | #define SH_FSI_CH_IMASK 0xF0000000 | 25 | * |
37 | #define SH_FSI_CH_OMASK 0x0F000000 | 26 | * A: inversion |
38 | #define SH_FSI_GET_CH_I(x) ((x & SH_FSI_CH_IMASK) >> 28) | 27 | * B: format mode |
39 | #define SH_FSI_GET_CH_O(x) ((x & SH_FSI_CH_OMASK) >> 24) | 28 | */ |
40 | |||
41 | /* clock inversion */ | ||
42 | #define SH_FSI_INVERSION_MASK 0x00F00000 | ||
43 | #define SH_FSI_LRM_INV (1 << 20) | ||
44 | #define SH_FSI_BRM_INV (1 << 21) | ||
45 | #define SH_FSI_LRS_INV (1 << 22) | ||
46 | #define SH_FSI_BRS_INV (1 << 23) | ||
47 | |||
48 | /* DI format */ | ||
49 | #define SH_FSI_FMT_MASK 0x000000FF | ||
50 | #define SH_FSI_IFMT(x) (((SH_FSI_FMT_ ## x) & SH_FSI_FMT_MASK) << 8) | ||
51 | #define SH_FSI_OFMT(x) (((SH_FSI_FMT_ ## x) & SH_FSI_FMT_MASK) << 0) | ||
52 | #define SH_FSI_GET_IFMT(x) ((x >> 8) & SH_FSI_FMT_MASK) | ||
53 | #define SH_FSI_GET_OFMT(x) ((x >> 0) & SH_FSI_FMT_MASK) | ||
54 | |||
55 | #define SH_FSI_FMT_MONO 0 | ||
56 | #define SH_FSI_FMT_MONO_DELAY 1 | ||
57 | #define SH_FSI_FMT_PCM 2 | ||
58 | #define SH_FSI_FMT_I2S 3 | ||
59 | #define SH_FSI_FMT_TDM 4 | ||
60 | #define SH_FSI_FMT_TDM_DELAY 5 | ||
61 | #define SH_FSI_FMT_SPDIF 6 | ||
62 | |||
63 | |||
64 | #define SH_FSI_IFMT_TDM_CH(x) \ | ||
65 | (SH_FSI_IFMT(TDM) | SH_FSI_SET_CH_I(x)) | ||
66 | #define SH_FSI_IFMT_TDM_DELAY_CH(x) \ | ||
67 | (SH_FSI_IFMT(TDM_DELAY) | SH_FSI_SET_CH_I(x)) | ||
68 | 29 | ||
69 | #define SH_FSI_OFMT_TDM_CH(x) \ | 30 | /* A: clock inversion */ |
70 | (SH_FSI_OFMT(TDM) | SH_FSI_SET_CH_O(x)) | 31 | #define SH_FSI_INVERSION_MASK 0x0000000F |
71 | #define SH_FSI_OFMT_TDM_DELAY_CH(x) \ | 32 | #define SH_FSI_LRM_INV (1 << 0) |
72 | (SH_FSI_OFMT(TDM_DELAY) | SH_FSI_SET_CH_O(x)) | 33 | #define SH_FSI_BRM_INV (1 << 1) |
34 | #define SH_FSI_LRS_INV (1 << 2) | ||
35 | #define SH_FSI_BRS_INV (1 << 3) | ||
36 | |||
37 | /* B: format mode */ | ||
38 | #define SH_FSI_FMT_MASK 0x000000F0 | ||
39 | #define SH_FSI_FMT_DAI (0 << 4) | ||
40 | #define SH_FSI_FMT_SPDIF (1 << 4) | ||
73 | 41 | ||
74 | 42 | ||
75 | /* | 43 | /* |