New and Resend the old patches
cover New and Resend the old patches
New and Resend the old patches basing the newest code version.
And this patch series has been tested based the VF610 Tower board.
PATCH 1/8 ASoC: fsl: Add VF610 soc audio card Kconfig
--- sound/soc/fsl/Kconfig | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
sound/soc/fsl/Kconfig +24 -0
@@ -219,3 +219,27 @@ config SND_SOC_IMX_MC13783 select SND_SOC_IMX_PCM_DMA endif # SND_IMX_SOC + +menuconfig SND_VF610_SOC + tristate "SoC Audio for Freescale VF610 CPUs" + select DMA_ENGINE + help + Say Y or M if you want to add support for codecs attached to + the VF610 CPUs. + + This will enable Freeacale SAI and SGTL5000 codec, and an extra + TWR-AUDIO-SGTL sub-board is needed for SGTL5000. + +if SND_VF610_SOC + +config SND_SOC_VF610_SGTL5000 + tristate "SoC Audio support for VF610 boards with SGTL5000" + depends on OF && I2C + select SND_SOC_FSL_SAI + select SND_SOC_SGTL5000 + select SND_SIMPLE_CARD + help + Say Y if you want to add support for SoC audio on an VF610 board with + a SGTL5000 codec and a SAI. + +endif #SND_VF610_SOC
Signature · 1 line
1.8.4
Mark Brown
maintainerRe: [PATCH 1/8] ASoC: fsl: Add VF610 soc audio card Kconfig
sound/soc/fsl/Kconfig config SND_SOC_IMX_MC13783 · line 231
Quoted 9 lines · Xiubo Li
sound/soc/fsl/Kconfig +9
-0+menuconfig SND_VF610_SOC + tristate "SoC Audio for Freescale VF610 CPUs" + select DMA_ENGINE + help + Say Y or M if you want to add support for codecs attached to + the VF610 CPUs. + + This will enable Freeacale SAI and SGTL5000 codec, and an extra + TWR-AUDIO-SGTL sub-board is needed for SGTL5000.
This bit is OK but...
sound/soc/fsl/Kconfig config SND_SOC_IMX_MC13783 · line 240
Quoted 6 lines
sound/soc/fsl/Kconfig +6
-0+config SND_SOC_VF610_SGTL5000 + tristate "SoC Audio support for VF610 boards with SGTL5000" + depends on OF && I2C + select SND_SOC_FSL_SAI + select SND_SOC_SGTL5000 + select SND_SIMPLE_CARD
...for simple card since the whole idea is to support any CODEC with the same driver we should probably just make sure that all the individual drivers can be enabled in Kconfig, that way we don't have to have specific Kconfig entries for boards and loose some of the benefit of the generic card. I sent a patch earlier exposing the OF supporting CODEC drivers, one for at least some of the Freescale CPU drivers was sent to the list recently too but there were some review comments.
RE: [PATCH 1/8] ASoC: fsl: Add VF610 soc audio card Kconfig
Hi Mark,
Quoted 7 lines
sound/soc/fsl/Kconfig config SND_SOC_IMX_MC13783 · line 240
Quoted 6 lines
sound/soc/fsl/Kconfig +6
-0+config SND_SOC_VF610_SGTL5000 + tristate "SoC Audio support for VF610 boards with SGTL5000" + depends on OF && I2C + select SND_SOC_FSL_SAI + select SND_SOC_SGTL5000 + select SND_SIMPLE_CARD
Quoted 7 lines
...for simple card since the whole idea is to support any CODEC with the same driver we should probably just make sure that all the individual drivers can be enabled in
Kconfig, that way we don't have to have specificKconfigentries for boards and loose some of the benefit of the generic card. I sent a patch earlier exposing the OF supporting CODEC drivers, one for at least some of the Freescale CPU drivers was sent to the list recently too but there were some review comments.
I hadn't found the patches, could you tell me the titles of them please?
Thanks very much,
--
* Happy New Year *
Best Regards,
Xiubo
Mark Brown
maintainerRe: [PATCH 1/8] ASoC: fsl: Add VF610 soc audio card Kconfig
Quoted 9 lines · On Sun, Jan 26, 2014 at 05:15:05AM +0000, [email protected] wrote:
Quoted 7 lines
...for simple card since the whole idea is to support any CODEC with the same driver we should probably just make sure that all the individual drivers can be enabled in
Kconfig, that way we don't have to have specificKconfigentries for boards and loose some of the benefit of the generic card. I sent a patch earlier exposing the OF supporting CODEC drivers, one for at least some of the Freescale CPU drivers was sent to the list recently too but there were some review comments.I hadn't found the patches, could you tell me the titles of them please?
My patch was "ASoC: codecs: Make OF supported CODECs visible in Kconfig". I can't remember offhand what the patch for i.MX was called.
RE: [PATCH 1/8] ASoC: fsl: Add VF610 soc audio card Kconfig
Quoted 13 lines
Subject: Re: [PATCH 1/8] ASoC: fsl: Add VF610 soc audio card
KconfigQuoted 7 lines · On Sun, Jan 26, 2014 at 05:15:05AM +0000, [email protected] wrote:
Quoted 7 lines
...for simple card since the whole idea is to support any CODEC with the same driver we should probably just make sure that all the individual drivers can be enabled in
Kconfig, that way we don't have to have specificKconfigentries for boards and loose some of the benefit of the generic card. I sent a patch earlier exposing the OF supporting CODEC drivers, one for at least some of the Freescale CPU drivers was sent to the list recently too but there were some review comments.
Quoted 4 lines
Quoted 1 line
I hadn't found the patches, could you tell me the titles of them please?
My patch was "ASoC: codecs: Make OF supported CODECs visible in
Kconfig". I can't remember offhand what the patch for i.MX was called.
Yes, found it.
If so, shouldn't the CPU DAIs(such as I2S) also be invisible in Kconfig like CODECs ?
Thanks very much.
--
Best Regards,
Xiubo
Mark Brown
maintainerRe: [PATCH 1/8] ASoC: fsl: Add VF610 soc audio card Kconfig
Quoted 7 lines · On Mon, Feb 10, 2014 at 04:12:19AM +0000, [email protected] wrote:
Quoted 2 lines
My patch was "ASoC: codecs: Make OF supported CODECs visible in
Kconfig". I can't remember offhand what the patch for i.MX was called.Yes, found it.
If so, shouldn't the CPU DAIs(such as I2S) also be invisible in
Kconfiglike CODECs ?
Yes, they should be getting made visible too when they can work with simple-card - that was what the i.MX patch was doing.
PATCH RESEND 2/8 ASoC: simple-card: fix __asoc_simple_card_dai_init
In reply to Xiubo LiIf the CPU/CODEC DAI set_sysclk() is not support, the -ENOTSUPP will returnd. Here do the check like set_fmt().
---
The VF610 Tower and VF610 LS1 platforms' ESAI and SPDIF will depend on this patch too.
sound/soc/generic/simple-card.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
sound/soc/generic/simple-card.c +11 -6
@@ -31,16 +31,21 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, daifmt |= set->fmt; -if (daifmt) +if (daifmt) { ret =snd_soc_dai_set_fmt (dai, daifmt); - -if (ret == -ENOTSUPP ) { -dev_dbg (dai->dev,"ASoC: set_fmt is not supported\n" ); - ret =0 ; +if (ret && ret != -ENOTSUPP ) { +dev_err (dai->dev,"simple-card: set_fmt error\n" ); +return ret; + } } -if (!ret && set->sysclk) +if (set->sysclk) { ret =snd_soc_dai_set_sysclk (dai,0 , set->sysclk,0 ); +if (ret && ret != -ENOTSUPP ) { +dev_err (dai->dev,"simple-card: set_sysclk error\n" ); +return ret; + } + }return ret; }
Signature · 1 line
1.8.4
Re: [PATCH Resend 2/8] ASoC: simple-card: fix __asoc_simple_card_dai_init
Quoted 38 lines · On Thu, 23 Jan 2014 13:02:44 +0800 Xiubo Li <[email protected]> wrote:
If the CPU/CODEC DAI
set_sysclk()is not support, the-ENOTSUPPwill returnd. Here do the check likeset_fmt().Signed-off-by Xiubo Li <[email protected]>---
The VF610 Tower and VF610 LS1 platforms' ESAI and SPDIF will depend on this patch too.
sound/soc/generic/simple-card.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)sound/soc/generic/simple-card.c +5
-5@@ -31,16 +31,21 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, daifmt |= set->fmt; -if (daifmt) +if (daifmt) { ret =snd_soc_dai_set_fmt (dai, daifmt); - -if (ret == -ENOTSUPP ) { -dev_dbg (dai->dev,"ASoC: set_fmt is not supported\n" ); - ret =0 ; +if (ret && ret != -ENOTSUPP ) { +dev_err (dai->dev,"simple-card: set_fmt error\n" ); +return ret; + } }
sound/soc/generic/simple-card.c static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, · line 50
Quoted 10 lines
sound/soc/generic/simple-card.c +6
-1-if (!ret && set->sysclk) +if (set->sysclk) { ret =snd_soc_dai_set_sysclk (dai,0 , set->sysclk,0 ); +if (ret && ret != -ENOTSUPP ) { +dev_err (dai->dev,"simple-card: set_sysclk error\n" ); +return ret; + } + }return ret;
Sorry: you must return 0 here
Quoted 1 line
sound/soc/generic/simple-card.c +0
-0}
Signature · 2 lines
Ken ar c'hentañ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/
RE: [PATCH Resend 2/8] ASoC: simple-card: fix __asoc_simple_card_dai_init
Quoted 33 lines
sound/soc/generic/simple-
Quoted 2 lines
sound/soc/generic/simple- renamed from sound/soc/generic/simple-card.c +0
-0
card.csound/soc/generic/simple-card.c static int __asoc_simple_card_dai_init(struct
Quoted 4 lines
index 6443c87..3b8c9a2 100644
sound/soc/generic/simple-card.c +0
-0@@ -31,16 +31,21 @@ static int __asoc_simple_card_dai_init(struct
snd_soc_dai*dai,Quoted 25 lines
sound/soc/generic/simple-card.c +11
-6daifmt |= set->fmt; -if (daifmt) +if (daifmt) { ret =snd_soc_dai_set_fmt (dai, daifmt); - -if (ret == -ENOTSUPP ) { -dev_dbg (dai->dev,"ASoC: set_fmt is not supported\n" ); - ret =0 ; +if (ret && ret != -ENOTSUPP ) { +dev_err (dai->dev,"simple-card: set_fmt error\n" ); +return ret; + } } -if (!ret && set->sysclk) +if (set->sysclk) { ret =snd_soc_dai_set_sysclk (dai,0 , set->sysclk,0 ); +if (ret && ret != -ENOTSUPP ) { +dev_err (dai->dev,"simple-card: set_sysclk error\n" ); +return ret; + } + }
Quoted 4 lines
sound/soc/generic/simple-card.c static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, · line 50
Quoted 1 line
sound/soc/generic/simple-card.c +0
-0return ret;Sorry: you must return 0 here
Yes, the ret maybe -ENOTSUPP.
I will revise it.
Thanks,
Best Regards,
Xiubo
PATCH RESEND 3/8 ASoC: simple-card: simplify the daifmt code
In reply to Xiubo LiIn the asoc_simple_card_parse_of() will parse the device node's CPU/CODEC DAI commone fmts, and then in asoc_simple_card_sub_parse_of() will parse the CPU/CODEC DAI's sub-node fmts, so we can combine the info->daifmt and info->set.fmt in asoc_simple_card_sub_parse_of() not while just before _set_fmt().
And this will be more easy to add new functions, such as supporting _set_tdm_slot(), etc.
--- sound/soc/generic/simple-card.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
sound/soc/generic/simple-card.c +9 -11
@@ -24,15 +24,12 @@ struct simple_card_data { };static int __asoc_simple_card_dai_init (struct snd_soc_dai *dai, -struct asoc_simple_dai *set, -unsigned int daifmt) +struct asoc_simple_dai *set) {int ret =0 ; - daifmt |= set->fmt; - -if (daifmt) { - ret =snd_soc_dai_set_fmt (dai, daifmt); +if (set->fmt) { + ret =snd_soc_dai_set_fmt (dai, set->fmt);if (ret && ret != -ENOTSUPP ) {dev_err (dai->dev,"simple-card: set_fmt error\n" );return ret;
@@ -56,14 +53,13 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)snd_soc_card_get_drvdata (rtd->card);struct snd_soc_dai *codec = rtd->codec_dai;struct snd_soc_dai *cpu = rtd->cpu_dai; -unsigned int daifmt = priv->daifmt;int ret; - ret =__asoc_simple_card_dai_init (codec, &priv->codec_dai, daifmt); + ret =__asoc_simple_card_dai_init (codec, &priv->codec_dai);if (ret <0 )return ret; - ret =__asoc_simple_card_dai_init (cpu, &priv->cpu_dai, daifmt); + ret =__asoc_simple_card_dai_init (cpu, &priv->cpu_dai);if (ret <0 )return ret;
@@ -72,6 +68,7 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)static int asoc_simple_card_sub_parse_of (struct device_node *np, +unsigned int daifmt,struct asoc_simple_dai *dai,const struct device_node **p_node,const char **name)
@@ -100,6 +97,7 @@ asoc_simple_card_sub_parse_of(struct device_node *np,* and specific "format" if it has */ dai->fmt =snd_soc_of_parse_daifmt (np,NULL ); + dai->fmt |= daifmt;/* * dai->sysclk come from
@@ -158,7 +156,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, ret = -EINVAL ; np =of_get_child_by_name (node,"simple-audio-card,cpu" );if (np) - ret =asoc_simple_card_sub_parse_of (np, + ret =asoc_simple_card_sub_parse_of (np, priv->daifmt, &priv->cpu_dai, &dai_link->cpu_of_node, &dai_link->cpu_dai_name);
@@ -169,7 +167,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, ret = -EINVAL ; np =of_get_child_by_name (node,"simple-audio-card,codec" );if (np) - ret =asoc_simple_card_sub_parse_of (np, + ret =asoc_simple_card_sub_parse_of (np, priv->daifmt, &priv->codec_dai, &dai_link->codec_of_node, &dai_link->codec_dai_name);
Signature · 1 line
1.8.4
Mark Brown
maintainerRe: [PATCH Resend 3/8] ASoC: simple-card: simplify the daifmt code
Quoted 5 lines · Xiubo Li
In the
asoc_simple_card_parse_of()will parse the device node's CPU/CODEC DAI commone fmts, and then inasoc_simple_card_sub_parse_of()will parse the CPU/CODEC DAI's sub-node fmts, so we can combine theinfo->daifmtandinfo->set.fmtinasoc_simple_card_sub_parse_of()not while just before_set_fmt().
This doesn't apply against the current topic/simple, can you please check and resend?
RE: [PATCH Resend 3/8] ASoC: simple-card: simplify the daifmt code
Quoted 4 lines
Subject: Re: [PATCH Resend 3/8] ASoC: simple-card: simplify the daifmt code
On Thu, Jan 23, 2014 at 01:02:45PM +0800, Xiubo Li wrote:
Quoted 8 lines
Quoted 5 lines
In the
asoc_simple_card_parse_of()will parse the device node's CPU/CODEC DAI commone fmts, and then inasoc_simple_card_sub_parse_of()will parse the CPU/CODEC DAI's sub-node fmts, so we can combine theinfo->daifmtandinfo->set.fmtinasoc_simple_card_sub_parse_of()not while just before_set_fmt().This doesn't apply against the current topic/simple, can you please check and resend?
Yes, it's caused by the dependency of PATCH 2/8, and the PATCH 2/8 needs to be revised.
I will resend them, which hasn't been applied, and also adding one binding patch.
Thanks,
--
Best Regards,
Xiubo
PATCH RESEND 4/8 ASoC: simple-card: Add snd_card's name parsing from DT node support
In reply to Xiubo LiIf the DT is used and the CPU DAI device has only one DAI, the card name will be like :
ALSA device list:
0: 40031000.sai-sgtl5000
And this name maybe a little ugly to some customers, so here the card name parsing from DT node is supported.
--- sound/soc/generic/simple-card.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/generic/simple-card.c +5 -1
@@ -140,6 +140,9 @@ static int asoc_simple_card_parse_of(struct device_node *node,char *name;int ret; +/* parsing the card name from DT */ +snd_soc_of_parse_card_name (&priv->snd_card,"simple-audio-card,name" ); +/* get CPU/CODEC common format via simple-audio-card,format */ priv->daifmt =snd_soc_of_parse_daifmt (node,"simple-audio-card," ) & (SND_SOC_DAIFMT_FORMAT_MASK |SND_SOC_DAIFMT_INV_MASK );
@@ -184,7 +187,8 @@ static int asoc_simple_card_parse_of(struct device_node *node, GFP_KERNEL);sprintf (name,"%s-%s" , dai_link->cpu_dai_name, dai_link->codec_dai_name); - priv->snd_card.name = name; +if (!priv->snd_card.name) + priv->snd_card.name = name; dai_link->name = dai_link->stream_name = name;/* simple-card assumes platform == cpu */
Signature · 1 line
1.8.4
Mark Brown
maintainerRe: [PATCH Resend 4/8] ASoC: simple-card: Add snd_card's name parsing from DT node support
sound/soc/generic/simple-card.c static int asoc_simple_card_parse_of(struct device_node *node, · line 145
Quoted 3 lines · Xiubo Li
sound/soc/generic/simple-card.c +3
-0+/* parsing the card name from DT */ +snd_soc_of_parse_card_name (&priv->snd_card,"simple-audio-card,name" ); +
This is OK but new properties need documenting in the binding.
PATCH 5/8 ASoC: core: set_tdm_slot() will return -ENOTSUPP if no operation provided
In reply to Xiubo LiMake it easier for generic code to work with set_tdm_slot() by distinguishing between the operation not being supported and an error as is done.
--- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-core.c +1 -1
@@ -3626,7 +3626,7 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,return dai->driver->ops->set_tdm_slot (dai, tx_mask, rx_mask, slots, slot_width); else - return -EINVAL; + return -ENOTSUPP; }EXPORT_SYMBOL_GPL (snd_soc_dai_set_tdm_slot);
Signature · 1 line
1.8.4
Re: [PATCH 5/8] ASoC: core: set_tdm_slot() will return -ENOTSUPP if no operation provided
Quoted 2 lines · Xiubo Li
Make it easier for generic code to work with
set_tdm_slot()by distinguishing between the operation not being supported and an error as is done.
Applied, thanks.
PATCH 6/8 ASoC: simple-card: add tdm slot supports
In reply to Xiubo LiFor some CPU/CODEC DAI devices the tdm slot maybe needed. This patch adds the tdm slot supporting for simple-card driver.
The style of the tdm slot in DT:
For instance:
simple-tdm-slot = <0xffffffc 0xffffffc 2 0>;
---
The VF610 Tower and VF610 LS1 platforms' SPDIF will depend on this patch.
include/sound/simple_card.h | 8 ++++++ sound/soc/generic/simple-card.c | 61 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 64 insertions(+), 5 deletions(-)
include/sound/simple_card.h +8 -0
@@ -14,10 +14,18 @@#include <sound/soc.h> +struct asoc_simple_tdm_slot { +unsigned int tx_mask; +unsigned int rx_mask; +int slots; +int slot_width; +}; +struct asoc_simple_dai {const char *name;unsigned int fmt;unsigned int sysclk; +struct asoc_simple_tdm_slot *tdm; };struct asoc_simple_card_info {
sound/soc/generic/simple-card.c +56 -5
104 lines not on this page · raw message
Signature · 1 line
1.8.4
Re: [PATCH 6/8] ASoC: simple-card: add tdm slot supports
Quoted 73 lines · Xiubo Li
include/sound/simple_card.h +8
-0@@ -14,10 +14,18 @@#include <sound/soc.h> +struct asoc_simple_tdm_slot { +unsigned int tx_mask; +unsigned int rx_mask; +int slots; +int slot_width; +}; +struct asoc_simple_dai {const char *name;unsigned int fmt;unsigned int sysclk; +struct asoc_simple_tdm_slot *tdm; };struct asoc_simple_card_info {sound/soc/generic/simple-card.c +23
-2@@ -32,7 +32,7 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, ret =snd_soc_dai_set_fmt (dai, set->fmt);if (ret && ret != -ENOTSUPP ) {dev_err (dai->dev,"simple-card: set_fmt error\n" ); -return ret; + goto err; } }@@ -40,10 +40,22 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, ret =snd_soc_dai_set_sysclk (dai,0 , set->sysclk,0 );if (ret && ret != -ENOTSUPP ) {dev_err (dai->dev,"simple-card: set_sysclk error\n" ); -return ret; + goto err; + } + } + +if (set->tdm) { + ret =snd_soc_dai_set_tdm_slot (dai, set->tdm->tx_mask, + set->tdm->rx_mask, + set->tdm->slots, + set->tdm->slot_width); +if (ret && ret != -ENOTSUPP ) { +dev_err (dai->dev,"simple-card: set_tdm_slot error\n" ); + goto err; } } +err:return ret; }@@ -67,11 +79,43 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) }static int +asoc_simple_card_of_parse_tdm_slot (struct device_node *np, +struct device *dev, +struct asoc_simple_dai *dai, +const char *propname) +{ +struct asoc_simple_tdm_slot *tdm; +u32 out_value[4 ]; +int ret; +
sound/soc/generic/simple-card.c static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) · line 100
Quoted 10 lines
sound/soc/generic/simple-card.c +10
-0+if (!of_property_read_bool (np, propname)) +return 0 ; + + tdm =devm_kzalloc (dev,sizeof (*tdm),GFP_KERNEL ); +if (!tdm) +return -ENOMEM ; + + ret =of_property_read_u32_array (np, propname, out_value,4 ); +if (ret) +return ret;
Looks like a memory leak?
Quoted 54 lines
sound/soc/generic/simple-card.c +23
-3+ + tdm->tx_mask = out_value[0 ]; + tdm->rx_mask = out_value[1 ]; + tdm->slots = out_value[2 ]; + tdm->slot_width = out_value[3 ]; + + dai->tdm = tdm; + +return 0 ; +} + +static int asoc_simple_card_sub_parse_of (struct device_node *np,unsigned int daifmt,struct asoc_simple_dai *dai,const struct device_node **p_node, - const char **name) +const char **name, +struct device *dev) {struct device_node *node;struct clk *clk;@@ -91,6 +135,11 @@ asoc_simple_card_sub_parse_of(struct device_node *np,if (ret <0 ) goto parse_error; +/* parse tdm_slot */ + ret =asoc_simple_card_of_parse_tdm_slot (np, dev, dai,"tdm-slot" ); +if (ret <0 ) + goto parse_error; +/* * bitclock-inversion, frame-inversion * bitclock-master, frame-master @@ -162,7 +211,8 @@ static int asoc_simple_card_parse_of(struct device_node *node, ret =asoc_simple_card_sub_parse_of (np, priv->daifmt, &priv->cpu_dai, &dai_link->cpu_of_node, - &dai_link->cpu_dai_name); + &dai_link->cpu_dai_name, + dev);if (ret <0 )return ret;@@ -173,7 +223,8 @@ static int asoc_simple_card_parse_of(struct device_node *node, ret =asoc_simple_card_sub_parse_of (np, priv->daifmt, &priv->codec_dai, &dai_link->codec_of_node, - &dai_link->codec_dai_name); + &dai_link->codec_dai_name, + dev);if (ret <0 )return ret;
RE: [PATCH 6/8] ASoC: simple-card: add tdm slot supports
Hi David,
Firstly thanks for your comment.
Quoted 13 lines
Quoted 13 lines
sound/soc/generic/simple-card.c +13
-0+asoc_simple_card_of_parse_tdm_slot(struct device_node *np, + struct device *dev, + struct asoc_simple_dai *dai, + const char *propname) +{ + struct asoc_simple_tdm_slot *tdm; +u32 out_value[4 ]; +int ret; + +if (!of_property_read_bool (np, propname)) +return 0 ; + + tdm =devm_kzalloc (dev,sizeof (*tdm),GFP_KERNEL );
Quoted 9 lines
sound/soc/generic/simple-card.c static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) · line 100
Quoted 6 lines
sound/soc/generic/simple-card.c +6
-0+if (!tdm) +return -ENOMEM ; + + ret =of_property_read_u32_array (np, propname, out_value,4 ); +if (ret) +return ret;Looks like a memory leak?
Using devm_ and this will be called by _probe().
Please see the "Documentation/driver-model/devres.txt" for detail about devres.
Quoted 11 lines
sound/soc/generic/simple-card.c static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) · line 111
Quoted 11 lines
sound/soc/generic/simple-card.c +11
-0+ + tdm->tx_mask = out_value[0 ]; + tdm->rx_mask = out_value[1 ]; + tdm->slots = out_value[2 ]; + tdm->slot_width = out_value[3 ]; + + dai->tdm = tdm; + +return 0 ; +} +
Thanks,
Best Regards,
Xiubo
Mark Brown
maintainerRe: [PATCH 6/8] ASoC: simple-card: add tdm slot supports
In reply to Xiubo LiQuoted 2 lines · Xiubo Li
For some CPU/CODEC DAI devices the tdm slot maybe needed. This patch adds the tdm slot supporting for simple-card driver.
This needs binding documentation.
PATCH RESEND 7/8 ASoC: add snd_soc_of_parse_audio_simple_widgets for DeviceTree
In reply to Xiubo LiThis patch adds snd_soc_of_parse_audio_simple_widgets() and supports below style of widgets name on DT.
"wname-prefix[ individual name]" "wname-prefix" includes: "Mic", "Line", "Hp", "Spk"...
For instance:
simple-audio-widgets = "Mic Jack", "Line In Jack", "Hp Jack", "Spk Ext", "Line Out Jack";
---
Add :
widgets[i].name = wname;
And this will use the widget name from DT node.
include/sound/soc.h | 2 ++ sound/soc/soc-core.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+)
include/sound/soc.h +2 -0
@@ -1173,6 +1173,8 @@ void snd_soc_util_exit(void);int snd_soc_of_parse_card_name (struct snd_soc_card *card,const char *propname); +int snd_soc_of_parse_audio_simple_widgets (struct snd_soc_card *card, +const char *propname);int snd_soc_of_parse_audio_routing (struct snd_soc_card *card,const char *propname); unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
sound/soc/soc-core.c +63 -0
69 lines not on this page · raw message
Signature · 1 line
1.8.4
Mark Brown
maintainerRe: [PATCH Resend 7/8] ASoC: add snd_soc_of_parse_audio_simple_widgets for DeviceTree
sound/soc/soc-core.c int snd_soc_of_parse_card_name(struct snd_soc_card *card, · line 4425
Quoted 6 lines · Xiubo Li
sound/soc/soc-core.c +6
-0+static struct snd_soc_dapm_widget simple_widgets[] = { +SND_SOC_DAPM_MIC ("Mic" ,NULL ), +SND_SOC_DAPM_LINE ("Line" ,NULL ), +SND_SOC_DAPM_HP ("Hp" ,NULL ), +SND_SOC_DAPM_SPK ("Spk" ,NULL ), +};
Does this mean we're restricted to a particular set of names? That seems sad and won't work if there's a desire for more than one of a given widget - the main use case I can see is multiple microphones with separate microphone biases. How about having some templates that we copy and then replace the name with the one the user supplied?
sound/soc/soc-core.c int snd_soc_of_parse_card_name(struct snd_soc_card *card, · line 4439
Quoted 4 lines
sound/soc/soc-core.c +4
-0+if (cnt <=0 ) { +dev_err (card->dev, +"ASoC: Property '%s' does not exist or " +"length is zero\n" , propname);
Don't split error messages over lines, this makes it harder to grep for them.
RE: [PATCH Resend 7/8] ASoC: add snd_soc_of_parse_audio_simple_widgets for DeviceTree
Quoted 8 lines
sound/soc/soc-core.c int snd_soc_of_parse_card_name(struct snd_soc_card *card, · line 4425
Quoted 7 lines
sound/soc/soc-core.c +6
-0+static struct snd_soc_dapm_widget simple_widgets[] = { +SND_SOC_DAPM_MIC ("Mic" ,NULL ), +SND_SOC_DAPM_LINE ("Line" ,NULL ), +SND_SOC_DAPM_HP ("Hp" ,NULL ), +SND_SOC_DAPM_SPK ("Spk" ,NULL ), +};
This is the templates for "Microphone XXX", "Line XXX", "Headphone XXX" and "Spk XXX" .
Quoted 6 lines
Does this mean we're restricted to a particular set of names? That seems sad and won't work if there's a desire for more than one of a given widget - the main use case I can see is multiple microphones with separate microphone biases. How about having some templates that we copy and then replace the name with the one the user supplied?
This code has already supplied this I think.
Using this API, the only limitation is that, for example if the user has multiple Microphones, it should set the name in DT file like:
"Mic XXX", "Mic YYY", "Mic ZZZ"...
And these widgets will use the template of : SND_SOC_DAPM_MIC("Mic", NULL), And the widgets' names will be replaced with "Mic XXX", "Mic YYY", "Mic ZZZ"... from the user's DT node.
Or your suggestion is :
The templates is:
+static struct snd_soc_dapm_widget simple_widgets[] = {
+ SND_SOC_DAPM_MIC("Mic", NULL),
+ SND_SOC_DAPM_LINE("Line", NULL),
+ SND_SOC_DAPM_HP("Hp", NULL),
+ SND_SOC_DAPM_SPK("Spk", NULL),
+};
And in the DT node:
simple-off-codec-widgets =
/* template-name user-supplied-name */
"Mic", "Microphone XXX", "Mic", "UUU Microphone YYY", "Hp", "TTT Headphone XXX", "Hp", "Headphone YYY";
And then just replace the template's name with the user supplied name?
Thanks,
Best Regards,
Xiubo
Mark Brown
maintainerRe: [PATCH Resend 7/8] ASoC: add snd_soc_of_parse_audio_simple_widgets for DeviceTree
Quoted 10 lines · On Fri, Jan 24, 2014 at 02:46:33AM +0000, [email protected] wrote:
Quoted 6 lines
sound/soc/soc-core.c int snd_soc_of_parse_card_name(struct snd_soc_card *card, · line 4425
Quoted 6 lines
sound/soc/soc-core.c +6
-0+static struct snd_soc_dapm_widget simple_widgets[] = { +SND_SOC_DAPM_MIC ("Mic" ,NULL ), +SND_SOC_DAPM_LINE ("Line" ,NULL ), +SND_SOC_DAPM_HP ("Hp" ,NULL ), +SND_SOC_DAPM_SPK ("Spk" ,NULL ), +};This is the templates for "Microphone XXX", "Line XXX", "Headphone XXX" and "Spk XXX" .
Quoted 7 lines
Quoted 5 lines
Does this mean we're restricted to a particular set of names? That seems sad and won't work if there's a desire for more than one of a given widget - the main use case I can see is multiple microphones with separate microphone biases. How about having some templates that we copy and then replace the name with the one the user supplied?
This code has already supplied this I think.
OK, that's fine - this is one of the things that the lack of binding documentation doesn't help with, it says what the code is supposed to do. When reviewing DT code without bindings I tend to just skim the code.
PATCH 8/8 ASoC: simple-card: add off-codec widgets supports.
In reply to Xiubo Li--- sound/soc/generic/simple-card.c | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/soc/generic/simple-card.c +8 -0
@@ -196,6 +196,14 @@ static int asoc_simple_card_parse_of(struct device_node *node, priv->daifmt =snd_soc_of_parse_daifmt (node,"simple-audio-card," ) & (SND_SOC_DAIFMT_FORMAT_MASK |SND_SOC_DAIFMT_INV_MASK ); +/* off-codec widgets */ +if (of_property_read_bool (node,"simple-audio-card,widgets" )) { + ret =snd_soc_of_parse_audio_simple_widgets (&priv->snd_card, +"simple-audio-card,widgets" ); +if (ret) +return ret; + } +/* DAPM routes */ if (of_property_read_bool (node,"simple-audio-card,routing" )) { ret = snd_soc_of_parse_audio_routing(&priv->snd_card,
Signature · 1 line
1.8.4
Mark Brown
maintainerRe: [PATCH 8/8] ASoC: simple-card: add off-codec widgets supports.
sound/soc/generic/simple-card.c static int asoc_simple_card_parse_of(struct device_node *node, · line 205
Quoted 7 lines · Xiubo Li
sound/soc/generic/simple-card.c +7
-0+/* off-codec widgets */ +if (of_property_read_bool (node,"simple-audio-card,widgets" )) { + ret =snd_soc_of_parse_audio_simple_widgets (&priv->snd_card, +"simple-audio-card,widgets" ); +if (ret) +return ret; + }
Again, needs documenting.