Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp2352438qtg; Wed, 22 Mar 2023 22:32:34 -0700 (PDT) X-Google-Smtp-Source: AKy350b0leb1y0pL6YkVyKFUikgQb2mmESuPIEuQUTp6IKapE2OLQQ+K6j4YpGk5z8KAhvidh1j4 X-Received: by 2002:a17:903:41c1:b0:1a0:67fb:444b with SMTP id u1-20020a17090341c100b001a067fb444bmr5281910ple.2.1679549554133; Wed, 22 Mar 2023 22:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679549554; cv=none; d=google.com; s=arc-20160816; b=rTVX2tO6K5dUzBACsDfDPsAHqBLbCA0Gz+FXZAUaFeN94M1GJ5P17S3rmornAKvrX0 fR+mLDQXHcuOQ/LWV48oBrKt86198zgertr9NO9M9TPH3oOrzpe53i7pOjrqDI3uhx+9 EiyMGUBlgEXerMKiEx5Qfo2B+KVDFggZaWonhGiaFGJhcUK6nQc+YMf5ahWlkuoJh+Yi rSwWlN32HTLCV+ULQTHsMSpJNulxEElc8Dif3KCePTVLslhsZlkpzwuFvjfGCTD7P7sq 0Vcjwsx9zZIuMV+ShzSfU5czmMoXV8+O8oasbbCjg5qoMwLtnaViKkBQtv+6L5Qmnb7s 6DLg== 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=XxKMIwJLTsl0/FYFwpT5sCKaRootY6m9y6a3jW88l8ooWqTJsmtpzWrtQR0rZsCVVL F3LFsqYrHTxNrg8jRxodeAMoIjzEFiEYcQLnOvORfbEUVdQDqBJI03xnagCajYn/WS/V ktA5RM+/S/+0qXFQLaZ8xIrodta3UhrmKyIwpQLAE37cWaDnBTu5URRoZQXdinr9mp6C MtdKwT8BWzxzGHOzkvr/6osqIQGJvJNRz/0QzVwAfILNU2UAAxaaHzYg1V8XjLxq8a09 td3X6aff9pT9K3diftgwueAk+Qd4QPZsyMY5k9iONJIt3Tje09SP1a/VnzY3j8yNLWrY pFiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ahm0ncEE; 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 w12-20020a17090a8a0c00b00237b958814fsi849773pjn.74.2023.03.22.22.32.22; Wed, 22 Mar 2023 22:32:34 -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=ahm0ncEE; 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 S230472AbjCWFba (ORCPT + 99 others); Thu, 23 Mar 2023 01:31:30 -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: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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