[alsa-devel] [PATCH v2 1/3] ASoC: rt5645: Simplify rt5645_enable_push_button_irq

Nicolas Boichat drinkcat at chromium.org
Wed Jul 15 13:50:50 CEST 2015


On Tue, Jul 14, 2015 at 6:09 PM, Bard Liao <bardliao at realtek.com> wrote:
>> -----Original Message-----
>> From: Mark Brown [mailto:broonie at kernel.org]
>> Sent: Tuesday, July 14, 2015 5:53 PM
>> To: Nicolas Boichat
>> Cc: Bard Liao; Oder Chiou; Liam Girdwood; Jaroslav Kysela; Takashi Iwai;
>> alsa-devel at alsa-project.org; koro.chen at mediatek.com
>> Subject: Re: [PATCH v2 1/3] ASoC: rt5645: Simplify
>> rt5645_enable_push_button_irq
>>
>> On Tue, Jul 14, 2015 at 02:51:25PM +0800, Nicolas Boichat wrote:
>>
>> > +           if (codec->component.card->instantiated) {
>> > +                   snd_soc_dapm_force_enable_pin(dapm, "ADC L power");
>> > +                   snd_soc_dapm_force_enable_pin(dapm, "ADC R power");
>> > +                   snd_soc_dapm_sync(dapm);
>> > +           } else {
>> > +                   regmap_update_bits(rt5645->regmap, RT5645_PWR_DIG1,
>> > +                           RT5645_PWR_ADC_L_BIT | RT5645_PWR_ADC_R_BIT,
>> > +                           RT5645_PWR_ADC_L_BIT |
>> RT5645_PWR_ADC_R_BIT);
>> > +           }
>>
>> I don't understand why this isn't updating the DAPM state if the device is
>> not yet instantiated - this means that when the card instantiates the pins
>> will be turned off which presumably isn't what you want given the manual
>> register map futzing in the else case.  What's going on here?
>
> Thanks for the review. I think what we need is something like
> +               snd_soc_dapm_force_enable_pin(dapm, "ADC L power");
> +               snd_soc_dapm_force_enable_pin(dapm, "ADC R power");
> +               snd_soc_dapm_sync(dapm);
> +               if (!codec->component.card->instantiated) {
> +                       regmap_update_bits(rt5645->regmap, RT5645_PWR_DIG1,
> +                               RT5645_PWR_ADC_L_BIT | RT5645_PWR_ADC_R_BIT,
> +                               RT5645_PWR_ADC_L_BIT | RT5645_PWR_ADC_R_BIT);
> +               }

Just to make sure I understand... With the code above, the dapm state
is consistent. However, DAPM will only set the regmap bits when the
card is instantiated. So why do we still need to update the regmap? To
make sure we do not miss an early jack/button event? Or would we still
get jack irq if the pins are enabled a little later? (I guess we can
live with missing a button event at that stage, but we need the jack
state to be correct)

Also, I'm going to update rt5645_irq_detection to do nothing if the
codec is not initialized yet (just like rt286.c does). That should be
ok as we call rt5645_irq from rt5645_set_jack_detect, after the codec
is ready, which will update the initial jack status, and setup the
DAPM pins. Does that sound ok?

Thanks!


More information about the Alsa-devel mailing list