lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 31 Dec 2020 11:52:14 +0100
From:   Takashi Iwai <tiwai@...e.de>
To:     Kai-Heng Feng <kai.heng.feng@...onical.com>
Cc:     pierre-louis.bossart@...ux.intel.com, lgirdwood@...il.com,
        ranjani.sridharan@...ux.intel.com, kai.vehmanen@...ux.intel.com,
        daniel.baluta@....com, Mark Brown <broonie@...nel.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>,
        Guennadi Liakhovetski <guennadi.liakhovetski@...ux.intel.com>,
        Rander Wang <rander.wang@...el.com>,
        Payal Kshirsagar <payalskshirsagar1234@...il.com>,
        Keyon Jie <yang.jie@...ux.intel.com>,
        Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
        Marcin Rajwa <marcin.rajwa@...ux.intel.com>,
        Cezary Rojewski <cezary.rojewski@...el.com>,
        Fred Oh <fred.oh@...ux.intel.com>,
        Bard Liao <yung-chuan.liao@...ux.intel.com>,
        Amery Song <chao.song@...el.com>,
        sound-open-firmware@...a-project.org (moderated list:SOUND - SOUND OPEN
        FIRMWARE (SOF) DRIVERS),
        alsa-devel@...a-project.org (moderated list:SOUND - SOC LAYER / DYNAMIC
        AUDIO POWER MANAGEM...), linux-kernel@...r.kernel.org (open list)
Subject: Re: [PATCH 1/2] ASoC: SOF: Intel: hda: Modify existing helper to disable WAKEEN

On Tue, 29 Dec 2020 14:38:14 +0100,
Kai-Heng Feng wrote:
> 
> Modify hda_codec_jack_wake_enable() to also support disable WAKEEN.
> This is a preparation for next patch.
> 
> No functional change intended.

Maybe it's better to mention that this patch moves the WAKEEN
disablement call out of hda_codec_jack_check() into
hda_codec_jack_wake_enable(), too.


thanks,

Takashi

> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@...onical.com>
> ---
>  sound/soc/sof/intel/hda-codec.c | 16 +++++++---------
>  sound/soc/sof/intel/hda-dsp.c   |  6 ++++--
>  sound/soc/sof/intel/hda.h       |  2 +-
>  3 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c
> index 6875fa570c2c..bc9ac4abdab5 100644
> --- a/sound/soc/sof/intel/hda-codec.c
> +++ b/sound/soc/sof/intel/hda-codec.c
> @@ -63,16 +63,18 @@ static int hda_codec_load_module(struct hda_codec *codec)
>  }
>  
>  /* enable controller wake up event for all codecs with jack connectors */
> -void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev)
> +void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool enable)
>  {
>  	struct hda_bus *hbus = sof_to_hbus(sdev);
>  	struct hdac_bus *bus = sof_to_bus(sdev);
>  	struct hda_codec *codec;
>  	unsigned int mask = 0;
>  
> -	list_for_each_codec(codec, hbus)
> -		if (codec->jacktbl.used)
> -			mask |= BIT(codec->core.addr);
> +	if (enable) {
> +		list_for_each_codec(codec, hbus)
> +			if (codec->jacktbl.used)
> +				mask |= BIT(codec->core.addr);
> +	}
>  
>  	snd_hdac_chip_updatew(bus, WAKEEN, STATESTS_INT_MASK, mask);
>  }
> @@ -81,12 +83,8 @@ void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev)
>  void hda_codec_jack_check(struct snd_sof_dev *sdev)
>  {
>  	struct hda_bus *hbus = sof_to_hbus(sdev);
> -	struct hdac_bus *bus = sof_to_bus(sdev);
>  	struct hda_codec *codec;
>  
> -	/* disable controller Wake Up event*/
> -	snd_hdac_chip_updatew(bus, WAKEEN, STATESTS_INT_MASK, 0);
> -
>  	list_for_each_codec(codec, hbus)
>  		/*
>  		 * Wake up all jack-detecting codecs regardless whether an event
> @@ -97,7 +95,7 @@ void hda_codec_jack_check(struct snd_sof_dev *sdev)
>  					      codec->jackpoll_interval);
>  }
>  #else
> -void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev) {}
> +void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool enable) {}
>  void hda_codec_jack_check(struct snd_sof_dev *sdev) {}
>  #endif /* CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC */
>  EXPORT_SYMBOL_NS(hda_codec_jack_wake_enable, SND_SOC_SOF_HDA_AUDIO_CODEC);
> diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
> index 2b001151fe37..7d00107cf3b2 100644
> --- a/sound/soc/sof/intel/hda-dsp.c
> +++ b/sound/soc/sof/intel/hda-dsp.c
> @@ -617,7 +617,7 @@ static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend)
>  
>  #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
>  	if (runtime_suspend)
> -		hda_codec_jack_wake_enable(sdev);
> +		hda_codec_jack_wake_enable(sdev, true);
>  
>  	/* power down all hda link */
>  	snd_hdac_ext_bus_link_power_down_all(bus);
> @@ -683,8 +683,10 @@ static int hda_resume(struct snd_sof_dev *sdev, bool runtime_resume)
>  
>  #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
>  	/* check jack status */
> -	if (runtime_resume)
> +	if (runtime_resume) {
> +		hda_codec_jack_wake_enable(sdev, false);
>  		hda_codec_jack_check(sdev);
> +	}
>  
>  	/* turn off the links that were off before suspend */
>  	list_for_each_entry(hlink, &bus->hlink_list, list) {
> diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
> index 9ec8ae0fd649..a3b6f3e9121c 100644
> --- a/sound/soc/sof/intel/hda.h
> +++ b/sound/soc/sof/intel/hda.h
> @@ -650,7 +650,7 @@ void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev);
>   */
>  void hda_codec_probe_bus(struct snd_sof_dev *sdev,
>  			 bool hda_codec_use_common_hdmi);
> -void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev);
> +void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev, bool enable);
>  void hda_codec_jack_check(struct snd_sof_dev *sdev);
>  
>  #endif /* CONFIG_SND_SOC_SOF_HDA */
> -- 
> 2.29.2
> 

Powered by blists - more mailing lists