From patchwork Fri Nov 18 02:58:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 22087 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp759909wrr; Thu, 17 Nov 2022 19:44:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf5mRUK7ByShxG/qM2S0zos8D4ReLgzDJ6s8Cf09dN8HjKGsCT/D8QwHeTxw41Yr6sqx1pzd X-Received: by 2002:a63:fa45:0:b0:476:e63a:99b6 with SMTP id g5-20020a63fa45000000b00476e63a99b6mr4855220pgk.60.1668743097898; Thu, 17 Nov 2022 19:44:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668743097; cv=none; d=google.com; s=arc-20160816; b=ukekPUGDQuLaXlsc4dTETos/AlWw3X0B08l4UpSIlQq9L+WK92n1TGpeEPMSWbutR+ bLhoipkReJnRup9YrX0GJEgCfJp+OHOjXtr5vxnoB+Fx9KLizrJ/PgvQ9FzoATgiA9C1 /jyXA68IsUWFy1U5uBnOuiicnRzH+DmTwNV02gCMUY9WWyTIJzU6H68vPO3qmSwkcxI3 InUg5WyEpr33W53AcMh50WyMX6+uCoTaY0pmbOmqK3+FBDUFx4wuY92SRDYPFIlijamD GhYPN5e6HKdb6STOqMzIT95bEdiDUBnkJMChjqEPs/uyJIipXTn7fvz2YpEuT3ep+5iw 94RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RpKQeZmM4RI6h73te63xvfYoZcPYky5EHfvuV3XJxS8=; b=MtY+MG6wdWFwWd6dMuBDysvkvOmLuspw4H/6wkrBi5WTcMIgHozvOniO2MWQPXq6b4 no9dJrQxbXLlKmen3RBNE2CzIqtz+hlzUrI/a86rqjLb/ufMfHjvB67ZfyogODEfRqQ+ YHPytTf9Q+A3d0JXOb4Edk/v7hG27YRrj0P4x6GY/Kqwu/rpuKY5Hj1tbvVHGMHGvQ4+ 2IJgSB/Uvavj+AdOcc+QiK2REhHxseDqtt+7ZicN2IHKWQ0KmFQ8rXqAGu2zNUNPNtDG XN0E3kRr6dZHPh0Ly3blaTMExUrrTmjknTbb/9sixFkVrf79vwkeqhx0g1gqoeLyZZ1W LmDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=d1rT+eaM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020a17090a4e8300b0021616a303b8si2426890pjh.83.2022.11.17.19.44.21; Thu, 17 Nov 2022 19:44:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=d1rT+eaM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240913AbiKRC4H (ORCPT + 99 others); Thu, 17 Nov 2022 21:56:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240832AbiKRCz6 (ORCPT ); Thu, 17 Nov 2022 21:55:58 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC1A48F3DB for ; Thu, 17 Nov 2022 18:55:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668740150; x=1700276150; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sFoTlN5v6r79HUZxzN2vBniRQPFO0vULAV0J7b3pGgI=; b=d1rT+eaM5kkMPiHBh6J6r6/k32GDbSdXw49xy5N4ROc0W3KI774tXeSN Ot9CUmrfDO9gW7t+cyBg2l4RHxG/sJ/vPh/1fXzLBA92b7rdwidFaaP/H ybvocJlAf3DO5VqBOdfdjFHGycKmdbyaqklagU9dXc+Q4SyGI81rBbllA JvcqiAyM2hDsR14xmNNSOqfErGBirZ45rtdYEBrrwAdeGxHYtbP5m32C+ 73475wHrTvB9dAsnxlkwoTlaHH7LbU5UGjd0mnRl8ylzBaZ9Oe7W68Mck D1Hes5u7P3p+3xLSdw1tr8jNE/tiBqAB+pbsHEJ8XM5NmuYFjWuh7B8fq Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10534"; a="296400633" X-IronPort-AV: E=Sophos;i="5.96,172,1665471600"; d="scan'208";a="296400633" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2022 18:55:50 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10534"; a="642347898" X-IronPort-AV: E=Sophos;i="5.96,172,1665471600"; d="scan'208";a="642347898" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2022 18:55:48 -0800 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com, vkoul@kernel.org, bard.liao@intel.com, peter.ujfalusi@linux.intel.com, ranjani.sridharan@linux.intel.com, vinod.koul@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] soundwire: enable optional clock registers for SoundWire 1.2 devices Date: Fri, 18 Nov 2022 10:58:07 +0800 Message-Id: <20221118025807.534863-3-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221118025807.534863-1-yung-chuan.liao@linux.intel.com> References: <20221118025807.534863-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749803963102162106?= X-GMAIL-MSGID: =?utf-8?q?1749803963102162106?= From: Pierre-Louis Bossart The bus supports the mandatory clock registers for SDCA devices, these registers can also be optionally supported by SoundWire 1.2 devices that don't follow the SDCA class specification. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Péter Ujfalusi Signed-off-by: Bard Liao Reviewed-by: Charles Keepax --- drivers/soundwire/bus.c | 7 ++++--- include/linux/soundwire/sdw.h | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index c23275b443ac..55d393247a0f 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -1233,10 +1233,11 @@ static int sdw_slave_set_frequency(struct sdw_slave *slave) /* * frequency base and scale registers are required for SDCA - * devices. They may also be used for 1.2+/non-SDCA devices, - * but we will need a DisCo property to cover this case + * devices. They may also be used for 1.2+/non-SDCA devices. + * Driver can set the property, we will need a DisCo property + * to discover this case from platform firmware. */ - if (!slave->id.class_id) + if (!slave->id.class_id && !slave->prop.clock_reg_supported) return 0; if (!mclk_freq) { diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 8fb458931772..9a49263c53cf 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -365,6 +365,9 @@ struct sdw_dpn_prop { * @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 + * registers introduced with the SoundWire 1.2 specification. SDCA devices + * do not need to set this boolean property as the registers are required. */ struct sdw_slave_prop { u32 mipi_revision; @@ -388,6 +391,7 @@ struct sdw_slave_prop { struct sdw_dpn_prop *sink_dpn_prop; u8 scp_int1_mask; u32 quirks; + bool clock_reg_supported; }; #define SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY BIT(0)