Re: [alsa-devel] [PATCH] ASoC: add RT5640 CODEC driver
Dear Mark,
Please see my reply below.
Thanks.
-----Original Message----- From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com] Sent: Tuesday, April 16, 2013 10:38 PM To: Bard Cc: Flove; Oder Chiou; swarren@nvidia.com; bard Subject: Re: [PATCH] ASoC: add RT5640 CODEC driver
On Tue, Apr 16, 2013 at 10:10:37PM +0800, bardliao@realtek.com wrote:
Please remember to post things to the list... just a quick scan through here:
+static int rt5640_reg_init(struct snd_soc_codec *codec) {
- int i;
- for (i = 0; i < RT5640_INIT_REG_LEN; i++)
snd_soc_write(codec, init_list[i].reg, init_list[i].val);
- return 0;
+}
This should be converted over to regmap. There's support for paging in the core, look at regmap_range.
Bard: I will use regmap_register_patch to do that.
+/* IN1/IN2 Input Type */ +static const char * const rt5640_input_mode[] = {
- "Single ended", "Differential"};
+static const SOC_ENUM_SINGLE_DECL(
- rt5640_in1_mode_enum, RT5640_IN1_IN2,
- RT5640_IN_SFT1, rt5640_input_mode);
+static const SOC_ENUM_SINGLE_DECL(
- rt5640_in2_mode_enum, RT5640_IN3_IN4,
- RT5640_IN_SFT2, rt5640_input_mode);
Platform data...
Bard: Can I export a function that machine can configure it by this function?
+static int rt5640_vol_rescale_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) {
- struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value;
- struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
- unsigned int val, val2;
- val = VOL_RESCALE_MAX_VOL - ucontrol->value.integer.value[0];
- val2 = VOL_RESCALE_MAX_VOL - ucontrol->value.integer.value[1];
- return snd_soc_update_bits_locked(codec, mc->reg, RT5640_L_VOL_MASK |
RT5640_R_VOL_MASK, val << mc->shift | val2); }
This looks like a variant on the _RANGE controls?
Bard: Yes, we want to limit the max value of volume. If it is not good, I will change it.
+static int hp_event(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *kcontrol, int event) {
- switch (event) {
- case SND_SOC_DAPM_POST_PMU:
break;
- case SND_SOC_DAPM_PRE_PMD:
break;
- default:
return 0;
- }
- return 0;
+}
Remove this, it doesn't actually do anything any more.
Bard: I will remove it.
------Please consider the environment before printing this e-mail.
On Mon, Apr 22, 2013 at 03:03:05PM +0800, Bard wrote:
Please see my reply below.
As you've been told several times now please fix your mailer to quote the text you're replying to. You shouldn't need to point out that you're replying inline, this is how we do things...
+static const SOC_ENUM_SINGLE_DECL(
- rt5640_in2_mode_enum, RT5640_IN3_IN4,
- RT5640_IN_SFT2, rt5640_input_mode);
Platform data...
Bard: Can I export a function that machine can configure it by this function?
Why on earth would you want to do that?
+static int rt5640_vol_rescale_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) {
- struct soc_mixer_control *mc =
(struct soc_mixer_control *)kcontrol->private_value;
- struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
- unsigned int val, val2;
- val = VOL_RESCALE_MAX_VOL - ucontrol->value.integer.value[0];
- val2 = VOL_RESCALE_MAX_VOL - ucontrol->value.integer.value[1];
- return snd_soc_update_bits_locked(codec, mc->reg, RT5640_L_VOL_MASK |
RT5640_R_VOL_MASK, val << mc->shift | val2); }
This looks like a variant on the _RANGE controls?
Bard: Yes, we want to limit the max value of volume. If it is not good, I will change it.
This shouldn't be open coded in the driver, the functions should be generic. Code wise it's fine.
participants (2)
-
Bard
-
Mark Brown