Commit 42ab9a79 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: rsnd: dvc enables non-stereo sound

Current DVC is assuming that the sound is always stereo.
This patch makes it more flexible
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 8ec85e7f
...@@ -871,10 +871,14 @@ int rsnd_kctrl_new_m(struct rsnd_mod *mod, ...@@ -871,10 +871,14 @@ int rsnd_kctrl_new_m(struct rsnd_mod *mod,
void (*update)(struct rsnd_dai_stream *io, void (*update)(struct rsnd_dai_stream *io,
struct rsnd_mod *mod), struct rsnd_mod *mod),
struct rsnd_kctrl_cfg_m *_cfg, struct rsnd_kctrl_cfg_m *_cfg,
int ch_size,
u32 max) u32 max)
{ {
if (ch_size > RSND_DVC_CHANNELS)
return -EINVAL;
_cfg->cfg.max = max; _cfg->cfg.max = max;
_cfg->cfg.size = RSND_DVC_CHANNELS; _cfg->cfg.size = ch_size;
_cfg->cfg.val = _cfg->val; _cfg->cfg.val = _cfg->val;
return __rsnd_kctrl_new(mod, io, rtd, name, &_cfg->cfg, update); return __rsnd_kctrl_new(mod, io, rtd, name, &_cfg->cfg, update);
} }
......
...@@ -97,6 +97,12 @@ static void rsnd_dvc_volume_parameter(struct rsnd_dai_stream *io, ...@@ -97,6 +97,12 @@ static void rsnd_dvc_volume_parameter(struct rsnd_dai_stream *io,
/* Enable Digital Volume */ /* Enable Digital Volume */
rsnd_mod_write(mod, DVC_VOL0R, val[0]); rsnd_mod_write(mod, DVC_VOL0R, val[0]);
rsnd_mod_write(mod, DVC_VOL1R, val[1]); 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]);
} }
static void rsnd_dvc_volume_init(struct rsnd_dai_stream *io, static void rsnd_dvc_volume_init(struct rsnd_dai_stream *io,
...@@ -236,8 +242,10 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, ...@@ -236,8 +242,10 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
struct rsnd_dai_stream *io, struct rsnd_dai_stream *io,
struct snd_soc_pcm_runtime *rtd) struct snd_soc_pcm_runtime *rtd)
{ {
struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod); struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod);
int is_play = rsnd_io_is_play(io); int is_play = rsnd_io_is_play(io);
int slots = rsnd_get_slot_rdai(rdai);
int ret; int ret;
/* Volume */ /* Volume */
...@@ -245,7 +253,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, ...@@ -245,7 +253,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
is_play ? is_play ?
"DVC Out Playback Volume" : "DVC In Capture Volume", "DVC Out Playback Volume" : "DVC In Capture Volume",
rsnd_dvc_volume_update, rsnd_dvc_volume_update,
&dvc->volume, 0x00800000 - 1); &dvc->volume, slots,
0x00800000 - 1);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -254,7 +263,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, ...@@ -254,7 +263,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
is_play ? is_play ?
"DVC Out Mute Switch" : "DVC In Mute Switch", "DVC Out Mute Switch" : "DVC In Mute Switch",
rsnd_dvc_volume_update, rsnd_dvc_volume_update,
&dvc->mute, 1); &dvc->mute, slots,
1);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -277,6 +277,12 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv) ...@@ -277,6 +277,12 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv)
RSND_GEN_M_REG(DVC_VRDBR, 0xe20, 0x100), RSND_GEN_M_REG(DVC_VRDBR, 0xe20, 0x100),
RSND_GEN_M_REG(DVC_VOL0R, 0xe28, 0x100), RSND_GEN_M_REG(DVC_VOL0R, 0xe28, 0x100),
RSND_GEN_M_REG(DVC_VOL1R, 0xe2c, 0x100), RSND_GEN_M_REG(DVC_VOL1R, 0xe2c, 0x100),
RSND_GEN_M_REG(DVC_VOL2R, 0xe30, 0x100),
RSND_GEN_M_REG(DVC_VOL3R, 0xe34, 0x100),
RSND_GEN_M_REG(DVC_VOL4R, 0xe38, 0x100),
RSND_GEN_M_REG(DVC_VOL5R, 0xe3c, 0x100),
RSND_GEN_M_REG(DVC_VOL6R, 0xe40, 0x100),
RSND_GEN_M_REG(DVC_VOL7R, 0xe44, 0x100),
RSND_GEN_M_REG(DVC_DVUER, 0xe48, 0x100), RSND_GEN_M_REG(DVC_DVUER, 0xe48, 0x100),
}; };
const static struct rsnd_regmap_field_conf conf_adg[] = { const static struct rsnd_regmap_field_conf conf_adg[] = {
......
...@@ -101,6 +101,12 @@ enum rsnd_reg { ...@@ -101,6 +101,12 @@ enum rsnd_reg {
RSND_REG_DVC_ZCMCR, RSND_REG_DVC_ZCMCR,
RSND_REG_DVC_VOL0R, RSND_REG_DVC_VOL0R,
RSND_REG_DVC_VOL1R, RSND_REG_DVC_VOL1R,
RSND_REG_DVC_VOL2R,
RSND_REG_DVC_VOL3R,
RSND_REG_DVC_VOL4R,
RSND_REG_DVC_VOL5R,
RSND_REG_DVC_VOL6R,
RSND_REG_DVC_VOL7R,
RSND_REG_DVC_DVUER, RSND_REG_DVC_DVUER,
RSND_REG_DVC_VRCTR, /* Gen2 only */ RSND_REG_DVC_VRCTR, /* Gen2 only */
RSND_REG_DVC_VRPDR, /* Gen2 only */ RSND_REG_DVC_VRPDR, /* Gen2 only */
...@@ -476,7 +482,7 @@ struct rsnd_kctrl_cfg { ...@@ -476,7 +482,7 @@ struct rsnd_kctrl_cfg {
struct snd_kcontrol *kctrl; struct snd_kcontrol *kctrl;
}; };
#define RSND_DVC_CHANNELS 2 #define RSND_DVC_CHANNELS 8
struct rsnd_kctrl_cfg_m { struct rsnd_kctrl_cfg_m {
struct rsnd_kctrl_cfg cfg; struct rsnd_kctrl_cfg cfg;
u32 val[RSND_DVC_CHANNELS]; u32 val[RSND_DVC_CHANNELS];
...@@ -497,6 +503,7 @@ int rsnd_kctrl_new_m(struct rsnd_mod *mod, ...@@ -497,6 +503,7 @@ int rsnd_kctrl_new_m(struct rsnd_mod *mod,
void (*update)(struct rsnd_dai_stream *io, void (*update)(struct rsnd_dai_stream *io,
struct rsnd_mod *mod), struct rsnd_mod *mod),
struct rsnd_kctrl_cfg_m *_cfg, struct rsnd_kctrl_cfg_m *_cfg,
int ch_size,
u32 max); u32 max);
int rsnd_kctrl_new_s(struct rsnd_mod *mod, int rsnd_kctrl_new_s(struct rsnd_mod *mod,
struct rsnd_dai_stream *io, struct rsnd_dai_stream *io,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment