Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1630695rwd; Mon, 15 May 2023 00:15:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ40W1S3scptiXIviEbKLQ4qWU8V7FNCFurR2WtTnbPduHNYdq3P7XvhVdF5hSz58IiW+pjW X-Received: by 2002:a17:90b:3a8e:b0:247:6ead:d0ed with SMTP id om14-20020a17090b3a8e00b002476eadd0edmr33144803pjb.28.1684134919144; Mon, 15 May 2023 00:15:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684134919; cv=none; d=google.com; s=arc-20160816; b=yfukgbj+20xvncJqE8YeCJdyeFVZZK/cKztJLNkkjZxNQmPvG9zZBRBcXB1DbNaVOX 7VJX1L05fKYRbzZXSxF1ZdJVL75fCmH5mj8evnCilVWeE3OgNVRYR6cY+xEEo9+S1gXh puM8hdBjcZUIRCA7YcHyzzhpRV7KWLMhgyIvdzdgJe5MmDyExLuJTKgiV7rAFram9ts9 yE2d1WzEfXgvdRt1g/XZkuUYGd87vi//H07xZlBM6vKi0CtP0ZUcP189BfVYedglkPNw Ev5woFu7S7beucCsqYSw99LV/U+YZvg3OmU6O5U9xb4lvyUnq2lryhdipj54bbHjlW1H U3oQ== 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 :dkim-signature; bh=b8/+lkGQ4xQ4v5F5224EhB8/afRLlGzzTSmckQo4XHE=; b=NNHDMNb8g3HU56hSBECoDq1qVaTkd9JNIx1SjF5QvwqDuwjGugGazfXSvVMEQoYZm7 QPPeZZ5Nc3P/+Hqq0yoASqN3ZKZ3vrvt+uX/rsISwbN/87pj8BO3C/DCm4KqdbFaKbUZ RGvLNAq6h1in/3Zz2v+/B5E4CXSAs8oQkQMV50G/988y6rOgTiiUWS3A4TQ0T0xocMeF y4EBrbTvG6eRziuEAs40CXtnFQVBe41YUoBMPNBOQJM7tS1YRhc8qqCTpE1L9iIp0n/N oMymMrTInzFHaoDNnv59GNuUG/es0X2HGMVMccdzzYbDp1kA5RIRoyjMyFXqYmNP6bjX ObMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Jdxs3TBc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a17090a764500b00246b7a596eesi9737785pjl.146.2023.05.15.00.15.06; Mon, 15 May 2023 00:15:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Jdxs3TBc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240359AbjEOGvi (ORCPT + 99 others); Mon, 15 May 2023 02:51:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240366AbjEOGvY (ORCPT ); Mon, 15 May 2023 02:51:24 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE5512684 for ; Sun, 14 May 2023 23:50:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133458; x=1715669458; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zfPDFAUHD0yEFTAl6FmNYsvKI40bPenFTeUs36GSzIY=; b=Jdxs3TBck9QVe9l8Y9bzOVtPFLEbll9RrBaJ6UaNWVxy85WG1U1haccE eMf0Y0FcSlvoNo7iJY5vjs1vBCJi2+nfunSv/qGr/jLukmqpCKCGluz+E 2buV0+4uEMrg72GaOkNamEpoZ1i2AUcrVTwzvrcMUjH3z0aJKOcflA4nJ 4mSTnBmTOOI0rFkIaCqROjSNAo5SFRCih99N+gVygr6Q3p7Xmfw1DkyuZ KVj5fnnAM1RmQja+irj/bAW5lGTdBOp0UX4A0s+zz7A+RNX0qN9jRgV0E RniUYmcg5WPd4dLXmFayVSHNuXevun+JjZuLZ6gfQaa0RmCOKGHz+fMxO A==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966377" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966377" 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:50:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908697" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908697" 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:45 -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 11/26] soundwire: intel_ace2x: add link power-up/down helpers Date: Mon, 15 May 2023 15:10:27 +0800 Message-Id: <20230515071042.2038-12-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: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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éter 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_ace2x.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" +static int intel_link_power_up(struct sdw_intel *sdw) +{ + int ret; + + mutex_lock(sdw->link_res->shim_lock); + + ret = hdac_bus_eml_sdw_power_up_unlocked(sdw->link_res->hbus, sdw->instance); + 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 = 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 = false; + + ret = hdac_bus_eml_sdw_power_down_unlocked(sdw->link_res->hbus, sdw->instance); + 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 = { .debugfs_init = intel_ace2x_debugfs_init, .debugfs_exit = intel_ace2x_debugfs_exit, + + .link_power_up = intel_link_power_up, + .link_power_down = intel_link_power_down, }; EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL); + +MODULE_IMPORT_NS(SND_SOC_SOF_HDA_MLINK); -- 2.25.1