From nobody Mon Feb 9 16:19:35 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 83419C6FD1C for ; Thu, 23 Mar 2023 05:33:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230464AbjCWFdM (ORCPT ); Thu, 23 Mar 2023 01:33:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230406AbjCWFcd (ORCPT ); Thu, 23 Mar 2023 01:32:33 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C848632E69 for ; Wed, 22 Mar 2023 22:31:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679549501; x=1711085501; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R3GyCN8p+cJBxO9BTibcqpeTRWzFQliw1LPEGnZdocY=; b=VMZ3Wyb/VSSzKrOPiOwT7pc5BwcZQuDv0PoaGz9TZsUpT59uXeQd1sbv +7O/tB9b03s6Ss62knNnx4jGubyLTMoUC0WSLFoJvoNpMYWAdN4PPjlgY BMN+rAvA44Bqj3K788wDANuL0qKElPpSf+Ezcf8IikZfEb+h3aKEOhI82 3qisOA14Y/SLxfrl8rIv8ZnRndMeDFZa3j3k7M98I2BFG5Fhe0Cl3Od+8 ODznk2zSdkrpS5wkgN8RCas8Khhln0ZC3kE+UzjPUlWoJcxWT48GmNY84 0QXcsUCs1go7QadRFT04IeFFbYS2fPdFmj3BsnzCjwomXfMf8s9LgTiXQ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="327779513" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="327779513" 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:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675567305" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675567305" 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:39 -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 20/20] soundwire: intel_ace2x: add new_peripheral_assigned callback Date: Thu, 23 Mar 2023 13:44:52 +0800 Message-Id: <20230323054452.1543233-21-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 Add the abstraction needed to only program the LSDIID registers for the HDaudio extended links. It's perfectly fine to program this register multiple times in case devices lose sync and reattach. 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 | 12 ++++++++++++ drivers/soundwire/intel_auxdevice.c | 16 ++++++++++++++++ include/linux/soundwire/sdw_intel.h | 3 +++ 3 files changed, 31 insertions(+) diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2= x.c index a12fee8a5bfa..65deb4345354 100644 --- a/drivers/soundwire/intel_ace2x.c +++ b/drivers/soundwire/intel_ace2x.c @@ -350,6 +350,16 @@ static int intel_register_dai(struct sdw_intel *sdw) dais, num_dai); } =20 +static void intel_program_sdi(struct sdw_intel *sdw, int dev_num) +{ + int ret; + + ret =3D hdac_bus_eml_sdw_set_lsdiid(sdw->link_res->hbus, sdw->instance, d= ev_num); + if (ret < 0) + dev_err(sdw->cdns.dev, "%s: could not set lsdiid for link %d %d\n", + __func__, sdw->instance, dev_num); +} + 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, @@ -372,6 +382,8 @@ const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops =3D { .sync_go_unlocked =3D intel_sync_go_unlocked, .sync_go =3D intel_sync_go, .sync_check_cmdsync_unlocked =3D intel_check_cmdsync_unlocked, + + .program_sdi =3D intel_program_sdi, }; EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL); =20 diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_= auxdevice.c index b02cef4f4b66..6e02782ef211 100644 --- a/drivers/soundwire/intel_auxdevice.c +++ b/drivers/soundwire/intel_auxdevice.c @@ -60,6 +60,21 @@ static int generic_post_bank_switch(struct sdw_bus *bus) return sdw->link_res->hw_ops->post_bank_switch(sdw); } =20 +static void generic_new_peripheral_assigned(struct sdw_bus *bus, int dev_n= um) +{ + struct sdw_cdns *cdns =3D bus_to_cdns(bus); + struct sdw_intel *sdw =3D cdns_to_intel(cdns); + + /* paranoia check, this should never happen */ + if (dev_num < INTEL_DEV_NUM_IDA_MIN || dev_num > SDW_MAX_DEVICES) { + dev_err(bus->dev, "%s: invalid dev_num %d\n", __func__, dev_num); + return; + } + + if (sdw->link_res->hw_ops->program_sdi) + sdw->link_res->hw_ops->program_sdi(sdw, dev_num); +} + static int sdw_master_read_intel_prop(struct sdw_bus *bus) { struct sdw_master_prop *prop =3D &bus->prop; @@ -117,6 +132,7 @@ static struct sdw_master_ops sdw_intel_ops =3D { .pre_bank_switch =3D generic_pre_bank_switch, .post_bank_switch =3D generic_post_bank_switch, .read_ping_status =3D cdns_read_ping_status, + .new_peripheral_assigned =3D generic_new_peripheral_assigned, }; =20 /* diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/= sdw_intel.h index bafc6f2554b0..1a8f32059cd8 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -399,6 +399,7 @@ struct sdw_intel; * @sync_go: helper for multi-link synchronization * @sync_check_cmdsync_unlocked: helper for multi-link synchronization * and bank switch - shim_lock is assumed to be locked at higher level + * @program_sdi: helper for codec command/control based on dev_num */ struct sdw_intel_hw_ops { void (*debugfs_init)(struct sdw_intel *sdw); @@ -425,6 +426,8 @@ struct sdw_intel_hw_ops { int (*sync_go_unlocked)(struct sdw_intel *sdw); int (*sync_go)(struct sdw_intel *sdw); bool (*sync_check_cmdsync_unlocked)(struct sdw_intel *sdw); + + void (*program_sdi)(struct sdw_intel *sdw, int dev_num); }; =20 extern const struct sdw_intel_hw_ops sdw_intel_cnl_hw_ops; --=20 2.25.1