Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1343548rdh; Mon, 25 Sep 2023 09:45:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0wdgwJpNtKplP+EQMPGODSTn4a7nGXhTSH78nDaUb1k2I7c6/AB8yniEpLNn5WypvSoBp X-Received: by 2002:a17:902:ce87:b0:1c1:ee23:bb75 with SMTP id f7-20020a170902ce8700b001c1ee23bb75mr8621906plg.1.1695660333257; Mon, 25 Sep 2023 09:45:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695660333; cv=none; d=google.com; s=arc-20160816; b=Xs5eJhk7PZ7oxxRg2YLuxgqZQurV/bt9Lt1E7WwU5sBAE8jhX7LMo2FIUpqGp4GnSn ULSZ0u5wPnMhqNE23JXbsoWujbt7D/dyGID/SqgQBEUv0uUmchVeiZrhYFBZYgPCbqEy gvCd5sRpp06dW3BDPjYyeooH+Sx6t6AqVqTu02rq44pUbkUdr0IbTCRhMFOkonipZ7or KeVoPw/yjOOOxHU+dc7R44Q6lk6LxSBsXFAlWnvxec+exRILATNPTMLnv1V4BZzTGMuZ c3YZrR8R4LCMX+1CkJPZ87C00aSYpOOqQfFt/9i3lRcEFe1TE5+uaTq2SZ2Cdz+reMnM KlNw== 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=5ULa3MlvTg8hdkVamNSIOKh6gGISQMp+o/MnpLuMkMw=; fh=11LKKpIlt6rtONTt+h6X+e6wp8mj+pGxb3/fOJjZKK8=; b=ND0Sj+/Ao5RcdA5y8YnQX4m5AEGOdZdwR/i60QeYD9ICoju0lL51pWKDDnhgnW0ppV bOD8qy/Iw+tuK/Ws+vr1189091PlgrAgm6LFoY1IcI/WCRtQ9ns6HqLtb604A5Xj/yjf aq9XhZFzOB6AjC/Pi5Pn1JmtWKo11rC9IlYA7G0goIQy83ZkRMvD9YbVABKWz5SS5QdG +jlSAIPkx2tRVu5FRqWyBP/jTl2FDGIKAl54a7cp/hSy9da7BWz5UuSgPfs6l9IKT8iO O1lC8rTtYNk9sJxDnjM/Ld8QWZ7ldQMktnUaV5UNW1x79M/tkag1eyEjQMUK4e0p4N0X OddA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jvgf32aO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id kg3-20020a170903060300b001bf0e15c0a9si9816777plb.269.2023.09.25.09.45.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 09:45:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jvgf32aO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 018DF802572C; Mon, 25 Sep 2023 08:42:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232958AbjIYPly (ORCPT + 99 others); Mon, 25 Sep 2023 11:41:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232931AbjIYPl3 (ORCPT ); Mon, 25 Sep 2023 11:41:29 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB6CB1B5 for ; Mon, 25 Sep 2023 08:41:18 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-405417465aaso55420215e9.1 for ; Mon, 25 Sep 2023 08:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656477; x=1696261277; 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=5ULa3MlvTg8hdkVamNSIOKh6gGISQMp+o/MnpLuMkMw=; b=Jvgf32aOulSysep/r2PHBiTBZdzYWRtf4K6wg4FZgROpmxdftdMCKf94lamDtcClzp 2Ir/1RJ+EGwrzudCUpJ31V2eI9zwkhYH8htAOU/fluIvRAUJ8ZjzEKdLl1zmyCG0o6RS Tpuk0OofYBaKTJXBNYIe1C2VcDTP7iUDR8UqHIAsxMnovc6Zpak82sd5jPu8EWS0/6e0 q52W9eVrT/uxRJURvueaDUuLt3m9I/0NzBhBv1tp0zirBvNMZtFrXj6TVFujwb7i8SDa m2dAwXf9DgAXOwpAfGAHu7FTJowSPQKVneG/bDGwpVkAjRf/YXbKFfO7LxNW4YNGpndF LTkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656477; x=1696261277; 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=5ULa3MlvTg8hdkVamNSIOKh6gGISQMp+o/MnpLuMkMw=; b=UCFTHk2KmTefMIJCe7EvNO0NJA31by8XebHirnQiEfzk+IKmFlWuOQDakusb60zAe3 kaWTSIigyyW+NKZvddSQt1e4IUWeTZ9lpce+tR2aG/xe0To0L22PWeocMs40b8p4ff8k OFH70dMBjh3sgGQulFqvUlubs2Ntr7reql+zerhQ5G7NGc2pdzvnys7h+CELz22hLZKb WWOqKEC9y1zM77WQuaxsgwfWfABQon6TpEXmRdgi+7ln1OuxQVo+qfAbej6B9S6Passg Ke4iFOEQFThdBVkbNWRgOWmfV4GEJiOoRHcb8/nc/PgAwM2H0a5ndfrKSHCs8SKO5eh3 3nfg== X-Gm-Message-State: AOJu0Yw5NpdKmukAzFnHNuqPvZoSVpXh/Wl8dBeJ5j4WBf2mt6fbRXua UwRv5sF7qj2Ql7XiqVtVjZuvig== X-Received: by 2002:a7b:ca56:0:b0:3fb:df34:176e with SMTP id m22-20020a7bca56000000b003fbdf34176emr5970660wml.31.1695656477042; Mon, 25 Sep 2023 08:41:17 -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 m15-20020a7bca4f000000b003fe4548188bsm15206155wml.48.2023.09.25.08.41.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:41:16 -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, robert.foss@linaro.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: [PATCH v6 11/17] media: qcom: camss: Allow clocks vfeN vfe_liteN or vfe_lite Date: Mon, 25 Sep 2023 16:40:53 +0100 Message-ID: <20230925154059.837152-12-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230925154059.837152-1-bryan.odonoghue@linaro.org> References: <20230925154059.837152-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 25 Sep 2023 08:42:02 -0700 (PDT) The number of Video Front End - VFE or Image Front End - IFE supported with new SoCs can vary both for the full and lite cases. For example sdm845 has one vfe_lite and two vfe interfaces with the vfe clock called simply "vfe_lite" with no integer postfix. sc8280xp has four vfe and four vfe lite blocks. At the moment we declare vfe_lite0 and vfe_lite1 for sm8250 but never set those clocks because we don't match the strings. We need to support the following clock name formats - vfeN - vfe_liteN - vfe_lite with N being any reasonably sized integer. There are two sites in this code which need to do the same thing, constructing and matching strings with the pattern above, so encapsulate the logic in one function. Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-vfe.c | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index db8f68819ded9..4db0d0a1c6a51 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -431,6 +431,20 @@ void vfe_isr_reset_ack(struct vfe_device *vfe) complete(&vfe->reset_complete); } +static int vfe_match_clock_names(struct vfe_device *vfe, + struct camss_clock *clock) +{ + char vfe_name[7]; /* vfeXXX\0 */ + char vfe_lite_name[12]; /* vfe_liteXXX\0 */ + + snprintf(vfe_name, sizeof(vfe_name), "vfe%d", vfe->id); + snprintf(vfe_lite_name, sizeof(vfe_lite_name), "vfe_lite%d", vfe->id); + + return (!strcmp(clock->name, vfe_name) || + !strcmp(clock->name, vfe_lite_name) || + !strcmp(clock->name, "vfe_lite")); +} + /* * vfe_set_clock_rates - Calculate and set clock rates on VFE module * @vfe: VFE device @@ -454,9 +468,7 @@ static int vfe_set_clock_rates(struct vfe_device *vfe) for (i = 0; i < vfe->nclocks; i++) { struct camss_clock *clock = &vfe->clock[i]; - if (!strcmp(clock->name, "vfe0") || - !strcmp(clock->name, "vfe1") || - !strcmp(clock->name, "vfe_lite")) { + if (vfe_match_clock_names(vfe, clock)) { u64 min_rate = 0; long rate; @@ -537,9 +549,7 @@ static int vfe_check_clock_rates(struct vfe_device *vfe) for (i = 0; i < vfe->nclocks; i++) { struct camss_clock *clock = &vfe->clock[i]; - if (!strcmp(clock->name, "vfe0") || - !strcmp(clock->name, "vfe1") || - !strcmp(clock->name, "vfe_lite")) { + if (vfe_match_clock_names(vfe, clock)) { u64 min_rate = 0; unsigned long rate; -- 2.42.0