From patchwork Mon Nov 14 10:29:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 19665 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2073343wru; Mon, 14 Nov 2022 02:38:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Ui33m81Z/kD2KmIg7vzQ8RlzPX9hqgp8UtY72S5bAVgMiVdmzyAcpSAMo/ZHYRqUkz+dx X-Received: by 2002:a17:902:f643:b0:186:8bd9:eca3 with SMTP id m3-20020a170902f64300b001868bd9eca3mr13371965plg.0.1668422314555; Mon, 14 Nov 2022 02:38:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668422314; cv=none; d=google.com; s=arc-20160816; b=TYoKZ+0rC9/3US9CR/C/felOhJ/qadJyWppOWtnTxy3Qj6enb475pMuB4UbnQE6QcT QzxNkMUlmhSKrtj81a+jVvcgn2P5xgLWa5VJb9EAa/Y2uzanSy9JfZMXOHsdGM+6hyCy yNKt/5Fot9ia5ROhssouvXkyJVlnXaxjvPxrQpbIu7fIrxkx9nJZQcuM6Tn6u8KWMQDH XYWvBV459y2jySRn5WKh4Nx5YViGGuaBNqn6rc5aFdeKGiFXRbKiJ6LCxeg+MWE/iGVS ifTb6efd3oANAn+CKqc5bIMILs4mDVKihPeqrRkzB5X/3Li5e1DbGEAQNKWRVF/T06Aq IEYg== 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=b32hXKJIPViLBZgGML5MZnvwImfcHKYM9AxZYNqCqcU=; b=dDah1F7CVNdnTOqfkLgasCCPIUsvFI8gbFS05+kzrplzJHH98JO2f7JEirkWWRNWCi cIfTfQwG9FwDcHf/Doz8aWVwJdKEObLrjyJLFY50XC/IBWs1mlx2kQQS3fLiuLoneoO/ RzgUBg+KkdPAa1XO1/2kamxgdkWuK0TLCPJXrNzS5iau6LsUQr6YCkcClMBy56kgSeck 0eJ6iZr4XPwUfWxsGs89vEoVJYGjqEOZwQEkrVy5c/FSv7AzBaXz32ee0NIcVVslJSnl K4874VEX1/yOW3WUFTOUuZD2WTMa+Q0WiMZuYFytxtIrkpCRL5s5GmdoYjYQ2Itiyp/b aNeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=lilYEVsp; 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 k25-20020a634b59000000b0046fe64444fcsi9706118pgl.839.2022.11.14.02.38.21; Mon, 14 Nov 2022 02:38:34 -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=lilYEVsp; 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 S236331AbiKNKaQ (ORCPT + 99 others); Mon, 14 Nov 2022 05:30:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236266AbiKNKaP (ORCPT ); Mon, 14 Nov 2022 05:30:15 -0500 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02F7EF031 for ; Mon, 14 Nov 2022 02:30:12 -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 2AE8Wcid019990; Mon, 14 Nov 2022 04:29:58 -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=b32hXKJIPViLBZgGML5MZnvwImfcHKYM9AxZYNqCqcU=; b=lilYEVspR3Y1LPIAlWCyuDL9Vf4FyJG35akAtKOVIugLcmG7TsQ2mbSfT2gYrV1j8Aj/ C884tpvrx/UrX/6xqyGXd+NIGm5WFAkjnQwdRqxCMbitngSWLosuIR7kcxijG5dU2aBz kjVteywMtIGkxErwZVUBLOut+w+l8N+5lDb/p5eoU5SJoE0QHIvFIi2Oa7uX90jbF0gM j17w9tI8siDlNG0Vzue231NPkxA4Mu1JFxWiDwngyVbGDOMYxO7gEGKUktTmiB9QUyit f2hTS2RRBGWk1Tmp0tPdPVZRy0yfuObBF6RnR8USR/uTSXkx2mp1PUh+HJiXaRCax0RG ww== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3kt8sst0cm-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Nov 2022 04:29:58 -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.15; Mon, 14 Nov 2022 04:29:56 -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.15 via Frontend Transport; Mon, 14 Nov 2022 04:29:56 -0600 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 56BB3B12; Mon, 14 Nov 2022 10:29:56 +0000 (UTC) From: Charles Keepax To: CC: , , , , , Subject: [PATCH 2/4] soundwire: Provide build stubs for common functions Date: Mon, 14 Nov 2022 10:29:54 +0000 Message-ID: <20221114102956.914468-3-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221114102956.914468-1-ckeepax@opensource.cirrus.com> References: <20221114102956.914468-1-ckeepax@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: iMsjegMcVmelEZf2jHDKFBECtcuZu3N2 X-Proofpoint-ORIG-GUID: iMsjegMcVmelEZf2jHDKFBECtcuZu3N2 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?1749467597205041680?= X-GMAIL-MSGID: =?utf-8?q?1749467597205041680?= Provide stub functions when CONFIG_SOUNDWIRE is not set for functions that are quite likely to be used from common code on devices supporting multiple control buses. Signed-off-by: Charles Keepax Reviewed-by: Pierre-Louis Bossart --- include/linux/soundwire/sdw.h | 92 +++++++++++++++++++++++++++++++---- 1 file changed, 82 insertions(+), 10 deletions(-) diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 902ed46f76c80..4f80cba898f11 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -1021,15 +1021,8 @@ int sdw_stream_add_master(struct sdw_bus *bus, struct sdw_port_config *port_config, unsigned int num_ports, struct sdw_stream_runtime *stream); -int sdw_stream_add_slave(struct sdw_slave *slave, - struct sdw_stream_config *stream_config, - struct sdw_port_config *port_config, - unsigned int num_ports, - struct sdw_stream_runtime *stream); int sdw_stream_remove_master(struct sdw_bus *bus, struct sdw_stream_runtime *stream); -int sdw_stream_remove_slave(struct sdw_slave *slave, - struct sdw_stream_runtime *stream); int sdw_startup_stream(void *sdw_substream); int sdw_prepare_stream(struct sdw_stream_runtime *stream); int sdw_enable_stream(struct sdw_stream_runtime *stream); @@ -1040,8 +1033,20 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus); int sdw_bus_clk_stop(struct sdw_bus *bus); int sdw_bus_exit_clk_stop(struct sdw_bus *bus); -/* messaging and data APIs */ +int sdw_compare_devid(struct sdw_slave *slave, struct sdw_slave_id id); +void sdw_extract_slave_id(struct sdw_bus *bus, u64 addr, struct sdw_slave_id *id); + +#if IS_ENABLED(CONFIG_SOUNDWIRE) +int sdw_stream_add_slave(struct sdw_slave *slave, + struct sdw_stream_config *stream_config, + struct sdw_port_config *port_config, + unsigned int num_ports, + struct sdw_stream_runtime *stream); +int sdw_stream_remove_slave(struct sdw_slave *slave, + struct sdw_stream_runtime *stream); + +/* messaging and data APIs */ int sdw_read(struct sdw_slave *slave, u32 addr); int sdw_write(struct sdw_slave *slave, u32 addr, u8 value); int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value); @@ -1053,7 +1058,74 @@ int sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, const u8 * int sdw_update(struct sdw_slave *slave, u32 addr, u8 mask, u8 val); int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val); -int sdw_compare_devid(struct sdw_slave *slave, struct sdw_slave_id id); -void sdw_extract_slave_id(struct sdw_bus *bus, u64 addr, struct sdw_slave_id *id); +#else + +static inline int sdw_stream_add_slave(struct sdw_slave *slave, + struct sdw_stream_config *stream_config, + struct sdw_port_config *port_config, + unsigned int num_ports, + struct sdw_stream_runtime *stream) +{ + return 0; +} + +static inline int sdw_stream_remove_slave(struct sdw_slave *slave, + struct sdw_stream_runtime *stream) +{ + return 0; +} + +/* messaging and data APIs */ +static inline int sdw_read(struct sdw_slave *slave, u32 addr) +{ + return 0; +} + +static inline int sdw_write(struct sdw_slave *slave, u32 addr, u8 value) +{ + return 0; +} + +static inline int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value) +{ + return 0; +} + +static inline int sdw_read_no_pm(struct sdw_slave *slave, u32 addr) +{ + return 0; +} + +static inline int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val) +{ + return 0; +} + +static inline int sdw_nread_no_pm(struct sdw_slave *slave, u32 addr, size_t count, u8 *val) +{ + return 0; +} + +static inline int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val) +{ + return 0; +} + +static inline int sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val) +{ + return 0; +} + +static inline int sdw_update(struct sdw_slave *slave, u32 addr, u8 mask, u8 val) +{ + return 0; +} + +static inline int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val) +{ + return 0; +} + +#endif /* CONFIG_SOUNDWIRE */ #endif /* __SOUNDWIRE_H */