[alsa-devel] [PATCH V2 0/8] Add audio support on smdk5420
Samsung has different versions of I2S introduced in different platforms. Each version has some new support added for multichannel, secondary fifo, s/w reset control, internal mux for rclk src clk and tdm support. Each newly added change has a quirk. So this patch adds all the required quirks as driver data and based on compatible string from dtsi fetches the quirks. This also adds i2s support on exynos5420 and make relevent changes in the dtsi files.
Changes since V1: - Pass quirks as driver data and fetch the quirks based on compatible string from dtsi file as suggested by Tomasz Figa and Mark Brown - Make the I2S driver more flexible with respect to register access as suggested by Tomasz Figa and Mark Brown - Add 5420 support in the driver. - Modify the dtsi files with the corresponding compatible strings and removed the i2s quirks from 5250 dtsi file. - Updated the i2s Documentation with relevent changes and i2s versioning info. - Add i2s nodes on exynos5420.dtsi - Enable sound support on smdk5420
This patch set is dependent on the following dma and audio subsystem clk controller patches. http://comments.gmane.org/gmane.linux.kernel.samsung-soc/20661 http://comments.gmane.org/gmane.linux.kernel.samsung-soc/20668
This patch set is made based on Kukjin Kim for-next branch.
Andrew Bresticker (1): ARM: dts: exynos5420: add i2s controllers
Padmavathi Venna (7): platform: Increase platform name size ASoC: Samsung: I2S: Add quirks as driver data in I2S ARM: dts: Change i2s compatible string on exynos5250 ASoC: Samsung: I2S: Modify driver to give more flexibility ASoC: Samsung: I2S: Modify the I2S driver to support I2S on Exynos5420 ARM: dts: wm8994: Add wm8994 support on smdk5420 ARM: dts: Enable sound support on smdk5420
.../devicetree/bindings/sound/samsung-i2s.txt | 25 ++- arch/arm/boot/dts/exynos5250.dtsi | 9 +- arch/arm/boot/dts/exynos5420-smdk5420.dts | 60 ++++++ arch/arm/boot/dts/exynos5420.dtsi | 44 +++++ include/linux/mod_devicetable.h | 2 +- include/linux/platform_data/asoc-s3c.h | 1 + sound/soc/samsung/i2s-regs.h | 51 ++++-- sound/soc/samsung/i2s.c | 205 +++++++++++++++----- 8 files changed, 312 insertions(+), 85 deletions(-)
This patch increases the platform name size from 20 to 30.
Signed-off-by: Padmavathi Venna padma.v@samsung.com --- include/linux/mod_devicetable.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index b62d4af..f67b5d5 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -478,7 +478,7 @@ struct dmi_system_id { #define DMI_MATCH(a, b) { .slot = a, .substr = b } #define DMI_EXACT_MATCH(a, b) { .slot = a, .substr = b, .exact_match = 1 }
-#define PLATFORM_NAME_SIZE 20 +#define PLATFORM_NAME_SIZE 30 #define PLATFORM_MODULE_PREFIX "platform:"
struct platform_device_id {
Hi Padma,
On 26 July 2013 19:06, Padmavathi Venna padma.v@samsung.com wrote:
This patch increases the platform name size from 20 to 30.
Instead of describing what the patch does (which is quite obvious from the code), it would be useful to describe why this change is required.
Signed-off-by: Padmavathi Venna padma.v@samsung.com
include/linux/mod_devicetable.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index b62d4af..f67b5d5 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -478,7 +478,7 @@ struct dmi_system_id { #define DMI_MATCH(a, b) { .slot = a, .substr = b } #define DMI_EXACT_MATCH(a, b) { .slot = a, .substr = b, .exact_match = 1 }
-#define PLATFORM_NAME_SIZE 20 +#define PLATFORM_NAME_SIZE 30 #define PLATFORM_MODULE_PREFIX "platform:"
struct platform_device_id {
1.7.4.4
-- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Sachin,
On Fri, Jul 26, 2013 at 8:06 PM, Sachin Kamat sachin.kamat@linaro.org wrote:
Hi Padma,
On 26 July 2013 19:06, Padmavathi Venna padma.v@samsung.com wrote:
This patch increases the platform name size from 20 to 30.
Instead of describing what the patch does (which is quite obvious from the code), it would be useful to describe why this change is required.
OK. I will post in my next version.
Signed-off-by: Padmavathi Venna padma.v@samsung.com
include/linux/mod_devicetable.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index b62d4af..f67b5d5 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -478,7 +478,7 @@ struct dmi_system_id { #define DMI_MATCH(a, b) { .slot = a, .substr = b } #define DMI_EXACT_MATCH(a, b) { .slot = a, .substr = b, .exact_match = 1 }
-#define PLATFORM_NAME_SIZE 20 +#define PLATFORM_NAME_SIZE 30 #define PLATFORM_MODULE_PREFIX "platform:"
struct platform_device_id {
1.7.4.4
-- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
-- With warm regards, Sachin
Thanks Padma
Samsung has different versions of I2S introduced in different platforms. Each version has some new support added for multichannel, secondary fifo, s/w reset control and internal mux for rclk src clk. Each newly added change has a quirk. So this patch adds all the required quirks as driver data and based on compatible string from dtsi fetches the quirks.
Signed-off-by: Padmavathi Venna padma.v@samsung.com --- .../devicetree/bindings/sound/samsung-i2s.txt | 21 +++--- sound/soc/samsung/i2s.c | 82 +++++++++++++------- 2 files changed, 64 insertions(+), 39 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/samsung-i2s.txt b/Documentation/devicetree/bindings/sound/samsung-i2s.txt index 025e66b..b3f6443 100644 --- a/Documentation/devicetree/bindings/sound/samsung-i2s.txt +++ b/Documentation/devicetree/bindings/sound/samsung-i2s.txt @@ -2,7 +2,16 @@
Required SoC Specific Properties:
-- compatible : "samsung,i2s-v5" +- compatible : should be one of the following. + - samsung,s3c6410-i2s: for 8/16/24bit stereo I2S. Previous versions + has only 8/16bit support. + - samsung,s3c6410-i2sv4: for 8/16/24bit multichannel(5.1 channel) I2S. + Introduced in s3c6410. This also applicable for s5p64x0 platforms. + - samsung,s5pc100-i2s: for 8/16/24bit multichannel(5.1 channel) I2S + with secondary fifo and s/w reset control. + - samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with + secondary fifo, s/w reset control and internal mux for root clk src. + - reg: physical base address of the controller and length of memory mapped region. - dmas: list of DMA controller phandle and DMA request line ordered pairs. @@ -21,13 +30,6 @@ Required SoC Specific Properties:
Optional SoC Specific Properties:
-- samsung,supports-6ch: If the I2S Primary sound source has 5.1 Channel - support, this flag is enabled. -- samsung,supports-rstclr: This flag should be set if I2S software reset bit - control is required. When this flag is set I2S software reset bit will be - enabled or disabled based on need. -- samsung,supports-secdai:If I2S block has a secondary FIFO and internal DMA, - then this flag is enabled. - samsung,idma-addr: Internal DMA register base address of the audio sub system(used in secondary sound source). - pinctrl-0: Should specify pin control groups used for this controller. @@ -46,9 +48,6 @@ i2s0: i2s@03830000 { <&clock_audss EXYNOS_I2S_BUS>, <&clock_audss EXYNOS_SCLK_I2S>; clock-names = "iis", "i2s_opclk0", "i2s_opclk1"; - samsung,supports-6ch; - samsung,supports-rstclr; - samsung,supports-secdai; samsung,idma-addr = <0x03000000>; pinctrl-names = "default"; pinctrl-0 = <&i2s0_bus>; diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 959c702..f661a98 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -40,6 +40,7 @@ enum samsung_dai_type {
struct samsung_i2s_dai_data { int dai_type; + u32 quirks; };
struct i2s_dai { @@ -1018,18 +1019,18 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
static const struct of_device_id exynos_i2s_match[];
-static inline int samsung_i2s_get_driver_data(struct platform_device *pdev) +static inline struct samsung_i2s_dai_data *samsung_i2s_get_driver_data( + struct platform_device *pdev) { #ifdef CONFIG_OF - struct samsung_i2s_dai_data *data; if (pdev->dev.of_node) { const struct of_device_id *match; match = of_match_node(exynos_i2s_match, pdev->dev.of_node); - data = (struct samsung_i2s_dai_data *) match->data; - return data->dai_type; + return (struct samsung_i2s_dai_data *) match->data; } else #endif - return platform_get_device_id(pdev)->driver_data; + return (struct samsung_i2s_dai_data *) + platform_get_device_id(pdev)->driver_data; }
#ifdef CONFIG_PM_RUNTIME @@ -1060,13 +1061,13 @@ static int samsung_i2s_probe(struct platform_device *pdev) struct resource *res; u32 regs_base, quirks = 0, idma_addr = 0; struct device_node *np = pdev->dev.of_node; - enum samsung_dai_type samsung_dai_type; + struct samsung_i2s_dai_data *i2s_dai_data; int ret = 0;
/* Call during Seconday interface registration */ - samsung_dai_type = samsung_i2s_get_driver_data(pdev); + i2s_dai_data = samsung_i2s_get_driver_data(pdev);
- if (samsung_dai_type == TYPE_SEC) { + if (i2s_dai_data->dai_type == TYPE_SEC) { sec_dai = dev_get_drvdata(&pdev->dev); if (!sec_dai) { dev_err(&pdev->dev, "Unable to get drvdata\n"); @@ -1115,15 +1116,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) idma_addr = i2s_cfg->idma_addr; } } else { - if (of_find_property(np, "samsung,supports-6ch", NULL)) - quirks |= QUIRK_PRI_6CHAN; - - if (of_find_property(np, "samsung,supports-secdai", NULL)) - quirks |= QUIRK_SEC_DAI; - - if (of_find_property(np, "samsung,supports-rstclr", NULL)) - quirks |= QUIRK_NEED_RSTCLR; - + quirks = i2s_dai_data->quirks; if (of_property_read_u32(np, "samsung,idma-addr", &idma_addr)) { if (quirks & QUIRK_SEC_DAI) { @@ -1236,27 +1229,60 @@ static int samsung_i2s_remove(struct platform_device *pdev) return 0; }
+static struct samsung_i2s_dai_data i2sv3_dai_type = { + .dai_type = TYPE_PRI, + .quirks = QUIRK_NO_MUXPSR, +}; + +static struct samsung_i2s_dai_data i2sv4_dai_type = { + .dai_type = TYPE_PRI, + .quirks = QUIRK_PRI_6CHAN | QUIRK_NO_MUXPSR, +}; + +static struct samsung_i2s_dai_data i2sv5_c100_dai_type = { + .dai_type = TYPE_PRI, + .quirks = QUIRK_PRI_6CHAN | QUIRK_NO_MUXPSR | QUIRK_SEC_DAI | + QUIRK_NEED_RSTCLR, +}; + +static struct samsung_i2s_dai_data i2sv5_dai_type = { + .dai_type = TYPE_PRI, + .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR, +}; + +static struct samsung_i2s_dai_data samsung_dai_type_sec = { + .dai_type = TYPE_SEC, +}; + static struct platform_device_id samsung_i2s_driver_ids[] = { { - .name = "samsung-i2s", - .driver_data = TYPE_PRI, + .name = "samsung,s3c6410-i2s", + .driver_data = (kernel_ulong_t)&i2sv3_dai_type, + }, { + .name = "samsung,s3c6410-i2sv4", + .driver_data = (kernel_ulong_t)&i2sv4_dai_type, + }, { + .name = "samsung,s5pc100-i2s", + .driver_data = (kernel_ulong_t)&i2sv5_c100_dai_type, }, { - .name = "samsung-i2s-sec", - .driver_data = TYPE_SEC, + .name = "samsung,s5pv210-i2s", + .driver_data = (kernel_ulong_t)&i2sv5_dai_type, + }, { + .name = "samsung-i2s-sec", + .driver_data = (kernel_ulong_t)&samsung_dai_type_sec, }, {}, }; MODULE_DEVICE_TABLE(platform, samsung_i2s_driver_ids);
#ifdef CONFIG_OF -static struct samsung_i2s_dai_data samsung_i2s_dai_data_array[] = { - [TYPE_PRI] = { TYPE_PRI }, - [TYPE_SEC] = { TYPE_SEC }, -}; - static const struct of_device_id exynos_i2s_match[] = { - { .compatible = "samsung,i2s-v5", - .data = &samsung_i2s_dai_data_array[TYPE_PRI], + { + .compatible = "samsung,s3c6410-i2s", + .data = &i2sv3_dai_type, + }, { + .compatible = "samsung,s5pv210-i2s", + .data = &i2sv5_dai_type, }, {}, };
On Fri, Jul 26, 2013 at 07:06:46PM +0530, Padmavathi Venna wrote:
-- compatible : "samsung,i2s-v5" +- compatible : should be one of the following.
- samsung,s3c6410-i2s: for 8/16/24bit stereo I2S. Previous versions
has only 8/16bit support.
- samsung,s3c6410-i2sv4: for 8/16/24bit multichannel(5.1 channel) I2S.
Introduced in s3c6410. This also applicable for s5p64x0 platforms.
- samsung,s5pc100-i2s: for 8/16/24bit multichannel(5.1 channel) I2S
with secondary fifo and s/w reset control.
- samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with
secondary fifo, s/w reset control and internal mux for root clk src.
So what happens with your changes to everyone who is using a DT file with the "samsung,i2s-v5" compatible string?
Hi Russell,
On Friday 26 of July 2013 15:06:18 Russell King - ARM Linux wrote:
On Fri, Jul 26, 2013 at 07:06:46PM +0530, Padmavathi Venna wrote:
-- compatible : "samsung,i2s-v5" +- compatible : should be one of the following.
- samsung,s3c6410-i2s: for 8/16/24bit stereo I2S. Previous versions
has only 8/16bit support.
- samsung,s3c6410-i2sv4: for 8/16/24bit multichannel(5.1 channel)
I2S. + Introduced in s3c6410. This also applicable for s5p64x0 platforms. + - samsung,s5pc100-i2s: for 8/16/24bit multichannel(5.1 channel) I2S + with secondary fifo and s/w reset control.
- samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with
secondary fifo, s/w reset control and internal mux for root clk
src. +
So what happens with your changes to everyone who is using a DT file with the "samsung,i2s-v5" compatible string?
AFAIK we decided that current bindings, if broken, can be redone correctly, without caring for compatibility with old DTBs and only then, after reviewing these new bindings by DT people, they can be stabilized.
Other issue, though, is that this patch breaks things until they get fixed by patch 3. Support for new bindings should be added first, then users fixed and only then old bindings can be removed.
Best regards, Tomasz
On Fri, Jul 26, 2013 at 04:21:16PM +0200, Tomasz Figa wrote:
Hi Russell,
On Friday 26 of July 2013 15:06:18 Russell King - ARM Linux wrote:
On Fri, Jul 26, 2013 at 07:06:46PM +0530, Padmavathi Venna wrote:
-- compatible : "samsung,i2s-v5" +- compatible : should be one of the following.
- samsung,s3c6410-i2s: for 8/16/24bit stereo I2S. Previous versions
has only 8/16bit support.
- samsung,s3c6410-i2sv4: for 8/16/24bit multichannel(5.1 channel)
I2S. + Introduced in s3c6410. This also applicable for s5p64x0 platforms. + - samsung,s5pc100-i2s: for 8/16/24bit multichannel(5.1 channel) I2S + with secondary fifo and s/w reset control.
- samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with
secondary fifo, s/w reset control and internal mux for root clk
src. +
So what happens with your changes to everyone who is using a DT file with the "samsung,i2s-v5" compatible string?
AFAIK we decided that current bindings, if broken, can be redone correctly, without caring for compatibility with old DTBs and only then, after reviewing these new bindings by DT people, they can be stabilized.
Other issue, though, is that this patch breaks things until they get fixed by patch 3. Support for new bindings should be added first, then users fixed and only then old bindings can be removed.
So, these bindings were merged in the v3.9 merge window, using the "samsung,i2s-v5" compatible string, and now for the v3.12 merge window, you're proposing to break the audio description in any DT file which has been used with v3.9..v3.11 inclusive?
The way you should be doing this is to keep the existing stuff working and supplement it with the new method of describing the hardware.
On Friday 26 of July 2013 15:27:22 Russell King - ARM Linux wrote:
On Fri, Jul 26, 2013 at 04:21:16PM +0200, Tomasz Figa wrote:
Hi Russell,
On Friday 26 of July 2013 15:06:18 Russell King - ARM Linux wrote:
On Fri, Jul 26, 2013 at 07:06:46PM +0530, Padmavathi Venna wrote:
-- compatible : "samsung,i2s-v5" +- compatible : should be one of the following.
- samsung,s3c6410-i2s: for 8/16/24bit stereo I2S. Previous
versions
has only 8/16bit support.
- samsung,s3c6410-i2sv4: for 8/16/24bit multichannel(5.1
channel) I2S. + Introduced in s3c6410. This also applicable for s5p64x0 platforms. + - samsung,s5pc100-i2s: for 8/16/24bit multichannel(5.1 channel) I2S + with secondary fifo and s/w reset control.
- samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S
with
secondary fifo, s/w reset control and internal mux for root
clk src. +
So what happens with your changes to everyone who is using a DT file with the "samsung,i2s-v5" compatible string?
AFAIK we decided that current bindings, if broken, can be redone correctly, without caring for compatibility with old DTBs and only then, after reviewing these new bindings by DT people, they can be stabilized.
Other issue, though, is that this patch breaks things until they get fixed by patch 3. Support for new bindings should be added first, then users fixed and only then old bindings can be removed.
So, these bindings were merged in the v3.9 merge window, using the "samsung,i2s-v5" compatible string, and now for the v3.12 merge window, you're proposing to break the audio description in any DT file which has been used with v3.9..v3.11 inclusive?
It depends whether we want to keep all the broken stuff. At current state dts is still pretty much coupled with kernel version from which it comes from, so there is not yet too late to replace the broken bindings with something acceptable.
The way you should be doing this is to keep the existing stuff working and supplement it with the new method of describing the hardware.
Ideally yes and we are moving towards this with all the plans to separate stable and staging bindings. However we are currently half-drowning in a swamp of broken bindings, so we would rather try to clean the mess ASAP, before things stabilize.
Best regards, Tomasz
On Fri, Jul 26, 2013 at 07:06:46PM +0530, Padmavathi Venna wrote:
Samsung has different versions of I2S introduced in different platforms. Each version has some new support added for multichannel, secondary fifo, s/w reset control and internal mux for rclk src clk. Each newly added change has a quirk. So this patch adds all the required quirks as driver data and based on compatible string from dtsi fetches the quirks.
As Russell indicated you should really keep the old name around, though marking them as deprecated is OK. However I'm not sure anyone will have deployed this so I'm not sure how much it matters - every downstream kernel I've seen was still using board files anyway.
The actual meat of the patch changing to a quirk scheme does look good, though.
-- compatible : "samsung,i2s-v5" +- compatible : should be one of the following.
- samsung,s3c6410-i2s: for 8/16/24bit stereo I2S. Previous versions
has only 8/16bit support.
- samsung,s3c6410-i2sv4: for 8/16/24bit multichannel(5.1 channel) I2S.
Introduced in s3c6410. This also applicable for s5p64x0 platforms.
- samsung,s5pc100-i2s: for 8/16/24bit multichannel(5.1 channel) I2S
with secondary fifo and s/w reset control.
- samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with
secondary fifo, s/w reset control and internal mux for root clk src.
I think the -vN naming scheme was fine - I see where this came from but the main point was about having things identified by a string not switching the naming scheme. As you can see from the s3c6410 stuff the SoC isn't that helpful as a naming scheme as multiple IP versions appear on the same SoC.
On Friday 26 of July 2013 15:53:19 Mark Brown wrote:
On Fri, Jul 26, 2013 at 07:06:46PM +0530, Padmavathi Venna wrote:
Samsung has different versions of I2S introduced in different platforms. Each version has some new support added for multichannel, secondary fifo, s/w reset control and internal mux for rclk src clk. Each newly added change has a quirk. So this patch adds all the required quirks as driver data and based on compatible string from dtsi fetches the quirks.
As Russell indicated you should really keep the old name around, though marking them as deprecated is OK. However I'm not sure anyone will have deployed this so I'm not sure how much it matters - every downstream kernel I've seen was still using board files anyway.
The actual meat of the patch changing to a quirk scheme does look good, though.
-- compatible : "samsung,i2s-v5" +- compatible : should be one of the following.
- samsung,s3c6410-i2s: for 8/16/24bit stereo I2S. Previous versions
has only 8/16bit support.
- samsung,s3c6410-i2sv4: for 8/16/24bit multichannel(5.1 channel)
I2S. + Introduced in s3c6410. This also applicable for s5p64x0 platforms. + - samsung,s5pc100-i2s: for 8/16/24bit multichannel(5.1 channel) I2S + with secondary fifo and s/w reset control.
- samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with
secondary fifo, s/w reset control and internal mux for root clk
src. +
I think the -vN naming scheme was fine - I see where this came from but the main point was about having things identified by a string not switching the naming scheme. As you can see from the s3c6410 stuff the SoC isn't that helpful as a naming scheme as multiple IP versions appear on the same SoC.
IMHO this SoC-based identification looks much better, especially considering the fact that IP version isn't something easily determinable, as even the documentation can sometimes be not really clear about that.
However the s3c6410-i2sv4 string looks a bit unfortunate. AFAIK there were two types of I2S IPs on S3C6410 - normal I2S and I2S multichannel. What about having a compatible like s3c6410-i2s-multi?
Best regards, Tomasz
On Fri, Jul 26, 2013 at 05:02:46PM +0200, Tomasz Figa wrote:
IMHO this SoC-based identification looks much better, especially considering the fact that IP version isn't something easily determinable, as even the documentation can sometimes be not really clear about that.
Yeah, it's not terribly clever either way. We've been using the version numbers in audio for a long time partly because it is documented sometimes and partly because most of the SoCs tend to have one fully featured controller and a bunch of secondary controllers on older IP revisions.
However the s3c6410-i2sv4 string looks a bit unfortunate. AFAIK there were two types of I2S IPs on S3C6410 - normal I2S and I2S multichannel. What about having a compatible like s3c6410-i2s-multi?
It was explicitly identified as I2Sv4 in the S3C6410 datasheet so no real issue there.
On Friday 26 of July 2013 16:25:51 Mark Brown wrote:
On Fri, Jul 26, 2013 at 05:02:46PM +0200, Tomasz Figa wrote:
IMHO this SoC-based identification looks much better, especially considering the fact that IP version isn't something easily determinable, as even the documentation can sometimes be not really clear about that.
Yeah, it's not terribly clever either way. We've been using the version numbers in audio for a long time partly because it is documented sometimes and partly because most of the SoCs tend to have one fully featured controller and a bunch of secondary controllers on older IP revisions.
However the s3c6410-i2sv4 string looks a bit unfortunate. AFAIK there were two types of I2S IPs on S3C6410 - normal I2S and I2S multichannel. What about having a compatible like s3c6410-i2s-multi?
It was explicitly identified as I2Sv4 in the S3C6410 datasheet so no real issue there.
Well, the datasheet I have calls it either "I2S V40" or "IIS MULTI AUDIO INTERFACE". I like the latter much more, because it actually says what's the difference compared to previous I2S IPs.
I'm not strongly against using the v4 suffix, but since we decided to use more meaningful compatible values elsewhere, I think this way would be better for sound drivers as well.
Best regards, Tomasz
Hi Mark,
On Fri, Jul 26, 2013 at 8:23 PM, Mark Brown broonie@kernel.org wrote:
On Fri, Jul 26, 2013 at 07:06:46PM +0530, Padmavathi Venna wrote:
Samsung has different versions of I2S introduced in different platforms. Each version has some new support added for multichannel, secondary fifo, s/w reset control and internal mux for rclk src clk. Each newly added change has a quirk. So this patch adds all the required quirks as driver data and based on compatible string from dtsi fetches the quirks.
As Russell indicated you should really keep the old name around, though marking them as deprecated is OK. However I'm not sure anyone will have deployed this so I'm not sure how much it matters - every downstream kernel I've seen was still using board files anyway.
This is there only on exynos5250.dtsi, so changing this file alone is enough. patch3 in this series have the same.
The actual meat of the patch changing to a quirk scheme does look good, though.
-- compatible : "samsung,i2s-v5" +- compatible : should be one of the following.
- samsung,s3c6410-i2s: for 8/16/24bit stereo I2S. Previous versions
has only 8/16bit support.
- samsung,s3c6410-i2sv4: for 8/16/24bit multichannel(5.1 channel) I2S.
Introduced in s3c6410. This also applicable for s5p64x0 platforms.
- samsung,s5pc100-i2s: for 8/16/24bit multichannel(5.1 channel) I2S
with secondary fifo and s/w reset control.
- samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with
secondary fifo, s/w reset control and internal mux for root clk src.
I think the -vN naming scheme was fine - I see where this came from but the main point was about having things identified by a string not switching the naming scheme. As you can see from the s3c6410 stuff the SoC isn't that helpful as a naming scheme as multiple IP versions appear on the same SoC.
Having only the version info is confusing. When I posted my previous version of patches I was clear which version introduced in which platform and again if I come back today and see I again had to search each SoC datasheet. So I think this patch now clearly explains what new support introduced in which version of IP and which SoC platform.
Thanks Padma
On Sat, Jul 27, 2013 at 06:38:02AM +0530, Padma Venkat wrote:
On Fri, Jul 26, 2013 at 8:23 PM, Mark Brown broonie@kernel.org wrote:
As Russell indicated you should really keep the old name around, though marking them as deprecated is OK. However I'm not sure anyone will have deployed this so I'm not sure how much it matters - every downstream kernel I've seen was still using board files anyway.
This is there only on exynos5250.dtsi, so changing this file alone is enough. patch3 in this series have the same.
The idea with DT is that you can bake the DT into a board firmware and then upgrade the kernel without upgrading the DT.
Having only the version info is confusing. When I posted my previous version of patches I was clear which version introduced in which platform and again if I come back today and see I again had to search each SoC datasheet. So I think this patch now clearly explains what new support introduced in which version of IP and which SoC platform.
Like I keep saying the problem we've always had is that there's never been a 1:1 mapping between SoCs and IIS IPs, and of course nobody can get the documentation on the older SoCs outside of Samsung so... If it were a linear march forward in terms of IP it'd be a lot easier :(
This patch removes quirks from i2s node and change the i2s compatible names.
Signed-off-by: Padmavathi Venna padma.v@samsung.com --- arch/arm/boot/dts/exynos5250.dtsi | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi index db2ca8b..f7fbedd 100644 --- a/arch/arm/boot/dts/exynos5250.dtsi +++ b/arch/arm/boot/dts/exynos5250.dtsi @@ -385,7 +385,7 @@ };
i2s0: i2s@03830000 { - compatible = "samsung,i2s-v5"; + compatible = "samsung,s5pv210-i2s"; reg = <0x03830000 0x100>; dmas = <&pdma0 10 &pdma0 9 @@ -395,16 +395,13 @@ <&clock_audss EXYNOS_I2S_BUS>, <&clock_audss EXYNOS_SCLK_I2S>; clock-names = "iis", "i2s_opclk0", "i2s_opclk1"; - samsung,supports-6ch; - samsung,supports-rstclr; - samsung,supports-secdai; samsung,idma-addr = <0x03000000>; pinctrl-names = "default"; pinctrl-0 = <&i2s0_bus>; };
i2s1: i2s@12D60000 { - compatible = "samsung,i2s-v5"; + compatible = "samsung,s3c6410-i2s"; reg = <0x12D60000 0x100>; dmas = <&pdma1 12 &pdma1 11>; @@ -416,7 +413,7 @@ };
i2s2: i2s@12D70000 { - compatible = "samsung,i2s-v5"; + compatible = "samsung,s3c6410-i2s"; reg = <0x12D70000 0x100>; dmas = <&pdma0 12 &pdma0 11>;
This patch modifies the i2s driver to give flexibility towards register handling. This is a pre requirement for enabling i2s support on Exynos5420. This patch modifies only the required registers as a pre-requirement to support on Exynos5420.
Signed-off-by: Padmavathi Venna padma.v@samsung.com --- sound/soc/samsung/i2s-regs.h | 36 ++++++++++++++----------- sound/soc/samsung/i2s.c | 58 +++++++++++++++++++++++++---------------- 2 files changed, 55 insertions(+), 39 deletions(-)
diff --git a/sound/soc/samsung/i2s-regs.h b/sound/soc/samsung/i2s-regs.h index c0e6d9a..30513b7 100644 --- a/sound/soc/samsung/i2s-regs.h +++ b/sound/soc/samsung/i2s-regs.h @@ -95,22 +95,26 @@ #define MOD_RXONLY (1 << 8) #define MOD_TXRX (2 << 8) #define MOD_MASK (3 << 8) -#define MOD_LR_LLOW (0 << 7) -#define MOD_LR_RLOW (1 << 7) -#define MOD_SDF_IIS (0 << 5) -#define MOD_SDF_MSB (1 << 5) -#define MOD_SDF_LSB (2 << 5) -#define MOD_SDF_MASK (3 << 5) -#define MOD_RCLK_256FS (0 << 3) -#define MOD_RCLK_512FS (1 << 3) -#define MOD_RCLK_384FS (2 << 3) -#define MOD_RCLK_768FS (3 << 3) -#define MOD_RCLK_MASK (3 << 3) -#define MOD_BCLK_32FS (0 << 1) -#define MOD_BCLK_48FS (1 << 1) -#define MOD_BCLK_16FS (2 << 1) -#define MOD_BCLK_24FS (3 << 1) -#define MOD_BCLK_MASK (3 << 1) +#define MOD_LRP_SHIFT 7 +#define MOD_LR_LLOW 0 +#define MOD_LR_RLOW 1 +#define MOD_SDF_SHIFT 5 +#define MOD_SDF_IIS 0 +#define MOD_SDF_MSB 1 +#define MOD_SDF_LSB 2 +#define MOD_SDF_MASK 3 +#define MOD_RCLK_SHIFT 3 +#define MOD_RCLK_256FS 0 +#define MOD_RCLK_512FS 1 +#define MOD_RCLK_384FS 2 +#define MOD_RCLK_768FS 3 +#define MOD_RCLK_MASK 3 +#define MOD_BCLK_SHIFT 1 +#define MOD_BCLK_32FS 0 +#define MOD_BCLK_48FS 1 +#define MOD_BCLK_16FS 2 +#define MOD_BCLK_24FS 3 +#define MOD_BCLK_MASK 3 #define MOD_8BIT (1 << 0)
#define MOD_CDCLKCON (1 << 12) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index f661a98..0b36b0a 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -199,7 +199,8 @@ static inline bool is_manager(struct i2s_dai *i2s) /* Read RCLK of I2S (in multiples of LRCLK) */ static inline unsigned get_rfs(struct i2s_dai *i2s) { - u32 rfs = (readl(i2s->addr + I2SMOD) >> 3) & 0x3; + u32 rfs = (readl(i2s->addr + I2SMOD) >> MOD_RCLK_SHIFT); + rfs &= MOD_RCLK_MASK;
switch (rfs) { case 3: return 768; @@ -213,21 +214,22 @@ static inline unsigned get_rfs(struct i2s_dai *i2s) static inline void set_rfs(struct i2s_dai *i2s, unsigned rfs) { u32 mod = readl(i2s->addr + I2SMOD); + int rfs_shift = MOD_RCLK_SHIFT;
- mod &= ~MOD_RCLK_MASK; + mod &= ~(MOD_RCLK_MASK << rfs_shift);
switch (rfs) { case 768: - mod |= MOD_RCLK_768FS; + mod |= (MOD_RCLK_768FS << rfs_shift); break; case 512: - mod |= MOD_RCLK_512FS; + mod |= (MOD_RCLK_512FS << rfs_shift); break; case 384: - mod |= MOD_RCLK_384FS; + mod |= (MOD_RCLK_384FS << rfs_shift); break; default: - mod |= MOD_RCLK_256FS; + mod |= (MOD_RCLK_256FS << rfs_shift); break; }
@@ -237,7 +239,8 @@ static inline void set_rfs(struct i2s_dai *i2s, unsigned rfs) /* Read Bit-Clock of I2S (in multiples of LRCLK) */ static inline unsigned get_bfs(struct i2s_dai *i2s) { - u32 bfs = (readl(i2s->addr + I2SMOD) >> 1) & 0x3; + u32 bfs = readl(i2s->addr + I2SMOD) >> MOD_BCLK_SHIFT; + bfs &= MOD_BCLK_MASK;
switch (bfs) { case 3: return 24; @@ -251,21 +254,22 @@ static inline unsigned get_bfs(struct i2s_dai *i2s) static inline void set_bfs(struct i2s_dai *i2s, unsigned bfs) { u32 mod = readl(i2s->addr + I2SMOD); + int bfs_shift = MOD_BCLK_SHIFT;
- mod &= ~MOD_BCLK_MASK; + mod &= ~(MOD_BCLK_MASK << bfs_shift);
switch (bfs) { case 48: - mod |= MOD_BCLK_48FS; + mod |= (MOD_BCLK_48FS << bfs_shift); break; case 32: - mod |= MOD_BCLK_32FS; + mod |= (MOD_BCLK_32FS << bfs_shift); break; case 24: - mod |= MOD_BCLK_24FS; + mod |= (MOD_BCLK_24FS << bfs_shift); break; case 16: - mod |= MOD_BCLK_16FS; + mod |= (MOD_BCLK_16FS << bfs_shift); break; default: dev_err(&i2s->pdev->dev, "Wrong BCLK Divider!\n"); @@ -492,20 +496,25 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, { struct i2s_dai *i2s = to_info(dai); u32 mod = readl(i2s->addr + I2SMOD); + int lrp_shift = MOD_LRP_SHIFT, sdf_shift = MOD_SDF_SHIFT; + int sdf_mask, lrp_rlow; u32 tmp = 0;
+ sdf_mask = MOD_SDF_MASK << sdf_shift; + lrp_rlow = MOD_LR_RLOW << lrp_shift; + /* Format is priority */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_RIGHT_J: - tmp |= MOD_LR_RLOW; - tmp |= MOD_SDF_MSB; + tmp |= lrp_rlow; + tmp |= (MOD_SDF_MSB << sdf_shift); break; case SND_SOC_DAIFMT_LEFT_J: - tmp |= MOD_LR_RLOW; - tmp |= MOD_SDF_LSB; + tmp |= lrp_rlow; + tmp |= (MOD_SDF_LSB << sdf_shift); break; case SND_SOC_DAIFMT_I2S: - tmp |= MOD_SDF_IIS; + tmp |= (MOD_SDF_IIS << sdf_shift); break; default: dev_err(&i2s->pdev->dev, "Format not supported\n"); @@ -520,10 +529,10 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, case SND_SOC_DAIFMT_NB_NF: break; case SND_SOC_DAIFMT_NB_IF: - if (tmp & MOD_LR_RLOW) - tmp &= ~MOD_LR_RLOW; + if (tmp & lrp_rlow) + tmp &= ~lrp_rlow; else - tmp |= MOD_LR_RLOW; + tmp |= lrp_rlow; break; default: dev_err(&i2s->pdev->dev, "Polarity not supported\n"); @@ -545,15 +554,18 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, return -EINVAL; }
+ /* + * Don't change the I2S mode if any controller is active on this + * channel. + */ if (any_active(i2s) && - ((mod & (MOD_SDF_MASK | MOD_LR_RLOW - | MOD_SLAVE)) != tmp)) { + ((mod & (sdf_mask | lrp_rlow | MOD_SLAVE)) != tmp)) { dev_err(&i2s->pdev->dev, "%s:%d Other DAI busy\n", __func__, __LINE__); return -EAGAIN; }
- mod &= ~(MOD_SDF_MASK | MOD_LR_RLOW | MOD_SLAVE); + mod &= ~(sdf_mask | lrp_rlow | MOD_SLAVE); mod |= tmp; writel(mod, i2s->addr + I2SMOD);
On Fri, Jul 26, 2013 at 07:06:48PM +0530, Padmavathi Venna wrote:
This patch modifies the i2s driver to give flexibility towards register handling. This is a pre requirement for enabling i2s support on Exynos5420. This patch modifies only the required registers as a pre-requirement to support on Exynos5420.
Applied, thanks.
Exynos5420 added support for I2S TDM mode. For this, there are some register changes in the I2S controller. This patch adds the relevant register changes to support I2S in normal mode. This patch adds a quirk for TDM mode and if TDM mode is present all the relevent changes will be applied.
Signed-off-by: Padmavathi Venna padma.v@samsung.com --- .../devicetree/bindings/sound/samsung-i2s.txt | 4 + include/linux/platform_data/asoc-s3c.h | 1 + sound/soc/samsung/i2s-regs.h | 15 ++++ sound/soc/samsung/i2s.c | 81 ++++++++++++++++++-- 4 files changed, 93 insertions(+), 8 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/samsung-i2s.txt b/Documentation/devicetree/bindings/sound/samsung-i2s.txt index b3f6443..9b5c892 100644 --- a/Documentation/devicetree/bindings/sound/samsung-i2s.txt +++ b/Documentation/devicetree/bindings/sound/samsung-i2s.txt @@ -11,6 +11,10 @@ Required SoC Specific Properties: with secondary fifo and s/w reset control. - samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with secondary fifo, s/w reset control and internal mux for root clk src. + - samsung,exynos5420-i2s: for 8/16/24bit multichannel(7.1) I2S with + secondary fifo, s/w reset control, internal mux for root clk src and + TDM support. TDM (Time division multiplexing) is to allow transfer of + multiple channel audio data on single data line.
- reg: physical base address of the controller and length of memory mapped region. diff --git a/include/linux/platform_data/asoc-s3c.h b/include/linux/platform_data/asoc-s3c.h index 8827259..9efc04d 100644 --- a/include/linux/platform_data/asoc-s3c.h +++ b/include/linux/platform_data/asoc-s3c.h @@ -36,6 +36,7 @@ struct samsung_i2s { */ #define QUIRK_NO_MUXPSR (1 << 2) #define QUIRK_NEED_RSTCLR (1 << 3) +#define QUIRK_SUPPORTS_TDM (1 << 4) /* Quirks of the I2S controller */ u32 quirks; dma_addr_t idma_addr; diff --git a/sound/soc/samsung/i2s-regs.h b/sound/soc/samsung/i2s-regs.h index 30513b7..821a502 100644 --- a/sound/soc/samsung/i2s-regs.h +++ b/sound/soc/samsung/i2s-regs.h @@ -31,6 +31,10 @@ #define I2SLVL1ADDR 0x34 #define I2SLVL2ADDR 0x38 #define I2SLVL3ADDR 0x3c +#define I2SSTR1 0x40 +#define I2SVER 0x44 +#define I2SFIC2 0x48 +#define I2STDM 0x4c
#define CON_RSTCLR (1 << 31) #define CON_FRXOFSTATUS (1 << 26) @@ -117,6 +121,17 @@ #define MOD_BCLK_MASK 3 #define MOD_8BIT (1 << 0)
+#define EXYNOS5420_MOD_LRP_SHIFT 15 +#define EXYNOS5420_MOD_SDF_SHIFT 6 +#define EXYNOS5420_MOD_RCLK_SHIFT 4 +#define EXYNOS5420_MOD_BCLK_SHIFT 0 +#define EXYNOS5420_MOD_BCLK_64FS 4 +#define EXYNOS5420_MOD_BCLK_96FS 5 +#define EXYNOS5420_MOD_BCLK_128FS 6 +#define EXYNOS5420_MOD_BCLK_192FS 7 +#define EXYNOS5420_MOD_BCLK_256FS 8 +#define EXYNOS5420_MOD_BCLK_MASK 0xf + #define MOD_CDCLKCON (1 << 12)
#define PSR_PSREN (1 << 15) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 0b36b0a..bdbb65d 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -199,7 +199,12 @@ static inline bool is_manager(struct i2s_dai *i2s) /* Read RCLK of I2S (in multiples of LRCLK) */ static inline unsigned get_rfs(struct i2s_dai *i2s) { - u32 rfs = (readl(i2s->addr + I2SMOD) >> MOD_RCLK_SHIFT); + u32 rfs; + + if (i2s->quirks & QUIRK_SUPPORTS_TDM) + rfs = readl(i2s->addr + I2SMOD) >> EXYNOS5420_MOD_RCLK_SHIFT; + else + rfs = (readl(i2s->addr + I2SMOD) >> MOD_RCLK_SHIFT); rfs &= MOD_RCLK_MASK;
switch (rfs) { @@ -214,8 +219,12 @@ static inline unsigned get_rfs(struct i2s_dai *i2s) static inline void set_rfs(struct i2s_dai *i2s, unsigned rfs) { u32 mod = readl(i2s->addr + I2SMOD); - int rfs_shift = MOD_RCLK_SHIFT; + int rfs_shift;
+ if (i2s->quirks & QUIRK_SUPPORTS_TDM) + rfs_shift = EXYNOS5420_MOD_RCLK_SHIFT; + else + rfs_shift = MOD_RCLK_SHIFT; mod &= ~(MOD_RCLK_MASK << rfs_shift);
switch (rfs) { @@ -239,10 +248,22 @@ static inline void set_rfs(struct i2s_dai *i2s, unsigned rfs) /* Read Bit-Clock of I2S (in multiples of LRCLK) */ static inline unsigned get_bfs(struct i2s_dai *i2s) { - u32 bfs = readl(i2s->addr + I2SMOD) >> MOD_BCLK_SHIFT; - bfs &= MOD_BCLK_MASK; + u32 bfs; + + if (i2s->quirks & QUIRK_SUPPORTS_TDM) { + bfs = readl(i2s->addr + I2SMOD) >> EXYNOS5420_MOD_BCLK_SHIFT; + bfs &= EXYNOS5420_MOD_BCLK_MASK; + } else { + bfs = readl(i2s->addr + I2SMOD) >> MOD_BCLK_SHIFT; + bfs &= MOD_BCLK_MASK; + }
switch (bfs) { + case 8: return 256; + case 7: return 192; + case 6: return 128; + case 5: return 96; + case 4: return 64; case 3: return 24; case 2: return 16; case 1: return 48; @@ -254,9 +275,22 @@ static inline unsigned get_bfs(struct i2s_dai *i2s) static inline void set_bfs(struct i2s_dai *i2s, unsigned bfs) { u32 mod = readl(i2s->addr + I2SMOD); - int bfs_shift = MOD_BCLK_SHIFT; + int bfs_shift; + int tdm = i2s->quirks & QUIRK_SUPPORTS_TDM;
- mod &= ~(MOD_BCLK_MASK << bfs_shift); + if (i2s->quirks & QUIRK_SUPPORTS_TDM) { + bfs_shift = EXYNOS5420_MOD_BCLK_SHIFT; + mod &= ~(EXYNOS5420_MOD_BCLK_MASK << bfs_shift); + } else { + bfs_shift = MOD_BCLK_SHIFT; + mod &= ~(MOD_BCLK_MASK << bfs_shift); + } + + /* Non-TDM I2S controllers do not support BCLK > 48 * FS */ + if (!tdm && bfs > 48) { + dev_err(&i2s->pdev->dev, "Unsupported BCLK divider\n"); + return; + }
switch (bfs) { case 48: @@ -271,6 +305,21 @@ static inline void set_bfs(struct i2s_dai *i2s, unsigned bfs) case 16: mod |= (MOD_BCLK_16FS << bfs_shift); break; + case 64: + mod |= (EXYNOS5420_MOD_BCLK_64FS << bfs_shift); + break; + case 96: + mod |= (EXYNOS5420_MOD_BCLK_96FS << bfs_shift); + break; + case 128: + mod |= (EXYNOS5420_MOD_BCLK_128FS << bfs_shift); + break; + case 192: + mod |= (EXYNOS5420_MOD_BCLK_192FS << bfs_shift); + break; + case 256: + mod |= (EXYNOS5420_MOD_BCLK_256FS << bfs_shift); + break; default: dev_err(&i2s->pdev->dev, "Wrong BCLK Divider!\n"); return; @@ -496,10 +545,17 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, { struct i2s_dai *i2s = to_info(dai); u32 mod = readl(i2s->addr + I2SMOD); - int lrp_shift = MOD_LRP_SHIFT, sdf_shift = MOD_SDF_SHIFT; - int sdf_mask, lrp_rlow; + int lrp_shift, sdf_shift, sdf_mask, lrp_rlow; u32 tmp = 0;
+ if (i2s->quirks & QUIRK_SUPPORTS_TDM) { + lrp_shift = EXYNOS5420_MOD_LRP_SHIFT; + sdf_shift = EXYNOS5420_MOD_SDF_SHIFT; + } else { + lrp_shift = MOD_LRP_SHIFT; + sdf_shift = MOD_SDF_SHIFT; + } + sdf_mask = MOD_SDF_MASK << sdf_shift; lrp_rlow = MOD_LR_RLOW << lrp_shift;
@@ -1262,6 +1318,12 @@ static struct samsung_i2s_dai_data i2sv5_dai_type = { .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR, };
+static struct samsung_i2s_dai_data i2sv6_dai_type = { + .dai_type = TYPE_PRI, + .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR | + QUIRK_SUPPORTS_TDM, +}; + static struct samsung_i2s_dai_data samsung_dai_type_sec = { .dai_type = TYPE_SEC, }; @@ -1295,6 +1357,9 @@ static const struct of_device_id exynos_i2s_match[] = { }, { .compatible = "samsung,s5pv210-i2s", .data = &i2sv5_dai_type, + }, { + .compatible = "samsung,exynos5420-i2s", + .data = &i2sv6_dai_type, }, {}, };
From: Andrew Bresticker abrestic@chromium.org
This adds device-tree bindings for the i2s controllers on Exynos 5420.
Signed-off-by: Andrew Bresticker abrestic@chromium.org Signed-off-by: Padmavathi Venna padma.v@samsung.com Reviewed-on: https://gerrit.chromium.org/gerrit/57713 --- arch/arm/boot/dts/exynos5420.dtsi | 44 +++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi index d2fdb87..c9ed8d2 100644 --- a/arch/arm/boot/dts/exynos5420.dtsi +++ b/arch/arm/boot/dts/exynos5420.dtsi @@ -242,4 +242,48 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c3_bus>; }; + + i2s_0: i2s@03830000 { + compatible = "samsung,exynos5420-i2s"; + reg = <0x03830000 0x100>; + dmas = <&adma 0 + &adma 2 + &adma 1>; + dma-names = "tx", "rx", "tx-sec"; + clocks = <&clock_audss EXYNOS_I2S_BUS>, + <&clock_audss EXYNOS_I2S_BUS>, + <&clock_audss EXYNOS_SCLK_I2S>; + clock-names = "iis", "i2s_opclk0", "i2s_opclk1"; + samsung,idma-addr = <0x03000000>; + pinctrl-names = "default"; + pinctrl-0 = <&i2s0_bus>; + status = "disabled"; + }; + + i2s_1: i2s@12D60000 { + compatible = "samsung,s3c6410-i2s"; + reg = <0x12D60000 0x100>; + dmas = <&pdma1 12 + &pdma1 11>; + dma-names = "tx", "rx"; + clocks = <&clock 275>, <&clock 138>; + clock-names = "iis", "i2s_opclk0"; + pinctrl-names = "default"; + pinctrl-0 = <&i2s1_bus>; + status = "disabled"; + }; + + i2s_2: i2s@12D70000 { + compatible = "samsung,s3c6410-i2s"; + reg = <0x12D70000 0x100>; + dmas = <&pdma0 12 + &pdma0 11>; + dma-names = "tx", "rx"; + clocks = <&clock 276>, <&clock 139>; + clock-names = "iis", "i2s_opclk0"; + pinctrl-names = "default"; + pinctrl-0 = <&i2s2_bus>; + status = "disabled"; + }; + };
This patch adds wm8994 codec node on i2c bus1 and the required regulator supplies and properties on smdk5420 board.
Signed-off-by: Padmavathi Venna padma.v@samsung.com --- arch/arm/boot/dts/exynos5420-smdk5420.dts | 50 +++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boot/dts/exynos5420-smdk5420.dts b/arch/arm/boot/dts/exynos5420-smdk5420.dts index d05de7a..28a6855 100644 --- a/arch/arm/boot/dts/exynos5420-smdk5420.dts +++ b/arch/arm/boot/dts/exynos5420-smdk5420.dts @@ -68,4 +68,54 @@ bus-width = <4>; }; }; + + vdd: fixed-regulator@0 { + compatible = "regulator-fixed"; + regulator-name = "vdd-supply"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + + dbvdd: fixed-regulator@1 { + compatible = "regulator-fixed"; + regulator-name = "dbvdd-supply"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + spkvdd: fixed-regulator@2 { + compatible = "regulator-fixed"; + regulator-name = "spkvdd-supply"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + }; + + i2c@12C70000 { + status = "okay"; + samsung,i2c-sda-delay = <100>; + samsung,i2c-max-bus-freq = <20000>; + + eeprom@51 { + compatible = "samsung,s524ad0xd1"; + reg = <0x51>; + }; + + wm8994: wm8994@1a { + compatible = "wlf,wm8994"; + reg = <0x1a>; + + gpio-controller; + #gpio-cells = <2>; + + AVDD2-supply = <&vdd>; + CPVDD-supply = <&vdd>; + DBVDD-supply = <&dbvdd>; + SPKVDD1-supply = <&spkvdd>; + SPKVDD2-supply = <&spkvdd>; + }; + }; + };
On Fri, Jul 26, 2013 at 07:06:51PM +0530, Padmavathi Venna wrote:
This patch adds wm8994 codec node on i2c bus1 and the required regulator supplies and properties on smdk5420 board.
This isn't a device tree patch for WM8994, it's a patch for the SMDK5420.
- vdd: fixed-regulator@0 {
compatible = "regulator-fixed";
regulator-name = "vdd-supply";
These names look wrong - they should reflect the names in the schematic as they're for human comprehensibility. This may just be a case of dropping the -supply.
wm8994: wm8994@1a {
compatible = "wlf,wm8994";
reg = <0x1a>;
gpio-controller;
#gpio-cells = <2>;
AVDD2-supply = <&vdd>;
CPVDD-supply = <&vdd>;
DBVDD-supply = <&dbvdd>;
SPKVDD1-supply = <&spkvdd>;
SPKVDD2-supply = <&spkvdd>;
};
It would be helpful to also add a clock binding (I posted a binding documentation update the other day, it's in my tree now) but it's not essential and I suspect it needs some work on the clock driver side still.
Hi Mark,
On Fri, Jul 26, 2013 at 8:49 PM, Mark Brown broonie@kernel.org wrote:
On Fri, Jul 26, 2013 at 07:06:51PM +0530, Padmavathi Venna wrote:
This patch adds wm8994 codec node on i2c bus1 and the required regulator supplies and properties on smdk5420 board.
This isn't a device tree patch for WM8994, it's a patch for the SMDK5420.
Yes. I will correct the subject.
vdd: fixed-regulator@0 {
compatible = "regulator-fixed";
regulator-name = "vdd-supply";
These names look wrong - they should reflect the names in the schematic as they're for human comprehensibility. This may just be a case of dropping the -supply.
OK.
wm8994: wm8994@1a {
compatible = "wlf,wm8994";
reg = <0x1a>;
gpio-controller;
#gpio-cells = <2>;
AVDD2-supply = <&vdd>;
CPVDD-supply = <&vdd>;
DBVDD-supply = <&dbvdd>;
SPKVDD1-supply = <&spkvdd>;
SPKVDD2-supply = <&spkvdd>;
};
It would be helpful to also add a clock binding (I posted a binding documentation update the other day, it's in my tree now) but it's not essential and I suspect it needs some work on the clock driver side still.
OK. I will check this.
Thanks Padma
Hi Mark,
On Sat, Jul 27, 2013 at 6:46 AM, Padma Venkat padma.kvr@gmail.com wrote:
Hi Mark,
On Fri, Jul 26, 2013 at 8:49 PM, Mark Brown broonie@kernel.org wrote:
On Fri, Jul 26, 2013 at 07:06:51PM +0530, Padmavathi Venna wrote:
This patch adds wm8994 codec node on i2c bus1 and the required regulator supplies and properties on smdk5420 board.
This isn't a device tree patch for WM8994, it's a patch for the SMDK5420.
Yes. I will correct the subject.
vdd: fixed-regulator@0 {
compatible = "regulator-fixed";
regulator-name = "vdd-supply";
These names look wrong - they should reflect the names in the schematic as they're for human comprehensibility. This may just be a case of dropping the -supply.
When I posted the same patch for smdk5250, you asked me to club all the same supply regulators. So I clubbed AVDD2 and CPVDD. So any other better name for representing both supplies?
OK.
wm8994: wm8994@1a {
compatible = "wlf,wm8994";
reg = <0x1a>;
gpio-controller;
#gpio-cells = <2>;
AVDD2-supply = <&vdd>;
CPVDD-supply = <&vdd>;
DBVDD-supply = <&dbvdd>;
SPKVDD1-supply = <&spkvdd>;
SPKVDD2-supply = <&spkvdd>;
};
It would be helpful to also add a clock binding (I posted a binding documentation update the other day, it's in my tree now) but it's not essential and I suspect it needs some work on the clock driver side still.
OK. I will check this.
As per schemata, input clock to MCLK1 is an oscillator clock with 16.9MHz and MCLK2 not showing any input clock. So here I need to add a fixed rate clock with 16.9MHz as MCLK1 in the smdk board file.
Is it correct?
Thanks Padma
On Mon, Jul 29, 2013 at 05:31:16PM +0530, Padma Venkat wrote:
On Sat, Jul 27, 2013 at 6:46 AM, Padma Venkat padma.kvr@gmail.com wrote:
vdd: fixed-regulator@0 {
compatible = "regulator-fixed";
regulator-name = "vdd-supply";
These names look wrong - they should reflect the names in the schematic as they're for human comprehensibility. This may just be a case of dropping the -supply.
When I posted the same patch for smdk5250, you asked me to club all the same supply regulators. So I clubbed AVDD2 and CPVDD. So any other better name for representing both supplies?
No, I'd have told you to combine things taht come from the same supply on the board - things like the speaker supplies for example aren't going to be coming from separate places. The names should reflect whatever the names on the schemaric are, like I say that's probably just removing the -supply.
documentation update the other day, it's in my tree now) but it's not essential and I suspect it needs some work on the clock driver side still.
OK. I will check this.
As per schemata, input clock to MCLK1 is an oscillator clock with 16.9MHz and MCLK2 not showing any input clock. So here I need to add a fixed rate clock with 16.9MHz as MCLK1 in the smdk board file.
Is it correct?
Yes, in the DTS (or to XCLKOUT on the AP?).
Hi Mark,
On Mon, Jul 29, 2013 at 7:13 PM, Mark Brown broonie@kernel.org wrote:
On Mon, Jul 29, 2013 at 05:31:16PM +0530, Padma Venkat wrote:
On Sat, Jul 27, 2013 at 6:46 AM, Padma Venkat padma.kvr@gmail.com wrote:
vdd: fixed-regulator@0 {
compatible = "regulator-fixed";
regulator-name = "vdd-supply";
These names look wrong - they should reflect the names in the schematic as they're for human comprehensibility. This may just be a case of dropping the -supply.
When I posted the same patch for smdk5250, you asked me to club all the same supply regulators. So I clubbed AVDD2 and CPVDD. So any other better name for representing both supplies?
No, I'd have told you to combine things taht come from the same supply on the board - things like the speaker supplies for example aren't going to be coming from separate places. The names should reflect whatever the names on the schemaric are, like I say that's probably just removing the -supply.
documentation update the other day, it's in my tree now) but it's not essential and I suspect it needs some work on the clock driver side still.
OK. I will check this.
As per schemata, input clock to MCLK1 is an oscillator clock with 16.9MHz and MCLK2 not showing any input clock. So here I need to add a fixed rate clock with 16.9MHz as MCLK1 in the smdk board file.
Is it correct?
Yes, in the DTS (or to XCLKOUT on the AP?).
On smdk boards(atleast on smdk5250 and smdk5420) there is no XCLKOUT funda. Codec MCLK can get clock from oscillator clock in codec master mode or i2scdclk in codec slave mode. XCLKOUT is there in some other variants of 5250 and 5420 where it is using other codecs than wm8994. But the mux and divider of XCLKOUT is out of CMU. As Sylwester told it is there in PMU registers.
Thanks Padma
Hi Mark,
On Tue, Jul 30, 2013 at 8:58 AM, Padma Venkat padma.kvr@gmail.com wrote:
Hi Mark,
On Mon, Jul 29, 2013 at 7:13 PM, Mark Brown broonie@kernel.org wrote:
On Mon, Jul 29, 2013 at 05:31:16PM +0530, Padma Venkat wrote:
On Sat, Jul 27, 2013 at 6:46 AM, Padma Venkat padma.kvr@gmail.com wrote:
vdd: fixed-regulator@0 {
compatible = "regulator-fixed";
regulator-name = "vdd-supply";
These names look wrong - they should reflect the names in the schematic as they're for human comprehensibility. This may just be a case of dropping the -supply.
When I posted the same patch for smdk5250, you asked me to club all the same supply regulators. So I clubbed AVDD2 and CPVDD. So any other better name for representing both supplies?
No, I'd have told you to combine things taht come from the same supply on the board - things like the speaker supplies for example aren't going to be coming from separate places. The names should reflect whatever the names on the schemaric are, like I say that's probably just removing the -supply.
documentation update the other day, it's in my tree now) but it's not essential and I suspect it needs some work on the clock driver side still.
OK. I will check this.
As per schemata, input clock to MCLK1 is an oscillator clock with 16.9MHz and MCLK2 not showing any input clock. So here I need to add a fixed rate clock with 16.9MHz as MCLK1 in the smdk board file.
Is it correct?
Yes, in the DTS (or to XCLKOUT on the AP?).
On smdk boards(atleast on smdk5250 and smdk5420) there is no XCLKOUT funda. Codec MCLK can get clock from oscillator clock in codec master mode or i2scdclk in codec slave mode. XCLKOUT is there in some other variants of 5250 and 5420 where it is using other codecs than wm8994. But the mux and divider of XCLKOUT is out of CMU. As Sylwester told it is there in PMU registers.
Sorry for giving some what wrong info here. I verified the schemata. There is a switch on the board which can be used to select the input clock of codec MCLK1. We can either select oscillator clock which is 16.9MHz which is on the board or XCLKOUT which is from PMU or i2scdclk(codec slave mode). Right now we are using oscillator clock as input clock to MCLK1.
Thanks Padma
On Fri, Aug 02, 2013 at 04:15:28PM +0530, Padma Venkat wrote:
Sorry for giving some what wrong info here. I verified the schemata. There is a switch on the board which can be used to select the input clock of codec MCLK1. We can either select oscillator clock which is 16.9MHz which is on the board or XCLKOUT which is from PMU or i2scdclk(codec slave mode). Right now we are using oscillator clock as input clock to MCLK1.
I agree that going with whatever the board ships with as default seems sensible. Might be worth putting in a comment with the XCLKOUT option saying how it maps into the control on the board.
This patch enables i2s0 and sound support on smdk5420.
Signed-off-by: Padmavathi Venna padma.v@samsung.com --- arch/arm/boot/dts/exynos5420-smdk5420.dts | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boot/dts/exynos5420-smdk5420.dts b/arch/arm/boot/dts/exynos5420-smdk5420.dts index 28a6855..a5a2c2f 100644 --- a/arch/arm/boot/dts/exynos5420-smdk5420.dts +++ b/arch/arm/boot/dts/exynos5420-smdk5420.dts @@ -118,4 +118,14 @@ }; };
+ i2s0: i2s@03830000 { + status = "okay"; + }; + + sound { + compatible = "samsung,smdk-wm8994"; + + samsung,i2s-controller = <&i2s0>; + samsung,audio-codec = <&wm8994>; + }; };
Hi Padmavathi,
On Friday 26 of July 2013 19:06:44 Padmavathi Venna wrote:
Samsung has different versions of I2S introduced in different platforms. Each version has some new support added for multichannel, secondary fifo, s/w reset control, internal mux for rclk src clk and tdm support. Each newly added change has a quirk. So this patch adds all the required quirks as driver data and based on compatible string from dtsi fetches the quirks. This also adds i2s support on exynos5420 and make relevent changes in the dtsi files.
Changes since V1:
- Pass quirks as driver data and fetch the quirks based on compatible string from dtsi file as suggested by Tomasz Figa and Mark Brown
- Make the I2S driver more flexible with respect to register access as suggested by Tomasz Figa and Mark Brown
- Add 5420 support in the driver.
- Modify the dtsi files with the corresponding compatible strings and removed the i2s quirks from 5250 dtsi file.
- Updated the i2s Documentation with relevent changes and i2s versioning info.
- Add i2s nodes on exynos5420.dtsi
- Enable sound support on smdk5420
This patch set is dependent on the following dma and audio subsystem clk controller patches. http://comments.gmane.org/gmane.linux.kernel.samsung-soc/20661 http://comments.gmane.org/gmane.linux.kernel.samsung-soc/20668
This patch set is made based on Kukjin Kim for-next branch.
Andrew Bresticker (1): ARM: dts: exynos5420: add i2s controllers
Padmavathi Venna (7): platform: Increase platform name size ASoC: Samsung: I2S: Add quirks as driver data in I2S ARM: dts: Change i2s compatible string on exynos5250 ASoC: Samsung: I2S: Modify driver to give more flexibility ASoC: Samsung: I2S: Modify the I2S driver to support I2S on Exynos5420 ARM: dts: wm8994: Add wm8994 support on smdk5420 ARM: dts: Enable sound support on smdk5420
.../devicetree/bindings/sound/samsung-i2s.txt | 25 ++- arch/arm/boot/dts/exynos5250.dtsi | 9 +- arch/arm/boot/dts/exynos5420-smdk5420.dts | 60 ++++++ arch/arm/boot/dts/exynos5420.dtsi | 44 +++++ include/linux/mod_devicetable.h | 2 +- include/linux/platform_data/asoc-s3c.h | 1 + sound/soc/samsung/i2s-regs.h | 51 ++++-- sound/soc/samsung/i2s.c | 205 +++++++++++++++----- 8 files changed, 312 insertions(+), 85 deletions(-)
Please resend the whole series again using correct devicetree mailing list, which is:
devicetree@vger.kernel.org
The old one (devicetree-discuss@lists.ozlabs.org) is no longer functioning.
Best regards, Tomasz
On Fri, Jul 26, 2013 at 7:52 PM, Tomasz Figa t.figa@samsung.com wrote:
Hi Padmavathi,
On Friday 26 of July 2013 19:06:44 Padmavathi Venna wrote:
Samsung has different versions of I2S introduced in different platforms. Each version has some new support added for multichannel, secondary fifo, s/w reset control, internal mux for rclk src clk and tdm support. Each newly added change has a quirk. So this patch adds all the required quirks as driver data and based on compatible string from dtsi fetches the quirks. This also adds i2s support on exynos5420 and make relevent changes in the dtsi files.
Changes since V1: - Pass quirks as driver data and fetch the quirks based on compatible string from dtsi file as suggested by Tomasz Figa and Mark Brown - Make the I2S driver more flexible with respect to register access as suggested by Tomasz Figa and Mark Brown - Add 5420 support in the driver. - Modify the dtsi files with the corresponding compatible strings and removed the i2s quirks from 5250 dtsi file. - Updated the i2s Documentation with relevent changes and i2s versioning info. - Add i2s nodes on exynos5420.dtsi - Enable sound support on smdk5420
This patch set is dependent on the following dma and audio subsystem clk controller patches. http://comments.gmane.org/gmane.linux.kernel.samsung-soc/20661 http://comments.gmane.org/gmane.linux.kernel.samsung-soc/20668
This patch set is made based on Kukjin Kim for-next branch.
Andrew Bresticker (1): ARM: dts: exynos5420: add i2s controllers
Padmavathi Venna (7): platform: Increase platform name size ASoC: Samsung: I2S: Add quirks as driver data in I2S ARM: dts: Change i2s compatible string on exynos5250 ASoC: Samsung: I2S: Modify driver to give more flexibility ASoC: Samsung: I2S: Modify the I2S driver to support I2S on Exynos5420 ARM: dts: wm8994: Add wm8994 support on smdk5420 ARM: dts: Enable sound support on smdk5420
.../devicetree/bindings/sound/samsung-i2s.txt | 25 ++- arch/arm/boot/dts/exynos5250.dtsi | 9 +- arch/arm/boot/dts/exynos5420-smdk5420.dts | 60 ++++++ arch/arm/boot/dts/exynos5420.dtsi | 44 +++++ include/linux/mod_devicetable.h | 2 +- include/linux/platform_data/asoc-s3c.h | 1 + sound/soc/samsung/i2s-regs.h | 51 ++++-- sound/soc/samsung/i2s.c | 205 +++++++++++++++----- 8 files changed, 312 insertions(+), 85 deletions(-)
Please resend the whole series again using correct devicetree mailing list, which is:
devicetree@vger.kernel.org
The old one (devicetree-discuss@lists.ozlabs.org) is no longer functioning.
Best regards, Tomasz
OK. I will post.
Thanks Padma
participants (7)
-
Mark Brown
-
Padma Venkat
-
Padmavathi Venna
-
Russell King - ARM Linux
-
Sachin Kamat
-
Tomasz Figa
-
Tomasz Figa