From patchwork Mon May 15 07:10:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 93896 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6720143vqo; Mon, 15 May 2023 00:02:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4WYydBP1/NWKZC59g2zfHEAGbjxDO42MhxgODr4kUHnGjjIosRTdjDRutV8OCN5Bmt4q1i X-Received: by 2002:a05:6a00:17a3:b0:636:f5f4:5308 with SMTP id s35-20020a056a0017a300b00636f5f45308mr46357935pfg.7.1684134167340; Mon, 15 May 2023 00:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684134167; cv=none; d=google.com; s=arc-20160816; b=evMpy1CIi1aysAMdl8aGChdGdbpG88w1ZLmjtkp+uru0ZfYGlPdXVzz5tQ7a8sliMh dQDwpTlqy/FydcLJcqn0XJwo2sNVCK5GWVGR4iCgB9Tul4VLhfpz6dapvZ23Eb/JBoXi 4RzoZfXUavDxQpuY0EsdF22+yo1fwZYJFh96UsnhQJ9Y91cLZIioALtmkiHE6d0NgeGG E70jOAKjwCjTLWxKSMZhjJIthxpQFjPyBboR+zWxi7GxWTaSX9MdcJQpUrz3Yv4MITSF gdDUIy3J9tw+RcsEDOkOHQI96F2Dm6yFpixS56UGKhuPXq7kmqItG8ZnU1RJu9HMzOCB YaQg== 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=LI+SlmHiIWQo5zcz6KR7g4k9ybTiiToFoUz9HGLQ2wY=; b=k2/29dJ8I9WPp73ipTRPOVpBUNuZmEt3j/nNOCcvAwk90kEfaVHLCpP+TXE6HTDqGw +v1m7KcScEEGfi+SfzmLVfauI+VFNPbbIFovqjqEfdzSen90MwKBdes6BA0gNiC0KjOJ udFdxLWYzg8iQEPMnM76N4/twPEwCyzla0JM0jeCendM7lqRq3pWNakEeBrN4FniyWFJ tiExZF0or5xW9Th60REUNusbdhxp95zbOSoqFGAczJTskbmEcwh75cCY7iuQIy4gdgvX DyOXMH9wurPY9OHKbiTyV5hlWLg4wVLQgIbZ6z3zcDDBBdA94POGWANRhWx+kUly/Pv7 65zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TxaZ0l8w; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y76-20020a62644f000000b0063b82925d69si16482048pfb.337.2023.05.15.00.02.20; Mon, 15 May 2023 00:02:47 -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=TxaZ0l8w; 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 S240199AbjEOGu4 (ORCPT + 99 others); Mon, 15 May 2023 02:50:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240241AbjEOGur (ORCPT ); Mon, 15 May 2023 02:50:47 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5728E1BE4 for ; Sun, 14 May 2023 23:50:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684133436; x=1715669436; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aAq1nEu0w9jquwDbM8Ql9Dgc92dfowXErHtU9iHqtg8=; b=TxaZ0l8wg/g2jE/7zo9RI6M0iFjVo5bXlw3Hveecx4e3ZlwzGMXyZQJ0 47JjznsyZTyoE1doqL5agoWLlfRVrBnZyDGCwfaHMW+b4lhb2w2iZuubM dVztqYchRLcEMcYwgFbQPJ47C6nuwx6zESnyTKCz4XAxzQYBskrIX8RT0 SnHOtlkaG1obMLVDny7hDjP/gkFEK2CvsFw1Lo4Rsv0NzatosQeX6oMAU C7Y/RS4y8Lu4Di6kht2Iid0RKRCEPUKJ65+w/muv6oT2boGhVrsOj6Mg4 Jx3HmQ65monnG3E6nA5h+L/mrgmfvvgNiKYP1ghy9O0U4Iil0z41IAS5u A==; X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="349966321" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="349966321" 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:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10710"; a="694908635" X-IronPort-AV: E=Sophos;i="5.99,275,1677571200"; d="scan'208";a="694908635" 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:33 -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 06/26] ASoC/soundwire: intel: pass hdac_bus pointer for link management Date: Mon, 15 May 2023 15:10:22 +0800 Message-Id: <20230515071042.2038-7-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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765942668646730606?= X-GMAIL-MSGID: =?utf-8?q?1765942668646730606?= From: Pierre-Louis Bossart The hdac_bus pointer is used to access the extended link information and handle power management. Pass it from the SOF driver down to the auxiliary devices. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Bard Liao Acked-by: Mark Brown --- drivers/soundwire/intel.h | 4 ++++ drivers/soundwire/intel_init.c | 2 ++ include/linux/soundwire/sdw_intel.h | 4 ++++ sound/soc/sof/intel/hda.c | 1 + 4 files changed, 11 insertions(+) diff --git a/drivers/soundwire/intel.h b/drivers/soundwire/intel.h index 1b23292bb8be..cf9db4906de4 100644 --- a/drivers/soundwire/intel.h +++ b/drivers/soundwire/intel.h @@ -4,6 +4,8 @@ #ifndef __SDW_INTEL_LOCAL_H #define __SDW_INTEL_LOCAL_H +struct hdac_bus; + /** * struct sdw_intel_link_res - Soundwire Intel link resource structure, * typically populated by the controller driver. @@ -23,6 +25,7 @@ * @link_mask: global mask needed for power-up/down sequences * @cdns: Cadence master descriptor * @list: used to walk-through all masters exposed by the same controller + * @hbus: hdac_bus pointer, needed for power management */ struct sdw_intel_link_res { const struct sdw_intel_hw_ops *hw_ops; @@ -42,6 +45,7 @@ struct sdw_intel_link_res { u32 link_mask; struct sdw_cdns *cdns; struct list_head list; + struct hdac_bus *hbus; }; struct sdw_intel { diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c index 43d339c6bcee..c918d2b81cc3 100644 --- a/drivers/soundwire/intel_init.c +++ b/drivers/soundwire/intel_init.c @@ -84,6 +84,8 @@ static struct sdw_intel_link_dev *intel_link_dev_register(struct sdw_intel_res * link->shim_mask = &ctx->shim_mask; link->link_mask = ctx->link_mask; + link->hbus = res->hbus; + /* now follow the two-step init/add sequence */ ret = auxiliary_device_init(auxdev); if (ret < 0) { diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h index 88eb5bf98140..c4281aa06e2e 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -269,6 +269,8 @@ struct sdw_intel_slave_id { struct sdw_slave_id id; }; +struct hdac_bus; + /** * struct sdw_intel_ctx - context allocated by the controller * driver probe @@ -324,6 +326,7 @@ struct sdw_intel_ctx { * @shim_base: sdw shim base. * @alh_base: sdw alh base. * @ext: extended HDaudio link support + * @hbus: hdac_bus pointer, needed for power management */ struct sdw_intel_res { const struct sdw_intel_hw_ops *hw_ops; @@ -339,6 +342,7 @@ struct sdw_intel_res { u32 shim_base; u32 alh_base; bool ext; + struct hdac_bus *hbus; }; /* diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 793baf60c78b..4d48f4018617 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -189,6 +189,7 @@ static int hda_sdw_probe(struct snd_sof_dev *sdev) res.ops = &sdw_callback; res.dev = sdev->dev; res.clock_stop_quirks = sdw_clock_stop_quirks; + res.hbus = sof_to_bus(sdev); /* * ops and arg fields are not populated for now,