ASoC: simple-card / rsnd resend
Subsystems (4)
PATCH RESEND 1/1 ASoC: simple-card / rsnd resend
Hi Mark
These are resend patches which are still not applied, and, no response.
The original patch-set had sent in...
Subject: [PATCH 0/3] ASoC: simple-card: cleanup simple-card daifmt
Date: Tue, 09 Sep 2014 21:36:43 -0700 (PDT)
Subject: [PATCH 0/8] ASoC: rsnd: add Volume Ramp support
Date: Tue, 21 Oct 2014 18:13:17 -0700 (PDT)
Best regards
---
Kuninori Morimoto
PATCH 1/1 ASoC: simple-card: add asoc_simple_card_parse_daifmt()
From: Kuninori Morimoto <[email protected]>
Current daifmt setting method in simple-card driver is placed to many places, and using un-readable/confusable method. This patch adds new asoc_simple_card_parse_daifmt() and tidyup code.
--- sound/soc/generic/simple-card.c | 134 +++++++++++++++++++-------------------- 1 file changed, 65 insertions(+), 69 deletions(-)
sound/soc/generic/simple-card.c +65 -69
@@ -226,6 +226,53 @@ asoc_simple_card_sub_parse_of(struct device_node *np,return 0 ; } +static int asoc_simple_card_parse_daifmt (struct device_node *node, +struct simple_card_data *priv, +struct device_node *cpu, +struct device_node *codec, +char *prefix,int idx) +{ +struct device *dev =simple_priv_to_dev (priv); +struct device_node *bitclkmaster =NULL ; +struct device_node *framemaster =NULL ; +struct simple_dai_props *dai_props =simple_priv_to_props (priv, idx); +struct asoc_simple_dai *cpu_dai = &dai_props->cpu_dai; +struct asoc_simple_dai *codec_dai = &dai_props->codec_dai; +unsigned int daifmt; + + daifmt =snd_soc_of_parse_daifmt (node, prefix, + &bitclkmaster, &framemaster); + daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK ; + +if (strlen (prefix) && !bitclkmaster && !framemaster) { +/* +* No dai-link level and master setting was not found from +* sound node level, revert back to legacy DT parsing and +* take the settings from codec node. +*/ +dev_dbg (dev,"Revert to legacy daifmt parsing\n" ); + + cpu_dai->fmt = codec_dai->fmt = +snd_soc_of_parse_daifmt (codec,NULL ,NULL ,NULL ) | + (daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK ); + }else { +if (codec == bitclkmaster) + daifmt |= (codec == framemaster) ? +SND_SOC_DAIFMT_CBM_CFM :SND_SOC_DAIFMT_CBM_CFS ; +else + daifmt |= (codec == framemaster) ? +SND_SOC_DAIFMT_CBS_CFM :SND_SOC_DAIFMT_CBS_CFS ; + + cpu_dai->fmt = daifmt; + codec_dai->fmt = daifmt; + } + +of_node_put (bitclkmaster); +of_node_put (framemaster); + +return 0 ; +} + static int asoc_simple_card_dai_link_of(struct device_node *node, struct simple_card_data *priv, int idx,
@@ -234,10 +281,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,struct device *dev =simple_priv_to_dev (priv);struct snd_soc_dai_link *dai_link =simple_priv_to_link (priv, idx);struct simple_dai_props *dai_props =simple_priv_to_props (priv, idx); -struct device_node *np =NULL ; -struct device_node *bitclkmaster =NULL ; -struct device_node *framemaster =NULL ; -unsigned int daifmt; +struct device_node *cpu =NULL ; +struct device_node *codec =NULL ;char *name;char prop[128 ];char *prefix ="" ;
@@ -247,85 +292,36 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,if (is_top_level_node) prefix ="simple-audio-card," ; - daifmt =snd_soc_of_parse_daifmt (node, prefix, - &bitclkmaster, &framemaster); - daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK ; -snprintf (prop,sizeof (prop),"%scpu" , prefix); - np =of_get_child_by_name (node, prop); -if (!np) { + cpu =of_get_child_by_name (node, prop); + +snprintf (prop,sizeof (prop),"%scodec" , prefix); + codec =of_get_child_by_name (node, prop); + +if (!cpu || !codec) { ret = -EINVAL ;dev_err (dev,"%s: Can't find %s DT node\n" , __func__, prop); goto dai_link_of_err; } - ret =asoc_simple_card_sub_parse_of (np, &dai_props->cpu_dai, + ret =asoc_simple_card_parse_daifmt (node, priv, + cpu, codec, prefix, idx); +if (ret <0 ) + goto dai_link_of_err; + + ret =asoc_simple_card_sub_parse_of (cpu, &dai_props->cpu_dai, &dai_link->cpu_of_node, &dai_link->cpu_dai_name, &cpu_args);if (ret <0 ) goto dai_link_of_err; - dai_props->cpu_dai.fmt = daifmt; -switch (((np == bitclkmaster) <<4 ) | (np == framemaster)) { -case 0x11 : - dai_props->cpu_dai.fmt |=SND_SOC_DAIFMT_CBS_CFS ; -break ; -case 0x10 : - dai_props->cpu_dai.fmt |=SND_SOC_DAIFMT_CBS_CFM ; -break ; -case 0x01 : - dai_props->cpu_dai.fmt |=SND_SOC_DAIFMT_CBM_CFS ; -break ; -default : - dai_props->cpu_dai.fmt |=SND_SOC_DAIFMT_CBM_CFM ; -break ; - } - -of_node_put (np); -snprintf (prop,sizeof (prop),"%scodec" , prefix); - np =of_get_child_by_name (node, prop); -if (!np) { - ret = -EINVAL ; -dev_err (dev,"%s: Can't find %s DT node\n" , __func__, prop); - goto dai_link_of_err; - } - - ret =asoc_simple_card_sub_parse_of (np, &dai_props->codec_dai, + ret =asoc_simple_card_sub_parse_of (codec, &dai_props->codec_dai, &dai_link->codec_of_node, &dai_link->codec_dai_name,NULL );if (ret <0 ) goto dai_link_of_err; -if (strlen (prefix) && !bitclkmaster && !framemaster) { -/* -* No DAI link level and master setting was found -* from sound node level, revert back to legacy DT -* parsing and take the settings from codec node. -*/ -dev_dbg (dev,"%s: Revert to legacy daifmt parsing\n" , - __func__); - dai_props->cpu_dai.fmt = dai_props->codec_dai.fmt = -snd_soc_of_parse_daifmt (np,NULL ,NULL ,NULL ) | - (daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK ); - }else { - dai_props->codec_dai.fmt = daifmt; -switch (((np == bitclkmaster) <<4 ) | (np == framemaster)) { -case 0x11 : - dai_props->codec_dai.fmt |=SND_SOC_DAIFMT_CBM_CFM ; -break ; -case 0x10 : - dai_props->codec_dai.fmt |=SND_SOC_DAIFMT_CBM_CFS ; -break ; -case 0x01 : - dai_props->codec_dai.fmt |=SND_SOC_DAIFMT_CBS_CFM ; -break ; -default : - dai_props->codec_dai.fmt |=SND_SOC_DAIFMT_CBS_CFS ; -break ; - } - } -if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) { ret = -EINVAL ; goto dai_link_of_err;
@@ -368,9 +364,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, dai_link->cpu_dai_name =NULL ; dai_link_of_err: -of_node_put (np); -of_node_put (bitclkmaster); -of_node_put (framemaster); +of_node_put (cpu); +of_node_put (codec); +return ret; }
Signature · 1 line
1.7.9.5
Re: [PATCH] ASoC: simple-card: add asoc_simple_card_parse_daifmt()
Quoted 6 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
Current daifmt setting method in simple-card driver is placed to many places, and using un-readable/confusable method. This patch adds new
asoc_simple_card_parse_daifmt()and tidyup code.
Applied, thanks.
PATCH 4/8 ASoC: rsnd: control DVC_DVUCR under rsnd_dvc_volume_update()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
rsnd_dvc_volume_update() is main function to control DVC feature like Digital Volume / Mute / Ramp etc. DVC_DVUCR should be controlled under this function.
--- sound/soc/sh/rcar/dvc.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
sound/soc/sh/rcar/dvc.c +10 -4
@@ -40,6 +40,7 @@ struct rsnd_dvc {static void rsnd_dvc_volume_update (struct rsnd_mod *mod) {struct rsnd_dvc *dvc =rsnd_mod_to_dvc (mod); +u32 dvucr =0 ;u32 mute =0 ;int i;
@@ -47,10 +48,18 @@ static void rsnd_dvc_volume_update(struct rsnd_mod *mod) mute |= (!!dvc->mute.val[i]) << i; } +/* Enable Digital Volume */ + dvucr =0x100 ;rsnd_mod_write (mod,DVC_VOL0R , dvc->volume.val[0 ]);rsnd_mod_write (mod,DVC_VOL1R , dvc->volume.val[1 ]); -rsnd_mod_write (mod,DVC_ZCMCR , mute); +/* Enable Mute */ +if (mute) { + dvucr |=0x1 ; +rsnd_mod_write (mod,DVC_ZCMCR , mute); + } + +rsnd_mod_write (mod,DVC_DVUCR , dvucr); } static int rsnd_dvc_probe_gen2(struct rsnd_mod *mod,
@@ -103,9 +112,6 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,rsnd_mod_write (dvc_mod,DVC_ADINR ,rsnd_get_adinr (dvc_mod)); -/* enable Volume / Mute */ -rsnd_mod_write (dvc_mod,DVC_DVUCR ,0x101 ); -/* ch0/ch1 Volume */ rsnd_dvc_volume_update (dvc_mod);
Signature · 1 line
1.7.9.5
PATCH 5/8 ASoC: rsnd: move DVC_DVUER settings under rsnd_dvc_volume_update()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
We need to Enable/Disable DVC_DVUER register if we set DVCp_ZCMCR, DVCp_VRCTR, DVCp_VRPDR, DVCp_VRDBR, DVCp_VOL0R, DVCp_VOL1R, DVCp_VOL2R, DVCp_VOL3R, DVCp_VOL4R, DVCp_VOL5R, DVCp_VOL6R, DVCp_VOL7R and, these are controlled under rsnd_dvc_volume_update(). This patch moves DVC_DVUER settings to it.
--- sound/soc/sh/rcar/dvc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/sh/rcar/dvc.c +6 -2
@@ -48,6 +48,9 @@ static void rsnd_dvc_volume_update(struct rsnd_mod *mod) mute |= (!!dvc->mute.val[i]) << i; } +/* Enable DVC Register access */ +rsnd_mod_write (mod,DVC_DVUER ,1 ); +/* Enable Digital Volume */ dvucr =0x100 ;rsnd_mod_write (mod,DVC_VOL0R , dvc->volume.val[0 ]);
@@ -60,6 +63,9 @@ static void rsnd_dvc_volume_update(struct rsnd_mod *mod) }rsnd_mod_write (mod,DVC_DVUCR , dvucr); + +/* Disable DVC Register access */ +rsnd_mod_write (mod,DVC_DVUER ,0 ); } static int rsnd_dvc_probe_gen2(struct rsnd_mod *mod,
@@ -117,8 +123,6 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,rsnd_mod_write (dvc_mod,DVC_DVUIR ,0 ); -rsnd_mod_write (dvc_mod,DVC_DVUER ,1 ); -rsnd_adg_set_cmd_timsel_gen2 (rdai, dvc_mod, io);return 0 ;
Signature · 1 line
1.7.9.5
PATCH 6/8 ASoC: rsnd: enable multiple DVC valume settings
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
DVC controls some digital volume features. Some of them requests values for "each channels", but, some of them requests values for "feature". Current dvc.c is supporting Mute/Volume, and these have "each channels" settings. This patch adds rsnd_dvc_cfg_m and care about multiple settings for each channels.
--- sound/soc/sh/rcar/dvc.c | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-)
sound/soc/sh/rcar/dvc.c +29 -13
@@ -17,6 +17,12 @@struct rsnd_dvc_cfg {unsigned int max; +unsigned int size; +u32 *val; +}; + +struct rsnd_dvc_cfg_m { +struct rsnd_dvc_cfg cfg;u32 val[RSND_DVC_CHANNELS ]; };
@@ -24,8 +30,8 @@ struct rsnd_dvc {struct rsnd_dvc_platform_info *info;/* rcar_snd.h */ struct rsnd_mod mod;struct clk *clk; -struct rsnd_dvc_cfg volume; -struct rsnd_dvc_cfg mute; +struct rsnd_dvc_cfg_m volume; +struct rsnd_dvc_cfg_m mute; };#define rsnd_mod_to_dvc (_mod) \
@@ -44,9 +50,8 @@ static void rsnd_dvc_volume_update(struct rsnd_mod *mod)u32 mute =0 ;int i; -for (i =0 ; i <RSND_DVC_CHANNELS ; i++) { - mute |= (!!dvc->mute.val[i]) << i; - } +for (i =0 ; i < dvc->mute.cfg.size; i++) + mute |= (!!dvc->mute.cfg.val[i]) << i;/* Enable DVC Register access */ rsnd_mod_write (mod,DVC_DVUER ,1 );
@@ -177,7 +182,7 @@ static int rsnd_dvc_volume_get(struct snd_kcontrol *kctrl,struct rsnd_dvc_cfg *cfg = (struct rsnd_dvc_cfg *)kctrl->private_value;int i; -for (i =0 ; i <RSND_DVC_CHANNELS ; i++) +for (i =0 ; i < cfg->size; i++) ucontrol->value.integer.value[i] = cfg->val[i];return 0 ;
@@ -190,7 +195,7 @@ static int rsnd_dvc_volume_put(struct snd_kcontrol *kctrl,struct rsnd_dvc_cfg *cfg = (struct rsnd_dvc_cfg *)kctrl->private_value;int i, change =0 ; -for (i =0 ; i <RSND_DVC_CHANNELS ; i++) { +for (i =0 ; i < cfg->size; i++) { change |= (ucontrol->value.integer.value[i] != cfg->val[i]); cfg->val[i] = ucontrol->value.integer.value[i]; }
@@ -230,6 +235,19 @@ static int __rsnd_dvc_pcm_new(struct rsnd_mod *mod,return 0 ; } +static int _rsnd_dvc_pcm_new_m (struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct snd_soc_pcm_runtime *rtd, +const unsigned char *name, +struct rsnd_dvc_cfg_m *private, +u32 max) +{ + private->cfg.max = max; + private->cfg.size =RSND_DVC_CHANNELS ; + private->cfg.val = private->val; +return __rsnd_dvc_pcm_new (mod, rdai, rtd, name, &private->cfg); +} +static int rsnd_dvc_pcm_new (struct rsnd_mod *mod,struct rsnd_dai *rdai,struct snd_soc_pcm_runtime *rtd)
@@ -239,20 +257,18 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,int ret;/* Volume */ - dvc->volume.max =0x00800000 -1 ; - ret =__rsnd_dvc_pcm_new (mod, rdai, rtd, + ret =_rsnd_dvc_pcm_new_m (mod, rdai, rtd,rsnd_dai_is_play (rdai, io) ?"DVC Out Playback Volume" :"DVC In Capture Volume" , - &dvc->volume); + &dvc->volume,0x00800000 -1 );if (ret <0 )return ret;/* Mute */ - dvc->mute.max =1 ; - ret =__rsnd_dvc_pcm_new (mod, rdai, rtd, + ret =_rsnd_dvc_pcm_new_m (mod, rdai, rtd,rsnd_dai_is_play (rdai, io) ?"DVC Out Mute Switch" :"DVC In Mute Switch" , - &dvc->mute); + &dvc->mute,1 );if (ret <0 )return ret;
Signature · 1 line
1.7.9.5
PATCH 7/8 ASoC: rsnd: enable single DVC valume settings
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
DVC controls some digital volume features. Some of them requests values for "each channels", but, some of them requests values for "feature". And, Volume Ramp has "feature" settings.
This patch adds rsnd_dvc_cfg_s and care about single settings.
Compiler will report like below at this point, but, it will be removed if Volume Ramp was supported.
warning: '_rsnd_dvc_pcm_new_s' defined but not used
--- sound/soc/sh/rcar/dvc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
sound/soc/sh/rcar/dvc.c +18 -0
@@ -26,6 +26,11 @@ struct rsnd_dvc_cfg_m {u32 val[RSND_DVC_CHANNELS ]; }; +struct rsnd_dvc_cfg_s { +struct rsnd_dvc_cfg cfg; +u32 val; +}; +struct rsnd_dvc {struct rsnd_dvc_platform_info *info;/* rcar_snd.h */ struct rsnd_mod mod;
@@ -248,6 +253,19 @@ static int _rsnd_dvc_pcm_new_m(struct rsnd_mod *mod,return __rsnd_dvc_pcm_new (mod, rdai, rtd, name, &private->cfg); } +static int _rsnd_dvc_pcm_new_s (struct rsnd_mod *mod, +struct rsnd_dai *rdai, +struct snd_soc_pcm_runtime *rtd, +const unsigned char *name, +struct rsnd_dvc_cfg_s *private, +u32 max) +{ + private->cfg.max = max; + private->cfg.size =1 ; + private->cfg.val = &private->val; +return __rsnd_dvc_pcm_new (mod, rdai, rtd, name, &private->cfg); +} +static int rsnd_dvc_pcm_new (struct rsnd_mod *mod,struct rsnd_dai *rdai,struct snd_soc_pcm_runtime *rtd)
Signature · 1 line
1.7.9.5
PATCH 8/8 ASoC: rsnd: Add Volume Ramp support
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
This patch adds Volume Ramp to
Renesas sound driver.
This sample indicates Mute -> Volume 100% -> Mute
amixer set "DVC Out Ramp" 100% // Mute as default
amixer set "DVC Out Ramp Period" 80%
amixer set "DVC Out Ramp Enable" on
aplay xxx.wav &
amixer set "DVC Out Ramp" 0% // to Volume 100%
amixer set "DVC Out Ramp" 100% // to Mute
--- sound/soc/sh/rcar/dvc.c | 34 ++++++++++++++++++++++++++++++++++ sound/soc/sh/rcar/gen.c | 3 +++ sound/soc/sh/rcar/rsnd.h | 6 ++++++ 3 files changed, 43 insertions(+)
sound/soc/sh/rcar/dvc.c +34 -0
@@ -37,6 +37,9 @@ struct rsnd_dvc {struct clk *clk;struct rsnd_dvc_cfg_m volume;struct rsnd_dvc_cfg_m mute; +struct rsnd_dvc_cfg_s ren;/* Ramp Enable */ +struct rsnd_dvc_cfg_s rperiod;/* Ramp Period */ +struct rsnd_dvc_cfg_s rvol;/* Ramp Volume */ };#define rsnd_mod_to_dvc (_mod) \
@@ -66,6 +69,15 @@ static void rsnd_dvc_volume_update(struct rsnd_mod *mod)rsnd_mod_write (mod,DVC_VOL0R , dvc->volume.val[0 ]);rsnd_mod_write (mod,DVC_VOL1R , dvc->volume.val[1 ]); +/* Enable Ramp */ +if (dvc->ren.val) { + dvucr |=0x10 ; +rsnd_mod_write (mod,DVC_VRCTR ,0xff ); +rsnd_mod_write (mod,DVC_VRPDR , dvc->rperiod.val <<8 | + dvc->rperiod.val); +rsnd_mod_write (mod,DVC_VRDBR , dvc->rvol.val); + } +/* Enable Mute */ if (mute) { dvucr |=0x1 ;
@@ -290,6 +302,28 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,if (ret <0 )return ret; +/* Ramp */ + ret =_rsnd_dvc_pcm_new_s (mod, rdai, rtd, +rsnd_dai_is_play (rdai, io) ? +"DVC Out Ramp Enable" :"DVC In Ramp Enable" , + &dvc->ren,1 ); +if (ret <0 ) +return ret; + + ret =_rsnd_dvc_pcm_new_s (mod, rdai, rtd, +rsnd_dai_is_play (rdai, io) ? +"DVC Out Ramp Period" :"DVC In Ramp Period" , + &dvc->rperiod,0x17 );/* 10111 */ +if (ret <0 ) +return ret; + + ret =_rsnd_dvc_pcm_new_s (mod, rdai, rtd, +rsnd_dai_is_play (rdai, io) ? +"DVC Out Ramp Volume" :"DVC In Ramp Volume" , + &dvc->rvol,0x3ff ); +if (ret <0 ) +return ret; +return 0 ; }
sound/soc/sh/rcar/gen.c +3 -0
@@ -324,6 +324,9 @@ static int rsnd_gen2_probe(struct platform_device *pdev,RSND_GEN_M_REG (DVC_ADINR ,0xe08 ,0x100 ),RSND_GEN_M_REG (DVC_DVUCR ,0xe10 ,0x100 ),RSND_GEN_M_REG (DVC_ZCMCR ,0xe14 ,0x100 ), +RSND_GEN_M_REG (DVC_VRCTR ,0xe18 ,0x100 ), +RSND_GEN_M_REG (DVC_VRPDR ,0xe1c ,0x100 ), +RSND_GEN_M_REG (DVC_VRDBR ,0xe20 ,0x100 ),RSND_GEN_M_REG (DVC_VOL0R ,0xe28 ,0x100 ),RSND_GEN_M_REG (DVC_VOL1R ,0xe2c ,0x100 ), RSND_GEN_M_REG(DVC_DVUER, 0xe48, 0x100),
sound/soc/sh/rcar/rsnd.h +6 -0
@@ -91,6 +91,9 @@ enum rsnd_reg {RSND_REG_SHARE20 ,RSND_REG_SHARE21 ,RSND_REG_SHARE22 , +RSND_REG_SHARE23 , +RSND_REG_SHARE24 , +RSND_REG_SHARE25 , RSND_REG_MAX, };
@@ -129,6 +132,9 @@ enum rsnd_reg {#define RSND_REG_CMD_CTRL RSND_REG_SHARE20#define RSND_REG_CMDOUT_TIMSEL RSND_REG_SHARE21#define RSND_REG_BUSIF_DALIGN RSND_REG_SHARE22 +#define RSND_REG_DVC_VRCTR RSND_REG_SHARE23 +#define RSND_REG_DVC_VRPDR RSND_REG_SHARE24 +#define RSND_REG_DVC_VRDBR RSND_REG_SHARE25struct rsnd_of_data ;struct rsnd_priv ;
Signature · 1 line
1.7.9.5
Mark Brown
maintainerQuoted 2 lines · Kuninori Morimoto
Subject: [PATCH 0/8] ASoC: rsnd: add Volume Ramp support
Date: Tue, 21 Oct 2014 18:13:17 -0700 (PDT)
You sent these patches less than a week ago, please allow a reasonable time for a response.