[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d2b64cb9-895e-f6ab-d95d-8c2d5962d64c@opensource.cirrus.com>
Date: Thu, 4 Mar 2021 18:45:13 +0000
From: Vitaly Rodionov <vitalyr@...nsource.cirrus.com>
To: Takashi Iwai <tiwai@...e.de>
CC: Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
<alsa-devel@...a-project.org>, <patches@...nsource.cirrus.com>,
<linux-kernel@...r.kernel.org>,
Stefan Binding <sbinding@...nsource.cirrus.com>
Subject: Re: [PATCH 4/4] ALSA: hda/cirrus: Add Headphone and Headset MIC
Volume Control
On 04/03/2021 1:49 pm, Takashi Iwai wrote:
> On Wed, 03 Mar 2021 19:29:59 +0100,
> Vitaly Rodionov wrote:
>> +static int cs8409_cs42l42_volume_get(struct snd_kcontrol *kcontrol,
>> + struct snd_ctl_elem_value *ucontrol)
>> +{
>> + struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
>> + hda_nid_t nid = get_amp_nid(kcontrol);
>> + int chs = get_amp_channels(kcontrol);
>> + long *valp = ucontrol->value.integer.value;
>> + char vol = 0;
>> +
>> + codec_dbg(codec, "%s() nid: %d\n", __func__, nid);
>> + snd_hda_power_up(codec);
>> + switch (nid) {
>> + case CS8409_CS42L42_HP_PIN_NID:
>> + mutex_lock(&cs8409_i2c_mux);
>> + if (chs & 1) {
>> + vol = -(cs8409_i2c_read(codec, CS42L42_I2C_ADDR,
>> + CS8409_CS42L42_REG_HS_VOLUME_CHA, 1));
> Better to cache the values instead of i2c read at each time?
> Then the unnecessary power up/down sequence can be avoided, too.
Yes, agree. Will be fixed in next version of patch.
>
>
> thanks,
>
> Takashi
Thank you,
Vitaly
Powered by blists - more mailing lists