Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1313082rdh; Mon, 25 Sep 2023 09:00:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGlKlpYfFwr9Yu+M1mQo5OFB//ZjQNibfugB/2USn3BFP2BbbQEcIlEDzrvNLL2BVAFFeN X-Received: by 2002:a17:902:c951:b0:1c3:a91a:627f with SMTP id i17-20020a170902c95100b001c3a91a627fmr8629698pla.47.1695657608865; Mon, 25 Sep 2023 09:00:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695657608; cv=none; d=google.com; s=arc-20160816; b=CdJQ5uo9c5QKkC8PpkxCBFbYvVdQGjrHj7dkKd7skkxBUzfjG2h0br7OD0gqSzEMSs Ak8/FBYGW0Ep/mkTqZ5SA4GWVbbmuqJ4IFWan+QE9GQb4ybg439LfoAGrdf0l11ER0V8 ycPTtMuBdfbR/PDNrmA0o+gKmtPmbgMurC3b5s/IHkGlesF7NkBM6VEmfUMpU1vReExN UGoTLi71+ZHJfn/+2IGv2bfPckoMVPRLzfPKJLiYCk3U5iN1SuFv83I7jRLTtqC+Z59n X//9uV81+6b+e2GaHSGK3aLxsUNYaBIuySzFooVhFK32iNT+hCqLVWxSa3vYyIWyfvnQ nQIg== 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=Wmbicm6J4n1g5d7DX/duVuL47dLgNvi79FpU0w8H5SU=; fh=YrDxnoZE2zu1w4A5O/pMyb6W2NB5EAkKDOR3m7KPwy0=; b=LdJFwO+AEndQlytDyBgTLmtpfFfozGnui9h5srqD7du+Uvs6mBFO98gQgg9USiBqWQ njRflqyONyLFUUyxhGIC816/43IGT1CdRPayg2cfoulk2KLzLmI2x2DZTIJerWF82QQZ rUb7vldZm/tty7Z8+YWcoAFSwIlZm9LYNx4ve3ODdbhhTAht2MUmcsCwLg1HkFnI66Cg 0zZa/RN6MXsPwKQm6Fznnx6W6l4vGmJHVjzWXH26537UYl/YZKdN06xha47caMxmOJhe Zq9qRC5ac1YddtKV3hLIuw+yMQCqzEZteSUog8FCeEJknJ/Ul5Cclvt/3k5R1ZlvVfrT C6/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pu+3vg3K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id b14-20020a170902650e00b001c61bd7cee0si2412842plk.211.2023.09.25.08.59.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 09:00:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pu+3vg3K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id F2A4181CB0D9; Mon, 25 Sep 2023 08:48:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233327AbjIYPsS (ORCPT + 99 others); Mon, 25 Sep 2023 11:48:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233098AbjIYPri (ORCPT ); Mon, 25 Sep 2023 11:47:38 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C0B8139 for ; Mon, 25 Sep 2023 08:47:29 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-405505b07dfso27159425e9.0 for ; Mon, 25 Sep 2023 08:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656847; x=1696261647; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Wmbicm6J4n1g5d7DX/duVuL47dLgNvi79FpU0w8H5SU=; b=pu+3vg3KmMC1BDJOrQKyPoAD0WWHEQqu1REzRuIPic/VwYowaq8Q0vWFCrXNNv39E6 VVlc/P14P1xaRYa21yWGDVgnheaQfNAK0tAL8PKeQ+jBgmN6wLJPuNfMEC0RvNHUwpm9 2FAyWPS2NaIW0B81e0na/VOxgz+hjcJXwvviImWJe0rgGVZkl9XaCSnNwYvMVibJ8KbF PXv8uKgVpmyXuh5gWvfR1ryowplHGvNprxpopVcPgAaRWSsvFEjhXoCA3K7zGOCZV2V2 D5jtKMpWCFhfFtvEs9MKsPKA774EAsq5y892bhQaaF5StJMgGfjG3g0SkBH9l7UgZS6D ODbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656847; x=1696261647; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Wmbicm6J4n1g5d7DX/duVuL47dLgNvi79FpU0w8H5SU=; b=Js9osI8fs+Zhkmjz8MdOBUQObZBBzwrlOgRFMSav+J5OHBr0hO4Bq6FOAzJklQMrFe Arqr635RqA5ytDnunmdO1iOoInj0c+HDpnX1NZUknPi1J898RsHYpYgUuccizqbKLnp8 7DweXWb41OkuNZJsFbmf1K6xtTa7rsuLHsLvX/iNyCU5+QAm51rLK5ozc0zuwAxFBQAw IzYG8UGS2JIA69O2sG0Rcf50N38UkIEmoTEdp5Nj7TigcKmG4fR8vcgBdapJbmtbORhF oUD2OFvM5At/jaH1SuCONJSxRO19h879fPXiZxoe+QAzu6xx8OzLerjPxpWXkRO97A+c SJjA== X-Gm-Message-State: AOJu0Yypb8vXY1yx+eZ4habKtIxS3pby4q8gnZ6NhDNOBXIa2aCQgP4b Kj08UqhylDu2zGt3K0BapRBDNg== X-Received: by 2002:a05:600c:2249:b0:402:e68f:8a4f with SMTP id a9-20020a05600c224900b00402e68f8a4fmr82970wmm.0.1695656847565; Mon, 25 Sep 2023 08:47:27 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id d4-20020adffd84000000b0031f34a395e7sm12077536wrr.45.2023.09.25.08.47.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:27 -0700 (PDT) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, rfoss@kernel.org, todor.too@gmail.com, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, mchehab@kernel.org, sakari.ailus@linux.intel.com, andrey.konovalov@linaro.org Cc: linux-kernel@vger.kernel.org, Bryan O'Donoghue Subject: [RESEND PATCH v6 15/17] media: qcom: camss: Move vfe_disable into a common routine where applicable Date: Mon, 25 Sep 2023 16:47:05 +0100 Message-ID: <20230925154707.837542-16-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230925154707.837542-1-bryan.odonoghue@linaro.org> References: <20230925154707.837542-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 25 Sep 2023 08:48:58 -0700 (PDT) We can move vfe_disable() into a common routine in the core VFE file provided we make wm_stop() a VFE specific callback. The callback is required to capture the case where VFE 17x currently isn't VC enabled where as VFE 480 is. Suggested-by: Laurent Pinchart Signed-off-by: Bryan O'Donoghue --- .../media/platform/qcom/camss/camss-vfe-170.c | 40 +------------------ .../media/platform/qcom/camss/camss-vfe-480.c | 40 +------------------ drivers/media/platform/qcom/camss/camss-vfe.c | 39 ++++++++++++++++++ drivers/media/platform/qcom/camss/camss-vfe.h | 9 +++++ 4 files changed, 50 insertions(+), 78 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/media/platform/qcom/camss/camss-vfe-170.c index a5aa799501861..0b211fed12760 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-170.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c @@ -494,22 +494,6 @@ static int vfe_enable_output(struct vfe_line *line) return 0; } -static void vfe_disable_output(struct vfe_line *line) -{ - struct vfe_device *vfe = to_vfe(line); - struct vfe_output *output = &line->output; - unsigned long flags; - unsigned int i; - - spin_lock_irqsave(&vfe->output_lock, flags); - for (i = 0; i < output->wm_num; i++) - vfe_wm_stop(vfe, output->wm_idx[i]); - output->gen2.active_num = 0; - spin_unlock_irqrestore(&vfe->output_lock, flags); - - vfe_reset(vfe); -} - /* * vfe_enable - Enable streaming on VFE line * @line: VFE line @@ -555,29 +539,6 @@ static int vfe_enable(struct vfe_line *line) return ret; } -/* - * vfe_disable - Disable streaming on VFE line - * @line: VFE line - * - * Return 0 on success or a negative error code otherwise - */ -static int vfe_disable(struct vfe_line *line) -{ - struct vfe_device *vfe = to_vfe(line); - - vfe_disable_output(line); - - vfe_put_output(line); - - mutex_lock(&vfe->stream_lock); - - vfe->stream_count--; - - mutex_unlock(&vfe->stream_lock); - - return 0; -} - /* * vfe_isr_sof - Process start of frame interrupt * @vfe: VFE Device @@ -770,4 +731,5 @@ const struct vfe_hw_ops vfe_ops_170 = { .vfe_enable = vfe_enable, .vfe_halt = vfe_halt, .violation_read = vfe_violation_read, + .vfe_wm_stop = vfe_wm_stop, }; diff --git a/drivers/media/platform/qcom/camss/camss-vfe-480.c b/drivers/media/platform/qcom/camss/camss-vfe-480.c index 43a2964121f22..f2368b77fc6d6 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-480.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-480.c @@ -327,22 +327,6 @@ static int vfe_enable_output(struct vfe_line *line) return 0; } -static void vfe_disable_output(struct vfe_line *line) -{ - struct vfe_device *vfe = to_vfe(line); - struct vfe_output *output = &line->output; - unsigned long flags; - unsigned int i; - - spin_lock_irqsave(&vfe->output_lock, flags); - for (i = 0; i < output->wm_num; i++) - vfe_wm_stop(vfe, output->wm_idx[i]); - output->gen2.active_num = 0; - spin_unlock_irqrestore(&vfe->output_lock, flags); - - vfe_reset(vfe); -} - /* * vfe_enable - Enable streaming on VFE line * @line: VFE line @@ -390,29 +374,6 @@ static int vfe_enable(struct vfe_line *line) return ret; } -/* - * vfe_disable - Disable streaming on VFE line - * @line: VFE line - * - * Return 0 on success or a negative error code otherwise - */ -static int vfe_disable(struct vfe_line *line) -{ - struct vfe_device *vfe = to_vfe(line); - - vfe_disable_output(line); - - vfe_put_output(line); - - mutex_lock(&vfe->stream_lock); - - vfe->stream_count--; - - mutex_unlock(&vfe->stream_lock); - - return 0; -} - /* * vfe_isr_reg_update - Process reg update interrupt * @vfe: VFE Device @@ -581,4 +542,5 @@ const struct vfe_hw_ops vfe_ops_480 = { .vfe_disable = vfe_disable, .vfe_enable = vfe_enable, .vfe_halt = vfe_halt, + .vfe_wm_stop = vfe_wm_stop, }; diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index 4db0d0a1c6a51..b3d5af7f09690 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -410,6 +410,45 @@ int vfe_put_output(struct vfe_line *line) return 0; } +static int vfe_disable_output(struct vfe_line *line) +{ + struct vfe_device *vfe = to_vfe(line); + struct vfe_output *output = &line->output; + unsigned long flags; + unsigned int i; + + spin_lock_irqsave(&vfe->output_lock, flags); + for (i = 0; i < output->wm_num; i++) + vfe->ops->vfe_wm_stop(vfe, output->wm_idx[i]); + output->gen2.active_num = 0; + spin_unlock_irqrestore(&vfe->output_lock, flags); + + return vfe_reset(vfe); +} + +/* + * vfe_disable - Disable streaming on VFE line + * @line: VFE line + * + * Return 0 on success or a negative error code otherwise + */ +int vfe_disable(struct vfe_line *line) +{ + struct vfe_device *vfe = to_vfe(line); + + vfe_disable_output(line); + + vfe_put_output(line); + + mutex_lock(&vfe->stream_lock); + + vfe->stream_count--; + + mutex_unlock(&vfe->stream_lock); + + return 0; +} + /** * vfe_isr_comp_done() - Process composite image done interrupt * @vfe: VFE Device diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/platform/qcom/camss/camss-vfe.h index 4783afa73a365..09baded0dcdd6 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.h +++ b/drivers/media/platform/qcom/camss/camss-vfe.h @@ -114,6 +114,7 @@ struct vfe_hw_ops { int (*vfe_enable)(struct vfe_line *line); int (*vfe_halt)(struct vfe_device *vfe); void (*violation_read)(struct vfe_device *vfe); + void (*vfe_wm_stop)(struct vfe_device *vfe, u8 wm); }; struct vfe_isr_ops { @@ -192,6 +193,14 @@ int vfe_reserve_wm(struct vfe_device *vfe, enum vfe_line_id line_id); */ int vfe_reset(struct vfe_device *vfe); +/* + * vfe_disable - Disable streaming on VFE line + * @line: VFE line + * + * Return 0 on success or a negative error code otherwise + */ +int vfe_disable(struct vfe_line *line); + extern const struct vfe_hw_ops vfe_ops_4_1; extern const struct vfe_hw_ops vfe_ops_4_7; extern const struct vfe_hw_ops vfe_ops_4_8; -- 2.42.0