Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13847610pxu; Mon, 4 Jan 2021 06:12:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUagzv4DK86aXqrKuM4jPk+aj5noem0QRlCYN4yAVaUL/JqLB2tqeLvuMVdL7eBLivL/DU X-Received: by 2002:a17:906:3499:: with SMTP id g25mr67940039ejb.18.1609769568712; Mon, 04 Jan 2021 06:12:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609769568; cv=none; d=google.com; s=arc-20160816; b=JXHoZlBUzctwcr4UeqF6/KTdaU3kTuKl+Fs1wRsmOiOzrNgpujd9Lwniou80elv/6r Ugg7ykCyk2dGjrbAsRz5iLDHvkt7R/gW7XMwvurgQxD9V3xW+11QNrO5T92GyYlzuFIZ RygxpuWVFjATNPt70Ole6TMEjdE0ZXcljhT/s/S/vQxbdFjcEpLjFfiLO1L/EWbKL7ul qDM3YH/EelhKTDq/rcXq7y21zKL/i86jF0zkwcLO4NEaZb4u/XDYTtR0jeHyhSr28ftA Lc2OBhunekq4Cxc+vurVrdhBXpYd714rfKeY6igci+168wni18jhfFUY39uqEB+F1QgZ Uzag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8GCLjXhix68b/2q/L12UwV5Mm/3frc/rmZycOsigkZw=; b=WhB+2XlKnTMWL1sL6ixXJ+O01DuakA5qLNvP7VXAwc7xtBKJOEYDyXVcEKiuXFkf7e DnpKRVssxZq5BsUhWbiE6HBuZrEiPyPd7k7opFWBqZ4oyAyUfPTyv6S/j6NFWjywV756 oQ7gJRz6dMNiiaIsvVEAMujQ6Qa1oIKv1W+pEUrElCJAYrn/AFSDTCQNj+UeSDwkpe68 IVqKJ/F+iCz4dZfW+5Uo0gOH4EoUqkUYdRGzs5nbMXhsKr8nebuLGbLNI4Dx72ad29e1 n0g689KurCGx/K4riZ2Xr+S4mQl0iSgO1gg+4ASHFm8U1q6uOvJxuhjzJ41Q41bEECwd LB9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 96si33901796edq.111.2021.01.04.06.12.25; Mon, 04 Jan 2021 06:12:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726961AbhADOKM (ORCPT + 99 others); Mon, 4 Jan 2021 09:10:12 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:48453 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726258AbhADOKF (ORCPT ); Mon, 4 Jan 2021 09:10:05 -0500 Received: from 36-229-96-78.dynamic-ip.hinet.net ([36.229.96.78] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kwQXk-0006pa-Mg; Mon, 04 Jan 2021 14:09:09 +0000 From: Kai-Heng Feng To: pierre-louis.bossart@linux.intel.com, lgirdwood@gmail.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com, daniel.baluta@nxp.com Cc: Kai-Heng Feng , Mark Brown , Jaroslav Kysela , Takashi Iwai , Guennadi Liakhovetski , Rander Wang , Payal Kshirsagar , Keyon Jie , Kuninori Morimoto , Marcin Rajwa , Cezary Rojewski , Fred Oh , Amery Song , sound-open-firmware@alsa-project.org (moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS), alsa-devel@alsa-project.org (moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 2/3] ASoC: SOF: Intel: hda: Modify existing helper to disable WAKEEN Date: Mon, 4 Jan 2021 22:08:51 +0800 Message-Id: <20210104140853.228448-2-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210104140853.228448-1-kai.heng.feng@canonical.com> References: <20210104140853.228448-1-kai.heng.feng@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Modify hda_codec_jack_wake_enable() to also support disable WAKEEN. In addition, this patch also moves the WAKEEN disablement call out of hda_codec_jack_check() into hda_codec_jack_wake_enable(). This is a preparation for next patch. No functional change intended. Signed-off-by: Kai-Heng Feng --- v2: Mention it moves the disabling part into another function. 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 df59c79cfdfc..b7e9931ead57 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 @@ -96,7 +94,7 @@ void hda_codec_jack_check(struct snd_sof_dev *sdev) pm_request_resume(&codec->core.dev); } #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