From patchwork Wed Jan 18 16:04:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Binding X-Patchwork-Id: 45358 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2423302wrn; Wed, 18 Jan 2023 08:12:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXvZA1cW1qeFklWrmAIqiFeLDgCBfHMBHmRHM5E2NYqsrI0SPi7N7TP7oopZS7TC7sFJYdl9 X-Received: by 2002:a05:6402:2b8c:b0:48f:a9a2:29fa with SMTP id fj12-20020a0564022b8c00b0048fa9a229famr7953559edb.2.1674058364518; Wed, 18 Jan 2023 08:12:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674058364; cv=none; d=google.com; s=arc-20160816; b=Zb2V9Z4GKqfh0OkCBHKALW2QuRwl3O4csQm0xtenr/l8WSXbFqMWjYOHRa+60svNGB vbXR8ByiKwK2ea4XrndIMk7Hv0OuBgSlTiAg2GzvSC3o8aiBtbwvR1hrKeGBWNnwlvYK x4iMEpx+XEnK/YXuPQTXWZq4l/bKkWBMCIWsir4ABng5VHwNsdmkDkBIC+pYVZ+1swd/ 4zBJMwB4qpcIR8XN2q98QJagWTSjH2pzMAS8YyVdojNC6eMFc8w2F8tZPVtCTUhAYBRE FUSdS4gY2QqGSWxQl508Z4y8RrvixdoV3py72Gd0gAx/NkwJqd7gpV9sbx1IkW7NyS1Q HJZA== 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=RrsmUAoPfdKz/GjTW3d2CI1v1QDtyYNp4XQoW8Gfmu4=; b=V3bdSFgjZhrCDxgZ2MJ68hPy3I2aEmcXgn5q8X5oA4GO8ApOLXoVAO+9+Z0dgHXBr/ tTrE5k08igd+ByvzI/aM7XJxJRF+VdX30V77n3+AzVJLDfnD2C8MuJvA+wooG95JL58l WnRzpGN0BR4oBMuI0DHmW/Fnaa2KsXumX4U8nLB9r3VioyOpJOB6CV871TcdcXeCU4sa XAQQKPTdIXFdi0Jt1seRq5regaf6cdHJfucA8TlhrUSz8YKUivfIxNuAoda3nIE1xHgz gGTeoEk7M+Z8p1X/pWmGHDMSkF777fYkovZGMVqxJPidOZ4aKsBmmR36FX2C7ROuM8sr I5Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=lQ6o62Lk; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a50c88b000000b0048b6bca0c4bsi32654350edh.565.2023.01.18.08.12.19; Wed, 18 Jan 2023 08:12:44 -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=@cirrus.com header.s=PODMain02222019 header.b=lQ6o62Lk; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230506AbjARQJ4 (ORCPT + 99 others); Wed, 18 Jan 2023 11:09:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230373AbjARQJF (ORCPT ); Wed, 18 Jan 2023 11:09:05 -0500 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0D7145890 for ; Wed, 18 Jan 2023 08:05:16 -0800 (PST) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30IEDgr6022836; Wed, 18 Jan 2023 10:05:00 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=RrsmUAoPfdKz/GjTW3d2CI1v1QDtyYNp4XQoW8Gfmu4=; b=lQ6o62LkRIncspk6CTo7TCqKVATdDk0oiVuVG99ajX5AaiO7NHtPCwg18mLY3uvS/JWz OySbtAXgH06LDTOeOAKEJBtBQedcZjuznz4efhO+7VPUxrgAoI9NSwQdFQsQMvup1dSA mg4YVy+JdkfSRh6KPARNEP9taMBjss5FqzDc5cwBC44ao/fVldacntdSGBRa3anaXN7B qt0EjydzzJOL7SWD/VN1jfXDpBmdmRRPwzFTLp107EAsU2ExQ5KZQ+JKZ5hrGUB2e4ul 7EdoSPriJUxlvLjYRJrtOoNuUjhC9EFZrvoMqLYus4Hd3dgNrQ4BlJPgVT1UW742HKkg Vw== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3n3spx6vk9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 18 Jan 2023 10:05:00 -0600 Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.21; Wed, 18 Jan 2023 10:04:57 -0600 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.7 via Frontend Transport; Wed, 18 Jan 2023 10:04:57 -0600 Received: from sbinding-cirrus-dsktp2.ad.cirrus.com (unknown [198.90.202.160]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 0BA1EB12; Wed, 18 Jan 2023 16:04:57 +0000 (UTC) From: Stefan Binding To: Mark Brown , Pierre-Louis Bossart CC: , , , Stefan Binding Subject: [PATCH v2 1/8] soundwire: stream: Add specific prep/deprep commands to port_prep callback Date: Wed, 18 Jan 2023 16:04:45 +0000 Message-ID: <20230118160452.2385494-2-sbinding@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230118160452.2385494-1-sbinding@opensource.cirrus.com> References: <20230118160452.2385494-1-sbinding@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: -czQAVRU0DdhMIyzE7Xe7chznsaOXhYp X-Proofpoint-ORIG-GUID: -czQAVRU0DdhMIyzE7Xe7chznsaOXhYp X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS 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?1755377424016368045?= X-GMAIL-MSGID: =?utf-8?q?1755377424016368045?= Currently, port_prep callback only has commands for PRE_PREP, PREP, and POST_PREP, which doesn't directly say whether this is for a prepare or deprepare call. Extend the command list enum to say whether the call is for prepare or deprepare aswell. Also remove SDW_OPS_PORT_PREP from sdw_port_prep_ops as this is unused, and update this enum to be simpler and more consistent with enum sdw_clk_stop_type. Note: Currently, the only users of SDW_OPS_PORT_POST_PREP are codec drivers sound/soc/codecs/wsa881x.c and sound/soc/codecs/wsa883x.c, both of which seem to assume that POST_PREP only occurs after a prepare, even though it would also have occurred after a deprepare. Since it doesn't make sense to mark the port prepared after a deprepare, changing the enum to separate PORT_DEPREP from PORT_PREP should make the check for PORT_PREP in those drivers be more logical. Signed-off-by: Stefan Binding Reviewed-by: Pierre-Louis Bossart --- drivers/soundwire/stream.c | 4 ++-- include/linux/soundwire/sdw.h | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index df3b36670df4c..1652fb5737d9d 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -469,7 +469,7 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus, } /* Inform slave about the impending port prepare */ - sdw_do_port_prep(s_rt, prep_ch, SDW_OPS_PORT_PRE_PREP); + sdw_do_port_prep(s_rt, prep_ch, prep ? SDW_OPS_PORT_PRE_PREP : SDW_OPS_PORT_PRE_DEPREP); /* Prepare Slave port implementing CP_SM */ if (!dpn_prop->simple_ch_prep_sm) { @@ -501,7 +501,7 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus, } /* Inform slaves about ports prepared */ - sdw_do_port_prep(s_rt, prep_ch, SDW_OPS_PORT_POST_PREP); + sdw_do_port_prep(s_rt, prep_ch, prep ? SDW_OPS_PORT_POST_PREP : SDW_OPS_PORT_POST_DEPREP); /* Disable interrupt after Port de-prepare */ if (!prep && intr) diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 3cd2a761911ff..547fc1b30a51a 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -569,13 +569,15 @@ struct sdw_prepare_ch { * enum sdw_port_prep_ops: Prepare operations for Data Port * * @SDW_OPS_PORT_PRE_PREP: Pre prepare operation for the Port - * @SDW_OPS_PORT_PREP: Prepare operation for the Port + * @SDW_OPS_PORT_PRE_DEPREP: Pre deprepare operation for the Port * @SDW_OPS_PORT_POST_PREP: Post prepare operation for the Port + * @SDW_OPS_PORT_POST_DEPREP: Post deprepare operation for the Port */ enum sdw_port_prep_ops { SDW_OPS_PORT_PRE_PREP = 0, - SDW_OPS_PORT_PREP = 1, - SDW_OPS_PORT_POST_PREP = 2, + SDW_OPS_PORT_PRE_DEPREP, + SDW_OPS_PORT_POST_PREP, + SDW_OPS_PORT_POST_DEPREP, }; /**