Audio improvements/SSIU BUSIF/
Subsystems (10)
cover Audio improvements/SSIU BUSIF/
This patch add support for SSIU BUSIF/ TDM split mode. Also it fixes some of audio issues.
This patch series is based on linux-4.19.y-cip and all the patches in this series are cherry-picked from linux rc tree.
Dmytro Prokopchuk (1):
ASoC: rsnd: fixup SSI clock during suspend/resume modes
Dragos Tarcatu (2):
ASoC: rsnd: add support for 16/24 bit slot widths
ASoC: rsnd: add support for 8 bit S8 format
Fabrizio Castro (1):
arm64: dts: renesas: r8a774a1: Add SSIU support for sound
Jiada Wang (12):
ASoC: rsnd: add warning message to rsnd_kctrl_accept_runtime()
ASoC: rsnd: remove is_play parameter from hw_rule function
ASoC: rsnd: ssi: Fix issue in dma data address assignment
ASoC: rsnd: ssi: Check runtime channel number rather than hw_params
ASoc: rsnd: dma: Calculate dma address with consider of BUSIF
ASoc: rsnd: dma: Calculate PDMACHCRE with consider of BUSIF
ASoC: rsnd: ssiu: Support BUSIF other than BUSIF0
ASoC: rsnd: ssiu: Support to init different BUSIF instance
ASoC: rsnd: ssiu: correct shift bit for ssiu9
ASoC: rsnd: gen: fix SSI9 4/5/6/7 busif related register address
ASoC: rsnd: src: Avoid a potential deadlock
ASoC: rsnd: src: fix compiler warnings
Kuninori Morimoto (37):
ASoC: rsnd: merge .nolock_start and .prepare
ASoC: rsnd: gen: use tab instead of white-space
ASoC: rsnd: don't use %p for dev_dbg()
ASoC: add for_each_rtd_codec_dai() macro
ASoC: convert for_each_rtd_codec_dai() for missing part
ASoC: add for_each_dpcm_fe() macro
ASoC: add for_each_dpcm_be() macro
ASoC: rsnd: use 32bit TDM width as default
ASoC: rsnd: enable TDM settings for SSI parent
ASoC: rsnd: tidyup SSICR::SWSP for TDM
ASoC: rsnd: move .get_status under rsnd_mod_ops
ASoC: rsnd: add .get_id/.get_id_sub
ASoC: rsnd: rsnd_mod_name() handles both name and ID
ASoC: rsnd: remove endpoint bidirectional check
ASoC: rsnd: rename rsnd_runtime_is_ssi_xxx()
ASoC: rsnd: use defined io_playback/io_capture
ASoC: rsnd: move HDMI information from ssi.c to core.c
ASoC: rsnd: handle DPCM converted rate/chan under core
ASoC: rsnd: add SSIU BUSIF support
ASoC: rsnd: add TDM Split mode support
ASoC: rsnd: use ring buffer for rsnd_mod_name()
ASoC: rsnd: tidyup rsnd_parse_connect_ssiu_compatible()
ASoC: rsnd: makes rsnd_ssi_is_dma_mode() static
ASoC: rsnd: tidyup registering method for rsnd_kctrl_new()
ASoC: rsnd: indicates Channel and Mode for debug
ASoC: rsnd: fixup mod ID for CTU regmap read/write
ASoC: rsnd: add missing TDM Split mode support for simple-card
ASoC: rsnd: remove RSND_REG_ from rsnd_reg
ASoC: rsnd: update BSDSR/BSDISR handling
ASoC: rsnd: fixup MIX kctrl registration
ASoC: rsnd: synchronize connection check for simple-card/audio-graph
ASoC: rsnd: fixup TDM Split mode check for CTU
ASoC: rsnd: fixup 6ch settings to 8ch
ASoC: rsnd: move pcm_new from snd_soc_component_driver to
snd_soc_dai_driver
ASoC: rsnd: ssiu: tidyup SSI_MODE1/2 settings
ASoC: rsnd: add missing pin sharing with SSI9
ASoC: rsnd: do error check after rsnd_channel_normalization()
Nilkanth Ahirrao (1):
ASoC: rsnd: fixup mod ID calculation in rsnd_ctu_probe_
Takashi Iwai (2):
ASoC: sh: Avoid passing NULL to memory allocators
ASoC: sh: Drop superfluous PCM preallocation error checks
Timo Wischer (1):
ASoC: rsnd: Support hw_free() callback at DAI level
arch/arm64/boot/dts/renesas/r8a774a1.dtsi | 251 +++++++++- include/sound/soc-dpcm.h | 10 + include/sound/soc.h | 7 + sound/soc/fsl/fsl_asrc_dma.c | 2 +- sound/soc/intel/boards/kbl_rt5663_max98927.c | 5 +- .../soc/intel/boards/kbl_rt5663_rt5514_max98927.c | 5 +- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | 5 +- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 5 +- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 5 +- sound/soc/meson/axg-card.c | 6 +- sound/soc/sh/fsi.c | 3 +- sound/soc/sh/rcar/adg.c | 43 +- sound/soc/sh/rcar/cmd.c | 11 +- sound/soc/sh/rcar/core.c | 531 ++++++++++++++------- sound/soc/sh/rcar/ctu.c | 140 ++---- sound/soc/sh/rcar/dma.c | 185 ++++--- sound/soc/sh/rcar/dvc.c | 21 +- sound/soc/sh/rcar/gen.c | 106 +++- sound/soc/sh/rcar/mix.c | 3 +- sound/soc/sh/rcar/rsnd.h | 440 ++++++++++------- sound/soc/sh/rcar/src.c | 175 ++++--- sound/soc/sh/rcar/ssi.c | 372 +++++++-------- sound/soc/sh/rcar/ssiu.c | 376 +++++++++++---- sound/soc/sh/siu_pcm.c | 15 +- sound/soc/soc-compress.c | 4 +- sound/soc/soc-core.c | 38 +- sound/soc/soc-dapm.c | 14 +- sound/soc/soc-pcm.c | 239 +++++----- 28 files changed, 1867 insertions(+), 1150 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/57 ASoC: rsnd: add warning message to rsnd_kctrl_accept_runtime()
From: Jiada Wang <[email protected]>
commit b5c088689847372794500f83b65673aaa8ca4d8d upstream.
Add warning message to rsnd_kctrl_accept_runtime(), when kctrl update is rejected due to corresponding dai-link is idle. So that user can notice the reason of kctrl update failure.
--- sound/soc/sh/rcar/core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
sound/soc/sh/rcar/core.c +8 -1
@@ -1274,8 +1274,15 @@ int rsnd_kctrl_accept_anytime(struct rsnd_dai_stream *io)int rsnd_kctrl_accept_runtime (struct rsnd_dai_stream *io) {struct snd_pcm_runtime *runtime =rsnd_io_to_runtime (io); +struct rsnd_priv *priv =rsnd_io_to_priv (io); +struct device *dev =rsnd_priv_to_dev (priv); + +if (!runtime) { +dev_warn (dev,"Can't update kctrl when idle\n" ); +return 0 ; + } -return !!runtime; +return 1 ; }struct rsnd_kctrl_cfg *rsnd_kctrl_init_m (struct rsnd_kctrl_cfg_m *cfg)
Signature · 1 line
2.7.4
PATCH 2/57 ASoC: rsnd: add support for 16/24 bit slot widths
In reply to Biju DasFrom: Dragos Tarcatu <[email protected]>
commit fb2815f44a9eb341ed8990263855a266960a5135 upstream.
The slot width (system word length) was fixed at 32 bits. This patch allows also setting it to 16 or 24 bits.
--- sound/soc/sh/rcar/core.c | 32 +++++++++++++++++++++------- sound/soc/sh/rcar/rsnd.h | 8 ++++++- sound/soc/sh/rcar/ssi.c | 54 +++++++++++++++++++++++++++++++++++------------- 3 files changed, 72 insertions(+), 22 deletions(-)
sound/soc/sh/rcar/core.c +25 -7
@@ -540,6 +540,14 @@ int rsnd_rdai_ssi_lane_ctrl(struct rsnd_dai *rdai,return rdai->ssi_lane; } +int rsnd_rdai_width_ctrl (struct rsnd_dai *rdai,int width) +{ +if (width >0 ) + rdai->chan_width = width; + +return rdai->chan_width; +} +struct rsnd_dai *rsnd_rdai_get (struct rsnd_priv *priv,int id) {if ((id <0 ) || (id >=rsnd_rdai_nr (priv)))
@@ -720,6 +728,16 @@ static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai,struct rsnd_dai *rdai =rsnd_dai_to_rdai (dai);struct device *dev =rsnd_priv_to_dev (priv); +switch (slot_width) { +case 16 : +case 24 : +case 32 : +break ; +default : +dev_err (dev,"unsupported slot width value: %d\n" , slot_width); +return -EINVAL ; + } +switch (slots) {case 2 :case 6 :
@@ -727,6 +745,7 @@ static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai,/* TDM Extend Mode */ rsnd_rdai_channels_set (rdai, slots);rsnd_rdai_ssi_lane_set (rdai,1 ); +rsnd_rdai_width_set (rdai, slot_width);break ;default :dev_err (dev,"unsupported TDM slots (%d)\n" , slots);
@@ -755,7 +774,7 @@ static unsigned int rsnd_soc_hw_rate_list[] = { 192000, }; -static int rsnd_soc_hw_rule (struct rsnd_priv *priv, +static int rsnd_soc_hw_rule (struct rsnd_dai *rdai,unsigned int *list,int list_num,struct snd_interval *baseline,struct snd_interval *iv) {
@@ -772,14 +791,14 @@ static int rsnd_soc_hw_rule(struct rsnd_priv *priv,if (!snd_interval_test (iv, list[i]))continue ; - rate =rsnd_ssi_clk_query (priv, + rate =rsnd_ssi_clk_query (rdai, baseline->min, list[i],NULL );if (rate >0 ) { p.min =min (p.min, list[i]); p.max =max (p.max, list[i]); } - rate =rsnd_ssi_clk_query (priv, + rate =rsnd_ssi_clk_query (rdai, baseline->max, list[i],NULL );if (rate >0 ) { p.min =min (p.min, list[i]);
@@ -799,7 +818,6 @@ static int __rsnd_soc_hw_rule_rate(struct snd_pcm_hw_params *params,struct snd_interval ic;struct snd_soc_dai *dai = rule->private;struct rsnd_dai *rdai =rsnd_dai_to_rdai (dai); -struct rsnd_priv *priv =rsnd_rdai_to_priv (rdai);struct rsnd_dai_stream *io = is_play ? &rdai->playback : &rdai->capture;/*
@@ -811,7 +829,7 @@ static int __rsnd_soc_hw_rule_rate(struct snd_pcm_hw_params *params, ic.min = ic.max =rsnd_runtime_channel_for_ssi_with_params (io, params); -return rsnd_soc_hw_rule (priv, rsnd_soc_hw_rate_list, +return rsnd_soc_hw_rule (rdai, rsnd_soc_hw_rate_list,ARRAY_SIZE (rsnd_soc_hw_rate_list), &ic, ir); }
@@ -837,7 +855,6 @@ static int __rsnd_soc_hw_rule_channels(struct snd_pcm_hw_params *params,struct snd_interval ic;struct snd_soc_dai *dai = rule->private;struct rsnd_dai *rdai =rsnd_dai_to_rdai (dai); -struct rsnd_priv *priv =rsnd_rdai_to_priv (rdai);struct rsnd_dai_stream *io = is_play ? &rdai->playback : &rdai->capture;/*
@@ -849,7 +866,7 @@ static int __rsnd_soc_hw_rule_channels(struct snd_pcm_hw_params *params, ic.min = ic.max =rsnd_runtime_channel_for_ssi_with_params (io, params); -return rsnd_soc_hw_rule (priv, rsnd_soc_hw_channels_list, +return rsnd_soc_hw_rule (rdai, rsnd_soc_hw_channels_list,ARRAY_SIZE (rsnd_soc_hw_channels_list), ir, &ic); }
@@ -1083,6 +1100,7 @@ static void __rsnd_dai_probe(struct rsnd_priv *priv, rdai->capture.rdai = rdai;rsnd_rdai_channels_set (rdai,2 );/* default 2ch */ rsnd_rdai_ssi_lane_set (rdai,1 );/* default 1lane */ +rsnd_rdai_width_set (rdai,32 );/* default 32bit width */ for (io_i =0 ;; io_i++) { playback =of_parse_phandle (dai_np,"playback" , io_i);
sound/soc/sh/rcar/rsnd.h +7 -1
@@ -467,6 +467,7 @@ struct rsnd_dai {int max_channels;/* 2ch - 16ch */ int ssi_lane;/* 1lane - 4lane */ +int chan_width;/* 16/24/32 bit width */ unsigned int clk_master:1; unsigned int bit_clk_inv:1;
@@ -500,6 +501,11 @@ int rsnd_rdai_channels_ctrl(struct rsnd_dai *rdai,int rsnd_rdai_ssi_lane_ctrl (struct rsnd_dai *rdai,int ssi_lane); +#define rsnd_rdai_width_set (rdai, width) \ + rsnd_rdai_width_ctrl(rdai, width) +#define rsnd_rdai_width_get (rdai) \ + rsnd_rdai_width_ctrl(rdai, 0) +int rsnd_rdai_width_ctrl (struct rsnd_dai *rdai,int width);void rsnd_dai_period_elapsed (struct rsnd_dai_stream *io); int rsnd_dai_connect(struct rsnd_mod *mod, struct rsnd_dai_stream *io,
@@ -709,7 +715,7 @@ int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);void rsnd_parse_connect_ssi (struct rsnd_dai *rdai,struct device_node *playback,struct device_node *capture); -unsigned int rsnd_ssi_clk_query (struct rsnd_priv *priv, +unsigned int rsnd_ssi_clk_query (struct rsnd_dai *rdai,int param1,int param2,int *idx);/*
sound/soc/sh/rcar/ssi.c +40 -14
105 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 3/57 ASoC: rsnd: add support for 8 bit S8 format
In reply to Biju DasFrom: Dragos Tarcatu <[email protected]>
commit ba5d553b7bd71e63d639863e2cb09e0c9543b8b7 upstream.
This patch adds support for SNDRV_PCM_FMTBIT_S8 format.
--- sound/soc/sh/rcar/core.c | 10 +++++++--- sound/soc/sh/rcar/ssi.c | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-)
sound/soc/sh/rcar/core.c +7 -3
@@ -102,7 +102,9 @@#include "rsnd.h" #define RSND_RATES SNDRV_PCM_RATE_8000_192000 -#define RSND_FMTS (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE) +#define RSND_FMTS (SNDRV_PCM_FMTBIT_S8 |\ + SNDRV_PCM_FMTBIT_S16_LE |\ + SNDRV_PCM_FMTBIT_S24_LE)static const struct of_device_id rsnd_of_match[] = { { .compatible ="renesas,rcar_sound-gen1" , .data = (void *)RSND_GEN1 },
@@ -280,6 +282,8 @@ u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io)struct device *dev =rsnd_priv_to_dev (priv);switch (snd_pcm_format_width (runtime->format)) { +case 8 : +return 16 <<16 ;case 16 :return 8 <<16 ;case 24 :
@@ -331,7 +335,7 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io) target = cmd ? cmd : ssiu; } -/* Non target mod or 24bit data needs normal DALIGN */ +/* Non target mod or non 16bit needs normal DALIGN */ if ((snd_pcm_format_width (runtime->format) !=16 ) || (mod != target))return 0x76543210 ;
@@ -367,7 +371,7 @@ u32 rsnd_get_busif_shift(struct rsnd_dai_stream *io, struct rsnd_mod *mod)* HW 24bit data is located as 0x******00 * */ -if (snd_pcm_format_width (runtime->format) ==16 ) +if (snd_pcm_format_width (runtime->format) !=24 )return 0 ;for (i =0 ; i <ARRAY_SIZE (playback_mods); i++) {
sound/soc/sh/rcar/ssi.c +3 -0
@@ -400,6 +400,9 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, cr_own &= ~DWL_MASK ;switch (snd_pcm_format_width (runtime->format)) { +case 8 : + cr_own |=DWL_8 ; +break ;case 16 : cr_own |=DWL_16 ;break ;
Signature · 1 line
2.7.4
PATCH 4/57 ASoC: rsnd: remove is_play parameter from hw_rule function
In reply to Biju DasFrom: Jiada Wang <[email protected]>
commit b735662fa473c0e3618a4d645ce797d31e0c9192 upstream.
Currently rsnd_dai_stream *io is set to either &rdai->playback or &rdai->capture based on whether it is a playback or capture stream, in __rsnd_soc_hw_rule_* functions, but this is not necessary, rsnd_dai_stream *io handler can be get from rule->private.
This patch removes 'is_play' parameter from hw_rule function.
--- sound/soc/sh/rcar/core.c | 54 +++++++++++------------------------------------- 1 file changed, 12 insertions(+), 42 deletions(-)
sound/soc/sh/rcar/core.c +12 -42
@@ -813,16 +813,14 @@ static int rsnd_soc_hw_rule(struct rsnd_dai *rdai,return snd_interval_refine (iv, &p); } -static int __rsnd_soc_hw_rule_rate (struct snd_pcm_hw_params *params, -struct snd_pcm_hw_rule *rule, -int is_play) +static int rsnd_soc_hw_rule_rate (struct snd_pcm_hw_params *params, +struct snd_pcm_hw_rule *rule) {struct snd_interval *ic_ =hw_param_interval (params,SNDRV_PCM_HW_PARAM_CHANNELS );struct snd_interval *ir =hw_param_interval (params,SNDRV_PCM_HW_PARAM_RATE );struct snd_interval ic; -struct snd_soc_dai *dai = rule->private; -struct rsnd_dai *rdai =rsnd_dai_to_rdai (dai); -struct rsnd_dai_stream *io = is_play ? &rdai->playback : &rdai->capture; +struct rsnd_dai_stream *io = rule->private; +struct rsnd_dai *rdai =rsnd_io_to_rdai (io);/* * possible sampling rate limitation is same as
@@ -838,28 +836,14 @@ static int __rsnd_soc_hw_rule_rate(struct snd_pcm_hw_params *params, &ic, ir); } -static int rsnd_soc_hw_rule_rate_playback (struct snd_pcm_hw_params *params, -struct snd_pcm_hw_rule *rule) -{ -return __rsnd_soc_hw_rule_rate (params, rule,1 ); -} - -static int rsnd_soc_hw_rule_rate_capture (struct snd_pcm_hw_params *params, -struct snd_pcm_hw_rule *rule) -{ -return __rsnd_soc_hw_rule_rate (params, rule,0 ); -} - -static int __rsnd_soc_hw_rule_channels (struct snd_pcm_hw_params *params, -struct snd_pcm_hw_rule *rule, -int is_play) +static int rsnd_soc_hw_rule_channels (struct snd_pcm_hw_params *params, +struct snd_pcm_hw_rule *rule) {struct snd_interval *ic_ =hw_param_interval (params,SNDRV_PCM_HW_PARAM_CHANNELS );struct snd_interval *ir =hw_param_interval (params,SNDRV_PCM_HW_PARAM_RATE );struct snd_interval ic; -struct snd_soc_dai *dai = rule->private; -struct rsnd_dai *rdai =rsnd_dai_to_rdai (dai); -struct rsnd_dai_stream *io = is_play ? &rdai->playback : &rdai->capture; +struct rsnd_dai_stream *io = rule->private; +struct rsnd_dai *rdai =rsnd_io_to_rdai (io);/* * possible sampling rate limitation is same as
@@ -875,18 +859,6 @@ static int __rsnd_soc_hw_rule_channels(struct snd_pcm_hw_params *params, ir, &ic); } -static int rsnd_soc_hw_rule_channels_playback (struct snd_pcm_hw_params *params, -struct snd_pcm_hw_rule *rule) -{ -return __rsnd_soc_hw_rule_channels (params, rule,1 ); -} - -static int rsnd_soc_hw_rule_channels_capture (struct snd_pcm_hw_params *params, -struct snd_pcm_hw_rule *rule) -{ -return __rsnd_soc_hw_rule_channels (params, rule,0 ); -} -static const struct snd_pcm_hardware rsnd_pcm_hardware = { .info =SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP |
@@ -943,14 +915,12 @@ static int rsnd_soc_dai_startup(struct snd_pcm_substream *substream,int is_play = substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ;snd_pcm_hw_rule_add (runtime,0 ,SNDRV_PCM_HW_PARAM_RATE , - is_play ? rsnd_soc_hw_rule_rate_playback : - rsnd_soc_hw_rule_rate_capture, - dai, + rsnd_soc_hw_rule_rate, + is_play ? &rdai->playback : &rdai->capture,SNDRV_PCM_HW_PARAM_CHANNELS ,-1 );snd_pcm_hw_rule_add (runtime,0 ,SNDRV_PCM_HW_PARAM_CHANNELS , - is_play ? rsnd_soc_hw_rule_channels_playback : - rsnd_soc_hw_rule_channels_capture, - dai, + rsnd_soc_hw_rule_channels, + is_play ? &rdai->playback : &rdai->capture,SNDRV_PCM_HW_PARAM_RATE ,-1 ); }
Signature · 1 line
2.7.4
PATCH 5/57 ASoC: rsnd: ssi: Fix issue in dma data address assignment
In reply to Biju DasFrom: Jiada Wang <[email protected]>
commit 0e289012b47a2de1f029a6b61c75998e2f159dd9 upstream.
Same SSI device may be used in different dai links, by only having one dma struct in rsnd_ssi, after the first instance's dma config be initilized, the following instances can no longer configure dma, this causes issue, when their dma data address are different from the first instance.
--- sound/soc/sh/rcar/rsnd.h | 1 + sound/soc/sh/rcar/ssi.c | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-)
sound/soc/sh/rcar/rsnd.h +1 -0
@@ -438,6 +438,7 @@ struct rsnd_dai_stream {char name[RSND_DAI_NAME_SIZE ];struct snd_pcm_substream *substream;struct rsnd_mod *mod[RSND_MOD_MAX ]; +struct rsnd_mod *dma;struct rsnd_dai *rdai;struct device *dmac_dev;/* for IPMMU */ u32 parent_ssi_status;
sound/soc/sh/rcar/ssi.c +1 -3
@@ -78,7 +78,6 @@struct rsnd_ssi {struct rsnd_mod mod; -struct rsnd_mod *dma;u32 flags;u32 cr_own;
@@ -902,7 +901,6 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,struct rsnd_dai_stream *io, struct rsnd_priv *priv) { - struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); int ret;/*
@@ -917,7 +915,7 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,return ret;/* SSI probe might be called many times in MUX multi path */ - ret =rsnd_dma_attach (io, mod, &ssi->dma); + ret =rsnd_dma_attach (io, mod, &io->dma);return ret; }
Signature · 1 line
2.7.4
PATCH 6/57 ASoC: rsnd: ssi: Check runtime channel number rather than hw_params
In reply to Biju DasFrom: Jiada Wang <[email protected]>
commit 599da084e041b877ef89211dcbb4c7bd8380049d upstream.
The number of channel handled by SSI maybe differs from the one set in hw_params, currently SSI checks hw_params's channel number, and constrains to use same channel number, when it is being used by multiple clients.
This patch corrects to check runtime channel number rather than channel number set in hw_params.
--- sound/soc/sh/rcar/ssi.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-)
sound/soc/sh/rcar/ssi.c +7 -20
@@ -307,6 +307,11 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,return -EINVAL ; } +if (ssi->chan != chan) { +dev_err (dev,"SSI parent/child should use same chan\n" ); +return -EINVAL ; + } +return 0 ; }
@@ -334,6 +339,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,SCKD |SWSD |CKDV (idx); ssi->wsr =CONT ; ssi->rate = rate; + ssi->chan = chan; dev_dbg(dev, "%s[%d] outputs %u Hz\n", rsnd_mod_name(mod),
@@ -359,6 +365,7 @@ static void rsnd_ssi_master_clk_stop(struct rsnd_mod *mod, ssi->cr_clk =0 ; ssi->rate =0 ; + ssi->chan =0 ;rsnd_adg_ssi_clk_stop (mod); }
@@ -506,9 +513,7 @@ static int rsnd_ssi_hw_params(struct rsnd_mod *mod,struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); struct rsnd_dai *rdai = rsnd_io_to_rdai(io); -int chan =params_channels (params);unsigned int fmt_width =snd_pcm_format_width (params_format (params));if (fmt_width > rdai->chan_width) {
@@ -519,24 +524,6 @@ static int rsnd_ssi_hw_params(struct rsnd_mod *mod,return -EINVAL ; } -/* -* snd_pcm_ops::hw_params will be called *before* -* snd_soc_dai_ops::trigger. Thus, ssi->usrcnt is 0 -* in 1st call. -*/ -if (ssi->usrcnt) { -/* -* Already working. -* It will happen if SSI has parent/child connection. -* it is error if child <-> parent SSI uses -* different channels. -*/ -if (ssi->chan != chan) -return -EIO ; - } - - ssi->chan = chan; -return 0 ; }
Signature · 1 line
2.7.4
PATCH 6/57 ASoC: rsnd: ssi: Check runtime channel number rather than hw_params
Hi!
Quoted 9 lines
commit
599da084e041b877ef89211dcbb4c7bd8380049dupstream.The number of channel handled by SSI maybe differs from the one set in
hw_params, currently SSI checks hw_params's channel number, and constrains to use same channel number, when it is being used by multiple clients.This patch corrects to check runtime channel number rather than channel number set in
hw_params.
This also changes the error return here from -EIO to -EINVAL. I assume that's okay, but I wanted to double check.
Best regards,
Pavel
Quoted 23 lines
sound/soc/sh/rcar/ssi.c +5
-10@@ -307,6 +307,11 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,return -EINVAL ; } +if (ssi->chan != chan) { +dev_err (dev,"SSI parent/child should use same chan\n" ); +return -EINVAL ; + } +return 0 ; }@@ -519,24 +524,6 @@ static int rsnd_ssi_hw_params(struct rsnd_mod *mod, -if (ssi->usrcnt) { -/* -* Already working. -* It will happen if SSI has parent/child connection. -* it is error if child <-> parent SSI uses -* different channels. -*/ -if (ssi->chan != chan) -return -EIO ; - }
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191020/27015c9c/attachment.sig>
PATCH 6/57 ASoC: rsnd: ssi: Check runtime channel number rather than hw_params
Hi Pavel,
Thanks for the feedback.
Quoted 12 lines
Subject: Re: [PATCH 4.19.y-cip 06/57] ASoC: rsnd: ssi: Check runtime channel number rather than
hw_paramsHi!
Quoted 7 lines
commit
599da084e041b877ef89211dcbb4c7bd8380049dupstream.The number of channel handled by SSI maybe differs from the one set in
hw_params, currently SSI checks hw_params's channel number, and constrains to use same channel number, when it is being used by multiple clients.
Quoted 6 lines
Quoted 2 lines
This patch corrects to check runtime channel number rather than channel number set in
hw_params.This also changes the error return here from
-EIOto-EINVAL. I assume that's okay, but I wanted to double check.
Do you prefer -EIO rather than -EINVAL? For me, -EINVAL make sense here.
Cheers,
Biju
Quoted 25 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ if (ssi->chan != chan) { + dev_err(dev, "SSI parent/child should use samechan\n");
sound/soc/sh/rcar/ssi.c static int rsnd_ssi_hw_params(struct rsnd_mod
Quoted 7 lines
sound/soc/sh/rcar/ssi.c +3
-0+return -EINVAL ; + } +return 0 ; }@@ -519,24 +524,6 @@ static int rsnd_ssi_hw_params(struct rsnd_mod*mod,
sound/soc/sh/rcar/ssi.c static int rsnd_ssi_hw_params(struct rsnd_mod *mod, · line 536
Quoted 10 lines
sound/soc/sh/rcar/ssi.c +0
-10-if (ssi->usrcnt) { -/* -* Already working. -* It will happen if SSI has parent/child connection. -* it is error if child <-> parent SSI uses -* different channels. -*/ -if (ssi->chan != chan) -return -EIO ; - }--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 7/57 ASoc: rsnd: dma: Calculate dma address with consider of BUSIF
In reply to Biju DasFrom: Jiada Wang <[email protected]>
commit 5e45a6fab3b90ca300e13191fc68baaa8e37d1d4 upstream.
DMA address calculated by rsnd_dma_addr() only considers BUSIF0 so far. But BUSIF1 ~ BUSIF7 also maybe used, in the future.
This patch updates DMA address calculations, to also consider BUSIF number used by SSI.
One note is that we can't support SSI9-4/5/6/7 so far, because its address is out of calculation rule.
--- sound/soc/sh/rcar/dma.c | 43 +++++++++++++++++++++++++++---------------- sound/soc/sh/rcar/rsnd.h | 1 + sound/soc/sh/rcar/ssi.c | 5 +++++ 3 files changed, 33 insertions(+), 16 deletions(-)
sound/soc/sh/rcar/dma.c +27 -16
@@ -491,11 +491,11 @@ static struct rsnd_mod_ops rsnd_dmapp_ops = {#define RDMA_SSI_I_N (addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)#define RDMA_SSI_O_N (addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0xc) -#define RDMA_SSIU_I_N (addr, i) (addr ##_reg - 0x00441000 + (0x1000 * i)) -#define RDMA_SSIU_O_N (addr, i) (addr ##_reg - 0x00441000 + (0x1000 * i)) +#define RDMA_SSIU_I_N (addr, i, j) (addr ##_reg - 0x00441000 + (0x1000 * (i)) + (((j) / 4) * 0xA000) + (((j) % 4) * 0x400)) +#define RDMA_SSIU_O_N (addr, i, j) RDMA_SSIU_I_N(addr, i, j) -#define RDMA_SSIU_I_P (addr, i) (addr ##_reg - 0x00141000 + (0x1000 * i)) -#define RDMA_SSIU_O_P (addr, i) (addr ##_reg - 0x00141000 + (0x1000 * i)) +#define RDMA_SSIU_I_P (addr, i, j) (addr ##_reg - 0x00141000 + (0x1000 * (i)) + (((j) / 4) * 0xA000) + (((j) % 4) * 0x400)) +#define RDMA_SSIU_O_P (addr, i, j) RDMA_SSIU_I_P(addr, i, j)#define RDMA_SRC_I_N (addr, i) (addr ##_reg - 0x00500000 + (0x400 * i))#define RDMA_SRC_O_N (addr, i) (addr ##_reg - 0x004fc000 + (0x400 * i))
@@ -521,6 +521,7 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io, !!rsnd_io_to_mod_mix (io) || !!rsnd_io_to_mod_ctu (io);int id =rsnd_mod_id (mod); +int busif =rsnd_ssi_get_busif (io);struct dma_addr {dma_addr_t out_addr;dma_addr_t in_addr;
@@ -537,25 +538,35 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io, },/* SSI */ /* Capture */ - {{{ RDMA_SSI_O_N(ssi, id), 0 }, - { RDMA_SSIU_O_P(ssi, id), 0 }, - { RDMA_SSIU_O_P(ssi, id), 0 } }, + {{{ RDMA_SSI_O_N(ssi, id), 0 }, + { RDMA_SSIU_O_P(ssi, id, busif), 0 }, + { RDMA_SSIU_O_P(ssi, id, busif), 0 } },/* Playback */ - {{ 0, RDMA_SSI_I_N(ssi, id) }, - { 0, RDMA_SSIU_I_P(ssi, id) }, - { 0, RDMA_SSIU_I_P(ssi, id) } } + {{ 0, RDMA_SSI_I_N(ssi, id) }, + { 0, RDMA_SSIU_I_P(ssi, id, busif) }, + { 0, RDMA_SSIU_I_P(ssi, id, busif) } } },/* SSIU */ /* Capture */ - {{{ RDMA_SSIU_O_N(ssi, id), 0 }, - { RDMA_SSIU_O_P(ssi, id), 0 }, - { RDMA_SSIU_O_P(ssi, id), 0 } }, + {{{ RDMA_SSIU_O_N(ssi, id, busif), 0 }, + { RDMA_SSIU_O_P(ssi, id, busif), 0 }, + { RDMA_SSIU_O_P(ssi, id, busif), 0 } },/* Playback */ - {{ 0, RDMA_SSIU_I_N(ssi, id) }, - { 0, RDMA_SSIU_I_P(ssi, id) }, - { 0, RDMA_SSIU_I_P(ssi, id) } } }, + {{ 0, RDMA_SSIU_I_N(ssi, id, busif) }, + { 0, RDMA_SSIU_I_P(ssi, id, busif) }, + { 0, RDMA_SSIU_I_P(ssi, id, busif) } } }, }; +/* +* FIXME +* +* We can't support SSI9-4/5/6/7, because its address is +* out of calculation rule +*/ +if ((id ==9 ) && (busif >=4 )) +dev_err (dev,"This driver doesn't support SSI%d-%d, so far" , + id, busif); +/* it shouldn't happen */ if (use_cmd && !use_src)dev_err (dev,"DVC is selected without SRC\n" );
sound/soc/sh/rcar/rsnd.h +1 -0
@@ -699,6 +699,7 @@ void rsnd_ssi_remove(struct rsnd_priv *priv);struct rsnd_mod *rsnd_ssi_mod_get (struct rsnd_priv *priv,int id);int rsnd_ssi_is_dma_mode (struct rsnd_mod *mod);int rsnd_ssi_use_busif (struct rsnd_dai_stream *io); +int rsnd_ssi_get_busif (struct rsnd_dai_stream *io);u32 rsnd_ssi_multi_slaves_runtime (struct rsnd_dai_stream *io);#define RSND_SSI_HDMI_PORT0 0xf0
sound/soc/sh/rcar/ssi.c +5 -0
@@ -150,6 +150,11 @@ int rsnd_ssi_use_busif(struct rsnd_dai_stream *io)return use_busif; } +int rsnd_ssi_get_busif (struct rsnd_dai_stream *io) +{ +return 0 ;/* BUSIF0 only for now */ +} +static void rsnd_ssi_status_clear (struct rsnd_mod *mod) {rsnd_mod_write (mod,SSISR ,0 );
Signature · 1 line
2.7.4
PATCH 8/57 ASoc: rsnd: dma: Calculate PDMACHCRE with consider of BUSIF
In reply to Biju DasFrom: Jiada Wang <[email protected]>
commit 92c7d384ff7282738c70720f8670c9b65c90c7df upstream.
PDMACHCR setting for SSI only considers BUSIF0 so far. But BUSIF1 ~ BUSIF7 also maybe used, in the future.
This patch updates table gen2_id_table_ssiu, to also consider BUSIF number used by SSI.
--- sound/soc/sh/rcar/dma.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-)
sound/soc/sh/rcar/dma.c +26 -11
@@ -302,16 +302,26 @@ static struct rsnd_mod_ops rsnd_dmaen_ops = {* Audio DMAC peri peri */ static const u8 gen2_id_table_ssiu[] = { -0x00 ,/* SSI00 */ -0x04 ,/* SSI10 */ -0x08 ,/* SSI20 */ -0x0c ,/* SSI3 */ -0x0d ,/* SSI4 */ -0x0e ,/* SSI5 */ -0x0f ,/* SSI6 */ -0x10 ,/* SSI7 */ -0x11 ,/* SSI8 */ -0x12 ,/* SSI90 */ +/* SSI00 ~ SSI07 */ +0x00 ,0x01 ,0x02 ,0x03 ,0x39 ,0x3a ,0x3b ,0x3c , +/* SSI10 ~ SSI17 */ +0x04 ,0x05 ,0x06 ,0x07 ,0x3d ,0x3e ,0x3f ,0x40 , +/* SSI20 ~ SSI27 */ +0x08 ,0x09 ,0x0a ,0x0b ,0x41 ,0x42 ,0x43 ,0x44 , +/* SSI30 ~ SSI37 */ +0x0c ,0x45 ,0x46 ,0x47 ,0x48 ,0x49 ,0x4a ,0x4b , +/* SSI40 ~ SSI47 */ +0x0d ,0x4c ,0x4d ,0x4e ,0x4f ,0x50 ,0x51 ,0x52 , +/* SSI5 */ +0x0e ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +/* SSI6 */ +0x0f ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +/* SSI7 */ +0x10 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +/* SSI8 */ +0x11 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 , +/* SSI90 ~ SSI97 */ +0x12 ,0x13 ,0x14 ,0x15 ,0x53 ,0x54 ,0x55 ,0x56 , };static const u8 gen2_id_table_scu[] = {0x2d ,/* SCU_SRCI0 */
@@ -337,18 +347,23 @@ static u32 rsnd_dmapp_get_id(struct rsnd_dai_stream *io,struct rsnd_mod *src =rsnd_io_to_mod_src (io);struct rsnd_mod *dvc =rsnd_io_to_mod_dvc (io);const u8 *entry =NULL ; -int id =rsnd_mod_id (mod); +int id =255 ;int size =0 ;if (mod == ssi) { +int busif =rsnd_ssi_get_busif (io); + entry = gen2_id_table_ssiu; size =ARRAY_SIZE (gen2_id_table_ssiu); + id = (rsnd_mod_id (mod) *8 ) + busif; }else if (mod == src) { entry = gen2_id_table_scu; size =ARRAY_SIZE (gen2_id_table_scu); + id =rsnd_mod_id (mod); }else if (mod == dvc) { entry = gen2_id_table_cmd; size =ARRAY_SIZE (gen2_id_table_cmd); + id =rsnd_mod_id (mod); }if ((!entry) || (size <= id)) {
Signature · 1 line
2.7.4
PATCH 9/57 ASoC: rsnd: ssiu: Support BUSIF other than BUSIF0
In reply to Biju DasFrom: Jiada Wang <[email protected]>
commit 8c9d750333408420a1e4816b1820f10be2a84af6 upstream.
Currently only BUSIF0 is supported by SSIU, all register setting is done only for BUSIF.
Since BUSIF1 ~ BUSIF7 has been supported, so also support these BUSIF from SSIU.
One note is that we can't support SSI9-4/5/6/7 so far, because its address is out of calculation rule.
--- sound/soc/sh/rcar/gen.c | 27 ++++++++++++++++--- sound/soc/sh/rcar/rsnd.h | 27 ++++++++++++++++--- sound/soc/sh/rcar/ssiu.c | 70 ++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 107 insertions(+), 17 deletions(-)
sound/soc/sh/rcar/gen.c +24 -3
@@ -219,9 +219,30 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv)RSND_GEN_S_REG (HDMI1_SEL ,0x9e4 ),/* FIXME: it needs SSI_MODE2/3 in the future */ -RSND_GEN_M_REG (SSI_BUSIF_MODE ,0x0 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF_ADINR ,0x4 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF_DALIGN ,0x8 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF0_MODE ,0x0 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF0_ADINR ,0x4 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF0_DALIGN ,0x8 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF1_MODE ,0x20 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF1_ADINR ,0x24 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF1_DALIGN ,0x28 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF2_MODE ,0x40 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF2_ADINR ,0x44 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF2_DALIGN ,0x48 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF3_MODE ,0x60 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF3_ADINR ,0x64 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF3_DALIGN ,0x68 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF4_MODE ,0x500 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF4_ADINR ,0x504 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF4_DALIGN ,0x508 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF5_MODE ,0x520 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF5_ADINR ,0x524 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF5_DALIGN ,0x528 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF6_MODE ,0x540 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF6_ADINR ,0x544 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF6_DALIGN ,0x548 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF7_MODE ,0x560 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF7_ADINR ,0x564 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF7_DALIGN ,0x568 ,0x80 ),RSND_GEN_M_REG (SSI_MODE ,0xc ,0x80 ),RSND_GEN_M_REG (SSI_CTRL ,0x10 ,0x80 ), RSND_GEN_M_REG(SSI_INT_ENABLE, 0x18, 0x80),
sound/soc/sh/rcar/rsnd.h +24 -3
@@ -156,9 +156,30 @@ enum rsnd_reg {RSND_REG_SSI_MODE2 ,RSND_REG_SSI_CONTROL ,RSND_REG_SSI_CTRL , -RSND_REG_SSI_BUSIF_MODE , -RSND_REG_SSI_BUSIF_ADINR , -RSND_REG_SSI_BUSIF_DALIGN , +RSND_REG_SSI_BUSIF0_MODE , +RSND_REG_SSI_BUSIF0_ADINR , +RSND_REG_SSI_BUSIF0_DALIGN , +RSND_REG_SSI_BUSIF1_MODE , +RSND_REG_SSI_BUSIF1_ADINR , +RSND_REG_SSI_BUSIF1_DALIGN , +RSND_REG_SSI_BUSIF2_MODE , +RSND_REG_SSI_BUSIF2_ADINR , +RSND_REG_SSI_BUSIF2_DALIGN , +RSND_REG_SSI_BUSIF3_MODE , +RSND_REG_SSI_BUSIF3_ADINR , +RSND_REG_SSI_BUSIF3_DALIGN , +RSND_REG_SSI_BUSIF4_MODE , +RSND_REG_SSI_BUSIF4_ADINR , +RSND_REG_SSI_BUSIF4_DALIGN , +RSND_REG_SSI_BUSIF5_MODE , +RSND_REG_SSI_BUSIF5_ADINR , +RSND_REG_SSI_BUSIF5_DALIGN , +RSND_REG_SSI_BUSIF6_MODE , +RSND_REG_SSI_BUSIF6_ADINR , +RSND_REG_SSI_BUSIF6_DALIGN , +RSND_REG_SSI_BUSIF7_MODE , +RSND_REG_SSI_BUSIF7_ADINR , +RSND_REG_SSI_BUSIF7_DALIGN ,RSND_REG_SSI_INT_ENABLE ,RSND_REG_SSI_SYS_STATUS0 , RSND_REG_SSI_SYS_STATUS1,
sound/soc/sh/rcar/ssiu.c +59 -11
94 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 10/57 ASoC: rsnd: ssiu: Support to init different BUSIF instance
In reply to Biju DasFrom: Jiada Wang <[email protected]>
commit 2e66d523cd055ac3fa920f7e630c4bfa80d24c24 upstream.
Currently ssiu's .init is only called once during audio stream. But SSIU with different BUSIF, shall be initialized each time, even they are used in the same audio stream.
This patch introduces ssiu_status for BUSIF0 to BUSIF7 in rsnd_ssiu, to make sure same .init for different BUSIF can always be executed.
To avoid the first stopped stream to stop the whole SSIU, which may still has other BUSIF instance running, use usrcnt to count the usage of SSIU, only the last user of SSIU can stop the whole SSIU.
--- sound/soc/sh/rcar/ssiu.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
sound/soc/sh/rcar/ssiu.c +21 -1
@@ -10,9 +10,12 @@struct rsnd_ssiu {struct rsnd_mod mod; +u32 busif_status[8 ];/* for BUSIF0 - BUSIF7 */ +unsigned int usrcnt; };#define rsnd_ssiu_nr (priv) ((priv)->ssiu_nr) +#define rsnd_mod_to_ssiu (_mod) container_of((_mod), struct rsnd_ssiu, mod)#define for_each_rsnd_ssiu (pos, priv, i) \ for (i = 0; \ (i < rsnd_ssiu_nr(priv)) && \
@@ -120,6 +123,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,struct rsnd_dai_stream *io, struct rsnd_priv *priv) { + struct rsnd_ssiu *ssiu = rsnd_mod_to_ssiu(mod);int hdmi =rsnd_ssi_hdmi_port (io);int ret;u32 mode =0 ;
@@ -128,6 +132,8 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,if (ret <0 )return ret; + ssiu->usrcnt++; +if (rsnd_runtime_is_ssi_tdm (io)) {/* * TDM Extend Mode
@@ -255,6 +261,7 @@ static int rsnd_ssiu_stop_gen2(struct rsnd_mod *mod,struct rsnd_dai_stream *io, struct rsnd_priv *priv) { + struct rsnd_ssiu *ssiu = rsnd_mod_to_ssiu(mod);int busif =rsnd_ssi_get_busif (io);if (!rsnd_ssi_use_busif (io))
@@ -262,6 +269,9 @@ static int rsnd_ssiu_stop_gen2(struct rsnd_mod *mod,rsnd_mod_bset (mod,SSI_CTRL ,1 << (busif *4 ),0 ); +if (--ssiu->usrcnt) +return 0 ; +if (rsnd_ssi_multi_slaves_runtime (io))rsnd_mod_write (mod,SSI_CONTROL ,0 );
@@ -294,6 +304,16 @@ int rsnd_ssiu_attach(struct rsnd_dai_stream *io,return rsnd_dai_connect (mod, io, mod->type); } +static u32 *rsnd_ssiu_get_status (struct rsnd_dai_stream *io, +struct rsnd_mod *mod, +enum rsnd_mod_type type) +{ +struct rsnd_ssiu *ssiu =rsnd_mod_to_ssiu (mod); +int busif =rsnd_ssi_get_busif (io); + +return &ssiu->busif_status[busif]; +} +int rsnd_ssiu_probe (struct rsnd_priv *priv) {struct device *dev =rsnd_priv_to_dev (priv);
@@ -317,7 +337,7 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv)for_each_rsnd_ssiu (ssiu, priv, i) { ret =rsnd_mod_init (priv,rsnd_mod_get (ssiu), - ops,NULL , rsnd_mod_get_status, + ops,NULL , rsnd_ssiu_get_status,RSND_MOD_SSIU , i);if (ret)return ret;
Signature · 1 line
2.7.4
PATCH 11/57 ASoC: rsnd: merge .nolock_start and .prepare
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 6ab6a2474e0dce02f71e92adb9778a168a8931f4 upstream.
Main purpose of .nolock_start is we need to call
some function without spinlock.
OTOH we have .prepare which main purpose is
called under atomic context.
Then, it is called without spinlock.
In summary, our main callback init/quit, and start/stop are called under "atomic context and with spinlock". And some function need to be called under "non-atomic context or without spinlock".
Let's merge .nolock_start and prepare to be more clear code. Then, let's rename nolock_stop to cleanup
--- sound/soc/sh/rcar/core.c | 13 ++----------- sound/soc/sh/rcar/dma.c | 20 ++++++++++---------- sound/soc/sh/rcar/rsnd.h | 26 ++++++++++---------------- 3 files changed, 22 insertions(+), 37 deletions(-)
sound/soc/sh/rcar/core.c +2 -11
@@ -875,12 +875,10 @@ static int rsnd_soc_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) {struct rsnd_dai *rdai =rsnd_dai_to_rdai (dai); -struct rsnd_priv *priv =rsnd_rdai_to_priv (rdai);struct rsnd_dai_stream *io =rsnd_rdai_to_io (rdai, substream);struct snd_pcm_hw_constraint_list *constraint = &rdai->constraint;struct snd_pcm_runtime *runtime = substream->runtime;unsigned int max_channels =rsnd_rdai_channels_get (rdai); -int ret;int i;rsnd_dai_stream_init (io, substream);
@@ -924,14 +922,7 @@ static int rsnd_soc_dai_startup(struct snd_pcm_substream *substream, SNDRV_PCM_HW_PARAM_RATE, -1); } -/* -* call rsnd_dai_call without spinlock -*/ - ret =rsnd_dai_call (nolock_start, io, priv); -if (ret <0 ) -rsnd_dai_call (nolock_stop, io, priv); - -return ret; +return 0 ; } static void rsnd_soc_dai_shutdown(struct snd_pcm_substream *substream,
@@ -944,7 +935,7 @@ static void rsnd_soc_dai_shutdown(struct snd_pcm_substream *substream,/* * call rsnd_dai_call without spinlock */ -rsnd_dai_call (nolock_stop, io, priv); +rsnd_dai_call (cleanup, io, priv);rsnd_dai_stream_quit (io); }
sound/soc/sh/rcar/dma.c +10 -10
@@ -106,9 +106,9 @@ static int rsnd_dmaen_stop(struct rsnd_mod *mod,return 0 ; } -static int rsnd_dmaen_nolock_stop (struct rsnd_mod *mod, -struct rsnd_dai_stream *io, -struct rsnd_priv *priv) +static int rsnd_dmaen_cleanup (struct rsnd_mod *mod, +struct rsnd_dai_stream *io, +struct rsnd_priv *priv) {struct rsnd_dma *dma =rsnd_mod_to_dma (mod);struct rsnd_dmaen *dmaen =rsnd_dma_to_dmaen (dma);
@@ -116,7 +116,7 @@ static int rsnd_dmaen_nolock_stop(struct rsnd_mod *mod,/* * DMAEngine release uses mutex lock. * Thus, it shouldn't be called under spinlock. -* Let's call it under nolock_start +* Let's call it under prepare */ if (dmaen->chan)dma_release_channel (dmaen->chan);
@@ -126,9 +126,9 @@ static int rsnd_dmaen_nolock_stop(struct rsnd_mod *mod,return 0 ; } -static int rsnd_dmaen_nolock_start (struct rsnd_mod *mod, -struct rsnd_dai_stream *io, -struct rsnd_priv *priv) +static int rsnd_dmaen_prepare (struct rsnd_mod *mod, +struct rsnd_dai_stream *io, +struct rsnd_priv *priv) {struct rsnd_dma *dma =rsnd_mod_to_dma (mod);struct rsnd_dmaen *dmaen =rsnd_dma_to_dmaen (dma);
@@ -142,7 +142,7 @@ static int rsnd_dmaen_nolock_start(struct rsnd_mod *mod,/* * DMAEngine request uses mutex lock. * Thus, it shouldn't be called under spinlock. -* Let's call it under nolock_start +* Let's call it under prepare */ dmaen->chan = rsnd_dmaen_request_channel(io, dma->mod_from,
@@ -291,8 +291,8 @@ static int rsnd_dmaen_pointer(struct rsnd_mod *mod,static struct rsnd_mod_ops rsnd_dmaen_ops = { .name ="audmac" , - .nolock_start = rsnd_dmaen_nolock_start, - .nolock_stop = rsnd_dmaen_nolock_stop, + .prepare = rsnd_dmaen_prepare, + .cleanup = rsnd_dmaen_cleanup, .start = rsnd_dmaen_start, .stop = rsnd_dmaen_stop, .pointer= rsnd_dmaen_pointer,
sound/soc/sh/rcar/rsnd.h +10 -16
@@ -295,15 +295,12 @@ struct rsnd_mod_ops {int (*fallback)(struct rsnd_mod *mod,struct rsnd_dai_stream *io,struct rsnd_priv *priv); -int (*nolock_start)(struct rsnd_mod *mod, -struct rsnd_dai_stream *io, -struct rsnd_priv *priv); -int (*nolock_stop)(struct rsnd_mod *mod, -struct rsnd_dai_stream *io, -struct rsnd_priv *priv);int (*prepare)(struct rsnd_mod *mod,struct rsnd_dai_stream *io,struct rsnd_priv *priv); +int (*cleanup)(struct rsnd_mod *mod, +struct rsnd_dai_stream *io, +struct rsnd_priv *priv); };struct rsnd_dai_stream ;
@@ -323,7 +320,7 @@ struct rsnd_mod {* * 0xH0000CBA * -* A 0: nolock_start 1: nolock_stop +* A 0: prepare 1: cleanup * B 0: init 1: quit * C 0: start 1: stop *
@@ -335,8 +332,8 @@ struct rsnd_mod {* H 0: pointer * H 0: prepare */ -#define __rsnd_mod_shift_nolock_start 0 -#define __rsnd_mod_shift_nolock_stop 0 +#define __rsnd_mod_shift_prepare 0 +#define __rsnd_mod_shift_cleanup 0#define __rsnd_mod_shift_init 4#define __rsnd_mod_shift_quit 4#define __rsnd_mod_shift_start 8
@@ -348,12 +345,11 @@ struct rsnd_mod {#define __rsnd_mod_shift_fallback 28/* always called */ #define __rsnd_mod_shift_hw_params 28/* always called */ #define __rsnd_mod_shift_pointer 28/* always called */ -#define __rsnd_mod_shift_prepare 28/* always called */ #define __rsnd_mod_add_probe 0#define __rsnd_mod_add_remove 0 -#define __rsnd_mod_add_nolock_start 1 -#define __rsnd_mod_add_nolock_stop -1 +#define __rsnd_mod_add_prepare 1 +#define __rsnd_mod_add_cleanup -1#define __rsnd_mod_add_init 1#define __rsnd_mod_add_quit -1#define __rsnd_mod_add_start 1
@@ -363,10 +359,11 @@ struct rsnd_mod {#define __rsnd_mod_add_fallback 0#define __rsnd_mod_add_hw_params 0#define __rsnd_mod_add_pointer 0 -#define __rsnd_mod_add_prepare 0#define __rsnd_mod_call_probe 0#define __rsnd_mod_call_remove 0 +#define __rsnd_mod_call_prepare 0 +#define __rsnd_mod_call_cleanup 1#define __rsnd_mod_call_init 0#define __rsnd_mod_call_quit 1#define __rsnd_mod_call_start 0
@@ -376,9 +373,6 @@ struct rsnd_mod {#define __rsnd_mod_call_fallback 0#define __rsnd_mod_call_hw_params 0#define __rsnd_mod_call_pointer 0 -#define __rsnd_mod_call_nolock_start 0 -#define __rsnd_mod_call_nolock_stop 1 -#define __rsnd_mod_call_prepare 0#define rsnd_mod_to_priv (mod) ((mod)->priv)#define rsnd_mod_name (mod) ((mod)->ops->name)
Signature · 1 line
2.7.4
PATCH 12/57 ASoC: rsnd: gen: use tab instead of white-space
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 501683d0cd54714de78501efe945bbe4356b922b upstream.
commit 8c9d75033340 ("ASoC: rsnd: ssiu: Support BUSIF other than BUSIF0") added new SSIU registers. But it is using white-space for it.
This patch fixup it to use tab.
--- sound/soc/sh/rcar/gen.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-)
sound/soc/sh/rcar/gen.c +24 -24
@@ -222,30 +222,30 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv)RSND_GEN_M_REG (SSI_BUSIF0_MODE ,0x0 ,0x80 ),RSND_GEN_M_REG (SSI_BUSIF0_ADINR ,0x4 ,0x80 ),RSND_GEN_M_REG (SSI_BUSIF0_DALIGN ,0x8 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF1_MODE ,0x20 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF1_ADINR ,0x24 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF1_DALIGN ,0x28 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF2_MODE ,0x40 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF2_ADINR ,0x44 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF2_DALIGN ,0x48 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF3_MODE ,0x60 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF3_ADINR ,0x64 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF3_DALIGN ,0x68 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF4_MODE ,0x500 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF4_ADINR ,0x504 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF4_DALIGN ,0x508 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF5_MODE ,0x520 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF5_ADINR ,0x524 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF5_DALIGN ,0x528 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF6_MODE ,0x540 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF6_ADINR ,0x544 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF6_DALIGN ,0x548 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF7_MODE ,0x560 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF7_ADINR ,0x564 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF7_DALIGN ,0x568 ,0x80 ), -RSND_GEN_M_REG (SSI_MODE ,0xc ,0x80 ), -RSND_GEN_M_REG (SSI_CTRL ,0x10 ,0x80 ), - RSND_GEN_M_REG(SSI_INT_ENABLE, 0x18, 0x80), +RSND_GEN_M_REG (SSI_BUSIF1_MODE ,0x20 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF1_ADINR ,0x24 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF1_DALIGN ,0x28 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF2_MODE ,0x40 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF2_ADINR ,0x44 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF2_DALIGN ,0x48 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF3_MODE ,0x60 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF3_ADINR ,0x64 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF3_DALIGN ,0x68 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF4_MODE ,0x500 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF4_ADINR ,0x504 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF4_DALIGN ,0x508 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF5_MODE ,0x520 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF5_ADINR ,0x524 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF5_DALIGN ,0x528 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF6_MODE ,0x540 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF6_ADINR ,0x544 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF6_DALIGN ,0x548 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF7_MODE ,0x560 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF7_ADINR ,0x564 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF7_DALIGN ,0x568 ,0x80 ), +RSND_GEN_M_REG (SSI_MODE ,0xc ,0x80 ), +RSND_GEN_M_REG (SSI_CTRL ,0x10 ,0x80 ), + RSND_GEN_M_REG(SSI_INT_ENABLE, 0x18, 0x80), }; static const struct rsnd_regmap_field_conf conf_scu[] = {
Signature · 1 line
2.7.4
PATCH 12/57 ASoC: rsnd: gen: use tab instead of white-space
Quoted 8 lines · Biju Das
From: Kuninori Morimoto <[email protected]>
commit
501683d0cd54714de78501efe945bbe4356b922bupstream.commit
8c9d75033340("ASoC: rsnd: ssiu: Support BUSIF other than BUSIF0") added new SSIU registers. But it is using white-space for it.
This patch fixup it to use tab.
I believe spaces are okay for indentation, too and normally we do not fix this kind of minor formatting problems unless there are real changes in the same area.
(Plus English could be improved in changelog).
Best regards,
Pavel
Quoted 55 lines
sound/soc/sh/rcar/gen.c +24
-24@@ -222,30 +222,30 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv)RSND_GEN_M_REG (SSI_BUSIF0_MODE ,0x0 ,0x80 ),RSND_GEN_M_REG (SSI_BUSIF0_ADINR ,0x4 ,0x80 ),RSND_GEN_M_REG (SSI_BUSIF0_DALIGN ,0x8 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF1_MODE ,0x20 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF1_ADINR ,0x24 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF1_DALIGN ,0x28 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF2_MODE ,0x40 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF2_ADINR ,0x44 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF2_DALIGN ,0x48 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF3_MODE ,0x60 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF3_ADINR ,0x64 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF3_DALIGN ,0x68 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF4_MODE ,0x500 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF4_ADINR ,0x504 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF4_DALIGN ,0x508 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF5_MODE ,0x520 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF5_ADINR ,0x524 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF5_DALIGN ,0x528 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF6_MODE ,0x540 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF6_ADINR ,0x544 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF6_DALIGN ,0x548 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF7_MODE ,0x560 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF7_ADINR ,0x564 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF7_DALIGN ,0x568 ,0x80 ), -RSND_GEN_M_REG (SSI_MODE ,0xc ,0x80 ), -RSND_GEN_M_REG (SSI_CTRL ,0x10 ,0x80 ), - RSND_GEN_M_REG(SSI_INT_ENABLE, 0x18, 0x80), +RSND_GEN_M_REG (SSI_BUSIF1_MODE ,0x20 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF1_ADINR ,0x24 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF1_DALIGN ,0x28 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF2_MODE ,0x40 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF2_ADINR ,0x44 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF2_DALIGN ,0x48 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF3_MODE ,0x60 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF3_ADINR ,0x64 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF3_DALIGN ,0x68 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF4_MODE ,0x500 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF4_ADINR ,0x504 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF4_DALIGN ,0x508 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF5_MODE ,0x520 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF5_ADINR ,0x524 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF5_DALIGN ,0x528 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF6_MODE ,0x540 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF6_ADINR ,0x544 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF6_DALIGN ,0x548 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF7_MODE ,0x560 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF7_ADINR ,0x564 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF7_DALIGN ,0x568 ,0x80 ), +RSND_GEN_M_REG (SSI_MODE ,0xc ,0x80 ), +RSND_GEN_M_REG (SSI_CTRL ,0x10 ,0x80 ), + RSND_GEN_M_REG(SSI_INT_ENABLE, 0x18, 0x80), }; static const struct rsnd_regmap_field_conf conf_scu[] = {
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191020/8e3cd05a/attachment.sig>
PATCH 12/57 ASoC: rsnd: gen: use tab instead of white-space
Hi Pavel,
Thanks for the feedback.
Quoted 13 lines
Subject: Re: [PATCH 4.19.y-cip 12/57] ASoC: rsnd: gen: use tab instead of white-space
Quoted 8 lines · Biju Das
From: Kuninori Morimoto <[email protected]>
commit
501683d0cd54714de78501efe945bbe4356b922bupstream.commit
8c9d75033340("ASoC: rsnd: ssiu: Support BUSIF other than BUSIF0") added new SSIU registers.
But it is using white-space for it.
This patch fixup it to use tab.
Quoted 5 lines
I believe spaces are okay for indentation, too and normally we do not fix this kind of minor formatting problems unless there are real changes in the same area.
(Plus English could be improved in changelog).
Later patches touches in this area. That is the reason.
Cheers,
Biju
Quoted 68 lines
Review static int rsnd_gen2_probe(struct rsnd_priv *priv) · line 222
Quoted 3 lines
(quoted diff) +0
-0@@ -222,30 +222,30 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv) RSND_GEN_M_REG(SSI_BUSIF0_MODE, 0x0,0x80),Quoted 17 lines
sound/soc/sh/rcar/gen.c +0
-15RSND_GEN_M_REG (SSI_BUSIF0_ADINR ,0x4 ,0x80 ), RSND_GEN_M_REG(SSI_BUSIF0_DALIGN, 0x8, 0x80), -RSND_GEN_M_REG (SSI_BUSIF1_MODE ,0x20 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF1_ADINR ,0x24 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF1_DALIGN ,0x28 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF2_MODE ,0x40 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF2_ADINR ,0x44 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF2_DALIGN ,0x48 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF3_MODE ,0x60 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF3_ADINR ,0x64 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF3_DALIGN ,0x68 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF4_MODE ,0x500 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF4_ADINR ,0x504 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF4_DALIGN ,0x508 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF5_MODE ,0x520 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF5_ADINR ,0x524 ,0x80 ), - RSND_GEN_M_REG(SSI_BUSIF5_DALIGN, 0x528, 0x80),sound/soc/sh/rcar/gen.c static int rsnd_gen2_probe(struct rsnd_priv *priv)
Quoted 10 lines
sound/soc/sh/rcar/gen.c +1
-9-RSND_GEN_M_REG (SSI_BUSIF6_MODE ,0x540 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF6_ADINR ,0x544 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF6_DALIGN ,0x548 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF7_MODE ,0x560 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF7_ADINR ,0x564 ,0x80 ), -RSND_GEN_M_REG (SSI_BUSIF7_DALIGN ,0x568 ,0x80 ), -RSND_GEN_M_REG (SSI_MODE ,0xc ,0x80 ), -RSND_GEN_M_REG (SSI_CTRL ,0x10 ,0x80 ), - RSND_GEN_M_REG(SSI_INT_ENABLE, 0x18, 0x80), + RSND_GEN_M_REG(SSI_BUSIF1_MODE, 0x20,0x80),sound/soc/sh/rcar/gen.c static int rsnd_gen2_probe(struct rsnd_priv *priv)
Quoted 3 lines
sound/soc/sh/rcar/gen.c +3
-0+RSND_GEN_M_REG (SSI_BUSIF1_ADINR ,0x24 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF1_DALIGN ,0x28 ,0x80 ), + RSND_GEN_M_REG(SSI_BUSIF2_MODE, 0x40,0x80),sound/soc/sh/rcar/gen.c static int rsnd_gen2_probe(struct rsnd_priv *priv)
Quoted 3 lines
sound/soc/sh/rcar/gen.c +3
-0+RSND_GEN_M_REG (SSI_BUSIF2_ADINR ,0x44 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF2_DALIGN ,0x48 ,0x80 ), + RSND_GEN_M_REG(SSI_BUSIF3_MODE, 0x60,0x80),sound/soc/sh/rcar/gen.c static int rsnd_gen2_probe(struct rsnd_priv *priv)
Quoted 3 lines
sound/soc/sh/rcar/gen.c +3
-0+RSND_GEN_M_REG (SSI_BUSIF3_ADINR ,0x64 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF3_DALIGN ,0x68 ,0x80 ), + RSND_GEN_M_REG(SSI_BUSIF4_MODE,0x500, 0x80),sound/soc/sh/rcar/gen.c static int rsnd_gen2_probe(struct rsnd_priv *priv)
Quoted 3 lines
sound/soc/sh/rcar/gen.c +3
-0+RSND_GEN_M_REG (SSI_BUSIF4_ADINR ,0x504 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF4_DALIGN ,0x508 ,0x80 ), + RSND_GEN_M_REG(SSI_BUSIF5_MODE,0x520, 0x80),sound/soc/sh/rcar/gen.c static int rsnd_gen2_probe(struct rsnd_priv *priv)
Quoted 3 lines
sound/soc/sh/rcar/gen.c +3
-0+RSND_GEN_M_REG (SSI_BUSIF5_ADINR ,0x524 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF5_DALIGN ,0x528 ,0x80 ), + RSND_GEN_M_REG(SSI_BUSIF6_MODE,0x540, 0x80),sound/soc/sh/rcar/gen.c static int rsnd_gen2_probe(struct rsnd_priv *priv)
Quoted 3 lines
sound/soc/sh/rcar/gen.c +3
-0+RSND_GEN_M_REG (SSI_BUSIF6_ADINR ,0x544 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF6_DALIGN ,0x548 ,0x80 ), + RSND_GEN_M_REG(SSI_BUSIF7_MODE,0x560, 0x80),sound/soc/sh/rcar/gen.c static int rsnd_gen2_probe(struct rsnd_priv *priv) · line 251
Quoted 8 lines
sound/soc/sh/rcar/gen.c +5
-0+RSND_GEN_M_REG (SSI_BUSIF7_ADINR ,0x564 ,0x80 ), +RSND_GEN_M_REG (SSI_BUSIF7_DALIGN ,0x568 ,0x80 ), +RSND_GEN_M_REG (SSI_MODE ,0xc ,0x80 ), +RSND_GEN_M_REG (SSI_CTRL ,0x10 ,0x80 ), + RSND_GEN_M_REG(SSI_INT_ENABLE, 0x18, 0x80), }; static const struct rsnd_regmap_field_conf conf_scu[] = {--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 13/57 ASoC: rsnd: don't use %p for dev_dbg()
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit dabdbe3ae0cb9a67872fa4ac80ffdef61391f645 upstream.
rsnd driver sometimes want to know which address is used when debugging. But it will indicate "(____ptrval____)" if it used "%p" on dev_dbg(). Let's use "%pa" or "%px" for it.
--- sound/soc/sh/rcar/adg.c | 4 ++-- sound/soc/sh/rcar/dma.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
sound/soc/sh/rcar/adg.c +2 -2
@@ -591,7 +591,7 @@ static void rsnd_adg_clk_dbg_info(struct rsnd_priv *priv, struct rsnd_adg *adg)int i;for_each_rsnd_clk (clk, adg, i) -dev_dbg (dev,"%s : %p : %ld\n" , +dev_dbg (dev,"%s : %pa : %ld\n" , clk_name[i], clk,clk_get_rate (clk)); dev_dbg(dev, "BRGCKR = 0x%08x, BRRA/BRRB = 0x%x/0x%x\n",
@@ -604,7 +604,7 @@ static void rsnd_adg_clk_dbg_info(struct rsnd_priv *priv, struct rsnd_adg *adg)* by BRGCKR::BRGCKR_31 */ for_each_rsnd_clkout (clk, adg, i) -dev_dbg (dev,"clkout %d : %p : %ld\n" , i, +dev_dbg (dev,"clkout %d : %pa : %ld\n" , i, clk, clk_get_rate(clk)); }#else
sound/soc/sh/rcar/dma.c +1 -1
@@ -397,7 +397,7 @@ static void rsnd_dmapp_write(struct rsnd_dma *dma, u32 data, u32 reg)struct rsnd_dma_ctrl *dmac =rsnd_priv_to_dmac (priv);struct device *dev =rsnd_priv_to_dev (priv); -dev_dbg (dev,"w %p : %08x\n" ,rsnd_dmapp_addr (dmac, dma, reg), data); +dev_dbg (dev,"w 0x%px : %08x\n" ,rsnd_dmapp_addr (dmac, dma, reg), data);iowrite32 (data,rsnd_dmapp_addr (dmac, dma, reg)); }
Signature · 1 line
2.7.4
PATCH 13/57 ASoC: rsnd: don't use %p for dev_dbg()
Quoted 7 lines · Biju Das
From: Kuninori Morimoto <[email protected]>
commit
dabdbe3ae0cb9a67872fa4ac80ffdef61391f645upstream.rsnd driver sometimes want to know which address is used when debugging. But it will indicate "(
____ptrval____)" if it used "%p" ondev_dbg(). Let's use "%pa" or "%px" for it.
Well, ____ptrval____ is there to hide address space randomization data from the userland. This defeats it... which is probably okay while debugging, but not sure if it is good idea for production.
(It is okay if dev_dbgs are compiled out by default. Is it?)
Best regards,
Pavel
Quoted 31 lines
sound/soc/sh/rcar/adg.c +2
-2@@ -591,7 +591,7 @@ static void rsnd_adg_clk_dbg_info(struct rsnd_priv *priv, struct rsnd_adg *adg)int i;for_each_rsnd_clk (clk, adg, i) -dev_dbg (dev,"%s : %p : %ld\n" , +dev_dbg (dev,"%s : %pa : %ld\n" , clk_name[i], clk,clk_get_rate (clk)); dev_dbg(dev, "BRGCKR = 0x%08x, BRRA/BRRB = 0x%x/0x%x\n",@@ -604,7 +604,7 @@ static void rsnd_adg_clk_dbg_info(struct rsnd_priv *priv, struct rsnd_adg *adg)* by BRGCKR::BRGCKR_31 */ for_each_rsnd_clkout (clk, adg, i) -dev_dbg (dev,"clkout %d : %p : %ld\n" , i, +dev_dbg (dev,"clkout %d : %pa : %ld\n" , i, clk, clk_get_rate(clk)); }#else sound/soc/sh/rcar/dma.c +1
-1@@ -397,7 +397,7 @@ static void rsnd_dmapp_write(struct rsnd_dma *dma, u32 data, u32 reg)struct rsnd_dma_ctrl *dmac =rsnd_priv_to_dmac (priv);struct device *dev =rsnd_priv_to_dev (priv); -dev_dbg (dev,"w %p : %08x\n" ,rsnd_dmapp_addr (dmac, dma, reg), data); +dev_dbg (dev,"w 0x%px : %08x\n" ,rsnd_dmapp_addr (dmac, dma, reg), data);iowrite32 (data,rsnd_dmapp_addr (dmac, dma, reg)); }
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191020/fca61ee9/attachment.sig>
PATCH 13/57 ASoC: rsnd: don't use %p for dev_dbg()
Hi Pave,
Thanks for the feedback.
Quoted 9 lines
Subject: Re: [PATCH 4.19.y-cip 13/57] ASoC: rsnd: don't use %p for
dev_dbg()Quoted 5 lines · Biju Das
From: Kuninori Morimoto <[email protected]>
commit
dabdbe3ae0cb9a67872fa4ac80ffdef61391f645upstream.rsnd driver sometimes want to know which address is used when
debugging.
Quoted 8 lines
Quoted 2 lines
But it will indicate "(
____ptrval____)" if it used "%p" ondev_dbg(). Let's use "%pa" or "%px" for it.Well,
____ptrval____is there to hide address space randomization data from the userland. This defeats it... which is probably okay while debugging, but not sure if it is good idea for production.(It is okay if
dev_dbgsare compiled out by default. Is it?)
Yes, for production scenario no one will enable this.
Regards,
Biju
Quoted 42 lines
Review static void rsnd_adg_clk_dbg_info(struct rsnd_priv
Quoted 2 lines
(quoted diff) +0
-0@@ -591,7 +591,7 @@ static void rsnd_adg_clk_dbg_info(struct rsnd_priv*priv, struct
rsnd_adg*adg)sound/soc/sh/rcar/adg.c static void rsnd_adg_clk_dbg_info(struct rsnd_priv *priv, struct rsnd_adg *adg)
Quoted 8 lines
sound/soc/sh/rcar/adg.c +1
-1int i;for_each_rsnd_clk (clk, adg, i) -dev_dbg (dev,"%s : %p : %ld\n" , +dev_dbg (dev,"%s : %pa : %ld\n" , clk_name[i], clk,clk_get_rate (clk)); dev_dbg(dev, "BRGCKR = 0x%08x, BRRA/BRRB = 0x%x/0x%x\n", @@-604,7
Quoted 1 line
+604,7 @@ static void rsnd_adg_clk_dbg_info(struct
rsnd_priv*priv, struct
rsnd_adg*adg)sound/soc/sh/rcar/dma.c static void rsnd_dmapp_write(struct rsnd_dma
Quoted 13 lines
sound/soc/sh/rcar/adg.c +1
-1* by BRGCKR::BRGCKR_31 */ for_each_rsnd_clkout (clk, adg, i) -dev_dbg (dev,"clkout %d : %p : %ld\n" , i, +dev_dbg (dev,"clkout %d : %pa : %ld\n" , i, clk, clk_get_rate(clk)); }#else sound/soc/sh/rcar/dma.c index renamed from sound/soc/sh/rcar/dma.c +0
-0b5f3bf8..0bbc4b0 100644
sound/soc/sh/rcar/dma.c +0
-0@@ -397,7 +397,7 @@ static void rsnd_dmapp_write(struct rsnd_dma*dma, u32 data, u32 reg)
sound/soc/sh/rcar/dma.c static void rsnd_dmapp_write(struct rsnd_dma *dma, u32 data, u32 reg)
Quoted 4 lines
sound/soc/sh/rcar/dma.c +0
-1struct rsnd_dma_ctrl *dmac =rsnd_priv_to_dmac (priv);struct device *dev =rsnd_priv_to_dev (priv); - dev_dbg(dev, "w %p : %08x\n", rsnd_dmapp_addr(dmac, dma, reg),data);
sound/soc/sh/rcar/dma.c static void rsnd_dmapp_write(struct rsnd_dma · line 400
Quoted 1 line
sound/soc/sh/rcar/dma.c +1
-0+ dev_dbg(dev, "w 0x%px : %08x\n", rsnd_dmapp_addr(dmac, dma,reg),
sound/soc/sh/rcar/dma.c static void rsnd_dmapp_write(struct rsnd_dma · line 403
Quoted 3 lines
sound/soc/sh/rcar/dma.c +1
-0+data);iowrite32 (data,rsnd_dmapp_addr (dmac, dma, reg)); }--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 14/57 ASoC: add for_each_rtd_codec_dai() macro
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 0b7990e38971da403ce223d8bdc758a817eb72f8 upstream.
ALSA SoC snd_soc_pcm_runtime has snd_soc_dai array for codec_dai. To be more readable code, this patch adds
new for_each_rtd_codec_dai() macro, and replace existing code to it.
--- include/sound/soc.h | 7 + sound/soc/intel/boards/kbl_rt5663_max98927.c | 5 +- .../soc/intel/boards/kbl_rt5663_rt5514_max98927.c | 5 +- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | 5 +- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 5 +- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 5 +- sound/soc/meson/axg-card.c | 6 +- sound/soc/soc-core.c | 38 ++--- sound/soc/soc-dapm.c | 14 +- sound/soc/soc-pcm.c | 154 ++++++++++----------- 10 files changed, 118 insertions(+), 126 deletions(-)
include/sound/soc.h +7 -0
@@ -1152,6 +1152,13 @@ struct snd_soc_pcm_runtime { unsigned int dev_registered:1; unsigned int pop_wait:1; }; +#define for_each_rtd_codec_dai (rtd, i, dai)\ + for ((i) = 0; \ + ((i) < rtd->num_codecs) && ((dai) = rtd->codec_dais[i]); \ + (i)++) +#define for_each_rtd_codec_dai_reverse (rtd, i, dai) \ + for (; ((i--) >= 0) && ((dai) = rtd->codec_dais[i]);) +/* mixer control */ struct soc_mixer_control {
sound/soc/intel/boards/kbl_rt5663_max98927.c +2 -3
@@ -488,11 +488,10 @@ static int kabylake_ssp0_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) {struct snd_soc_pcm_runtime *rtd = substream->private_data; +struct snd_soc_dai *codec_dai;int ret =0 , j; -for (j =0 ; j < rtd->num_codecs; j++) { -struct snd_soc_dai *codec_dai = rtd->codec_dais[j]; - +for_each_rtd_codec_dai (rtd, j, codec_dai) {if (!strcmp (codec_dai->component->name,MAXIM_DEV0_NAME )) {/* * Use channel 4 and 5 for the first amp
sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c +2 -3
@@ -353,11 +353,10 @@ static int kabylake_ssp0_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) {struct snd_soc_pcm_runtime *rtd = substream->private_data; +struct snd_soc_dai *codec_dai;int ret =0 , j; -for (j =0 ; j < rtd->num_codecs; j++) { -struct snd_soc_dai *codec_dai = rtd->codec_dais[j]; - +for_each_rtd_codec_dai (rtd, j, codec_dai) {if (!strcmp (codec_dai->component->name,RT5514_DEV_NAME )) { ret =snd_soc_dai_set_tdm_slot (codec_dai,0xF ,0 ,8 ,16 );if (ret <0 ) {
sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c +2 -3
@@ -44,11 +44,10 @@ static int mt8173_rt5650_rt5514_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) {struct snd_soc_pcm_runtime *rtd = substream->private_data; +struct snd_soc_dai *codec_dai;int i, ret; -for (i =0 ; i < rtd->num_codecs; i++) { -struct snd_soc_dai *codec_dai = rtd->codec_dais[i]; - +for_each_rtd_codec_dai (rtd, i, codec_dai) {/* pll from mclk 12.288M */ ret =snd_soc_dai_set_pll (codec_dai,0 ,0 ,MCLK_FOR_CODECS ,params_rate (params) *512 );
sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +2 -3
@@ -48,11 +48,10 @@ static int mt8173_rt5650_rt5676_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) {struct snd_soc_pcm_runtime *rtd = substream->private_data; +struct snd_soc_dai *codec_dai;int i, ret; -for (i =0 ; i < rtd->num_codecs; i++) { -struct snd_soc_dai *codec_dai = rtd->codec_dais[i]; - +for_each_rtd_codec_dai (rtd, i, codec_dai) {/* pll from mclk 12.288M */ ret =snd_soc_dai_set_pll (codec_dai,0 ,0 ,MCLK_FOR_CODECS ,params_rate (params) *512 );
sound/soc/mediatek/mt8173/mt8173-rt5650.c +2 -3
@@ -59,6 +59,7 @@ static int mt8173_rt5650_hw_params(struct snd_pcm_substream *substream, {struct snd_soc_pcm_runtime *rtd = substream->private_data;unsigned int mclk_clock; +struct snd_soc_dai *codec_dai;int i, ret;switch (mt8173_rt5650_priv.pll_from) {
@@ -76,9 +77,7 @@ static int mt8173_rt5650_hw_params(struct snd_pcm_substream *substream,break ; } -for (i =0 ; i < rtd->num_codecs; i++) { -struct snd_soc_dai *codec_dai = rtd->codec_dais[i]; - +for_each_rtd_codec_dai (rtd, i, codec_dai) {/* pll from mclk */ ret =snd_soc_dai_set_pll (codec_dai,0 ,0 , mclk_clock,params_rate (params) *512 );
sound/soc/meson/axg-card.c +2 -4
@@ -167,8 +167,7 @@ static int axg_card_tdm_be_hw_params(struct snd_pcm_substream *substream,if (be->mclk_fs) { mclk =params_rate (params) * be->mclk_fs; -for (i =0 ; i < rtd->num_codecs; i++) { - codec_dai = rtd->codec_dais[i]; +for_each_rtd_codec_dai (rtd, i, codec_dai) { ret =snd_soc_dai_set_sysclk (codec_dai,0 , mclk,SND_SOC_CLOCK_IN );if (ret && ret != -ENOTSUPP )
@@ -196,8 +195,7 @@ static int axg_card_tdm_dai_init(struct snd_soc_pcm_runtime *rtd)struct snd_soc_dai *codec_dai;int ret, i; -for (i =0 ; i < rtd->num_codecs; i++) { - codec_dai = rtd->codec_dais[i]; +for_each_rtd_codec_dai (rtd, i, codec_dai) { ret = snd_soc_dai_set_tdm_slot(codec_dai, be->codec_masks[i].tx, be->codec_masks[i].rx,
sound/soc/soc-core.c +19 -19
@@ -452,12 +452,12 @@ int snd_soc_suspend(struct device *dev)/* mute any active DACs */ list_for_each_entry (rtd, &card->rtd_list, list) { +struct snd_soc_dai *dai;if (rtd->dai_link->ignore_suspend)continue ; -for (i =0 ; i < rtd->num_codecs; i++) { -struct snd_soc_dai *dai = rtd->codec_dais[i]; +for_each_rtd_codec_dai (rtd, i, dai) {struct snd_soc_dai_driver *drv = dai->driver;if (drv->ops->digital_mute && dai->playback_active)
@@ -625,12 +625,12 @@ static void soc_resume_deferred(struct work_struct *work)/* unmute any active DACs */ list_for_each_entry (rtd, &card->rtd_list, list) { +struct snd_soc_dai *dai;if (rtd->dai_link->ignore_suspend)continue ; -for (i =0 ; i < rtd->num_codecs; i++) { -struct snd_soc_dai *dai = rtd->codec_dais[i]; +for_each_rtd_codec_dai (rtd, i, dai) {struct snd_soc_dai_driver *drv = dai->driver;if (drv->ops->digital_mute && dai->playback_active)
@@ -674,15 +674,14 @@ int snd_soc_resume(struct device *dev)/* activate pins from sleep state */ list_for_each_entry (rtd, &card->rtd_list, list) { -struct snd_soc_dai **codec_dais = rtd->codec_dais; +struct snd_soc_dai *codec_dai;struct snd_soc_dai *cpu_dai = rtd->cpu_dai;int j;if (cpu_dai->active)pinctrl_pm_select_default_state (cpu_dai->dev); -for (j =0 ; j < rtd->num_codecs; j++) { -struct snd_soc_dai *codec_dai = codec_dais[j]; +for_each_rtd_codec_dai (rtd, j, codec_dai) {if (codec_dai->active)pinctrl_pm_select_default_state (codec_dai->dev); }
@@ -877,6 +876,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, rtd->num_codecs = dai_link->num_codecs;/* Find CODEC from registered CODECs */ +/* we can use for_each_rtd_codec_dai() after this */ codec_dais = rtd->codec_dais;for (i =0 ; i < rtd->num_codecs; i++) { codec_dais[i] =snd_soc_find_dai (&codecs[i]);
@@ -959,6 +959,7 @@ static void soc_remove_link_dais(struct snd_soc_card *card, struct snd_soc_pcm_runtime *rtd, int order) { int i; +struct snd_soc_dai *codec_dai;/* unregister the rtd device */ if (rtd->dev_registered) {
@@ -967,8 +968,8 @@ static void soc_remove_link_dais(struct snd_soc_card *card, }/* remove the CODEC DAI */ -for (i =0 ; i < rtd->num_codecs; i++) -soc_remove_dai (rtd->codec_dais[i], order); +for_each_rtd_codec_dai (rtd, i, codec_dai) +soc_remove_dai (codec_dai, order);soc_remove_dai (rtd->cpu_dai, order); }
@@ -1480,6 +1481,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card,struct snd_soc_dai *cpu_dai = rtd->cpu_dai;struct snd_soc_rtdcom_list *rtdcom;struct snd_soc_component *component; +struct snd_soc_dai *codec_dai;int i, ret, num; dev_dbg(card->dev, "ASoC: probe %s dai link %d late %d\n",
@@ -1493,8 +1495,8 @@ static int soc_probe_link_dais(struct snd_soc_card *card,return ret;/* probe the CODEC DAI */ -for (i =0 ; i < rtd->num_codecs; i++) { - ret =soc_probe_dai (rtd->codec_dais[i], order); +for_each_rtd_codec_dai (rtd, i, codec_dai) { + ret =soc_probe_dai (codec_dai, order);if (ret)return ret; }
@@ -1681,14 +1683,12 @@ static void soc_remove_aux_devices(struct snd_soc_card *card)int snd_soc_runtime_set_dai_fmt (struct snd_soc_pcm_runtime *rtd,unsigned int dai_fmt) { -struct snd_soc_dai **codec_dais = rtd->codec_dais;struct snd_soc_dai *cpu_dai = rtd->cpu_dai; +struct snd_soc_dai *codec_dai;unsigned int i;int ret; -for (i =0 ; i < rtd->num_codecs; i++) { -struct snd_soc_dai *codec_dai = codec_dais[i]; - +for_each_rtd_codec_dai (rtd, i, codec_dai) { ret =snd_soc_dai_set_fmt (codec_dai, dai_fmt);if (ret !=0 && ret != -ENOTSUPP ) { dev_warn(codec_dai->dev,
@@ -2232,11 +2232,11 @@ int snd_soc_poweroff(struct device *dev)/* deactivate pins to sleep state */ list_for_each_entry (rtd, &card->rtd_list, list) {struct snd_soc_dai *cpu_dai = rtd->cpu_dai; +struct snd_soc_dai *codec_dai;int i;pinctrl_pm_select_sleep_state (cpu_dai->dev); -for (i =0 ; i < rtd->num_codecs; i++) { -struct snd_soc_dai *codec_dai = rtd->codec_dais[i]; +for_each_rtd_codec_dai (rtd, i, codec_dai) {pinctrl_pm_select_sleep_state (codec_dai->dev); } }
@@ -2742,10 +2742,10 @@ int snd_soc_register_card(struct snd_soc_card *card)/* deactivate pins to sleep state */ list_for_each_entry (rtd, &card->rtd_list, list) {struct snd_soc_dai *cpu_dai = rtd->cpu_dai; +struct snd_soc_dai *codec_dai;int j; -for (j =0 ; j < rtd->num_codecs; j++) { -struct snd_soc_dai *codec_dai = rtd->codec_dais[j]; +for_each_rtd_codec_dai (rtd, j, codec_dai) {if (!codec_dai->active)pinctrl_pm_select_sleep_state (codec_dai->dev); }
sound/soc/soc-dapm.c +8 -6
@@ -2397,12 +2397,13 @@ static ssize_t dapm_widget_show(struct device *dev, struct device_attribute *attr, char *buf) { struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); +struct snd_soc_dai *codec_dai;int i, count =0 ;mutex_lock (&rtd->card->dapm_mutex); -for (i =0 ; i < rtd->num_codecs; i++) { -struct snd_soc_component *cmpnt = rtd->codec_dais[i]->component; +for_each_rtd_codec_dai (rtd, i, codec_dai) { +struct snd_soc_component *cmpnt = codec_dai->component; count +=dapm_widget_show_component (cmpnt, buf + count); }
@@ -4145,11 +4146,11 @@ static void dapm_connect_dai_link_widgets(struct snd_soc_card *card, struct snd_soc_pcm_runtime *rtd) {struct snd_soc_dai *cpu_dai = rtd->cpu_dai; +struct snd_soc_dai *codec_dai;struct snd_soc_dapm_widget *sink, *source;int i; -for (i =0 ; i < rtd->num_codecs; i++) { -struct snd_soc_dai *codec_dai = rtd->codec_dais[i]; +for_each_rtd_codec_dai (rtd, i, codec_dai) {/* connect BE DAI playback if widgets are valid */ if (codec_dai->playback_widget && cpu_dai->playback_widget) {
@@ -4237,11 +4238,12 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card)static void soc_dapm_stream_event (struct snd_soc_pcm_runtime *rtd,int stream,int event) { +struct snd_soc_dai *codec_dai;int i;soc_dapm_dai_stream_event (rtd->cpu_dai, stream, event); -for (i =0 ; i < rtd->num_codecs; i++) -soc_dapm_dai_stream_event (rtd->codec_dais[i], stream, event); +for_each_rtd_codec_dai (rtd, i, codec_dai) +soc_dapm_dai_stream_event (codec_dai, stream, event);dapm_power_widgets (rtd->card, event); }
sound/soc/soc-pcm.c +72 -82
411 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 14/57 ASoC: add for_each_rtd_codec_dai() macro
Hi!
Quoted 5 lines
commit
0b7990e38971da403ce223d8bdc758a817eb72f8upstream.ALSA SoC
snd_soc_pcm_runtimehassnd_soc_daiarray forcodec_dai. To be more readable code, this patch adds
newfor_each_rtd_codec_dai()macro, and replace existing code to it.
I'm okay with for_each_rtd_codec_dai() macro. But there's _reverse macro, and they look very, very similar, except that the _reverse macro does not actually initialize i... Yes, code needs it that way, but that's kind of tiny detail easy to overlook.
Mainline at least names the macro _rollback to make it tiny bit clearer. But I'd recommend just opencoding the _reverse macro; it does not really help readability.
Best regards,
Pavel
Quoted 15 lines
+++
b/include/sound/soc.hinclude/sound/soc.h +7
-0@@ -1152,6 +1152,13 @@ struct snd_soc_pcm_runtime { unsigned int dev_registered:1; unsigned int pop_wait:1; }; +#define for_each_rtd_codec_dai (rtd, i, dai)\ + for ((i) = 0; \ + ((i) < rtd->num_codecs) && ((dai) = rtd->codec_dais[i]); \ + (i)++) +#define for_each_rtd_codec_dai_reverse (rtd, i, dai) \ + for (; ((i--) >= 0) && ((dai) = rtd->codec_dais[i]);) +
include/sound/soc.h static int soc_pcm_open(struct snd_pcm_substream *substream) · line 627
Quoted 9 lines
include/sound/soc.h +1
-2@@ -620,8 +621,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) i = rtd->num_codecs; codec_dai_err: -while (--i >=0 ) { - codec_dai = rtd->codec_dais[i]; +for_each_rtd_codec_dai_reverse (rtd, i, codec_dai) {if (codec_dai->driver->ops->shutdown) codec_dai->driver->ops->shutdown (substream, codec_dai); }
Best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191020/27ced167/attachment.sig>
PATCH 14/57 ASoC: add for_each_rtd_codec_dai() macro
HI Pavel,
Thanks for the feedback
Quoted 11 lines
Subject: Re: [PATCH 4.19.y-cip 14/57] ASoC: add
for_each_rtd_codec_dai()macroHi!
Quoted 5 lines
commit
0b7990e38971da403ce223d8bdc758a817eb72f8upstream.ALSA SoC
snd_soc_pcm_runtimehassnd_soc_daiarray forcodec_dai. To be more readable code, this patch adds newfor_each_rtd_codec_dai()macro, and replace existing code to it.
Quoted 8 lines
I'm okay with
for_each_rtd_codec_dai()macro. But there's_reversemacro, and they look very, very similar, except that the_reversemacro does not actually initialize i... Yes, code needs it that way, but that's kind of tiny detail easy to overlook.Mainline at least names the macro
_rollbackto make it tiny bit clearer. But I'd recommend just opencoding the_reversemacro; it does not really help readability.
I have backported this patch only because I got compilation error.
Regards,
Biju
Quoted 34 lines
include/sound/soc.h struct snd_soc_pcm_runtime { · line 1159
Quoted 11 lines
+++
b/include/sound/soc.hinclude/sound/soc.h +5
-0@@ -1152,6 +1152,13 @@ struct snd_soc_pcm_runtime { unsigned int dev_registered:1; unsigned int pop_wait:1; }; +#define for_each_rtd_codec_dai (rtd, i, dai)\ + for ((i) = 0; \ + ((i) < rtd->num_codecs) && ((dai) = rtd->codec_dais[i]); \ + (i)++) +#define for_each_rtd_codec_dai_reverse (rtd, i, dai)\include/sound/soc.h static int soc_pcm_open(struct
Quoted 5 lines
include/sound/soc.h +2
-0+for (; ((i--) >=0 ) && ((dai) = rtd->codec_dais[i]);) +@@ -620,8 +621,7 @@ static int soc_pcm_open(struct
snd_pcm_substream*substream)sound/soc/soc-pcm.c static int soc_pcm_open(struct snd_pcm_substream *substream)
Quoted 8 lines
sound/soc/soc-pcm.c +1
-2i = rtd->num_codecs; codec_dai_err: -while (--i >=0 ) { - codec_dai = rtd->codec_dais[i]; +for_each_rtd_codec_dai_reverse (rtd, i, codec_dai) {if (codec_dai->driver->ops->shutdown) codec_dai->driver->ops->shutdown(substream,
codec_dai);Review static int soc_pcm_open(struct · line 627
Quoted 1 line
(quoted diff) +0
-0}Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 15/57 ASoC: convert for_each_rtd_codec_dai() for missing part
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 7afecb3073e357ebfe4087e4ab8bb493c32bb652 upstream.
commit 0b7990e38971 ("ASoC: add for_each_rtd_codec_dai() macro") added for_each_rtd_codec_dai(), but it didn't convert few loop which is not using "rtd". This patch fixup it.
--- sound/soc/soc-pcm.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
sound/soc/soc-pcm.c +15 -16
@@ -1304,6 +1304,7 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card, struct snd_soc_dapm_widget *widget, int stream) {struct snd_soc_pcm_runtime *be; +struct snd_soc_dai *dai;int i;dev_dbg (card->dev,"ASoC: find BE for widget %s\n" , widget->name);
@@ -1321,8 +1322,7 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,if (be->cpu_dai->playback_widget == widget)return be; -for (i =0 ; i < be->num_codecs; i++) { -struct snd_soc_dai *dai = be->codec_dais[i]; +for_each_rtd_codec_dai (be, i, dai) {if (dai->playback_widget == widget)return be; }
@@ -1341,8 +1341,7 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,if (be->cpu_dai->capture_widget == widget)return be; -for (i =0 ; i < be->num_codecs; i++) { -struct snd_soc_dai *dai = be->codec_dais[i]; +for_each_rtd_codec_dai (be, i, dai) {if (dai->capture_widget == widget)return be; }
@@ -1438,6 +1437,7 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,struct snd_soc_dpcm *dpcm;struct snd_soc_dapm_widget_list *list = *list_;struct snd_soc_dapm_widget *widget; +struct snd_soc_dai *dai;int prune =0 ;/* Destroy any old FE <--> BE connections */
@@ -1452,8 +1452,7 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,continue ;/* is there a valid CODEC DAI widget for this BE */ -for (i =0 ; i < dpcm->be->num_codecs; i++) { -struct snd_soc_dai *dai = dpcm->be->codec_dais[i]; +for_each_rtd_codec_dai (dpcm->be, i, dai) { widget =dai_get_widget (dai, stream);/* prune the BE if it's no longer in our active list */
@@ -1688,6 +1687,7 @@ static void dpcm_runtime_merge_format(struct snd_pcm_substream *substream, {struct snd_soc_pcm_runtime *fe = substream->private_data;struct snd_soc_dpcm *dpcm; +struct snd_soc_dai *dai;int stream = substream->stream;if (!fe->dai_link->dpcm_merged_format)
@@ -1704,16 +1704,15 @@ static void dpcm_runtime_merge_format(struct snd_pcm_substream *substream,struct snd_soc_pcm_stream *codec_stream;int i; -for (i =0 ; i < be->num_codecs; i++) { +for_each_rtd_codec_dai (be, i, dai) {/* * Skip CODECs which don't support the current stream * type. See soc_pcm_init_runtime_hw() for more details */ -if (!snd_soc_dai_stream_valid (be->codec_dais[i], - stream)) +if (!snd_soc_dai_stream_valid (dai, stream))continue ; - codec_dai_drv = be->codec_dais[i]->driver; + codec_dai_drv = dai->driver;if (stream ==SNDRV_PCM_STREAM_PLAYBACK ) codec_stream = &codec_dai_drv->playback;else
@@ -1798,6 +1797,7 @@ static void dpcm_runtime_merge_rate(struct snd_pcm_substream *substream,struct snd_soc_dai_driver *codec_dai_drv;struct snd_soc_pcm_stream *codec_stream;struct snd_soc_pcm_stream *cpu_stream; +struct snd_soc_dai *dai;int i;if (stream ==SNDRV_PCM_STREAM_PLAYBACK )
@@ -1809,16 +1809,15 @@ static void dpcm_runtime_merge_rate(struct snd_pcm_substream *substream, *rate_max =min_not_zero (*rate_max, cpu_stream->rate_max); *rates =snd_pcm_rate_mask_intersect (*rates, cpu_stream->rates); -for (i =0 ; i < be->num_codecs; i++) { +for_each_rtd_codec_dai (be, i, dai) {/* * Skip CODECs which don't support the current stream * type. See soc_pcm_init_runtime_hw() for more details */ -if (!snd_soc_dai_stream_valid (be->codec_dais[i], - stream)) +if (!snd_soc_dai_stream_valid (dai, stream))continue ; - codec_dai_drv = be->codec_dais[i]->driver; + codec_dai_drv = dai->driver;if (stream ==SNDRV_PCM_STREAM_PLAYBACK ) codec_stream = &codec_dai_drv->playback;else
@@ -2788,6 +2787,7 @@ int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute)struct snd_soc_dpcm *dpcm;struct list_head *clients = &fe->dpcm[SNDRV_PCM_STREAM_PLAYBACK ].be_clients; +struct snd_soc_dai *dai;list_for_each_entry (dpcm, clients, list_be) {
@@ -2797,8 +2797,7 @@ int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute)if (be->dai_link->ignore_suspend)continue ; -for (i =0 ; i < be->num_codecs; i++) { -struct snd_soc_dai *dai = be->codec_dais[i]; +for_each_rtd_codec_dai (be, i, dai) {struct snd_soc_dai_driver *drv = dai->driver; dev_dbg(be->dev, "ASoC: BE digital mute %s\n",
Signature · 1 line
2.7.4
PATCH 15/57 ASoC: convert for_each_rtd_codec_dai() for missing part
Hi!
Quoted 6 lines
commit
0b7990e38971("ASoC: addfor_each_rtd_codec_dai()macro") addedfor_each_rtd_codec_dai(), but it didn't convert few loop which is not using "rtd". This patch fixup it.
sound/soc/soc-pcm.c static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card, · line 1328
Quoted 9 lines
sound/soc/soc-pcm.c +1
-2@@ -1321,8 +1322,7 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,if (be->cpu_dai->playback_widget == widget)return be; -for (i =0 ; i < be->num_codecs; i++) { -struct snd_soc_dai *dai = be->codec_dais[i]; +for_each_rtd_codec_dai (be, i, dai) {if (dai->playback_widget == widget)return be; }
This conversion is not equivalent. Original code always goes through num_codecs, new code stops at first NULL pointer. I assume there are always non-NULL pointers in the list, but perhaps new code should not be ignoring the NULLs silently?
Best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191020/722af6d1/attachment.sig>
PATCH 15/57 ASoC: convert for_each_rtd_codec_dai() for missing part
+ Morimoto-San,
Quoted 16 lines
Subject: Re: [PATCH 4.19.y-cip 15/57] ASoC: convert
for_each_rtd_codec_dai()for missing partHi!
Quoted 1 line
commit
0b7990e38971("ASoC: addfor_each_rtd_codec_dai()macro")added
Review static struct snd_soc_pcm_runtime
Quoted 5 lines
for_each_rtd_codec_dai(), but it didn't convert few loop which is not using "rtd". This patch fixup it.(quoted diff) +0
-0@@ -1321,8 +1322,7 @@ static struct snd_soc_pcm_runtime*dpcm_get_be(struct
snd_soc_card*card,Quoted 3 lines
sound/soc/soc-pcm.c +0
-0if (be->cpu_dai->playback_widget == widget)return be;
Quoted 12 lines
sound/soc/soc-pcm.c static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card, · line 1328
Quoted 6 lines
sound/soc/soc-pcm.c +1
-2-for (i =0 ; i < be->num_codecs; i++) { -struct snd_soc_dai *dai = be->codec_dais[i]; +for_each_rtd_codec_dai (be, i, dai) {if (dai->playback_widget == widget)return be; }This conversion is not equivalent. Original code always goes through
num_codecs, new code stops at first NULL pointer. I assume there are always non-NULL pointers in the list, but perhaps new code should not be ignoring the NULLs silently?
Do you have any opinion on Pavel's findings?
Regards,
Biju
PATCH 15/57 ASoC: convert for_each_rtd_codec_dai() for missing part
Hi
Quoted 18 lines
Quoted 5 lines
Review static struct snd_soc_pcm_runtime
Quoted 1 line
(quoted diff) +0
-0@@ -1321,8 +1322,7 @@ static struct snd_soc_pcm_runtime*dpcm_get_be(struct
snd_soc_card*card,Quoted 3 lines
sound/soc/soc-pcm.c +0
-0if (be->cpu_dai->playback_widget == widget)return be;Quoted 12 lines
sound/soc/soc-pcm.c static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card, · line 1328
Quoted 6 lines
sound/soc/soc-pcm.c +1
-2-for (i =0 ; i < be->num_codecs; i++) { -struct snd_soc_dai *dai = be->codec_dais[i]; +for_each_rtd_codec_dai (be, i, dai) {if (dai->playback_widget == widget)return be; }This conversion is not equivalent. Original code always goes through
num_codecs, new code stops at first NULL pointer. I assume there are always non-NULL pointers in the list, but perhaps new code should not be ignoring the NULLs silently?
Quoted 1 line
Do you have any opinion on Pavel's findings?
Hmm.. strange.
If original code goes through eventhough NULL pointer, it will be Oops at dai->playback_widget access ?
? Does this comment came from code review,
instead of actual machine operation issue ?
if so, it is always non-NULL pointer list.
Thank you for your help !!
Best regards
---
Kuninori Morimoto
PATCH 15/57 ASoC: convert for_each_rtd_codec_dai() for missing part
Hello Morimota-San,
Thanks for the feedback.
Quoted 24 lines
Subject: Re: [PATCH 4.19.y-cip 15/57] ASoC: convert
for_each_rtd_codec_dai()for missing partHi
Quoted 18 lines
Quoted 17 lines
Review static struct snd_soc_pcm_runtime
Quoted 1 line
(quoted diff) +0
-0@@ -1321,8 +1322,7 @@ static struct snd_soc_pcm_runtime*dpcm_get_be(struct
snd_soc_card*card,sound/soc/soc-pcm.c static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card, · line 1328
Quoted 9 lines
sound/soc/soc-pcm.c +1
-2if (be->cpu_dai->playback_widget == widget)return be; -for (i =0 ; i < be->num_codecs; i++) { -struct snd_soc_dai *dai = be->codec_dais[i]; +for_each_rtd_codec_dai (be, i, dai) {if (dai->playback_widget == widget)return be; }This conversion is not equivalent. Original code always goes through
num_codecs, new code stops at first NULL pointer. I assume there are always non-NULL pointers in the list, but perhaps new code should not be ignoring the NULLs silently?
Quoted 8 lines
Quoted 1 line
Do you have any opinion on Pavel's findings?
Hmm.. strange.
If original code goes through eventhough NULL pointer, it will be Oops at dai-Quoted 1 line
playback_widgetaccess ?? Does this comment came from code review, instead of actual machine operation issue ?
This comments are from code review.
https://lists.cip-project.org/pipermail/cip-dev/2019-October/thread.html#3456
Cheers,
Biju
Quoted 2 lines
if so, it is always non-NULL pointer list.
PATCH 16/57 ASoC: add for_each_dpcm_fe() macro
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit d2e24d64652bf9d272e5496ae8a562bc64facff3 upstream.
To be more readable code, this patch adds
new for_each_dpcm_fe() macro, and replace existing code to it.
--- include/sound/soc-dpcm.h | 3 +++ sound/soc/soc-pcm.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-)
include/sound/soc-dpcm.h +3 -0
@@ -103,6 +103,9 @@ struct snd_soc_dpcm_runtime {int trigger_pending;/* trigger cmd + 1 if pending, 0 if not */ }; +#define for_each_dpcm_fe (be, stream, dpcm) \ + list_for_each_entry(dpcm, &(be)->dpcm[stream].fe_clients, list_fe) +/* can this BE stop and free */ int snd_soc_dpcm_can_be_free_stop (struct snd_soc_pcm_runtime *fe,struct snd_soc_pcm_runtime *be,int stream);
sound/soc/soc-pcm.c +3 -3
@@ -1255,7 +1255,7 @@ static void dpcm_be_reparent(struct snd_soc_pcm_runtime *fe, be_substream =snd_soc_dpcm_get_substream (be, stream); -list_for_each_entry (dpcm, &be->dpcm[stream].fe_clients, list_fe) { +for_each_dpcm_fe (be, stream, dpcm) {if (dpcm->fe == fe)continue ;
@@ -3223,7 +3223,7 @@ int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe,struct snd_soc_dpcm *dpcm;int state; -list_for_each_entry (dpcm, &be->dpcm[stream].fe_clients, list_fe) { +for_each_dpcm_fe (be, stream, dpcm) {if (dpcm->fe == fe)continue ;
@@ -3250,7 +3250,7 @@ int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe,struct snd_soc_dpcm *dpcm;int state; -list_for_each_entry (dpcm, &be->dpcm[stream].fe_clients, list_fe) { +for_each_dpcm_fe (be, stream, dpcm) {if (dpcm->fe == fe)continue ;
Signature · 1 line
2.7.4
PATCH 16/57 ASoC: add for_each_dpcm_fe() macro
Hi!
include/sound/soc-dpcm.h struct snd_soc_dpcm_runtime { · line 108
Quoted 9 lines
include/sound/soc-dpcm.h +3
-0@@ -103,6 +103,9 @@ struct snd_soc_dpcm_runtime {int trigger_pending;/* trigger cmd + 1 if pending, 0 if not */ }; +#define for_each_dpcm_fe (be, stream, dpcm) \ + list_for_each_entry(dpcm, &(be)->dpcm[stream].fe_clients, list_fe) +
This macro is really confusing. dpcm is used as both control variable of the loop and name of the field in *be. Plus it relies on list_fe variable to be present in the context including it... that's non-standard.
Oh and "&(be)->" can be written as "(be)." AFAICT.
Best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191020/e45c32b7/attachment.sig>
PATCH 16/57 ASoC: add for_each_dpcm_fe() macro
+ Morimoto-San,
Quoted 11 lines
Subject: Re: [PATCH 4.19.y-cip 16/57] ASoC: add
for_each_dpcm_fe()macroHi!
include/sound/soc-dpcm.h struct snd_soc_dpcm_runtime { · line 105
Quoted 6 lines
include/sound/soc-dpcm.h +1
-0@@ -103,6 +103,9 @@ struct snd_soc_dpcm_runtime {int trigger_pending;/* trigger cmd + 1 if pending, 0 if not */ }; +#define for_each_dpcm_fe (be, stream, dpcm)\
Quoted 8 lines
include/sound/soc-dpcm.h struct snd_soc_dpcm_runtime { · line 108
Quoted 2 lines
include/sound/soc-dpcm.h +2
-0+list_for_each_entry (dpcm, &(be)->dpcm[stream].fe_clients, list_fe) +This macro is really confusing. dpcm is used as both control variable of the loop and name of the field in *be. Plus it relies on
list_fevariable to be present in the context including it... that's non-standard.Oh and "&(be)->" can be written as "(be)." AFAICT.
Morimoto-San,
Do you have any opinion on Pavel's findings?
Regards,
Biju
PATCH 16/57 ASoC: add for_each_dpcm_fe() macro
Hi
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
include/sound/soc-dpcm.h +0
-0@@ -103,6 +103,9 @@ struct snd_soc_dpcm_runtime {int trigger_pending;/* trigger cmd + 1 if pending, 0 if not */ };
Quoted 7 lines
Quoted 7 lines
include/sound/soc-dpcm.h struct snd_soc_dpcm_runtime { · line 105
Quoted 1 line
include/sound/soc-dpcm.h +1
-0+#define for_each_dpcm_fe (be, stream, dpcm)\include/sound/soc-dpcm.h struct snd_soc_dpcm_runtime { · line 108
Quoted 2 lines
include/sound/soc-dpcm.h +2
-0+list_for_each_entry (dpcm, &(be)->dpcm[stream].fe_clients, list_fe) +This macro is really confusing. dpcm is used as both control variable of the loop and name of the field in *be.
Ohh, yes, indeed.
Thank you for pointing it. I will post fixup patch
Quoted 2 lines
Plus it relies on
list_fevariable to beQuoted 1 line
present in the context including it... that's non-standard.
sorry I couldn't understand about this
Quoted 1 line
Quoted 1 line
Oh and "&(be)->" can be written as "(be)." AFAICT.
This "&" is for fe_clients
Thank you for your help !!
Best regards
---
Kuninori Morimoto
PATCH 16/57 ASoC: add for_each_dpcm_fe() macro
Quoted 10 lines · Kuninori Morimoto
Hi
Quoted 7 lines
Quoted 7 lines
include/sound/soc-dpcm.h struct snd_soc_dpcm_runtime { · line 105
Quoted 6 lines
include/sound/soc-dpcm.h +1
-0@@ -103,6 +103,9 @@ struct snd_soc_dpcm_runtime {int trigger_pending;/* trigger cmd + 1 if pending, 0 if not */ }; +#define for_each_dpcm_fe (be, stream, dpcm)\
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
include/sound/soc-dpcm.h struct snd_soc_dpcm_runtime { · line 108
Quoted 2 lines
include/sound/soc-dpcm.h +2
-0+list_for_each_entry (dpcm, &(be)->dpcm[stream].fe_clients, list_fe) +This macro is really confusing. dpcm is used as both control variable of the loop and name of the field in *be.
Ohh, yes, indeed.
Thank you for pointing it. I will post fixup patch
Thanks!
Quoted 4 lines
Quoted 2 lines
Plus it relies on
list_fevariable to beQuoted 1 line
present in the context including it... that's non-standard.
sorry I couldn't understand about this
Macro is:
include/sound/soc-dpcm.h struct snd_soc_dpcm_runtime { · line 107
Quoted 2 lines
include/sound/soc-dpcm.h +2
-0+#define for_each_dpcm_fe (be, stream, dpcm) \ + list_for_each_entry(dpcm, &(be)->dpcm[stream].fe_clients, list_fe)
It should be:
Review
Quoted 2 lines
(quoted diff) +2
-0+#define for_each_dpcm_fe(be, stream, dpcm, list_de) \ + list_for_each_entry(dpcm, &(be)->dpcm[stream].fe_clients, list_fe)
[accessing variables not passed as macro arguments is strange/surprising].
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Oh and "&(be)->" can be written as "(be)." AFAICT.
This "&" is for
fe_clients
Aha, sorry, I misparsed that one.
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 195 bytes Desc: not available URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191118/13bfaf44/attachment.sig>
PATCH 16/57 ASoC: add for_each_dpcm_fe() macro
Hi Pavel
Quoted 9 lines
include/sound/soc-dpcm.h struct snd_soc_dpcm_runtime { · line 107
Quoted 2 lines
include/sound/soc-dpcm.h +2
-0+#define for_each_dpcm_fe (be, stream, dpcm) \ + list_for_each_entry(dpcm, &(be)->dpcm[stream].fe_clients, list_fe)It should be:
Review
Quoted 2 lines
(quoted diff) +2
-0+#define for_each_dpcm_fe(be, stream, dpcm, list_de) \ + list_for_each_entry(dpcm, &(be)->dpcm[stream].fe_clients, list_fe)[accessing variables not passed as macro arguments is strange/surprising].
Ahh, OK. But, I would say, Yes and No.
Indeed, using not passed parameter in macro is strange. But, this time, it is used at list_for_each_entry(). Last one is struct location/member, not parameter.
In this case, in order to use properly,
macro name is indicating "for what".
We have xx_fe and xx_be.
#define for_each_dpcm_fe(be, stream, _dpcm) \ list_for_each_entry(_dpcm, &(be)->dpcm[stream].fe_clients, list_fe)
#define for_each_dpcm_be(fe, stream, _dpcm) \ list_for_each_entry(_dpcm, &(fe)->dpcm[stream].be_clients, list_be)
Thank you for your help !!
Best regards
---
Kuninori Morimoto
PATCH 17/57 ASoC: add for_each_dpcm_be() macro
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 8d6258a4dd267838e2f10643c3d91b79fe75ef6e upstream.
To be more readable code, this patch adds
new for_each_dpcm_be() macro, and replace existing code to it.
--- include/sound/soc-dpcm.h | 7 +++++++ sound/soc/fsl/fsl_asrc_dma.c | 2 +- sound/soc/sh/rcar/ctu.c | 2 +- sound/soc/sh/rcar/src.c | 2 +- sound/soc/soc-compress.c | 4 ++-- sound/soc/soc-pcm.c | 48 +++++++++++++++++++++----------------------- 6 files changed, 35 insertions(+), 30 deletions(-)
include/sound/soc-dpcm.h +7 -0
@@ -106,6 +106,13 @@ struct snd_soc_dpcm_runtime {#define for_each_dpcm_fe (be, stream, dpcm) \ list_for_each_entry(dpcm, &(be)->dpcm[stream].fe_clients, list_fe) +#define for_each_dpcm_be (fe, stream, dpcm) \ + list_for_each_entry(dpcm, &(fe)->dpcm[stream].be_clients, list_be) +#define for_each_dpcm_be_safe (fe, stream, dpcm, _dpcm) \ + list_for_each_entry_safe(dpcm, _dpcm, &(fe)->dpcm[stream].be_clients, list_be) +#define for_each_dpcm_be_rollback (fe, stream, dpcm) \ + list_for_each_entry_continue_reverse(dpcm, &(fe)->dpcm[stream].be_clients, list_be) +/* can this BE stop and free */ int snd_soc_dpcm_can_be_free_stop (struct snd_soc_pcm_runtime *fe,struct snd_soc_pcm_runtime *be,int stream);
sound/soc/fsl/fsl_asrc_dma.c +1 -1
@@ -151,7 +151,7 @@ static int fsl_asrc_dma_hw_params(struct snd_pcm_substream *substream,int ret;/* Fetch the Back-End dma_data from DPCM */ -list_for_each_entry (dpcm, &rtd->dpcm[stream].be_clients, list_be) { +for_each_dpcm_be (rtd, stream, dpcm) {struct snd_soc_pcm_runtime *be = dpcm->be;struct snd_pcm_substream *substream_be;struct snd_soc_dai *dai = be->cpu_dai;
sound/soc/sh/rcar/ctu.c +1 -1
@@ -258,7 +258,7 @@ static int rsnd_ctu_hw_params(struct rsnd_mod *mod,struct snd_pcm_hw_params *be_params;int stream = substream->stream; -list_for_each_entry (dpcm, &fe->dpcm[stream].be_clients, list_be) { +for_each_dpcm_be (fe, stream, dpcm) { be_params = &dpcm->hw_params;if (params_channels (fe_params) !=params_channels (be_params)) ctu->channels =params_channels (be_params);
sound/soc/sh/rcar/src.c +1 -1
@@ -158,7 +158,7 @@ static int rsnd_src_hw_params(struct rsnd_mod *mod,struct snd_soc_dpcm *dpcm;struct snd_pcm_hw_params *be_params; -list_for_each_entry (dpcm, &fe->dpcm[stream].be_clients, list_be) { +for_each_dpcm_be (fe, stream, dpcm) { be_params = &dpcm->hw_params;if (params_rate (fe_params) !=params_rate (be_params))
sound/soc/soc-compress.c +2 -2
@@ -157,7 +157,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) ret =dpcm_be_dai_startup (fe, stream);if (ret <0 ) {/* clean up all links */ -list_for_each_entry (dpcm, &fe->dpcm[stream].be_clients, list_be) +for_each_dpcm_be (fe, stream, dpcm) dpcm->state =SND_SOC_DPCM_LINK_STATE_FREE ;dpcm_be_disconnect (fe, stream);
@@ -321,7 +321,7 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream) ret =dpcm_be_dai_shutdown (fe, stream);/* mark FE's links ready to prune */ -list_for_each_entry (dpcm, &fe->dpcm[stream].be_clients, list_be) +for_each_dpcm_be (fe, stream, dpcm) dpcm->state =SND_SOC_DPCM_LINK_STATE_FREE ;dpcm_dapm_stream_event (fe, stream,SND_SOC_DAPM_STREAM_STOP );
sound/soc/soc-pcm.c +23 -25
188 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 18/57 ASoC: rsnd: fixup SSI clock during suspend/resume modes
In reply to Biju DasFrom: Dmytro Prokopchuk <[email protected]>
commit 624d1a7cd8991e33dad96ab4629a52c412540e65 upstream.
Prepare <-> Cleanup functions pair has balanced calls. But in case of suspend mode no call to rsnd_soc_dai_shutdown() function, so cleanup isn't called. OTOH during resume mode function rsnd_soc_dai_prepare() is called, but calling rsnd_ssi_prepare() is skipped (rsnd_status_update() returns zero, bacause was not cleanup before).
We need to call rsnd_ssi_prepare(), because it enables SSI clocks by calling rsnd_ssi_master_clk_start().
This patch allows to call prepare/cleanup functions always.
--- sound/soc/sh/rcar/dma.c | 7 +++---- sound/soc/sh/rcar/rsnd.h | 14 +++++++------- 2 files changed, 10 insertions(+), 11 deletions(-)
sound/soc/sh/rcar/dma.c +3 -4
@@ -134,10 +134,9 @@ static int rsnd_dmaen_prepare(struct rsnd_mod *mod,struct rsnd_dmaen *dmaen =rsnd_dma_to_dmaen (dma);struct device *dev =rsnd_priv_to_dev (priv); -if (dmaen->chan) { -dev_err (dev,"it already has dma channel\n" ); -return -EIO ; - } +/* maybe suspended */ +if (dmaen->chan) +return 0 ;/* * DMAEngine request uses mutex lock.
sound/soc/sh/rcar/rsnd.h +7 -7
@@ -318,9 +318,8 @@ struct rsnd_mod {/* * status * -* 0xH0000CBA +* 0xH0000CB0 * -* A 0: prepare 1: cleanup * B 0: init 1: quit * C 0: start 1: stop *
@@ -331,9 +330,8 @@ struct rsnd_mod {* H 0: hw_params * H 0: pointer * H 0: prepare +* H 0: cleanup */ -#define __rsnd_mod_shift_prepare 0 -#define __rsnd_mod_shift_cleanup 0#define __rsnd_mod_shift_init 4#define __rsnd_mod_shift_quit 4#define __rsnd_mod_shift_start 8
@@ -345,11 +343,13 @@ struct rsnd_mod {#define __rsnd_mod_shift_fallback 28/* always called */ #define __rsnd_mod_shift_hw_params 28/* always called */ #define __rsnd_mod_shift_pointer 28/* always called */ +#define __rsnd_mod_shift_prepare 28/* always called */ +#define __rsnd_mod_shift_cleanup 28/* always called */ #define __rsnd_mod_add_probe 0#define __rsnd_mod_add_remove 0 -#define __rsnd_mod_add_prepare 1 -#define __rsnd_mod_add_cleanup -1 +#define __rsnd_mod_add_prepare 0 +#define __rsnd_mod_add_cleanup 0#define __rsnd_mod_add_init 1#define __rsnd_mod_add_quit -1#define __rsnd_mod_add_start 1
@@ -363,7 +363,7 @@ struct rsnd_mod {#define __rsnd_mod_call_probe 0#define __rsnd_mod_call_remove 0#define __rsnd_mod_call_prepare 0 -#define __rsnd_mod_call_cleanup 1 +#define __rsnd_mod_call_cleanup 0#define __rsnd_mod_call_init 0#define __rsnd_mod_call_quit 1#define __rsnd_mod_call_start 0
Signature · 1 line
2.7.4
PATCH 19/57 ASoC: rsnd: use 32bit TDM width as default
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 82ab7e9a4d3fcec27f745be04063e17da1881dda upstream.
commit fb2815f44a9e ("ASoC: rsnd: add support for 16/24 bit slot widths") added TDM width check, and return error if it was not 16/24/32 bit. But it is too strict. This patch uses 32bit same as default.
--- sound/soc/sh/rcar/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/sh/rcar/core.c +2 -2
@@ -738,8 +738,8 @@ static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai,case 32 :break ;default : -dev_err (dev,"unsupported slot width value: %d\n" , slot_width); -return -EINVAL ; +/* use default */ + slot_width =32 ; }switch (slots) {
Signature · 1 line
2.7.4
PATCH 19/57 ASoC: rsnd: use 32bit TDM width as default
Quoted 9 lines · Biju Das
From: Kuninori Morimoto <[email protected]>
commit
82ab7e9a4d3fcec27f745be04063e17da1881ddaupstream.commit
fb2815f44a9e("ASoC: rsnd: add support for 16/24 bit slot widths") added TDM width check, and return error if it was not 16/24/32 bit. But it is too strict. This patch uses 32bit same as default.
sound/soc/sh/rcar/core.c static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai, · line 745
Quoted 10 lines
sound/soc/sh/rcar/core.c +2
-2@@ -738,8 +738,8 @@ static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai,case 32 :break ;default : -dev_err (dev,"unsupported slot width value: %d\n" , slot_width); -return -EINVAL ; +/* use default */ + slot_width =32 ; }switch (slots) {
I don't think I like this. People should not be passing strange values to this function. Can the caller be fixed, instead?
Thanks,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191020/7f233998/attachment-0001.sig>
PATCH 19/57 ASoC: rsnd: use 32bit TDM width as default
+ Morimoto-San,
Hi Pavel,
Thanks for the feedback.
Quoted 33 lines
-----Original Message-----
From: Pavel Machek <[email protected]>
Sent: Sunday, October 20, 2019 10:49 AM
To: Biju Das <[email protected]>
Cc: cip-dev at lists.cip-project.org; Nobuhiro Iwamatsu <[email protected]>; Pavel Machek <[email protected]>; Chris Paterson <[email protected]>; Fabrizio Castro <[email protected]>
Subject: Re: [PATCH 4.19.y-cip 19/57] ASoC: rsnd: use 32bit TDM width as defaultQuoted 6 lines · Biju Das
From: Kuninori Morimoto <[email protected]>
commit
82ab7e9a4d3fcec27f745be04063e17da1881ddaupstream.commit
fb2815f44a9e("ASoC: rsnd: add support for 16/24 bit slot widths") added TDM width check, and return error if it was not 16/24/32bit.
Review static int rsnd_soc_set_dai_tdm_slot(struct
Quoted 3 lines
But it is too strict. This patch uses 32bit same as default.
(quoted diff) +0
-0@@ -738,8 +738,8 @@ static int rsnd_soc_set_dai_tdm_slot(struct
snd_soc_dai*dai,sound/soc/sh/rcar/core.c static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai,
Quoted 4 lines
sound/soc/sh/rcar/core.c +0
-1case 32 :break ;default : - dev_err(dev, "unsupported slot width value: %d\n",
slot_width);Quoted 5 lines
sound/soc/sh/rcar/core.c +2
-1-return -EINVAL ; +/* use default */ + slot_width =32 ; }
Quoted 4 lines
sound/soc/sh/rcar/core.c static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai, · line 745
Quoted 1 line
sound/soc/sh/rcar/core.c +0
-0switch (slots) {I don't think I like this. People should not be passing strange values to this function. Can the caller be fixed, instead?
Morimoto San, Do you agree to Pavel's comment?
Regards,
Biju
PATCH 19/57 ASoC: rsnd: use 32bit TDM width as default
Hi
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
sound/soc/sh/rcar/core.c +2
-2@@ -738,8 +738,8 @@ static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai,case 32 :break ;default : -dev_err (dev,"unsupported slot width value: %d\n" , slot_width); -return -EINVAL ; +/* use default */ + slot_width =32 ; }
Quoted 6 lines
Quoted 4 lines
sound/soc/sh/rcar/core.c static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai, · line 745
Quoted 1 line
sound/soc/sh/rcar/core.c +0
-0switch (slots) {I don't think I like this. People should not be passing strange values to this function. Can the caller be fixed, instead?
Morimoto San, Do you agree to Pavel's comment?
As git-log said, it is default values, not strange value. People don't set all settings, especially it was default.
Thank you for your help !!
Best regards
---
Kuninori Morimoto
PATCH 19/57 ASoC: rsnd: use 32bit TDM width as default
Quoted 18 lines · Kuninori Morimoto
Hi
Quoted 15 lines
Quoted 14 lines
sound/soc/sh/rcar/core.c static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai, · line 745
Quoted 11 lines
sound/soc/sh/rcar/core.c +2
-2@@ -738,8 +738,8 @@ static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai,case 32 :break ;default : -dev_err (dev,"unsupported slot width value: %d\n" , slot_width); -return -EINVAL ; +/* use default */ + slot_width =32 ; }switch (slots) {I don't think I like this. People should not be passing strange values to this function. Can the caller be fixed, instead?
Quoted 4 lines
Quoted 1 line
Morimoto San, Do you agree to Pavel's comment?
As git-log said, it is default values, not strange value. People don't set all settings, especially it was default.
I'd understand turning 0 to 32 (that is if someone forgot to set it?). But turning 19 into 32 seems wrong.
Best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 195 bytes Desc: not available URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191118/2a79135d/attachment.sig>
PATCH 19/57 ASoC: rsnd: use 32bit TDM width as default
Hi Pavel
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
sound/soc/sh/rcar/core.c static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai, · line 745
Quoted 11 lines
sound/soc/sh/rcar/core.c +2
-2@@ -738,8 +738,8 @@ static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai,case 32 :break ;default : -dev_err (dev,"unsupported slot width value: %d\n" , slot_width); -return -EINVAL ; +/* use default */ + slot_width =32 ; }switch (slots) {I don't think I like this. People should not be passing strange values to this function. Can the caller be fixed, instead?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Morimoto San, Do you agree to Pavel's comment?
As git-log said, it is default values, not strange value. People don't set all settings, especially it was default.
I'd understand turning 0 to 32 (that is if someone forgot to set it?). But turning 19 into 32 seems wrong.
Hmm... indeed.
But 19 (in this case) is wrong settings.
So, can you accept like this ?
switch (slot_width) {
...
default:
/* use default */
=> if (slot_width)
=> dev_warn(dev, "unsupported slot width(%d). use default\n", slot_width);
slot_width = 32;
}Thank you for your help !!
Best regards
---
Kuninori Morimoto
PATCH 20/57 ASoC: rsnd: enable TDM settings for SSI parent
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 6817d7593f3e3c8a9c11e7a07cb5646c70371f0a upstream.
Some SSIs are sharing each pins (= WS/CLK pin for playback/capture). Then, SSI parent needs control WS/CLK setting for SSI slave. In such case, SSI parent needs TDM settings if SSI slave is working as TDM mode. But it is not cared in current driver.
It can't capture TDM sound without this patch if SSIs were pin sharing. This patch is tested on R-Car H3 ulcb-kf board, SSI3/4 with TDM sound.
--- sound/soc/sh/rcar/ssi.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
sound/soc/sh/rcar/ssi.c +11 -10
@@ -400,6 +400,17 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, cr_own |=DEL ;/* +* TDM Mode +* see +* rsnd_ssiu_init_gen2() +*/ + wsr = ssi->wsr; +if (is_tdm) { + wsr |=WS_MODE ; + cr_own |=CHNL_8 ; + } + +/* * We shouldn't exchange SWSP after running. * This means, parent needs to care it. */
@@ -429,16 +440,6 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, cr_mode =DIEN ;/* PIO : enable Data interrupt */ } -/* -* TDM Extend Mode -* see -* rsnd_ssiu_init_gen2() -*/ - wsr = ssi->wsr; -if (is_tdm) { - wsr |=WS_MODE ; - cr_own |=CHNL_8 ; - } init_end: ssi->cr_own = cr_own; ssi->cr_mode = cr_mode;
Signature · 1 line
2.7.4
PATCH 21/57 ASoC: rsnd: tidyup SSICR::SWSP for TDM
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 2eaa6e233091f51d8a629e423ad0bc080ffcb5d6 upstream.
R-Car datasheet is indicating that WS output settings of SSICR::SWSP is inverted on TDM mode from non TDM mode settings.
But, it is meaning that TDM should use 0 here.
Without this patch, sound input/output 1ch will be 2ch, 2ch will be 3ch ..., be jumbled on I2S + TDM settings. This patch fixup it. This patch is tested on R-Car H3 ulcb-kf board, SSI3/4 TDM sound.
--- sound/soc/sh/rcar/ssi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sh/rcar/ssi.c +1 -1
@@ -392,7 +392,7 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod,if (rdai->bit_clk_inv) cr_own |=SCKP ; -if (rdai->frm_clk_inv ^ is_tdm) +if (rdai->frm_clk_inv && !is_tdm) cr_own |=SWSP ;if (rdai->data_alignment) cr_own |=SDTA ;
Signature · 1 line
2.7.4
PATCH 22/57 ASoC: rsnd: move .get_status under rsnd_mod_ops
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 7e7fe06de376e9874f4399dac81d65ea9b0a9507 upstream.
Each mod needs to have .get_status, but current driver is handling it under rsnd_mod, instead of rsnd_mod_ops.
It is not any make sence. This patch moves it to rsnd_mod_ops, and tidyup its parameter order to align to other callback functions.
--- sound/soc/sh/rcar/adg.c | 2 +- sound/soc/sh/rcar/cmd.c | 11 +++-- sound/soc/sh/rcar/core.c | 10 ++-- sound/soc/sh/rcar/ctu.c | 3 +- sound/soc/sh/rcar/dma.c | 26 +++++----- sound/soc/sh/rcar/dvc.c | 3 +- sound/soc/sh/rcar/mix.c | 3 +- sound/soc/sh/rcar/rsnd.h | 13 ++--- sound/soc/sh/rcar/src.c | 24 ++++----- sound/soc/sh/rcar/ssi.c | 124 ++++++++++++++++++++++++----------------------- sound/soc/sh/rcar/ssiu.c | 37 +++++++------- 11 files changed, 129 insertions(+), 127 deletions(-)
sound/soc/sh/rcar/adg.c +1 -1
@@ -622,7 +622,7 @@ int rsnd_adg_probe(struct rsnd_priv *priv)return -ENOMEM ; ret =rsnd_mod_init (priv, &adg->mod, &adg_ops, -NULL ,NULL ,0 ,0 ); +NULL ,0 ,0 );if (ret)return ret;
sound/soc/sh/rcar/cmd.c +6 -5
@@ -116,10 +116,11 @@ static int rsnd_cmd_stop(struct rsnd_mod *mod, }static struct rsnd_mod_ops rsnd_cmd_ops = { - .name =CMD_NAME , - .init = rsnd_cmd_init, - .start = rsnd_cmd_start, - .stop = rsnd_cmd_stop, + .name =CMD_NAME , + .init = rsnd_cmd_init, + .start = rsnd_cmd_start, + .stop = rsnd_cmd_stop, + .get_status = rsnd_mod_get_status, };static struct rsnd_mod *rsnd_cmd_mod_get (struct rsnd_priv *priv,int id)
@@ -162,7 +163,7 @@ int rsnd_cmd_probe(struct rsnd_priv *priv)for_each_rsnd_cmd (cmd, priv, i) { ret =rsnd_mod_init (priv,rsnd_mod_get (cmd), &rsnd_cmd_ops,NULL , - rsnd_mod_get_status,RSND_MOD_CMD , i); +RSND_MOD_CMD , i);if (ret)return ret; }
sound/soc/sh/rcar/core.c +3 -7
@@ -137,8 +137,8 @@ struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,return mod->ops->dma_req (io, mod); } -u32 *rsnd_mod_get_status (struct rsnd_dai_stream *io, -struct rsnd_mod *mod, +u32 *rsnd_mod_get_status (struct rsnd_mod *mod, +struct rsnd_dai_stream *io,enum rsnd_mod_type type) {return &mod->status;
@@ -148,9 +148,6 @@ int rsnd_mod_init(struct rsnd_priv *priv,struct rsnd_mod *mod, struct rsnd_mod_ops *ops, struct clk *clk, - u32* (*get_status)(struct rsnd_dai_stream *io, -struct rsnd_mod *mod, -enum rsnd_mod_type type), enum rsnd_mod_type type, int id) {
@@ -164,7 +161,6 @@ int rsnd_mod_init(struct rsnd_priv *priv, mod->type = type; mod->clk = clk; mod->priv = priv; - mod->get_status = get_status;return ret; }
@@ -472,7 +468,7 @@ static int rsnd_status_update(u32 *status,enum rsnd_mod_type *types = rsnd_mod_sequence[is_play]; \ for_each_rsnd_mod_arrays(i, mod, io, types, RSND_MOD_MAX) { \int tmp =0 ; \ -u32 *status = mod->get_status (io, mod, types[i]); \ +u32 *status = mod->ops->get_status (mod, io, types[i]); \ int func_call = rsnd_status_update(status, \ __rsnd_mod_shift_##fn, \ __rsnd_mod_add_##fn, \
sound/soc/sh/rcar/ctu.c +2 -1
@@ -341,6 +341,7 @@ static struct rsnd_mod_ops rsnd_ctu_ops = { .quit = rsnd_ctu_quit, .hw_params = rsnd_ctu_hw_params, .pcm_new = rsnd_ctu_pcm_new, + .get_status = rsnd_mod_get_status, };struct rsnd_mod *rsnd_ctu_mod_get (struct rsnd_priv *priv,int id)
@@ -404,7 +405,7 @@ int rsnd_ctu_probe(struct rsnd_priv *priv) } ret =rsnd_mod_init (priv,rsnd_mod_get (ctu), &rsnd_ctu_ops, - clk, rsnd_mod_get_status,RSND_MOD_CTU , i); + clk,RSND_MOD_CTU , i);if (ret) {of_node_put (np); goto rsnd_ctu_probe_done;
sound/soc/sh/rcar/dma.c +14 -12
@@ -289,12 +289,13 @@ static int rsnd_dmaen_pointer(struct rsnd_mod *mod, }static struct rsnd_mod_ops rsnd_dmaen_ops = { - .name ="audmac" , - .prepare = rsnd_dmaen_prepare, - .cleanup = rsnd_dmaen_cleanup, - .start = rsnd_dmaen_start, - .stop = rsnd_dmaen_stop, - .pointer= rsnd_dmaen_pointer, + .name ="audmac" , + .prepare = rsnd_dmaen_prepare, + .cleanup = rsnd_dmaen_cleanup, + .start = rsnd_dmaen_start, + .stop = rsnd_dmaen_stop, + .pointer = rsnd_dmaen_pointer, + .get_status = rsnd_mod_get_status, };/*
@@ -477,10 +478,11 @@ static int rsnd_dmapp_attach(struct rsnd_dai_stream *io, }static struct rsnd_mod_ops rsnd_dmapp_ops = { - .name ="audmac-pp" , - .start = rsnd_dmapp_start, - .stop = rsnd_dmapp_stop, - .quit = rsnd_dmapp_stop, + .name ="audmac-pp" , + .start = rsnd_dmapp_start, + .stop = rsnd_dmapp_stop, + .quit = rsnd_dmapp_stop, + .get_status = rsnd_mod_get_status, };/*
@@ -756,7 +758,7 @@ static int rsnd_dma_alloc(struct rsnd_dai_stream *io, struct rsnd_mod *mod, *dma_mod =rsnd_mod_get (dma); ret =rsnd_mod_init (priv, *dma_mod, ops,NULL , - rsnd_mod_get_status, type, dma_id); + type, dma_id);if (ret <0 )return ret;
@@ -823,5 +825,5 @@ int rsnd_dma_probe(struct rsnd_priv *priv) priv->dma = dmac;/* dummy mem mod for debug */ -return rsnd_mod_init (NULL , &mem, &mem_ops,NULL ,NULL ,0 ,0 ); +return rsnd_mod_init (NULL , &mem, &mem_ops,NULL ,0 ,0 ); }
sound/soc/sh/rcar/dvc.c +2 -1
@@ -306,6 +306,7 @@ static struct rsnd_mod_ops rsnd_dvc_ops = { .init = rsnd_dvc_init, .quit = rsnd_dvc_quit, .pcm_new = rsnd_dvc_pcm_new, + .get_status = rsnd_mod_get_status, };struct rsnd_mod *rsnd_dvc_mod_get (struct rsnd_priv *priv,int id)
@@ -365,7 +366,7 @@ int rsnd_dvc_probe(struct rsnd_priv *priv) } ret =rsnd_mod_init (priv,rsnd_mod_get (dvc), &rsnd_dvc_ops, - clk, rsnd_mod_get_status,RSND_MOD_DVC , i); + clk,RSND_MOD_DVC , i);if (ret) {of_node_put (np); goto rsnd_dvc_probe_done;
sound/soc/sh/rcar/mix.c +2 -1
@@ -256,6 +256,7 @@ static struct rsnd_mod_ops rsnd_mix_ops = { .init = rsnd_mix_init, .quit = rsnd_mix_quit, .pcm_new = rsnd_mix_pcm_new, + .get_status = rsnd_mod_get_status, };struct rsnd_mod *rsnd_mix_mod_get (struct rsnd_priv *priv,int id)
@@ -315,7 +316,7 @@ int rsnd_mix_probe(struct rsnd_priv *priv) } ret =rsnd_mod_init (priv,rsnd_mod_get (mix), &rsnd_mix_ops, - clk, rsnd_mod_get_status,RSND_MOD_MIX , i); + clk,RSND_MOD_MIX , i);if (ret) {of_node_put (np); goto rsnd_mix_probe_done;
sound/soc/sh/rcar/rsnd.h +5 -8
@@ -301,6 +301,9 @@ struct rsnd_mod_ops {int (*cleanup)(struct rsnd_mod *mod,struct rsnd_dai_stream *io,struct rsnd_priv *priv); +u32 *(*get_status)(struct rsnd_mod *mod, +struct rsnd_dai_stream *io, +enum rsnd_mod_type type); };struct rsnd_dai_stream ;
@@ -310,9 +313,6 @@ struct rsnd_mod {struct rsnd_mod_ops *ops;struct rsnd_priv *priv;struct clk *clk; -u32 *(*get_status)(struct rsnd_dai_stream *io, -struct rsnd_mod *mod, -enum rsnd_mod_type type);u32 status; };/*
@@ -385,9 +385,6 @@ int rsnd_mod_init(struct rsnd_priv *priv,struct rsnd_mod *mod, struct rsnd_mod_ops *ops, struct clk *clk, - u32* (*get_status)(struct rsnd_dai_stream *io, -struct rsnd_mod *mod, -enum rsnd_mod_type type), enum rsnd_mod_type type, int id);void rsnd_mod_quit (struct rsnd_mod *mod);
@@ -396,8 +393,8 @@ struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,void rsnd_mod_interrupt (struct rsnd_mod *mod,void (*callback)(struct rsnd_mod *mod,struct rsnd_dai_stream *io)); -u32 *rsnd_mod_get_status (struct rsnd_dai_stream *io, -struct rsnd_mod *mod, +u32 *rsnd_mod_get_status (struct rsnd_mod *mod, +struct rsnd_dai_stream *io,enum rsnd_mod_type type); struct rsnd_mod *rsnd_mod_next(int *iterator, struct rsnd_dai_stream *io,
sound/soc/sh/rcar/src.c +12 -12
@@ -527,16 +527,17 @@ static int rsnd_src_pcm_new(struct rsnd_mod *mod, }static struct rsnd_mod_ops rsnd_src_ops = { - .name =SRC_NAME , - .dma_req = rsnd_src_dma_req, - .probe = rsnd_src_probe_, - .init = rsnd_src_init, - .quit = rsnd_src_quit, - .start = rsnd_src_start, - .stop = rsnd_src_stop, - .irq = rsnd_src_irq, - .hw_params = rsnd_src_hw_params, - .pcm_new = rsnd_src_pcm_new, + .name =SRC_NAME , + .dma_req = rsnd_src_dma_req, + .probe = rsnd_src_probe_, + .init = rsnd_src_init, + .quit = rsnd_src_quit, + .start = rsnd_src_start, + .stop = rsnd_src_stop, + .irq = rsnd_src_irq, + .hw_params = rsnd_src_hw_params, + .pcm_new = rsnd_src_pcm_new, + .get_status = rsnd_mod_get_status, };struct rsnd_mod *rsnd_src_mod_get (struct rsnd_priv *priv,int id)
@@ -605,8 +606,7 @@ int rsnd_src_probe(struct rsnd_priv *priv) } ret =rsnd_mod_init (priv,rsnd_mod_get (src), - &rsnd_src_ops, clk, rsnd_mod_get_status, -RSND_MOD_SRC , i); + &rsnd_src_ops, clk,RSND_MOD_SRC , i);if (ret) {of_node_put (np); goto rsnd_src_probe_done;
sound/soc/sh/rcar/ssi.c +63 -61
154 lines not on this page · raw message
sound/soc/sh/rcar/ssiu.c +19 -18
@@ -22,6 +22,16 @@ struct rsnd_ssiu { ((pos) = ((struct rsnd_ssiu *)(priv)->ssiu + i)); \ i++) +static u32 *rsnd_ssiu_get_status (struct rsnd_mod *mod, +struct rsnd_dai_stream *io, +enum rsnd_mod_type type) +{ +struct rsnd_ssiu *ssiu =rsnd_mod_to_ssiu (mod); +int busif =rsnd_ssi_get_busif (io); + +return &ssiu->busif_status[busif]; +} +static int rsnd_ssiu_init (struct rsnd_mod *mod,struct rsnd_dai_stream *io,struct rsnd_priv *priv)
@@ -115,8 +125,9 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod, }static struct rsnd_mod_ops rsnd_ssiu_ops_gen1 = { - .name =SSIU_NAME , - .init = rsnd_ssiu_init, + .name =SSIU_NAME , + .init = rsnd_ssiu_init, + .get_status = rsnd_ssiu_get_status, }; static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
@@ -279,10 +290,11 @@ static int rsnd_ssiu_stop_gen2(struct rsnd_mod *mod, }static struct rsnd_mod_ops rsnd_ssiu_ops_gen2 = { - .name =SSIU_NAME , - .init = rsnd_ssiu_init_gen2, - .start = rsnd_ssiu_start_gen2, - .stop = rsnd_ssiu_stop_gen2, + .name =SSIU_NAME , + .init = rsnd_ssiu_init_gen2, + .start = rsnd_ssiu_start_gen2, + .stop = rsnd_ssiu_stop_gen2, + .get_status = rsnd_ssiu_get_status, };static struct rsnd_mod *rsnd_ssiu_mod_get (struct rsnd_priv *priv,int id)
@@ -304,16 +316,6 @@ int rsnd_ssiu_attach(struct rsnd_dai_stream *io,return rsnd_dai_connect (mod, io, mod->type); } -static u32 *rsnd_ssiu_get_status (struct rsnd_dai_stream *io, -struct rsnd_mod *mod, -enum rsnd_mod_type type) -{ -struct rsnd_ssiu *ssiu =rsnd_mod_to_ssiu (mod); -int busif =rsnd_ssi_get_busif (io); - -return &ssiu->busif_status[busif]; -} -int rsnd_ssiu_probe (struct rsnd_priv *priv) {struct device *dev =rsnd_priv_to_dev (priv);
@@ -337,8 +339,7 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv)for_each_rsnd_ssiu (ssiu, priv, i) { ret =rsnd_mod_init (priv,rsnd_mod_get (ssiu), - ops,NULL , rsnd_ssiu_get_status, -RSND_MOD_SSIU , i); + ops,NULL ,RSND_MOD_SSIU , i);if (ret)return ret; }
Signature · 1 line
2.7.4
PATCH 23/57 ASoC: rsnd: add .get_id/.get_id_sub
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit c16015f36cc128244c910152663de45c3b99f551 upstream.
ID for CTU and SSIU are confusable.
1 CTU has 4 sub nodes. This means, CTU0 has CTU01 - CTU03, CTU1 has CTU10 - CTU13. SSIU is more confusable. Gen2 SSIU has BUSIF0-3, Gen3 SSIU has BUSIF0-7, but not for all SSIU.
In rsnd driver, each mod drivers are assuming rsnd_mod_id() returns main device ID (In CTU case CTU0-1, SSIU case SSIU0-9), not serial number.
This patch adds new .id/.id_sub to handling more detail ID.
--- sound/soc/sh/rcar/core.c | 21 +++++++++++++++++++++ sound/soc/sh/rcar/ctu.c | 20 ++++++++++++++++++++ sound/soc/sh/rcar/rsnd.h | 6 +++++- 3 files changed, 46 insertions(+), 1 deletion(-)
sound/soc/sh/rcar/core.c +21 -0
@@ -144,6 +144,27 @@ u32 *rsnd_mod_get_status(struct rsnd_mod *mod,return &mod->status; } +int rsnd_mod_id_raw (struct rsnd_mod *mod) +{ +return mod->id; +} + +int rsnd_mod_id (struct rsnd_mod *mod) +{ +if ((mod)->ops->id) +return (mod)->ops->id (mod); + +return rsnd_mod_id_raw (mod); +} + +int rsnd_mod_id_sub (struct rsnd_mod *mod) +{ +if ((mod)->ops->id_sub) +return (mod)->ops->id_sub (mod); + +return 0 ; +} + int rsnd_mod_init(struct rsnd_priv *priv, struct rsnd_mod *mod, struct rsnd_mod_ops *ops,
sound/soc/sh/rcar/ctu.c +20 -0
@@ -334,6 +334,24 @@ static int rsnd_ctu_pcm_new(struct rsnd_mod *mod,return ret; } +static int rsnd_ctu_id (struct rsnd_mod *mod) +{ +/* +* ctu00: -> 0, ctu01: -> 0, ctu02: -> 0, ctu03: -> 0 +* ctu10: -> 1, ctu11: -> 1, ctu12: -> 1, ctu13: -> 1 +*/ +return mod->id /4 ; +} + +static int rsnd_ctu_id_sub (struct rsnd_mod *mod) +{ +/* +* ctu00: -> 0, ctu01: -> 1, ctu02: -> 2, ctu03: -> 3 +* ctu10: -> 0, ctu11: -> 1, ctu12: -> 2, ctu13: -> 3 +*/ +return mod->id %4 ; +} +static struct rsnd_mod_ops rsnd_ctu_ops = { .name =CTU_NAME , .probe = rsnd_ctu_probe_,
@@ -342,6 +360,8 @@ static struct rsnd_mod_ops rsnd_ctu_ops = { .hw_params = rsnd_ctu_hw_params, .pcm_new = rsnd_ctu_pcm_new, .get_status = rsnd_mod_get_status, + .id = rsnd_ctu_id, + .id_sub = rsnd_ctu_id_sub, };struct rsnd_mod *rsnd_ctu_mod_get (struct rsnd_priv *priv,int id)
sound/soc/sh/rcar/rsnd.h +5 -1
@@ -304,6 +304,8 @@ struct rsnd_mod_ops {u32 *(*get_status)(struct rsnd_mod *mod,struct rsnd_dai_stream *io,enum rsnd_mod_type type); +int (*id)(struct rsnd_mod *mod); +int (*id_sub)(struct rsnd_mod *mod); };struct rsnd_dai_stream ;
@@ -376,7 +378,6 @@ struct rsnd_mod {#define rsnd_mod_to_priv (mod) ((mod)->priv)#define rsnd_mod_name (mod) ((mod)->ops->name) -#define rsnd_mod_id (mod) ((mod)->id)#define rsnd_mod_power_on (mod) clk_enable((mod)->clk)#define rsnd_mod_power_off (mod) clk_disable((mod)->clk)#define rsnd_mod_get (ip) (&(ip)->mod)
@@ -396,6 +397,9 @@ void rsnd_mod_interrupt(struct rsnd_mod *mod,u32 *rsnd_mod_get_status (struct rsnd_mod *mod,struct rsnd_dai_stream *io,enum rsnd_mod_type type); +int rsnd_mod_id (struct rsnd_mod *mod); +int rsnd_mod_id_raw (struct rsnd_mod *mod); +int rsnd_mod_id_sub (struct rsnd_mod *mod); struct rsnd_mod *rsnd_mod_next(int *iterator, struct rsnd_dai_stream *io, enum rsnd_mod_type *array,
Signature · 1 line
2.7.4
PATCH 24/57 ASoC: rsnd: rsnd_mod_name() handles both name and ID
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit c0ea089dbad47a41ae30ad290766d7a6571c9802 upstream.
Current rsnd driver is using "%s[%d]" for mod name and ID, but, this ID portion might confusable.
For example currently, CTU ID is 0 to 7, but using 00 to 13 (= 00, 01, 02, 03, 10, 11, 12, 13) is very best matching to datasheet.
In the future, we will support BUSIFn, but it will be more complicated numbering. To avoid future confusable code, this patch modify rsnd_mod_name() to return understandable name.
To avoid using pointless memory, it uses static char and snprintf, thus, rsnd_mod_name() user should use it immediately, and shouldn't keep its pointer.
--- sound/soc/sh/rcar/core.c | 41 ++++++++++++++++++++++++++++++++--------- sound/soc/sh/rcar/dma.c | 21 ++++++++------------- sound/soc/sh/rcar/gen.c | 12 ++++++------ sound/soc/sh/rcar/rsnd.h | 2 +- sound/soc/sh/rcar/src.c | 5 ++--- sound/soc/sh/rcar/ssi.c | 23 ++++++++--------------- 6 files changed, 57 insertions(+), 47 deletions(-)
sound/soc/sh/rcar/core.c +32 -9
@@ -123,8 +123,8 @@ void rsnd_mod_make_sure(struct rsnd_mod *mod, enum rsnd_mod_type type)struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv); -dev_warn (dev,"%s[%d] is not your expected module\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod)); +dev_warn (dev,"%s is not your expected module\n" , +rsnd_mod_name (mod)); } }
@@ -137,6 +137,30 @@ struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,return mod->ops->dma_req (io, mod); } +#define MOD_NAME_SIZE 16 +char *rsnd_mod_name (struct rsnd_mod *mod) +{ +static char name[MOD_NAME_SIZE ]; + +/* +* Let's use same char to avoid pointlessness memory +* Thus, rsnd_mod_name() should be used immediately +* Don't keep pointer +*/ +if ((mod)->ops->id_sub) { +snprintf (name,MOD_NAME_SIZE ,"%s[%d%d]" , + mod->ops->name, +rsnd_mod_id (mod), +rsnd_mod_id_sub (mod)); + }else { +snprintf (name,MOD_NAME_SIZE ,"%s[%d]" , + mod->ops->name, +rsnd_mod_id (mod)); + } + +return name; +} +u32 *rsnd_mod_get_status (struct rsnd_mod *mod,struct rsnd_dai_stream *io,enum rsnd_mod_type type)
@@ -494,15 +518,14 @@ static int rsnd_status_update(u32 *status, __rsnd_mod_shift_##fn, \ __rsnd_mod_add_##fn, \ __rsnd_mod_call_##fn); \ - rsnd_dbg_dai_call(dev, "%s[%d]\t0x%08x %s\n", \ - rsnd_mod_name(mod), rsnd_mod_id(mod), *status, \ + rsnd_dbg_dai_call(dev, "%s\t0x%08x %s\n", \ + rsnd_mod_name(mod), *status, \ (func_call && (mod)->ops->fn) ? #fn : ""); \ if (func_call && (mod)->ops->fn) \ tmp = (mod)->ops->fn(mod, io, param); \ if (tmp && (tmp != -EPROBE_DEFER)) \ - dev_err(dev, "%s[%d] : %s error %d\n", \ - rsnd_mod_name(mod), rsnd_mod_id(mod), \ - #fn, tmp); \ + dev_err(dev, "%s : %s error %d\n", \ + rsnd_mod_name(mod), #fn, tmp); \ ret |= tmp; \ } \ ret; \
@@ -529,8 +552,8 @@ int rsnd_dai_connect(struct rsnd_mod *mod, io->mod[type] = mod; -dev_dbg (dev,"%s[%d] is connected to io (%s)\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod), +dev_dbg (dev,"%s is connected to io (%s)\n" , +rsnd_mod_name (mod),rsnd_io_is_play (io) ?"Playback" :"Capture" );return 0 ;
sound/soc/sh/rcar/dma.c +8 -13
@@ -174,8 +174,8 @@ static int rsnd_dmaen_start(struct rsnd_mod *mod, cfg.src_addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; cfg.dst_addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ; -dev_dbg (dev,"%s[%d] %pad -> %pad\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod), +dev_dbg (dev,"%s %pad -> %pad\n" , +rsnd_mod_name (mod), &cfg.src_addr, &cfg.dst_addr); ret =dmaengine_slave_config (dmaen->chan, &cfg);
@@ -369,8 +369,7 @@ static u32 rsnd_dmapp_get_id(struct rsnd_dai_stream *io,if ((!entry) || (size <= id)) {struct device *dev =rsnd_priv_to_dev (rsnd_io_to_priv (io)); -dev_err (dev,"unknown connection (%s[%d])\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod)); +dev_err (dev,"unknown connection (%s)\n" ,rsnd_mod_name (mod));/* use non-prohibited SRS number as error */ return 0x00 ;/* SSI00 */
@@ -692,12 +691,10 @@ static void rsnd_dma_of_path(struct rsnd_mod *this, *mod_to = mod[1 ]; } -dev_dbg (dev,"module connection (this is %s[%d])\n" , -rsnd_mod_name (this),rsnd_mod_id (this)); +dev_dbg (dev,"module connection (this is %s)\n" ,rsnd_mod_name (this));for (i =0 ; i <= idx; i++) { -dev_dbg (dev," %s[%d]%s\n" , +dev_dbg (dev," %s%s\n" ,rsnd_mod_name (mod[i] ? mod[i] : &mem), -rsnd_mod_id (mod[i] ? mod[i] : &mem), (mod[i] == *mod_from) ?" from" : (mod[i] == *mod_to) ?" to" :"" ); }
@@ -762,12 +759,10 @@ static int rsnd_dma_alloc(struct rsnd_dai_stream *io, struct rsnd_mod *mod,if (ret <0 )return ret; -dev_dbg (dev,"%s[%d] %s[%d] -> %s[%d]\n" , -rsnd_mod_name (*dma_mod),rsnd_mod_id (*dma_mod), +dev_dbg (dev,"%s %s -> %s\n" , +rsnd_mod_name (*dma_mod),rsnd_mod_name (mod_from ? mod_from : &mem), -rsnd_mod_id (mod_from ? mod_from : &mem), -rsnd_mod_name (mod_to ? mod_to : &mem), -rsnd_mod_id (mod_to ? mod_to : &mem)); +rsnd_mod_name (mod_to ? mod_to : &mem)); ret =attach (io, dma, mod_from, mod_to);if (ret <0 )
sound/soc/sh/rcar/gen.c +6 -6
@@ -83,8 +83,8 @@ u32 rsnd_read(struct rsnd_priv *priv,regmap_fields_read (gen->regs[reg],rsnd_mod_id (mod), &val); -dev_dbg (dev,"r %s[%d] - %-18s (%4d) : %08x\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod), +dev_dbg (dev,"r %s - %-18s (%4d) : %08x\n" , +rsnd_mod_name (mod),rsnd_reg_name (gen, reg), reg, val);return val;
@@ -102,8 +102,8 @@ void rsnd_write(struct rsnd_priv *priv,regmap_fields_force_write (gen->regs[reg],rsnd_mod_id (mod), data); -dev_dbg (dev,"w %s[%d] - %-18s (%4d) : %08x\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod), +dev_dbg (dev,"w %s - %-18s (%4d) : %08x\n" , +rsnd_mod_name (mod),rsnd_reg_name (gen, reg), reg, data); }
@@ -119,8 +119,8 @@ void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod,regmap_fields_force_update_bits (gen->regs[reg],rsnd_mod_id (mod), mask, data); -dev_dbg (dev,"b %s[%d] - %-18s (%4d) : %08x/%08x\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod), +dev_dbg (dev,"b %s - %-18s (%4d) : %08x/%08x\n" , +rsnd_mod_name (mod),rsnd_reg_name (gen, reg), reg, data, mask); }
sound/soc/sh/rcar/rsnd.h +1 -1
@@ -377,7 +377,6 @@ struct rsnd_mod {#define __rsnd_mod_call_pointer 0#define rsnd_mod_to_priv (mod) ((mod)->priv) -#define rsnd_mod_name (mod) ((mod)->ops->name)#define rsnd_mod_power_on (mod) clk_enable((mod)->clk)#define rsnd_mod_power_off (mod) clk_disable((mod)->clk)#define rsnd_mod_get (ip) (&(ip)->mod)
@@ -400,6 +399,7 @@ u32 *rsnd_mod_get_status(struct rsnd_mod *mod,int rsnd_mod_id (struct rsnd_mod *mod);int rsnd_mod_id_raw (struct rsnd_mod *mod);int rsnd_mod_id_sub (struct rsnd_mod *mod); +char *rsnd_mod_name (struct rsnd_mod *mod); struct rsnd_mod *rsnd_mod_next(int *iterator, struct rsnd_dai_stream *io, enum rsnd_mod_type *array,
sound/soc/sh/rcar/src.c +2 -3
@@ -349,9 +349,8 @@ static bool rsnd_src_error_occurred(struct rsnd_mod *mod) status0 =rsnd_mod_read (mod,SCU_SYS_STATUS0 ); status1 =rsnd_mod_read (mod,SCU_SYS_STATUS1 );if ((status0 & val0) || (status1 & val1)) { -rsnd_dbg_irq_status (dev,"%s[%d] err status : 0x%08x, 0x%08x\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod), - status0, status1); +rsnd_dbg_irq_status (dev,"%s err status : 0x%08x, 0x%08x\n" , +rsnd_mod_name (mod), status0, status1); ret = true; }
sound/soc/sh/rcar/ssi.c +8 -15
@@ -181,8 +181,7 @@ static void rsnd_ssi_status_check(struct rsnd_mod *mod,udelay (5 ); } -dev_warn (dev,"%s[%d] status check failed\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod)); +dev_warn (dev,"%s status check failed\n" ,rsnd_mod_name (mod)); }static u32 rsnd_ssi_multi_slaves (struct rsnd_dai_stream *io)
@@ -346,9 +345,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod, ssi->rate = rate; ssi->chan = chan; -dev_dbg (dev,"%s[%d] outputs %u Hz\n" , -rsnd_mod_name (mod), -rsnd_mod_id (mod), rate); +dev_dbg (dev,"%s outputs %u Hz\n" ,rsnd_mod_name (mod), rate);return 0 ; }
@@ -494,8 +491,7 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod,return 0 ;if (!ssi->usrcnt) { -dev_err (dev,"%s[%d] usrcnt error\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod)); +dev_err (dev,"%s usrcnt error\n" ,rsnd_mod_name (mod));return -EIO ; }
@@ -654,8 +650,8 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod,/* DMA only */ if (is_dma && (status & (UIRQ |OIRQ ))) { -rsnd_dbg_irq_status (dev,"%s[%d] err status : 0x%08x\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod), status); +rsnd_dbg_irq_status (dev,"%s err status : 0x%08x\n" , +rsnd_mod_name (mod), status); stop = true; }
@@ -964,8 +960,7 @@ static int rsnd_ssi_fallback(struct rsnd_mod *mod,*/ mod->ops = &rsnd_ssi_pio_ops; -dev_info (dev,"%s[%d] fallback to PIO mode\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod)); +dev_info (dev,"%s fallback to PIO mode\n" ,rsnd_mod_name (mod));return 0 ; }
@@ -1085,15 +1080,13 @@ static void __rsnd_ssi_parse_hdmi_connection(struct rsnd_priv *priv,/* HDMI0 */ if (strstr (remote_node->full_name,"hdmi at fead0000" )) {rsnd_flags_set (ssi,RSND_SSI_HDMI0 ); -dev_dbg (dev,"%s[%d] connected to HDMI0\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod)); +dev_dbg (dev,"%s connected to HDMI0\n" ,rsnd_mod_name (mod)); }/* HDMI1 */ if (strstr (remote_node->full_name,"hdmi at feae0000" )) {rsnd_flags_set (ssi,RSND_SSI_HDMI1 ); -dev_dbg (dev,"%s[%d] connected to HDMI1\n" , -rsnd_mod_name (mod),rsnd_mod_id (mod)); +dev_dbg (dev,"%s connected to HDMI1\n" ,rsnd_mod_name (mod)); } }
Signature · 1 line
2.7.4
PATCH 24/57 ASoC: rsnd: rsnd_mod_name() handles both name and ID
Hi!
Quoted 7 lines
In the future, we will support BUSIFn, but it will be more complicated numbering. To avoid future confusable code, this patch modify
rsnd_mod_name()to return understandable name.To avoid using pointless memory, it uses static char and snprintf, thus,
rsnd_mod_name()user should use it immediately, and shouldn't keep its pointer.
No, don't do that. That's a dangerous interface.
Quoted 13 lines
sound/soc/sh/rcar/core.c +13
-0+#define MOD_NAME_SIZE 16 +char *rsnd_mod_name (struct rsnd_mod *mod) +{ +static char name[MOD_NAME_SIZE ]; + +/* +* Let's use same char to avoid pointlessness memory +* Thus, rsnd_mod_name() should be used immediately +* Don't keep pointer +*/ +if ((mod)->ops->id_sub) { + snprintf(name, MOD_NAME_SIZE, "%s[%d%d]", + mod->ops->name,
sound/soc/sh/rcar/core.c struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io, · line 162
Quoted 10 lines
sound/soc/sh/rcar/core.c +10
-0+rsnd_mod_id (mod), + rsnd_mod_id_sub(mod)); + }else { +snprintf (name,MOD_NAME_SIZE ,"%s[%d]" , + mod->ops->name, +rsnd_mod_id (mod)); + } + +return name; +}
This is too hard to use correctly.
Quoted 6 lines
sound/soc/sh/rcar/dma.c +0
-2@@ -762,12 +759,10 @@ static int rsnd_dma_alloc(struct rsnd_dai_stream *io, struct rsnd_mod *mod,if (ret <0 )return ret; - dev_dbg(dev, "%s[%d] %s[%d] -> %s[%d]\n", - rsnd_mod_name(*dma_mod), rsnd_mod_id(*dma_mod),
sound/soc/sh/rcar/dma.c static int rsnd_dma_alloc(struct rsnd_dai_stream *io, struct rsnd_mod *mod, · line 768
Quoted 10 lines
sound/soc/sh/rcar/dma.c +3
-3+dev_dbg (dev,"%s %s -> %s\n" , +rsnd_mod_name (*dma_mod),rsnd_mod_name (mod_from ? mod_from : &mem), -rsnd_mod_id (mod_from ? mod_from : &mem), -rsnd_mod_name (mod_to ? mod_to : &mem), - rsnd_mod_id (mod_to ? mod_to : &mem)); +rsnd_mod_name (mod_to ? mod_to : &mem)); ret =attach (io, dma, mod_from, mod_to);if (ret <0 )
For example this usage is not correct.
And yes, I took a look@mainline, and no, having 5 static buffers is not really an acceptable solution.
Best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191020/f03b5d89/attachment.sig>
PATCH 24/57 ASoC: rsnd: rsnd_mod_name() handles both name and ID
Hi Pavel,
Thanks for the feedback.
Quoted 9 lines
Subject: Re: [PATCH 4.19.y-cip 24/57] ASoC: rsnd:
rsnd_mod_name()handles both name and IDHi!
Quoted 4 lines
In the future, we will support BUSIFn, but it will be more complicated numbering. To avoid future confusable code, this patch modify
rsnd_mod_name()to return understandable name.
Quoted 5 lines
Quoted 3 lines
To avoid using pointless memory, it uses static char and snprintf, thus,
rsnd_mod_name()user should use it immediately, and shouldn't keep its pointer.No, don't do that. That's a dangerous interface.
Can you please elaborate more on the dangerous interface ?
Quoted 16 lines
Quoted 16 lines
sound/soc/sh/rcar/core.c +16
-0+#define MOD_NAME_SIZE 16 +char *rsnd_mod_name (struct rsnd_mod *mod) { +static char name[MOD_NAME_SIZE ]; + +/* +* Let's use same char to avoid pointlessness memory +* Thus, rsnd_mod_name() should be used immediately +* Don't keep pointer +*/ +if ((mod)->ops->id_sub) { +snprintf (name,MOD_NAME_SIZE ,"%s[%d%d]" , + mod->ops->name, +rsnd_mod_id (mod), +rsnd_mod_id_sub (mod)); + }else { + snprintf(name, MOD_NAME_SIZE, "%s[%d]",
Quoted 8 lines
sound/soc/sh/rcar/core.c struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io, · line 162
Quoted 6 lines
sound/soc/sh/rcar/core.c +6
-0+ mod->ops->name, + rsnd_mod_id(mod)); + } + +return name; +}This is too hard to use correctly.
Can you please suggest the correct way of doing this?
Quoted 15 lines
Review static int rsnd_dma_alloc(struct rsnd_dai_stream
Quoted 1 line
(quoted diff) +0
-0@@ -762,12 +759,10 @@ static int rsnd_dma_alloc(struct rsnd_dai_stream*io, struct
rsnd_mod*mod,Quoted 13 lines
sound/soc/sh/rcar/dma.c +3
-5if (ret <0 )return ret; -dev_dbg (dev,"%s[%d] %s[%d] -> %s[%d]\n" , -rsnd_mod_name (*dma_mod),rsnd_mod_id (*dma_mod), +dev_dbg (dev,"%s %s -> %s\n" , +rsnd_mod_name (*dma_mod),rsnd_mod_name (mod_from ? mod_from : &mem), -rsnd_mod_id (mod_from ? mod_from : &mem), -rsnd_mod_name (mod_to ? mod_to : &mem), -rsnd_mod_id (mod_to ? mod_to : &mem)); +rsnd_mod_name (mod_to ? mod_to : &mem));
Quoted 8 lines
sound/soc/sh/rcar/dma.c static int rsnd_dma_alloc(struct rsnd_dai_stream *io, struct rsnd_mod *mod, · line 768
Quoted 2 lines
sound/soc/sh/rcar/dma.c +0
-0ret =attach (io, dma, mod_from, mod_to);if (ret <0 )For example this usage is not correct.
And yes, I took a look at mainline, and no, having 5 static buffers is not really an acceptable solution.
Cheers,
Biju
PATCH 24/57 ASoC: rsnd: rsnd_mod_name() handles both name and ID
Hi!
Quoted 37 lines
Quoted 9 lines
Quoted 7 lines
In the future, we will support BUSIFn, but it will be more complicated numbering. To avoid future confusable code, this patch modify
rsnd_mod_name()to return understandable name.To avoid using pointless memory, it uses static char and snprintf, thus,
rsnd_mod_name()user should use it immediately, and shouldn't keep its pointer.No, don't do that. That's a dangerous interface.
Can you please elaborate more on the dangerous interface ?
Quoted 16 lines
Quoted 16 lines
sound/soc/sh/rcar/core.c +16
-0+#define MOD_NAME_SIZE 16 +char *rsnd_mod_name (struct rsnd_mod *mod) { +static char name[MOD_NAME_SIZE ]; + +/* +* Let's use same char to avoid pointlessness memory +* Thus, rsnd_mod_name() should be used immediately +* Don't keep pointer +*/ +if ((mod)->ops->id_sub) { +snprintf (name,MOD_NAME_SIZE ,"%s[%d%d]" , + mod->ops->name, +rsnd_mod_id (mod), +rsnd_mod_id_sub (mod)); + }else { + snprintf(name, MOD_NAME_SIZE, "%s[%d]",Quoted 8 lines
sound/soc/sh/rcar/core.c struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io, · line 162
Quoted 6 lines
sound/soc/sh/rcar/core.c +6
-0+ mod->ops->name, + rsnd_mod_id(mod)); + } + +return name; +}This is too hard to use correctly.
Quoted 1 line
Can you please suggest the correct way of doing this?
void rsnd_mod_name(char *buf, struct rsnd_mod *mod) {} would be usual way of doing it. Semantics would be similar to sprintf().
Best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 195 bytes Desc: not available URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191118/99a4affa/attachment.sig>
PATCH 24/57 ASoC: rsnd: rsnd_mod_name() handles both name and ID
+ Morimoto-San
Quoted 43 lines
Subject: Re: [PATCH 4.19.y-cip 24/57] ASoC: rsnd:
rsnd_mod_name()handles both name and IDHi!
Quoted 38 lines
Quoted 10 lines
Quoted 8 lines
In the future, we will support BUSIFn, but it will be more complicated numbering. To avoid future confusable code, this patch modify
rsnd_mod_name()to return understandable name.To avoid using pointless memory, it uses static char and snprintf, thus,
rsnd_mod_name()user should use it immediately, and shouldn't keep its pointer.No, don't do that. That's a dangerous interface.
Can you please elaborate more on the dangerous interface ?
Quoted 24 lines
Quoted 12 lines
sound/soc/sh/rcar/core.c +12
-0+#define MOD_NAME_SIZE 16 +char *rsnd_mod_name (struct rsnd_mod *mod) { +static char name[MOD_NAME_SIZE ]; + +/* +* Let's use same char to avoid pointlessness memory +* Thus, rsnd_mod_name() should be used immediately +* Don't keep pointer +*/ +if ((mod)->ops->id_sub) { + snprintf(name, MOD_NAME_SIZE, "%s[%d%d]", + mod->ops->name,sound/soc/sh/rcar/core.c struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io, · line 162
Quoted 10 lines
sound/soc/sh/rcar/core.c +10
-0+rsnd_mod_id (mod), + rsnd_mod_id_sub(mod)); + }else { +snprintf (name,MOD_NAME_SIZE ,"%s[%d]" , + mod->ops->name, +rsnd_mod_id (mod)); + } + +return name; +}This is too hard to use correctly.
Quoted 4 lines
Quoted 1 line
Can you please suggest the correct way of doing this?
void
rsnd_mod_name(char *buf, struct rsnd_mod *mod){} would be usual way of doing it. Semantics would be similar tosprintf().
Morimoto-San,
Please share your opinion on this.
Regards,
Biju
PATCH 24/57 ASoC: rsnd: rsnd_mod_name() handles both name and ID
Hi Biju
Quoted 38 lines
Quoted 38 lines
Quoted 38 lines
Quoted 10 lines
Quoted 8 lines
In the future, we will support BUSIFn, but it will be more complicated numbering. To avoid future confusable code, this patch modify
rsnd_mod_name()to return understandable name.To avoid using pointless memory, it uses static char and snprintf, thus,
rsnd_mod_name()user should use it immediately, and shouldn't keep its pointer.No, don't do that. That's a dangerous interface.
Can you please elaborate more on the dangerous interface ?
Quoted 24 lines
Quoted 12 lines
sound/soc/sh/rcar/core.c +12
-0+#define MOD_NAME_SIZE 16 +char *rsnd_mod_name (struct rsnd_mod *mod) { +static char name[MOD_NAME_SIZE ]; + +/* +* Let's use same char to avoid pointlessness memory +* Thus, rsnd_mod_name() should be used immediately +* Don't keep pointer +*/ +if ((mod)->ops->id_sub) { + snprintf(name, MOD_NAME_SIZE, "%s[%d%d]", + mod->ops->name,sound/soc/sh/rcar/core.c struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io, · line 162
Quoted 10 lines
sound/soc/sh/rcar/core.c +10
-0+rsnd_mod_id (mod), + rsnd_mod_id_sub(mod)); + }else { +snprintf (name,MOD_NAME_SIZE ,"%s[%d]" , + mod->ops->name, +rsnd_mod_id (mod)); + } + +return name; +}This is too hard to use correctly.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Can you please suggest the correct way of doing this?
void
rsnd_mod_name(char *buf, struct rsnd_mod *mod){} would be usual way of doing it. Semantics would be similar tosprintf().Morimoto-San,
Please share your opinion on this.
rsnd_mod_name() is used for debug or error case,
and not used in Hi frequency.
At least, it doesn't used over 5 (= MOD_NAME_NUM) times in the same time. So, it is no problem *at this point*.
But, indeed it is including potential issue...
Thank you for your help !!
Best regards
---
Kuninori Morimoto
PATCH 25/57 ASoC: rsnd: remove endpoint bidirectional check
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit c8b222bf110ccb54d787f695fb3eb2fb6b723903 upstream.
DTC commit df536831d02c ("checks: add graph binding checks") is checking endpoint bidirectional, and it is upstreamed to linux by commit 50aafd60898a ("scripts/dtc: Update to upstream version v1.4.6-21-g84e414b0b5bc").
Let's remove own bidirectional check
--- sound/soc/sh/rcar/ssi.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
sound/soc/sh/rcar/ssi.c +1 -5
@@ -1095,11 +1095,7 @@ void rsnd_ssi_parse_hdmi_connection(struct rsnd_priv *priv, int dai_i) {struct rsnd_dai *rdai =rsnd_rdai_get (priv, dai_i); -struct device_node *remote_ep; - - remote_ep =of_graph_get_remote_endpoint (endpoint); -if (!remote_ep) -return ; +struct device_node *remote_ep =of_graph_get_remote_endpoint (endpoint);__rsnd_ssi_parse_hdmi_connection (priv, &rdai->playback, remote_ep);__rsnd_ssi_parse_hdmi_connection (priv, &rdai->capture, remote_ep);
Signature · 1 line
2.7.4
PATCH 25/57 ASoC: rsnd: remove endpoint bidirectional check
Hi!
Quoted 5 lines
DTC commit
df536831d02c("checks: add graph binding checks") is checking endpoint bidirectional, and it is upstreamed to linux by commit50aafd60898a("scripts/dtc: Update to upstream version v1.4.6-21-g84e414b0b5bc").
Let's remove own bidirectional check
I don't really understand what bidirectional check? Are you saying that of_graph_get_remote_endpoint() never fails in 4.19.X ?
sound/soc/sh/rcar/ssi.c void rsnd_ssi_parse_hdmi_connection(struct rsnd_priv *priv, · line 1098
Quoted 11 lines
+++
b/sound/soc/sh/rcar/ssi.csound/soc/sh/rcar/ssi.c +1
-5@@ -1095,11 +1095,7 @@ void rsnd_ssi_parse_hdmi_connection(struct rsnd_priv *priv, int dai_i) {struct rsnd_dai *rdai =rsnd_rdai_get (priv, dai_i); -struct device_node *remote_ep; - - remote_ep =of_graph_get_remote_endpoint (endpoint); -if (!remote_ep) -return ; +struct device_node *remote_ep =of_graph_get_remote_endpoint (endpoint);
Plus the code seems to be missing of_node_put().
Best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191020/8c98cce4/attachment.sig>
PATCH 25/57 ASoC: rsnd: remove endpoint bidirectional check
+ Morimoto San,
Hi Pavel, Thanks for the feedback.
Quoted 17 lines
Subject: Re: [PATCH 4.19.y-cip 25/57] ASoC: rsnd: remove endpoint bidirectional check
Hi!
Quoted 5 lines
DTC commit
df536831d02c("checks: add graph binding checks") is checking endpoint bidirectional, and it is upstreamed to linux by commit50aafd60898a("scripts/dtc: Update to upstream version v1.4.6-21-g84e414b0b5bc").
Let's remove own bidirectional checkI don't really understand what bidirectional check? Are you saying that
of_graph_get_remote_endpoint()never fails in 4.19.X ?Review void rsnd_ssi_parse_hdmi_connection(struct
Quoted 2 lines
+++
b/sound/soc/sh/rcar/ssi.c(quoted diff) +0
-0@@ -1095,11 +1095,7 @@ void rsnd_ssi_parse_hdmi_connection(struct
rsnd_priv*priv,
Quoted 12 lines
sound/soc/sh/rcar/ssi.c void rsnd_ssi_parse_hdmi_connection(struct rsnd_priv *priv,
Quoted 10 lines
sound/soc/sh/rcar/ssi.c +2
-5int dai_i) {struct rsnd_dai *rdai =rsnd_rdai_get (priv, dai_i); -struct device_node *remote_ep; - - remote_ep =of_graph_get_remote_endpoint (endpoint); -if (!remote_ep) -return ; +struct device_node *remote_ep = +of_graph_get_remote_endpoint (endpoint);Plus the code seems to be missing
of_node_put().
This patch is overridden by " 0028-ASoC-rsnd-move-HDMI-information-from-ssi.c-to-core.c.patch", yes I agree we are still missing of_node_put??
Morimoto-San, any comments??
Regards,
Biju
PATCH 25/57 ASoC: rsnd: remove endpoint bidirectional check
Hi
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
DTC commit
df536831d02c("checks: add graph binding checks") is checking endpoint bidirectional, and it is upstreamed to linux by commit50aafd60898a("scripts/dtc: Update to upstream version v1.4.6-21-g84e414b0b5bc").
Let's remove own bidirectional checkI don't really understand what bidirectional check? Are you saying that
of_graph_get_remote_endpoint()never fails in 4.19.X ?
On OF-graph DT, remote-endpoint need to be pair.
ex)
endpoint1: endpoint {
remote-endpoint = <&endpoint2>;
};
endpoint2: endpoint {
remote-endpoint = <&endpoint1>;
};This "bidirectional check" is for it.
Now, it is checked by DTC.
Quoted 15 lines
Quoted 15 lines
Review void rsnd_ssi_parse_hdmi_connection(struct
Quoted 2 lines
+++
b/sound/soc/sh/rcar/ssi.c(quoted diff) +0
-0@@ -1095,11 +1095,7 @@ void rsnd_ssi_parse_hdmi_connection(struct
rsnd_priv*priv,sound/soc/sh/rcar/ssi.c void rsnd_ssi_parse_hdmi_connection(struct rsnd_priv *priv,
Quoted 10 lines
sound/soc/sh/rcar/ssi.c +2
-5int dai_i) {struct rsnd_dai *rdai =rsnd_rdai_get (priv, dai_i); -struct device_node *remote_ep; - - remote_ep =of_graph_get_remote_endpoint (endpoint); -if (!remote_ep) -return ; +struct device_node *remote_ep = +of_graph_get_remote_endpoint (endpoint);Plus the code seems to be missing
of_node_put().
Thanks. indeed it missing of_node_put().
I will post fixup patch
Thank you for your help !!
Best regards
---
Kuninori Morimoto
PATCH 26/57 ASoC: rsnd: rename rsnd_runtime_is_ssi_xxx()
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit a607280293b4b804fa080c75412b256ec37ce04c upstream.
Current rsnd driver has rsnd_runtime_is_ssi_xxx() functions, but it is not only related to SSI, thus, it is misunderstandable. This patch renames it.
--- sound/soc/sh/rcar/core.c | 6 +++--- sound/soc/sh/rcar/rsnd.h | 4 ++-- sound/soc/sh/rcar/ssi.c | 4 ++-- sound/soc/sh/rcar/ssiu.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-)
sound/soc/sh/rcar/core.c +3 -3
@@ -287,7 +287,7 @@ int rsnd_runtime_channel_for_ssi_with_params(struct rsnd_dai_stream *io,rsnd_runtime_channel_original_with_params (io, params);/* Use Multi SSI */ -if (rsnd_runtime_is_ssi_multi (io)) +if (rsnd_runtime_is_multi_ssi (io)) chan /=rsnd_rdai_ssi_lane_get (rdai);/* TDM Extend Mode needs 8ch */
@@ -297,7 +297,7 @@ int rsnd_runtime_channel_for_ssi_with_params(struct rsnd_dai_stream *io,return chan; } -int rsnd_runtime_is_ssi_multi (struct rsnd_dai_stream *io) +int rsnd_runtime_is_multi_ssi (struct rsnd_dai_stream *io) {struct rsnd_dai *rdai =rsnd_io_to_rdai (io);int lane =rsnd_rdai_ssi_lane_get (rdai);
@@ -308,7 +308,7 @@ int rsnd_runtime_is_ssi_multi(struct rsnd_dai_stream *io)return (chan >2 ) && (lane >1 ); } -int rsnd_runtime_is_ssi_tdm (struct rsnd_dai_stream *io) +int rsnd_runtime_is_tdm (struct rsnd_dai_stream *io) {return rsnd_runtime_channel_for_ssi (io) >=6 ; }
sound/soc/sh/rcar/rsnd.h +2 -2
@@ -431,8 +431,8 @@ int rsnd_runtime_channel_after_ctu_with_params(struct rsnd_dai_stream *io, rsnd_runtime_channel_for_ssi_with_params(io, NULL)int rsnd_runtime_channel_for_ssi_with_params (struct rsnd_dai_stream *io,struct snd_pcm_hw_params *params); -int rsnd_runtime_is_ssi_multi (struct rsnd_dai_stream *io); -int rsnd_runtime_is_ssi_tdm (struct rsnd_dai_stream *io); +int rsnd_runtime_is_multi_ssi (struct rsnd_dai_stream *io); +int rsnd_runtime_is_tdm (struct rsnd_dai_stream *io);/* * DT
sound/soc/sh/rcar/ssi.c +2 -2
@@ -223,7 +223,7 @@ static u32 rsnd_ssi_run_mods(struct rsnd_dai_stream *io)u32 rsnd_ssi_multi_slaves_runtime (struct rsnd_dai_stream *io) { -if (rsnd_runtime_is_ssi_multi (io)) +if (rsnd_runtime_is_multi_ssi (io))return rsnd_ssi_multi_slaves (io);return 0 ;
@@ -383,7 +383,7 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod,u32 wsr = ssi->wsr;int is_tdm; - is_tdm =rsnd_runtime_is_ssi_tdm (io); + is_tdm =rsnd_runtime_is_tdm (io); cr_own |=FORCE |rsnd_rdai_width_to_swl (rdai);
sound/soc/sh/rcar/ssiu.c +1 -1
@@ -145,7 +145,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod, ssiu->usrcnt++; -if (rsnd_runtime_is_ssi_tdm (io)) { +if (rsnd_runtime_is_tdm (io)) {/* * TDM Extend Mode * see
Signature · 1 line
2.7.4
PATCH 27/57 ASoC: rsnd: use defined io_playback/io_capture
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 9328882e9dc6b3ae6d11eaf6dbdeb45dfbb2d38f upstream.
rdai->playback/rdai->capture are defined as io_playback/io_capture on __rsnd_dai_probe(). Let's use it instead of original one.
--- sound/soc/sh/rcar/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/sh/rcar/core.c +6 -6
@@ -1085,24 +1085,24 @@ static void __rsnd_dai_probe(struct rsnd_priv *priv, drv->name = rdai->name; drv->ops = &rsnd_soc_dai_ops; -snprintf (rdai->playback.name,RSND_DAI_NAME_SIZE , +snprintf (io_playback->name,RSND_DAI_NAME_SIZE ,"DAI%d Playback" , dai_i); drv->playback.rates =RSND_RATES ; drv->playback.formats =RSND_FMTS ; drv->playback.channels_min =2 ; drv->playback.channels_max =8 ; - drv->playback.stream_name = rdai->playback.name; + drv->playback.stream_name = io_playback->name; -snprintf (rdai->capture.name,RSND_DAI_NAME_SIZE , +snprintf (io_capture->name,RSND_DAI_NAME_SIZE ,"DAI%d Capture" , dai_i); drv->capture.rates =RSND_RATES ; drv->capture.formats =RSND_FMTS ; drv->capture.channels_min =2 ; drv->capture.channels_max =8 ; - drv->capture.stream_name = rdai->capture.name; + drv->capture.stream_name = io_capture->name; - rdai->playback.rdai = rdai; - rdai->capture.rdai = rdai; + io_playback->rdai = rdai; + io_capture->rdai = rdai;rsnd_rdai_channels_set (rdai,2 );/* default 2ch */ rsnd_rdai_ssi_lane_set (rdai,1 );/* default 1lane */ rsnd_rdai_width_set (rdai,32 );/* default 32bit width */
Signature · 1 line
2.7.4
PATCH 28/57 ASoC: rsnd: move HDMI information from ssi.c to core.c
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit beed78aeeb10214798b1fd5f1dd05e0b7199d65f upstream.
Current driver is supporting HDMI output, and its information are handled under ssi.c. But, it is stream information. Let's move it from ssi.c to core.c.
--- sound/soc/sh/rcar/core.c | 30 +++++++++++++++++++++++- sound/soc/sh/rcar/rsnd.h | 13 +++++------ sound/soc/sh/rcar/ssi.c | 60 +----------------------------------------------- sound/soc/sh/rcar/ssiu.c | 13 ++++------- 4 files changed, 41 insertions(+), 75 deletions(-)
sound/soc/sh/rcar/core.c +29 -1
@@ -999,6 +999,29 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { .prepare = rsnd_soc_dai_prepare, }; +static void rsnd_parse_connect_graph (struct rsnd_priv *priv, +struct rsnd_dai_stream *io, +struct device_node *endpoint) +{ +struct device *dev =rsnd_priv_to_dev (priv); +struct device_node *remote_node =of_graph_get_remote_port_parent (endpoint); + +if (!rsnd_io_to_mod_ssi (io)) +return ; + +/* HDMI0 */ +if (strstr (remote_node->full_name,"hdmi at fead0000" )) { +rsnd_flags_set (io,RSND_STREAM_HDMI0 ); +dev_dbg (dev,"%s connected to HDMI0\n" , io->name); + } + +/* HDMI1 */ +if (strstr (remote_node->full_name,"hdmi at feae0000" )) { +rsnd_flags_set (io,RSND_STREAM_HDMI1 ); +dev_dbg (dev,"%s connected to HDMI1\n" , io->name); + } +} + void rsnd_parse_connect_common(struct rsnd_dai *rdai, struct rsnd_mod* (*mod_get)(struct rsnd_priv *priv, int id), struct device_node *node,
@@ -1171,7 +1194,12 @@ static int rsnd_dai_probe(struct rsnd_priv *priv)if (is_graph) {for_each_endpoint_of_node (dai_node, dai_np) {__rsnd_dai_probe (priv, dai_np, dai_i); -rsnd_ssi_parse_hdmi_connection (priv, dai_np, dai_i); +if (rsnd_is_gen3 (priv)) { +struct rsnd_dai *rdai =rsnd_rdai_get (priv, dai_i); + +rsnd_parse_connect_graph (priv, &rdai->playback, dai_np); +rsnd_parse_connect_graph (priv, &rdai->capture, dai_np); + } dai_i++; } }else {
sound/soc/sh/rcar/rsnd.h +6 -7
@@ -458,7 +458,13 @@ struct rsnd_dai_stream {struct rsnd_dai *rdai;struct device *dmac_dev;/* for IPMMU */ u32 parent_ssi_status; +u32 flags; }; + +/* flags */ +#define RSND_STREAM_HDMI0 (1 << 0)/* for HDMI0 */ +#define RSND_STREAM_HDMI1 (1 << 1)/* for HDMI1 */ +#define rsnd_io_to_mod (io, i) ((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL)#define rsnd_io_to_mod_ssi (io) rsnd_io_to_mod((io), RSND_MOD_SSI)#define rsnd_io_to_mod_ssiu (io) rsnd_io_to_mod((io), RSND_MOD_SSIU)
@@ -718,13 +724,6 @@ int rsnd_ssi_use_busif(struct rsnd_dai_stream *io);int rsnd_ssi_get_busif (struct rsnd_dai_stream *io);u32 rsnd_ssi_multi_slaves_runtime (struct rsnd_dai_stream *io); -#define RSND_SSI_HDMI_PORT0 0xf0 -#define RSND_SSI_HDMI_PORT1 0xf1 -int rsnd_ssi_hdmi_port (struct rsnd_dai_stream *io); -void rsnd_ssi_parse_hdmi_connection (struct rsnd_priv *priv, -struct device_node *endpoint, -int dai_i); -#define rsnd_ssi_is_pin_sharing (io) \ __rsnd_ssi_is_pin_sharing(rsnd_io_to_mod_ssi(io))int __rsnd_ssi_is_pin_sharing (struct rsnd_mod *mod);
sound/soc/sh/rcar/ssi.c +1 -59
78 lines not on this page · raw message
sound/soc/sh/rcar/ssiu.c +5 -8
@@ -135,7 +135,8 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod, struct rsnd_priv *priv) {struct rsnd_ssiu *ssiu =rsnd_mod_to_ssiu (mod); -int hdmi =rsnd_ssi_hdmi_port (io); +u32 has_hdmi0 =rsnd_flags_has (io,RSND_STREAM_HDMI0 ); +u32 has_hdmi1 =rsnd_flags_has (io,RSND_STREAM_HDMI1 );int ret;u32 mode =0 ;
@@ -212,7 +213,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod, } } -if (hdmi) { +if (has_hdmi0 || has_hdmi1) {enum rsnd_mod_type rsnd_ssi_array[] = {RSND_MOD_SSIM1 ,RSND_MOD_SSIM2 ,
@@ -238,14 +239,10 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,rsnd_mod_id (pos) << shift; } -switch (hdmi) { -case RSND_SSI_HDMI_PORT0 : +if (has_hdmi0)rsnd_mod_write (mod,HDMI0_SEL , val); -break ; -case RSND_SSI_HDMI_PORT1 : +if (has_hdmi1)rsnd_mod_write (mod,HDMI1_SEL , val); -break ; - } }return 0 ;
Signature · 1 line
2.7.4
PATCH 28/57 ASoC: rsnd: move HDMI information from ssi.c to core.c
Hi!
Quoted 18 lines
Current driver is supporting HDMI output, and its information are handled under
ssi.c. But, it is stream information. Let's move it fromssi.ctocore.c.+++
b/sound/soc/sh/rcar/core.csound/soc/sh/rcar/core.c +12
-0+static void rsnd_parse_connect_graph (struct rsnd_priv *priv, +struct rsnd_dai_stream *io, +struct device_node *endpoint) +{ +struct device *dev =rsnd_priv_to_dev (priv); +struct device_node *remote_node =of_graph_get_remote_port_parent (endpoint); + +if (!rsnd_io_to_mod_ssi (io)) +return ; + +/* HDMI0 */ +if (strstr (remote_node->full_name,"hdmi at fead0000" )) {
sound/soc/sh/rcar/core.c static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { · line 1023
Quoted 10 lines
sound/soc/sh/rcar/core.c +10
-0+rsnd_flags_set (io,RSND_STREAM_HDMI0 ); +dev_dbg (dev,"%s connected to HDMI0\n" , io->name); + } + +/* HDMI1 */ +if (strstr (remote_node->full_name,"hdmi at feae0000" )) { +rsnd_flags_set (io,RSND_STREAM_HDMI1 ); +dev_dbg (dev,"%s connected to HDMI1\n" , io->name); + } +}
Does it miss of_node_put()?
Best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191020/9e3f7a16/attachment.sig>
PATCH 28/57 ASoC: rsnd: move HDMI information from ssi.c to core.c
+ Morimoto-San
Hi Pavel,
Thanks for the feedback.
Quoted 27 lines
Subject: Re: [PATCH 4.19.y-cip 28/57] ASoC: rsnd: move HDMI information from
ssi.ctocore.cHi!
Quoted 22 lines
Current driver is supporting HDMI output, and its information are handled under
ssi.c. But, it is stream information. Let's move it fromssi.ctocore.c.+++
b/sound/soc/sh/rcar/core.csound/soc/sh/rcar/core.c +16
-0+static void rsnd_parse_connect_graph (struct rsnd_priv *priv, +struct rsnd_dai_stream *io, +struct device_node *endpoint) { +struct device *dev =rsnd_priv_to_dev (priv); +struct device_node *remote_node = +of_graph_get_remote_port_parent (endpoint); + +if (!rsnd_io_to_mod_ssi (io)) +return ; + +/* HDMI0 */ +if (strstr (remote_node->full_name,"hdmi at fead0000" )) { +rsnd_flags_set (io,RSND_STREAM_HDMI0 ); +dev_dbg (dev,"%s connected to HDMI0\n" , io->name); + } +
Quoted 8 lines
sound/soc/sh/rcar/core.c static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { · line 1023
Quoted 6 lines
sound/soc/sh/rcar/core.c +6
-0+/* HDMI1 */ +if (strstr (remote_node->full_name,"hdmi at feae0000" )) { +rsnd_flags_set (io,RSND_STREAM_HDMI1 ); +dev_dbg (dev,"%s connected to HDMI1\n" , io->name); + } +}Does it miss
of_node_put()?
Ye looks like we are missing of_node_put. Morimoto-San any comments?
Regards,
Biju
PATCH 29/57 ASoC: rsnd: handle DPCM converted rate/chan under core
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit c2aaaa57d44a195b71fe1e9ff0c6a80ac017495d upstream.
converted rate/chan are handled each rated module, but it will be used other module too.
For examle, converted channel is currently used for CTU, but, it will be used for TDM Split mode, too.
This patch move/merge SRC/CTU hw_param under core.c and handles converted rate/chan under rsnd_dai_stream.
--- sound/soc/sh/rcar/core.c | 34 +++++++++++++++++++++++++++++++++- sound/soc/sh/rcar/ctu.c | 45 --------------------------------------------- sound/soc/sh/rcar/rsnd.h | 5 ++++- sound/soc/sh/rcar/src.c | 40 ++-------------------------------------- 4 files changed, 39 insertions(+), 85 deletions(-)
sound/soc/sh/rcar/core.c +33 -1
@@ -269,7 +269,7 @@ int rsnd_runtime_channel_after_ctu_with_params(struct rsnd_dai_stream *io,struct rsnd_mod *ctu_mod =rsnd_io_to_mod_ctu (io);if (ctu_mod) { -u32 converted_chan =rsnd_ctu_converted_channel (ctu_mod); +u32 converted_chan =rsnd_io_converted_chan (io);if (converted_chan)return converted_chan;
@@ -1219,8 +1219,40 @@ static int rsnd_hw_params(struct snd_pcm_substream *substream,struct snd_soc_dai *dai =rsnd_substream_to_dai (substream);struct rsnd_dai *rdai =rsnd_dai_to_rdai (dai);struct rsnd_dai_stream *io =rsnd_rdai_to_io (rdai, substream); +struct snd_soc_pcm_runtime *fe = substream->private_data;int ret; +/* +* rsnd assumes that it might be used under DPCM if user want to use +* channel / rate convert. Then, rsnd should be FE. +* And then, this function will be called *after* BE settings. +* this means, each BE already has fixuped hw_params. +* see +* dpcm_fe_dai_hw_params() +* dpcm_be_dai_hw_params() +*/ + io->converted_rate =0 ; + io->converted_chan =0 ; +if (fe->dai_link->dynamic) { +struct rsnd_priv *priv =rsnd_io_to_priv (io); +struct device *dev =rsnd_priv_to_dev (priv); +struct snd_soc_dpcm *dpcm; +struct snd_pcm_hw_params *be_params; +int stream = substream->stream; + +for_each_dpcm_be (fe, stream, dpcm) { + be_params = &dpcm->hw_params; +if (params_channels (hw_params) !=params_channels (be_params)) + io->converted_chan =params_channels (be_params); +if (params_rate (hw_params) !=params_rate (be_params)) + io->converted_rate =params_rate (be_params); + } +if (io->converted_chan) +dev_dbg (dev,"convert channels = %d\n" , io->converted_chan); +if (io->converted_rate) +dev_dbg (dev,"convert rate = %d\n" , io->converted_rate); + } + ret =rsnd_dai_call (hw_params, io, substream, hw_params);if (ret)return ret;
sound/soc/sh/rcar/ctu.c +0 -45
63 lines not on this page · raw message
sound/soc/sh/rcar/rsnd.h +4 -1
@@ -457,6 +457,8 @@ struct rsnd_dai_stream {struct rsnd_mod *dma;struct rsnd_dai *rdai;struct device *dmac_dev;/* for IPMMU */ +u32 converted_rate;/* converted sampling rate */ +int converted_chan;/* converted channels */ u32 parent_ssi_status;u32 flags; };
@@ -479,6 +481,8 @@ struct rsnd_dai_stream {#define rsnd_io_is_play (io) (&rsnd_io_to_rdai(io)->playback == io)#define rsnd_io_to_runtime (io) ((io)->substream ? \ (io)->substream->runtime : NULL) +#define rsnd_io_converted_rate (io) ((io)->converted_rate) +#define rsnd_io_converted_chan (io) ((io)->converted_chan)int rsnd_io_is_working (struct rsnd_dai_stream *io);struct rsnd_dai {
@@ -767,7 +771,6 @@ unsigned int rsnd_src_get_rate(struct rsnd_priv *priv,*/ int rsnd_ctu_probe (struct rsnd_priv *priv);void rsnd_ctu_remove (struct rsnd_priv *priv); -int rsnd_ctu_converted_channel (struct rsnd_mod *mod);struct rsnd_mod *rsnd_ctu_mod_get (struct rsnd_priv *priv,int id);#define rsnd_ctu_of_node (priv) rsnd_parse_of_node(priv, RSND_NODE_CTU)#define rsnd_parse_connect_ctu (rdai, playback, capture) \
sound/soc/sh/rcar/src.c +2 -38
@@ -25,7 +25,6 @@ struct rsnd_src {struct rsnd_mod *dma;struct rsnd_kctrl_cfg_s sen;/* sync convert enable */ struct rsnd_kctrl_cfg_s sync;/* sync convert */ -u32 convert_rate;/* sampling rate convert */ int irq; };
@@ -89,12 +88,12 @@ static u32 rsnd_src_convert_rate(struct rsnd_dai_stream *io,return 0 ;if (!rsnd_src_sync_is_enabled (mod)) -return src->convert_rate; +return rsnd_io_converted_rate (io); convert_rate = src->sync.val;if (!convert_rate) - convert_rate = src->convert_rate; + convert_rate =rsnd_io_converted_rate (io);if (!convert_rate) convert_rate = runtime->rate;
@@ -135,40 +134,6 @@ unsigned int rsnd_src_get_rate(struct rsnd_priv *priv,return rate; } -static int rsnd_src_hw_params (struct rsnd_mod *mod, -struct rsnd_dai_stream *io, -struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *fe_params) -{ -struct rsnd_src *src =rsnd_mod_to_src (mod); -struct snd_soc_pcm_runtime *fe = substream->private_data; - -/* -* SRC assumes that it is used under DPCM if user want to use -* sampling rate convert. Then, SRC should be FE. -* And then, this function will be called *after* BE settings. -* this means, each BE already has fixuped hw_params. -* see -* dpcm_fe_dai_hw_params() -* dpcm_be_dai_hw_params() -*/ - src->convert_rate =0 ; -if (fe->dai_link->dynamic) { -int stream = substream->stream; -struct snd_soc_dpcm *dpcm; -struct snd_pcm_hw_params *be_params; - -for_each_dpcm_be (fe, stream, dpcm) { - be_params = &dpcm->hw_params; - -if (params_rate (fe_params) !=params_rate (be_params)) - src->convert_rate =params_rate (be_params); - } - } - -return 0 ; -} -static void rsnd_src_set_convert_rate (struct rsnd_dai_stream *io,struct rsnd_mod *mod) {
@@ -534,7 +499,6 @@ static struct rsnd_mod_ops rsnd_src_ops = { .start = rsnd_src_start, .stop = rsnd_src_stop, .irq = rsnd_src_irq, - .hw_params = rsnd_src_hw_params, .pcm_new = rsnd_src_pcm_new, .get_status = rsnd_mod_get_status, };
Signature · 1 line
2.7.4
PATCH 30/57 ASoC: rsnd: add SSIU BUSIF support
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 4e7788fb8018afbb2e34e9d59b59baea30f5b045 upstream.
Gen2 has BUSIF0-3, Gen3 has BUSIF0-7 on some SSIU.
Current driver is assuming it is using BUSIF0 as default. Thus, SSI is attaching SSIU (with BUSIF0) by using rsnd_ssiu_attach(). But, TDM split mode also needs other BUSIF to use it.
This patch adds missing SSIU BUSIFx support.
BUSIF is handled by SSIU instead of SSI anymore.
Thus, its settings no longer needed on SSI node on DT.
This patch removes its settings from Document, but driver is still keeping compatibility. Thus, old DT style is still working. But, to avoid confusing, it doesn't indicate old compatibility things on Document. New SoC should have SSIU on DT from this patch.
1) old style DT is still supported (= no rcar_sound,ssiu node on DT)
2) If ssiu is not indicated on playback/capture,
BUSIF0 will be used as default
playback = <&ssi3>; /* ssiu30 will be selected */
3) you can select own ssiu
playback = <&ssi32 &ssi3>; /* ssiu32 will be selected */
--- sound/soc/sh/rcar/core.c | 1 + sound/soc/sh/rcar/dma.c | 37 ++++++++-- sound/soc/sh/rcar/rsnd.h | 6 +- sound/soc/sh/rcar/ssi.c | 22 +++--- sound/soc/sh/rcar/ssiu.c | 178 +++++++++++++++++++++++++++++++++++++++++++---- 5 files changed, 215 insertions(+), 29 deletions(-)
sound/soc/sh/rcar/core.c +1 -0
@@ -1138,6 +1138,7 @@ static void __rsnd_dai_probe(struct rsnd_priv *priv,break ;rsnd_parse_connect_ssi (rdai, playback, capture); +rsnd_parse_connect_ssiu (rdai, playback, capture);rsnd_parse_connect_src (rdai, playback, capture);rsnd_parse_connect_ctu (rdai, playback, capture);rsnd_parse_connect_mix (rdai, playback, capture);
sound/soc/sh/rcar/dma.c +31 -6
@@ -218,7 +218,7 @@ struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node,int i =0 ;for_each_child_of_node (of_node, np) { -if (i ==rsnd_mod_id (mod) && (!chan)) +if (i ==rsnd_mod_id_raw (mod) && (!chan)) chan =of_dma_request_slave_channel (np, name); i++; }
@@ -344,14 +344,16 @@ static u32 rsnd_dmapp_get_id(struct rsnd_dai_stream *io, struct rsnd_mod *mod) {struct rsnd_mod *ssi =rsnd_io_to_mod_ssi (io); +struct rsnd_mod *ssiu =rsnd_io_to_mod_ssiu (io);struct rsnd_mod *src =rsnd_io_to_mod_src (io);struct rsnd_mod *dvc =rsnd_io_to_mod_dvc (io);const u8 *entry =NULL ;int id =255 ;int size =0 ; -if (mod == ssi) { -int busif =rsnd_ssi_get_busif (io); +if ((mod == ssi) || + (mod == ssiu)) { +int busif =rsnd_mod_id_sub (ssiu); entry = gen2_id_table_ssiu; size =ARRAY_SIZE (gen2_id_table_ssiu);
@@ -530,13 +532,14 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,struct device *dev =rsnd_priv_to_dev (priv);phys_addr_t ssi_reg =rsnd_gen_get_phy_addr (priv,RSND_GEN2_SSI );phys_addr_t src_reg =rsnd_gen_get_phy_addr (priv,RSND_GEN2_SCU ); -int is_ssi = !!(rsnd_io_to_mod_ssi (io) == mod); +int is_ssi = !!(rsnd_io_to_mod_ssi (io) == mod) || + !!(rsnd_io_to_mod_ssiu (io) == mod);int use_src = !!rsnd_io_to_mod_src (io);int use_cmd = !!rsnd_io_to_mod_dvc (io) || !!rsnd_io_to_mod_mix (io) || !!rsnd_io_to_mod_ctu (io);int id =rsnd_mod_id (mod); -int busif =rsnd_ssi_get_busif (io); +int busif =rsnd_mod_id_sub (rsnd_io_to_mod_ssiu (io));struct dma_addr {dma_addr_t out_addr;dma_addr_t in_addr;
@@ -620,7 +623,7 @@ static void rsnd_dma_of_path(struct rsnd_mod *this,struct rsnd_mod **mod_from, struct rsnd_mod **mod_to) { - struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io); + struct rsnd_mod *ssi;struct rsnd_mod *src =rsnd_io_to_mod_src (io);struct rsnd_mod *ctu =rsnd_io_to_mod_ctu (io);struct rsnd_mod *mix =rsnd_io_to_mod_mix (io);
@@ -631,6 +634,28 @@ static void rsnd_dma_of_path(struct rsnd_mod *this,struct device *dev =rsnd_priv_to_dev (priv);int nr, i, idx; +/* +* It should use "rcar_sound,ssiu" on DT. +* But, we need to keep compatibility for old version. +* +* If it has "rcar_sound.ssiu", it will be used. +* If not, "rcar_sound.ssi" will be used. +* see +* rsnd_ssiu_dma_req() +* rsnd_ssi_dma_req() +*/ +if (rsnd_ssiu_of_node (priv)) { +struct rsnd_mod *ssiu =rsnd_io_to_mod_ssiu (io); + +/* use SSIU */ + ssi = ssiu; +if (this ==rsnd_io_to_mod_ssi (io)) + this = ssiu; + }else { +/* keep compatible, use SSI */ + ssi =rsnd_io_to_mod_ssi (io); + } +if (!ssi)return ;
sound/soc/sh/rcar/rsnd.h +5 -1
@@ -441,6 +441,7 @@ int rsnd_runtime_is_tdm(struct rsnd_dai_stream *io); of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, node)#define RSND_NODE_DAI "rcar_sound,dai"#define RSND_NODE_SSI "rcar_sound,ssi" +#define RSND_NODE_SSIU "rcar_sound,ssiu"#define RSND_NODE_SRC "rcar_sound,src"#define RSND_NODE_CTU "rcar_sound,ctu"#define RSND_NODE_MIX "rcar_sound,mix"
@@ -725,7 +726,6 @@ void rsnd_ssi_remove(struct rsnd_priv *priv);struct rsnd_mod *rsnd_ssi_mod_get (struct rsnd_priv *priv,int id);int rsnd_ssi_is_dma_mode (struct rsnd_mod *mod);int rsnd_ssi_use_busif (struct rsnd_dai_stream *io); -int rsnd_ssi_get_busif (struct rsnd_dai_stream *io);u32 rsnd_ssi_multi_slaves_runtime (struct rsnd_dai_stream *io);#define rsnd_ssi_is_pin_sharing (io) \
@@ -746,6 +746,10 @@ int rsnd_ssiu_attach(struct rsnd_dai_stream *io, struct rsnd_mod *mod);int rsnd_ssiu_probe (struct rsnd_priv *priv);void rsnd_ssiu_remove (struct rsnd_priv *priv); +void rsnd_parse_connect_ssiu (struct rsnd_dai *rdai, +struct device_node *playback, +struct device_node *capture); +#define rsnd_ssiu_of_node (priv) rsnd_parse_of_node(priv, RSND_NODE_SSIU)/* * R-Car SRC
sound/soc/sh/rcar/ssi.c +12 -10
@@ -134,11 +134,6 @@ int rsnd_ssi_use_busif(struct rsnd_dai_stream *io)return use_busif; } -int rsnd_ssi_get_busif (struct rsnd_dai_stream *io) -{ -return 0 ;/* BUSIF0 only for now */ -} -static void rsnd_ssi_status_clear (struct rsnd_mod *mod) {rsnd_mod_write (mod,SSISR ,0 );
@@ -745,7 +740,7 @@ static int rsnd_ssi_common_probe(struct rsnd_mod *mod, {struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_ssi *ssi =rsnd_mod_to_ssi (mod); -int ret; +int ret =0 ;/* * SSIP/SSIU/IRQ are not needed on
@@ -759,10 +754,6 @@ static int rsnd_ssi_common_probe(struct rsnd_mod *mod,* see rsnd_ssi_pcm_new() */ - ret =rsnd_ssiu_attach (io, mod); -if (ret <0 ) -return ret; -/* * SSI might be called again as PIO fallback * It is easy to manual handling for IRQ request/free
@@ -956,6 +947,17 @@ static struct dma_chan *rsnd_ssi_dma_req(struct rsnd_dai_stream *io,int is_play =rsnd_io_is_play (io);char *name; +/* +* It should use "rcar_sound,ssiu" on DT. +* But, we need to keep compatibility for old version. +* +* If it has "rcar_sound.ssiu", it will be used. +* If not, "rcar_sound.ssi" will be used. +* see +* rsnd_ssiu_dma_req() +* rsnd_dma_of_path() +*/ +if (rsnd_ssi_use_busif (io)) name = is_play ?"rxu" :"txu" ;else
sound/soc/sh/rcar/ssiu.c +166 -12
246 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 30/57 ASoC: rsnd: add SSIU BUSIF support
Hi!
Quoted 4 lines
This patch removes its settings from Document, but driver is still keeping compatibility. Thus, old DT style is still working. But, to avoid confusing, it doesn't indicate old compatibility things on Document. New SoC should have SSIU on DT from this patch.
I'm not sure which Document this talks about:
Quoted 10 lines
Signed-off-by Kuninori Morimoto <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Biju Das <[email protected]>--- sound/soc/sh/rcar/core.c | 1 + sound/soc/sh/rcar/dma.c | 37 ++++++++-- sound/soc/sh/rcar/rsnd.h | 6 +- sound/soc/sh/rcar/ssi.c | 22 +++--- sound/soc/sh/rcar/ssiu.c | 178 +++++++++++++++++++++++++++++++++++++++++++---- 5 files changed, 215 insertions(+), 29 deletions(-)
Patch does not seem to be changing any documentation.
Best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191020/61c40343/attachment.sig>
PATCH 30/57 ASoC: rsnd: add SSIU BUSIF support
HI Pavel,
Thanks for the feedback.
Quoted 10 lines
Subject: Re: [PATCH 4.19.y-cip 30/57] ASoC: rsnd: add SSIU BUSIF support
Hi!
Quoted 4 lines
This patch removes its settings from Document, but driver is still keeping compatibility. Thus, old DT style is still working. But, to avoid confusing, it doesn't indicate old compatibility things on Document. New SoC should have SSIU on DT from this patch.
I'm not sure which Document this talks about:
I think, it is talking about "Old" means BUS IF handled by SSI driver and "New" means BUSIF handled by SSIU.
If you have new DT style and don't have this driver change, then you will get the below error and the driver fallback to PIO mode.
[ 10.762848] rcar_sound ec500000.sound: ssi[2] : probe error -11 [ 10.768858] rcar_sound ec500000.sound: ssi[2] fallback to PIO mode [ 10.775177] rcar_sound ec500000.sound: probed
Quoted 11 lines
Quoted 10 lines
Signed-off-by Kuninori Morimoto <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Biju Das <[email protected]>--- sound/soc/sh/rcar/core.c | 1 + sound/soc/sh/rcar/dma.c | 37 ++++++++-- sound/soc/sh/rcar/rsnd.h | 6 +- sound/soc/sh/rcar/ssi.c | 22 +++--- sound/soc/sh/rcar/ssiu.c | 178 +++++++++++++++++++++++++++++++++++++++++++---- 5 files changed, 215 insertions(+), 29 deletions(-)
Quoted 1 line
Patch does not seem to be changing any documentation.
Cheers,
Biju
PATCH 31/57 ASoC: rsnd: add TDM Split mode support
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit f69f452243e4e16d7a3d0a14e14126b10933d545 upstream.
This patch adds TDM Split mode support. rsnd driver is assuming audio-graph-scu-card is used for Sound Card.
This is very simple sample DT settings to use it.
sound_card: sound {
compatible = "audio-graph-scu-card";
...
convert-channels = <8>; /* TDM Split */
dais = <&rsnd_port0 /* playback ch1/ch2 */
&rsnd_port1 /* playback ch3/ch4 */
&rsnd_port2 /* playback ch5/ch6 */
&rsnd_port3 /* playback ch7/ch8 */
>;
};
audio-codec {
...
port {
codec_0: endpoint at 1 {
remote-endpoint = <&rsnd_ep0>;
};
codec_1: endpoint at 2 {
remote-endpoint = <&rsnd_ep1>;
};
codec_2: endpoint at 3 {
remote-endpoint = <&rsnd_ep2>;
};
codec_3: endpoint at 4 {
remote-endpoint = <&rsnd_ep3>;
};
};
};
&rcar_sound {
...
ports {
rsnd_port0: port at 0 {
rsnd_ep0: endpoint {
remote-endpoint = <&codec_0>;
...
playback = <&ssiu30 &ssi3>;
};
};
rsnd_port1: port at 1 {
rsnd_ep1: endpoint {
remote-endpoint = <&codec_1>;
...
playback = <&ssiu31 &ssi3>;
};
};
rsnd_port2: port at 2 {
rsnd_ep2: endpoint {
remote-endpoint = <&codec_2>;
...
playback = <&ssiu32 &ssi3>;
};
};
rsnd_port3: port at 3 {
rsnd_ep3: endpoint {
remote-endpoint = <&codec_3>;
...
playback = <&ssiu33 &ssi3>;
};
};
};
};--- sound/soc/sh/rcar/core.c | 29 +++++++++++++++++++++++++++++ sound/soc/sh/rcar/rsnd.h | 2 ++ sound/soc/sh/rcar/ssi.c | 27 +++++++++++++++++++++++---- sound/soc/sh/rcar/ssiu.c | 21 +++++++++++++-------- 4 files changed, 67 insertions(+), 12 deletions(-)
sound/soc/sh/rcar/core.c +29 -0
@@ -271,6 +271,19 @@ int rsnd_runtime_channel_after_ctu_with_params(struct rsnd_dai_stream *io,if (ctu_mod) {u32 converted_chan =rsnd_io_converted_chan (io); +/* +* !! Note !! +* +* converted_chan will be used for CTU, +* or TDM Split mode. +* User shouldn't use CTU with TDM Split mode. +*/ +if (rsnd_runtime_is_tdm_split (io)) { +struct device *dev =rsnd_priv_to_dev (rsnd_io_to_priv (io)); + +dev_err (dev,"CTU and TDM Split should be used\n" ); + } +if (converted_chan)return converted_chan; }
@@ -313,6 +326,11 @@ int rsnd_runtime_is_tdm(struct rsnd_dai_stream *io)return rsnd_runtime_channel_for_ssi (io) >=6 ; } +int rsnd_runtime_is_tdm_split (struct rsnd_dai_stream *io) +{ +return !!rsnd_flags_has (io,RSND_STREAM_TDM_SPLIT ); +} +/* * ADINR function */
@@ -784,6 +802,7 @@ static int rsnd_soc_set_dai_tdm_slot(struct snd_soc_dai *dai,switch (slots) {case 2 : +/* TDM Split Mode */ case 6 :case 8 :/* TDM Extend Mode */
@@ -1004,6 +1023,7 @@ static void rsnd_parse_connect_graph(struct rsnd_priv *priv, struct device_node *endpoint) {struct device *dev =rsnd_priv_to_dev (priv); +struct device_node *remote_port =of_graph_get_remote_port (endpoint);struct device_node *remote_node =of_graph_get_remote_port_parent (endpoint);if (!rsnd_io_to_mod_ssi (io))
@@ -1020,6 +1040,15 @@ static void rsnd_parse_connect_graph(struct rsnd_priv *priv,rsnd_flags_set (io,RSND_STREAM_HDMI1 );dev_dbg (dev,"%s connected to HDMI1\n" , io->name); } + +/* +* This driver assumes that it is TDM Split mode +* if remote node has multi endpoint +*/ +if (of_get_child_count (remote_port) >1 ) { +rsnd_flags_set (io,RSND_STREAM_TDM_SPLIT ); +dev_dbg (dev,"%s is part of TDM Split\n" , io->name); + } } void rsnd_parse_connect_common(struct rsnd_dai *rdai,
sound/soc/sh/rcar/rsnd.h +2 -0
@@ -433,6 +433,7 @@ int rsnd_runtime_channel_for_ssi_with_params(struct rsnd_dai_stream *io, struct snd_pcm_hw_params *params);int rsnd_runtime_is_multi_ssi (struct rsnd_dai_stream *io);int rsnd_runtime_is_tdm (struct rsnd_dai_stream *io); +int rsnd_runtime_is_tdm_split (struct rsnd_dai_stream *io);/* * DT
@@ -467,6 +468,7 @@ struct rsnd_dai_stream {/* flags */ #define RSND_STREAM_HDMI0 (1 << 0)/* for HDMI0 */ #define RSND_STREAM_HDMI1 (1 << 1)/* for HDMI1 */ +#define RSND_STREAM_TDM_SPLIT (1 << 2)/* for TDM split mode */ #define rsnd_io_to_mod (io, i) ((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL)#define rsnd_io_to_mod_ssi (io) rsnd_io_to_mod((io), RSND_MOD_SSI)
sound/soc/sh/rcar/ssi.c +23 -4
@@ -298,6 +298,9 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,return 0 ; } +if (rsnd_runtime_is_tdm_split (io)) + chan =rsnd_io_converted_chan (io); + main_rate =rsnd_ssi_clk_query (rdai, rate, chan, &idx);if (!main_rate) {dev_err (dev,"unsupported clock rate\n" );
@@ -360,9 +363,11 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod,u32 cr_own = ssi->cr_own;u32 cr_mode = ssi->cr_mode;u32 wsr = ssi->wsr; -int is_tdm; +int width; +int is_tdm, is_tdm_split; - is_tdm =rsnd_runtime_is_tdm (io); + is_tdm =rsnd_runtime_is_tdm (io); + is_tdm_split =rsnd_runtime_is_tdm_split (io); cr_own |=FORCE |rsnd_rdai_width_to_swl (rdai);
@@ -381,7 +386,7 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod,* rsnd_ssiu_init_gen2() */ wsr = ssi->wsr; -if (is_tdm) { +if (is_tdm || is_tdm_split) { wsr |=WS_MODE ; cr_own |=CHNL_8 ; }
@@ -397,7 +402,18 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, cr_own |=TRMD ; cr_own &= ~DWL_MASK ; -switch (snd_pcm_format_width (runtime->format)) { + width =snd_pcm_format_width (runtime->format); +if (is_tdm_split) { +/* +* The SWL and DWL bits in SSICR should be fixed at 32-bit +* setting when TDM split mode. +* see datasheet +* Operation :: TDM Format Split Function (TDM Split Mode) +*/ + width =32 ; + } + +switch (width) {case 8 : cr_own |=DWL_8 ;break ;
@@ -407,6 +423,9 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod,case 24 : cr_own |=DWL_24 ;break ; +case 32 : + cr_own |=DWL_32 ; +break ; }if (rsnd_ssi_is_dma_mode (mod)) {
sound/soc/sh/rcar/ssiu.c +13 -8
@@ -16,6 +16,10 @@ struct rsnd_ssiu {int id_sub; }; +/* SSI_MODE */ +#define TDM_EXT (1 << 0) +#define TDM_SPLIT (1 << 8) +#define rsnd_ssiu_nr (priv) ((priv)->ssiu_nr)#define rsnd_mod_to_ssiu (_mod) container_of((_mod), struct rsnd_ssiu, mod)#define for_each_rsnd_ssiu (pos, priv, i) \
@@ -165,14 +169,15 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod, ssiu->usrcnt++; -if (rsnd_runtime_is_tdm (io)) { -/* -* TDM Extend Mode -* see -* rsnd_ssi_config_init() -*/ - mode =0x1 ; - } +/* +* TDM Extend/Split Mode +* see +* rsnd_ssi_config_init() +*/ +if (rsnd_runtime_is_tdm (io)) + mode =TDM_EXT ; +else if (rsnd_runtime_is_tdm_split (io)) + mode =TDM_SPLIT ;rsnd_mod_write (mod,SSI_MODE , mode);
Signature · 1 line
2.7.4
PATCH 32/57 ASoC: rsnd: use ring buffer for rsnd_mod_name()
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 0246c661b6f0051ef7bfbfff01d8ef7fd0359372 upstream.
commit c0ea089dbad4 ("ASoC: rsnd: rsnd_mod_name() handles both name and ID") merged "name" and "ID" on rsnd_mod_name() to handle sub-ID (= for CTU/BUSIF).
Then, it decided to share static char to avoid pointless memory. But, it doesn't work correctry in below case, because last called name will be used.
dev_xxx(dev, "%s is connected to %s\n", rsnd_mod_name(mod_a), /* ssiu[00] */ rsnd_mod_name(mod_b)); /* ssi[0] */ -> rcar_sound ec500000.sound: ssi[0] is connected to ssi[0] ~~~~~~ ~~~~~~
We still don't want to have pointless memory, so let's use ring buffer. 16byte x 5 is very enough for this purpose.
dev_xxx(dev, "%s is connected to %s\n", rsnd_mod_name(mod_a), /* ssiu[00] */ rsnd_mod_name(mod_b)); /* ssi[0] */ -> rcar_sound ec500000.sound: ssiu[00] is connected to ssi[0] ~~~~~~~~ ~~~~~~
--- sound/soc/sh/rcar/core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
sound/soc/sh/rcar/core.c +8 -1
@@ -137,10 +137,17 @@ struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,return mod->ops->dma_req (io, mod); } +#define MOD_NAME_NUM 5#define MOD_NAME_SIZE 16char *rsnd_mod_name (struct rsnd_mod *mod) { -static char name[MOD_NAME_SIZE ]; +static char names[MOD_NAME_NUM ][MOD_NAME_SIZE ]; +static int num; +char *name = names[num]; + + num++; +if (num >=MOD_NAME_NUM ) + num =0 ;/* * Let's use same char to avoid pointlessness memory
Signature · 1 line
2.7.4
PATCH 32/57 ASoC: rsnd: use ring buffer for rsnd_mod_name()
Quoted 20 lines · Biju Das
From: Kuninori Morimoto <[email protected]>
commit
0246c661b6f0051ef7bfbfff01d8ef7fd0359372upstream.commit
c0ea089dbad4("ASoC: rsnd:rsnd_mod_name()handles both name and ID") merged "name" and "ID" onrsnd_mod_name()to handle sub-ID (= for CTU/BUSIF).
Then, it decided to share static char to avoid pointless memory. But, it doesn't work correctry in below case, because last called name will be used.dev_xxx(dev, "%s is connected to %s\n", rsnd_mod_name(mod_a), /* ssiu[00] */ rsnd_mod_name(mod_b)); /* ssi[0] */ -> rcar_sound ec500000.sound: ssi[0] is connected to ssi[0] ~~~~~~ ~~~~~~We still don't want to have pointless memory, so let's use ring buffer. 16byte x 5 is very enough for this purpose.
Quoted 6 lines
dev_xxx(dev, "%s is connected to %s\n", rsnd_mod_name(mod_a), /* ssiu[00] */ rsnd_mod_name(mod_b)); /* ssi[0] */ -> rcar_sound ec500000.sound: ssiu[00] is connected to ssi[0] ~~~~~~~~ ~~~~~~
I'd really preffer caller passing pointer to buffer to be used to the function.
Best regards,
Pavel
Quoted 20 lines
+++
b/sound/soc/sh/rcar/core.csound/soc/sh/rcar/core.c +8
-1@@ -137,10 +137,17 @@ struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,return mod->ops->dma_req (io, mod); } +#define MOD_NAME_NUM 5#define MOD_NAME_SIZE 16char *rsnd_mod_name (struct rsnd_mod *mod) { -static char name[MOD_NAME_SIZE ]; +static char names[MOD_NAME_NUM ][MOD_NAME_SIZE ]; +static int num; +char *name = names[num]; + + num++; +if (num >=MOD_NAME_NUM ) + num =0 ;/* * Let's use same char to avoid pointlessness memory
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191020/cd2652f6/attachment.sig>
PATCH 32/57 ASoC: rsnd: use ring buffer for rsnd_mod_name()
+Morimoto-San,
Quoted 34 lines
-----Original Message-----
From: Pavel Machek <[email protected]>
Sent: Sunday, October 20, 2019 11:54 AM
To: Biju Das <[email protected]>
Cc: cip-dev at lists.cip-project.org; Nobuhiro Iwamatsu <[email protected]>; Pavel Machek <[email protected]>; Chris Paterson <[email protected]>; Fabrizio Castro <[email protected]>
Subject: Re: [PATCH 4.19.y-cip 32/57] ASoC: rsnd: use ring buffer forrsnd_mod_name()Quoted 5 lines · Biju Das
From: Kuninori Morimoto <[email protected]>
commit
0246c661b6f0051ef7bfbfff01d8ef7fd0359372upstream.commit
c0ea089dbad4("ASoC: rsnd:rsnd_mod_name()handles bothname
Quoted 16 lines
and
ID") merged "name" and "ID" onrsnd_mod_name()to handle sub-ID (= for CTU/BUSIF).
Then, it decided to share static char to avoid pointless memory. But, it doesn't work correctry in below case, because last called name will be used.dev_xxx(dev, "%s is connected to %s\n", rsnd_mod_name(mod_a), /* ssiu[00] */ rsnd_mod_name(mod_b)); /* ssi[0] */ -> rcar_sound ec500000.sound: ssi[0] is connected to ssi[0] ~~~~~~ ~~~~~~We still don't want to have pointless memory, so let's use ring buffer. 16byte x 5 is very enough for this purpose.
Quoted 8 lines
Quoted 6 lines
dev_xxx(dev, "%s is connected to %s\n", rsnd_mod_name(mod_a), /* ssiu[00] */ rsnd_mod_name(mod_b)); /* ssi[0] */ -> rcar_sound ec500000.sound: ssiu[00] is connected to ssi[0] ~~~~~~~~ ~~~~~~I'd really preffer caller passing pointer to buffer to be used to the function.
Why???
Cheers,
Biju
Quoted 25 lines
Review struct dma_chan *rsnd_mod_dma_req(struct
Quoted 3 lines
+++
b/sound/soc/sh/rcar/core.c(quoted diff) +0
-0@@ -137,10 +137,17 @@ struct dma_chan *rsnd_mod_dma_req(struct
rsnd_dai_stream*io,Quoted 7 lines
sound/soc/sh/rcar/core.c +1
-1return mod->ops->dma_req (io, mod); } +#define MOD_NAME_NUM 5#define MOD_NAME_SIZE 16char *rsnd_mod_name (struct rsnd_mod *mod) { -static char name[MOD_NAME_SIZE ];sound/soc/sh/rcar/core.c struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io, · line 153
Quoted 10 lines
sound/soc/sh/rcar/core.c +7
-0+static char names[MOD_NAME_NUM ][MOD_NAME_SIZE ]; +static int num; +char *name = names[num]; + + num++; +if (num >=MOD_NAME_NUM ) + num =0 ;/* * Let's use same char to avoid pointlessness memory --
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 33/57 ASoC: rsnd: tidyup rsnd_parse_connect_ssiu_compatible()
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 331e875432ecfb651d9335a18149160c307429ab upstream.
rsnd_parse_connect_ssiu_compatible() is doing
- using rsnd_ssiu_id(), but we use it via rsnd_mod_id()
- we can break loop if rsnd_dai_connect() was called
This patch fixup these.
--- sound/soc/sh/rcar/ssiu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/soc/sh/rcar/ssiu.c +4 -2
@@ -382,9 +382,11 @@ static void rsnd_parse_connect_ssiu_compatible(struct rsnd_priv *priv,for_each_rsnd_ssiu (ssiu, priv, i) { mod =rsnd_mod_get (ssiu); -if ((rsnd_mod_id (ssi_mod) ==rsnd_ssiu_id (mod)) && - (rsnd_mod_id_sub (mod) ==0 )) +if ((rsnd_mod_id (ssi_mod) ==rsnd_mod_id (mod)) && + (rsnd_mod_id_sub (mod) ==0 )) {rsnd_dai_connect (mod, io, mod->type); +return ; + } } }
Signature · 1 line
2.7.4
PATCH 34/57 ASoC: rsnd: makes rsnd_ssi_is_dma_mode() static
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 0ade2ccfb81244d0a271a5f9917f9fccc349b6cf upstream.
ssi.c only is using rsnd_ssi_is_dma_mode().
Let's move it as static function.
--- sound/soc/sh/rcar/rsnd.h | 1 - sound/soc/sh/rcar/ssi.c | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-)
sound/soc/sh/rcar/rsnd.h +0 -1
@@ -726,7 +726,6 @@ extern const char * const volume_ramp_rate[];int rsnd_ssi_probe (struct rsnd_priv *priv);void rsnd_ssi_remove (struct rsnd_priv *priv);struct rsnd_mod *rsnd_ssi_mod_get (struct rsnd_priv *priv,int id); -int rsnd_ssi_is_dma_mode (struct rsnd_mod *mod);int rsnd_ssi_use_busif (struct rsnd_dai_stream *io);u32 rsnd_ssi_multi_slaves_runtime (struct rsnd_dai_stream *io);
sound/soc/sh/rcar/ssi.c +3 -2
@@ -117,6 +117,8 @@ struct rsnd_ssi { (rsnd_ssi_run_mods(io) & (1 << rsnd_mod_id(mod)))#define rsnd_ssi_can_output_clk (mod) (!__rsnd_ssi_is_pin_sharing(mod)) +static int rsnd_ssi_is_dma_mode (struct rsnd_mod *mod); +int rsnd_ssi_use_busif (struct rsnd_dai_stream *io) {struct rsnd_mod *mod =rsnd_io_to_mod_ssi (io);
@@ -1003,12 +1005,11 @@ static struct rsnd_mod_ops rsnd_ssi_dma_ops = { .get_status = rsnd_ssi_get_status, }; -int rsnd_ssi_is_dma_mode (struct rsnd_mod *mod) +static int rsnd_ssi_is_dma_mode (struct rsnd_mod *mod) {return mod->ops == &rsnd_ssi_dma_ops; } -/* * ssi mod function */
Signature · 1 line
2.7.4
PATCH 35/57 ASoC: rsnd: tidyup registering method for rsnd_kctrl_new()
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 9c698e8481a15237a5b1db5f8391dd66d59e42a4 upstream.
Current rsnd dvc.c is using flags to avoid duplicating register for MIXer case. OTOH, commit e894efef9ac7 ("ASoC: core: add support to card rebind") allows to rebind sound card without rebinding all drivers.
Because of above patch and dvc.c flags, it can't re-register kctrl if only sound card was rebinded, because dvc is keeping old flags. (Of course it will be no problem if rsnd driver also be rebinded, but it is not purpose of above patch).
This patch checks current card registered kctrl when registering. In MIXer case, it can avoid duplicate register if card already has same kctrl. In rebind case, it can re-register kctrl because card registered kctl had been removed when unbinding.
This patch is updated version of commit b918f1bc7f1ce ("ASoC: rsnd: DVC kctrl sets once")
--- sound/soc/sh/rcar/core.c | 12 ++++++++++++ sound/soc/sh/rcar/dvc.c | 8 -------- 2 files changed, 12 insertions(+), 8 deletions(-)
sound/soc/sh/rcar/core.c +12 -0
@@ -1470,6 +1470,18 @@ int rsnd_kctrl_new(struct rsnd_mod *mod, };int ret; +/* +* 1) Avoid duplicate register (ex. MIXer case) +* 2) re-register if card was rebinded +*/ +list_for_each_entry (kctrl, &card->controls, list) { +struct rsnd_kctrl_cfg *c = kctrl->private_data; + +if (strcmp (kctrl->id.name, name) ==0 && + c->mod == mod) +return 0 ; + } +if (size >RSND_MAX_CHANNELS )return -EINVAL ;
sound/soc/sh/rcar/dvc.c +0 -8
@@ -40,11 +40,8 @@ struct rsnd_dvc {struct rsnd_kctrl_cfg_s ren;/* Ramp Enable */ struct rsnd_kctrl_cfg_s rup;/* Ramp Rate Up */ struct rsnd_kctrl_cfg_s rdown;/* Ramp Rate Down */ -u32 flags; }; -#define KCTRL_INITIALIZED (1 << 0) -#define rsnd_dvc_get (priv, id) ((struct rsnd_dvc *)(priv->dvc) + id)#define rsnd_dvc_nr (priv) ((priv)->dvc_nr)
@@ -227,9 +224,6 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,int channels =rsnd_rdai_channels_get (rdai);int ret; -if (rsnd_flags_has (dvc,KCTRL_INITIALIZED )) -return 0 ; -/* Volume */ ret = rsnd_kctrl_new_m(mod, io, rtd, is_play ?
@@ -285,8 +279,6 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,if (ret <0 )return ret; -rsnd_flags_set (dvc,KCTRL_INITIALIZED ); -return 0 ; }
Signature · 1 line
2.7.4
PATCH 36/57 ASoC: rsnd: indicates Channel and Mode for debug
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 5d9bb5554c1dadb141eda9afc06dea350e277b18 upstream.
For TDM debug purpose, indicating Channel and Mode is very useful. This patch indicate it if it has #define DEBUG
--- sound/soc/sh/rcar/ssi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
sound/soc/sh/rcar/ssi.c +9 -1
@@ -329,7 +329,8 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod, ssi->rate = rate; ssi->chan = chan; -dev_dbg (dev,"%s outputs %u Hz\n" ,rsnd_mod_name (mod), rate); +dev_dbg (dev,"%s outputs %d chan %u Hz\n" , +rsnd_mod_name (mod), chan, rate);return 0 ; }
@@ -360,6 +361,8 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, struct rsnd_dai_stream *io) {struct rsnd_dai *rdai =rsnd_io_to_rdai (io); +struct rsnd_priv *priv =rsnd_rdai_to_priv (rdai); +struct device *dev =rsnd_priv_to_dev (priv);struct snd_pcm_runtime *runtime =rsnd_io_to_runtime (io);struct rsnd_ssi *ssi =rsnd_mod_to_ssi (mod);u32 cr_own = ssi->cr_own;
@@ -371,6 +374,11 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, is_tdm =rsnd_runtime_is_tdm (io); is_tdm_split =rsnd_runtime_is_tdm_split (io); +if (is_tdm) +dev_dbg (dev,"TDM mode\n" ); +if (is_tdm_split) +dev_dbg (dev,"TDM Split mode\n" ); + cr_own |=FORCE |rsnd_rdai_width_to_swl (rdai);if (rdai->bit_clk_inv)
Signature · 1 line
2.7.4
PATCH 37/57 ASoC: rsnd: fixup mod ID for CTU regmap read/write
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 665c1ade11e8aee0db691c7a928de1586b712344 upstream.
commit c16015f36cc12824 ("ASoC: rsnd: add .get_id/.get_id_sub") add new .get_id/.get_id_sub to indicate module ID/subID.
It is used for SSIU and CTU. In SSIU case, subID indicates BUSIF, but register settings is based on SSIU ID.
OTOH, in CTU case, subID indicates CTU channel, and register settings is based on it. This means regmap read/write function needs to care it. This patch fixup this issue. It can't play MIXed sound without this patch.
--- sound/soc/sh/rcar/ctu.c | 1 + sound/soc/sh/rcar/gen.c | 14 +++++++++++--- sound/soc/sh/rcar/rsnd.h | 1 + 3 files changed, 13 insertions(+), 3 deletions(-)
sound/soc/sh/rcar/ctu.c +1 -0
@@ -317,6 +317,7 @@ static struct rsnd_mod_ops rsnd_ctu_ops = { .get_status = rsnd_mod_get_status, .id = rsnd_ctu_id, .id_sub = rsnd_ctu_id_sub, + .id_cmd = rsnd_mod_id_raw, };struct rsnd_mod *rsnd_ctu_mod_get (struct rsnd_priv *priv,int id)
sound/soc/sh/rcar/gen.c +11 -3
@@ -71,6 +71,14 @@ static int rsnd_is_accessible_reg(struct rsnd_priv *priv,return 1 ; } +static int rsnd_mod_id_cmd (struct rsnd_mod *mod) +{ +if (mod->ops->id_cmd) +return mod->ops->id_cmd (mod); + +return rsnd_mod_id (mod); +} +u32 rsnd_read (struct rsnd_priv *priv,struct rsnd_mod *mod,enum rsnd_reg reg) {
@@ -81,7 +89,7 @@ u32 rsnd_read(struct rsnd_priv *priv,if (!rsnd_is_accessible_reg (priv, gen, reg))return 0 ; -regmap_fields_read (gen->regs[reg],rsnd_mod_id (mod), &val); +regmap_fields_read (gen->regs[reg],rsnd_mod_id_cmd (mod), &val); dev_dbg(dev, "r %s - %-18s (%4d) : %08x\n", rsnd_mod_name(mod),
@@ -100,7 +108,7 @@ void rsnd_write(struct rsnd_priv *priv,if (!rsnd_is_accessible_reg (priv, gen, reg))return ; -regmap_fields_force_write (gen->regs[reg],rsnd_mod_id (mod), data); +regmap_fields_force_write (gen->regs[reg],rsnd_mod_id_cmd (mod), data); dev_dbg(dev, "w %s - %-18s (%4d) : %08x\n", rsnd_mod_name(mod),
@@ -117,7 +125,7 @@ void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod,return ;regmap_fields_force_update_bits (gen->regs[reg], -rsnd_mod_id (mod), mask, data); +rsnd_mod_id_cmd (mod), mask, data); dev_dbg(dev, "b %s - %-18s (%4d) : %08x/%08x\n", rsnd_mod_name(mod),
sound/soc/sh/rcar/rsnd.h +1 -0
@@ -306,6 +306,7 @@ struct rsnd_mod_ops { enum rsnd_mod_type type);int (*id)(struct rsnd_mod *mod);int (*id_sub)(struct rsnd_mod *mod); +int (*id_cmd)(struct rsnd_mod *mod); };struct rsnd_dai_stream ;
Signature · 1 line
2.7.4
PATCH 38/57 ASoC: rsnd: add missing TDM Split mode support for simple-card
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 538a4ffea3f719ed8f853f78826e360aee5fe9d7 upstream.
commit f69f452243e4e1 ("ASoC: rsnd: add TDM Split mode support") added TDM Split mode support for rsnd driver.
But, it cares audio-graph-card style only. We can't use TDM Split mode on simple-card style now.
This patch fixup this issue.
--- sound/soc/sh/rcar/core.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-)
sound/soc/sh/rcar/core.c +51 -2
@@ -1025,6 +1025,49 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { .prepare = rsnd_soc_dai_prepare, }; +static void rsnd_parse_connect_simple (struct rsnd_priv *priv, +struct device_node *dai_np, +int dai_i,int is_play) +{ +struct device *dev =rsnd_priv_to_dev (priv); +struct rsnd_dai *rdai =rsnd_rdai_get (priv, dai_i); +struct rsnd_dai_stream *io = is_play ? + &rdai->playback : + &rdai->capture; +struct device_node *ssiu_np =rsnd_ssiu_of_node (priv); +struct device_node *np; +int i, j; + +if (!ssiu_np) +return ; + +if (!rsnd_io_to_mod_ssi (io)) +return ; + +/* +* This driver assumes that it is TDM Split mode +* if it includes ssiu node +*/ +for (i =0 ;; i++) { +struct device_node *node = is_play ? +of_parse_phandle (dai_np,"playback" , i) : +of_parse_phandle (dai_np,"capture" , i); + +if (!node) +break ; + + j =0 ; +for_each_child_of_node (ssiu_np, np) { +if (np == node) { +rsnd_flags_set (io,RSND_STREAM_TDM_SPLIT ); +dev_dbg (dev,"%s is part of TDM Split\n" , io->name); + } + j++; + } + + } +} +static void rsnd_parse_connect_graph (struct rsnd_priv *priv,struct rsnd_dai_stream *io,struct device_node *endpoint)
@@ -1240,8 +1283,14 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) dai_i++; } }else { -for_each_child_of_node (dai_node, dai_np) -__rsnd_dai_probe (priv, dai_np, dai_i++); +for_each_child_of_node (dai_node, dai_np) { +__rsnd_dai_probe (priv, dai_np, dai_i); +if (rsnd_is_gen3 (priv)) { +rsnd_parse_connect_simple (priv, dai_np, dai_i,1 ); +rsnd_parse_connect_simple (priv, dai_np, dai_i,0 ); + } + dai_i++; + } }return 0 ;
Signature · 1 line
2.7.4
PATCH 39/57 ASoC: rsnd: remove RSND_REG_ from rsnd_reg
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit b7169ddea2f2a90538f606688adf4948f2da82ce upstream.
Current rsnd is using RSND_REG_xxx for register naming, and using RSND_REG_##f style macro for read/write. The biggest reason why it uses this style is that
we can avoid non-existing register access.
But, its demerit is sequential register access code will be very ugly.
Current rsnd driver is well tested, so, let's remove RSND_REG_ from rsnd_reg, and cleanup sequential register access code.
--- sound/soc/sh/rcar/adg.c | 36 +----- sound/soc/sh/rcar/ctu.c | 69 +++------- sound/soc/sh/rcar/dvc.c | 10 +- sound/soc/sh/rcar/gen.c | 23 ++-- sound/soc/sh/rcar/rsnd.h | 329 +++++++++++++++++++++++------------------------ sound/soc/sh/rcar/ssiu.c | 59 ++------- 6 files changed, 212 insertions(+), 314 deletions(-)
sound/soc/sh/rcar/adg.c +3 -33
@@ -250,28 +250,8 @@ int rsnd_adg_set_src_timesel_gen2(struct rsnd_mod *src_mod, out = out << shift; mask =0x0f1f << shift; -switch (id /2 ) { -case 0 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL0 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL0 , mask, out); -break ; -case 1 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL1 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL1 , mask, out); -break ; -case 2 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL2 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL2 , mask, out); -break ; -case 3 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL3 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL3 , mask, out); -break ; -case 4 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL4 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL4 , mask, out); -break ; - } +rsnd_mod_bset (adg_mod,SRCIN_TIMSEL (id /2 ), mask, in); +rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL (id /2 ), mask, out);if (en)rsnd_mod_bset (adg_mod,DIV_EN , en, en);
@@ -300,17 +280,7 @@ static void rsnd_adg_set_ssi_clk(struct rsnd_mod *ssi_mod, u32 val)if (id ==8 )return ; -switch (id /4 ) { -case 0 : -rsnd_mod_bset (adg_mod,AUDIO_CLK_SEL0 , mask, val); -break ; -case 1 : -rsnd_mod_bset (adg_mod,AUDIO_CLK_SEL1 , mask, val); -break ; -case 2 : -rsnd_mod_bset (adg_mod,AUDIO_CLK_SEL2 , mask, val); -break ; - } +rsnd_mod_bset (adg_mod,AUDIO_CLK_SEL (id /4 ), mask, val);dev_dbg (dev,"AUDIO_CLK_SEL is 0x%x\n" , val); }
sound/soc/sh/rcar/ctu.c +17 -52
117 lines not on this page · raw message
sound/soc/sh/rcar/dvc.c +2 -8
@@ -86,14 +86,8 @@ static void rsnd_dvc_volume_parameter(struct rsnd_dai_stream *io, val[i] =rsnd_kctrl_valm (dvc->volume, i);/* Enable Digital Volume */ -rsnd_mod_write (mod,DVC_VOL0R , val[0 ]); -rsnd_mod_write (mod,DVC_VOL1R , val[1 ]); -rsnd_mod_write (mod,DVC_VOL2R , val[2 ]); -rsnd_mod_write (mod,DVC_VOL3R , val[3 ]); -rsnd_mod_write (mod,DVC_VOL4R , val[4 ]); -rsnd_mod_write (mod,DVC_VOL5R , val[5 ]); -rsnd_mod_write (mod,DVC_VOL6R , val[6 ]); -rsnd_mod_write (mod,DVC_VOL7R , val[7 ]); +for (i =0 ; i <RSND_MAX_CHANNELS ; i++) +rsnd_mod_write (mod,DVC_VOLxR (i), val[i]); } static void rsnd_dvc_volume_init(struct rsnd_dai_stream *io,
sound/soc/sh/rcar/gen.c +12 -11
@@ -26,8 +26,8 @@ struct rsnd_gen {struct regmap *regmap[RSND_BASE_MAX ];/* RSND_REG_MAX base */ -struct regmap_field *regs[RSND_REG_MAX ]; -const char *reg_name[RSND_REG_MAX ]; +struct regmap_field *regs[REG_MAX ]; +const char *reg_name[REG_MAX ]; };#define rsnd_priv_to_gen (p) ((struct rsnd_gen *)(p)->gen)
@@ -49,11 +49,11 @@ struct rsnd_regmap_field_conf { }/* single address mapping */ #define RSND_GEN_S_REG (id, offset) \ - RSND_REG_SET(RSND_REG_##id, offset, 0, #id) + RSND_REG_SET(id, offset, 0, #id)/* multi address mapping */ #define RSND_GEN_M_REG (id, offset, _id_offset) \ - RSND_REG_SET(RSND_REG_##id, offset, _id_offset, #id) + RSND_REG_SET(id, offset, _id_offset, #id)/* * basic function
@@ -79,9 +79,9 @@ static int rsnd_mod_id_cmd(struct rsnd_mod *mod)return rsnd_mod_id (mod); } -u32 rsnd_read (struct rsnd_priv *priv, -struct rsnd_mod *mod,enum rsnd_reg reg) +u32 rsnd_mod_read (struct rsnd_mod *mod,enum rsnd_reg reg) { +struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_gen *gen =rsnd_priv_to_gen (priv);u32 val;
@@ -98,10 +98,10 @@ u32 rsnd_read(struct rsnd_priv *priv,return val; } -void rsnd_write (struct rsnd_priv *priv, -struct rsnd_mod *mod, -enum rsnd_reg reg,u32 data) +void rsnd_mod_write (struct rsnd_mod *mod, +enum rsnd_reg reg,u32 data) { +struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_gen *gen =rsnd_priv_to_gen (priv);
@@ -115,9 +115,10 @@ void rsnd_write(struct rsnd_priv *priv, rsnd_reg_name(gen, reg), reg, data); } -void rsnd_bset (struct rsnd_priv *priv,struct rsnd_mod *mod, -enum rsnd_reg reg,u32 mask,u32 data) +void rsnd_mod_bset (struct rsnd_mod *mod, +enum rsnd_reg reg,u32 mask,u32 data) { +struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_gen *gen =rsnd_priv_to_gen (priv);
sound/soc/sh/rcar/rsnd.h +164 -165
349 lines not on this page · raw message
sound/soc/sh/rcar/ssiu.c +14 -45
79 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 39/57 ASoC: rsnd: remove RSND_REG_ from rsnd_reg
Hi!
Quoted 13 lines
From: Kuninori Morimoto <[email protected]>
commit
b7169ddea2f2a90538f606688adf4948f2da82ceupstream.Current rsnd is using
RSND_REG_xxxfor register naming, and using RSND_REG_##f style macro for read/write. The biggest reason why it uses this style is that
we can avoid non-existing register access.
But, its demerit is sequential register access code will be very ugly.
Current rsnd driver is well tested, so, let's removeRSND_REG_fromrsnd_reg, and cleanup sequential register access code.
sound/soc/sh/rcar/rsnd.h line 212
Quoted 9 lines
sound/soc/sh/rcar/rsnd.h +9
-0+#define SRCIN_TIMSEL (i) (SRCIN_TIMSEL0 + (i)) +#define SRCOUT_TIMSEL (i) (SRCOUT_TIMSEL0 + (i)) +#define CTU_SVxxR (i, j) (CTU_SV00R + (i * 8) + (j)) +#define DVC_VOLxR (i) (DVC_VOL0R + (i)) +#define AUDIO_CLK_SEL (i) (AUDIO_CLK_SEL0 + (i)) +#define SSI_BUSIF_MODE (i) (SSI_BUSIF0_MODE + (i)) +#define SSI_BUSIF_ADINR (i) (SSI_BUSIF0_ADINR + (i)) +#define SSI_BUSIF_DALIGN (i) (SSI_BUSIF0_DALIGN + (i)) +#define SSI_SYS_STATUS (i) (SSI_SYS_STATUS0 + (i))
Would it still make sense to test that i is in expected range?
#define CHECK_RANGE(i) ({ WARN_ON(i<0 || i>4); i; })
#define SRCIN_TIMSEL(i) (SRCIN_TIMSEL0 + (i))
...
Thanks and best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191025/71f59fad/attachment.sig>
PATCH 39/57 ASoC: rsnd: remove RSND_REG_ from rsnd_reg
Hi Pavel
Quoted 12 lines
sound/soc/sh/rcar/rsnd.h line 212
Quoted 9 lines
sound/soc/sh/rcar/rsnd.h +9
-0+#define SRCIN_TIMSEL (i) (SRCIN_TIMSEL0 + (i)) +#define SRCOUT_TIMSEL (i) (SRCOUT_TIMSEL0 + (i)) +#define CTU_SVxxR (i, j) (CTU_SV00R + (i * 8) + (j)) +#define DVC_VOLxR (i) (DVC_VOL0R + (i)) +#define AUDIO_CLK_SEL (i) (AUDIO_CLK_SEL0 + (i)) +#define SSI_BUSIF_MODE (i) (SSI_BUSIF0_MODE + (i)) +#define SSI_BUSIF_ADINR (i) (SSI_BUSIF0_ADINR + (i)) +#define SSI_BUSIF_DALIGN (i) (SSI_BUSIF0_DALIGN + (i)) +#define SSI_SYS_STATUS (i) (SSI_SYS_STATUS0 + (i))Would it still make sense to test that i is in expected range?
Quoted 2 lines
#define
CHECK_RANGE(i)({WARN_ON(i<0 || i>4); i; })
#defineSRCIN_TIMSEL(i)(SRCIN_TIMSEL0+ (i))
Which range ?? for SRCIN ?
I'm not sure it make sense. Can you send use case ??
Thank you for your help !!
Best regards
---
Kuninori Morimoto
PATCH 40/57 ASoC: rsnd: update BSDSR/BSDISR handling
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 7674bec4fc09e85803a8f2bd26a013d0076a80a9 upstream.
Current BSDSR/BSDISR are using temporary/generic settings, but it can't handle all SRCx/SoC. It needs to handle correctry. Otherwise, sampling rate converted sound channel will be broken if it was TDM. One note is that it needs to overwrite settings on E3 case.
--- sound/soc/sh/rcar/src.c | 125 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 115 insertions(+), 10 deletions(-)
sound/soc/sh/rcar/src.c +115 -10
@@ -14,6 +14,7 @@*/ #include "rsnd.h" +#include <linux/sys_soc.h> #define SRC_NAME "src"
@@ -134,20 +135,83 @@ unsigned int rsnd_src_get_rate(struct rsnd_priv *priv,return rate; } +const static u32 bsdsr_table_pattern1[] = { +0x01800000 ,/* 6 - 1/6 */ +0x01000000 ,/* 6 - 1/4 */ +0x00c00000 ,/* 6 - 1/3 */ +0x00800000 ,/* 6 - 1/2 */ +0x00600000 ,/* 6 - 2/3 */ +0x00400000 ,/* 6 - 1 */ +}; + +const static u32 bsdsr_table_pattern2[] = { +0x02400000 ,/* 6 - 1/6 */ +0x01800000 ,/* 6 - 1/4 */ +0x01200000 ,/* 6 - 1/3 */ +0x00c00000 ,/* 6 - 1/2 */ +0x00900000 ,/* 6 - 2/3 */ +0x00600000 ,/* 6 - 1 */ +}; + +const static u32 bsisr_table[] = { +0x00100060 ,/* 6 - 1/6 */ +0x00100040 ,/* 6 - 1/4 */ +0x00100030 ,/* 6 - 1/3 */ +0x00100020 ,/* 6 - 1/2 */ +0x00100020 ,/* 6 - 2/3 */ +0x00100020 ,/* 6 - 1 */ +}; + +const static u32 chan288888[] = { +0x00000006 ,/* 1 to 2 */ +0x000001fe ,/* 1 to 8 */ +0x000001fe ,/* 1 to 8 */ +0x000001fe ,/* 1 to 8 */ +0x000001fe ,/* 1 to 8 */ +0x000001fe ,/* 1 to 8 */ +}; + +const static u32 chan244888[] = { +0x00000006 ,/* 1 to 2 */ +0x0000001e ,/* 1 to 4 */ +0x0000001e ,/* 1 to 4 */ +0x000001fe ,/* 1 to 8 */ +0x000001fe ,/* 1 to 8 */ +0x000001fe ,/* 1 to 8 */ +}; + +const static u32 chan222222[] = { +0x00000006 ,/* 1 to 2 */ +0x00000006 ,/* 1 to 2 */ +0x00000006 ,/* 1 to 2 */ +0x00000006 ,/* 1 to 2 */ +0x00000006 ,/* 1 to 2 */ +0x00000006 ,/* 1 to 2 */ +}; + +static const struct soc_device_attribute ov_soc[] = { + { .soc_id ="r8a77990" },/* E3 */ + {/* sentinel */ } +}; +static void rsnd_src_set_convert_rate (struct rsnd_dai_stream *io,struct rsnd_mod *mod) {struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv);struct snd_pcm_runtime *runtime =rsnd_io_to_runtime (io); +const struct soc_device_attribute *soc =soc_device_match (ov_soc);int is_play =rsnd_io_is_play (io);int use_src =0 ;u32 fin, fout;u32 ifscr, fsrate, adinr;u32 cr, route; -u32 bsdsr, bsisr;u32 i_busif, o_busif, tmp; +const u32 *bsdsr_table; +const u32 *chptn;uint ratio; +int chan; +int idx;if (!runtime)return ;
@@ -155,6 +219,8 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io, fin =rsnd_src_get_in_rate (priv, io); fout =rsnd_src_get_out_rate (priv, io); + chan =rsnd_runtime_channel_original (io); +/* 6 - 1/6 are very enough ratio for SRC_BSDSR */ if (fin == fout) ratio =0 ;
@@ -173,8 +239,7 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io,/* * SRC_ADINR */ - adinr =rsnd_get_adinr_bit (mod, io) | -rsnd_runtime_channel_original (io); + adinr =rsnd_get_adinr_bit (mod, io) | chan;/* * SRC_IFSCR / SRC_IFSVR
@@ -207,21 +272,56 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io,/* * SRC_BSDSR / SRC_BSISR +* +* see +* Combination of Register Setting Related to +* FSO/FSI Ratio and Channel, Latency */ switch (rsnd_mod_id (mod)) { +case 0 : + chptn = chan288888; + bsdsr_table = bsdsr_table_pattern1; +break ; +case 1 : +case 3 : +case 4 : + chptn = chan244888; + bsdsr_table = bsdsr_table_pattern1; +break ; +case 2 : +case 9 : + chptn = chan222222; + bsdsr_table = bsdsr_table_pattern1; +break ;case 5 :case 6 :case 7 :case 8 : - bsdsr =0x02400000 ;/* 6 - 1/6 */ - bsisr =0x00100060 ;/* 6 - 1/6 */ + chptn = chan222222; + bsdsr_table = bsdsr_table_pattern2;break ;default : - bsdsr =0x01800000 ;/* 6 - 1/6 */ - bsisr =0x00100060 ;/* 6 - 1/6 */ -break ; + goto convert_rate_err; } +/* +* E3 need to overwrite +*/ +if (soc) +switch (rsnd_mod_id (mod)) { +case 0 : +case 4 : + chptn = chan222222; + } + +for (idx =0 ; idx <ARRAY_SIZE (chan222222); idx++) +if (chptn[idx] & (1 << chan)) +break ; + +if (chan >8 || + idx >=ARRAY_SIZE (chan222222)) + goto convert_rate_err; +/* BUSIF_MODE */ tmp =rsnd_get_busif_shift (io, mod); i_busif = ( is_play ? tmp :0 ) |1 ;
@@ -234,8 +334,8 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io,rsnd_mod_write (mod,SRC_IFSCR , ifscr);rsnd_mod_write (mod,SRC_IFSVR , fsrate);rsnd_mod_write (mod,SRC_SRCCR , cr); -rsnd_mod_write (mod,SRC_BSDSR , bsdsr); -rsnd_mod_write (mod,SRC_BSISR , bsisr); +rsnd_mod_write (mod,SRC_BSDSR , bsdsr_table[idx]); +rsnd_mod_write (mod,SRC_BSISR , bsisr_table[idx]);rsnd_mod_write (mod,SRC_SRCIR ,0 );/* cancel initialize */ rsnd_mod_write (mod,SRC_I_BUSIF_MODE , i_busif);
@@ -244,6 +344,11 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io,rsnd_mod_write (mod,SRC_BUSIF_DALIGN ,rsnd_get_dalign (mod, io));rsnd_adg_set_src_timesel_gen2 (mod, io, fin, fout); + +return ; + +convert_rate_err: +dev_err (dev,"unknown BSDSR/BSDIR settings\n" ); } static int rsnd_src_irq(struct rsnd_mod *mod,
Signature · 1 line
2.7.4
PATCH 40/57 ASoC: rsnd: update BSDSR/BSDISR handling
Hi!
Quoted 10 lines
Current BSDSR/BSDISR are using temporary/generic settings, but it can't handle all SRCx/SoC. It needs to handle correctry. Otherwise, sampling rate converted sound channel will be broken if it was TDM. One note is that it needs to overwrite settings on E3 case.
Signed-off-by Kuninori Morimoto <[email protected]>static void rsnd_src_set_convert_rate(struct
rsnd_dai_stream*io,
structrsnd_mod*mod)
{
...
Quoted 3 lines
sound/soc/sh/rcar/src.c +3
-0+if (chan >8 || + idx >=ARRAY_SIZE (chan222222)) + goto convert_rate_err;
...
sound/soc/sh/rcar/src.c static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io, · line 352
Quoted 10 lines
sound/soc/sh/rcar/src.c +5
-0@@ -244,6 +344,11 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io,rsnd_mod_write (mod,SRC_BUSIF_DALIGN ,rsnd_get_dalign (mod, io));rsnd_adg_set_src_timesel_gen2 (mod, io, fin, fout); + +return ; + +convert_rate_err: +dev_err (dev,"unknown BSDSR/BSDIR settings\n" ); }
If error happens, would it make sense to propagate it back to the caller?
Best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191027/8581ba07/attachment.sig>
PATCH 41/57 ASoC: rsnd: fixup MIX kctrl registration
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 7aea8a9d71d54f449f49e20324df06341cc18395 upstream.
Renesas sound device has many IPs and many situations. If platform/board uses MIXer, situation will be more complex. To avoid duplicate DVC kctrl registration when MIXer was used, it had original flags.
But it was issue when sound card was re-binded, because no one can't cleanup this flags then.
To solve this issue, commit 9c698e8481a15237a ("ASoC: rsnd: tidyup registering method for rsnd_kctrl_new()") checks registered card->controls, because if card was re-binded, these were cleanuped automatically. This patch could solve re-binding issue. But, it start to avoid MIX kctrl.
To solve these issues, we need below.
To avoid card re-binding issue: check registered card->controls To avoid duplicate DVC registration: check registered rsnd_kctrl_cfg To allow multiple MIX registration: check registered rsnd_kctrl_cfg This patch do it.
--- sound/soc/sh/rcar/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/sh/rcar/core.c +4 -4
@@ -1520,14 +1520,14 @@ int rsnd_kctrl_new(struct rsnd_mod *mod,int ret;/* -* 1) Avoid duplicate register (ex. MIXer case) -* 2) re-register if card was rebinded +* 1) Avoid duplicate register for DVC with MIX case +* 2) Allow duplicate register for MIX +* 3) re-register if card was rebinded */ list_for_each_entry (kctrl, &card->controls, list) {struct rsnd_kctrl_cfg *c = kctrl->private_data; -if (strcmp (kctrl->id.name, name) ==0 && - c->mod == mod) +if (c == cfg)return 0 ; }
Signature · 1 line
2.7.4
PATCH 42/57 ASoC: rsnd: synchronize connection check for simple-card/audio-graph
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit f497c88b195eaee8733a304f2a1dc27fb319c9c3 upstream.
Current rsnd driver has below function to check connection
rsnd_parse_connect_simple() rsnd_parse_connect_graph()
But these have different parameters. This patch synchronize these for cleanup.
--- sound/soc/sh/rcar/core.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
sound/soc/sh/rcar/core.c +7 -8
@@ -1026,16 +1026,13 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { };static void rsnd_parse_connect_simple (struct rsnd_priv *priv, -struct device_node *dai_np, -int dai_i,int is_play) +struct rsnd_dai_stream *io, +struct device_node *dai_np) {struct device *dev =rsnd_priv_to_dev (priv); -struct rsnd_dai *rdai =rsnd_rdai_get (priv, dai_i); -struct rsnd_dai_stream *io = is_play ? - &rdai->playback : - &rdai->capture;struct device_node *ssiu_np =rsnd_ssiu_of_node (priv);struct device_node *np; +int is_play =rsnd_io_is_play (io);int i, j;if (!ssiu_np)
@@ -1286,8 +1283,10 @@ static int rsnd_dai_probe(struct rsnd_priv *priv)for_each_child_of_node (dai_node, dai_np) {__rsnd_dai_probe (priv, dai_np, dai_i);if (rsnd_is_gen3 (priv)) { -rsnd_parse_connect_simple (priv, dai_np, dai_i,1 ); -rsnd_parse_connect_simple (priv, dai_np, dai_i,0 ); +struct rsnd_dai *rdai =rsnd_rdai_get (priv, dai_i); + +rsnd_parse_connect_simple (priv, &rdai->playback, dai_np); +rsnd_parse_connect_simple (priv, &rdai->capture, dai_np); } dai_i++; }
Signature · 1 line
2.7.4
PATCH 43/57 ASoC: rsnd: fixup TDM Split mode check for CTU
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 2264cf2e5db99cdff995592bf80ab6dea567ea91 upstream.
Renesas sound card need to judge that whether it is using "TDM Split mode". To judge it and for other purpose, it has rsnd_parse_connect_simple() and rsnd_parse_connect_graph(), but these are using different judgement policy for TDM Split mode.
It is pointless and confusable.
This patch add new rsnd_parse_tdm_split_mode() and use common judgement policy for simple-card/audio-graph.
Without this patch, CTU will be judged as TDM Split mode on audio-graph card.
--- sound/soc/sh/rcar/core.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
sound/soc/sh/rcar/core.c +12 -13
@@ -1025,7 +1025,7 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { .prepare = rsnd_soc_dai_prepare, }; -static void rsnd_parse_connect_simple (struct rsnd_priv *priv, +static void rsnd_parse_tdm_split_mode (struct rsnd_priv *priv,struct rsnd_dai_stream *io,struct device_node *dai_np) {
@@ -1038,9 +1038,6 @@ static void rsnd_parse_connect_simple(struct rsnd_priv *priv,if (!ssiu_np)return ; -if (!rsnd_io_to_mod_ssi (io)) -return ; -/* * This driver assumes that it is TDM Split mode * if it includes ssiu node
@@ -1065,12 +1062,21 @@ static void rsnd_parse_connect_simple(struct rsnd_priv *priv, } } +static void rsnd_parse_connect_simple (struct rsnd_priv *priv, +struct rsnd_dai_stream *io, +struct device_node *dai_np) +{ +if (!rsnd_io_to_mod_ssi (io)) +return ; + +rsnd_parse_tdm_split_mode (priv, io, dai_np); +} +static void rsnd_parse_connect_graph (struct rsnd_priv *priv,struct rsnd_dai_stream *io,struct device_node *endpoint) {struct device *dev =rsnd_priv_to_dev (priv); -struct device_node *remote_port =of_graph_get_remote_port (endpoint);struct device_node *remote_node =of_graph_get_remote_port_parent (endpoint);if (!rsnd_io_to_mod_ssi (io))
@@ -1088,14 +1094,7 @@ static void rsnd_parse_connect_graph(struct rsnd_priv *priv,dev_dbg (dev,"%s connected to HDMI1\n" , io->name); } -/* -* This driver assumes that it is TDM Split mode -* if remote node has multi endpoint -*/ -if (of_get_child_count (remote_port) >1 ) { -rsnd_flags_set (io,RSND_STREAM_TDM_SPLIT ); -dev_dbg (dev,"%s is part of TDM Split\n" , io->name); - } +rsnd_parse_tdm_split_mode (priv, io, endpoint); } void rsnd_parse_connect_common(struct rsnd_dai *rdai,
Signature · 1 line
2.7.4
PATCH 44/57 ASoC: sh: Avoid passing NULL to memory allocators
In reply to Biju DasFrom: Takashi Iwai <[email protected]>
commit 8f74ae398aa0b96207de366e9a723517e440e590 upstream.
We should pass a proper non-NULL device object to memory allocators
although it was accepted in the past. The card->dev points to the most appropriate device object in such a case, so let's put it.
--- sound/soc/sh/siu_pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sh/siu_pcm.c +1 -1
@@ -542,7 +542,7 @@ static int siu_pcm_new(struct snd_soc_pcm_runtime *rtd)return ret; ret =snd_pcm_lib_preallocate_pages_for_all (pcm, -SNDRV_DMA_TYPE_DEV ,NULL , +SNDRV_DMA_TYPE_DEV , card->dev,SIU_BUFFER_BYTES_MAX ,SIU_BUFFER_BYTES_MAX );if (ret <0 ) { dev_err(card->dev,
Signature · 1 line
2.7.4
PATCH 45/57 ASoC: sh: Drop superfluous PCM preallocation error checks
In reply to Biju DasFrom: Takashi Iwai <[email protected]>
commit b76c7fe6c99d427a064e5e152dca7fe24f424f53 upstream.
snd_pcm_lib_preallocate_pages() and co always succeed, so the error check is simply redundant. Drop it.
--- sound/soc/sh/fsi.c | 3 ++- sound/soc/sh/rcar/core.c | 5 +---- sound/soc/sh/siu_pcm.c | 13 +------------ 3 files changed, 4 insertions(+), 17 deletions(-)
sound/soc/sh/fsi.c +2 -1
@@ -1768,11 +1768,12 @@ static const struct snd_pcm_ops fsi_pcm_ops = {static int fsi_pcm_new (struct snd_soc_pcm_runtime *rtd) { -return snd_pcm_lib_preallocate_pages_for_all ( +snd_pcm_lib_preallocate_pages_for_all ( rtd->pcm,SNDRV_DMA_TYPE_DEV , rtd->card->snd_card->dev,PREALLOC_BUFFER ,PREALLOC_BUFFER_MAX ); +return 0 ; }/*
sound/soc/sh/rcar/core.c +1 -4
@@ -1567,7 +1567,6 @@ static int rsnd_preallocate_pages(struct snd_soc_pcm_runtime *rtd,struct rsnd_priv *priv =rsnd_io_to_priv (io);struct device *dev =rsnd_priv_to_dev (priv);struct snd_pcm_substream *substream; -int err;/* * use Audio-DMAC dev if we can use IPMMU
@@ -1580,12 +1579,10 @@ static int rsnd_preallocate_pages(struct snd_soc_pcm_runtime *rtd,for (substream = rtd->pcm->streams[stream].substream; substream; substream = substream->next) { - err =snd_pcm_lib_preallocate_pages (substream, +snd_pcm_lib_preallocate_pages (substream,SNDRV_DMA_TYPE_DEV , dev,PREALLOC_BUFFER ,PREALLOC_BUFFER_MAX ); -if (err <0 ) -return err; }return 0 ;
sound/soc/sh/siu_pcm.c +1 -12
@@ -541,15 +541,9 @@ static int siu_pcm_new(struct snd_soc_pcm_runtime *rtd)if (ret <0 )return ret; - ret =snd_pcm_lib_preallocate_pages_for_all (pcm, +snd_pcm_lib_preallocate_pages_for_all (pcm,SNDRV_DMA_TYPE_DEV , card->dev,SIU_BUFFER_BYTES_MAX ,SIU_BUFFER_BYTES_MAX ); -if (ret <0 ) { -dev_err (card->dev, -"snd_pcm_lib_preallocate_pages_for_all() err=%d" , - ret); - goto fail; - } (*port_info)->pcm = pcm;
@@ -562,11 +556,6 @@ static int siu_pcm_new(struct snd_soc_pcm_runtime *rtd)dev_info (card->dev,"SuperH SIU driver initialized.\n" );return 0 ; - -fail: -siu_free_port (siu_ports[pdev->id]); -dev_err (card->dev,"SIU: failed to initialize.\n" ); -return ret; }static void siu_pcm_free (struct snd_pcm *pcm)
Signature · 1 line
2.7.4
PATCH 46/57 ASoC: rsnd: ssiu: correct shift bit for ssiu9
In reply to Biju DasFrom: Jiada Wang <[email protected]>
commit 76379dfbfd7c8fd7dd29eea3f828cf85c884829e upstream.
Currently "0xf << 36" is used to
clear SSIU-9 internal buffer state, which overflows 32-bit value according to user reference manual, it is always bit4 ~ bit7 of SSI_SYS_STATUS[1,3,5,7] registers indicate
SSIU-9's buffer state, so "0xf << 4" should be used.
This patch fix incorrect shifting issue in SSIU-9 case
--- sound/soc/sh/rcar/ssiu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sh/rcar/ssiu.c +1 -1
@@ -79,7 +79,7 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod,break ;case 9 :for (i =0 ; i <4 ; i++) -rsnd_mod_write (mod,SSI_SYS_STATUS ((i *2 ) +1 ),0xf << (id *4 )); +rsnd_mod_write (mod,SSI_SYS_STATUS ((i *2 ) +1 ),0xf <<4 );break ; }
Signature · 1 line
2.7.4
PATCH 47/57 ASoC: rsnd: gen: fix SSI9 4/5/6/7 busif related register address
In reply to Biju DasFrom: Jiada Wang <[email protected]>
commit 8af6c521cc236534093f9e744cfa004314bfe5ae upstream.
Currently each SSI unit 's busif mode/adinr/dalign address is registered by: (in busif4 case) RSND_GEN_M_REG(SSI_BUSIF4_MODE, 0x500, 0x80) RSND_GEN_M_REG(SSI_BUSIF4_ADINR,0x504, 0x80) RSND_GEN_M_REG(SSI_BUSIF4_DALIGN, 0x508, 0x80)
But according to user manual 41.1.4 Register Configuration ssi9 4/5/6/7 busif mode/adinr/dalign register address ( SSI9-[4/5/6/7]_BUSIF_[MODE/ADINR/DALIGN] )
are out of this rule.
This patch registers ssi9 4/5/6/7 mode/adinr/dalign register as single register, and access these registers in case of SSI9 BUSIF 4/5/6/7.
--- sound/soc/sh/rcar/gen.c | 24 ++++++++++++++++++++++++ sound/soc/sh/rcar/rsnd.h | 27 +++++++++++++++++++++++++++ sound/soc/sh/rcar/ssiu.c | 24 +++++++++++------------- 3 files changed, 62 insertions(+), 13 deletions(-)
sound/soc/sh/rcar/gen.c +24 -0
@@ -255,6 +255,30 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv)RSND_GEN_M_REG (SSI_MODE ,0xc ,0x80 ),RSND_GEN_M_REG (SSI_CTRL ,0x10 ,0x80 ),RSND_GEN_M_REG (SSI_INT_ENABLE ,0x18 ,0x80 ), +RSND_GEN_S_REG (SSI9_BUSIF0_MODE ,0x48c ), +RSND_GEN_S_REG (SSI9_BUSIF0_ADINR ,0x484 ), +RSND_GEN_S_REG (SSI9_BUSIF0_DALIGN ,0x488 ), +RSND_GEN_S_REG (SSI9_BUSIF1_MODE ,0x4a0 ), +RSND_GEN_S_REG (SSI9_BUSIF1_ADINR ,0x4a4 ), +RSND_GEN_S_REG (SSI9_BUSIF1_DALIGN ,0x4a8 ), +RSND_GEN_S_REG (SSI9_BUSIF2_MODE ,0x4c0 ), +RSND_GEN_S_REG (SSI9_BUSIF2_ADINR ,0x4c4 ), +RSND_GEN_S_REG (SSI9_BUSIF2_DALIGN ,0x4c8 ), +RSND_GEN_S_REG (SSI9_BUSIF3_MODE ,0x4e0 ), +RSND_GEN_S_REG (SSI9_BUSIF3_ADINR ,0x4e4 ), +RSND_GEN_S_REG (SSI9_BUSIF3_DALIGN ,0x4e8 ), +RSND_GEN_S_REG (SSI9_BUSIF4_MODE ,0xd80 ), +RSND_GEN_S_REG (SSI9_BUSIF4_ADINR ,0xd84 ), +RSND_GEN_S_REG (SSI9_BUSIF4_DALIGN ,0xd88 ), +RSND_GEN_S_REG (SSI9_BUSIF5_MODE ,0xda0 ), +RSND_GEN_S_REG (SSI9_BUSIF5_ADINR ,0xda4 ), +RSND_GEN_S_REG (SSI9_BUSIF5_DALIGN ,0xda8 ), +RSND_GEN_S_REG (SSI9_BUSIF6_MODE ,0xdc0 ), +RSND_GEN_S_REG (SSI9_BUSIF6_ADINR ,0xdc4 ), +RSND_GEN_S_REG (SSI9_BUSIF6_DALIGN ,0xdc8 ), +RSND_GEN_S_REG (SSI9_BUSIF7_MODE ,0xde0 ), +RSND_GEN_S_REG (SSI9_BUSIF7_ADINR ,0xde4 ), + RSND_GEN_S_REG(SSI9_BUSIF7_DALIGN, 0xde8), }; static const struct rsnd_regmap_field_conf conf_scu[] = {
sound/soc/sh/rcar/rsnd.h +27 -0
@@ -191,6 +191,30 @@ enum rsnd_reg {SSI_SYS_STATUS7 ,HDMI0_SEL ,HDMI1_SEL , +SSI9_BUSIF0_MODE , +SSI9_BUSIF1_MODE , +SSI9_BUSIF2_MODE , +SSI9_BUSIF3_MODE , +SSI9_BUSIF4_MODE , +SSI9_BUSIF5_MODE , +SSI9_BUSIF6_MODE , +SSI9_BUSIF7_MODE , +SSI9_BUSIF0_ADINR , +SSI9_BUSIF1_ADINR , +SSI9_BUSIF2_ADINR , +SSI9_BUSIF3_ADINR , +SSI9_BUSIF4_ADINR , +SSI9_BUSIF5_ADINR , +SSI9_BUSIF6_ADINR , +SSI9_BUSIF7_ADINR , +SSI9_BUSIF0_DALIGN , +SSI9_BUSIF1_DALIGN , +SSI9_BUSIF2_DALIGN , +SSI9_BUSIF3_DALIGN , +SSI9_BUSIF4_DALIGN , +SSI9_BUSIF5_DALIGN , +SSI9_BUSIF6_DALIGN , +SSI9_BUSIF7_DALIGN ,/* SSI */ SSICR,
@@ -209,6 +233,9 @@ enum rsnd_reg {#define SSI_BUSIF_MODE (i) (SSI_BUSIF0_MODE + (i))#define SSI_BUSIF_ADINR (i) (SSI_BUSIF0_ADINR + (i))#define SSI_BUSIF_DALIGN (i) (SSI_BUSIF0_DALIGN + (i)) +#define SSI9_BUSIF_MODE (i) (SSI9_BUSIF0_MODE + (i)) +#define SSI9_BUSIF_ADINR (i) (SSI9_BUSIF0_ADINR + (i)) +#define SSI9_BUSIF_DALIGN (i) (SSI9_BUSIF0_DALIGN + (i))#define SSI_SYS_STATUS (i) (SSI_SYS_STATUS0 + (i))
sound/soc/sh/rcar/ssiu.c +11 -13
@@ -181,28 +181,26 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,if (rsnd_ssi_use_busif (io)) {int id =rsnd_mod_id (mod);int busif =rsnd_mod_id_sub (mod); +enum rsnd_reg adinr_reg, mode_reg, dalign_reg; -/* -* FIXME -* -* We can't support SSI9-4/5/6/7, because its address is -* out of calculation rule -*/ if ((id ==9 ) && (busif >=4 )) { -struct device *dev =rsnd_priv_to_dev (priv); - -dev_err (dev,"This driver doesn't support SSI%d-%d, so far" , - id, busif); + adinr_reg =SSI9_BUSIF_ADINR (busif); + mode_reg =SSI9_BUSIF_MODE (busif); + dalign_reg =SSI9_BUSIF_DALIGN (busif); + }else { + adinr_reg =SSI_BUSIF_ADINR (busif); + mode_reg =SSI_BUSIF_MODE (busif); + dalign_reg =SSI_BUSIF_DALIGN (busif); } -rsnd_mod_write (mod,SSI_BUSIF_ADINR (busif), +rsnd_mod_write (mod, adinr_reg,rsnd_get_adinr_bit (mod, io) | (rsnd_io_is_play (io) ?rsnd_runtime_channel_after_ctu (io) :rsnd_runtime_channel_original (io))); -rsnd_mod_write (mod,SSI_BUSIF_MODE (busif), +rsnd_mod_write (mod, mode_reg,rsnd_get_busif_shift (io, mod) |1 ); -rsnd_mod_write (mod,SSI_BUSIF_DALIGN (busif), +rsnd_mod_write (mod, dalign_reg,rsnd_get_dalign (mod, io)); }
Signature · 1 line
2.7.4
PATCH 48/57 ASoC: rsnd: src: Avoid a potential deadlock
In reply to Biju DasFrom: Jiada Wang <[email protected]>
commit ba164a49f8f7390b036713bf8a70a150a938c670 upstream.
lockdep warns us that priv->lock and k->k_lock can cause a deadlock when after acquire of k->k_lock, process is interrupted by src, while in another routine of src .init, k->k_lock is acquired with priv->lock held.
This patch avoids a potential deadlock by not calling soc_device_match() in SRC .init callback, instead it adds new soc fields in priv->flags to differentiate SoCs.
--- sound/soc/sh/rcar/core.c | 2 ++ sound/soc/sh/rcar/rsnd.h | 5 +++++ sound/soc/sh/rcar/src.c | 9 +-------- 3 files changed, 8 insertions(+), 8 deletions(-)
sound/soc/sh/rcar/core.c +2 -0
@@ -110,6 +110,8 @@ static const struct of_device_id rsnd_of_match[] = { { .compatible = "renesas,rcar_sound-gen1", .data = (void *)RSND_GEN1 }, { .compatible = "renesas,rcar_sound-gen2", .data = (void *)RSND_GEN2 }, { .compatible = "renesas,rcar_sound-gen3", .data = (void *)RSND_GEN3 }, + /* Special Handling */ + { .compatible = "renesas,rcar_sound-r8a77990", .data = (void *)(RSND_GEN3 | RSND_SOC_E) }, {}, };MODULE_DEVICE_TABLE (of, rsnd_of_match);
sound/soc/sh/rcar/rsnd.h +5 -0
@@ -607,6 +607,8 @@ struct rsnd_priv {#define RSND_GEN1 (1 << 0)#define RSND_GEN2 (2 << 0)#define RSND_GEN3 (3 << 0) +#define RSND_SOC_MASK (0xFF << 4) +#define RSND_SOC_E (1 << 4)/* E1/E2/E3 */ /* * below value will be filled on rsnd_gen_probe()
@@ -679,6 +681,9 @@ struct rsnd_priv {#define rsnd_is_gen1 (priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN1)#define rsnd_is_gen2 (priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN2)#define rsnd_is_gen3 (priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN3) +#define rsnd_is_e3 (priv) (((priv)->flags & \ + (RSND_GEN_MASK | RSND_SOC_MASK)) == \ + (RSND_GEN3 | RSND_SOC_E))#define rsnd_flags_has (p, f) ((p)->flags & (f))#define rsnd_flags_set (p, f) ((p)->flags |= (f))
sound/soc/sh/rcar/src.c +1 -8
@@ -14,7 +14,6 @@*/ #include "rsnd.h" -#include <linux/sys_soc.h> #define SRC_NAME "src"
@@ -189,18 +188,12 @@ const static u32 chan222222[] = { 0x00000006, /* 1 to 2 */ }; -static const struct soc_device_attribute ov_soc[] = { - { .soc_id ="r8a77990" },/* E3 */ - {/* sentinel */ } -}; -static void rsnd_src_set_convert_rate (struct rsnd_dai_stream *io,struct rsnd_mod *mod) {struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv);struct snd_pcm_runtime *runtime =rsnd_io_to_runtime (io); -const struct soc_device_attribute *soc =soc_device_match (ov_soc);int is_play =rsnd_io_is_play (io);int use_src =0 ;u32 fin, fout;
@@ -307,7 +300,7 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io,/* * E3 need to overwrite */ -if (soc) +if (rsnd_is_e3 (priv))switch (rsnd_mod_id (mod)) {case 0 :case 4 :
Signature · 1 line
2.7.4
PATCH 48/57 ASoC: rsnd: src: Avoid a potential deadlock
Quoted 4 lines · Biju Das
From: Jiada Wang <[email protected]>
commit
ba164a49f8f7390b036713bf8a70a150a938c670upstream.
Quoted 8 lines
lockdep warns us that
priv->lockandk->k_lockcan cause a deadlock when after acquire ofk->k_lock, process is interrupted by src, while in another routine of src .init,k->k_lockis acquired withpriv->lockheld.This patch avoids a potential deadlock by not calling
soc_device_match()in SRC .init callback, instead it adds new soc fields inpriv->flagsto differentiate SoCs.
Could this be moved near the patch it fixes? Or even merged to it? Introducing deadlocks is bad for bisection at the very least...
Best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191027/34db6ccb/attachment.sig>
PATCH 49/57 ASoC: rsnd: src: fix compiler warnings
In reply to Biju DasFrom: Jiada Wang <[email protected]>
commit 399706df420ea8bc8b31283a919e6475f737d0ea upstream.
compiler complains about following declarations
sound/soc/sh/rcar/src.c:174:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 bsdsr_table_pattern1[] = {
^~~~~sound/soc/sh/rcar/src.c:183:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 bsdsr_table_pattern2[] = {
^~~~~sound/soc/sh/rcar/src.c:192:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 bsisr_table[] = {
^~~~~sound/soc/sh/rcar/src.c:201:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 chan288888[] = {
^~~~~sound/soc/sh/rcar/src.c:210:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 chan244888[] = {
^~~~~sound/soc/sh/rcar/src.c:219:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 chan222222[] = {
^~~~~
This patch moves the 'static' keyword to the front of the declaration to fix the compiler warnings
--- sound/soc/sh/rcar/src.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/sh/rcar/src.c +6 -6
@@ -134,7 +134,7 @@ unsigned int rsnd_src_get_rate(struct rsnd_priv *priv,return rate; } -const static u32 bsdsr_table_pattern1[] = { +static const u32 bsdsr_table_pattern1[] = {0x01800000 ,/* 6 - 1/6 */ 0x01000000 ,/* 6 - 1/4 */ 0x00c00000 ,/* 6 - 1/3 */
@@ -143,7 +143,7 @@ const static u32 bsdsr_table_pattern1[] = { 0x00400000, /* 6 - 1 */ }; -const static u32 bsdsr_table_pattern2[] = { +static const u32 bsdsr_table_pattern2[] = {0x02400000 ,/* 6 - 1/6 */ 0x01800000 ,/* 6 - 1/4 */ 0x01200000 ,/* 6 - 1/3 */
@@ -152,7 +152,7 @@ const static u32 bsdsr_table_pattern2[] = { 0x00600000, /* 6 - 1 */ }; -const static u32 bsisr_table[] = { +static const u32 bsisr_table[] = {0x00100060 ,/* 6 - 1/6 */ 0x00100040 ,/* 6 - 1/4 */ 0x00100030 ,/* 6 - 1/3 */
@@ -161,7 +161,7 @@ const static u32 bsisr_table[] = { 0x00100020, /* 6 - 1 */ }; -const static u32 chan288888[] = { +static const u32 chan288888[] = {0x00000006 ,/* 1 to 2 */ 0x000001fe ,/* 1 to 8 */ 0x000001fe ,/* 1 to 8 */
@@ -170,7 +170,7 @@ const static u32 chan288888[] = { 0x000001fe, /* 1 to 8 */ }; -const static u32 chan244888[] = { +static const u32 chan244888[] = {0x00000006 ,/* 1 to 2 */ 0x0000001e ,/* 1 to 4 */ 0x0000001e ,/* 1 to 4 */
@@ -179,7 +179,7 @@ const static u32 chan244888[] = { 0x000001fe, /* 1 to 8 */ }; -const static u32 chan222222[] = { +static const u32 chan222222[] = {0x00000006 ,/* 1 to 2 */ 0x00000006 ,/* 1 to 2 */ 0x00000006 ,/* 1 to 2 */
Signature · 1 line
2.7.4
PATCH 49/57 ASoC: rsnd: src: fix compiler warnings
Hi!
Quoted 8 lines
From: Jiada Wang <[email protected]>
commit
399706df420ea8bc8b31283a919e6475f737d0eaupstream.compiler complains about following declarations
sound/soc/sh/rcar/src.c:174:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
const static u32 bsdsr_table_pattern1[] = {
I'd prefer this to be need the patch it fixes, too.
Thanks,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191027/45aee3e2/attachment.sig>
PATCH 50/57 ASoC: rsnd: fixup 6ch settings to 8ch
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 66287def435315d9d8de740da4c543e37630b897 upstream.
rsnd need to use 8ch clock settings for 6ch for TDM. Otherwise, it can't work correctly.
This patch fixup it.
--- sound/soc/sh/rcar/core.c | 18 +++++++++++++----- sound/soc/sh/rcar/rsnd.h | 1 + sound/soc/sh/rcar/ssi.c | 2 ++ 3 files changed, 16 insertions(+), 5 deletions(-)
sound/soc/sh/rcar/core.c +13 -5
@@ -300,6 +300,18 @@ int rsnd_runtime_channel_after_ctu_with_params(struct rsnd_dai_stream *io,return chan; } +int rsnd_channel_normalization (int chan) +{ +if ((chan >8 ) || (chan <0 )) +return 0 ; + +/* TDM Extend Mode needs 8ch */ +if (chan ==6 ) + chan =8 ; + +return chan; +} +int rsnd_runtime_channel_for_ssi_with_params (struct rsnd_dai_stream *io,struct snd_pcm_hw_params *params) {
@@ -312,11 +324,7 @@ int rsnd_runtime_channel_for_ssi_with_params(struct rsnd_dai_stream *io,if (rsnd_runtime_is_multi_ssi (io)) chan /=rsnd_rdai_ssi_lane_get (rdai); -/* TDM Extend Mode needs 8ch */ -if (chan ==6 ) - chan =8 ; - -return chan; +return rsnd_channel_normalization (chan); }int rsnd_runtime_is_multi_ssi (struct rsnd_dai_stream *io)
sound/soc/sh/rcar/rsnd.h +1 -0
@@ -446,6 +446,7 @@ void rsnd_parse_connect_common(struct rsnd_dai *rdai,struct device_node *playback, struct device_node *capture); +int rsnd_channel_normalization (int chan);#define rsnd_runtime_channel_original (io) \ rsnd_runtime_channel_original_with_params(io, NULL) int rsnd_runtime_channel_original_with_params(struct rsnd_dai_stream *io,
sound/soc/sh/rcar/ssi.c +2 -0
@@ -303,6 +303,8 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,if (rsnd_runtime_is_tdm_split (io)) chan =rsnd_io_converted_chan (io); + chan =rsnd_channel_normalization (chan); + main_rate =rsnd_ssi_clk_query (rdai, rate, chan, &idx);if (!main_rate) {dev_err (dev,"unsupported clock rate\n" );
Signature · 1 line
2.7.4
PATCH 50/57 ASoC: rsnd: fixup 6ch settings to 8ch
Quoted 7 lines · Biju Das
From: Kuninori Morimoto <[email protected]>
commit
66287def435315d9d8de740da4c543e37630b897upstream.rsnd need to use 8ch clock settings for 6ch for TDM. Otherwise, it can't work correctly.
This patch fixup it.
Ok, but...
sound/soc/sh/rcar/core.c int rsnd_runtime_channel_after_ctu_with_params(struct rsnd_dai_stream *io, · line 314
Quoted 12 lines
sound/soc/sh/rcar/core.c +12
-0+int rsnd_channel_normalization (int chan) +{ +if ((chan >8 ) || (chan <0 )) +return 0 ; + +/* TDM Extend Mode needs 8ch */ +if (chan ==6 ) + chan =8 ; + +return chan; +} +
Should the if ((chan > 8) || (chan < 0)) ever be true in practice? Sounds like bogus inputs to me. Should we dev_err() and return error in those cases? Or@least WARN_ON()?
Best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191027/26df021d/attachment.sig>
PATCH 50/57 ASoC: rsnd: fixup 6ch settings to 8ch
Hi Pavel
Quoted 8 lines
Quoted 8 lines
sound/soc/sh/rcar/core.c +8
-0+int rsnd_channel_normalization (int chan) +{ +if ((chan >8 ) || (chan <0 )) +return 0 ; + +/* TDM Extend Mode needs 8ch */ +if (chan ==6 ) + chan =8 ;
Quoted 8 lines
sound/soc/sh/rcar/core.c int rsnd_runtime_channel_after_ctu_with_params(struct rsnd_dai_stream *io, · line 314
Quoted 4 lines
sound/soc/sh/rcar/core.c +4
-0+ +return chan; +} +Should the if ((chan > 8) || (chan < 0)) ever be true in practice? Sounds like bogus inputs to me. Should we
dev_err()and return error in those cases? Or at leastWARN_ON()?
Hmm... indeed.
Thank you for your report.
I will re-check code, and post patch
Thank you for your help !!
Best regards
---
Kuninori Morimoto
PATCH 51/57 ASoC: rsnd: move pcm_new from snd_soc_component_driver to snd_soc_dai_driver
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit e9b5daad4e9bdd1b9e467873a4463c867ccf9ff1 upstream.
snd_soc_dai_driver :: pcm_new has snd_soc_dai as parameter, but snd_soc_component_driver :: pcm_new doesn't have it.
rsnd driver needs snd_soc_dai at pcm_new.
This patch moves .pcm_new from snd_soc_component_driver to snd_soc_dai_driver, and don't use rtd->cpu_dai anymore.
--- sound/soc/sh/rcar/core.c | 120 +++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 60 deletions(-)
sound/soc/sh/rcar/core.c +60 -60
@@ -1170,6 +1170,65 @@ static struct device_node *rsnd_dai_of_node(struct rsnd_priv *priv,return ret; } + +#define PREALLOC_BUFFER (32 * 1024) +#define PREALLOC_BUFFER_MAX (32 * 1024) + +static int rsnd_preallocate_pages (struct snd_soc_pcm_runtime *rtd, +struct rsnd_dai_stream *io, +int stream) +{ +struct rsnd_priv *priv =rsnd_io_to_priv (io); +struct device *dev =rsnd_priv_to_dev (priv); +struct snd_pcm_substream *substream; + +/* +* use Audio-DMAC dev if we can use IPMMU +* see +* rsnd_dmaen_attach() +*/ +if (io->dmac_dev) + dev = io->dmac_dev; + +for (substream = rtd->pcm->streams[stream].substream; + substream; + substream = substream->next) { +snd_pcm_lib_preallocate_pages (substream, +SNDRV_DMA_TYPE_DEV , + dev, +PREALLOC_BUFFER ,PREALLOC_BUFFER_MAX ); + } + +return 0 ; +} + +static int rsnd_pcm_new (struct snd_soc_pcm_runtime *rtd, +struct snd_soc_dai *dai) +{ +struct rsnd_dai *rdai =rsnd_dai_to_rdai (dai); +int ret; + + ret =rsnd_dai_call (pcm_new, &rdai->playback, rtd); +if (ret) +return ret; + + ret =rsnd_dai_call (pcm_new, &rdai->capture, rtd); +if (ret) +return ret; + + ret =rsnd_preallocate_pages (rtd, &rdai->playback, +SNDRV_PCM_STREAM_PLAYBACK ); +if (ret) +return ret; + + ret =rsnd_preallocate_pages (rtd, &rdai->capture, +SNDRV_PCM_STREAM_CAPTURE ); +if (ret) +return ret; + +return 0 ; +} +static void __rsnd_dai_probe (struct rsnd_priv *priv,struct device_node *dai_np,int dai_i)
@@ -1192,6 +1251,7 @@ static void __rsnd_dai_probe(struct rsnd_priv *priv, rdai->priv = priv; drv->name = rdai->name; drv->ops = &rsnd_soc_dai_ops; + drv->pcm_new = rsnd_pcm_new;snprintf (io_playback->name,RSND_DAI_NAME_SIZE ,"DAI%d Playback" , dai_i);
@@ -1566,68 +1626,8 @@ int rsnd_kctrl_new(struct rsnd_mod *mod,/* * snd_soc_component */ - -#define PREALLOC_BUFFER (32 * 1024) -#define PREALLOC_BUFFER_MAX (32 * 1024) - -static int rsnd_preallocate_pages (struct snd_soc_pcm_runtime *rtd, -struct rsnd_dai_stream *io, -int stream) -{ -struct rsnd_priv *priv =rsnd_io_to_priv (io); -struct device *dev =rsnd_priv_to_dev (priv); -struct snd_pcm_substream *substream; - -/* -* use Audio-DMAC dev if we can use IPMMU -* see -* rsnd_dmaen_attach() -*/ -if (io->dmac_dev) - dev = io->dmac_dev; - -for (substream = rtd->pcm->streams[stream].substream; - substream; - substream = substream->next) { -snd_pcm_lib_preallocate_pages (substream, -SNDRV_DMA_TYPE_DEV , - dev, -PREALLOC_BUFFER ,PREALLOC_BUFFER_MAX ); - } - -return 0 ; -} - -static int rsnd_pcm_new (struct snd_soc_pcm_runtime *rtd) -{ -struct snd_soc_dai *dai = rtd->cpu_dai; -struct rsnd_dai *rdai =rsnd_dai_to_rdai (dai); -int ret; - - ret =rsnd_dai_call (pcm_new, &rdai->playback, rtd); -if (ret) -return ret; - - ret =rsnd_dai_call (pcm_new, &rdai->capture, rtd); -if (ret) -return ret; - - ret =rsnd_preallocate_pages (rtd, &rdai->playback, -SNDRV_PCM_STREAM_PLAYBACK ); -if (ret) -return ret; - - ret =rsnd_preallocate_pages (rtd, &rdai->capture, -SNDRV_PCM_STREAM_CAPTURE ); -if (ret) -return ret; - -return 0 ; -} -static const struct snd_soc_component_driver rsnd_soc_component = { .ops = &rsnd_pcm_ops, - .pcm_new = rsnd_pcm_new, .name ="rsnd" , };
Signature · 1 line
2.7.4
PATCH 52/57 ASoC: rsnd: fixup mod ID calculation in rsnd_ctu_probe_
In reply to Biju DasFrom: Nilkanth Ahirrao <[email protected]>
commit ac28ec07ae1c5c1e18ed6855eb105a328418da88 upstream.
commit c16015f36cc1 ("ASoC: rsnd: add .get_id/.get_id_sub") introduces rsnd_ctu_id which calcualates and gives the main Device id of the CTU by dividing the id by 4. rsnd_mod_id uses this interface to get the CTU main Device id. But this commit forgets to revert the main Device id calcution previously done in rsnd_ctu_probe_ which also divides the id by 4. This path corrects the same to get the correct main Device id.
The issue is observered when rsnd_ctu_probe_ is done for CTU1
--- sound/soc/sh/rcar/ctu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sh/rcar/ctu.c +1 -1
@@ -108,7 +108,7 @@ static int rsnd_ctu_probe_(struct rsnd_mod *mod,struct rsnd_dai_stream *io, struct rsnd_priv *priv) { - return rsnd_cmd_attach(io, rsnd_mod_id(mod) / 4); + return rsnd_cmd_attach(io, rsnd_mod_id(mod)); } static void rsnd_ctu_value_init(struct rsnd_dai_stream *io,
Signature · 1 line
2.7.4
PATCH 52/57 ASoC: rsnd: fixup mod ID calculation in rsnd_ctu_probe_
Quoted 18 lines · Biju Das
From: Nilkanth Ahirrao <[email protected]>
commit
ac28ec07ae1c5c1e18ed6855eb105a328418da88upstream.commit
c16015f36cc1("ASoC: rsnd: add .get_id/.get_id_sub") introducesrsnd_ctu_idwhich calcualates and gives the main Device id of the CTU by dividing the id by 4.rsnd_mod_iduses this interface to get the CTU main Device id. But this commit forgets to revert the main Device id calcution previously done inrsnd_ctu_probe_which also divides the id by 4. This path corrects the same to get the correct main Device id.The issue is observered when
rsnd_ctu_probe_is done for CTU1Fixes c16015f36cc1 ("ASoC: rsnd: add .get_id/.get_id_sub")
sound/soc/sh/rcar/ctu.c static int rsnd_ctu_probe_(struct rsnd_mod *mod, · line 114
Quoted 8 lines
sound/soc/sh/rcar/ctu.c +1
-1@@ -108,7 +108,7 @@ static int rsnd_ctu_probe_(struct rsnd_mod *mod,struct rsnd_dai_stream *io, struct rsnd_priv *priv) { - return rsnd_cmd_attach(io, rsnd_mod_id(mod) / 4); + return rsnd_cmd_attach(io, rsnd_mod_id(mod)); } static void rsnd_ctu_value_init(struct rsnd_dai_stream *io,
Ok, but again, could it be next to the patch it fixes?
Thanks,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191027/66bfdef2/attachment.sig>
PATCH 53/57 ASoC: rsnd: ssiu: tidyup SSI_MODE1/2 settings
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit dfea7b2c5c7eaf657086bb95d61814d7e04d1409 upstream.
R-Car Sound can use pin sharing and multi-SSI for SSI0/1/2/3/4/9.
Because complex HW settings and spaghetti code, the settings for SSI9 pin sharing with SSI0 doesn't work.
This patch tidyup settings for it.
--- sound/soc/sh/rcar/ssiu.c | 92 +++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 48 deletions(-)
sound/soc/sh/rcar/ssiu.c +44 -48
@@ -60,11 +60,11 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod, struct rsnd_priv *priv) {struct rsnd_dai *rdai =rsnd_io_to_rdai (io); -u32 multi_ssi_slaves =rsnd_ssi_multi_slaves_runtime (io); +u32 ssis =rsnd_ssi_multi_slaves_runtime (io);int use_busif =rsnd_ssi_use_busif (io);int id =rsnd_mod_id (mod); -u32 mask1, val1; -u32 mask2, val2; +int is_clk_master =rsnd_rdai_is_clk_master (rdai); +u32 val1, val2;int i;/* clear status */
@@ -89,57 +89,53 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod,rsnd_mod_bset (mod,SSI_MODE0 , (1 << id), !use_busif << id);/* -* SSI_MODE1 +* SSI_MODE1 / SSI_MODE2 +* +* FIXME +* sharing/multi with SSI0 are mainly supported */ - mask1 = (1 <<4 ) | (1 <<20 );/* mask sync bit */ - mask2 = (1 <<4 );/* mask sync bit */ - val1 = val2 =0 ; -if (id ==8 ) { -/* -* SSI8 pin is sharing with SSI7, nothing to do. -*/ - }else if (rsnd_ssi_is_pin_sharing (io)) { -int shift =-1 ; - -switch (id) { -case 1 : - shift =0 ; -break ; -case 2 : - shift =2 ; -break ; -case 4 : - shift =16 ; -break ; -default : -return -EINVAL ; - } - - mask1 |=0x3 << shift; - val1 =rsnd_rdai_is_clk_master (rdai) ? -0x2 << shift :0x1 << shift; + val1 =rsnd_mod_read (mod,SSI_MODE1 ); + val2 =rsnd_mod_read (mod,SSI_MODE2 ); +if (rsnd_ssi_is_pin_sharing (io)) { - }else if (multi_ssi_slaves) { + ssis |= (1 << id); - mask2 |=0x00000007 ; - mask1 |=0x0000000f ; - -switch (multi_ssi_slaves) { -case 0x0206 :/* SSI0/1/2/9 */ - val2 = (1 <<4 ) |/* SSI0129 sync */ - (rsnd_rdai_is_clk_master (rdai) ?0x2 :0x1 ); -/* fall through */ -case 0x0006 :/* SSI0/1/2 */ - val1 =rsnd_rdai_is_clk_master (rdai) ? -0xa :0x5 ; + }else if (ssis) { +/* +* Multi SSI +* +* set synchronized bit here +*/ -if (!val2)/* SSI012 sync */ - val1 |= (1 <<4 ); - } +/* SSI4 is synchronized with SSI3 */ +if (ssis & (1 <<4 )) + val1 |= (1 <<20 ); +/* SSI012 are synchronized */ +if (ssis ==0x0006 ) + val1 |= (1 <<4 ); +/* SSI0129 are synchronized */ +if (ssis ==0x0206 ) + val2 |= (1 <<4 ); } -rsnd_mod_bset (mod,SSI_MODE1 , mask1, val1); -rsnd_mod_bset (mod,SSI_MODE2 , mask2, val2); +/* SSI1 is sharing pin with SSI0 */ +if (ssis & (1 <<1 )) + val1 |= is_clk_master ?0x2 :0x1 ; + +/* SSI2 is sharing pin with SSI0 */ +if (ssis & (1 <<2 )) + val1 |= is_clk_master ?0x2 <<2 : +0x1 <<2 ; +/* SSI4 is sharing pin with SSI3 */ +if (ssis & (1 <<4 )) + val1 |= is_clk_master ?0x2 <<16 : +0x1 <<16 ; +/* SSI9 is sharing pin with SSI0 */ +if (ssis & (1 <<9 )) + val2 |= is_clk_master ?0x2 :0x1 ; + +rsnd_mod_bset (mod,SSI_MODE1 ,0x0013001f , val1); +rsnd_mod_bset (mod,SSI_MODE2 ,0x00000017 , val2);return 0 ; }
Signature · 1 line
2.7.4
PATCH 54/57 ASoC: rsnd: add missing pin sharing with SSI9
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 526a6d45b013d45fdddd420860c69fb29fed3d62 upstream.
When SSI9 is sharing pin with SSI0, we need to care about it, but is missing. This patch fixup it.
--- sound/soc/sh/rcar/adg.c | 1 + sound/soc/sh/rcar/ssi.c | 1 + 2 files changed, 2 insertions(+)
sound/soc/sh/rcar/adg.c +1 -0
@@ -88,6 +88,7 @@ static u32 rsnd_adg_ssi_ws_timing_gen2(struct rsnd_dai_stream *io)switch (id) {case 1 :case 2 : +case 9 : ws =0 ;break ;case 4 :
sound/soc/sh/rcar/ssi.c +1 -0
@@ -740,6 +740,7 @@ static void rsnd_ssi_parent_attach(struct rsnd_mod *mod,switch (rsnd_mod_id (mod)) {case 1 :case 2 : +case 9 :rsnd_dai_connect (rsnd_ssi_mod_get (priv,0 ), io,RSND_MOD_SSIP );break ;case 4 :
Signature · 1 line
2.7.4
PATCH 55/57 ASoC: rsnd: Support hw_free() callback at DAI level
In reply to Biju DasFrom: Timo Wischer <[email protected]>
commit 859fd6cbf1fb32b5428c26f837215c085b8a822e upstream.
This patch provides the needed infrastructure to support calling hw_free() at the DAI level. This is for example required to free resources allocated in hw_params() callback.
The modification of __rsnd_mod_add_hw_params does not have any side effects because rsnd_mod_ops::hw_params callback is not used by anyone until now.
--- sound/soc/sh/rcar/core.c | 16 +++++++++++++++- sound/soc/sh/rcar/rsnd.h | 12 +++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-)
sound/soc/sh/rcar/core.c +15 -1
@@ -1415,6 +1415,20 @@ static int rsnd_hw_params(struct snd_pcm_substream *substream, params_buffer_bytes(hw_params)); } +static int rsnd_hw_free (struct snd_pcm_substream *substream) +{ +struct snd_soc_dai *dai =rsnd_substream_to_dai (substream); +struct rsnd_dai *rdai =rsnd_dai_to_rdai (dai); +struct rsnd_dai_stream *io =rsnd_rdai_to_io (rdai, substream); +int ret; + + ret =rsnd_dai_call (hw_free, io, substream); +if (ret) +return ret; + +return snd_pcm_lib_free_pages (substream); +} +static snd_pcm_uframes_t rsnd_pointer (struct snd_pcm_substream *substream) {struct snd_soc_dai *dai =rsnd_substream_to_dai (substream);
@@ -1430,7 +1444,7 @@ static snd_pcm_uframes_t rsnd_pointer(struct snd_pcm_substream *substream)static const struct snd_pcm_ops rsnd_pcm_ops = { .ioctl = snd_pcm_lib_ioctl, .hw_params = rsnd_hw_params, - .hw_free = snd_pcm_lib_free_pages, + .hw_free = rsnd_hw_free, .pointer = rsnd_pointer, };
sound/soc/sh/rcar/rsnd.h +9 -3
@@ -327,6 +327,9 @@ struct rsnd_mod_ops {int (*cleanup)(struct rsnd_mod *mod,struct rsnd_dai_stream *io,struct rsnd_priv *priv); +int (*hw_free)(struct rsnd_mod *mod, +struct rsnd_dai_stream *io, +struct snd_pcm_substream *substream);u32 *(*get_status)(struct rsnd_mod *mod,struct rsnd_dai_stream *io,enum rsnd_mod_type type);
@@ -351,12 +354,12 @@ struct rsnd_mod {* * B 0: init 1: quit * C 0: start 1: stop +* D 0: hw_params 1: hw_free * * H is always called (see __rsnd_mod_call) * H 0: probe 1: remove * H 0: pcm_new * H 0: fallback -* H 0: hw_params * H 0: pointer * H 0: prepare * H 0: cleanup
@@ -365,12 +368,13 @@ struct rsnd_mod {#define __rsnd_mod_shift_quit 4#define __rsnd_mod_shift_start 8#define __rsnd_mod_shift_stop 8 +#define __rsnd_mod_shift_hw_params 12 +#define __rsnd_mod_shift_hw_free 12#define __rsnd_mod_shift_probe 28/* always called */ #define __rsnd_mod_shift_remove 28/* always called */ #define __rsnd_mod_shift_irq 28/* always called */ #define __rsnd_mod_shift_pcm_new 28/* always called */ #define __rsnd_mod_shift_fallback 28/* always called */ -#define __rsnd_mod_shift_hw_params 28/* always called */ #define __rsnd_mod_shift_pointer 28/* always called */ #define __rsnd_mod_shift_prepare 28/* always called */ #define __rsnd_mod_shift_cleanup 28/* always called */
@@ -383,10 +387,11 @@ struct rsnd_mod {#define __rsnd_mod_add_quit -1#define __rsnd_mod_add_start 1#define __rsnd_mod_add_stop -1 +#define __rsnd_mod_add_hw_params 1 +#define __rsnd_mod_add_hw_free -1#define __rsnd_mod_add_irq 0#define __rsnd_mod_add_pcm_new 0#define __rsnd_mod_add_fallback 0 -#define __rsnd_mod_add_hw_params 0#define __rsnd_mod_add_pointer 0#define __rsnd_mod_call_probe 0
@@ -402,6 +407,7 @@ struct rsnd_mod {#define __rsnd_mod_call_fallback 0#define __rsnd_mod_call_hw_params 0#define __rsnd_mod_call_pointer 0 +#define __rsnd_mod_call_hw_free 1#define rsnd_mod_to_priv (mod) ((mod)->priv)#define rsnd_mod_power_on (mod) clk_enable((mod)->clk)
Signature · 1 line
2.7.4
PATCH 56/57 ASoC: rsnd: do error check after rsnd_channel_normalization()
In reply to Biju DasFrom: Kuninori Morimoto <[email protected]>
commit 947ec14c7369a87625f03abaab5b3f4d33ac73ba upstream.
SSI need to use rsnd_channel_normalization() for TDM-split mode, thus, channel check need to do after that.
--- sound/soc/sh/rcar/ssi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/sh/rcar/ssi.c +5 -5
@@ -286,6 +286,11 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,if (rsnd_ssi_is_multi_slave (mod, io))return 0 ; +if (rsnd_runtime_is_tdm_split (io)) + chan =rsnd_io_converted_chan (io); + + chan =rsnd_channel_normalization (chan); +if (ssi->usrcnt >0 ) {if (ssi->rate != rate) {dev_err (dev,"SSI parent/child should use same rate\n" );
@@ -300,11 +305,6 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,return 0 ; } -if (rsnd_runtime_is_tdm_split (io)) - chan =rsnd_io_converted_chan (io); - - chan =rsnd_channel_normalization (chan); - main_rate =rsnd_ssi_clk_query (rdai, rate, chan, &idx);if (!main_rate) {dev_err (dev,"unsupported clock rate\n" );
Signature · 1 line
2.7.4
PATCH 57/57 arm64: dts: renesas: r8a774a1: Add SSIU support for sound
In reply to Biju DasFrom: Fabrizio Castro <[email protected]>
commit a44efeaa0bbf699f7ad397f5130e2834d52f621e upstream.
Add SSIU support to the SoC DT as the sound driver supports it now, and also since the sound driver can now handle BUSIF0-7 via SSIU remove the no longer needed "rxu" and "txu" properties.
Based on similar work from Kuninori Morimoto and Simon Horman in commits 8d14bfa074db ("arm64: dts: renesas: r8a7796: add SSIU support for sound") and 10bd03fa896e ("arm64: dts: renesas: r8a7796: remove BUSIF0 settings from rcar_sound,ssi").
--- arch/arm64/boot/dts/renesas/r8a774a1.dtsi | 251 +++++++++++++++++++++++++++--- 1 file changed, 231 insertions(+), 20 deletions(-)
arch/arm64/boot/dts/renesas/r8a774a1.dtsi +231 -20
@@ -1550,56 +1550,267 @@ }; }; + rcar_sound,ssiu { + ssiu00: ssiu-0 { + dmas = <&audma0 0x15>, <&audma1 0x16>; + dma-names = "rx", "tx"; + }; + ssiu01: ssiu-1 { + dmas = <&audma0 0x35>, <&audma1 0x36>; + dma-names = "rx", "tx"; + }; + ssiu02: ssiu-2 { + dmas = <&audma0 0x37>, <&audma1 0x38>; + dma-names = "rx", "tx"; + }; + ssiu03: ssiu-3 { + dmas = <&audma0 0x47>, <&audma1 0x48>; + dma-names = "rx", "tx"; + }; + ssiu04: ssiu-4 { + dmas = <&audma0 0x3F>, <&audma1 0x40>; + dma-names = "rx", "tx"; + }; + ssiu05: ssiu-5 { + dmas = <&audma0 0x43>, <&audma1 0x44>; + dma-names = "rx", "tx"; + }; + ssiu06: ssiu-6 { + dmas = <&audma0 0x4F>, <&audma1 0x50>; + dma-names = "rx", "tx"; + }; + ssiu07: ssiu-7 { + dmas = <&audma0 0x53>, <&audma1 0x54>; + dma-names = "rx", "tx"; + }; + ssiu10: ssiu-8 { + dmas = <&audma0 0x49>, <&audma1 0x4a>; + dma-names = "rx", "tx"; + }; + ssiu11: ssiu-9 { + dmas = <&audma0 0x4B>, <&audma1 0x4C>; + dma-names = "rx", "tx"; + }; + ssiu12: ssiu-10 { + dmas = <&audma0 0x57>, <&audma1 0x58>; + dma-names = "rx", "tx"; + }; + ssiu13: ssiu-11 { + dmas = <&audma0 0x59>, <&audma1 0x5A>; + dma-names = "rx", "tx"; + }; + ssiu14: ssiu-12 { + dmas = <&audma0 0x5F>, <&audma1 0x60>; + dma-names = "rx", "tx"; + }; + ssiu15: ssiu-13 { + dmas = <&audma0 0xC3>, <&audma1 0xC4>; + dma-names = "rx", "tx"; + }; + ssiu16: ssiu-14 { + dmas = <&audma0 0xC7>, <&audma1 0xC8>; + dma-names = "rx", "tx"; + }; + ssiu17: ssiu-15 { + dmas = <&audma0 0xCB>, <&audma1 0xCC>; + dma-names = "rx", "tx"; + }; + ssiu20: ssiu-16 { + dmas = <&audma0 0x63>, <&audma1 0x64>; + dma-names = "rx", "tx"; + }; + ssiu21: ssiu-17 { + dmas = <&audma0 0x67>, <&audma1 0x68>; + dma-names = "rx", "tx"; + }; + ssiu22: ssiu-18 { + dmas = <&audma0 0x6B>, <&audma1 0x6C>; + dma-names = "rx", "tx"; + }; + ssiu23: ssiu-19 { + dmas = <&audma0 0x6D>, <&audma1 0x6E>; + dma-names = "rx", "tx"; + }; + ssiu24: ssiu-20 { + dmas = <&audma0 0xCF>, <&audma1 0xCE>; + dma-names = "rx", "tx"; + }; + ssiu25: ssiu-21 { + dmas = <&audma0 0xEB>, <&audma1 0xEC>; + dma-names = "rx", "tx"; + }; + ssiu26: ssiu-22 { + dmas = <&audma0 0xED>, <&audma1 0xEE>; + dma-names = "rx", "tx"; + }; + ssiu27: ssiu-23 { + dmas = <&audma0 0xEF>, <&audma1 0xF0>; + dma-names = "rx", "tx"; + }; + ssiu30: ssiu-24 { + dmas = <&audma0 0x6f>, <&audma1 0x70>; + dma-names = "rx", "tx"; + }; + ssiu31: ssiu-25 { + dmas = <&audma0 0x21>, <&audma1 0x22>; + dma-names = "rx", "tx"; + }; + ssiu32: ssiu-26 { + dmas = <&audma0 0x23>, <&audma1 0x24>; + dma-names = "rx", "tx"; + }; + ssiu33: ssiu-27 { + dmas = <&audma0 0x25>, <&audma1 0x26>; + dma-names = "rx", "tx"; + }; + ssiu34: ssiu-28 { + dmas = <&audma0 0x27>, <&audma1 0x28>; + dma-names = "rx", "tx"; + }; + ssiu35: ssiu-29 { + dmas = <&audma0 0x29>, <&audma1 0x2A>; + dma-names = "rx", "tx"; + }; + ssiu36: ssiu-30 { + dmas = <&audma0 0x2B>, <&audma1 0x2C>; + dma-names = "rx", "tx"; + }; + ssiu37: ssiu-31 { + dmas = <&audma0 0x2D>, <&audma1 0x2E>; + dma-names = "rx", "tx"; + }; + ssiu40: ssiu-32 { + dmas = <&audma0 0x71>, <&audma1 0x72>; + dma-names = "rx", "tx"; + }; + ssiu41: ssiu-33 { + dmas = <&audma0 0x17>, <&audma1 0x18>; + dma-names = "rx", "tx"; + }; + ssiu42: ssiu-34 { + dmas = <&audma0 0x19>, <&audma1 0x1A>; + dma-names = "rx", "tx"; + }; + ssiu43: ssiu-35 { + dmas = <&audma0 0x1B>, <&audma1 0x1C>; + dma-names = "rx", "tx"; + }; + ssiu44: ssiu-36 { + dmas = <&audma0 0x1D>, <&audma1 0x1E>; + dma-names = "rx", "tx"; + }; + ssiu45: ssiu-37 { + dmas = <&audma0 0x1F>, <&audma1 0x20>; + dma-names = "rx", "tx"; + }; + ssiu46: ssiu-38 { + dmas = <&audma0 0x31>, <&audma1 0x32>; + dma-names = "rx", "tx"; + }; + ssiu47: ssiu-39 { + dmas = <&audma0 0x33>, <&audma1 0x34>; + dma-names = "rx", "tx"; + }; + ssiu50: ssiu-40 { + dmas = <&audma0 0x73>, <&audma1 0x74>; + dma-names = "rx", "tx"; + }; + ssiu60: ssiu-41 { + dmas = <&audma0 0x75>, <&audma1 0x76>; + dma-names = "rx", "tx"; + }; + ssiu70: ssiu-42 { + dmas = <&audma0 0x79>, <&audma1 0x7a>; + dma-names = "rx", "tx"; + }; + ssiu80: ssiu-43 { + dmas = <&audma0 0x7b>, <&audma1 0x7c>; + dma-names = "rx", "tx"; + }; + ssiu90: ssiu-44 { + dmas = <&audma0 0x7d>, <&audma1 0x7e>; + dma-names = "rx", "tx"; + }; + ssiu91: ssiu-45 { + dmas = <&audma0 0x7F>, <&audma1 0x80>; + dma-names = "rx", "tx"; + }; + ssiu92: ssiu-46 { + dmas = <&audma0 0x81>, <&audma1 0x82>; + dma-names = "rx", "tx"; + }; + ssiu93: ssiu-47 { + dmas = <&audma0 0x83>, <&audma1 0x84>; + dma-names = "rx", "tx"; + }; + ssiu94: ssiu-48 { + dmas = <&audma0 0xA3>, <&audma1 0xA4>; + dma-names = "rx", "tx"; + }; + ssiu95: ssiu-49 { + dmas = <&audma0 0xA5>, <&audma1 0xA6>; + dma-names = "rx", "tx"; + }; + ssiu96: ssiu-50 { + dmas = <&audma0 0xA7>, <&audma1 0xA8>; + dma-names = "rx", "tx"; + }; + ssiu97: ssiu-51 { + dmas = <&audma0 0xA9>, <&audma1 0xAA>; + dma-names = "rx", "tx"; + }; + }; + rcar_sound,ssi { ssi0: ssi-0 { interrupts = <GIC_SPI 370 IRQ_TYPE_LEVEL_HIGH>; - dmas = <&audma0 0x01>, <&audma1 0x02>, <&audma0 0x15>, <&audma1 0x16>; - dma-names = "rx", "tx", "rxu", "txu"; + dmas = <&audma0 0x01>, <&audma1 0x02>; + dma-names = "rx", "tx"; }; ssi1: ssi-1 { interrupts = <GIC_SPI 371 IRQ_TYPE_LEVEL_HIGH>; - dmas = <&audma0 0x03>, <&audma1 0x04>, <&audma0 0x49>, <&audma1 0x4a>; - dma-names = "rx", "tx", "rxu", "txu"; + dmas = <&audma0 0x03>, <&audma1 0x04>; + dma-names = "rx", "tx"; }; ssi2: ssi-2 { interrupts = <GIC_SPI 372 IRQ_TYPE_LEVEL_HIGH>; - dmas = <&audma0 0x05>, <&audma1 0x06>, <&audma0 0x63>, <&audma1 0x64>; - dma-names = "rx", "tx", "rxu", "txu"; + dmas = <&audma0 0x05>, <&audma1 0x06>; + dma-names = "rx", "tx"; }; ssi3: ssi-3 { interrupts = <GIC_SPI 373 IRQ_TYPE_LEVEL_HIGH>; - dmas = <&audma0 0x07>, <&audma1 0x08>, <&audma0 0x6f>, <&audma1 0x70>; - dma-names = "rx", "tx", "rxu", "txu"; + dmas = <&audma0 0x07>, <&audma1 0x08>; + dma-names = "rx", "tx"; }; ssi4: ssi-4 { interrupts = <GIC_SPI 374 IRQ_TYPE_LEVEL_HIGH>; - dmas = <&audma0 0x09>, <&audma1 0x0a>, <&audma0 0x71>, <&audma1 0x72>; - dma-names = "rx", "tx", "rxu", "txu"; + dmas = <&audma0 0x09>, <&audma1 0x0a>; + dma-names = "rx", "tx"; }; ssi5: ssi-5 { interrupts = <GIC_SPI 375 IRQ_TYPE_LEVEL_HIGH>; - dmas = <&audma0 0x0b>, <&audma1 0x0c>, <&audma0 0x73>, <&audma1 0x74>; - dma-names = "rx", "tx", "rxu", "txu"; + dmas = <&audma0 0x0b>, <&audma1 0x0c>; + dma-names = "rx", "tx"; }; ssi6: ssi-6 { interrupts = <GIC_SPI 376 IRQ_TYPE_LEVEL_HIGH>; - dmas = <&audma0 0x0d>, <&audma1 0x0e>, <&audma0 0x75>, <&audma1 0x76>; - dma-names = "rx", "tx", "rxu", "txu"; + dmas = <&audma0 0x0d>, <&audma1 0x0e>; + dma-names = "rx", "tx"; }; ssi7: ssi-7 { interrupts = <GIC_SPI 377 IRQ_TYPE_LEVEL_HIGH>; - dmas = <&audma0 0x0f>, <&audma1 0x10>, <&audma0 0x79>, <&audma1 0x7a>; - dma-names = "rx", "tx", "rxu", "txu"; + dmas = <&audma0 0x0f>, <&audma1 0x10>; + dma-names = "rx", "tx"; }; ssi8: ssi-8 { interrupts = <GIC_SPI 378 IRQ_TYPE_LEVEL_HIGH>; - dmas = <&audma0 0x11>, <&audma1 0x12>, <&audma0 0x7b>, <&audma1 0x7c>; - dma-names = "rx", "tx", "rxu", "txu"; + dmas = <&audma0 0x11>, <&audma1 0x12>; + dma-names = "rx", "tx"; }; ssi9: ssi-9 { interrupts = <GIC_SPI 379 IRQ_TYPE_LEVEL_HIGH>; - dmas = <&audma0 0x13>, <&audma1 0x14>, <&audma0 0x7d>, <&audma1 0x7e>; - dma-names = "rx", "tx", "rxu", "txu"; + dmas = <&audma0 0x13>, <&audma1 0x14>; + dma-names = "rx", "tx"; }; };
Signature · 1 line
2.7.4
cover Audio improvements/SSIU BUSIF/
In reply to Biju DasHi!
Quoted 15 lines
This patch add support for SSIU BUSIF/ TDM split mode. Also it fixes some of audio issues.
This patch series is based on linux-4.19.y-cip and all the patches in this series are cherry-picked from linux rc tree.
arch/arm64/boot/dts/renesas/r8a774a1.dtsi | 251 +++++++++- include/sound/soc-dpcm.h | 10 + include/sound/soc.h | 7 + sound/soc/fsl/fsl_asrc_dma.c | 2 +- sound/soc/intel/boards/kbl_rt5663_max98927.c | 5 +- .../soc/intel/boards/kbl_rt5663_rt5514_max98927.c | 5 +- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | 5 +- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 5 +- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 5 +-
...
Quoted 6 lines
sound/soc/meson/axg-card.c | 6 +- sound/soc/soc-compress.c | 4 +- sound/soc/soc-core.c | 38 +- sound/soc/soc-dapm.c | 14 +- sound/soc/soc-pcm.c | 239 +++++----- 28 files changed, 1867 insertions(+), 1150 deletions(-)
Ok, this is quite a lot of changes, some of them questionable, and some of them to the shared code.
What is "SSIU BUSIF/ TDM split mode" and why is it important? Is it possible to identify which patches fix existing issues, and what issues those are?
I'll post comments on individual patches later, but it would be really useful to have a big picture.
Thanks and best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 181 bytes Desc: Digital signature URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191018/c0db7cf5/attachment.sig>
cover Audio improvements/SSIU BUSIF/
In reply to Biju DasHello Pavel and others,
Thanks for the feedback.
Can you please suggest, how you want to handle this patch set?
regards,
Biju
Quoted 114 lines
Subject: [PATCH 4.19.y-cip 00/57] Audio improvements/SSIU BUSIF/
This patch add support for SSIU BUSIF/ TDM split mode. Also it fixes some of audio issues.
This patch series is based on linux-4.19.y-cip and all the patches in this series are cherry-picked from linux rc tree.
Dmytro Prokopchuk (1):
ASoC: rsnd: fixup SSI clock during suspend/resume modesDragos Tarcatu (2):
ASoC: rsnd: add support for 16/24 bit slot widths
ASoC: rsnd: add support for 8 bit S8 formatFabrizio Castro (1):
arm64: dts: renesas: r8a774a1: Add SSIU support for soundJiada Wang (12):
ASoC: rsnd: add warning message torsnd_kctrl_accept_runtime()
ASoC: rsnd: removeis_playparameter fromhw_rulefunction
ASoC: rsnd: ssi: Fix issue in dma data address assignment
ASoC: rsnd: ssi: Check runtime channel number rather thanhw_params
ASoc: rsnd: dma: Calculate dma address with consider of BUSIF
ASoc: rsnd: dma: Calculate PDMACHCRE with consider of BUSIF
ASoC: rsnd: ssiu: Support BUSIF other than BUSIF0
ASoC: rsnd: ssiu: Support to init different BUSIF instance
ASoC: rsnd: ssiu: correct shift bit for ssiu9
ASoC: rsnd: gen: fix SSI9 4/5/6/7 busif related register address
ASoC: rsnd: src: Avoid a potential deadlock
ASoC: rsnd: src: fix compiler warningsKuninori Morimoto (37):
ASoC: rsnd: merge .nolock_start and .prepare
ASoC: rsnd: gen: use tab instead of white-space
ASoC: rsnd: don't use %p fordev_dbg()
ASoC: addfor_each_rtd_codec_dai()macro
ASoC: convertfor_each_rtd_codec_dai()for missing part
ASoC: addfor_each_dpcm_fe()macro
ASoC: addfor_each_dpcm_be()macro
ASoC: rsnd: use 32bit TDM width as default
ASoC: rsnd: enable TDM settings for SSI parent
ASoC: rsnd: tidyupSSICR::SWSPfor TDM
ASoC: rsnd: move .get_status underrsnd_mod_ops
ASoC: rsnd: add .get_id/.get_id_sub
ASoC: rsnd:rsnd_mod_name()handles both name and ID
ASoC: rsnd: remove endpoint bidirectional check
ASoC: rsnd: renamersnd_runtime_is_ssi_xxx()
ASoC: rsnd: use defined io_playback/io_capture
ASoC: rsnd: move HDMI information fromssi.ctocore.c
ASoC: rsnd: handle DPCM converted rate/chan under core
ASoC: rsnd: add SSIU BUSIF support
ASoC: rsnd: add TDM Split mode support
ASoC: rsnd: use ring buffer forrsnd_mod_name()
ASoC: rsnd: tidyuprsnd_parse_connect_ssiu_compatible()
ASoC: rsnd: makesrsnd_ssi_is_dma_mode()static
ASoC: rsnd: tidyup registering method forrsnd_kctrl_new()
ASoC: rsnd: indicates Channel and Mode for debug
ASoC: rsnd: fixup mod ID for CTU regmap read/write
ASoC: rsnd: add missing TDM Split mode support for simple-card
ASoC: rsnd: removeRSND_REG_fromrsnd_reg
ASoC: rsnd: update BSDSR/BSDISR handling
ASoC: rsnd: fixup MIX kctrl registration
ASoC: rsnd: synchronize connection check for simple-card/audio-graph
ASoC: rsnd: fixup TDM Split mode check for CTU
ASoC: rsnd: fixup 6ch settings to 8ch
ASoC: rsnd: movepcm_newfromsnd_soc_component_driverto
snd_soc_dai_driver
ASoC: rsnd: ssiu: tidyup SSI_MODE1/2 settings
ASoC: rsnd: add missing pin sharing with SSI9
ASoC: rsnd: do error check afterrsnd_channel_normalization()Nilkanth Ahirrao (1):
ASoC: rsnd: fixup mod ID calculation inrsnd_ctu_probe_Takashi Iwai (2):
ASoC: sh: Avoid passing NULL to memory allocators
ASoC: sh: Drop superfluous PCM preallocation error checksTimo Wischer (1):
ASoC: rsnd: Supporthw_free()callback at DAI levelarch/arm64/boot/dts/renesas/r8a774a1.dtsi | 251 +++++++++- include/sound/soc-dpcm.h | 10 + include/sound/soc.h | 7 + sound/soc/fsl/fsl_asrc_dma.c | 2 +- sound/soc/intel/boards/kbl_rt5663_max98927.c | 5 +- .../soc/intel/boards/kbl_rt5663_rt5514_max98927.c | 5 +- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | 5 +- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 5 +- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 5 +- sound/soc/meson/axg-card.c | 6 +- sound/soc/sh/fsi.c | 3 +- sound/soc/sh/rcar/adg.c | 43 +- sound/soc/sh/rcar/cmd.c | 11 +- sound/soc/sh/rcar/core.c | 531 ++++++++++++++------- sound/soc/sh/rcar/ctu.c | 140 ++---- sound/soc/sh/rcar/dma.c | 185 ++++--- sound/soc/sh/rcar/dvc.c | 21 +- sound/soc/sh/rcar/gen.c | 106 +++- sound/soc/sh/rcar/mix.c | 3 +- sound/soc/sh/rcar/rsnd.h | 440 ++++++++++------- sound/soc/sh/rcar/src.c | 175 ++++--- sound/soc/sh/rcar/ssi.c | 372 +++++++-------- sound/soc/sh/rcar/ssiu.c | 376 +++++++++++---- sound/soc/sh/siu_pcm.c | 15 +- sound/soc/soc-compress.c | 4 +- sound/soc/soc-core.c | 38 +- sound/soc/soc-dapm.c | 14 +- sound/soc/soc-pcm.c | 239 +++++----- 28 files changed, 1867 insertions(+), 1150 deletions(-)--
2.7.4
cover Audio improvements/SSIU BUSIF/
Hi!
Quoted 3 lines
Thanks for the feedback.
Can you please suggest, how you want to handle this patch set?
So... I see there were some follow up fixes done in the mainline. The series is also rather long to merge in one piece.
Would it be possible to send new series, with the follow up fixes merged or near the patch they are fixing?
And it might be good idea to split the series as 57 patches in a row is quite many. To help that... I went throught my comments again, and realized patches 1..10 are simple/easy. I merged them to make the pile smaller.
Thanks and best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 195 bytes Desc: not available URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191115/df443822/attachment.sig>
cover Audio improvements/SSIU BUSIF/
Hi Pavel,
Thanks for the feedback.
Quoted 6 lines
Subject: Re: [PATCH 4.19.y-cip 00/57] Audio improvements/SSIU BUSIF/
Hi!
Quoted 2 lines
Thanks for the feedback.
Quoted 7 lines
Quoted 1 line
Can you please suggest, how you want to handle this patch set?
So... I see there were some follow up fixes done in the mainline. The series is also rather long to merge in one piece.
Would it be possible to send new series, with the follow up fixes merged or near the patch they are fixing?
Will send a new series.
Quoted 3 lines
And it might be good idea to split the series as 57 patches in a row is quite many. To help that... I went throught my comments again, and realized patches 1..10 are simple/easy. I merged them to make the pile smaller.
Thanks for applying this.
Regards,
Biju