From nobody Mon Feb 9 12:26:50 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52B66C7EE24 for ; Mon, 15 May 2023 06:52:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240451AbjEOGwc (ORCPT ); Mon, 15 May 2023 02:52:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240454AbjEOGwK (ORCPT ); Mon, 15 May 2023 02:52:10 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2D892101 for ; Sun, 14 May 2023 23:51:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133507; x=1715669507; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zulnEGWCaE/ce7on2AHJOrEISXuutjX2aua9tmM2yVE=; b=WT6/sr+GjCk608Rgj65IJ2nebMUTwi178AL1Kp1f0n6v2MbpwaJEP69+ D97nwjSW6Nlv1JgEVQmmxBxYIRL6AaXmG9w3DJY1CL29wkSezALDU+zg/ ugze5Gt+PwEkCGMTX7A25yAw38flW3MjVsSmFgNlc1c/f4SzpiAMtvyKV GdVyQ5RSedoL/+7HziQ1dA9j9dntWeHwi6ntCTCoO2sBRdutciErm+XTT tzlo6SYj6xo4nGji2zm7u9TfJ6+oEupsU687RI48adLWrrweIq4Kk5Smw hC5SiIA7JOdrDLBKNDHptdJ4mG4UL3jA+aIAvEioEMdFAJFOnnHaLfyZz g==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966479" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966479" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:51:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908748" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908748" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2023 23:50:59 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org, tiwai@suse.de Cc: linux-kernel@vger.kernel.org, vinod.koul@linaro.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 17/26] soundwire: intel_ace2x: enable wake support Date: Mon, 15 May 2023 15:10:33 +0800 Message-Id: <20230515071042.2038-18-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> References: <20230515071042.2038-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart The WAKEEN and WAKESTS registers were moved to the per-link SHIM_VS area. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao --- drivers/soundwire/intel_ace2x.c | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c index 2e33e8a00b55..fe950b3ea3bc 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -31,6 +31,41 @@ static void intel_shim_vs_init(struct sdw_intel *sdw) usleep_range(10, 15); } =20 +static int intel_shim_check_wake(struct sdw_intel *sdw) +{ + void __iomem *shim_vs; + u16 wake_sts; + + shim_vs =3D sdw->link_res->shim_vs; + wake_sts =3D intel_readw(shim_vs, SDW_SHIM2_INTEL_VS_WAKESTS); + + return wake_sts & SDW_SHIM2_INTEL_VS_WAKEEN_PWS; +} + +static void intel_shim_wake(struct sdw_intel *sdw, bool wake_enable) +{ + void __iomem *shim_vs =3D sdw->link_res->shim_vs; + u16 wake_en; + u16 wake_sts; + + wake_en =3D intel_readw(shim_vs, SDW_SHIM2_INTEL_VS_WAKEEN); + + if (wake_enable) { + /* Enable the wakeup */ + wake_en |=3D SDW_SHIM2_INTEL_VS_WAKEEN_PWE; + intel_writew(shim_vs, SDW_SHIM2_INTEL_VS_WAKEEN, wake_en); + } else { + /* Disable the wake up interrupt */ + wake_en &=3D ~SDW_SHIM2_INTEL_VS_WAKEEN_PWE; + intel_writew(shim_vs, SDW_SHIM2_INTEL_VS_WAKEEN, wake_en); + + /* Clear wake status (W1C) */ + wake_sts =3D intel_readw(shim_vs, SDW_SHIM2_INTEL_VS_WAKESTS); + wake_sts |=3D SDW_SHIM2_INTEL_VS_WAKEEN_PWS; + intel_writew(shim_vs, SDW_SHIM2_INTEL_VS_WAKESTS, wake_sts); + } +} + static int intel_link_power_up(struct sdw_intel *sdw) { struct sdw_bus *bus =3D &sdw->cdns.bus; @@ -325,6 +360,9 @@ const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops =3D { .link_power_up =3D intel_link_power_up, .link_power_down =3D intel_link_power_down, =20 + .shim_check_wake =3D intel_shim_check_wake, + .shim_wake =3D intel_shim_wake, + .sync_arm =3D intel_sync_arm, .sync_go_unlocked =3D intel_sync_go_unlocked, .sync_go =3D intel_sync_go, --=20 2.25.1