From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: hp_pin was NULL value Date: Tue, 15 Jan 2019 09:57:32 +0100 Message-ID: References: <6FAB7C47BCF00940BB0999A99BE3547A18420E8B@RTITMBSV02.realtek.com.tw> <6FAB7C47BCF00940BB0999A99BE3547A18420EBD@RTITMBSV02.realtek.com.tw> <6FAB7C47BCF00940BB0999A99BE3547A184210B1@RTITMBSV02.realtek.com.tw> <6FAB7C47BCF00940BB0999A99BE3547A184210E5@RTITMBSV02.realtek.com.tw> <6FAB7C47BCF00940BB0999A99BE3547A184210FC@RTITMBSV02.realtek.com.tw> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 8D6BF2666B3 for ; Tue, 15 Jan 2019 09:57:34 +0100 (CET) In-Reply-To: <6FAB7C47BCF00940BB0999A99BE3547A184210FC@RTITMBSV02.realtek.com.tw> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Kailang Cc: " (alsa-devel@alsa-project.org)" List-Id: alsa-devel@alsa-project.org On Tue, 15 Jan 2019 09:17:24 +0100, Kailang wrote: > > > Hi Takashi, > > Sorry!! Maybe I don't understand what you mean. > Please see below. > > --- patch_realtek.c.orig 2019-01-11 16:28:43.745957854 +0800 > +++ patch_realtek.c 2019-01-15 16:09:56.017873567 +0800 > @@ -3221,12 +3221,29 @@ static void alc256_shutup(struct hda_cod > snd_hda_shutup_pins(codec); > } > > +static void alc225_hp_init(struct hda_codec *codec) > +{ > + struct alc_spec *spec = codec->spec; > + hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; > + int i, val; > + int coef38, coef0d, coef36; > + printk("%s-start hp=0x%x\n",__func__,hp_pin); > + if (!hp_pin) > + return; > + > + alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); > + msleep(50); > + alc_update_coef_idx(codec, 0x4a, 1<<15, 0); > + printk("%s-end hp=0x%x\n",__func__,hp_pin); > +} > + > static void alc225_init(struct hda_codec *codec) > { > struct alc_spec *spec = codec->spec; > hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; > bool hp1_pin_sense, hp2_pin_sense; > > + alc225_hp_init(codec); > if (!hp_pin) > return; > > @@ -3262,6 +3279,7 @@ static void alc225_init(struct hda_codec > > alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); > alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ > + printk("%s hp=0x%x\n",__func__,hp_pin); > } ... and I don't understand what's your problem. Is it about that alc255_hp_init() gets called at resume in addition to the boot time? If so, this is the intended behavior. thanks, Takashi > > -----Original Message----- > From: Takashi Iwai > Sent: Tuesday, January 15, 2019 3:54 PM > To: Kailang > Cc: (alsa-devel@alsa-project.org) > Subject: Re: hp_pin was NULL value > > On Tue, 15 Jan 2019 08:43:40 +0100, > Kailang wrote: > > > > > > No, it not expected. > > It will enter two times after boot ready. > > I think it could add a flag in alc225_hp_init(). > > To make sure it only excute one time. How do you think about? > > Where was it called, actually? The call of patch_ops.init is found in several places: once in snd_hda_codec_build_controls() just before creating controls (which is the boot time init), and at resume, alc269_resume(). > > And, as already explained, we have to call this at resume, because it's not guaranteed that it's been already called in the case of hibernation. > > > thanks, > > Takashi > > > > > -----Original Message----- > > From: Takashi Iwai > > Sent: Tuesday, January 15, 2019 2:37 PM > > To: Kailang > > Cc: (alsa-devel@alsa-project.org) > > Subject: Re: hp_pin was NULL value > > > > On Tue, 15 Jan 2019 03:31:33 +0100, > > Kailang wrote: > > > > > > Hi Takashi, > > > > > > Could you receive this email? > > > > > > BR, > > > Kailang > > > > > > -----Original Message----- > > > From: Kailang > > > Sent: Thursday, January 10, 2019 11:14 AM > > > To: 'Takashi Iwai' > > > Cc: (alsa-devel@alsa-project.org) > > > Subject: RE: hp_pin was NULL value > > > > > > Hi Takashi, > > > > > > I simulate test your prefer function. > > > I put alc225_hp_init() in alc225_init(). > > > If system boot ready, I write 1 to power_save of /sys/module/.... > > > The print message as below. It called two times until boot ready. > > > If System enter to power save, play stream will wake up codec. It also call alc225_hp_init(). > > > > > > [ 21.497524] alc225_init hp_pin=0x21 > > > [ 21.497526] alc225_hp_init-s hp=0x21 > > > [ 22.140076] alc225_hp_init-e hp=0x21 > > > [ 22.183496] snd_hda_codec_realtek hdaudioC0D2: Headset jack set to unplugged mode. > > > [ 22.184681] snd_hda_codec_realtek hdaudioC0D2: Headset jack set to unplugged mode. > > > [ 22.186846] alc225_shutup hp_pin=0x21 > > > [ 22.187831] input: HDA Intel Line Out as /devices/pci0000:00/0000:00:1b.0/sound/card0/input5 > > > [ 22.188055] input: HDA Intel Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card0/input6 > > > [ 22.205104] alc225_init hp_pin=0x21 > > > [ 22.205108] alc225_hp_init-s hp=0x21 > > > [ 22.852123] alc225_hp_init-e hp=0x21 > > > [ 22.894772] snd_hda_codec_realtek hdaudioC0D2: Headset jack set to unplugged mode. > > > ############ Boot ready ############## [ 116.832084] alc225_shutup > > > hp_pin=0x21 ==> echo 1 to power_save > > > [ 120.002582] alc225_init hp_pin=0x21 ==> play system sound > > > [ 120.002586] alc225_hp_init-s hp=0x21 [ 120.644128] > > > alc225_hp_init-e hp=0x21 > > > > It wasn't clear to me whether you meant this as a success or a failure... Did the patch work as expected, no? > > > > > > thanks, > > > > Takashi > > > > ------Please consider the environment before printing this e-mail. > > >