From nobody Mon Feb 9 23:39:11 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 9F989C6FD1C for ; Thu, 23 Mar 2023 05:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230329AbjCWFbc (ORCPT ); Thu, 23 Mar 2023 01:31:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230409AbjCWFbD (ORCPT ); Thu, 23 Mar 2023 01:31:03 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B2492D151 for ; Wed, 22 Mar 2023 22:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549454; x=1711085454; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zfPDFAUHD0yEFTAl6FmNYsvKI40bPenFTeUs36GSzIY=; b=ahm0ncEEFKg/f2Cm3I46zkUeVUyq7gh0yzGrkJgELws71us6SAGazhJx b51L36b55YKh+Et3syTGAKs/sVQfdzxNopDXGM66FpJnVzjMCZs9NE4H6 2Z5DvufYxa2NzC8OTsFoU+tGHZcduLMf54XAdsz51JFIKEvYtoYWlYhHG vX0lRRheqqbXZ7M2KeTs7oEehyLhntdqPpM3leRj/xlTIC/jWrAZFaTUc kIWb4TOxIECnAAQwaeauO5QPqGYeNPMlYx46hqzM62m8PKvg/hAUYijiT mzlLobryrRn5j2WW8It8h8emihh1wOroqgyUtvxQgA8XHGvJ1oRiCLY56 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779408" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779408" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2023 22:30:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567117" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567117" 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; 22 Mar 2023 22:30:16 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org, broonie@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, tiwai@suse.de Subject: [PATCH 11/20] soundwire: intel_ace2x: add link power-up/down helpers Date: Thu, 23 Mar 2023 13:44:43 +0800 Message-Id: <20230323054452.1543233-12-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230323054452.1543233-1-yung-chuan.liao@linux.intel.com> References: <20230323054452.1543233-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 only power-up/down for now, the frequency is not set. 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 | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c index 1c47bb2adb93..5b6a608e63ba 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -10,12 +10,62 @@ #include #include #include +#include #include "cadence_master.h" #include "bus.h" #include "intel.h" =20 +static int intel_link_power_up(struct sdw_intel *sdw) +{ + int ret; + + mutex_lock(sdw->link_res->shim_lock); + + ret =3D hdac_bus_eml_sdw_power_up_unlocked(sdw->link_res->hbus, sdw->inst= ance); + if (ret < 0) { + dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_power_up failed: %d\n", + __func__, ret); + goto out; + } + + sdw->cdns.link_up =3D true; +out: + mutex_unlock(sdw->link_res->shim_lock); + + return ret; +} + +static int intel_link_power_down(struct sdw_intel *sdw) +{ + int ret; + + mutex_lock(sdw->link_res->shim_lock); + + sdw->cdns.link_up =3D false; + + ret =3D hdac_bus_eml_sdw_power_down_unlocked(sdw->link_res->hbus, sdw->in= stance); + if (ret < 0) { + dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_power_down failed: %d\n", + __func__, ret); + + /* + * we leave the sdw->cdns.link_up flag as false since we've disabled + * the link at this point and cannot handle interrupts any longer. + */ + } + + mutex_unlock(sdw->link_res->shim_lock); + + return ret; +} + const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops =3D { .debugfs_init =3D intel_ace2x_debugfs_init, .debugfs_exit =3D intel_ace2x_debugfs_exit, + + .link_power_up =3D intel_link_power_up, + .link_power_down =3D intel_link_power_down, }; EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL); + +MODULE_IMPORT_NS(SND_SOC_SOF_HDA_MLINK); --=20 2.25.1