Fix capture devices functionality on TM2
Subsystems (4)
A message that is not in the archive (sent off-list or not yet received): CGME20170906010417epcas2p2ba8d740d4d071b6479a05b31f81c8b46@epcas2p2.samsung.com
v2 cover Fix capture devices functionality on TM2
Hello,
This patchset makes capture functionality working on TM2.
Capture devices can't be detected because I2S doesn't have appropriate dai name. Therefore, TM2 will select unexpected cpu dai which is named "i2s-samsung-sec" that doesn't have a capture functionality.
In samsung I2S driver, it tries to register two components without specific name. The driver finally has components having same name: dai name as well. As a result, dai_link doesn't have enough information to select cpu_dai properly.
Changes in v2:
- defined SAMSUNG_I2S_DAI_* in i2s.h and removed duplicated code
- modified commit message about invalid parameter that Krzystof mentioned
- rebased code because of conflicts in i2s.c
Jaechul Lee (3):
ASoC: samsung: i2s: Use specific name for i2s dais
ASoC: samsung: Use 'samsung-i2s' cpu_dai for dai_links
ASoC: samsung: Fix invalid argument when devm_gpiod_get is called
sound/soc/samsung/i2s.c | 4 ++++ sound/soc/samsung/i2s.h | 3 +++ sound/soc/samsung/tm2_wm5110.c | 7 ++++--- 3 files changed, 11 insertions(+), 3 deletions(-)
Signature · 1 line
2.14.1
PATCH v2 1/3 ASoC: samsung: i2s: Use specific name for i2s dais
Add specific dais name when components are registered. Component and dai name will follow their parent dev name, if the name isn't described. In case of this driver, each dais will have same name like '11440000.i2s0' by fmt_single_name function.
The problem having same name is that TM2 machine driver can't detect capture devices correctly. Machine driver doesn't know which one is proper to use for cpu dai. The driver just selects to use 'samsung-i2c-sec' that doesn't have capture functionality because the component of samsung-i2s-sec is located in the first of the component_list.
I add dai name like 'samsung-i2s', 'samsung-i2s-sec' for each dais. The reason why adding dai id to 1 is that it doesn't allow to use particular dai name in case of when I use 0 for dai id.
--- sound/soc/samsung/i2s.c | 4 ++++ sound/soc/samsung/i2s.h | 3 +++ 2 files changed, 7 insertions(+)
sound/soc/samsung/i2s.c +4 -0
@@ -1096,6 +1096,7 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, i2s->pdev = pdev; i2s->pri_dai =NULL ; i2s->sec_dai =NULL ; + i2s->i2s_dai_drv.id =1 ; i2s->i2s_dai_drv.symmetric_rates =1 ; i2s->i2s_dai_drv.probe = samsung_i2s_dai_probe; i2s->i2s_dai_drv.remove = samsung_i2s_dai_remove;
@@ -1108,10 +1109,13 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, i2s->i2s_dai_drv.playback.formats =SAMSUNG_I2S_FMTS ;if (!sec) { + i2s->i2s_dai_drv.name =SAMSUNG_I2S_DAI ; i2s->i2s_dai_drv.capture.channels_min =1 ; i2s->i2s_dai_drv.capture.channels_max =2 ; i2s->i2s_dai_drv.capture.rates = i2s_dai_data->pcm_rates; i2s->i2s_dai_drv.capture.formats =SAMSUNG_I2S_FMTS ; + }else { + i2s->i2s_dai_drv.name =SAMSUNG_I2S_DAI_SEC ; }return i2s; }
sound/soc/samsung/i2s.h +3 -0
@@ -13,6 +13,9 @@#ifndef __SND_SOC_SAMSUNG_I2S_H#define __SND_SOC_SAMSUNG_I2S_H +#define SAMSUNG_I2S_DAI "samsung-i2s" +#define SAMSUNG_I2S_DAI_SEC "samsung-i2s-sec" +#define SAMSUNG_I2S_DIV_BCLK 1#define SAMSUNG_I2S_RCLKSRC_0 0
Signature · 1 line
2.14.1
Re: [PATCH v2 1/3] ASoC: samsung: i2s: Use specific name for i2s dais
Quoted 15 lines · Jaechul Lee
Add specific dais name when components are registered. Component and dai name will follow their parent dev name, if the name isn't described. In case of this driver, each dais will have same name like '11440000.i2s0' by
fmt_single_namefunction.The problem having same name is that TM2 machine driver can't detect capture devices correctly. Machine driver doesn't know which one is proper to use for cpu dai. The driver just selects to use 'samsung-i2c-sec' that doesn't have capture functionality because the component of samsung-i2s-sec is located in the first of the
component_list.I add dai name like 'samsung-i2s', 'samsung-i2s-sec' for each dais. The reason why adding dai id to 1 is that it doesn't allow to use particular dai name in case of when I use 0 for dai id.
Quoted 6 lines
Signed-off-by Jaechul Lee <[email protected]>--- sound/soc/samsung/i2s.c | 4 ++++ sound/soc/samsung/i2s.h | 3 +++ 2 files changed, 7 insertions(+)
Best regards,
Krzysztof
Mark Brown
maintainerApplied "ASoC: samsung: i2s: Use specific name for i2s dais" to the asoc tree
In reply to Jaechul LeeThe patch
ASoC: samsung: i2s: Use specific name for i2s dais
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
22289ddcd87285b3d61cd8b129438ca6abb1aa37Mon Sep 17 00:00:00 2001
From: Jaechul Lee <[email protected]>
Date: Wed, 6 Sep 2017 10:04:13 +0900
Subject: [PATCH] ASoC: samsung: i2s: Use specific name for i2s dais
Add specific dais name when components are registered. Component and dai name will follow their parent dev name, if the name isn't described. In case of this driver, each dais will have same name like '11440000.i2s0' by fmt_single_name function.
The problem having same name is that TM2 machine driver can't detect capture devices correctly. Machine driver doesn't know which one is proper to use for cpu dai. The driver just selects to use 'samsung-i2c-sec' that doesn't have capture functionality because the component of samsung-i2s-sec is located in the first of the component_list.
I add dai name like 'samsung-i2s', 'samsung-i2s-sec' for each dais. The reason why adding dai id to 1 is that it doesn't allow to use particular dai name in case of when I use 0 for dai id.
--- sound/soc/samsung/i2s.c | 4 ++++ sound/soc/samsung/i2s.h | 3 +++ 2 files changed, 7 insertions(+)
sound/soc/samsung/i2s.c +4 -0
@@ -1099,6 +1099,7 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, i2s->pdev = pdev; i2s->pri_dai =NULL ; i2s->sec_dai =NULL ; + i2s->i2s_dai_drv.id =1 ; i2s->i2s_dai_drv.symmetric_rates =1 ; i2s->i2s_dai_drv.probe = samsung_i2s_dai_probe; i2s->i2s_dai_drv.remove = samsung_i2s_dai_remove;
@@ -1111,10 +1112,13 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, i2s->i2s_dai_drv.playback.formats =SAMSUNG_I2S_FMTS ;if (!sec) { + i2s->i2s_dai_drv.name =SAMSUNG_I2S_DAI ; i2s->i2s_dai_drv.capture.channels_min =1 ; i2s->i2s_dai_drv.capture.channels_max =2 ; i2s->i2s_dai_drv.capture.rates = i2s_dai_data->pcm_rates; i2s->i2s_dai_drv.capture.formats =SAMSUNG_I2S_FMTS ; + }else { + i2s->i2s_dai_drv.name =SAMSUNG_I2S_DAI_SEC ; }return i2s; }
sound/soc/samsung/i2s.h +3 -0
@@ -13,6 +13,9 @@#ifndef __SND_SOC_SAMSUNG_I2S_H#define __SND_SOC_SAMSUNG_I2S_H +#define SAMSUNG_I2S_DAI "samsung-i2s" +#define SAMSUNG_I2S_DAI_SEC "samsung-i2s-sec" +#define SAMSUNG_I2S_DIV_BCLK 1#define SAMSUNG_I2S_RCLKSRC_0 0
Signature · 1 line
2.14.1
PATCH v2 2/3 ASoC: samsung: Use 'samsung-i2s' cpu_dai for dai_links
In reply to Jaechul LeeAdd specific cpu_dai_name to dai_link because samsung i2s driver registers two dais and components. Selecting one of them clearly is needed more information like cpu_dai_name, of_node. The reason why the dai_links have to use 'samsung-i2s' for cpu_dai is that 'samsung-i2s-sec' doesn't have a capture functionality.
Without this code, cpu_dai will be selected the first one of the component_list. For example, if I describe nothing to cpu_dai_name, 'samsung-i2s-sec' might be selected to HiFi Primay.
--- sound/soc/samsung/tm2_wm5110.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/samsung/tm2_wm5110.c +3 -1
@@ -383,6 +383,7 @@ static struct snd_soc_dai_link tm2_dai_links[] = { { .name = "WM5110 AIF1", .stream_name = "HiFi Primary", + .cpu_dai_name = SAMSUNG_I2S_DAI, .codec_dai_name = "wm5110-aif1", .ops = &tm2_aif1_ops, .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
@@ -390,6 +391,7 @@ static struct snd_soc_dai_link tm2_dai_links[] = { }, { .name = "WM5110 Voice", .stream_name = "Voice call", + .cpu_dai_name = SAMSUNG_I2S_DAI, .codec_dai_name = "wm5110-aif2", .ops = &tm2_aif2_ops, .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
@@ -398,6 +400,7 @@ static struct snd_soc_dai_link tm2_dai_links[] = { }, { .name = "WM5110 BT", .stream_name = "Bluetooth", + .cpu_dai_name = SAMSUNG_I2S_DAI, .codec_dai_name = "wm5110-aif3", .dai_fmt =SND_SOC_DAIFMT_I2S |SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM,
@@ -477,7 +480,6 @@ static int tm2_probe(struct platform_device *pdev) }for (i =0 ; i < card->num_links; i++) { - card->dai_link[i].cpu_dai_name =NULL ; card->dai_link[i].cpu_name =NULL ; card->dai_link[i].platform_name =NULL ; card->dai_link[i].codec_of_node = codec_dai_node;
Signature · 1 line
2.14.1
Re: [PATCH v2 2/3] ASoC: samsung: Use 'samsung-i2s' cpu_dai for dai_links
Quoted 6 lines · Jaechul Lee
Add specific
cpu_dai_nametodai_linkbecause samsung i2s driver registers two dais and components. Selecting one of them clearly is needed more information likecpu_dai_name,of_node. The reason why thedai_linkshave to use 'samsung-i2s' forcpu_daiis that 'samsung-i2s-sec' doesn't have a capture functionality.
Quoted 9 lines
Without this code,
cpu_daiwill be selected the first one of thecomponent_list. For example, if I describe nothing tocpu_dai_name, 'samsung-i2s-sec' might be selected to HiFi Primay.Signed-off-by Jaechul Lee <[email protected]>--- sound/soc/samsung/tm2_wm5110.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Best regards,
Krzysztof
Mark Brown
maintainerApplied "ASoC: samsung: Use 'samsung-i2s' cpu_dai for dai_links" to the asoc tree
In reply to Jaechul LeeThe patch
ASoC: samsung: Use 'samsung-i2s' cpu_dai for dai_links
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
e8d93208905a9987c211f97a14a93f2776ab52e7Mon Sep 17 00:00:00 2001
From: Jaechul Lee <[email protected]>
Date: Wed, 6 Sep 2017 10:04:14 +0900
Subject: [PATCH] ASoC: samsung: Use 'samsung-i2s' cpu_dai for dai_links
Add specific cpu_dai_name to dai_link because samsung i2s driver registers two dais and components. Selecting one of them clearly is needed more information like cpu_dai_name, of_node. The reason why the dai_links have to use 'samsung-i2s' for cpu_dai is that 'samsung-i2s-sec' doesn't have a capture functionality.
Without this code, cpu_dai will be selected the first one of the component_list. For example, if I describe nothing to cpu_dai_name, 'samsung-i2s-sec' might be selected to HiFi Primay.
--- sound/soc/samsung/tm2_wm5110.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/samsung/tm2_wm5110.c +3 -1
@@ -383,6 +383,7 @@ static struct snd_soc_dai_link tm2_dai_links[] = { { .name = "WM5110 AIF1", .stream_name = "HiFi Primary", + .cpu_dai_name = SAMSUNG_I2S_DAI, .codec_dai_name = "wm5110-aif1", .ops = &tm2_aif1_ops, .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
@@ -390,6 +391,7 @@ static struct snd_soc_dai_link tm2_dai_links[] = { }, { .name = "WM5110 Voice", .stream_name = "Voice call", + .cpu_dai_name = SAMSUNG_I2S_DAI, .codec_dai_name = "wm5110-aif2", .ops = &tm2_aif2_ops, .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
@@ -398,6 +400,7 @@ static struct snd_soc_dai_link tm2_dai_links[] = { }, { .name = "WM5110 BT", .stream_name = "Bluetooth", + .cpu_dai_name = SAMSUNG_I2S_DAI, .codec_dai_name = "wm5110-aif3", .dai_fmt =SND_SOC_DAIFMT_I2S |SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM,
@@ -477,7 +480,6 @@ static int tm2_probe(struct platform_device *pdev) }for (i =0 ; i < card->num_links; i++) { - card->dai_link[i].cpu_dai_name =NULL ; card->dai_link[i].cpu_name =NULL ; card->dai_link[i].platform_name =NULL ; card->dai_link[i].codec_of_node = codec_dai_node;
Signature · 1 line
2.14.1
PATCH v2 3/3 ASoC: samsung: Fix invalid argument when devm_gpiod_get is called
In reply to Jaechul Leedevm_gpiod_get is called with GPIOF_OUT_INIT_LOW but the function doesn't allow the parameters. Unluckily, GPIOF_OUT_INIT_LOW is same value as GPIOD_ASIS and gpio direction isn't set properly.
Muted stream comes up when I try recording some sounds on TM2. mic-bias gpiod state can't be changed because the gpiod is created with the invalid parameter. The gpio should be set GPIOD_OUT_HIGH.
--- sound/soc/samsung/tm2_wm5110.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/samsung/tm2_wm5110.c +1 -2
@@ -439,8 +439,7 @@ static int tm2_probe(struct platform_device *pdev)snd_soc_card_set_drvdata (card, priv); card->dev = dev; - priv->gpio_mic_bias =devm_gpiod_get (dev,"mic-bias" , -GPIOF_OUT_INIT_LOW ); + priv->gpio_mic_bias =devm_gpiod_get (dev,"mic-bias" ,GPIOD_OUT_HIGH );if (IS_ERR (priv->gpio_mic_bias)) {dev_err (dev,"Failed to get mic bias gpio\n" );return PTR_ERR (priv->gpio_mic_bias);
Signature · 1 line
2.14.1
Re: [PATCH v2 3/3] ASoC: samsung: Fix invalid argument when devm_gpiod_get is called
Quoted 8 lines · Jaechul Lee
devm_gpiod_getis called withGPIOF_OUT_INIT_LOWbut the function doesn't allow the parameters. Unluckily,GPIOF_OUT_INIT_LOWis same value asGPIOD_ASISand gpio direction isn't set properly.Muted stream comes up when I try recording some sounds on TM2. mic-bias gpiod state can't be changed because the gpiod is created with the invalid parameter. The gpio should be set
GPIOD_OUT_HIGH.
Quoted 6 lines
Fixes 1bfbc260a5b4 ("ASoC: samsung: Add machine driver for Exynos5433 based TM2 board")Signed-off-by Jaechul Lee <[email protected]>--- sound/soc/samsung/tm2_wm5110.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Best regards,
Krzysztof