From nobody Sat Nov 30 05:36:45 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 253BD1885A7; Wed, 11 Sep 2024 11:59:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055945; cv=none; b=lht+1hdov5mvPwXUn9lME0u1A0Z3ti1TLKC6H7c8ydCbRRwunbKnAYFo/bnxE3HDZGj5dcfeZRN3ZuXm6XNXc4Ii7jxHcqH5xgWMj1KmKf3rzVizH9nyShhsYFewYyXOVuKe6fJG0SYP1QPqTL8GAXNWInlifIxFKh+AQN9s5Pw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055945; c=relaxed/simple; bh=CG9df6F+03dKHnVkxP0n+YhDuVOghFDYTIJ+MPKHnM0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JktV8r2q+MZgKxGrWp1q2QpdzqVvDF1ugFrgvT0yso7TWK7F8luSJ8ZN+sUDU4ZGECvDOAdMSBKkzNGhJGaGyOecqVoojgl9ECPZb+3dMykCH/PCaymohHmxKEGS7MxakYB/SYYQsvxLVToaEHnQvIlEIL+3KvXx2Ul5CAxcivs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=BBY2/Y7F; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BBY2/Y7F" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726055944; x=1757591944; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CG9df6F+03dKHnVkxP0n+YhDuVOghFDYTIJ+MPKHnM0=; b=BBY2/Y7Fe+ZJvOLft/Ow4/QzEsBW5BI6jwFb9OK9w4cxYUSCyq6t4SA5 4xrdtEXuGKrEKpozSzGOBRTw6Ae6aq3mx5gIusg5lfS78n7KfrFRXRuzB 2Jo6sFqHdNUn66ZBo4/pLy8GZJvDsY01GUq/rmq2bFwJMnppH5GRGhhMP QdEavV9hnCMA2IbaewRGbLEVEBdEVe/RzKFzd35VG6lFVzb1BwmARr1NK 3BK2xXP+zL1kX6syJXCyYn0UMtKkRqm+ae6+uku26tyg2yylruBJ2/X5X 7q2SCNcs0lgLhy/omi74W5N0qx/+aW0uDFSe3ewveVbqpq2iDOMKOmP6X Q==; X-CSE-ConnectionGUID: H0MMd+sqSF6QBfkrudW+7Q== X-CSE-MsgGUID: JUqaFUfaSO614pYOoax58A== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35417210" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35417210" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:04 -0700 X-CSE-ConnectionGUID: xtXFVfZvStG+TGBo06TOFw== X-CSE-MsgGUID: lgRKWtBaRwes+aYbZB9wyA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67292715" Received: from bvivekan-mobl2.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.254]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:01 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 01/14] soundwire: mipi_disco: add MIPI-specific property_read_bool() helpers Date: Wed, 11 Sep 2024 19:58:14 +0800 Message-ID: <20240911115827.233171-2-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> References: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart The existing device/fwnode_property_read_bool() helpers only check if the property is present. The MIPI DisCo for SoundWire specification allows properties to be exposed with a value of 'false'. Using the standard helpers to retrieve the MIPI-defined properties causes all kinds of logical inversions leading to loss of functionality - such as jack detection in clock-stop mode broken when the device properties are read in Realtek codec drivers. This patch adds new MIPI/SoundWire helpers which first check if the property is present, and then return the actual value extracted from platform firmware. Modifying the default property handling was considered as a possible solution, but it could lead to other types of logical inversions breaking 'working' setups. Andy Shevchenko also pointed out that DT keeps values in the BE32 format, it's probably best to avoid endianness complications. The path of least resistance was chosen, with MIPI-specific helpers which can be tested and with no side effects outside of the SoundWire subsystem. Closes: https://github.com/thesofproject/linux/issues/5129 Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- drivers/soundwire/mipi_disco.c | 50 ++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/drivers/soundwire/mipi_disco.c b/drivers/soundwire/mipi_disco.c index e5d9df26d4dc..fdab3d4a1379 100644 --- a/drivers/soundwire/mipi_disco.c +++ b/drivers/soundwire/mipi_disco.c @@ -23,6 +23,26 @@ #include #include "bus.h" =20 +static bool mipi_fwnode_property_read_bool(const struct fwnode_handle *fwn= ode, + const char *propname) +{ + int ret; + u8 val; + + if (!fwnode_property_present(fwnode, propname)) + return false; + ret =3D fwnode_property_read_u8_array(fwnode, propname, &val, 1); + if (ret < 0) + return false; + return !!val; +} + +static bool mipi_device_property_read_bool(const struct device *dev, + const char *propname) +{ + return mipi_fwnode_property_read_bool(dev_fwnode(dev), propname); +} + /** * sdw_master_read_prop() - Read Master properties * @bus: SDW bus instance @@ -48,11 +68,11 @@ int sdw_master_read_prop(struct sdw_bus *bus) return -EIO; } =20 - if (fwnode_property_read_bool(link, + if (mipi_fwnode_property_read_bool(link, "mipi-sdw-clock-stop-mode0-supported")) prop->clk_stop_modes |=3D BIT(SDW_CLK_STOP_MODE0); =20 - if (fwnode_property_read_bool(link, + if (mipi_fwnode_property_read_bool(link, "mipi-sdw-clock-stop-mode1-supported")) prop->clk_stop_modes |=3D BIT(SDW_CLK_STOP_MODE1); =20 @@ -114,7 +134,7 @@ int sdw_master_read_prop(struct sdw_bus *bus) fwnode_property_read_u32(link, "mipi-sdw-default-frame-col-size", &prop->default_col); =20 - prop->dynamic_frame =3D fwnode_property_read_bool(link, + prop->dynamic_frame =3D mipi_fwnode_property_read_bool(link, "mipi-sdw-dynamic-frame-shape"); =20 fwnode_property_read_u32(link, "mipi-sdw-command-error-threshold", @@ -153,13 +173,13 @@ static int sdw_slave_read_dp0(struct sdw_slave *slave, dp0->words, dp0->num_words); } =20 - dp0->BRA_flow_controlled =3D fwnode_property_read_bool(port, + dp0->BRA_flow_controlled =3D mipi_fwnode_property_read_bool(port, "mipi-sdw-bra-flow-controlled"); =20 - dp0->simple_ch_prep_sm =3D fwnode_property_read_bool(port, + dp0->simple_ch_prep_sm =3D mipi_fwnode_property_read_bool(port, "mipi-sdw-simplified-channel-prepare-sm"); =20 - dp0->imp_def_interrupts =3D fwnode_property_read_bool(port, + dp0->imp_def_interrupts =3D mipi_fwnode_property_read_bool(port, "mipi-sdw-imp-def-dp0-interrupts-supported"); =20 return 0; @@ -220,7 +240,7 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, "mipi-sdw-max-grouping-supported", &dpn[i].max_grouping); =20 - dpn[i].simple_ch_prep_sm =3D fwnode_property_read_bool(node, + dpn[i].simple_ch_prep_sm =3D mipi_fwnode_property_read_bool(node, "mipi-sdw-simplified-channelprepare-sm"); =20 fwnode_property_read_u32(node, @@ -278,7 +298,7 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, fwnode_property_read_u32(node, "mipi-sdw-max-async-buffer", &dpn[i].max_async_buffer); =20 - dpn[i].block_pack_mode =3D fwnode_property_read_bool(node, + dpn[i].block_pack_mode =3D mipi_fwnode_property_read_bool(node, "mipi-sdw-block-packing-mode"); =20 fwnode_property_read_u32(node, "mipi-sdw-port-encoding-type", @@ -308,19 +328,19 @@ int sdw_slave_read_prop(struct sdw_slave *slave) device_property_read_u32(dev, "mipi-sdw-sw-interface-revision", &prop->mipi_revision); =20 - prop->wake_capable =3D device_property_read_bool(dev, + prop->wake_capable =3D mipi_device_property_read_bool(dev, "mipi-sdw-wake-up-unavailable"); prop->wake_capable =3D !prop->wake_capable; =20 - prop->test_mode_capable =3D device_property_read_bool(dev, + prop->test_mode_capable =3D mipi_device_property_read_bool(dev, "mipi-sdw-test-mode-supported"); =20 prop->clk_stop_mode1 =3D false; - if (device_property_read_bool(dev, + if (mipi_device_property_read_bool(dev, "mipi-sdw-clock-stop-mode1-supported")) prop->clk_stop_mode1 =3D true; =20 - prop->simple_clk_stop_capable =3D device_property_read_bool(dev, + prop->simple_clk_stop_capable =3D mipi_device_property_read_bool(dev, "mipi-sdw-simplified-clockstopprepare-sm-supported"); =20 device_property_read_u32(dev, "mipi-sdw-clockstopprepare-timeout", @@ -333,13 +353,13 @@ int sdw_slave_read_prop(struct sdw_slave *slave) "mipi-sdw-clockstopprepare-hard-reset-behavior", &prop->reset_behave); =20 - prop->high_PHY_capable =3D device_property_read_bool(dev, + prop->high_PHY_capable =3D mipi_device_property_read_bool(dev, "mipi-sdw-highPHY-capable"); =20 - prop->paging_support =3D device_property_read_bool(dev, + prop->paging_support =3D mipi_device_property_read_bool(dev, "mipi-sdw-paging-support"); =20 - prop->bank_delay_support =3D device_property_read_bool(dev, + prop->bank_delay_support =3D mipi_device_property_read_bool(dev, "mipi-sdw-bank-delay-support"); =20 device_property_read_u32(dev, --=20 2.43.0 From nobody Sat Nov 30 05:36:45 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A087D18FC9D; Wed, 11 Sep 2024 11:59:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055948; cv=none; b=WNhxVvA+aTTtsCns+NFgfV5jJFygTJMkPiQkMVX+zHJv5YWLxxJu77ia36e9Lx/og3WopwotOdYH3LPjMWvbeWdGwUzK/xSOgdcyaFRtTxU5owF9t4zX2MTINIsDl5VxSK/27NrhSK0nk3ZZ0eIkW8VLIm0Pq+qHx/mnVpdGJCw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055948; c=relaxed/simple; bh=BNF7KxV5nkbzub+I8LNYCT9nsHBpi/XN8kK/Yk07yxo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P2EizPLgp4n4DeTzbZemNLJE32Om2gh8Dl/X3VuU7rWu4rWvdihkv1/heNbgYmQRBJhRWPcvhWRly6wl7j9r6/UGxlkPuyk+ROWxBfTQsK9iQFb2j3DmMf2eubCRf16S+TlSV8fldAhYMWHAJlZHs4IOyzotyYAbMJRfohYG10E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Mlag4Mqz; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Mlag4Mqz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726055947; x=1757591947; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BNF7KxV5nkbzub+I8LNYCT9nsHBpi/XN8kK/Yk07yxo=; b=Mlag4Mqz/+YbQ6aMOoYftbDmXvx8nZBYBMpwTXKeT1E2Jx0oetjnMViF qkkiocpbppsaw427TS+paNvxDWyULApQCnRZkioH10HcJi11vNE6x6oPb xeg1Pu5C0wSQ1P7fV8dIYJv2KcfqbOvvOX3jhLjjckJ8aT4aG5iq88Nng V1Imwn214iNgJgUZgx912/k/OOYRhxtGx7KcrQz0uG4eNM2hM0Uxmb7QW iNLnOF+X8EaLHtRxKEcF2TARrQ6OAQIxYtW/97BcwQXJOIGpbAljBvMZC f+l2/DqRUfKpzerDvGBrVn05dxEafkKKD/Nu5IW5QF1ZuhNl6C0kiEsQC g==; X-CSE-ConnectionGUID: xVHY9x86RemUYn22x99Rtg== X-CSE-MsgGUID: gwora+6ETGWKvzcL+xejLg== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35417217" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35417217" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:06 -0700 X-CSE-ConnectionGUID: OQQFkxAFTFiYwKVw7Amuqw== X-CSE-MsgGUID: sM87YRf6SSqfnNQQM+ooyw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67292726" Received: from bvivekan-mobl2.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.254]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:04 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 02/14] soundwire: optimize sdw_stream_runtime memory layout Date: Wed, 11 Sep 2024 19:58:15 +0800 Message-ID: <20240911115827.233171-3-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> References: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart pahole suggestion: swap position of 'm_rt_count' before: pahole -C sdw_stream_runtime drivers/soundwire/soundwire-bus.ko struct sdw_stream_runtime { const char * name; /* 0 8 */ struct sdw_stream_params params; /* 8 12 */ enum sdw_stream_state state; /* 20 4 */ enum sdw_stream_type type; /* 24 4 */ /* XXX 4 bytes hole, try to pack */ struct list_head master_list; /* 32 16 */ int m_rt_count; /* 48 4 */ /* size: 56, cachelines: 1, members: 6 */ /* sum members: 48, holes: 1, sum holes: 4 */ /* padding: 4 */ /* last cacheline: 56 bytes */ }; after: pahole --reorganize -C sdw_stream_runtime drivers/soundwire/soundwir= e-bus.ko struct sdw_stream_runtime { const char * name; /* 0 8 */ struct sdw_stream_params params; /* 8 12 */ enum sdw_stream_state state; /* 20 4 */ enum sdw_stream_type type; /* 24 4 */ int m_rt_count; /* 28 4 */ struct list_head master_list; /* 32 16 */ /* size: 48, cachelines: 1, members: 6 */ /* last cacheline: 48 bytes */ }; /* saved 8 bytes! */ Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- include/linux/soundwire/sdw.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 5e0dd47a0412..a4fa45132030 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -820,15 +820,15 @@ struct sdw_master_port_ops { struct sdw_msg; =20 /** - * struct sdw_defer - SDW deffered message - * @length: message length + * struct sdw_defer - SDW deferred message * @complete: message completion * @msg: SDW message + * @length: message length */ struct sdw_defer { + struct sdw_msg *msg; int length; struct completion complete; - struct sdw_msg *msg; }; =20 /** @@ -1010,18 +1010,18 @@ struct sdw_stream_params { * @params: Stream parameters * @state: Current state of the stream * @type: Stream type PCM or PDM + * @m_rt_count: Count of Master runtime(s) in this stream * @master_list: List of Master runtime(s) in this stream. * master_list can contain only one m_rt per Master instance * for a stream - * @m_rt_count: Count of Master runtime(s) in this stream */ struct sdw_stream_runtime { const char *name; struct sdw_stream_params params; enum sdw_stream_state state; enum sdw_stream_type type; - struct list_head master_list; int m_rt_count; + struct list_head master_list; }; =20 struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name); --=20 2.43.0 From nobody Sat Nov 30 05:36:45 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48AC0193092; Wed, 11 Sep 2024 11:59:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055950; cv=none; b=gNSV63Xy5ZSJ67k5uzz/PBS4HM+eIm+DFYOWbDyv4zy+T+FilQtOZwKt7xQM+t2jNtjfnVM/5xgVUjiM+GpSqfNl2Sx1Mds7+q6dl4MHic6hduvC1mPVFzR20tHlI7WCtmXdSGG7KmJlDMKE1dhXpgJdNmjd5XAQJMsCMhk6TK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055950; c=relaxed/simple; bh=gqV+DPaZQiWpZ8ck48YW8SBC25CmO7V6OVsBlat9ajg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oSCI3QEfPTN1sqVzPwGYDTNJrYMLhLFBFM7IpKNTZOShWDYoyyAzI6yVNfCIzHlHhnyXUi4pSJeXtvKVCaCp+fzBcGkcAshMNCLkHiSECLXLr4HQKfEiBhChvVeNC2lPflYeU14YuK96PUejLDQ+uWCcCwcEJMVN2xyUdUxOpVo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=JjtVwwlr; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JjtVwwlr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726055949; x=1757591949; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gqV+DPaZQiWpZ8ck48YW8SBC25CmO7V6OVsBlat9ajg=; b=JjtVwwlrmsEOc1WSv/G0mQ6LWI6PZ9AiozXrDgQ9x63/4rwZQmWUgPYD kkV+sDuZbfb7BWg4UpT80huLIOAHOcYIRCdR2KQVxtdefrX3Q5cGQhmzF wwf6/NC47Yllj2Vz02whpH3KrjmWb7YXKUU7oASW3LkJL7xOmcUUAPka+ qgPEmz8tG04pcGa8BSuI2qLHMwhLjcBd0VE1ARiswKDtPdJ7nOVfG22yT imnL8Aw/0PoUuOc1uaXNpI2URsQQ8MzrZuobQDhYmBY+ZBqnQtw8pcGoL xZOQ43kfUyLnE9wKnAoTLjzDBmXn9l3VBthVsD/lfJKD57ntmYTMDF2ey Q==; X-CSE-ConnectionGUID: ua+SRcLmTP2lODspd83z+g== X-CSE-MsgGUID: oc9tbXxdQ+2Ot0n1e1b51w== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35417227" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35417227" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:09 -0700 X-CSE-ConnectionGUID: Fi3t/gOXRwmUs4ui1ydOsg== X-CSE-MsgGUID: 186p3x3iQOCt4FeKaZRx6A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67292730" Received: from bvivekan-mobl2.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.254]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:07 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 03/14] soundwire: optimize sdw_master_prop Date: Wed, 11 Sep 2024 19:58:16 +0800 Message-ID: <20240911115827.233171-4-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> References: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart Make pahole happy by moving pointers and u64 first instead of interleaving them. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- include/linux/soundwire/sdw.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index a4fa45132030..2caea7345c3e 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -406,13 +406,14 @@ struct sdw_slave_prop { =20 /** * struct sdw_master_prop - Master properties + * @clk_gears: Clock gears supported + * @clk_freq: Clock frequencies supported, in Hz + * @quirks: bitmask identifying optional behavior beyond the scope of the = MIPI specification * @revision: MIPI spec version of the implementation * @clk_stop_modes: Bitmap, bit N set when clock-stop-modeN supported * @max_clk_freq: Maximum Bus clock frequency, in Hz * @num_clk_gears: Number of clock gears supported - * @clk_gears: Clock gears supported * @num_clk_freq: Number of clock frequencies supported, in Hz - * @clk_freq: Clock frequencies supported, in Hz * @default_frame_rate: Controller default Frame rate, in Hz * @default_row: Number of rows * @default_col: Number of columns @@ -421,24 +422,23 @@ struct sdw_slave_prop { * command * @mclk_freq: clock reference passed to SoundWire Master, in Hz. * @hw_disabled: if true, the Master is not functional, typically due to p= in-mux - * @quirks: bitmask identifying optional behavior beyond the scope of the = MIPI specification */ struct sdw_master_prop { + u32 *clk_gears; + u32 *clk_freq; + u64 quirks; u32 revision; u32 clk_stop_modes; u32 max_clk_freq; u32 num_clk_gears; - u32 *clk_gears; u32 num_clk_freq; - u32 *clk_freq; u32 default_frame_rate; u32 default_row; u32 default_col; - bool dynamic_frame; u32 err_threshold; u32 mclk_freq; + bool dynamic_frame; bool hw_disabled; - u64 quirks; }; =20 /* Definitions for Master quirks */ --=20 2.43.0 From nobody Sat Nov 30 05:36:45 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C70D319992A; Wed, 11 Sep 2024 11:59:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055953; cv=none; b=ARQaVBHpYoUwB0ISESvqW5JGYN2Zbwpj3xNPj302RGigESYeCPwVxqxH8vf2Gn1TqKHCKrnuhI/6bRiVMp5DpkfqFTPNRKlERHMtdZvrrtcWA9M+M+fDA7gjHzXCwzCvHc3L2t2o9hUndG/feZGzSvIdfs+dM8QUPEotk8Xk3zA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055953; c=relaxed/simple; bh=WAgu6JTe9rbbUDigxdAPNYw1V4HycexXa8xhS8dmrtw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jCbWLygZRZjJLvV4moi5ClMZ9jdhxQbaW7rWXCr0CTPr7se0a2N9pNqHiWN7VYv6/Mo1/SN8OOL/dLGp6vBf+8mWGlcGoi+zP2XgB6X+xp1nwtzCXw2K4O6dFz3cLiZQO6RDf9bFZukA6/llSQ6+DlwU8UEA8UDH25jwxGx2A1U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CUoL3Pvn; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CUoL3Pvn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726055952; x=1757591952; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WAgu6JTe9rbbUDigxdAPNYw1V4HycexXa8xhS8dmrtw=; b=CUoL3PvnDvUuqw+xlACX2+P2khGySavfxngbXOJxzUco8VchSaRrDwcF vOWHdpxaJ92P3PVuU4l+wAO52/8nnD8v5zc0yNI+Z7r4cWQfVbjUtKCHx X3OV7cwKMTIy9g3u7RHc2lG14h0Riu6wIcTdhtGz/Dd0xo+3y+WTDJxac AJYuvDg0Vcg1MZDO+KMpZJci8V0ZfRehNZyKD3i4WQzI5f3PVeeXJMoy/ +/9fUgWiSOA7YQSeUtIyeoKuRw9+0eDuOUuSPw3ShUeDKa/4rVaOU0Utb e6IG4F37SfxaqQzaTmTOUFDVkuBKStj1dL5KPrcVDE8fOmRdBLzoDIJIh g==; X-CSE-ConnectionGUID: 7/oa7RlESKC5NA2blvSahQ== X-CSE-MsgGUID: iq2X3nK3Qay2sd75ZwTSvQ== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35417234" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35417234" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:12 -0700 X-CSE-ConnectionGUID: FYgaz57bRiSJUztxBhqx/g== X-CSE-MsgGUID: qRypAEX+TNKBAOEO0/HvOA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67292736" Received: from bvivekan-mobl2.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.254]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:09 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 04/14] soundwire: optimize sdw_bus structure Date: Wed, 11 Sep 2024 19:58:17 +0800 Message-ID: <20240911115827.233171-5-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> References: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart The sdw_bus structure has seen multiple additions over the years. It's one of the most used structures in this subsystem, so there's merit in reshuffling the members a bit with 'pahole' to reduce holes and structures across cache lines. before: struct sdw_bus { struct device * dev; /* 0 8 */ struct sdw_master_device * md; /* 8 8 */ int controller_id; /* 16 4 */ unsigned int link_id; /* 20 4 */ int id; /* 24 4 */ /* XXX 4 bytes hole, try to pack */ struct list_head slaves; /* 32 16 */ long unsigned int assigned[1]; /* 48 8 */ struct mutex bus_lock; /* 56 160 */ /* --- cacheline 3 boundary (192 bytes) was 24 bytes ago --- */ struct lock_class_key bus_lock_key; /* 216 16 */ struct mutex msg_lock; /* 232 160 */ /* --- cacheline 6 boundary (384 bytes) was 8 bytes ago --- */ struct lock_class_key msg_lock_key; /* 392 16 */ int (*compute_params)(struct sdw_bus *); /* 408 = 8 */ const struct sdw_master_ops * ops; /* 416 8 */ const struct sdw_master_port_ops * port_ops; /* 424 8 */ struct sdw_bus_params params; /* 432 36 */ /* XXX 4 bytes hole, try to pack */ /* --- cacheline 7 boundary (448 bytes) was 24 bytes ago --- */ struct sdw_master_prop prop; /* 472 72 */ /* XXX last struct has 6 bytes of padding */ /* --- cacheline 8 boundary (512 bytes) was 32 bytes ago --- */ void * vendor_specific_prop; /* 544 8 */ struct list_head m_rt_list; /* 552 16 */ struct dentry * debugfs; /* 568 8 */ /* --- cacheline 9 boundary (576 bytes) --- */ struct irq_chip irq_chip; /* 576 264 */ /* --- cacheline 13 boundary (832 bytes) was 8 bytes ago --- */ struct irq_domain * domain; /* 840 8 */ struct sdw_defer defer_msg; /* 848 112 */ /* --- cacheline 15 boundary (960 bytes) --- */ unsigned int clk_stop_timeout; /* 960 4 */ u32 bank_switch_timeout; /* 964 4 */ bool multi_link; /* 968 1 */ /* XXX 3 bytes hole, try to pack */ int hw_sync_min_links; /* 972 4 */ int stream_refcount; /* 976 4 */ /* size: 984, cachelines: 16, members: 27 */ /* sum members: 969, holes: 3, sum holes: 11 */ /* padding: 4 */ /* paddings: 1, sum paddings: 6 */ /* last cacheline: 24 bytes */ }; after: struct sdw_bus { struct device * dev; /* 0 8 */ struct sdw_master_device * md; /* 8 8 */ struct lock_class_key bus_lock_key; /* 16 16 */ struct mutex bus_lock; /* 32 160 */ /* --- cacheline 3 boundary (192 bytes) --- */ struct list_head slaves; /* 192 16 */ struct lock_class_key msg_lock_key; /* 208 16 */ struct mutex msg_lock; /* 224 160 */ /* --- cacheline 6 boundary (384 bytes) --- */ struct list_head m_rt_list; /* 384 16 */ struct sdw_defer defer_msg; /* 400 112 */ /* --- cacheline 8 boundary (512 bytes) --- */ struct sdw_bus_params params; /* 512 36 */ int stream_refcount; /* 548 4 */ const struct sdw_master_ops * ops; /* 552 8 */ const struct sdw_master_port_ops * port_ops; /* 560 8 */ struct sdw_master_prop prop; /* 568 72 */ /* XXX last struct has 6 bytes of padding */ /* --- cacheline 10 boundary (640 bytes) --- */ void * vendor_specific_prop; /* 640 8 */ int hw_sync_min_links; /* 648 4 */ int controller_id; /* 652 4 */ unsigned int link_id; /* 656 4 */ int id; /* 660 4 */ int (*compute_params)(struct sdw_bus *); /* 664 = 8 */ long unsigned int assigned[1]; /* 672 8 */ unsigned int clk_stop_timeout; /* 680 4 */ u32 bank_switch_timeout; /* 684 4 */ struct irq_chip irq_chip; /* 688 264 */ /* --- cacheline 14 boundary (896 bytes) was 56 bytes ago --- */ struct irq_domain * domain; /* 952 8 */ /* --- cacheline 15 boundary (960 bytes) --- */ struct dentry * debugfs; /* 960 8 */ bool multi_link; /* 968 1 */ /* size: 976, cachelines: 16, members: 27 */ /* padding: 7 */ /* paddings: 1, sum paddings: 6 */ /* last cacheline: 16 bytes */ }; Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- include/linux/soundwire/sdw.h | 79 ++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 38 deletions(-) diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 2caea7345c3e..6fcf122c1831 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -871,68 +871,71 @@ struct sdw_master_ops { * struct sdw_bus - SoundWire bus * @dev: Shortcut to &bus->md->dev to avoid changing the entire code. * @md: Master device - * @controller_id: system-unique controller ID. If set to -1, the bus @id = will be used. - * @link_id: Link id number, can be 0 to N, unique for each Controller - * @id: bus system-wide unique id - * @slaves: list of Slaves on this bus - * @assigned: Bitmap for Slave device numbers. - * Bit set implies used number, bit clear implies unused number. + * @bus_lock_key: bus lock key associated to @bus_lock * @bus_lock: bus lock + * @slaves: list of Slaves on this bus + * @msg_lock_key: message lock key associated to @msg_lock * @msg_lock: message lock - * @compute_params: points to Bus resource management implementation - * @ops: Master callback ops - * @port_ops: Master port callback ops - * @params: Current bus parameters - * @prop: Master properties - * @vendor_specific_prop: pointer to non-standard properties * @m_rt_list: List of Master instance of all stream(s) running on Bus. Th= is * is used to compute and program bus bandwidth, clock, frame shape, * transport and port parameters - * @debugfs: Bus debugfs - * @domain: IRQ domain * @defer_msg: Defer message - * @clk_stop_timeout: Clock stop timeout computed - * @bank_switch_timeout: Bank switch timeout computed - * @multi_link: Store bus property that indicates if multi links - * are supported. This flag is populated by drivers after reading - * appropriate firmware (ACPI/DT). + * @params: Current bus parameters + * @stream_refcount: number of streams currently using this bus + * @ops: Master callback ops + * @port_ops: Master port callback ops + * @prop: Master properties + * @vendor_specific_prop: pointer to non-standard properties * @hw_sync_min_links: Number of links used by a stream above which * hardware-based synchronization is required. This value is only * meaningful if multi_link is set. If set to 1, hardware-based * synchronization will be used even if a stream only uses a single * SoundWire segment. - * @stream_refcount: number of streams currently using this bus + * @controller_id: system-unique controller ID. If set to -1, the bus @id = will be used. + * @link_id: Link id number, can be 0 to N, unique for each Controller + * @id: bus system-wide unique id + * @compute_params: points to Bus resource management implementation + * @assigned: Bitmap for Slave device numbers. + * Bit set implies used number, bit clear implies unused number. + * @clk_stop_timeout: Clock stop timeout computed + * @bank_switch_timeout: Bank switch timeout computed + * @domain: IRQ domain + * @irq_chip: IRQ chip + * @debugfs: Bus debugfs (optional) + * @multi_link: Store bus property that indicates if multi links + * are supported. This flag is populated by drivers after reading + * appropriate firmware (ACPI/DT). */ struct sdw_bus { struct device *dev; struct sdw_master_device *md; - int controller_id; - unsigned int link_id; - int id; - struct list_head slaves; - DECLARE_BITMAP(assigned, SDW_MAX_DEVICES); - struct mutex bus_lock; struct lock_class_key bus_lock_key; - struct mutex msg_lock; + struct mutex bus_lock; + struct list_head slaves; struct lock_class_key msg_lock_key; - int (*compute_params)(struct sdw_bus *bus); + struct mutex msg_lock; + struct list_head m_rt_list; + struct sdw_defer defer_msg; + struct sdw_bus_params params; + int stream_refcount; const struct sdw_master_ops *ops; const struct sdw_master_port_ops *port_ops; - struct sdw_bus_params params; struct sdw_master_prop prop; void *vendor_specific_prop; - struct list_head m_rt_list; -#ifdef CONFIG_DEBUG_FS - struct dentry *debugfs; -#endif - struct irq_chip irq_chip; - struct irq_domain *domain; - struct sdw_defer defer_msg; + int hw_sync_min_links; + int controller_id; + unsigned int link_id; + int id; + int (*compute_params)(struct sdw_bus *bus); + DECLARE_BITMAP(assigned, SDW_MAX_DEVICES); unsigned int clk_stop_timeout; u32 bank_switch_timeout; + struct irq_chip irq_chip; + struct irq_domain *domain; +#ifdef CONFIG_DEBUG_FS + struct dentry *debugfs; +#endif bool multi_link; - int hw_sync_min_links; - int stream_refcount; }; =20 int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent, --=20 2.43.0 From nobody Sat Nov 30 05:36:45 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4212419AD6E; Wed, 11 Sep 2024 11:59:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055955; cv=none; b=E8zA98szRHSbylVR1b38vCEPI/w2+s9efG6qsXCQ7z0eHjhHSjOSg2zGccXgmov6mCJM1d9oPCuklBvxPFMNzhmMUvqb0nnxGq07flRvtPGPFhRwGWp6zN8hYqZvfemhqEdlZ1YuJbjwiW4Jt3pH3WJzGfPt2B4NzOgHrwRcTu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055955; c=relaxed/simple; bh=lmMmn37+R6qgv1ErHkOCL6BvGv3yhHItHZa0c5ES79c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KPAJ510gITPFSC+TzIqbgQMfznbx1S735s5q9jsTv8a2ZX2SVZzOdL4PhAaYzuVHPqpDpSDOtY/5yiSizrDSUjdC/H/h8eSRjFBLiFJGcyH3Wh3vPN9QvYGuuMMXUqZWDqJleCq+oFj2HnsxJiw5nzizCEzWruy260RIyrUGgMw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=d9audhbB; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="d9audhbB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726055954; x=1757591954; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lmMmn37+R6qgv1ErHkOCL6BvGv3yhHItHZa0c5ES79c=; b=d9audhbBN+WsVwMEDmqRUuaRrzB8UW09RnFw4oPWflCrbrOuqcZsoqxn 2J6drUPl8LHycMc0fEqNHz8OVETu1OPxiiAotqeIDJAMRjsrNP5f1Dxhm W/zdP4zt3YrFAMsf+k/TDXNE5HAUwxkEaLd5X/ZfPevBBKw5/vY/71eXs tCj3gzHAmKYmmGnsNjNL4VkBr5nQesXrj4I2SFSBtuSb7KE8ldwh3kcf3 m1OId3IqorJsJZzWB2UbV7oL/6wubNPuCgbtkv9Y9hv5m+U9oCfezapQG VHhbqVU8JuXv1ra4WVZcwTnK5To9vnmCYQSlnT4KPwWcErtDpl+/uhHvB g==; X-CSE-ConnectionGUID: kq2X1KfcTD6U3vgKe9LhxQ== X-CSE-MsgGUID: Yfeh0ZsgS6ug45M9EPT40g== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35417237" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35417237" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:14 -0700 X-CSE-ConnectionGUID: XDHBm3Q1QjOIqAhOLxwa2Q== X-CSE-MsgGUID: Kv4YrA5BQvCra9DmqxCVYg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67292743" Received: from bvivekan-mobl2.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.254]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:12 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 05/14] soundwire: optimize sdw_slave_prop Date: Wed, 11 Sep 2024 19:58:18 +0800 Message-ID: <20240911115827.233171-6-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> References: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart move pointers first, and move booleans together. before: struct sdw_slave_prop { u32 mipi_revision; /* 0 4 */ bool wake_capable; /* 4 1 */ bool test_mode_capable; /* 5 1 */ bool clk_stop_mode1; /* 6 1 */ bool simple_clk_stop_capable; /* 7 1 */ u32 clk_stop_timeout; /* 8 4 */ u32 ch_prep_timeout; /* 12 4 */ enum sdw_clk_stop_reset_behave reset_behave; /* 16 4 */ bool high_PHY_capable; /* 20 1 */ bool paging_support; /* 21 1 */ bool bank_delay_support; /* 22 1 */ /* XXX 1 byte hole, try to pack */ enum sdw_p15_behave p15_behave; /* 24 4 */ bool lane_control_support; /* 28 1 */ /* XXX 3 bytes hole, try to pack */ u32 master_count; /* 32 4 */ u32 source_ports; /* 36 4 */ u32 sink_ports; /* 40 4 */ /* XXX 4 bytes hole, try to pack */ struct sdw_dp0_prop * dp0_prop; /* 48 8 */ struct sdw_dpn_prop * src_dpn_prop; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ struct sdw_dpn_prop * sink_dpn_prop; /* 64 8 */ u8 scp_int1_mask; /* 72 1 */ /* XXX 3 bytes hole, try to pack */ u32 quirks; /* 76 4 */ bool clock_reg_supported; /* 80 1 */ bool use_domain_irq; /* 81 1 */ /* size: 88, cachelines: 2, members: 23 */ /* sum members: 71, holes: 4, sum holes: 11 */ /* padding: 6 */ /* last cacheline: 24 bytes */ }; after: truct sdw_slave_prop { struct sdw_dp0_prop * dp0_prop; /* 0 8 */ struct sdw_dpn_prop * src_dpn_prop; /* 8 8 */ struct sdw_dpn_prop * sink_dpn_prop; /* 16 8 */ u32 mipi_revision; /* 24 4 */ bool wake_capable; /* 28 1 */ bool test_mode_capable; /* 29 1 */ bool clk_stop_mode1; /* 30 1 */ bool simple_clk_stop_capable; /* 31 1 */ u32 clk_stop_timeout; /* 32 4 */ u32 ch_prep_timeout; /* 36 4 */ enum sdw_clk_stop_reset_behave reset_behave; /* 40 4 */ bool high_PHY_capable; /* 44 1 */ bool paging_support; /* 45 1 */ bool bank_delay_support; /* 46 1 */ bool lane_control_support; /* 47 1 */ enum sdw_p15_behave p15_behave; /* 48 4 */ u32 master_count; /* 52 4 */ u32 source_ports; /* 56 4 */ u32 sink_ports; /* 60 4 */ /* --- cacheline 1 boundary (64 bytes) --- */ u32 quirks; /* 64 4 */ u8 scp_int1_mask; /* 68 1 */ bool clock_reg_supported; /* 69 1 */ bool use_domain_irq; /* 70 1 */ /* size: 72, cachelines: 2, members: 23 */ /* padding: 1 */ /* last cacheline: 8 bytes */ }; Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- include/linux/soundwire/sdw.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 6fcf122c1831..38db81f5bdb9 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -344,6 +344,9 @@ struct sdw_dpn_prop { =20 /** * struct sdw_slave_prop - SoundWire Slave properties + * @dp0_prop: Data Port 0 properties + * @src_dpn_prop: Source Data Port N properties + * @sink_dpn_prop: Sink Data Port N properties * @mipi_revision: Spec version of the implementation * @wake_capable: Wake-up events are supported * @test_mode_capable: If test mode is supported @@ -360,15 +363,12 @@ struct sdw_dpn_prop { * SCP_AddrPage2 * @bank_delay_support: Slave implements bank delay/bridge support registe= rs * SCP_BankDelay and SCP_NextFrame + * @lane_control_support: Slave supports lane control * @p15_behave: Slave behavior when the Master attempts a read to the Port= 15 * alias - * @lane_control_support: Slave supports lane control * @master_count: Number of Masters present on this Slave * @source_ports: Bitmap identifying source ports * @sink_ports: Bitmap identifying sink ports - * @dp0_prop: Data Port 0 properties - * @src_dpn_prop: Source Data Port N properties - * @sink_dpn_prop: Sink Data Port N properties * @scp_int1_mask: SCP_INT1_MASK desired settings * @quirks: bitmask identifying deltas from the MIPI specification * @clock_reg_supported: the Peripheral implements the clock base and scale @@ -377,6 +377,9 @@ struct sdw_dpn_prop { * @use_domain_irq: call actual IRQ handler on slave, as well as callback */ struct sdw_slave_prop { + struct sdw_dp0_prop *dp0_prop; + struct sdw_dpn_prop *src_dpn_prop; + struct sdw_dpn_prop *sink_dpn_prop; u32 mipi_revision; bool wake_capable; bool test_mode_capable; @@ -388,16 +391,13 @@ struct sdw_slave_prop { bool high_PHY_capable; bool paging_support; bool bank_delay_support; - enum sdw_p15_behave p15_behave; bool lane_control_support; + enum sdw_p15_behave p15_behave; u32 master_count; u32 source_ports; u32 sink_ports; - struct sdw_dp0_prop *dp0_prop; - struct sdw_dpn_prop *src_dpn_prop; - struct sdw_dpn_prop *sink_dpn_prop; - u8 scp_int1_mask; u32 quirks; + u8 scp_int1_mask; bool clock_reg_supported; bool use_domain_irq; }; --=20 2.43.0 From nobody Sat Nov 30 05:36:45 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2D0B19C56B; Wed, 11 Sep 2024 11:59:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055958; cv=none; b=UxsXsbypi65kgg9NbI/+y3UMDjoAbifrpXUm4PVsHNEhBP6qWeyKtMLLHFkhbKJfLnolms6EGgG6qKOLT4+rJNH7jfdcIqt8T1EFJefcDBFKTvUQszGVNv73qzjXlo+vGy3pKTTkrwcFhiVXrfZC7NfUfZ5SeY7uMG8yEmDX8A0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055958; c=relaxed/simple; bh=7jbLbmtzHZhVY/UmQFDWYc+qSpox4qDdhDzbm1XAid8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rPTGJO9+YGpvkoyr7s4uAEMfY8xMuBjrNN7t7LO4had1pECHI8k30onkIO1hFRK91fow6RgcL+HJMUNWHUpXcOA3uO+8g20ywor4C7JkhIXTA8ySeTXklrhZgQfmmxaPK2+/Cw6T+s0F5lwqcDY1Y0eZAFC0cKJGJHyXgA/8hq0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=GJMYOcUq; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GJMYOcUq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726055957; x=1757591957; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7jbLbmtzHZhVY/UmQFDWYc+qSpox4qDdhDzbm1XAid8=; b=GJMYOcUqr/mefbUcxuIQgG+fwL+5f9vKoL711/LVoIChmCl5jS1B2fvU eVJi0/N+MPcZtGQukum8zp4uiQnpUe3ocdLDtD+9dMkXEzqDSQ1teCHTA NsaSxgQiMCWKJwx8dJdKQvP/XUMql24yCLYk/Rmm9GdUBuYACFgY2WHEJ gxLhGuCJ0wKfKLRmjSqFsPGin3V7tPvSUiwL+D397Ka7VpvPTCQOTCj+j b1rT7efstb1AhS3UNvc5Wex0/V+ggu4tEGnNGHzp9jY7cx50kL54+cobB ZMI0ehyXP+QkxzLvHngGQnAnehNT3VH0odvVjWgAPurde484Zg4Ujpk47 A==; X-CSE-ConnectionGUID: IeQRklTvQWmuqSihfWWPMA== X-CSE-MsgGUID: T93lINWBSO+iO4IkPIW2uQ== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35417245" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35417245" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:17 -0700 X-CSE-ConnectionGUID: 6LpHCJkTQ1WxutSwoJaQww== X-CSE-MsgGUID: y2Cw+9liR42ToYToKjMnDw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67292748" Received: from bvivekan-mobl2.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.254]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:14 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 06/14] soundwire: optimize sdw_dp0_prop Date: Wed, 11 Sep 2024 19:58:19 +0800 Message-ID: <20240911115827.233171-7-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> References: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart Move pointers and booleans. Before: struct sdw_dp0_prop { u32 max_word; /* 0 4 */ u32 min_word; /* 4 4 */ u32 num_words; /* 8 4 */ /* XXX 4 bytes hole, try to pack */ u32 * words; /* 16 8 */ bool BRA_flow_controlled; /* 24 1 */ bool simple_ch_prep_sm; /* 25 1 */ /* XXX 2 bytes hole, try to pack */ u32 ch_prep_timeout; /* 28 4 */ bool imp_def_interrupts; /* 32 1 */ /* size: 40, cachelines: 1, members: 8 */ /* sum members: 27, holes: 2, sum holes: 6 */ /* padding: 7 */ /* last cacheline: 40 bytes */ }; after: struct sdw_dp0_prop { u32 * words; /* 0 8 */ u32 max_word; /* 8 4 */ u32 min_word; /* 12 4 */ u32 num_words; /* 16 4 */ u32 ch_prep_timeout; /* 20 4 */ bool BRA_flow_controlled; /* 24 1 */ bool simple_ch_prep_sm; /* 25 1 */ bool imp_def_interrupts; /* 26 1 */ /* size: 32, cachelines: 1, members: 8 */ /* padding: 5 */ /* last cacheline: 32 bytes */ }; Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- include/linux/soundwire/sdw.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 38db81f5bdb9..c72095137a35 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -226,16 +226,16 @@ enum sdw_clk_stop_mode { =20 /** * struct sdw_dp0_prop - DP0 properties - * @max_word: Maximum number of bits in a Payload Channel Sample, 1 to 64 - * (inclusive) - * @min_word: Minimum number of bits in a Payload Channel Sample, 1 to 64 - * (inclusive) - * @num_words: number of wordlengths supported * @words: wordlengths supported + * @max_word: Maximum number of bits in a Payload Channel Sample, 1 to 64 + * (inclusive) + * @min_word: Minimum number of bits in a Payload Channel Sample, 1 to 64 + * (inclusive) + * @num_words: number of wordlengths supported + * @ch_prep_timeout: Port-specific timeout value, in milliseconds * @BRA_flow_controlled: Slave implementation results in an OK_NotReady * response * @simple_ch_prep_sm: If channel prepare sequence is required - * @ch_prep_timeout: Port-specific timeout value, in milliseconds * @imp_def_interrupts: If set, each bit corresponds to support for * implementation-defined interrupts * @@ -244,13 +244,13 @@ enum sdw_clk_stop_mode { * support */ struct sdw_dp0_prop { + u32 *words; u32 max_word; u32 min_word; u32 num_words; - u32 *words; + u32 ch_prep_timeout; bool BRA_flow_controlled; bool simple_ch_prep_sm; - u32 ch_prep_timeout; bool imp_def_interrupts; }; =20 --=20 2.43.0 From nobody Sat Nov 30 05:36:45 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69F3B19D8A4; Wed, 11 Sep 2024 11:59:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055961; cv=none; b=owVYSahndH1FsR6xaFcCSLeoCxSHks9pFXZ4b7SddyYMR8i25o6sTanbQUNKPNVxYXSeRBisY+aXLDUcXdCkFfNT8zBFp1YppZCjaXk+tJ8zNVIm8rsQbT0BanrcgUlNWOjsJrWqU6hE7ddCJpKzRd6iwTKgjuWeV2mxXn1+d2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055961; c=relaxed/simple; bh=EyzHfJ0GwyNdqWr9Tz+WnVWaVwBx3I8DtCHEK5IXV6E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TYqbUpf8jCT6I1SNHCHkjWS2qq9ljtcTYf2ukWda+TgLIFwNB+xDY7sezaSoqyTNpyNbVy/kj5xL4BqY7Wvc3Oy/gWsA44eflPtzMVFIDV/5moZHRtxr1mwpOGo6ingMGbrg2nwbO0wrg94pZi6FX6WC/h1UA5fJqhvUJZmVY08= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=FfhVPneO; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FfhVPneO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726055959; x=1757591959; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EyzHfJ0GwyNdqWr9Tz+WnVWaVwBx3I8DtCHEK5IXV6E=; b=FfhVPneOrS1apsbcyHLdUSGBlSc45lZj5DzAdxo7lXgr1Ctsn+sSzG/5 0zppx2gnKBUjVr1jkit7fkNK1lsLli3a52g2qwOhc1+eFIvzGyj9jjJO9 E02LdPUaOCz4Mc9D7Gbf5ZBTY/1Lrh/35VtMSq81ccuB+xFgUi9uZR2wj KdlUyMiTxXteyC/MdzJv4Ar92PD486UkIKfAMsmxgy/Iey6OYWl/RBnzp uaqLNkAbYNz8Y90Aucn8Znwa05ktimGYU4kYysXLiXYbdArGZi/S1j7Y3 G9aY8tX11gZZlKKXCBY5u5izu82kvGS73C9KwxJoDdc3+SpRtyUl3rcUK g==; X-CSE-ConnectionGUID: 2O+kew6xTW+91XROpY39XA== X-CSE-MsgGUID: tasqpbGUTqeioSUTGAlF4g== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35417251" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35417251" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:19 -0700 X-CSE-ConnectionGUID: ysBVajEISZuZ0WBDS9fLOQ== X-CSE-MsgGUID: hCQ74qVFQ+KtHZJReqLk9Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67292759" Received: from bvivekan-mobl2.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.254]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:17 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 07/14] soundwire: optimize sdw_dpn_prop Date: Wed, 11 Sep 2024 19:58:20 +0800 Message-ID: <20240911115827.233171-8-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> References: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart before: struct sdw_dpn_prop { u32 num; /* 0 4 */ u32 max_word; /* 4 4 */ u32 min_word; /* 8 4 */ u32 num_words; /* 12 4 */ u32 * words; /* 16 8 */ enum sdw_dpn_type type; /* 24 4 */ u32 max_grouping; /* 28 4 */ bool simple_ch_prep_sm; /* 32 1 */ /* XXX 3 bytes hole, try to pack */ u32 ch_prep_timeout; /* 36 4 */ u32 imp_def_interrupts; /* 40 4 */ u32 max_ch; /* 44 4 */ u32 min_ch; /* 48 4 */ u32 num_channels; /* 52 4 */ u32 * channels; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ u32 num_ch_combinations; /* 64 4 */ /* XXX 4 bytes hole, try to pack */ u32 * ch_combinations; /* 72 8 */ u32 modes; /* 80 4 */ u32 max_async_buffer; /* 84 4 */ bool block_pack_mode; /* 88 1 */ bool read_only_wordlength; /* 89 1 */ /* XXX 2 bytes hole, try to pack */ u32 port_encoding; /* 92 4 */ struct sdw_dpn_audio_mode * audio_modes; /* 96 8 */ /* size: 104, cachelines: 2, members: 22 */ /* sum members: 95, holes: 3, sum holes: 9 */ /* last cacheline: 40 bytes */ }; after: struct sdw_dpn_prop { struct sdw_dpn_audio_mode * audio_modes; /* 0 8 */ u32 num; /* 8 4 */ u32 max_word; /* 12 4 */ u32 min_word; /* 16 4 */ u32 num_words; /* 20 4 */ u32 * words; /* 24 8 */ enum sdw_dpn_type type; /* 32 4 */ u32 max_grouping; /* 36 4 */ u32 ch_prep_timeout; /* 40 4 */ u32 imp_def_interrupts; /* 44 4 */ u32 max_ch; /* 48 4 */ u32 min_ch; /* 52 4 */ u32 num_channels; /* 56 4 */ u32 num_ch_combinations; /* 60 4 */ /* --- cacheline 1 boundary (64 bytes) --- */ u32 * channels; /* 64 8 */ u32 * ch_combinations; /* 72 8 */ u32 modes; /* 80 4 */ u32 max_async_buffer; /* 84 4 */ u32 port_encoding; /* 88 4 */ bool block_pack_mode; /* 92 1 */ bool read_only_wordlength; /* 93 1 */ bool simple_ch_prep_sm; /* 94 1 */ /* size: 96, cachelines: 2, members: 22 */ /* padding: 1 */ /* last cacheline: 32 bytes */ }; Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- include/linux/soundwire/sdw.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index c72095137a35..cc0afb8af333 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -288,6 +288,7 @@ struct sdw_dpn_audio_mode { =20 /** * struct sdw_dpn_prop - Data Port DPn properties + * @audio_modes: Audio modes supported * @num: port number * @max_word: Maximum number of bits in a Payload Channel Sample, 1 to 64 * (inclusive) @@ -298,26 +299,26 @@ struct sdw_dpn_audio_mode { * @type: Data port type. Full, Simplified or Reduced * @max_grouping: Maximum number of samples that can be grouped together f= or * a full data port - * @simple_ch_prep_sm: If the port supports simplified channel prepare sta= te - * machine * @ch_prep_timeout: Port-specific timeout value, in milliseconds * @imp_def_interrupts: If set, each bit corresponds to support for * implementation-defined interrupts * @max_ch: Maximum channels supported * @min_ch: Minimum channels supported * @num_channels: Number of discrete channels supported - * @channels: Discrete channels supported * @num_ch_combinations: Number of channel combinations supported + * @channels: Discrete channels supported * @ch_combinations: Channel combinations supported * @modes: SDW mode supported * @max_async_buffer: Number of samples that this port can buffer in * asynchronous modes + * @port_encoding: Payload Channel Sample encoding schemes supported * @block_pack_mode: Type of block port mode supported * @read_only_wordlength: Read Only wordlength field in DPN_BlockCtrl1 reg= ister - * @port_encoding: Payload Channel Sample encoding schemes supported - * @audio_modes: Audio modes supported + * @simple_ch_prep_sm: If the port supports simplified channel prepare sta= te + * machine */ struct sdw_dpn_prop { + struct sdw_dpn_audio_mode *audio_modes; u32 num; u32 max_word; u32 min_word; @@ -325,21 +326,20 @@ struct sdw_dpn_prop { u32 *words; enum sdw_dpn_type type; u32 max_grouping; - bool simple_ch_prep_sm; u32 ch_prep_timeout; u32 imp_def_interrupts; u32 max_ch; u32 min_ch; u32 num_channels; - u32 *channels; u32 num_ch_combinations; + u32 *channels; u32 *ch_combinations; u32 modes; u32 max_async_buffer; + u32 port_encoding; bool block_pack_mode; bool read_only_wordlength; - u32 port_encoding; - struct sdw_dpn_audio_mode *audio_modes; + bool simple_ch_prep_sm; }; =20 /** --=20 2.43.0 From nobody Sat Nov 30 05:36:45 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00EE719E970; Wed, 11 Sep 2024 11:59:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055963; cv=none; b=CRXb9qL0wUW2HYt9R3ENnb6nM9GxdbLEPqhRnQKsm7EDvmKX98O4gvKcf2O0dgBOZwTkQcdIBDj4ptetoj65+0cGJgIX1bihbi9abyidpDz2VTplycxNKqDVwrPd5zkiJXFkPsK0CbvNz4TeV8OK04L9gL5JH+6xHxvmkg6QZvs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055963; c=relaxed/simple; bh=scaVtywZM8FRzxJE7xGyoly1lnhP22/2qGmw6jgkdxg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JbbVq4yW41g1mqN5Q5AKHZBgcOx5VLIYFC1kXcwcLRjPlb3/aBXU88X0pFZFYB8r3Iv2+zcn22zrmuLXakllyHQCmh91SzXG8G7VWUbqB5QeFDKBx9BfBY7ijlXd9i+YulfK9nyorKXLSwVw21jEB8VXuZf3hnVX7+a/gI1I3Kc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AQyuUo8a; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AQyuUo8a" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726055962; x=1757591962; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=scaVtywZM8FRzxJE7xGyoly1lnhP22/2qGmw6jgkdxg=; b=AQyuUo8aoLjgnvsEVR3EcVgBpatSoUJDeaZVrj9ZkDZgDrPoBRPGFhEl TCYXdS43/6O+xTrncjoSkCmoq8tP+7I98YmIkCWm0ULp3DY9LTPiGZTOB cXzj4yEk4oT6uMAZ6ad+SL2BjoNgqACMJXYm583meIiGMTCMTggGs6cCV sOPV7NAAzjpTSVLbqOosTvnYZKEmJ7XoZN2V0VbSq9fepVIoEq713S5cO 0nWSE/t60f+TtlPCD/mzxzL1yi5fAiF1qXIm2EhkHenkHbDZM3NkS8nTZ IOzBTPOt6LllI7bvtLo3A8sAU5KaDOaW/xuG95XMsL6w3breNkEKYio8X g==; X-CSE-ConnectionGUID: VNCD5mgHQYeSYdM+3Q/pbw== X-CSE-MsgGUID: TqmqSYDDQNirgJp6eyHcsw== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35417256" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35417256" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:22 -0700 X-CSE-ConnectionGUID: ZFisY1gMS3mTVjLC0HM5lg== X-CSE-MsgGUID: Ubfb31yqTcK9oNxR4RzlHg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67292767" Received: from bvivekan-mobl2.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.254]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:19 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 08/14] soundwire: mipi-disco: remove DPn audio-modes Date: Wed, 11 Sep 2024 19:58:21 +0800 Message-ID: <20240911115827.233171-9-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> References: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart The concept of DPn audio-modes was never used by anyone, and was removed from the DisCo for SoundWire 2.0 specification. Remove the definitions and TODO. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- drivers/soundwire/mipi_disco.c | 2 -- include/linux/soundwire/sdw.h | 34 ---------------------------------- 2 files changed, 36 deletions(-) diff --git a/drivers/soundwire/mipi_disco.c b/drivers/soundwire/mipi_disco.c index fdab3d4a1379..79cf8212f97a 100644 --- a/drivers/soundwire/mipi_disco.c +++ b/drivers/soundwire/mipi_disco.c @@ -304,8 +304,6 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, fwnode_property_read_u32(node, "mipi-sdw-port-encoding-type", &dpn[i].port_encoding); =20 - /* TODO: Read audio mode */ - fwnode_handle_put(node); =20 i++; diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index cc0afb8af333..66feaa79ecfc 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -254,41 +254,8 @@ struct sdw_dp0_prop { bool imp_def_interrupts; }; =20 -/** - * struct sdw_dpn_audio_mode - Audio mode properties for DPn - * @bus_min_freq: Minimum bus frequency, in Hz - * @bus_max_freq: Maximum bus frequency, in Hz - * @bus_num_freq: Number of discrete frequencies supported - * @bus_freq: Discrete bus frequencies, in Hz - * @min_freq: Minimum sampling frequency, in Hz - * @max_freq: Maximum sampling bus frequency, in Hz - * @num_freq: Number of discrete sampling frequency supported - * @freq: Discrete sampling frequencies, in Hz - * @prep_ch_behave: Specifies the dependencies between Channel Prepare - * sequence and bus clock configuration - * If 0, Channel Prepare can happen at any Bus clock rate - * If 1, Channel Prepare sequence shall happen only after Bus clock is - * changed to a frequency supported by this mode or compatible modes - * described by the next field - * @glitchless: Bitmap describing possible glitchless transitions from this - * Audio Mode to other Audio Modes - */ -struct sdw_dpn_audio_mode { - u32 bus_min_freq; - u32 bus_max_freq; - u32 bus_num_freq; - u32 *bus_freq; - u32 max_freq; - u32 min_freq; - u32 num_freq; - u32 *freq; - u32 prep_ch_behave; - u32 glitchless; -}; - /** * struct sdw_dpn_prop - Data Port DPn properties - * @audio_modes: Audio modes supported * @num: port number * @max_word: Maximum number of bits in a Payload Channel Sample, 1 to 64 * (inclusive) @@ -318,7 +285,6 @@ struct sdw_dpn_audio_mode { * machine */ struct sdw_dpn_prop { - struct sdw_dpn_audio_mode *audio_modes; u32 num; u32 max_word; u32 min_word; --=20 2.43.0 From nobody Sat Nov 30 05:36:45 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8ED0219E98E; Wed, 11 Sep 2024 11:59:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055966; cv=none; b=gbWdn9LGpsKLk69bXCUWv0Q9jCIuXod1/POH0dDXEzsxnL8kFJhSF+09zj3MZOmRPRl/+hLx7XvKsoE1RJ8LW4s/W1DG6uHhJw0IbUgKYFuhf7ehT7Zz/CqExZj122M2PebBo1Ad/Lx+rZZ06T6GttxziBEK/4Ng3gqLSmKUe50= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055966; c=relaxed/simple; bh=AYWLBb8Keyuw2fUFmizNHQwBmBNVP35YDuFTaDlBHz4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kiJXwJAHbybq/IBf02BlKUGCZ5zJCxer0PMXLS6PjyKZF/CpdignJg3Fut5cpex0dct0R6ANB6bPu6fA0g1DzSlbZD/h5dCNWE62u5WGLJCokNNX2YttZMJbKPlXoDmMSo5s6FFi3TSF+ZsuAkG/NVhMBHiqSc0gE+p4hYQi1M8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=lh8UMUyR; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lh8UMUyR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726055965; x=1757591965; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AYWLBb8Keyuw2fUFmizNHQwBmBNVP35YDuFTaDlBHz4=; b=lh8UMUyRpmSoQwgZ0FbkrWyeS64rzNXFmFPpcB/nxp1/Y2KLVpOdiQwS TuCLMQS/MX85JMM8YCl2x+176KUWbLU37Z5aHAZVNgUB3TZsJuwlN4FnA HCpgrX5RD2SCuQ3LSBnVJ2BsI2snWvWgNstygYgXPPyF3WWanEtOUuI95 GrtBTMr+Zn7lc8GCp/2L33LXaKXkJPfsnGckBNOzL4b/RZ31wSOMvXcmK adkmXmMpLQVfFl0YwOtREsZJ4N1PJULUoBDa61gObF0CgYE5Xjs4NgCVB AcOwAURaE1is07RMjOGF32+oFtcxr7zRKcEK5DRm3oQbggcO3to9bhWD1 g==; X-CSE-ConnectionGUID: QLGYxqJ5Q/qiSGPV0VpjVw== X-CSE-MsgGUID: vImXfTAMRDCd4armKVCeVg== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35417261" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35417261" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:24 -0700 X-CSE-ConnectionGUID: eGgiJhvzSBqqYlzBuFWPXA== X-CSE-MsgGUID: jJEBzvpGS2q30vhZt/AoNA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67292771" Received: from bvivekan-mobl2.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.254]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:22 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 09/14] soundwire: mipi-disco: add error handling for property array read Date: Wed, 11 Sep 2024 19:58:22 +0800 Message-ID: <20240911115827.233171-10-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> References: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart The existing code assumes that there are no possible errors when using fwnode_property_read_u32_array(), because fwnode_property_count_u32() reads this array to determine its number of elements. We need to also protect the second read to be completely bullet-proof. Suggested-by: Andy Shevchenko Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- drivers/soundwire/mipi_disco.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/drivers/soundwire/mipi_disco.c b/drivers/soundwire/mipi_disco.c index 79cf8212f97a..99253f4c9a38 100644 --- a/drivers/soundwire/mipi_disco.c +++ b/drivers/soundwire/mipi_disco.c @@ -52,7 +52,9 @@ int sdw_master_read_prop(struct sdw_bus *bus) struct sdw_master_prop *prop =3D &bus->prop; struct fwnode_handle *link; char name[32]; - int nval, i; + int nval; + int ret; + int i; =20 device_property_read_u32(bus->dev, "mipi-sdw-sw-interface-revision", @@ -91,9 +93,11 @@ int sdw_master_read_prop(struct sdw_bus *bus) return -ENOMEM; } =20 - fwnode_property_read_u32_array(link, + ret =3D fwnode_property_read_u32_array(link, "mipi-sdw-clock-frequencies-supported", prop->clk_freq, prop->num_clk_freq); + if (ret < 0) + return ret; } =20 /* @@ -119,10 +123,12 @@ int sdw_master_read_prop(struct sdw_bus *bus) return -ENOMEM; } =20 - fwnode_property_read_u32_array(link, + ret =3D fwnode_property_read_u32_array(link, "mipi-sdw-supported-clock-gears", prop->clk_gears, prop->num_clk_gears); + if (ret < 0) + return ret; } =20 fwnode_property_read_u32(link, "mipi-sdw-default-frame-rate", @@ -151,6 +157,7 @@ static int sdw_slave_read_dp0(struct sdw_slave *slave, struct sdw_dp0_prop *dp0) { int nval; + int ret; =20 fwnode_property_read_u32(port, "mipi-sdw-port-max-wordlength", &dp0->max_word); @@ -168,9 +175,11 @@ static int sdw_slave_read_dp0(struct sdw_slave *slave, if (!dp0->words) return -ENOMEM; =20 - fwnode_property_read_u32_array(port, + ret =3D fwnode_property_read_u32_array(port, "mipi-sdw-port-wordlength-configs", dp0->words, dp0->num_words); + if (ret < 0) + return ret; } =20 dp0->BRA_flow_controlled =3D mipi_fwnode_property_read_bool(port, @@ -191,9 +200,10 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, { struct fwnode_handle *node; u32 bit, i =3D 0; - int nval; unsigned long addr; char name[40]; + int nval; + int ret; =20 addr =3D ports; /* valid ports are 1 to 14 so apply mask */ @@ -228,9 +238,11 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, return -ENOMEM; } =20 - fwnode_property_read_u32_array(node, + ret =3D fwnode_property_read_u32_array(node, "mipi-sdw-port-wordlength-configs", dpn[i].words, dpn[i].num_words); + if (ret < 0) + return ret; } =20 fwnode_property_read_u32(node, "mipi-sdw-data-port-type", @@ -269,9 +281,11 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, return -ENOMEM; } =20 - fwnode_property_read_u32_array(node, + ret =3D fwnode_property_read_u32_array(node, "mipi-sdw-channel-number-list", dpn[i].channels, dpn[i].num_channels); + if (ret < 0) + return ret; } =20 nval =3D fwnode_property_count_u32(node, "mipi-sdw-channel-combination-l= ist"); @@ -286,10 +300,12 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, return -ENOMEM; } =20 - fwnode_property_read_u32_array(node, + ret =3D fwnode_property_read_u32_array(node, "mipi-sdw-channel-combination-list", dpn[i].ch_combinations, dpn[i].num_ch_combinations); + if (ret < 0) + return ret; } =20 fwnode_property_read_u32(node, --=20 2.43.0 From nobody Sat Nov 30 05:36:45 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2876A19F112; Wed, 11 Sep 2024 11:59:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055968; cv=none; b=CyRkJ+aL9Rb+1kJA3uUDZeHM+Af6iFfG6rwbn4P0eKlF70i9X/MdalMiazP+6D4w9RpYTqezmF966YXYFM15E+IbIxQk1lfNr/cq3+AkSq+lIxdNE0R6PSTiLCmFAkCh3o9IYeaaYd/GPyqiVRSsWWsAkqrQyuSlZV/z5JmGNKk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055968; c=relaxed/simple; bh=gqvcCDV7IzMmRINKZ0ibda4nCVtOH01gXGIaUt4CVFE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DKWG939Jd90VmeyhbBEsqOk4HTIwjV6FFDH03dKd0g1ytdEeH+h1SfAtlGRiBmtAXwEec2uFhklkuRnBMvSdl6IDcrXzDPOFUMZpXGE7J3FYjLEHaYvzcHcVMgerkBy9Cdf5bj+iDc+KdZFjClUFTi4xUFL6zT7PbCrjtdYcky8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=kfLCNeCN; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kfLCNeCN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726055967; x=1757591967; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gqvcCDV7IzMmRINKZ0ibda4nCVtOH01gXGIaUt4CVFE=; b=kfLCNeCNEm3a04I3N593/ZRYTpg2KkgGwIJ0FalFDyHMGV11F+5XEy21 FXMQ7bwsCvRFkF85WWVX0nHqstz4vmPDwL9FVLzzkjo0ZrHwAAakrdBMD dWgsZ6N/A/400TyXHWfNEMSlxAMlaQqfpdmPH1lszEkMvIQjz1RXZs4Qf 2Ino+4LkidypeFz0BSC85Fbow0qS1sKFoxnRCObOxRs08gQbtIWdZ8BuE 6qbVyHIQUFv180riiXDOgwmDNq7CR0/4UI3KhcIh6cLuwEii1CU20pFYL sn9mF/3FCx5v6SdphBHrJnfwA9ZkR4zhhvM9TAI5f30naNpSNujymWAY3 A==; X-CSE-ConnectionGUID: juc0rks8TkK3Vmiz+RJNdw== X-CSE-MsgGUID: +Ld0ne+tTmeCjeztUeyeeA== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35417267" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35417267" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:27 -0700 X-CSE-ConnectionGUID: fURjMYspTVazeMu4tHjTtw== X-CSE-MsgGUID: ZDaEX7kEQgCw7Lf4uvhwbQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67292789" Received: from bvivekan-mobl2.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.254]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:24 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 10/14] soundwire: mipi_disco: add support for clock-scales property Date: Wed, 11 Sep 2024 19:58:23 +0800 Message-ID: <20240911115827.233171-11-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> References: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart The DisCo for SoundWire 2.0 spec adds support for the 'mipi-sdw-supported-clock-scales' property, which is just a rename. Add in a backwards-compatible manner. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- drivers/soundwire/mipi_disco.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/mipi_disco.c b/drivers/soundwire/mipi_disco.c index 99253f4c9a38..5f42d23bbc85 100644 --- a/drivers/soundwire/mipi_disco.c +++ b/drivers/soundwire/mipi_disco.c @@ -51,6 +51,7 @@ int sdw_master_read_prop(struct sdw_bus *bus) { struct sdw_master_prop *prop =3D &bus->prop; struct fwnode_handle *link; + const char *scales_prop; char name[32]; int nval; int ret; @@ -112,7 +113,12 @@ int sdw_master_read_prop(struct sdw_bus *bus) } } =20 - nval =3D fwnode_property_count_u32(link, "mipi-sdw-supported-clock-gears"= ); + scales_prop =3D "mipi-sdw-supported-clock-scales"; + nval =3D fwnode_property_count_u32(link, scales_prop); + if (nval =3D=3D 0) { + scales_prop =3D "mipi-sdw-supported-clock-gears"; + nval =3D fwnode_property_count_u32(link, scales_prop); + } if (nval > 0) { prop->num_clk_gears =3D nval; prop->clk_gears =3D devm_kcalloc(bus->dev, prop->num_clk_gears, @@ -124,7 +130,7 @@ int sdw_master_read_prop(struct sdw_bus *bus) } =20 ret =3D fwnode_property_read_u32_array(link, - "mipi-sdw-supported-clock-gears", + scales_prop, prop->clk_gears, prop->num_clk_gears); if (ret < 0) --=20 2.43.0 From nobody Sat Nov 30 05:36:45 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0D9C19F133; Wed, 11 Sep 2024 11:59:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055971; cv=none; b=mgG4Y+Fv23hz2BPE7J88Fq4vvoINqxEjiYwVcfTjbzH/bLQDst2RHm++NJ393/MmoMbrPFM8w7/aRxnmGOlkSsQFA4hW/nq/fUykBoJHT6LP3MqtXvzQ86H7UhjaIBIpXbYQD537V7NU160+Vs0zS7ZEBZJjOlReIFmNANTQGks= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055971; c=relaxed/simple; bh=tR8A1eViSyQSc4oQ1f/zM0XJtPGc9luqCHbxUT7oPnk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=glIo1aPnlHl+GGndutDtI0TSvD6iU9NjkHF/MPvJlLGuZSZK4Mz9cgtY2tOpH5ZEzXUNJyMsg4SoLWoO7UXUfmXxlLYIiSlDQxwpcXCwOJgri+IxwWvMQDo+eYJJSXQJAFl2W4ElfV2fU9qsWWXcXeZBqP1UmFdd2TsQGXuMFKI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AA9EEnSb; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AA9EEnSb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726055970; x=1757591970; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tR8A1eViSyQSc4oQ1f/zM0XJtPGc9luqCHbxUT7oPnk=; b=AA9EEnSbbbXeME1TlAccIhHEJ5LOXgN18lanHYW5NwclKJ4ojsjizArr JDTFCDFo/e0fe0edbS/ZKQ2slu6tWBlnXCthaiTRMtXcKoQn6uHnZbsQC zD8HUHmOzzuPVpidBvIOUvs8ncM7jplEDHh4vZWgnfdAdZEnbT21VZC/l HxkAMLhCND42fgi0fkQ9fLxJZA85gsDiqzCDgM7pomttCl7fUNaGr5PR2 N4LKVYfxs7UrUsnIzLRM8lOyyeB8/6oLlT4NP5fWGDIzLDst9/AKzGis3 uncsehqToB1GVRIQEiOhd4xktFNWE9fqZkk6njg5WPzaJ3+Zf5KxKIpso g==; X-CSE-ConnectionGUID: f1gd+oJvRZKq5hUTY1HeDg== X-CSE-MsgGUID: 8/FFL+HWQGatDDYvfRIrLQ== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35417272" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35417272" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:30 -0700 X-CSE-ConnectionGUID: e27MVziTSjq4SPnfeqKeHg== X-CSE-MsgGUID: IIkmz/++RgCr1TFvSLrPTw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67292801" Received: from bvivekan-mobl2.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.254]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:27 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 11/14] soundwire: mipi-disco: add support for peripheral channelprepare timeout Date: Wed, 11 Sep 2024 19:58:24 +0800 Message-ID: <20240911115827.233171-12-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> References: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart The DisCo for SoundWire 2.0 spec renamed the 'mipi-sdw-slave-channelprepare-timeout', add support for the new definition in backwards-compatible ways. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- drivers/soundwire/mipi_disco.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/soundwire/mipi_disco.c b/drivers/soundwire/mipi_disco.c index 5f42d23bbc85..6feba5631eae 100644 --- a/drivers/soundwire/mipi_disco.c +++ b/drivers/soundwire/mipi_disco.c @@ -344,6 +344,7 @@ int sdw_slave_read_prop(struct sdw_slave *slave) struct device *dev =3D &slave->dev; struct fwnode_handle *port; int nval; + int ret; =20 device_property_read_u32(dev, "mipi-sdw-sw-interface-revision", &prop->mipi_revision); @@ -366,8 +367,11 @@ int sdw_slave_read_prop(struct sdw_slave *slave) device_property_read_u32(dev, "mipi-sdw-clockstopprepare-timeout", &prop->clk_stop_timeout); =20 - device_property_read_u32(dev, "mipi-sdw-slave-channelprepare-timeout", - &prop->ch_prep_timeout); + ret =3D device_property_read_u32(dev, "mipi-sdw-peripheral-channelprepare= -timeout", + &prop->ch_prep_timeout); + if (ret < 0) + device_property_read_u32(dev, "mipi-sdw-slave-channelprepare-timeout", + &prop->ch_prep_timeout); =20 device_property_read_u32(dev, "mipi-sdw-clockstopprepare-hard-reset-behavior", --=20 2.43.0 From nobody Sat Nov 30 05:36:45 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 358831A01BF; Wed, 11 Sep 2024 11:59:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055973; cv=none; b=aJz5p5cwNBqfuSmsNt1O7xNav96rZkcAeDAo6CLXxOSqD/YXOAWfbv3PxMTA9ZWSwGsCQb6CYbtb9MFhSSRRwi4eib2lQUVawl6RWu+7jBjSTB6uPpZLNZ/I2pPbEwONSf3Dk3yy/mUZl6fMTIMOIX54wU/ki9Xvfn1KyfuSJkk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055973; c=relaxed/simple; bh=ZB3aqSPbxq3S58RNyPbBpF2vKgfog9SCStSlk2aXwzI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j+IirxKjdcRELCAl9pw8/YZG7sNpU4djVlFmcWPun5JZrKCz0quSC3WJUOe0ES3jVi6ur9IXoD+so1bafkwm4YpF5CHHnFxM8DTUTs7mS8rPLtXLigmom0CpZaNI4Yj1gBWCLBOeFuf6+INN+4LtVu5Cq+b7wfhL3o36CppWwK0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=jJzEK8no; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="jJzEK8no" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726055972; x=1757591972; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZB3aqSPbxq3S58RNyPbBpF2vKgfog9SCStSlk2aXwzI=; b=jJzEK8noxKYf6VhXOhWZrCW5qZyFvot6C+FsvlOiKsrYZp1rAKnlvdvl V+FLaXCgWrekB2MUB5ETzHzUExFo5m+mdDqfhh6iywknCnxmYYAaf7u++ Q85B8A3MhOgqDhsApRhRuApWooiiy1kkCjW8SCfkPzbCediwYaA23/wZc Hq+Kt0NY9cX+HgyJKaI9H9xiPWcCa/nac9FXenbQWpwBopkReoDP5U2wB nWncIv2Q8uu0/LGPdrRLt0D5IW4ji5CqYR81pqwz5h8PZK4JzPIO1t0f3 YVnp+aD2N39OJggej4pR5td9+diVPOmnlsbcY5Z3ilTKXu3eoEALFEVJ2 g==; X-CSE-ConnectionGUID: XlgRvSILQuqSGYhlsmfVZw== X-CSE-MsgGUID: Ex0Y5bi1Soa9Eyh3GSYa6g== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35417280" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35417280" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:32 -0700 X-CSE-ConnectionGUID: /wkxpD0mR3OXBS8QenhA6Q== X-CSE-MsgGUID: SGks27XXQD2qLo7yDeOXZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67292810" Received: from bvivekan-mobl2.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.254]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:30 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 12/14] soundwire: mipi-disco: add comment on DP0-supported property Date: Wed, 11 Sep 2024 19:58:25 +0800 Message-ID: <20240911115827.233171-13-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> References: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart The DisCo for SoundWire 2.0 spec adds support for a new property, but it's not very helpful. Add a comment to explain that it's intentionally ignored. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- drivers/soundwire/mipi_disco.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/mipi_disco.c b/drivers/soundwire/mipi_disco.c index 6feba5631eae..d6eb63bf1252 100644 --- a/drivers/soundwire/mipi_disco.c +++ b/drivers/soundwire/mipi_disco.c @@ -398,7 +398,11 @@ int sdw_slave_read_prop(struct sdw_slave *slave) device_property_read_u32(dev, "mipi-sdw-sink-port-list", &prop->sink_ports); =20 - /* Read dp0 properties */ + /* + * Read dp0 properties - we don't rely on the 'mipi-sdw-dp-0-supported' + * property since the 'mipi-sdw-dp0-subproperties' property is logically + * equivalent. + */ port =3D device_get_named_child_node(dev, "mipi-sdw-dp-0-subproperties"); if (!port) { dev_dbg(dev, "DP0 node not found!!\n"); --=20 2.43.0 From nobody Sat Nov 30 05:36:45 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B53AC1A2626; Wed, 11 Sep 2024 11:59:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055976; cv=none; b=DvZAQL+FT8LAtfKXfYBv/03kg+/xq690wRc/uxy5Ml0xm5vPnlya21o4l/Q+txQzgqHtFThSR22lHEvJe6SMuMeeqXgoQmSVl+qZYYdfhTABVmaoo5TT0cbW0s6jDfpq6Mg3sJjkIRcbwQlWlSbfVQwRMnVZo3gyVbsKtygxP/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055976; c=relaxed/simple; bh=8QxpkFSxoNjBvdT/4TaTLNU6cNZOZw6ufXE7ms0iV0A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YdXMSaKSwjmh6TTRwIUcymjIV17G0AySBGrUtFCO9vIsKqkJGQsXCBy5YIKqvvQR0GGR3SjtDgRE5E/0HQsY46OjOgWMl15/mExHTyPHfT8jQR9RMwl0qyUBWjeqgKeAvcTobxfqv06Id3A86tbqwhMbfM5jES9Y74Ybw5uqlkk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=FE3JT7hr; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FE3JT7hr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726055975; x=1757591975; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8QxpkFSxoNjBvdT/4TaTLNU6cNZOZw6ufXE7ms0iV0A=; b=FE3JT7hrVbPnszUMmgtn5R78Q/egdkevEkOo3k0iEjbK4j19CORXG6sR Naz4uyaYL4sLgZmgTa2TQysUDKzmwbTW5LBQkPq1UskzstkCF8wW2Fh89 +MjjCyIIPZGZfVBPsI6fbg2CoBQ70EoBEOneJHqxyLk8GkIZEOsvdNN0I 096kmZ9aAPM2DHu+RZfWNGbXvrjVRkn89QJKvDwpowWKTeJVGqjkbrkbE p+mok30NAOfJl4Mh7CcH/tQC7HyfCvH1w+2M4fFHX/qHIF/u4/mKXfDMt +VuGZltGoBVLTDheqO3n40w96eOVvVyMKlKMMyVqXpYcS18ooELzCIYfy A==; X-CSE-ConnectionGUID: CP1oTVqvSimc+r6fKcEB+A== X-CSE-MsgGUID: OsMhJYFlS+qgNgjIxvTVMw== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35417284" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35417284" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:34 -0700 X-CSE-ConnectionGUID: /tG9QsCDRHWFPrLEee29lQ== X-CSE-MsgGUID: Y4VFg8riQBiX6foISsq8XQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67292820" Received: from bvivekan-mobl2.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.254]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:32 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 13/14] soundwire: mipi-disco: add new properties from 2.0 spec Date: Wed, 11 Sep 2024 19:58:26 +0800 Message-ID: <20240911115827.233171-14-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> References: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart The DisCo for SoundWire 2.0 spec adds support for new 'mipi-sdw-sdca-interrupt-register-list' and 'mipi-sdw-commit-register-supported'. This patch only adds the definitions and property reads, but the use of these properties will come at some point in the future when needed. Note a slight conceptual disconnect between the MIPI DisCo definition of a boolean property and the Linux implementation. The latter only checks the presence of the property to set its value to 'true', whereas the MIPI definitions allow for a property with a 'false' value. This patch uses the new introduced mipi_device_property_read_bool() to handle it. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- drivers/soundwire/mipi_disco.c | 6 ++++++ include/linux/soundwire/sdw.h | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/mipi_disco.c b/drivers/soundwire/mipi_disco.c index d6eb63bf1252..36e734751225 100644 --- a/drivers/soundwire/mipi_disco.c +++ b/drivers/soundwire/mipi_disco.c @@ -398,6 +398,12 @@ int sdw_slave_read_prop(struct sdw_slave *slave) device_property_read_u32(dev, "mipi-sdw-sink-port-list", &prop->sink_ports); =20 + device_property_read_u32(dev, "mipi-sdw-sdca-interrupt-register-list", + &prop->sdca_interrupt_register_list); + + prop->commit_register_supported =3D mipi_device_property_read_bool(dev, + "mipi-sdw-commit-register-supported"); + /* * Read dp0 properties - we don't rely on the 'mipi-sdw-dp-0-supported' * property since the 'mipi-sdw-dp0-subproperties' property is logically diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 66feaa79ecfc..952514f044f0 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -335,8 +335,11 @@ struct sdw_dpn_prop { * @master_count: Number of Masters present on this Slave * @source_ports: Bitmap identifying source ports * @sink_ports: Bitmap identifying sink ports - * @scp_int1_mask: SCP_INT1_MASK desired settings * @quirks: bitmask identifying deltas from the MIPI specification + * @sdca_interrupt_register_list: indicates which sets of SDCA interrupt s= tatus + * and masks are supported + * @commit_register_supported: is PCP_Commit register supported + * @scp_int1_mask: SCP_INT1_MASK desired settings * @clock_reg_supported: the Peripheral implements the clock base and scale * registers introduced with the SoundWire 1.2 specification. SDCA devices * do not need to set this boolean property as the registers are required. @@ -363,6 +366,8 @@ struct sdw_slave_prop { u32 source_ports; u32 sink_ports; u32 quirks; + u32 sdca_interrupt_register_list; + u8 commit_register_supported; u8 scp_int1_mask; bool clock_reg_supported; bool use_domain_irq; --=20 2.43.0 From nobody Sat Nov 30 05:36:45 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 449AA1A262F; Wed, 11 Sep 2024 11:59:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055978; cv=none; b=E0cAD1BdE82z+4xUS5YxOpKAUEE066YAjXWp4eQDqE8prjKODj6r2rLNEKVpTnDerWQcvQFdj4f5fAf9NWeja27OtK9lJFAEmGWFxnRSU4fCV/TO9itXQD7+oThjJhLOHif5bmzizURXC0aUaOkAJDoPD4UKo+KIU91riwoofFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726055978; c=relaxed/simple; bh=awf+jdv0Kcu1kulfBFzwxSCd1Qw1p3qofzbE26Kc4ow=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Wh40LDb+POHmarTXO9vTepHiFReF/ixFD9G2XkeBshylnoaOA6h/ZXVd8UK8dnvv2yUuUI3Ges4g0jdzNmDOJK29lceZUNP7MzDNjV7kO26XhEYgOa7jW433YbnIJNMAKVhclmEwoUOuBEuSoE9lo0KWAofyI0WyIa33aROsD+c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=n4GN0MF1; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="n4GN0MF1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726055977; x=1757591977; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=awf+jdv0Kcu1kulfBFzwxSCd1Qw1p3qofzbE26Kc4ow=; b=n4GN0MF193fDGqbCGJ8XkrojmcMBvbqFgDfxLD+yII5c2ZhaA4IRLAa0 TcHuYCifUObUDw6zPqa57DxHMEGQoXem2iSZ0WJvVX3aWbz99PmClFW+E w9F+IMOi3YOzkIy+3nXLahAkmjufC03xfCJtPkxBQ8f+TZdWwYmh7yz/v tsFYRVDQU9QofsX1sl/sxYYshRURa6zyiR8CFmG7EadGVDG+lmRT1XhKW N6TqI7FvzhaYWL9q113xidyz1JpkWfRe8MSZScbbXO1HvQEvS7Iql6JjM pYl4NCQJ/+k2bYqfjLLBV5LHW14lwkPvzn2BaIuZUcYuMR0mALhCxSVVU w==; X-CSE-ConnectionGUID: +dXxeMdkRgy/pTvWQNScVg== X-CSE-MsgGUID: v1iBdf88QhiR5d8Oq7IThg== X-IronPort-AV: E=McAfee;i="6700,10204,11191"; a="35417287" X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="35417287" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:37 -0700 X-CSE-ConnectionGUID: PzjPFISkQge9sGjrLk5HYQ== X-CSE-MsgGUID: 15xmwU5mQNi7PFMgEa+LKA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,219,1719903600"; d="scan'208";a="67292833" Received: from bvivekan-mobl2.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.118.254]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2024 04:59:35 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com Subject: [PATCH v2 14/14] soundwire: mipi-disco: add support for DP0/DPn 'lane-list' property Date: Wed, 11 Sep 2024 19:58:27 +0800 Message-ID: <20240911115827.233171-15-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> References: <20240911115827.233171-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart The SoundWire specification did not clearly require that ports could use all Lanes. Some SoundWire/SDCA peripheral adopters added restrictions on which lanes can be used by what port, and the DisCo for SoundWire 2.1 specification added a 'lane-list' property to model this hardware limitation. When not specified, the ports can use all Lanes. Otherwise, the 'lane-list' indicates which Lanes can be used, sorted by order of preference (most-preferred-first). This patch only reads the properties, the use of this property will come at a later time with multi-lane support. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- drivers/soundwire/mipi_disco.c | 32 ++++++++++++++++++++++++++++++++ include/linux/soundwire/sdw.h | 8 ++++++++ 2 files changed, 40 insertions(+) diff --git a/drivers/soundwire/mipi_disco.c b/drivers/soundwire/mipi_disco.c index 36e734751225..9d59f486edbe 100644 --- a/drivers/soundwire/mipi_disco.c +++ b/drivers/soundwire/mipi_disco.c @@ -197,6 +197,22 @@ static int sdw_slave_read_dp0(struct sdw_slave *slave, dp0->imp_def_interrupts =3D mipi_fwnode_property_read_bool(port, "mipi-sdw-imp-def-dp0-interrupts-supported"); =20 + nval =3D fwnode_property_count_u32(port, "mipi-sdw-lane-list"); + if (nval > 0) { + dp0->num_lanes =3D nval; + dp0->lane_list =3D devm_kcalloc(&slave->dev, + dp0->num_lanes, sizeof(*dp0->lane_list), + GFP_KERNEL); + if (!dp0->lane_list) + return -ENOMEM; + + ret =3D fwnode_property_read_u32_array(port, + "mipi-sdw-lane-list", + dp0->lane_list, dp0->num_lanes); + if (ret < 0) + return ret; + } + return 0; } =20 @@ -326,6 +342,22 @@ static int sdw_slave_read_dpn(struct sdw_slave *slave, fwnode_property_read_u32(node, "mipi-sdw-port-encoding-type", &dpn[i].port_encoding); =20 + nval =3D fwnode_property_count_u32(node, "mipi-sdw-lane-list"); + if (nval > 0) { + dpn[i].num_lanes =3D nval; + dpn[i].lane_list =3D devm_kcalloc(&slave->dev, + dpn[i].num_lanes, sizeof(*dpn[i].lane_list), + GFP_KERNEL); + if (!dpn[i].lane_list) + return -ENOMEM; + + ret =3D fwnode_property_read_u32_array(node, + "mipi-sdw-lane-list", + dpn[i].lane_list, dpn[i].num_lanes); + if (ret < 0) + return ret; + } + fwnode_handle_put(node); =20 i++; diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 952514f044f0..73f655334fe9 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -238,6 +238,8 @@ enum sdw_clk_stop_mode { * @simple_ch_prep_sm: If channel prepare sequence is required * @imp_def_interrupts: If set, each bit corresponds to support for * implementation-defined interrupts + * @num_lanes: array size of @lane_list + * @lane_list: indicates which Lanes can be used by DP0 * * The wordlengths are specified by Spec as max, min AND number of * discrete values, implementation can define based on the wordlengths they @@ -252,6 +254,8 @@ struct sdw_dp0_prop { bool BRA_flow_controlled; bool simple_ch_prep_sm; bool imp_def_interrupts; + int num_lanes; + u32 *lane_list; }; =20 /** @@ -275,6 +279,8 @@ struct sdw_dp0_prop { * @num_ch_combinations: Number of channel combinations supported * @channels: Discrete channels supported * @ch_combinations: Channel combinations supported + * @lane_list: indicates which Lanes can be used by DPn + * @num_lanes: array size of @lane_list * @modes: SDW mode supported * @max_async_buffer: Number of samples that this port can buffer in * asynchronous modes @@ -300,6 +306,8 @@ struct sdw_dpn_prop { u32 num_ch_combinations; u32 *channels; u32 *ch_combinations; + u32 *lane_list; + int num_lanes; u32 modes; u32 max_async_buffer; u32 port_encoding; --=20 2.43.0