From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50FBDCE7A95 for ; Mon, 25 Sep 2023 15:47:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231790AbjIYPrW (ORCPT ); Mon, 25 Sep 2023 11:47:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231226AbjIYPrU (ORCPT ); Mon, 25 Sep 2023 11:47:20 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DB85BC for ; Mon, 25 Sep 2023 08:47:13 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3231d67aff2so3150672f8f.0 for ; Mon, 25 Sep 2023 08:47:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656831; x=1696261631; 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=bEExl+Qnlpbjs/kQF5vqHTfDAzymWTPDJmQL5fGoUhU=; b=OzH9sbAjwvrspYURlHGUKNZaWXaiCuT5Ii4eTET7chaJpi+kMMH0zdqZ9VS8fOA3pX 4nVJ/Hd6DcXIAMeyhalf58ng3Uxxn5O+1KabMIyjP7lE7jvIamKLHTlN9FyBWg6a5CFM L1whhC1vY/khfYIdjH61pSQZmMdWHnCBA7spCi6W7pB58gOZql93NRoUxJ7JTVtpbqCh VBM2uggVN6oqb2LSVNm875G6axQO4k6zi5u0NV6n+CMBewUVzevulJw/c1THZmQr7rGg lL8W5EnugbdCjKLetBQUvPUMPJy/QbAYr3F04Zlv6RsW5XpDXWSz8nbjD3ASoBwcx7ME mgmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656831; x=1696261631; 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=bEExl+Qnlpbjs/kQF5vqHTfDAzymWTPDJmQL5fGoUhU=; b=AbyaVtCMyQrMZdQOK4gawdnZCBghgYpYcirwR4iGfG2YdWHjiQLTo0wDtbh80UX3hF G25o8NKiyxa8qPmJXN/9uBYUWUHkF1oR3ODHIWpta7AZjWOWDkvHnOmzgb6R6ny+WzAm yWf98EwZx8FC2iZ5RdDm2tqlGEHgboUoRf0YRvmV0AzVL3xX1oX1DtSg+JZTs3IxQmiV 9MkkvXB0JhyQAXlsXqLHtm/WPZAu9CNRLEmtMM1QJRTglfLv5jj+E2Smnm4cgP++/jhX KzqydcP77zRA3TG6EjfNFdbExkIygf+pxWReR8BvRPo8/J4mepfIeXU7jUOoCTkYFW8G sLIw== X-Gm-Message-State: AOJu0YwrUkNQ7OfeVip5X7RLAlDP+R9g/AXtnBOUzZuODgBI8AOAh4K1 APZaAeDzwaamPd6+ckwkMPcu0A== X-Google-Smtp-Source: AGHT+IGQwR420EBz8gUib4vwFl7WdH5Kgm0Bu9eFHN1pPqVWcW6Sa7QkFWlMN7YlPd5yOLAq4/4JFA== X-Received: by 2002:adf:fb51:0:b0:31f:e980:cd88 with SMTP id c17-20020adffb51000000b0031fe980cd88mr5610836wrs.61.1695656831560; Mon, 25 Sep 2023 08:47:11 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:11 -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 01/17] media: qcom: camss: Amalgamate struct resource with struct resource_ispif Date: Mon, 25 Sep 2023 16:46:51 +0100 Message-ID: <20230925154707.837542-2-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There is no good reason to differentiate the two resource structures here. As part of a general tidyup of the declaration and passing of resources within in the CAMSS driver it will be advantageous to have one unified resource structure. The two structures are very similar anyway thus leading more credence still to the argument there should be only one. Signed-off-by: Bryan O'Donoghue Acked-by: Konrad Dybcio Reviewed-by: Laurent Pinchart --- drivers/media/platform/qcom/camss/camss-ispif.c | 4 ++-- drivers/media/platform/qcom/camss/camss-ispif.h | 4 ++-- drivers/media/platform/qcom/camss/camss.c | 14 +++++++------- drivers/media/platform/qcom/camss/camss.h | 8 +------- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/medi= a/platform/qcom/camss/camss-ispif.c index 1c7e4b1b49401..61765b874b9a2 100644 --- a/drivers/media/platform/qcom/camss/camss-ispif.c +++ b/drivers/media/platform/qcom/camss/camss-ispif.c @@ -1095,7 +1095,7 @@ static int ispif_init_formats(struct v4l2_subdev *sd,= struct v4l2_subdev_fh *fh) * Return 0 on success or a negative error code otherwise */ int msm_ispif_subdev_init(struct camss *camss, - const struct resources_ispif *res) + const struct resources *res) { struct device *dev =3D camss->dev; struct ispif_device *ispif =3D camss->ispif; @@ -1152,7 +1152,7 @@ int msm_ispif_subdev_init(struct camss *camss, =20 /* Interrupt */ =20 - ret =3D platform_get_irq_byname(pdev, res->interrupt); + ret =3D platform_get_irq_byname(pdev, res->interrupt[0]); if (ret < 0) return ret; =20 diff --git a/drivers/media/platform/qcom/camss/camss-ispif.h b/drivers/medi= a/platform/qcom/camss/camss-ispif.h index fdf28e68cc7d8..c7c41f7afcaad 100644 --- a/drivers/media/platform/qcom/camss/camss-ispif.h +++ b/drivers/media/platform/qcom/camss/camss-ispif.h @@ -66,10 +66,10 @@ struct ispif_device { struct camss *camss; }; =20 -struct resources_ispif; +struct resources; =20 int msm_ispif_subdev_init(struct camss *camss, - const struct resources_ispif *res); + const struct resources *res); =20 int msm_ispif_register_entities(struct ispif_device *ispif, struct v4l2_device *v4l2_dev); diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index c6df862c79e39..fa0eb30d77c26 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -93,14 +93,14 @@ static const struct resources csid_res_8x16[] =3D { }, }; =20 -static const struct resources_ispif ispif_res_8x16 =3D { +static const struct resources ispif_res_8x16 =3D { /* ISPIF */ .clock =3D { "top_ahb", "ahb", "ispif_ahb", "csi0", "csi0_pix", "csi0_rdi", "csi1", "csi1_pix", "csi1_rdi" }, .clock_for_reset =3D { "vfe0", "csi_vfe0" }, .reg =3D { "ispif", "csi_clk_mux" }, - .interrupt =3D "ispif" + .interrupt =3D { "ispif" } =20 }; =20 @@ -234,7 +234,7 @@ static const struct resources csid_res_8x96[] =3D { } }; =20 -static const struct resources_ispif ispif_res_8x96 =3D { +static const struct resources ispif_res_8x96 =3D { /* ISPIF */ .clock =3D { "top_ahb", "ahb", "ispif_ahb", "csi0", "csi0_pix", "csi0_rdi", @@ -243,7 +243,7 @@ static const struct resources_ispif ispif_res_8x96 =3D { "csi3", "csi3_pix", "csi3_rdi" }, .clock_for_reset =3D { "vfe0", "csi_vfe0", "vfe1", "csi_vfe1" }, .reg =3D { "ispif", "csi_clk_mux" }, - .interrupt =3D "ispif" + .interrupt =3D { "ispif" } }; =20 static const struct resources vfe_res_8x96[] =3D { @@ -410,7 +410,7 @@ static const struct resources csid_res_660[] =3D { } }; =20 -static const struct resources_ispif ispif_res_660 =3D { +static const struct resources ispif_res_660 =3D { /* ISPIF */ .clock =3D { "top_ahb", "ahb", "ispif_ahb", "csi0", "csi0_pix", "csi0_rdi", @@ -419,7 +419,7 @@ static const struct resources_ispif ispif_res_660 =3D { "csi3", "csi3_pix", "csi3_rdi" }, .clock_for_reset =3D { "vfe0", "csi_vfe0", "vfe1", "csi_vfe1" }, .reg =3D { "ispif", "csi_clk_mux" }, - .interrupt =3D "ispif" + .interrupt =3D { "ispif" } }; =20 static const struct resources vfe_res_660[] =3D { @@ -1122,7 +1122,7 @@ static int camss_init_subdevices(struct camss *camss) { const struct resources *csiphy_res; const struct resources *csid_res; - const struct resources_ispif *ispif_res; + const struct resources *ispif_res; const struct resources *vfe_res; unsigned int i; int ret; diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/plat= form/qcom/camss/camss.h index f6c326cb853b8..e95211cdb1fd6 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -44,18 +44,12 @@ struct resources { char *regulators[CAMSS_RES_MAX]; char *clock[CAMSS_RES_MAX]; + char *clock_for_reset[CAMSS_RES_MAX]; u32 clock_rate[CAMSS_RES_MAX][CAMSS_RES_MAX]; char *reg[CAMSS_RES_MAX]; char *interrupt[CAMSS_RES_MAX]; }; =20 -struct resources_ispif { - char *clock[CAMSS_RES_MAX]; - char *clock_for_reset[CAMSS_RES_MAX]; - char *reg[CAMSS_RES_MAX]; - char *interrupt; -}; - struct icc_bw_tbl { u32 avg; u32 peak; --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81CB6CE7A98 for ; Mon, 25 Sep 2023 15:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232910AbjIYPri (ORCPT ); Mon, 25 Sep 2023 11:47:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231779AbjIYPrb (ORCPT ); Mon, 25 Sep 2023 11:47:31 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AB23DF for ; Mon, 25 Sep 2023 08:47:14 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40528376459so67789175e9.3 for ; Mon, 25 Sep 2023 08:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656832; x=1696261632; 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=hWSBg2m/DFeH+pSop6GqXEz6uLfYv88RDnyNFoEgOcM=; b=yOWpqZlAThd5Jfru+nFL0EW0lHhs0Ih98/vZffobpoYaWdUkpmiPJnP5SuwqpCnFr/ KiO1gX/+RnF+YIkX0NlZvfbzs1jrjdSXMi7Yp3JxJpMcCht4TnfcogE8niWZmWJyKGk7 9Zwf+FodjdzWhW/nFAjLs4I3BprDsPeeQ4bdMg87ADZ9x6JK9wXQc9LMnIR5E0JevA8k cl4G6evTIlWUbrEcQvibskDe3ch+xljI99Bgsj1qdnNDJwa4r6wB8/C4kdhSywXiWvvV KJQ5Q9EQvwb2OcqOvUsPzBky7WVRMVWjzLUqNTNoVLeW650/fVT3dDJRQ8SNG9H2+1NT rOjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656832; x=1696261632; 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=hWSBg2m/DFeH+pSop6GqXEz6uLfYv88RDnyNFoEgOcM=; b=adpe7gBBexXasqMCdIh5g8gOqYb3hSs1bShQHbqut2PVL/mzBnlod6aIW/BcTADCHU tAjjc298BkHxXfEUAYNV9Tl4oDDKRy5NvQc/1TUXXmqYQVBXIWHMm24rLvUaTDXMbt6k e2jJUjj1nIthegtrhS8Q4XosnO6wa6eRieD+QbGJpMM+VgTl8AQNrhiYJSQmwOXQFsO3 +obC4N7njkjOpouD5ccHDIa9qQukhqLn1Hjseion46lCLzhGX3hBxb15rfaOsAiJHXKT 6x2eFoBG0to3Asy1f6mcViWqcU0FnqGCJo+q3QeFZdIuLYfspTU1gkbO4Q/bzv7W0DxV FzjA== X-Gm-Message-State: AOJu0YxvdwmhjUL3/fZbpwd9ve1IzBTFSe/ENVX30wtT+Tc4vNH0Yg0U 9M20zGS8b/jUGA0oSl7uUsiGRw== X-Google-Smtp-Source: AGHT+IHwMN0SWzO6w7hbigmCWhHoOMA6PHSnx83sJiMf5wyfXttSN5FK2Pj1DrwqJvYMUzC6Jddjmw== X-Received: by 2002:a05:6000:cf:b0:321:6953:6ae4 with SMTP id q15-20020a05600000cf00b0032169536ae4mr5681029wrx.37.1695656832690; Mon, 25 Sep 2023 08:47:12 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:12 -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 02/17] media: qcom: camss: Rename camss struct resources to camss_subdev_resources Date: Mon, 25 Sep 2023 16:46:52 +0100 Message-ID: <20230925154707.837542-3-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Rename non-specific struct resources {} to struct camss_subdev_resources {} Each logical block in CAMSS has a number of regulators, clocks and resets associated with it. We represent these blocks as v4l subdevices. The name "struct camss_subdev_resources" is a more descriptive and accurate name. Suggested-by: Laurent Pinchart Signed-off-by: Bryan O'Donoghue --- .../media/platform/qcom/camss/camss-csid.c | 2 +- .../media/platform/qcom/camss/camss-csid.h | 4 +- .../media/platform/qcom/camss/camss-csiphy.c | 2 +- .../media/platform/qcom/camss/camss-csiphy.h | 4 +- .../media/platform/qcom/camss/camss-ispif.c | 2 +- .../media/platform/qcom/camss/camss-ispif.h | 4 +- drivers/media/platform/qcom/camss/camss-vfe.c | 2 +- drivers/media/platform/qcom/camss/camss-vfe.h | 4 +- drivers/media/platform/qcom/camss/camss.c | 44 +++++++++---------- drivers/media/platform/qcom/camss/camss.h | 2 +- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media= /platform/qcom/camss/camss-csid.c index 9d7fb1adebb98..b1113decdb305 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -566,7 +566,7 @@ static const struct v4l2_ctrl_ops csid_ctrl_ops =3D { * Return 0 on success or a negative error code otherwise */ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid, - const struct resources *res, u8 id) + const struct camss_subdev_resources *res, u8 id) { struct device *dev =3D camss->dev; struct platform_device *pdev =3D to_platform_device(dev); diff --git a/drivers/media/platform/qcom/camss/camss-csid.h b/drivers/media= /platform/qcom/camss/camss-csid.h index d4b48432a0973..30d94eb2eb041 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.h +++ b/drivers/media/platform/qcom/camss/camss-csid.h @@ -172,7 +172,7 @@ struct csid_device { const struct csid_hw_ops *ops; }; =20 -struct resources; +struct camss_subdev_resources; =20 /* * csid_find_code - Find a format code in an array using array index or fo= rmat code @@ -200,7 +200,7 @@ const struct csid_format *csid_get_fmt_entry(const stru= ct csid_format *formats, u32 code); =20 int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid, - const struct resources *res, u8 id); + const struct camss_subdev_resources *res, u8 id); =20 int msm_csid_register_entity(struct csid_device *csid, struct v4l2_device *v4l2_dev); diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/med= ia/platform/qcom/camss/camss-csiphy.c index c5ae9c61ee0b1..b1b6c4cf18385 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -546,7 +546,7 @@ static int csiphy_init_formats(struct v4l2_subdev *sd, */ int msm_csiphy_subdev_init(struct camss *camss, struct csiphy_device *csiphy, - const struct resources *res, u8 id) + const struct camss_subdev_resources *res, u8 id) { struct device *dev =3D camss->dev; struct platform_device *pdev =3D to_platform_device(dev); diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.h b/drivers/med= ia/platform/qcom/camss/camss-csiphy.h index 1c14947f92d35..c9b7fe82b1f0d 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.h +++ b/drivers/media/platform/qcom/camss/camss-csiphy.h @@ -83,11 +83,11 @@ struct csiphy_device { unsigned int nformats; }; =20 -struct resources; +struct camss_subdev_resources; =20 int msm_csiphy_subdev_init(struct camss *camss, struct csiphy_device *csiphy, - const struct resources *res, u8 id); + const struct camss_subdev_resources *res, u8 id); =20 int msm_csiphy_register_entity(struct csiphy_device *csiphy, struct v4l2_device *v4l2_dev); diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/medi= a/platform/qcom/camss/camss-ispif.c index 61765b874b9a2..75b8a60806b22 100644 --- a/drivers/media/platform/qcom/camss/camss-ispif.c +++ b/drivers/media/platform/qcom/camss/camss-ispif.c @@ -1095,7 +1095,7 @@ static int ispif_init_formats(struct v4l2_subdev *sd,= struct v4l2_subdev_fh *fh) * Return 0 on success or a negative error code otherwise */ int msm_ispif_subdev_init(struct camss *camss, - const struct resources *res) + const struct camss_subdev_resources *res) { struct device *dev =3D camss->dev; struct ispif_device *ispif =3D camss->ispif; diff --git a/drivers/media/platform/qcom/camss/camss-ispif.h b/drivers/medi= a/platform/qcom/camss/camss-ispif.h index c7c41f7afcaad..dff6d5b35c72e 100644 --- a/drivers/media/platform/qcom/camss/camss-ispif.h +++ b/drivers/media/platform/qcom/camss/camss-ispif.h @@ -66,10 +66,10 @@ struct ispif_device { struct camss *camss; }; =20 -struct resources; +struct camss_subdev_resources; =20 int msm_ispif_subdev_init(struct camss *camss, - const struct resources *res); + const struct camss_subdev_resources *res); =20 int msm_ispif_register_entities(struct ispif_device *ispif, struct v4l2_device *v4l2_dev); diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/= platform/qcom/camss/camss-vfe.c index b021f81cef123..e84dcf0f4b2da 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -1279,7 +1279,7 @@ static int vfe_init_formats(struct v4l2_subdev *sd, s= truct v4l2_subdev_fh *fh) * Return 0 on success or a negative error code otherwise */ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, - const struct resources *res, u8 id) + const struct camss_subdev_resources *res, u8 id) { struct device *dev =3D camss->dev; struct platform_device *pdev =3D to_platform_device(dev); diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/= platform/qcom/camss/camss-vfe.h index cbc314c4e244b..b4bae9f65c68f 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.h +++ b/drivers/media/platform/qcom/camss/camss-vfe.h @@ -153,10 +153,10 @@ struct vfe_device { struct camss_video_ops video_ops; }; =20 -struct resources; +struct camss_subdev_resources; =20 int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, - const struct resources *res, u8 id); + const struct camss_subdev_resources *res, u8 id); =20 int msm_vfe_register_entities(struct vfe_device *vfe, struct v4l2_device *v4l2_dev); diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index fa0eb30d77c26..718ef8e4f5938 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -31,7 +31,7 @@ #define CAMSS_CLOCK_MARGIN_NUMERATOR 105 #define CAMSS_CLOCK_MARGIN_DENOMINATOR 100 =20 -static const struct resources csiphy_res_8x16[] =3D { +static const struct camss_subdev_resources csiphy_res_8x16[] =3D { /* CSIPHY0 */ { .regulators =3D {}, @@ -57,7 +57,7 @@ static const struct resources csiphy_res_8x16[] =3D { } }; =20 -static const struct resources csid_res_8x16[] =3D { +static const struct camss_subdev_resources csid_res_8x16[] =3D { /* CSID0 */ { .regulators =3D { "vdda" }, @@ -93,7 +93,7 @@ static const struct resources csid_res_8x16[] =3D { }, }; =20 -static const struct resources ispif_res_8x16 =3D { +static const struct camss_subdev_resources ispif_res_8x16 =3D { /* ISPIF */ .clock =3D { "top_ahb", "ahb", "ispif_ahb", "csi0", "csi0_pix", "csi0_rdi", @@ -104,7 +104,7 @@ static const struct resources ispif_res_8x16 =3D { =20 }; =20 -static const struct resources vfe_res_8x16[] =3D { +static const struct camss_subdev_resources vfe_res_8x16[] =3D { /* VFE0 */ { .regulators =3D {}, @@ -126,7 +126,7 @@ static const struct resources vfe_res_8x16[] =3D { } }; =20 -static const struct resources csiphy_res_8x96[] =3D { +static const struct camss_subdev_resources csiphy_res_8x96[] =3D { /* CSIPHY0 */ { .regulators =3D {}, @@ -164,7 +164,7 @@ static const struct resources csiphy_res_8x96[] =3D { } }; =20 -static const struct resources csid_res_8x96[] =3D { +static const struct camss_subdev_resources csid_res_8x96[] =3D { /* CSID0 */ { .regulators =3D { "vdda" }, @@ -234,7 +234,7 @@ static const struct resources csid_res_8x96[] =3D { } }; =20 -static const struct resources ispif_res_8x96 =3D { +static const struct camss_subdev_resources ispif_res_8x96 =3D { /* ISPIF */ .clock =3D { "top_ahb", "ahb", "ispif_ahb", "csi0", "csi0_pix", "csi0_rdi", @@ -246,7 +246,7 @@ static const struct resources ispif_res_8x96 =3D { .interrupt =3D { "ispif" } }; =20 -static const struct resources vfe_res_8x96[] =3D { +static const struct camss_subdev_resources vfe_res_8x96[] =3D { /* VFE0 */ { .regulators =3D {}, @@ -284,7 +284,7 @@ static const struct resources vfe_res_8x96[] =3D { } }; =20 -static const struct resources csiphy_res_660[] =3D { +static const struct camss_subdev_resources csiphy_res_660[] =3D { /* CSIPHY0 */ { .regulators =3D {}, @@ -328,7 +328,7 @@ static const struct resources csiphy_res_660[] =3D { } }; =20 -static const struct resources csid_res_660[] =3D { +static const struct camss_subdev_resources csid_res_660[] =3D { /* CSID0 */ { .regulators =3D { "vdda", "vdd_sec" }, @@ -410,7 +410,7 @@ static const struct resources csid_res_660[] =3D { } }; =20 -static const struct resources ispif_res_660 =3D { +static const struct camss_subdev_resources ispif_res_660 =3D { /* ISPIF */ .clock =3D { "top_ahb", "ahb", "ispif_ahb", "csi0", "csi0_pix", "csi0_rdi", @@ -422,7 +422,7 @@ static const struct resources ispif_res_660 =3D { .interrupt =3D { "ispif" } }; =20 -static const struct resources vfe_res_660[] =3D { +static const struct camss_subdev_resources vfe_res_660[] =3D { /* VFE0 */ { .regulators =3D {}, @@ -466,7 +466,7 @@ static const struct resources vfe_res_660[] =3D { } }; =20 -static const struct resources csiphy_res_845[] =3D { +static const struct camss_subdev_resources csiphy_res_845[] =3D { /* CSIPHY0 */ { .regulators =3D {}, @@ -540,7 +540,7 @@ static const struct resources csiphy_res_845[] =3D { } }; =20 -static const struct resources csid_res_845[] =3D { +static const struct camss_subdev_resources csid_res_845[] =3D { /* CSID0 */ { .regulators =3D { "vdda-phy", "vdda-pll" }, @@ -602,7 +602,7 @@ static const struct resources csid_res_845[] =3D { } }; =20 -static const struct resources vfe_res_845[] =3D { +static const struct camss_subdev_resources vfe_res_845[] =3D { /* VFE0 */ { .regulators =3D {}, @@ -663,7 +663,7 @@ static const struct resources vfe_res_845[] =3D { } }; =20 -static const struct resources csiphy_res_8250[] =3D { +static const struct camss_subdev_resources csiphy_res_8250[] =3D { /* CSIPHY0 */ { .regulators =3D {}, @@ -720,7 +720,7 @@ static const struct resources csiphy_res_8250[] =3D { } }; =20 -static const struct resources csid_res_8250[] =3D { +static const struct camss_subdev_resources csid_res_8250[] =3D { /* CSID0 */ { .regulators =3D { "vdda-phy", "vdda-pll" }, @@ -769,7 +769,7 @@ static const struct resources csid_res_8250[] =3D { } }; =20 -static const struct resources vfe_res_8250[] =3D { +static const struct camss_subdev_resources vfe_res_8250[] =3D { /* VFE0 */ { .regulators =3D {}, @@ -1120,10 +1120,10 @@ static int camss_of_parse_ports(struct camss *camss) */ static int camss_init_subdevices(struct camss *camss) { - const struct resources *csiphy_res; - const struct resources *csid_res; - const struct resources *ispif_res; - const struct resources *vfe_res; + const struct camss_subdev_resources *csiphy_res; + const struct camss_subdev_resources *csid_res; + const struct camss_subdev_resources *ispif_res; + const struct camss_subdev_resources *vfe_res; unsigned int i; int ret; =20 diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/plat= form/qcom/camss/camss.h index e95211cdb1fd6..9d6ba7b17ff02 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -41,7 +41,7 @@ =20 #define CAMSS_RES_MAX 17 =20 -struct resources { +struct camss_subdev_resources { char *regulators[CAMSS_RES_MAX]; char *clock[CAMSS_RES_MAX]; char *clock_for_reset[CAMSS_RES_MAX]; --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4513CE7A95 for ; Mon, 25 Sep 2023 15:47:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232546AbjIYPre (ORCPT ); Mon, 25 Sep 2023 11:47:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232118AbjIYPrX (ORCPT ); Mon, 25 Sep 2023 11:47:23 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5738A2 for ; Mon, 25 Sep 2023 08:47:15 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3231df054c4so2905692f8f.0 for ; Mon, 25 Sep 2023 08:47:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656834; x=1696261634; 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=WtUvABqn7deJbHXIvivNsqSlJTQ17oV+fRU19/L86bw=; b=HZkqBNGRaQdG3zTA/C/uAUAe9y9vucAnFBelQCSRRcFZTUlr0aKcDyX7l7Xh7tMLce 4HwEGoEcVntAKQ1l4sw6+TyTC+gwmM8eJdvV1OUomw1iVeFgcwPY9SCMb9BQ+uYJ/chu tVJNIs5G3DuCy1mXrXUw+yI8ned647TGu9LROYmd9ftE/rDb1zaBqKBzU/VevfoWtFiw xdy69hZi1ULzHVw5pzNgmtZtMTIBWIE0L742nafMvYV1jF5Zcm+j2700qjPhGieCqQ9h mz13JVdOH/j6MwooDmzNqfEoM4FW0KSZU/E7KbPVxrtI+WrbqLxqeqW9Dng+LeA3BppC 6rBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656834; x=1696261634; 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=WtUvABqn7deJbHXIvivNsqSlJTQ17oV+fRU19/L86bw=; b=eV1maLZ1B2nUKYGnm/55ShbsTPPwdrJl7E8eh8L66KYGbYeSudzi7Dkq4eVJW045Tb NRBfP/EsG5+3uxaadXCC6D/Fb2bEgHDq1N1Z86PQePnVD356u8/owjaFKFK4Xn1WVS2T 0zqLRxPPOa2J6soJ4gPnrnIKCdVAsEgcgwS7/j6IhAl6jTV/fHkPdOMY9jIBa3dUe3nL lZV6XRSziOA0kh8qBZlx/7SzgizMnCj2qkV2jWB7Qj93RThGQtgyyqPdJaIxDF71AcXx MDvf/RrTmYpn2AKUFaGzqdh8Kh54fJ+ni2yityG2Aq5AMf+7UJWM0Yn7cp6T8R8ntCtG e98A== X-Gm-Message-State: AOJu0YzFuHZNVFv9O2Ru2h53AZXcu4LMT06j3m4EYoaY9nxsPYvFiEUf Wt83+a7oBFPdgm7BaF+tWzmsBA== X-Google-Smtp-Source: AGHT+IHui5ItgVZVkrzlKk2MaXtQevTJX+D4WE7bMOUDc7G55beRLypjnFK5ubf4G7PQbzNMrPUorw== X-Received: by 2002:adf:fd8e:0:b0:31f:a0ab:26b5 with SMTP id d14-20020adffd8e000000b0031fa0ab26b5mr5846228wrr.8.1695656834064; Mon, 25 Sep 2023 08:47:14 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:13 -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 03/17] media: qcom: camss: Start to move to module compat matched resources Date: Mon, 25 Sep 2023 16:46:53 +0100 Message-ID: <20230925154707.837542-4-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There is a lot of unnecessary if/elsing in this code that arguably should never have made it upstream when adding a second let alone subsequent SoC. I'm guilty of not fixing the mess myself when adding in the sm8250. Before adding in any new SoCs or resources lets take the time to cleanup the resource passing. First step is to pass the generic struct camss_resources as a parameter per the compatible list. Subsequent patches will address the other somewhat disparate strutures which we are also doing if/else on and assigning statically. Squashed down a commit to drop useless NULL assignment for ispif resources. Signed-off-by: Bryan O'Donoghue Acked-by: Konrad Dybcio --- drivers/media/platform/qcom/camss/camss.c | 90 ++++++++++++----------- drivers/media/platform/qcom/camss/camss.h | 8 ++ 2 files changed, 54 insertions(+), 44 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index 718ef8e4f5938..8fa5dee75672d 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1120,47 +1121,13 @@ static int camss_of_parse_ports(struct camss *camss) */ static int camss_init_subdevices(struct camss *camss) { - const struct camss_subdev_resources *csiphy_res; - const struct camss_subdev_resources *csid_res; - const struct camss_subdev_resources *ispif_res; - const struct camss_subdev_resources *vfe_res; + const struct camss_resources *res =3D camss->res; unsigned int i; int ret; =20 - if (camss->version =3D=3D CAMSS_8x16) { - csiphy_res =3D csiphy_res_8x16; - csid_res =3D csid_res_8x16; - ispif_res =3D &ispif_res_8x16; - vfe_res =3D vfe_res_8x16; - } else if (camss->version =3D=3D CAMSS_8x96) { - csiphy_res =3D csiphy_res_8x96; - csid_res =3D csid_res_8x96; - ispif_res =3D &ispif_res_8x96; - vfe_res =3D vfe_res_8x96; - } else if (camss->version =3D=3D CAMSS_660) { - csiphy_res =3D csiphy_res_660; - csid_res =3D csid_res_660; - ispif_res =3D &ispif_res_660; - vfe_res =3D vfe_res_660; - } else if (camss->version =3D=3D CAMSS_845) { - csiphy_res =3D csiphy_res_845; - csid_res =3D csid_res_845; - /* Titan VFEs don't have an ISPIF */ - ispif_res =3D NULL; - vfe_res =3D vfe_res_845; - } else if (camss->version =3D=3D CAMSS_8250) { - csiphy_res =3D csiphy_res_8250; - csid_res =3D csid_res_8250; - /* Titan VFEs don't have an ISPIF */ - ispif_res =3D NULL; - vfe_res =3D vfe_res_8250; - } else { - return -EINVAL; - } - for (i =3D 0; i < camss->csiphy_num; i++) { ret =3D msm_csiphy_subdev_init(camss, &camss->csiphy[i], - &csiphy_res[i], i); + &res->csiphy_res[i], i); if (ret < 0) { dev_err(camss->dev, "Failed to init csiphy%d sub-device: %d\n", @@ -1172,7 +1139,7 @@ static int camss_init_subdevices(struct camss *camss) /* note: SM8250 requires VFE to be initialized before CSID */ for (i =3D 0; i < camss->vfe_num + camss->vfe_lite_num; i++) { ret =3D msm_vfe_subdev_init(camss, &camss->vfe[i], - &vfe_res[i], i); + &res->vfe_res[i], i); if (ret < 0) { dev_err(camss->dev, "Fail to init vfe%d sub-device: %d\n", i, ret); @@ -1182,7 +1149,7 @@ static int camss_init_subdevices(struct camss *camss) =20 for (i =3D 0; i < camss->csid_num; i++) { ret =3D msm_csid_subdev_init(camss, &camss->csid[i], - &csid_res[i], i); + &res->csid_res[i], i); if (ret < 0) { dev_err(camss->dev, "Failed to init csid%d sub-device: %d\n", @@ -1191,7 +1158,7 @@ static int camss_init_subdevices(struct camss *camss) } } =20 - ret =3D msm_ispif_subdev_init(camss, ispif_res); + ret =3D msm_ispif_subdev_init(camss, res->ispif_res); if (ret < 0) { dev_err(camss->dev, "Failed to init ispif sub-device: %d\n", ret); @@ -1568,6 +1535,8 @@ static int camss_probe(struct platform_device *pdev) if (!camss) return -ENOMEM; =20 + camss->res =3D of_device_get_match_data(dev); + atomic_set(&camss->ref_count, 0); camss->dev =3D dev; platform_set_drvdata(pdev, camss); @@ -1742,12 +1711,45 @@ static void camss_remove(struct platform_device *pd= ev) camss_genpd_cleanup(camss); } =20 +static const struct camss_resources msm8916_resources =3D { + .csiphy_res =3D csiphy_res_8x16, + .csid_res =3D csid_res_8x16, + .ispif_res =3D &ispif_res_8x16, + .vfe_res =3D vfe_res_8x16, +}; + +static const struct camss_resources msm8996_resources =3D { + .csiphy_res =3D csiphy_res_8x96, + .csid_res =3D csid_res_8x96, + .ispif_res =3D &ispif_res_8x96, + .vfe_res =3D vfe_res_8x96, +}; + +static const struct camss_resources sdm660_resources =3D { + .csiphy_res =3D csiphy_res_660, + .csid_res =3D csid_res_660, + .ispif_res =3D &ispif_res_660, + .vfe_res =3D vfe_res_660, +}; + +static const struct camss_resources sdm845_resources =3D { + .csiphy_res =3D csiphy_res_845, + .csid_res =3D csid_res_845, + .vfe_res =3D vfe_res_845, +}; + +static const struct camss_resources sm8250_resources =3D { + .csiphy_res =3D csiphy_res_8250, + .csid_res =3D csid_res_8250, + .vfe_res =3D vfe_res_8250, +}; + static const struct of_device_id camss_dt_match[] =3D { - { .compatible =3D "qcom,msm8916-camss" }, - { .compatible =3D "qcom,msm8996-camss" }, - { .compatible =3D "qcom,sdm660-camss" }, - { .compatible =3D "qcom,sdm845-camss" }, - { .compatible =3D "qcom,sm8250-camss" }, + { .compatible =3D "qcom,msm8916-camss", .data =3D &msm8916_resources }, + { .compatible =3D "qcom,msm8996-camss", .data =3D &msm8996_resources }, + { .compatible =3D "qcom,sdm660-camss", .data =3D &sdm660_resources }, + { .compatible =3D "qcom,sdm845-camss", .data =3D &sdm845_resources }, + { .compatible =3D "qcom,sm8250-camss", .data =3D &sm8250_resources }, { } }; =20 diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/plat= form/qcom/camss/camss.h index 9d6ba7b17ff02..20c84e8328880 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -79,6 +79,13 @@ enum icc_count { ICC_SM8250_COUNT =3D 4, }; =20 +struct camss_resources { + const struct camss_subdev_resources *csiphy_res; + const struct camss_subdev_resources *csid_res; + const struct camss_subdev_resources *ispif_res; + const struct camss_subdev_resources *vfe_res; +}; + struct camss { enum camss_version version; struct v4l2_device v4l2_dev; @@ -99,6 +106,7 @@ struct camss { struct device_link **genpd_link; struct icc_path *icc_path[ICC_SM8250_COUNT]; struct icc_bw_tbl icc_bw_tbl[ICC_SM8250_COUNT]; + const struct camss_resources *res; }; =20 struct camss_camera_interface { --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCDDCCE7A9A for ; Mon, 25 Sep 2023 15:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233171AbjIYPrk (ORCPT ); Mon, 25 Sep 2023 11:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231736AbjIYPrb (ORCPT ); Mon, 25 Sep 2023 11:47:31 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C3C8AF for ; Mon, 25 Sep 2023 08:47:16 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40566f89f6eso36849315e9.3 for ; Mon, 25 Sep 2023 08:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656835; x=1696261635; 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=sc3QrJ7bPpNquzpdbmPtMRrT+D/boaJ7K4FKMOV9GkU=; b=H3PVYLPpnelNgvmpHOso/1Vm4/D6bOgu8VbEy+o6OwYWwc2VY9iseE9Sp63V83/VS8 p74u16t27WkiUvbM8XIMPyvfIYXVuFirljLxJeK/S9zStv8GMldq7S9XLFUY44kkSIFr 3Ktmn0tFGAI38qUa0HX3FCHsmhnt7PPIhSnrESED6rj+7adokcnJpQ9/WNBqg+iof7Hm IXa60ejcQg7WZET8DZ1Ukj8shqUQFeY5FrlHCfUhl28asThkwO9W56c0j7UU1mOw3jUN YFgbbaMAtrh4IM6npp9kymismfQT+X00SKXPHOFbCKdR+hmCZZ2Yonsd32ODFW0ngFh7 s9uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656835; x=1696261635; 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=sc3QrJ7bPpNquzpdbmPtMRrT+D/boaJ7K4FKMOV9GkU=; b=KOkz25dSX5LA+8lYy97C/AOLosJXPTpmstbWPhg1iDzI5u+urgPDJ64Y3wiRVk94CA U+gkFfV3HiZbH8sm2fej4d2RPRk9ygBwNTTWjaRz4GfHrZCmldnYp5j8QLISEXosbjTG YbL96W7tBN1gF7uRysY7zMFmXew0RZXc7sXqz7x1Q+icPMT4bPG1Jk+mCw/nb1MVDqjO zBJjxMFaKoUkew8AC0acObm2mCgcfDXICzJVhYbYQHXFrybMpBisIZ2w3sVFaOBqaeB6 jONFEJLp4SRtDKHEGJn+4fZiRNUyPi31+OqOuUmLe5K+oqoSEARFmcbzuOHp8DBbJ5uw ZKmg== X-Gm-Message-State: AOJu0YwsKjctsuTM891QMWGRJcH+kcSjjEt4gK34y/Xtxj9qPiitCpc7 XSaVFb5y9KqjMYlhoejhIaMKzg== X-Google-Smtp-Source: AGHT+IG36AW3eM7yXuWX82AYCVyQ/lYpqfCIwvyKT2Wlv/+SLpJWnSF97hCUIVDjdLYa1A33ZDM2mg== X-Received: by 2002:adf:fd01:0:b0:322:5d58:99b4 with SMTP id e1-20020adffd01000000b003225d5899b4mr5900724wrr.0.1695656835097; Mon, 25 Sep 2023 08:47:15 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:14 -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 04/17] media: qcom: camss: Pass icc bandwidth table as a platform parameter Date: Mon, 25 Sep 2023 16:46:54 +0100 Message-ID: <20230925154707.837542-5-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Pass the bandwidth table as a platform parameter not if/else derived pointer to the static table. Signed-off-by: Bryan O'Donoghue Acked-by: Konrad Dybcio Reviewed-by: Laurent Pinchart --- drivers/media/platform/qcom/camss/camss.c | 29 +++++++---------------- drivers/media/platform/qcom/camss/camss.h | 3 ++- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index 8fa5dee75672d..f502b4d9e07c5 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -1485,21 +1485,15 @@ static int camss_configure_pd(struct camss *camss) static int camss_icc_get(struct camss *camss) { const struct resources_icc *icc_res; - int nbr_icc_paths =3D 0; int i; =20 - if (camss->version =3D=3D CAMSS_8250) { - icc_res =3D &icc_res_sm8250[0]; - nbr_icc_paths =3D ICC_SM8250_COUNT; - } + icc_res =3D camss->res->icc_res; =20 - for (i =3D 0; i < nbr_icc_paths; i++) { + for (i =3D 0; i < camss->res->icc_path_num; i++) { camss->icc_path[i] =3D devm_of_icc_get(camss->dev, icc_res[i].name); if (IS_ERR(camss->icc_path[i])) return PTR_ERR(camss->icc_path[i]); - - camss->icc_bw_tbl[i] =3D icc_res[i].icc_bw_tbl; } =20 return 0; @@ -1742,6 +1736,8 @@ static const struct camss_resources sm8250_resources = =3D { .csiphy_res =3D csiphy_res_8250, .csid_res =3D csid_res_8250, .vfe_res =3D vfe_res_8250, + .icc_res =3D icc_res_sm8250, + .icc_path_num =3D ARRAY_SIZE(icc_res_sm8250), }; =20 static const struct of_device_id camss_dt_match[] =3D { @@ -1758,14 +1754,10 @@ MODULE_DEVICE_TABLE(of, camss_dt_match); static int __maybe_unused camss_runtime_suspend(struct device *dev) { struct camss *camss =3D dev_get_drvdata(dev); - int nbr_icc_paths =3D 0; int i; int ret; =20 - if (camss->version =3D=3D CAMSS_8250) - nbr_icc_paths =3D ICC_SM8250_COUNT; - - for (i =3D 0; i < nbr_icc_paths; i++) { + for (i =3D 0; i < camss->res->icc_path_num; i++) { ret =3D icc_set_bw(camss->icc_path[i], 0, 0); if (ret) return ret; @@ -1777,17 +1769,14 @@ static int __maybe_unused camss_runtime_suspend(str= uct device *dev) static int __maybe_unused camss_runtime_resume(struct device *dev) { struct camss *camss =3D dev_get_drvdata(dev); - int nbr_icc_paths =3D 0; + const struct resources_icc *icc_res =3D camss->res->icc_res; int i; int ret; =20 - if (camss->version =3D=3D CAMSS_8250) - nbr_icc_paths =3D ICC_SM8250_COUNT; - - for (i =3D 0; i < nbr_icc_paths; i++) { + for (i =3D 0; i < camss->res->icc_path_num; i++) { ret =3D icc_set_bw(camss->icc_path[i], - camss->icc_bw_tbl[i].avg, - camss->icc_bw_tbl[i].peak); + icc_res[i].icc_bw_tbl.avg, + icc_res[i].icc_bw_tbl.peak); if (ret) return ret; } diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/plat= form/qcom/camss/camss.h index 20c84e8328880..8b2e4adb923ef 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -84,6 +84,8 @@ struct camss_resources { const struct camss_subdev_resources *csid_res; const struct camss_subdev_resources *ispif_res; const struct camss_subdev_resources *vfe_res; + const struct resources_icc *icc_res; + const unsigned int icc_path_num; }; =20 struct camss { @@ -105,7 +107,6 @@ struct camss { struct device **genpd; struct device_link **genpd_link; struct icc_path *icc_path[ICC_SM8250_COUNT]; - struct icc_bw_tbl icc_bw_tbl[ICC_SM8250_COUNT]; const struct camss_resources *res; }; =20 --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E00ECE7A98 for ; Mon, 25 Sep 2023 15:48:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232673AbjIYPsP (ORCPT ); Mon, 25 Sep 2023 11:48:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232719AbjIYPrc (ORCPT ); Mon, 25 Sep 2023 11:47:32 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2AEF112 for ; Mon, 25 Sep 2023 08:47:17 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3214d4ecd39so5655187f8f.1 for ; Mon, 25 Sep 2023 08:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656836; x=1696261636; 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=biCoK57H9w4x0GlQBz339du1frh/6bO6nSXoupCi++g=; b=Wx2UE+QunD2vZ8W/HAWaOVRHGKT8uTYagoyuHomYFsAa5tJsIjmPm/GtjSYhlgnDSr SRxbXQrBB2GaNOcby1/RbNcIGXqU4OzfHmJI1Vv/Kscsd4uLvfhgERdYczZz+UrQ8BmK nwNd/DQU0nytohQQl0e3PJf2BD3xWj7qdqbqnF3ZZQoTRfIuOiDD+6njzSox22dkpE0t 1TFkg2G84vOCZiSbLCgL13pqaARTl029EiQSdBI/kFIND4qVuy/srFMJk2ybpB5zX0NP MK6PibIkTvGnvkYOsgqVp4qePHxWOzkwFEAH3E1Ix+6GRrwY834nlAVgl8JGZPRfJ8nw cjNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656836; x=1696261636; 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=biCoK57H9w4x0GlQBz339du1frh/6bO6nSXoupCi++g=; b=uVL/H7NLXBbnoStOrwqJzNUl+95+Rx1I0ob/mWQfGuXZ8Mdj4f6scQvoteZmz3dQAY xflILvcC8MLEoyMdsYd3R5HEmHyt7kGPUgMGNhaJhaj/rHORyZSrYMCi1GkwpFXSmPgU N3w/aYD8yu5lk1yZa+nTLg6feTxj9UGHqDtX7ODSLGI+pzCrhjs1niv0+91HvfID3O7B BIVkDDjeCGsR9ohy7o1XaE4EX1Yyz9+phoZ/LqLiadk2Z3n6dassfg8UbjcxIIBZkbq9 ZKTjMoglxgHZXS1wTU1EOK1oVYc+UWed1ojyzuVpKCwNLIAtspbnANVu4ejTnaC4CYBF hkfg== X-Gm-Message-State: AOJu0Yx4L/g8h5B8YPlTPSUS3PxtA5ObDhnjcNBmKcQ1CVMG6RL6nPXe aRkWV8Ciwt2ikS4FI7X/njDeEg== X-Google-Smtp-Source: AGHT+IFCqoh/xTMTGcgF8sY+Zsab2ymBdjzXyQAmDptTqMJEn/apKKDMJEE7f3tTp63DNyD2iAwP6g== X-Received: by 2002:a05:6000:10d:b0:31f:9b4f:1910 with SMTP id o13-20020a056000010d00b0031f9b4f1910mr5343308wrx.63.1695656836190; Mon, 25 Sep 2023 08:47:16 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:15 -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 05/17] media: qcom: camss: Pass remainder of variables as resources Date: Mon, 25 Sep 2023 16:46:55 +0100 Message-ID: <20230925154707.837542-6-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The following variables are being assigned statically based on compatible strings in the probe path. * enum camss_version version; * unsigned int csiphy_num; * unsigned int csid_num; * unsigned int vfe_num; * unsigned int vfe_lite_num; * unsigned int vfe_total_num; Migrate those variables to resource parameters passed in on platform probe arguments. The one caveat is for VFE it has been necessary to intoduce a new variable vfe_total_num to capture the aggregate value of vfe_num + vfe_lite_num. All the rest of the changes are rote camss->variable to camss->res->variable with the parameter tables now populating the listed variables. Signed-off-by: Bryan O'Donoghue Acked-by: Konrad Dybcio Reviewed-by: Laurent Pinchart --- .../media/platform/qcom/camss/camss-csid.c | 14 +-- .../qcom/camss/camss-csiphy-3ph-1-0.c | 8 +- .../media/platform/qcom/camss/camss-csiphy.c | 16 +-- .../media/platform/qcom/camss/camss-ispif.c | 28 ++--- .../media/platform/qcom/camss/camss-vfe-170.c | 4 +- .../media/platform/qcom/camss/camss-vfe-480.c | 4 +- drivers/media/platform/qcom/camss/camss-vfe.c | 26 ++-- .../media/platform/qcom/camss/camss-video.c | 10 +- drivers/media/platform/qcom/camss/camss.c | 115 ++++++++---------- drivers/media/platform/qcom/camss/camss.h | 11 +- 10 files changed, 113 insertions(+), 123 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media= /platform/qcom/camss/camss-csid.c index b1113decdb305..14abb7a7ceb47 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -159,7 +159,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int o= n) struct camss *camss =3D csid->camss; struct device *dev =3D camss->dev; struct vfe_device *vfe =3D &camss->vfe[csid->id]; - u32 version =3D camss->version; + u32 version =3D camss->res->version; int ret =3D 0; =20 if (on) { @@ -576,13 +576,13 @@ int msm_csid_subdev_init(struct camss *camss, struct = csid_device *csid, csid->camss =3D camss; csid->id =3D id; =20 - if (camss->version =3D=3D CAMSS_8x16) { + if (camss->res->version =3D=3D CAMSS_8x16) { csid->ops =3D &csid_ops_4_1; - } else if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) { + } else if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) { csid->ops =3D &csid_ops_4_7; - } else if (camss->version =3D=3D CAMSS_845 || - camss->version =3D=3D CAMSS_8250) { + } else if (camss->res->version =3D=3D CAMSS_845 || + camss->res->version =3D=3D CAMSS_8250) { csid->ops =3D &csid_ops_gen2; } else { return -EINVAL; @@ -591,7 +591,7 @@ int msm_csid_subdev_init(struct camss *camss, struct cs= id_device *csid, =20 /* Memory */ =20 - if (camss->version =3D=3D CAMSS_8250) { + if (camss->res->version =3D=3D CAMSS_8250) { /* for titan 480, CSID registers are inside the VFE region, * between the VFE "top" and "bus" registers. this requires * VFE to be initialized before CSID diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/dri= vers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c index 4dba61b8d3f2a..f50e2235c37fc 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c @@ -402,7 +402,7 @@ static void csiphy_gen1_config_lanes(struct csiphy_devi= ce *csiphy, val =3D CSIPHY_3PH_LNn_CFG1_SWI_REC_DLY_PRG; writel_relaxed(val, csiphy->base + CSIPHY_3PH_LNn_CFG1(l)); =20 - if (csiphy->camss->version =3D=3D CAMSS_660) + if (csiphy->camss->res->version =3D=3D CAMSS_660) val =3D CSIPHY_3PH_LNn_CFG4_T_HS_CLK_MISS_660; else val =3D CSIPHY_3PH_LNn_CFG4_T_HS_CLK_MISS; @@ -419,7 +419,7 @@ static void csiphy_gen2_config_lanes(struct csiphy_devi= ce *csiphy, int i, l, array_size; u32 val; =20 - switch (csiphy->camss->version) { + switch (csiphy->camss->res->version) { case CAMSS_845: r =3D &lane_regs_sdm845[0][0]; array_size =3D ARRAY_SIZE(lane_regs_sdm845[0]); @@ -468,8 +468,8 @@ static void csiphy_lanes_enable(struct csiphy_device *c= siphy, s64 link_freq, u8 lane_mask) { struct csiphy_lanes_cfg *c =3D &cfg->csi2->lane_cfg; - bool is_gen2 =3D (csiphy->camss->version =3D=3D CAMSS_845 || - csiphy->camss->version =3D=3D CAMSS_8250); + bool is_gen2 =3D (csiphy->camss->res->version =3D=3D CAMSS_845 || + csiphy->camss->res->version =3D=3D CAMSS_8250); u8 settle_cnt; u8 val; int i; diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/med= ia/platform/qcom/camss/camss-csiphy.c index b1b6c4cf18385..48e6a101ec9c9 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -557,17 +557,17 @@ int msm_csiphy_subdev_init(struct camss *camss, csiphy->id =3D id; csiphy->cfg.combo_mode =3D 0; =20 - if (camss->version =3D=3D CAMSS_8x16) { + if (camss->res->version =3D=3D CAMSS_8x16) { csiphy->ops =3D &csiphy_ops_2ph_1_0; csiphy->formats =3D csiphy_formats_8x16; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_8x16); - } else if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) { + } else if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) { csiphy->ops =3D &csiphy_ops_3ph_1_0; csiphy->formats =3D csiphy_formats_8x96; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_8x96); - } else if (camss->version =3D=3D CAMSS_845 || - camss->version =3D=3D CAMSS_8250) { + } else if (camss->res->version =3D=3D CAMSS_845 || + camss->res->version =3D=3D CAMSS_8250) { csiphy->ops =3D &csiphy_ops_3ph_1_0; csiphy->formats =3D csiphy_formats_sdm845; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_sdm845); @@ -581,8 +581,8 @@ int msm_csiphy_subdev_init(struct camss *camss, if (IS_ERR(csiphy->base)) return PTR_ERR(csiphy->base); =20 - if (camss->version =3D=3D CAMSS_8x16 || - camss->version =3D=3D CAMSS_8x96) { + if (camss->res->version =3D=3D CAMSS_8x16 || + camss->res->version =3D=3D CAMSS_8x96) { csiphy->base_clk_mux =3D devm_platform_ioremap_resource_byname(pdev, res->reg[1]); if (IS_ERR(csiphy->base_clk_mux)) @@ -664,7 +664,7 @@ int msm_csiphy_subdev_init(struct camss *camss, !strcmp(clock->name, "csiphy5_timer")) csiphy->rate_set[i] =3D true; =20 - if (camss->version =3D=3D CAMSS_660 && + if (camss->res->version =3D=3D CAMSS_660 && (!strcmp(clock->name, "csi0_phy") || !strcmp(clock->name, "csi1_phy") || !strcmp(clock->name, "csi2_phy"))) diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/medi= a/platform/qcom/camss/camss-ispif.c index 75b8a60806b22..be9d2f0a10c18 100644 --- a/drivers/media/platform/qcom/camss/camss-ispif.c +++ b/drivers/media/platform/qcom/camss/camss-ispif.c @@ -270,7 +270,7 @@ static int ispif_vfe_reset(struct ispif_device *ispif, = u8 vfe_id) unsigned long time; u32 val; =20 - if (vfe_id > (camss->vfe_num - 1)) { + if (vfe_id > camss->res->vfe_num - 1) { dev_err(camss->dev, "Error: asked reset for invalid VFE%d\n", vfe_id); return -ENOENT; @@ -829,8 +829,8 @@ static int ispif_set_stream(struct v4l2_subdev *sd, int= enable) ispif_select_csid(ispif, intf, csid, vfe, 1); ispif_select_cid(ispif, intf, cid, vfe, 1); ispif_config_irq(ispif, intf, vfe, 1); - if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) + if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) ispif_config_pack(ispif, line->fmt[MSM_ISPIF_PAD_SINK].code, intf, cid, vfe, 1); @@ -847,8 +847,8 @@ static int ispif_set_stream(struct v4l2_subdev *sd, int= enable) return ret; =20 mutex_lock(&ispif->config_lock); - if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) + if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) ispif_config_pack(ispif, line->fmt[MSM_ISPIF_PAD_SINK].code, intf, cid, vfe, 0); @@ -1109,10 +1109,10 @@ int msm_ispif_subdev_init(struct camss *camss, ispif->camss =3D camss; =20 /* Number of ISPIF lines - same as number of CSID hardware modules */ - if (camss->version =3D=3D CAMSS_8x16) + if (camss->res->version =3D=3D CAMSS_8x16) ispif->line_num =3D 2; - else if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) + else if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) ispif->line_num =3D 4; else return -EINVAL; @@ -1126,12 +1126,12 @@ int msm_ispif_subdev_init(struct camss *camss, ispif->line[i].ispif =3D ispif; ispif->line[i].id =3D i; =20 - if (camss->version =3D=3D CAMSS_8x16) { + if (camss->res->version =3D=3D CAMSS_8x16) { ispif->line[i].formats =3D ispif_formats_8x16; ispif->line[i].nformats =3D ARRAY_SIZE(ispif_formats_8x16); - } else if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) { + } else if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) { ispif->line[i].formats =3D ispif_formats_8x96; ispif->line[i].nformats =3D ARRAY_SIZE(ispif_formats_8x96); @@ -1159,11 +1159,11 @@ int msm_ispif_subdev_init(struct camss *camss, ispif->irq =3D ret; snprintf(ispif->irq_name, sizeof(ispif->irq_name), "%s_%s", dev_name(dev), MSM_ISPIF_NAME); - if (camss->version =3D=3D CAMSS_8x16) + if (camss->res->version =3D=3D CAMSS_8x16) ret =3D devm_request_irq(dev, ispif->irq, ispif_isr_8x16, IRQF_TRIGGER_RISING, ispif->irq_name, ispif); - else if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) + else if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) ret =3D devm_request_irq(dev, ispif->irq, ispif_isr_8x96, IRQF_TRIGGER_RISING, ispif->irq_name, ispif); else diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-170.c index 168baaa80d4e6..82d2392022dd1 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-170.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c @@ -673,7 +673,7 @@ static void vfe_pm_domain_off(struct vfe_device *vfe) { struct camss *camss =3D vfe->camss; =20 - if (vfe->id >=3D camss->vfe_num) + if (vfe->id >=3D camss->res->vfe_num) return; =20 device_link_del(camss->genpd_link[vfe->id]); @@ -688,7 +688,7 @@ static int vfe_pm_domain_on(struct vfe_device *vfe) struct camss *camss =3D vfe->camss; enum vfe_line_id id =3D vfe->id; =20 - if (id >=3D camss->vfe_num) + if (id >=3D camss->res->vfe_num) return 0; =20 camss->genpd_link[id] =3D device_link_add(camss->dev, camss->genpd[id], diff --git a/drivers/media/platform/qcom/camss/camss-vfe-480.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-480.c index 8ddb8016434ae..074fa4e38163e 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-480.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-480.c @@ -499,7 +499,7 @@ static void vfe_pm_domain_off(struct vfe_device *vfe) { struct camss *camss =3D vfe->camss; =20 - if (vfe->id >=3D camss->vfe_num) + if (vfe->id >=3D camss->res->vfe_num) return; =20 device_link_del(camss->genpd_link[vfe->id]); @@ -514,7 +514,7 @@ static int vfe_pm_domain_on(struct vfe_device *vfe) struct camss *camss =3D vfe->camss; enum vfe_line_id id =3D vfe->id; =20 - if (id >=3D camss->vfe_num) + if (id >=3D camss->res->vfe_num) return 0; =20 camss->genpd_link[id] =3D device_link_add(camss->dev, camss->genpd[id], diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/= platform/qcom/camss/camss-vfe.c index e84dcf0f4b2da..94ee7c7039eb3 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -170,7 +170,7 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 = sink_code, { struct vfe_device *vfe =3D to_vfe(line); =20 - if (vfe->camss->version =3D=3D CAMSS_8x16) + if (vfe->camss->res->version =3D=3D CAMSS_8x16) switch (sink_code) { case MEDIA_BUS_FMT_YUYV8_1X16: { @@ -218,10 +218,10 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u3= 2 sink_code, =20 return sink_code; } - else if (vfe->camss->version =3D=3D CAMSS_8x96 || - vfe->camss->version =3D=3D CAMSS_660 || - vfe->camss->version =3D=3D CAMSS_845 || - vfe->camss->version =3D=3D CAMSS_8250) + else if (vfe->camss->res->version =3D=3D CAMSS_8x96 || + vfe->camss->res->version =3D=3D CAMSS_660 || + vfe->camss->res->version =3D=3D CAMSS_845 || + vfe->camss->res->version =3D=3D CAMSS_8250) switch (sink_code) { case MEDIA_BUS_FMT_YUYV8_1X16: { @@ -1286,7 +1286,7 @@ int msm_vfe_subdev_init(struct camss *camss, struct v= fe_device *vfe, int i, j; int ret; =20 - switch (camss->version) { + switch (camss->res->version) { case CAMSS_8x16: vfe->ops =3D &vfe_ops_4_1; break; @@ -1392,7 +1392,7 @@ int msm_vfe_subdev_init(struct camss *camss, struct v= fe_device *vfe, init_completion(&l->output.sof); init_completion(&l->output.reg_update); =20 - if (camss->version =3D=3D CAMSS_8x16) { + if (camss->res->version =3D=3D CAMSS_8x16) { if (i =3D=3D VFE_LINE_PIX) { l->formats =3D formats_pix_8x16; l->nformats =3D ARRAY_SIZE(formats_pix_8x16); @@ -1400,8 +1400,8 @@ int msm_vfe_subdev_init(struct camss *camss, struct v= fe_device *vfe, l->formats =3D formats_rdi_8x16; l->nformats =3D ARRAY_SIZE(formats_rdi_8x16); } - } else if (camss->version =3D=3D CAMSS_8x96 || - camss->version =3D=3D CAMSS_660) { + } else if (camss->res->version =3D=3D CAMSS_8x96 || + camss->res->version =3D=3D CAMSS_660) { if (i =3D=3D VFE_LINE_PIX) { l->formats =3D formats_pix_8x96; l->nformats =3D ARRAY_SIZE(formats_pix_8x96); @@ -1409,8 +1409,8 @@ int msm_vfe_subdev_init(struct camss *camss, struct v= fe_device *vfe, l->formats =3D formats_rdi_8x96; l->nformats =3D ARRAY_SIZE(formats_rdi_8x96); } - } else if (camss->version =3D=3D CAMSS_845 || - camss->version =3D=3D CAMSS_8250) { + } else if (camss->res->version =3D=3D CAMSS_845 || + camss->res->version =3D=3D CAMSS_8250) { l->formats =3D formats_rdi_845; l->nformats =3D ARRAY_SIZE(formats_rdi_845); } else { @@ -1542,8 +1542,8 @@ int msm_vfe_register_entities(struct vfe_device *vfe, } =20 video_out->ops =3D &vfe->video_ops; - if (vfe->camss->version =3D=3D CAMSS_845 || - vfe->camss->version =3D=3D CAMSS_8250) + if (vfe->camss->res->version =3D=3D CAMSS_845 || + vfe->camss->res->version =3D=3D CAMSS_8250) video_out->bpl_alignment =3D 16; else video_out->bpl_alignment =3D 8; diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/medi= a/platform/qcom/camss/camss-video.c index 1d686aef92eaf..46a89b5f6c171 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -1006,7 +1006,7 @@ int msm_video_register(struct camss_video *video, str= uct v4l2_device *v4l2_dev, =20 mutex_init(&video->lock); =20 - if (video->camss->version =3D=3D CAMSS_8x16) { + if (video->camss->res->version =3D=3D CAMSS_8x16) { if (is_pix) { video->formats =3D formats_pix_8x16; video->nformats =3D ARRAY_SIZE(formats_pix_8x16); @@ -1014,8 +1014,8 @@ int msm_video_register(struct camss_video *video, str= uct v4l2_device *v4l2_dev, video->formats =3D formats_rdi_8x16; video->nformats =3D ARRAY_SIZE(formats_rdi_8x16); } - } else if (video->camss->version =3D=3D CAMSS_8x96 || - video->camss->version =3D=3D CAMSS_660) { + } else if (video->camss->res->version =3D=3D CAMSS_8x96 || + video->camss->res->version =3D=3D CAMSS_660) { if (is_pix) { video->formats =3D formats_pix_8x96; video->nformats =3D ARRAY_SIZE(formats_pix_8x96); @@ -1023,8 +1023,8 @@ int msm_video_register(struct camss_video *video, str= uct v4l2_device *v4l2_dev, video->formats =3D formats_rdi_8x96; video->nformats =3D ARRAY_SIZE(formats_rdi_8x96); } - } else if (video->camss->version =3D=3D CAMSS_845 || - video->camss->version =3D=3D CAMSS_8250) { + } else if (video->camss->res->version =3D=3D CAMSS_845 || + video->camss->res->version =3D=3D CAMSS_8250) { video->formats =3D formats_rdi_845; video->nformats =3D ARRAY_SIZE(formats_rdi_845); } else { diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index f502b4d9e07c5..d1152a7db9cd2 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -1005,7 +1005,7 @@ int camss_pm_domain_on(struct camss *camss, int id) { int ret =3D 0; =20 - if (id < camss->vfe_num) { + if (id < camss->res->vfe_num) { struct vfe_device *vfe =3D &camss->vfe[id]; =20 ret =3D vfe->ops->pm_domain_on(vfe); @@ -1016,7 +1016,7 @@ int camss_pm_domain_on(struct camss *camss, int id) =20 void camss_pm_domain_off(struct camss *camss, int id) { - if (id < camss->vfe_num) { + if (id < camss->res->vfe_num) { struct vfe_device *vfe =3D &camss->vfe[id]; =20 vfe->ops->pm_domain_off(vfe); @@ -1125,7 +1125,7 @@ static int camss_init_subdevices(struct camss *camss) unsigned int i; int ret; =20 - for (i =3D 0; i < camss->csiphy_num; i++) { + for (i =3D 0; i < camss->res->csiphy_num; i++) { ret =3D msm_csiphy_subdev_init(camss, &camss->csiphy[i], &res->csiphy_res[i], i); if (ret < 0) { @@ -1137,7 +1137,7 @@ static int camss_init_subdevices(struct camss *camss) } =20 /* note: SM8250 requires VFE to be initialized before CSID */ - for (i =3D 0; i < camss->vfe_num + camss->vfe_lite_num; i++) { + for (i =3D 0; i < camss->vfe_total_num; i++) { ret =3D msm_vfe_subdev_init(camss, &camss->vfe[i], &res->vfe_res[i], i); if (ret < 0) { @@ -1147,7 +1147,7 @@ static int camss_init_subdevices(struct camss *camss) } } =20 - for (i =3D 0; i < camss->csid_num; i++) { + for (i =3D 0; i < camss->res->csid_num; i++) { ret =3D msm_csid_subdev_init(camss, &camss->csid[i], &res->csid_res[i], i); if (ret < 0) { @@ -1179,7 +1179,7 @@ static int camss_register_entities(struct camss *cams= s) int i, j, k; int ret; =20 - for (i =3D 0; i < camss->csiphy_num; i++) { + for (i =3D 0; i < camss->res->csiphy_num; i++) { ret =3D msm_csiphy_register_entity(&camss->csiphy[i], &camss->v4l2_dev); if (ret < 0) { @@ -1190,7 +1190,7 @@ static int camss_register_entities(struct camss *cams= s) } } =20 - for (i =3D 0; i < camss->csid_num; i++) { + for (i =3D 0; i < camss->res->csid_num; i++) { ret =3D msm_csid_register_entity(&camss->csid[i], &camss->v4l2_dev); if (ret < 0) { @@ -1209,7 +1209,7 @@ static int camss_register_entities(struct camss *cams= s) goto err_reg_ispif; } =20 - for (i =3D 0; i < camss->vfe_num + camss->vfe_lite_num; i++) { + for (i =3D 0; i < camss->vfe_total_num; i++) { ret =3D msm_vfe_register_entities(&camss->vfe[i], &camss->v4l2_dev); if (ret < 0) { @@ -1220,8 +1220,8 @@ static int camss_register_entities(struct camss *cams= s) } } =20 - for (i =3D 0; i < camss->csiphy_num; i++) { - for (j =3D 0; j < camss->csid_num; j++) { + for (i =3D 0; i < camss->res->csiphy_num; i++) { + for (j =3D 0; j < camss->res->csid_num; j++) { ret =3D media_create_pad_link( &camss->csiphy[i].subdev.entity, MSM_CSIPHY_PAD_SRC, @@ -1240,7 +1240,7 @@ static int camss_register_entities(struct camss *cams= s) } =20 if (camss->ispif) { - for (i =3D 0; i < camss->csid_num; i++) { + for (i =3D 0; i < camss->res->csid_num; i++) { for (j =3D 0; j < camss->ispif->line_num; j++) { ret =3D media_create_pad_link( &camss->csid[i].subdev.entity, @@ -1260,7 +1260,7 @@ static int camss_register_entities(struct camss *cams= s) } =20 for (i =3D 0; i < camss->ispif->line_num; i++) - for (k =3D 0; k < camss->vfe_num; k++) + for (k =3D 0; k < camss->res->vfe_num; k++) for (j =3D 0; j < camss->vfe[k].line_num; j++) { struct v4l2_subdev *ispif =3D &camss->ispif->line[i].subdev; struct v4l2_subdev *vfe =3D &camss->vfe[k].line[j].subdev; @@ -1280,8 +1280,8 @@ static int camss_register_entities(struct camss *cams= s) } } } else { - for (i =3D 0; i < camss->csid_num; i++) - for (k =3D 0; k < camss->vfe_num + camss->vfe_lite_num; k++) + for (i =3D 0; i < camss->res->csid_num; i++) + for (k =3D 0; k < camss->vfe_total_num; k++) for (j =3D 0; j < camss->vfe[k].line_num; j++) { struct v4l2_subdev *csid =3D &camss->csid[i].subdev; struct v4l2_subdev *vfe =3D &camss->vfe[k].line[j].subdev; @@ -1305,7 +1305,7 @@ static int camss_register_entities(struct camss *cams= s) return 0; =20 err_link: - i =3D camss->vfe_num + camss->vfe_lite_num; + i =3D camss->vfe_total_num; err_reg_vfe: for (i--; i >=3D 0; i--) msm_vfe_unregister_entities(&camss->vfe[i]); @@ -1313,12 +1313,12 @@ static int camss_register_entities(struct camss *ca= mss) err_reg_ispif: msm_ispif_unregister_entities(camss->ispif); =20 - i =3D camss->csid_num; + i =3D camss->res->csid_num; err_reg_csid: for (i--; i >=3D 0; i--) msm_csid_unregister_entity(&camss->csid[i]); =20 - i =3D camss->csiphy_num; + i =3D camss->res->csiphy_num; err_reg_csiphy: for (i--; i >=3D 0; i--) msm_csiphy_unregister_entity(&camss->csiphy[i]); @@ -1336,15 +1336,15 @@ static void camss_unregister_entities(struct camss = *camss) { unsigned int i; =20 - for (i =3D 0; i < camss->csiphy_num; i++) + for (i =3D 0; i < camss->res->csiphy_num; i++) msm_csiphy_unregister_entity(&camss->csiphy[i]); =20 - for (i =3D 0; i < camss->csid_num; i++) + for (i =3D 0; i < camss->res->csid_num; i++) msm_csid_unregister_entity(&camss->csid[i]); =20 msm_ispif_unregister_entities(camss->ispif); =20 - for (i =3D 0; i < camss->vfe_num + camss->vfe_lite_num; i++) + for (i =3D 0; i < camss->vfe_total_num; i++) msm_vfe_unregister_entities(&camss->vfe[i]); } =20 @@ -1463,7 +1463,7 @@ static int camss_configure_pd(struct camss *camss) } } =20 - if (i > camss->vfe_num) { + if (i > camss->res->vfe_num) { camss->genpd_link[i - 1] =3D device_link_add(camss->dev, camss->genpd[i = - 1], DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE); @@ -1506,7 +1506,7 @@ static void camss_genpd_cleanup(struct camss *camss) if (camss->genpd_num =3D=3D 1) return; =20 - if (camss->genpd_num > camss->vfe_num) + if (camss->genpd_num > camss->res->vfe_num) device_link_del(camss->genpd_link[camss->genpd_num - 1]); =20 for (i =3D 0; i < camss->genpd_num; i++) @@ -1523,7 +1523,8 @@ static int camss_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; struct camss *camss; - int num_subdevs, ret; + int num_subdevs; + int ret; =20 camss =3D devm_kzalloc(dev, sizeof(*camss), GFP_KERNEL); if (!camss) @@ -1535,59 +1536,25 @@ static int camss_probe(struct platform_device *pdev) camss->dev =3D dev; platform_set_drvdata(pdev, camss); =20 - if (of_device_is_compatible(dev->of_node, "qcom,msm8916-camss")) { - camss->version =3D CAMSS_8x16; - camss->csiphy_num =3D 2; - camss->csid_num =3D 2; - camss->vfe_num =3D 1; - } else if (of_device_is_compatible(dev->of_node, - "qcom,msm8996-camss")) { - camss->version =3D CAMSS_8x96; - camss->csiphy_num =3D 3; - camss->csid_num =3D 4; - camss->vfe_num =3D 2; - } else if (of_device_is_compatible(dev->of_node, - "qcom,sdm660-camss")) { - camss->version =3D CAMSS_660; - camss->csiphy_num =3D 3; - camss->csid_num =3D 4; - camss->vfe_num =3D 2; - } else if (of_device_is_compatible(dev->of_node, - "qcom,sdm845-camss")) { - camss->version =3D CAMSS_845; - camss->csiphy_num =3D 4; - camss->csid_num =3D 3; - camss->vfe_num =3D 2; - camss->vfe_lite_num =3D 1; - } else if (of_device_is_compatible(dev->of_node, - "qcom,sm8250-camss")) { - camss->version =3D CAMSS_8250; - camss->csiphy_num =3D 6; - camss->csid_num =3D 4; - camss->vfe_num =3D 2; - camss->vfe_lite_num =3D 2; - } else { - return -EINVAL; - } - - camss->csiphy =3D devm_kcalloc(dev, camss->csiphy_num, + camss->csiphy =3D devm_kcalloc(dev, camss->res->csiphy_num, sizeof(*camss->csiphy), GFP_KERNEL); if (!camss->csiphy) return -ENOMEM; =20 - camss->csid =3D devm_kcalloc(dev, camss->csid_num, sizeof(*camss->csid), + camss->csid =3D devm_kcalloc(dev, camss->res->csid_num, sizeof(*camss->cs= id), GFP_KERNEL); if (!camss->csid) return -ENOMEM; =20 - if (camss->version =3D=3D CAMSS_8x16 || - camss->version =3D=3D CAMSS_8x96) { + if (camss->res->version =3D=3D CAMSS_8x16 || + camss->res->version =3D=3D CAMSS_8x96) { camss->ispif =3D devm_kcalloc(dev, 1, sizeof(*camss->ispif), GFP_KERNEL); if (!camss->ispif) return -ENOMEM; } =20 - camss->vfe =3D devm_kcalloc(dev, camss->vfe_num + camss->vfe_lite_num, + camss->vfe_total_num =3D camss->res->vfe_num + camss->res->vfe_lite_num; + camss->vfe =3D devm_kcalloc(dev, camss->vfe_total_num, sizeof(*camss->vfe), GFP_KERNEL); if (!camss->vfe) return -ENOMEM; @@ -1706,38 +1673,60 @@ static void camss_remove(struct platform_device *pd= ev) } =20 static const struct camss_resources msm8916_resources =3D { + .version =3D CAMSS_8x16, .csiphy_res =3D csiphy_res_8x16, .csid_res =3D csid_res_8x16, .ispif_res =3D &ispif_res_8x16, .vfe_res =3D vfe_res_8x16, + .csiphy_num =3D ARRAY_SIZE(csiphy_res_8x16), + .csid_num =3D ARRAY_SIZE(csid_res_8x16), + .vfe_num =3D ARRAY_SIZE(vfe_res_8x16), }; =20 static const struct camss_resources msm8996_resources =3D { + .version =3D CAMSS_8x96, .csiphy_res =3D csiphy_res_8x96, .csid_res =3D csid_res_8x96, .ispif_res =3D &ispif_res_8x96, .vfe_res =3D vfe_res_8x96, + .csiphy_num =3D ARRAY_SIZE(csiphy_res_8x96), + .csid_num =3D ARRAY_SIZE(csid_res_8x96), + .vfe_num =3D ARRAY_SIZE(vfe_res_8x96), }; =20 static const struct camss_resources sdm660_resources =3D { + .version =3D CAMSS_660, .csiphy_res =3D csiphy_res_660, .csid_res =3D csid_res_660, .ispif_res =3D &ispif_res_660, .vfe_res =3D vfe_res_660, + .csiphy_num =3D ARRAY_SIZE(csiphy_res_660), + .csid_num =3D ARRAY_SIZE(csid_res_660), + .vfe_num =3D ARRAY_SIZE(vfe_res_660), }; =20 static const struct camss_resources sdm845_resources =3D { + .version =3D CAMSS_845, .csiphy_res =3D csiphy_res_845, .csid_res =3D csid_res_845, .vfe_res =3D vfe_res_845, + .csiphy_num =3D ARRAY_SIZE(csiphy_res_845), + .csid_num =3D ARRAY_SIZE(csid_res_845), + .vfe_num =3D 2, + .vfe_lite_num =3D 1, }; =20 static const struct camss_resources sm8250_resources =3D { + .version =3D CAMSS_8250, .csiphy_res =3D csiphy_res_8250, .csid_res =3D csid_res_8250, .vfe_res =3D vfe_res_8250, .icc_res =3D icc_res_sm8250, .icc_path_num =3D ARRAY_SIZE(icc_res_sm8250), + .csiphy_num =3D ARRAY_SIZE(csiphy_res_8250), + .csid_num =3D ARRAY_SIZE(csid_res_8250), + .vfe_num =3D 2, + .vfe_lite_num =3D 2, }; =20 static const struct of_device_id camss_dt_match[] =3D { diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/plat= form/qcom/camss/camss.h index 8b2e4adb923ef..3b6562b515d46 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -80,27 +80,27 @@ enum icc_count { }; =20 struct camss_resources { + enum camss_version version; const struct camss_subdev_resources *csiphy_res; const struct camss_subdev_resources *csid_res; const struct camss_subdev_resources *ispif_res; const struct camss_subdev_resources *vfe_res; const struct resources_icc *icc_res; const unsigned int icc_path_num; + const unsigned int csiphy_num; + const unsigned int csid_num; + const unsigned int vfe_num; + const unsigned int vfe_lite_num; }; =20 struct camss { - enum camss_version version; struct v4l2_device v4l2_dev; struct v4l2_async_notifier notifier; struct media_device media_dev; struct device *dev; - int csiphy_num; struct csiphy_device *csiphy; - int csid_num; struct csid_device *csid; struct ispif_device *ispif; - int vfe_num; - int vfe_lite_num; struct vfe_device *vfe; atomic_t ref_count; int genpd_num; @@ -108,6 +108,7 @@ struct camss { struct device_link **genpd_link; struct icc_path *icc_path[ICC_SM8250_COUNT]; const struct camss_resources *res; + unsigned int vfe_total_num; }; =20 struct camss_camera_interface { --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45F25CE7A9A for ; Mon, 25 Sep 2023 15:47:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233228AbjIYPrp (ORCPT ); Mon, 25 Sep 2023 11:47:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232596AbjIYPrc (ORCPT ); Mon, 25 Sep 2023 11:47:32 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DEBB124 for ; Mon, 25 Sep 2023 08:47:19 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40537481094so65803465e9.0 for ; Mon, 25 Sep 2023 08:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656837; x=1696261637; 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=ZNmLk2/hMJ8q4cG9CX8+EYjM5qVrNntkoJGG0Zi7eVo=; b=tkRp68MZGtH6RuRjKcpHuWJkmu0XPN6+Y2oY/Z2vVyiT4lydyv2t65NM7i30bKYfSV KlotrCHwERtfcwzbFyRR607PzukfgcJRtMLLfWaHaBYKAAFc+Z3aBUS2udvSZW7ktg6a nAGacDaZekEdMMbNBdwkVw4t25v2uqv9YiEUxeskd0Wl/MlNYftHITYik7QAglOyj8Sv 56KRjcklwj80UWL3oknZazeNmvCwSrvEQVjbpZ8fuYwZ3LkZgDVmHDNW2GSBgCxrCC2S jkxMkoupboMa46lawZUieMz3If+9dnybG9nLbsvsiwPagZ6dDn33GdM8PmYyu2Vhz2sO sqfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656837; x=1696261637; 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=ZNmLk2/hMJ8q4cG9CX8+EYjM5qVrNntkoJGG0Zi7eVo=; b=BO4umrUpLrxPxINZccXBHjy4YNVDoZycp65UB0EBGB7ZBOO3Yc4logMKnDiqRSHO6x ICvevGby2GrEyNY5y3TtcrTjz69XS8SAtRKjYjJ3z9hl5q2zi9Cj/Cq7tu7NMZNF81jI ocPpAxaIkaAk4HSBmRp/puGztTnErywQe1nt20Yq71KI5Sm1qGB+7iHvwD39+ZRXvhun QQzlengt14xzcSWdq0zi59gm6iZMwO9sM9dhUCCF0VzPYwC6hQFe+MXX8YwLJKrcHBoH oofZCBqk6FgoAN9kP/VFaOghAq1LHeV04FTgK8HAw5bd1e+2Hnd9ZPhFRXykGqHaWXCm J69w== X-Gm-Message-State: AOJu0YwWOkMxO7ywio25iPDymDrhQVhmvfvSpBPOdb/Pv4iOX7O2mzDi +KWsRwTNIljx/OtMIUm1xLek2w== X-Google-Smtp-Source: AGHT+IHRkaU3W48QquIkOqiMmSx2ZuuMyUCsStorj5wNGllICkXj0jgwAf9R6BttedGne+1BdUkRtQ== X-Received: by 2002:a05:600c:21cb:b0:402:8896:bb7b with SMTP id x11-20020a05600c21cb00b004028896bb7bmr6230722wmj.6.1695656837529; Mon, 25 Sep 2023 08:47: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 d4-20020adffd84000000b0031f34a395e7sm12077536wrr.45.2023.09.25.08.47.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47: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, 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 06/17] media: qcom: camss: Pass line_num from compat resources Date: Mon, 25 Sep 2023 16:46:56 +0100 Message-ID: <20230925154707.837542-7-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" line_num indicates the number of RDI - raw data interface channels which are associated with a given IFE/VFE - image/video front end. On several SoCs the RDI number is not static for each VFE - for example on sm8250 VFE Lite has four RDIs where regular VFE has three. Assigning line_num statically in the subdev_init() phase initialises each VFE to the lower number, meaning in practical terms that we are lobbing off one RDI on some VFEs. Interrupt handling uses static for (i =3D RDI0; i < RDI2; i++) {} in some of our VFE blocks but this can't work for situations where we have a mixture of VFE @ 3 RDI and VFE-lite @ 4 RDI blocks. First step to remediate is to pass line_num from a compat string controlled data-structure and do so on a per-VFE basis. Later patches will assign the correct number of RDI blocks per VFE. Signed-off-by: Bryan O'Donoghue Reviewed-by: Konrad Dybcio Reviewed-by: Laurent Pinchart --- .../media/platform/qcom/camss/camss-vfe-170.c | 2 -- .../media/platform/qcom/camss/camss-vfe-4-1.c | 2 -- .../media/platform/qcom/camss/camss-vfe-4-7.c | 2 -- .../media/platform/qcom/camss/camss-vfe-4-8.c | 2 -- .../media/platform/qcom/camss/camss-vfe-480.c | 1 - drivers/media/platform/qcom/camss/camss-vfe.c | 5 +++ drivers/media/platform/qcom/camss/camss.c | 36 ++++++++++++------- drivers/media/platform/qcom/camss/camss.h | 1 + 8 files changed, 30 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-170.c index 82d2392022dd1..2ba7160b3bd1e 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-170.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c @@ -753,8 +753,6 @@ static void vfe_subdev_init(struct device *dev, struct = vfe_device *vfe) { vfe->isr_ops =3D vfe_isr_ops_170; vfe->video_ops =3D vfe_video_ops_170; - - vfe->line_num =3D VFE_LINE_NUM_GEN2; } =20 const struct vfe_hw_ops vfe_ops_170 =3D { diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-1.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-4-1.c index bc309f326f519..2911e4126e7ad 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-4-1.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-1.c @@ -992,8 +992,6 @@ static void vfe_subdev_init(struct device *dev, struct = vfe_device *vfe) vfe->isr_ops =3D vfe_isr_ops_gen1; vfe->ops_gen1 =3D &vfe_ops_gen1_4_1; vfe->video_ops =3D vfe_video_ops_gen1; - - vfe->line_num =3D VFE_LINE_NUM_GEN1; } =20 const struct vfe_hw_ops vfe_ops_4_1 =3D { diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-7.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-4-7.c index 8acd76c9746ba..b65ed0fef595e 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-4-7.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-7.c @@ -1188,8 +1188,6 @@ static void vfe_subdev_init(struct device *dev, struc= t vfe_device *vfe) vfe->isr_ops =3D vfe_isr_ops_gen1; vfe->ops_gen1 =3D &vfe_ops_gen1_4_7; vfe->video_ops =3D vfe_video_ops_gen1; - - vfe->line_num =3D VFE_LINE_NUM_GEN1; } =20 const struct vfe_hw_ops vfe_ops_4_7 =3D { diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-8.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-4-8.c index 3a0167ecf873a..7b3805177f037 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-4-8.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-8.c @@ -1173,8 +1173,6 @@ static void vfe_subdev_init(struct device *dev, struc= t vfe_device *vfe) vfe->isr_ops =3D vfe_isr_ops_gen1; vfe->ops_gen1 =3D &vfe_ops_gen1_4_8; vfe->video_ops =3D vfe_video_ops_gen1; - - vfe->line_num =3D VFE_LINE_NUM_GEN1; } =20 const struct vfe_hw_ops vfe_ops_4_8 =3D { diff --git a/drivers/media/platform/qcom/camss/camss-vfe-480.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-480.c index 074fa4e38163e..43a2964121f22 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-480.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-480.c @@ -569,7 +569,6 @@ static const struct camss_video_ops vfe_video_ops_480 = =3D { static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe) { vfe->video_ops =3D vfe_video_ops_480; - vfe->line_num =3D MAX_VFE_OUTPUT_LINES; } =20 const struct vfe_hw_ops vfe_ops_480 =3D { diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/= platform/qcom/camss/camss-vfe.c index 94ee7c7039eb3..f381c82f1f877 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -1305,6 +1305,11 @@ int msm_vfe_subdev_init(struct camss *camss, struct = vfe_device *vfe, default: return -EINVAL; } + + if (!res->line_num) + return -EINVAL; + + vfe->line_num =3D res->line_num; vfe->ops->subdev_init(dev, vfe); =20 /* Memory */ diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index d1152a7db9cd2..54886a2a449b0 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -123,7 +123,8 @@ static const struct camss_subdev_resources vfe_res_8x16= [] =3D { { 0 }, { 0 } }, .reg =3D { "vfe0" }, - .interrupt =3D { "vfe0" } + .interrupt =3D { "vfe0" }, + .line_num =3D VFE_LINE_NUM_GEN1, } }; =20 @@ -263,7 +264,8 @@ static const struct camss_subdev_resources vfe_res_8x96= [] =3D { { 0 }, { 0 } }, .reg =3D { "vfe0" }, - .interrupt =3D { "vfe0" } + .interrupt =3D { "vfe0" }, + .line_num =3D VFE_LINE_NUM_GEN1, }, =20 /* VFE1 */ @@ -281,7 +283,8 @@ static const struct camss_subdev_resources vfe_res_8x96= [] =3D { { 0 }, { 0 } }, .reg =3D { "vfe1" }, - .interrupt =3D { "vfe1" } + .interrupt =3D { "vfe1" }, + .line_num =3D VFE_LINE_NUM_GEN1, } }; =20 @@ -442,7 +445,8 @@ static const struct camss_subdev_resources vfe_res_660[= ] =3D { { 0 }, { 0 } }, .reg =3D { "vfe0" }, - .interrupt =3D { "vfe0" } + .interrupt =3D { "vfe0" }, + .line_num =3D VFE_LINE_NUM_GEN1, }, =20 /* VFE1 */ @@ -463,7 +467,8 @@ static const struct camss_subdev_resources vfe_res_660[= ] =3D { { 0 }, { 0 } }, .reg =3D { "vfe1" }, - .interrupt =3D { "vfe1" } + .interrupt =3D { "vfe1" }, + .line_num =3D VFE_LINE_NUM_GEN1, } }; =20 @@ -621,7 +626,8 @@ static const struct camss_subdev_resources vfe_res_845[= ] =3D { { 19200000, 75000000, 384000000, 538666667 }, { 384000000 } }, .reg =3D { "vfe0" }, - .interrupt =3D { "vfe0" } + .interrupt =3D { "vfe0" }, + .line_num =3D VFE_LINE_NUM_GEN2, }, =20 /* VFE1 */ @@ -641,7 +647,8 @@ static const struct camss_subdev_resources vfe_res_845[= ] =3D { { 19200000, 75000000, 384000000, 538666667 }, { 384000000 } }, .reg =3D { "vfe1" }, - .interrupt =3D { "vfe1" } + .interrupt =3D { "vfe1" }, + .line_num =3D VFE_LINE_NUM_GEN2, }, =20 /* VFE-lite */ @@ -660,7 +667,8 @@ static const struct camss_subdev_resources vfe_res_845[= ] =3D { { 19200000, 75000000, 384000000, 538666667 }, { 384000000 } }, .reg =3D { "vfe_lite" }, - .interrupt =3D { "vfe_lite" } + .interrupt =3D { "vfe_lite" }, + .line_num =3D VFE_LINE_NUM_GEN2, } }; =20 @@ -787,7 +795,8 @@ static const struct camss_subdev_resources vfe_res_8250= [] =3D { { 0 }, { 0 } }, .reg =3D { "vfe0" }, - .interrupt =3D { "vfe0" } + .interrupt =3D { "vfe0" }, + .line_num =3D 4, }, /* VFE1 */ { @@ -805,7 +814,8 @@ static const struct camss_subdev_resources vfe_res_8250= [] =3D { { 0 }, { 0 } }, .reg =3D { "vfe1" }, - .interrupt =3D { "vfe1" } + .interrupt =3D { "vfe1" }, + .line_num =3D 4, }, /* VFE2 (lite) */ { @@ -822,7 +832,8 @@ static const struct camss_subdev_resources vfe_res_8250= [] =3D { { 400000000, 480000000 }, { 0 } }, .reg =3D { "vfe_lite0" }, - .interrupt =3D { "vfe_lite0" } + .interrupt =3D { "vfe_lite0" }, + .line_num =3D 4, }, /* VFE3 (lite) */ { @@ -839,7 +850,8 @@ static const struct camss_subdev_resources vfe_res_8250= [] =3D { { 400000000, 480000000 }, { 0 } }, .reg =3D { "vfe_lite1" }, - .interrupt =3D { "vfe_lite1" } + .interrupt =3D { "vfe_lite1" }, + .line_num =3D 4, }, }; =20 diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/plat= form/qcom/camss/camss.h index 3b6562b515d46..fc02aa84a5dd7 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -48,6 +48,7 @@ struct camss_subdev_resources { u32 clock_rate[CAMSS_RES_MAX][CAMSS_RES_MAX]; char *reg[CAMSS_RES_MAX]; char *interrupt[CAMSS_RES_MAX]; + u8 line_num; }; =20 struct icc_bw_tbl { --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42371CE7A98 for ; Mon, 25 Sep 2023 15:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233255AbjIYPry (ORCPT ); Mon, 25 Sep 2023 11:47:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232836AbjIYPrd (ORCPT ); Mon, 25 Sep 2023 11:47:33 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CDF8192 for ; Mon, 25 Sep 2023 08:47:20 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-405361bb94eso67438485e9.0 for ; Mon, 25 Sep 2023 08:47:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656838; x=1696261638; 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=7RcC5Z13/zUqK69N/so6eHAgcugzjOcvez6QkwUNOkw=; b=peCWt9m88Qa6Fj+8OZ896Bc4nufs/BohY3GE0PpRdCRwb1mG4SaZb3p6sDaaJzbuwU cAq5Cx3+2McaSTk6WrlK5leT58GvTlodZ0YhQnZwUhWhZUqfTBeJkpfSPwT+kF0zvHBr 0SMUqr3gyL5KQDplyhLcDVUbuhqaWeZpH2j27jFXOdIDXLH9OyVWzqeftamUCqgwv/J2 kmWVZcgUoQltk95XucFvPWXcVyjxAHOrDoj9lzFVHTKHuznXgtU3v/I69uDRZ/eIpDsA MicupU0eNbZzVJs7VUxxQCcT2ezwjK/Qd1l9GklVrpGPKpUQm3WRsvHlerc58MTdMite TJNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656838; x=1696261638; 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=7RcC5Z13/zUqK69N/so6eHAgcugzjOcvez6QkwUNOkw=; b=qan3Dr0Fo9RgFffh9/JHk2KNsIfDYFfO1KrsJOr9+2kEyuiYtwVpdNzbOYvD+efmSO B8Y3nnMneJJMs6njwmTdWZRJ26bcSZ2DUx5P3X57sG8BBkg0WnGOTNsI0QIVd2h8uK8I +JdS4q87NeMJX+YCfomJbgT+OyP3ufIJlHkfBFro6AeLxhgxG772Iunxda8OUZ1jNzPD /EsSFC0ToFig9gFgEgOH4wew5dNrRzgQLEjgaBfLO+STgmfTcGbUAbxhyzbiwGHzi8J0 6UziH4a5b4y/86NJUkTCVm0nuXOPauURlFonR6jT7g3Rng4bNws7gtot++WqZbt2rMcv tNPA== X-Gm-Message-State: AOJu0YxiOBp3vHHaU4EvBhG7U+3fsVRtyDbodiUeUXx4dC3idjrWSnwr W8J1wSbTqQ6TXo/bvK44XUbBVu1PbRAQHxPF5Kw= X-Google-Smtp-Source: AGHT+IHbDQQ+mWabkID+ZHSlihjCdysYLOzSBboGqBKPkwSwdjJWu9ugLmKVb8A9r5VzKllI1rrLew== X-Received: by 2002:a7b:c855:0:b0:405:3a65:1b4c with SMTP id c21-20020a7bc855000000b004053a651b4cmr6397322wml.6.1695656838662; Mon, 25 Sep 2023 08:47:18 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:18 -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 07/17] media: qcom: camss: Pass CAMSS subdev callbacks via resource ops pointer Date: Mon, 25 Sep 2023 16:46:57 +0100 Message-ID: <20230925154707.837542-8-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" It is possible to pass all of the CAMSS subdevice internal operations pointers from the controlling resources structure with an additional pointer added to the resources structure. This allows for the removal of most of the probe-time control structures. Signed-off-by: Bryan O'Donoghue --- .../media/platform/qcom/camss/camss-csid.c | 12 +- .../media/platform/qcom/camss/camss-csiphy.c | 4 +- drivers/media/platform/qcom/camss/camss-vfe.c | 20 +-- drivers/media/platform/qcom/camss/camss.c | 117 ++++++++++++------ drivers/media/platform/qcom/camss/camss.h | 1 + 5 files changed, 86 insertions(+), 68 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media= /platform/qcom/camss/camss-csid.c index 14abb7a7ceb47..99f651e2021cb 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -575,18 +575,8 @@ int msm_csid_subdev_init(struct camss *camss, struct c= sid_device *csid, =20 csid->camss =3D camss; csid->id =3D id; + csid->ops =3D res->ops; =20 - if (camss->res->version =3D=3D CAMSS_8x16) { - csid->ops =3D &csid_ops_4_1; - } else if (camss->res->version =3D=3D CAMSS_8x96 || - camss->res->version =3D=3D CAMSS_660) { - csid->ops =3D &csid_ops_4_7; - } else if (camss->res->version =3D=3D CAMSS_845 || - camss->res->version =3D=3D CAMSS_8250) { - csid->ops =3D &csid_ops_gen2; - } else { - return -EINVAL; - } csid->ops->subdev_init(csid); =20 /* Memory */ diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/med= ia/platform/qcom/camss/camss-csiphy.c index 48e6a101ec9c9..4310a132dcbe2 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -556,19 +556,17 @@ int msm_csiphy_subdev_init(struct camss *camss, csiphy->camss =3D camss; csiphy->id =3D id; csiphy->cfg.combo_mode =3D 0; + csiphy->ops =3D res->ops; =20 if (camss->res->version =3D=3D CAMSS_8x16) { - csiphy->ops =3D &csiphy_ops_2ph_1_0; csiphy->formats =3D csiphy_formats_8x16; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_8x16); } else if (camss->res->version =3D=3D CAMSS_8x96 || camss->res->version =3D=3D CAMSS_660) { - csiphy->ops =3D &csiphy_ops_3ph_1_0; csiphy->formats =3D csiphy_formats_8x96; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_8x96); } else if (camss->res->version =3D=3D CAMSS_845 || camss->res->version =3D=3D CAMSS_8250) { - csiphy->ops =3D &csiphy_ops_3ph_1_0; csiphy->formats =3D csiphy_formats_sdm845; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_sdm845); } else { diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/= platform/qcom/camss/camss-vfe.c index f381c82f1f877..4d5c32d3dddbf 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -1286,25 +1286,7 @@ int msm_vfe_subdev_init(struct camss *camss, struct = vfe_device *vfe, int i, j; int ret; =20 - switch (camss->res->version) { - case CAMSS_8x16: - vfe->ops =3D &vfe_ops_4_1; - break; - case CAMSS_8x96: - vfe->ops =3D &vfe_ops_4_7; - break; - case CAMSS_660: - vfe->ops =3D &vfe_ops_4_8; - break; - case CAMSS_845: - vfe->ops =3D &vfe_ops_170; - break; - case CAMSS_8250: - vfe->ops =3D &vfe_ops_480; - break; - default: - return -EINVAL; - } + vfe->ops =3D res->ops; =20 if (!res->line_num) return -EINVAL; diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index 54886a2a449b0..12131d9ea7ca8 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -42,7 +42,8 @@ static const struct camss_subdev_resources csiphy_res_8x1= 6[] =3D { { 0 }, { 100000000, 200000000 } }, .reg =3D { "csiphy0", "csiphy0_clk_mux" }, - .interrupt =3D { "csiphy0" } + .interrupt =3D { "csiphy0" }, + .ops =3D &csiphy_ops_2ph_1_0 }, =20 /* CSIPHY1 */ @@ -54,7 +55,8 @@ static const struct camss_subdev_resources csiphy_res_8x1= 6[] =3D { { 0 }, { 100000000, 200000000 } }, .reg =3D { "csiphy1", "csiphy1_clk_mux" }, - .interrupt =3D { "csiphy1" } + .interrupt =3D { "csiphy1" }, + .ops =3D &csiphy_ops_2ph_1_0 } }; =20 @@ -73,7 +75,8 @@ static const struct camss_subdev_resources csid_res_8x16[= ] =3D { { 0 }, { 0 } }, .reg =3D { "csid0" }, - .interrupt =3D { "csid0" } + .interrupt =3D { "csid0" }, + .ops =3D &csid_ops_4_1, }, =20 /* CSID1 */ @@ -90,7 +93,8 @@ static const struct camss_subdev_resources csid_res_8x16[= ] =3D { { 0 }, { 0 } }, .reg =3D { "csid1" }, - .interrupt =3D { "csid1" } + .interrupt =3D { "csid1" }, + .ops =3D &csid_ops_4_1, }, }; =20 @@ -125,6 +129,7 @@ static const struct camss_subdev_resources vfe_res_8x16= [] =3D { .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, .line_num =3D VFE_LINE_NUM_GEN1, + .ops =3D &vfe_ops_4_1 } }; =20 @@ -138,7 +143,8 @@ static const struct camss_subdev_resources csiphy_res_8= x96[] =3D { { 0 }, { 100000000, 200000000, 266666667 } }, .reg =3D { "csiphy0", "csiphy0_clk_mux" }, - .interrupt =3D { "csiphy0" } + .interrupt =3D { "csiphy0" }, + .ops =3D &csiphy_ops_3ph_1_0 }, =20 /* CSIPHY1 */ @@ -150,7 +156,8 @@ static const struct camss_subdev_resources csiphy_res_8= x96[] =3D { { 0 }, { 100000000, 200000000, 266666667 } }, .reg =3D { "csiphy1", "csiphy1_clk_mux" }, - .interrupt =3D { "csiphy1" } + .interrupt =3D { "csiphy1" }, + .ops =3D &csiphy_ops_3ph_1_0 }, =20 /* CSIPHY2 */ @@ -162,7 +169,8 @@ static const struct camss_subdev_resources csiphy_res_8= x96[] =3D { { 0 }, { 100000000, 200000000, 266666667 } }, .reg =3D { "csiphy2", "csiphy2_clk_mux" }, - .interrupt =3D { "csiphy2" } + .interrupt =3D { "csiphy2" }, + .ops =3D &csiphy_ops_3ph_1_0 } }; =20 @@ -181,7 +189,8 @@ static const struct camss_subdev_resources csid_res_8x9= 6[] =3D { { 0 }, { 0 } }, .reg =3D { "csid0" }, - .interrupt =3D { "csid0" } + .interrupt =3D { "csid0" }, + .ops =3D &csid_ops_4_7, }, =20 /* CSID1 */ @@ -198,7 +207,8 @@ static const struct camss_subdev_resources csid_res_8x9= 6[] =3D { { 0 }, { 0 } }, .reg =3D { "csid1" }, - .interrupt =3D { "csid1" } + .interrupt =3D { "csid1" }, + .ops =3D &csid_ops_4_7, }, =20 /* CSID2 */ @@ -215,7 +225,8 @@ static const struct camss_subdev_resources csid_res_8x9= 6[] =3D { { 0 }, { 0 } }, .reg =3D { "csid2" }, - .interrupt =3D { "csid2" } + .interrupt =3D { "csid2" }, + .ops =3D &csid_ops_4_7, }, =20 /* CSID3 */ @@ -232,7 +243,8 @@ static const struct camss_subdev_resources csid_res_8x9= 6[] =3D { { 0 }, { 0 } }, .reg =3D { "csid3" }, - .interrupt =3D { "csid3" } + .interrupt =3D { "csid3" }, + .ops =3D &csid_ops_4_7, } }; =20 @@ -266,6 +278,7 @@ static const struct camss_subdev_resources vfe_res_8x96= [] =3D { .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, .line_num =3D VFE_LINE_NUM_GEN1, + .ops =3D &vfe_ops_4_7 }, =20 /* VFE1 */ @@ -285,6 +298,7 @@ static const struct camss_subdev_resources vfe_res_8x96= [] =3D { .reg =3D { "vfe1" }, .interrupt =3D { "vfe1" }, .line_num =3D VFE_LINE_NUM_GEN1, + .ops =3D &vfe_ops_4_7 } }; =20 @@ -300,7 +314,8 @@ static const struct camss_subdev_resources csiphy_res_6= 60[] =3D { { 100000000, 200000000, 269333333 }, { 0 } }, .reg =3D { "csiphy0", "csiphy0_clk_mux" }, - .interrupt =3D { "csiphy0" } + .interrupt =3D { "csiphy0" }, + .ops =3D &csiphy_ops_3ph_1_0 }, =20 /* CSIPHY1 */ @@ -314,7 +329,8 @@ static const struct camss_subdev_resources csiphy_res_6= 60[] =3D { { 100000000, 200000000, 269333333 }, { 0 } }, .reg =3D { "csiphy1", "csiphy1_clk_mux" }, - .interrupt =3D { "csiphy1" } + .interrupt =3D { "csiphy1" }, + .ops =3D &csiphy_ops_3ph_1_0 }, =20 /* CSIPHY2 */ @@ -328,7 +344,8 @@ static const struct camss_subdev_resources csiphy_res_6= 60[] =3D { { 100000000, 200000000, 269333333 }, { 0 } }, .reg =3D { "csiphy2", "csiphy2_clk_mux" }, - .interrupt =3D { "csiphy2" } + .interrupt =3D { "csiphy2" }, + .ops =3D &csiphy_ops_3ph_1_0 } }; =20 @@ -350,7 +367,8 @@ static const struct camss_subdev_resources csid_res_660= [] =3D { { 0 }, { 0 } }, .reg =3D { "csid0" }, - .interrupt =3D { "csid0" } + .interrupt =3D { "csid0" }, + .ops =3D &csid_ops_4_7, }, =20 /* CSID1 */ @@ -370,7 +388,8 @@ static const struct camss_subdev_resources csid_res_660= [] =3D { { 0 }, { 0 } }, .reg =3D { "csid1" }, - .interrupt =3D { "csid1" } + .interrupt =3D { "csid1" }, + .ops =3D &csid_ops_4_7, }, =20 /* CSID2 */ @@ -390,7 +409,8 @@ static const struct camss_subdev_resources csid_res_660= [] =3D { { 0 }, { 0 } }, .reg =3D { "csid2" }, - .interrupt =3D { "csid2" } + .interrupt =3D { "csid2" }, + .ops =3D &csid_ops_4_7, }, =20 /* CSID3 */ @@ -410,7 +430,8 @@ static const struct camss_subdev_resources csid_res_660= [] =3D { { 0 }, { 0 } }, .reg =3D { "csid3" }, - .interrupt =3D { "csid3" } + .interrupt =3D { "csid3" }, + .ops =3D &csid_ops_4_7, } }; =20 @@ -447,6 +468,7 @@ static const struct camss_subdev_resources vfe_res_660[= ] =3D { .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, .line_num =3D VFE_LINE_NUM_GEN1, + .ops =3D &vfe_ops_4_8 }, =20 /* VFE1 */ @@ -469,6 +491,7 @@ static const struct camss_subdev_resources vfe_res_660[= ] =3D { .reg =3D { "vfe1" }, .interrupt =3D { "vfe1" }, .line_num =3D VFE_LINE_NUM_GEN1, + .ops =3D &vfe_ops_4_8 } }; =20 @@ -488,7 +511,8 @@ static const struct camss_subdev_resources csiphy_res_8= 45[] =3D { { 0 }, { 19200000, 240000000, 269333333 } }, .reg =3D { "csiphy0" }, - .interrupt =3D { "csiphy0" } + .interrupt =3D { "csiphy0" }, + .ops =3D &csiphy_ops_3ph_1_0 }, =20 /* CSIPHY1 */ @@ -506,7 +530,8 @@ static const struct camss_subdev_resources csiphy_res_8= 45[] =3D { { 0 }, { 19200000, 240000000, 269333333 } }, .reg =3D { "csiphy1" }, - .interrupt =3D { "csiphy1" } + .interrupt =3D { "csiphy1" }, + .ops =3D &csiphy_ops_3ph_1_0 }, =20 /* CSIPHY2 */ @@ -524,7 +549,8 @@ static const struct camss_subdev_resources csiphy_res_8= 45[] =3D { { 0 }, { 19200000, 240000000, 269333333 } }, .reg =3D { "csiphy2" }, - .interrupt =3D { "csiphy2" } + .interrupt =3D { "csiphy2" }, + .ops =3D &csiphy_ops_3ph_1_0 }, =20 /* CSIPHY3 */ @@ -542,7 +568,8 @@ static const struct camss_subdev_resources csiphy_res_8= 45[] =3D { { 0 }, { 19200000, 240000000, 269333333 } }, .reg =3D { "csiphy3" }, - .interrupt =3D { "csiphy3" } + .interrupt =3D { "csiphy3" }, + .ops =3D &csiphy_ops_3ph_1_0 } }; =20 @@ -564,7 +591,8 @@ static const struct camss_subdev_resources csid_res_845= [] =3D { { 19200000, 75000000, 384000000, 538666667 }, { 384000000 } }, .reg =3D { "csid0" }, - .interrupt =3D { "csid0" } + .interrupt =3D { "csid0" }, + .ops =3D &csid_ops_gen2 }, =20 /* CSID1 */ @@ -584,7 +612,8 @@ static const struct camss_subdev_resources csid_res_845= [] =3D { { 19200000, 75000000, 384000000, 538666667 }, { 384000000 } }, .reg =3D { "csid1" }, - .interrupt =3D { "csid1" } + .interrupt =3D { "csid1" }, + .ops =3D &csid_ops_gen2 }, =20 /* CSID2 */ @@ -604,7 +633,8 @@ static const struct camss_subdev_resources csid_res_845= [] =3D { { 19200000, 75000000, 384000000, 538666667 }, { 384000000 } }, .reg =3D { "csid2" }, - .interrupt =3D { "csid2" } + .interrupt =3D { "csid2" }, + .ops =3D &csid_ops_gen2 } }; =20 @@ -628,6 +658,7 @@ static const struct camss_subdev_resources vfe_res_845[= ] =3D { .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, .line_num =3D VFE_LINE_NUM_GEN2, + .ops =3D &vfe_ops_170 }, =20 /* VFE1 */ @@ -649,6 +680,7 @@ static const struct camss_subdev_resources vfe_res_845[= ] =3D { .reg =3D { "vfe1" }, .interrupt =3D { "vfe1" }, .line_num =3D VFE_LINE_NUM_GEN2, + .ops =3D &vfe_ops_170 }, =20 /* VFE-lite */ @@ -669,6 +701,7 @@ static const struct camss_subdev_resources vfe_res_845[= ] =3D { .reg =3D { "vfe_lite" }, .interrupt =3D { "vfe_lite" }, .line_num =3D VFE_LINE_NUM_GEN2, + .ops =3D &vfe_ops_170 } }; =20 @@ -680,7 +713,8 @@ static const struct camss_subdev_resources csiphy_res_8= 250[] =3D { .clock_rate =3D { { 400000000 }, { 300000000 } }, .reg =3D { "csiphy0" }, - .interrupt =3D { "csiphy0" } + .interrupt =3D { "csiphy0" }, + .ops =3D &csiphy_ops_3ph_1_0 }, /* CSIPHY1 */ { @@ -689,7 +723,8 @@ static const struct camss_subdev_resources csiphy_res_8= 250[] =3D { .clock_rate =3D { { 400000000 }, { 300000000 } }, .reg =3D { "csiphy1" }, - .interrupt =3D { "csiphy1" } + .interrupt =3D { "csiphy1" }, + .ops =3D &csiphy_ops_3ph_1_0 }, /* CSIPHY2 */ { @@ -698,7 +733,8 @@ static const struct camss_subdev_resources csiphy_res_8= 250[] =3D { .clock_rate =3D { { 400000000 }, { 300000000 } }, .reg =3D { "csiphy2" }, - .interrupt =3D { "csiphy2" } + .interrupt =3D { "csiphy2" }, + .ops =3D &csiphy_ops_3ph_1_0 }, /* CSIPHY3 */ { @@ -707,7 +743,8 @@ static const struct camss_subdev_resources csiphy_res_8= 250[] =3D { .clock_rate =3D { { 400000000 }, { 300000000 } }, .reg =3D { "csiphy3" }, - .interrupt =3D { "csiphy3" } + .interrupt =3D { "csiphy3" }, + .ops =3D &csiphy_ops_3ph_1_0 }, /* CSIPHY4 */ { @@ -716,7 +753,8 @@ static const struct camss_subdev_resources csiphy_res_8= 250[] =3D { .clock_rate =3D { { 400000000 }, { 300000000 } }, .reg =3D { "csiphy4" }, - .interrupt =3D { "csiphy4" } + .interrupt =3D { "csiphy4" }, + .ops =3D &csiphy_ops_3ph_1_0 }, /* CSIPHY5 */ { @@ -725,7 +763,8 @@ static const struct camss_subdev_resources csiphy_res_8= 250[] =3D { .clock_rate =3D { { 400000000 }, { 300000000 } }, .reg =3D { "csiphy5" }, - .interrupt =3D { "csiphy5" } + .interrupt =3D { "csiphy5" }, + .ops =3D &csiphy_ops_3ph_1_0 } }; =20 @@ -740,7 +779,8 @@ static const struct camss_subdev_resources csid_res_825= 0[] =3D { { 100000000, 200000000, 300000000, 400000000 }, { 0 } }, .reg =3D { "csid0" }, - .interrupt =3D { "csid0" } + .interrupt =3D { "csid0" }, + .ops =3D &csid_ops_gen2 }, /* CSID1 */ { @@ -752,7 +792,8 @@ static const struct camss_subdev_resources csid_res_825= 0[] =3D { { 100000000, 200000000, 300000000, 400000000 }, { 0 } }, .reg =3D { "csid1" }, - .interrupt =3D { "csid1" } + .interrupt =3D { "csid1" }, + .ops =3D &csid_ops_gen2 }, /* CSID2 */ { @@ -763,7 +804,8 @@ static const struct camss_subdev_resources csid_res_825= 0[] =3D { { 400000000, 480000000 }, { 0 } }, .reg =3D { "csid2" }, - .interrupt =3D { "csid2" } + .interrupt =3D { "csid2" }, + .ops =3D &csid_ops_gen2 }, /* CSID3 */ { @@ -774,7 +816,8 @@ static const struct camss_subdev_resources csid_res_825= 0[] =3D { { 400000000, 480000000 }, { 0 } }, .reg =3D { "csid3" }, - .interrupt =3D { "csid3" } + .interrupt =3D { "csid3" }, + .ops =3D &csid_ops_gen2 } }; =20 @@ -797,6 +840,7 @@ static const struct camss_subdev_resources vfe_res_8250= [] =3D { .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, .line_num =3D 4, + .ops =3D &vfe_ops_480 }, /* VFE1 */ { @@ -816,6 +860,7 @@ static const struct camss_subdev_resources vfe_res_8250= [] =3D { .reg =3D { "vfe1" }, .interrupt =3D { "vfe1" }, .line_num =3D 4, + .ops =3D &vfe_ops_480 }, /* VFE2 (lite) */ { @@ -834,6 +879,7 @@ static const struct camss_subdev_resources vfe_res_8250= [] =3D { .reg =3D { "vfe_lite0" }, .interrupt =3D { "vfe_lite0" }, .line_num =3D 4, + .ops =3D &vfe_ops_480 }, /* VFE3 (lite) */ { @@ -852,6 +898,7 @@ static const struct camss_subdev_resources vfe_res_8250= [] =3D { .reg =3D { "vfe_lite1" }, .interrupt =3D { "vfe_lite1" }, .line_num =3D 4, + .ops =3D &vfe_ops_480 }, }; =20 diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/plat= form/qcom/camss/camss.h index fc02aa84a5dd7..8acad7321c09d 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -49,6 +49,7 @@ struct camss_subdev_resources { char *reg[CAMSS_RES_MAX]; char *interrupt[CAMSS_RES_MAX]; u8 line_num; + const void *ops; }; =20 struct icc_bw_tbl { --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 133EBCE7A99 for ; Mon, 25 Sep 2023 15:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232521AbjIYPrr (ORCPT ); Mon, 25 Sep 2023 11:47:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231464AbjIYPrd (ORCPT ); Mon, 25 Sep 2023 11:47:33 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AEC11B0 for ; Mon, 25 Sep 2023 08:47:21 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40572aeb6d0so31600275e9.1 for ; Mon, 25 Sep 2023 08:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656839; x=1696261639; 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=XhSKtn1WWoetbFcEPefpk8WL/CMtB2nONd2TgD1HTnc=; b=a+qYhljL1C/V066XBe5dZ7FqjupeM+qrarX+trLPW9j+kyO1yoRxCMQfHK1vn8USlR d2Hq/16C3cJ1KmEym1zi8vgJbVRQwsWIJC4PTP/+WZAaPRyYTkq0iP3hAiZm8fJ90+kZ qxZTpcrevIV3WUnakufumRaGJnBBNRLRnGECHb+cn2DClVBt++88c67zabJ4Ly3QNnzx lYiyw1dplBHSyC1DAnMK8oBTxhe16BeKSbsezaDL47s1zkgxODiu3TLvCOytVoXcusop ss+7n+5+uktxBNDVANe1h04qz+3grk91vaztPwaWl2NDyxiD/wEtmrgHUsYJPCKKB/u1 kWJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656840; x=1696261640; 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=XhSKtn1WWoetbFcEPefpk8WL/CMtB2nONd2TgD1HTnc=; b=Win3F9BDoqxVTrdJzV6WSzbi5IGT+IJ2kqgCEAT0yU+DCLbFZx9ZfTNBJcyq0mFoT+ mW/8SW13lJgNhyuz64lFNEcrwcV8x9QQnoCDAvKI1RIkA3sjvOyAu9PqQG6lzWS2sYaL +UJx0MT/XYoIakGeCy86fA/FMcFtFP357Y68bO/KLWBNgluKbhmC+c0b8mAP0PzAnm4l boVYys8gsDfj1iJW3dkB4nFCanFVWOuS9/qRn5foyN6R7FGLGrE7mGtUcNrA43ZFhIci 9PUp7I7HdcK7fvQOMPEWQfBKo9Ykuq+B35Uw3o+mNyfULY9pogCrcG0w6zT4iGZgkAWP wJow== X-Gm-Message-State: AOJu0YwUy1Wtmh/Ig7AgXtcwcxFyvZGLJkL3PtU2i1ybDvG4tqVmuXjq BX0B3ZxYOvYzUfk9GiFtoUU7iQ== X-Google-Smtp-Source: AGHT+IF3/kX/IsfEDqGbANuV/GKw0nYXoU2maXmedXQCLdb4WJ8/qOgQ3XPyAznzEKF/1EpXttn29A== X-Received: by 2002:a5d:6382:0:b0:319:8c35:378 with SMTP id p2-20020a5d6382000000b003198c350378mr6188318wru.44.1695656839745; Mon, 25 Sep 2023 08:47:19 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:19 -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 08/17] media: qcom: camss: Assign the correct number of RDIs per VFE Date: Mon, 25 Sep 2023 16:46:58 +0100 Message-ID: <20230925154707.837542-9-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Each Video Front End - VFE - has a variable number of Raw Data Interfaces - RDIs associated with it. The CAMSS code started from a naive implementation where a fixed define was used as a control in a for(){} loop iterating through RDIs. That model scales badly. An attempt was made with VFE_LINE_NUM_GEN2 and VFE_LINE_NUM_GEN1 to differentiate between SoCs but, the problem with that is "gen1" and "gen2" have no meaning in the silicon. There is no fixed constraint in the silicon between VFE and RDI, it is entirely up to the SoC designers how many VFEs are populated and how many RDIs to associate with each VFE. As an example sdm845 has VFE version 175 and sm8250 VFE version 480. sdm845 has 2 VFEs with 4 RDIs and 1 VFE Lite with 4 RDIs. sm8250 has 2 VFEs with 3 RDIs and 2 VFE Lite with 4 RDIs. Clearly then we need a more granular model to capture the necessary data. The defines have gone away to be replaced with per-SoC data but, we haven't populated the parameter data with the real values. Let's call those values out now msm8916: 1 x VFE 3 x RDI per VFE (not 4) msm8996: 2 x VFE 3 x RDI per VFE (not 4) sdm660: 2 x VFE 3 x RDI per VFE (not 4) sdm845: 2 x VFE 4 x RDI per VFE (not 3) 1 x VFE Lite 4 x RDI per VFE Lite (not 3) sm8250: 2 x VFE 3 x RDI per VFE (not 4) 2 x VFE Lite 4 x RDI per VFE Lite This more complex and correct mapping was not possible prior to passing values via driver data. Now that we have that change in place we can correctly map VFEs to RDIs for each VFE. Signed-off-by: Bryan O'Donoghue Acked-by: Konrad Dybcio Reviewed-by: Laurent Pinchart --- drivers/media/platform/qcom/camss/camss-vfe.h | 2 -- drivers/media/platform/qcom/camss/camss.c | 20 +++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/= platform/qcom/camss/camss-vfe.h index b4bae9f65c68f..4783afa73a365 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.h +++ b/drivers/media/platform/qcom/camss/camss-vfe.h @@ -52,9 +52,7 @@ enum vfe_line_id { VFE_LINE_RDI0 =3D 0, VFE_LINE_RDI1 =3D 1, VFE_LINE_RDI2 =3D 2, - VFE_LINE_NUM_GEN2 =3D 3, VFE_LINE_PIX =3D 3, - VFE_LINE_NUM_GEN1 =3D 4, VFE_LINE_NUM_MAX =3D 4 }; =20 diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/plat= form/qcom/camss/camss.c index 12131d9ea7ca8..8e78dd8d5961e 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -128,7 +128,7 @@ static const struct camss_subdev_resources vfe_res_8x16= [] =3D { { 0 } }, .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, - .line_num =3D VFE_LINE_NUM_GEN1, + .line_num =3D 3, .ops =3D &vfe_ops_4_1 } }; @@ -277,7 +277,7 @@ static const struct camss_subdev_resources vfe_res_8x96= [] =3D { { 0 } }, .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, - .line_num =3D VFE_LINE_NUM_GEN1, + .line_num =3D 3, .ops =3D &vfe_ops_4_7 }, =20 @@ -297,7 +297,7 @@ static const struct camss_subdev_resources vfe_res_8x96= [] =3D { { 0 } }, .reg =3D { "vfe1" }, .interrupt =3D { "vfe1" }, - .line_num =3D VFE_LINE_NUM_GEN1, + .line_num =3D 3, .ops =3D &vfe_ops_4_7 } }; @@ -467,7 +467,7 @@ static const struct camss_subdev_resources vfe_res_660[= ] =3D { { 0 } }, .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, - .line_num =3D VFE_LINE_NUM_GEN1, + .line_num =3D 3, .ops =3D &vfe_ops_4_8 }, =20 @@ -490,7 +490,7 @@ static const struct camss_subdev_resources vfe_res_660[= ] =3D { { 0 } }, .reg =3D { "vfe1" }, .interrupt =3D { "vfe1" }, - .line_num =3D VFE_LINE_NUM_GEN1, + .line_num =3D 3, .ops =3D &vfe_ops_4_8 } }; @@ -657,7 +657,7 @@ static const struct camss_subdev_resources vfe_res_845[= ] =3D { { 384000000 } }, .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, - .line_num =3D VFE_LINE_NUM_GEN2, + .line_num =3D 4, .ops =3D &vfe_ops_170 }, =20 @@ -679,7 +679,7 @@ static const struct camss_subdev_resources vfe_res_845[= ] =3D { { 384000000 } }, .reg =3D { "vfe1" }, .interrupt =3D { "vfe1" }, - .line_num =3D VFE_LINE_NUM_GEN2, + .line_num =3D 4, .ops =3D &vfe_ops_170 }, =20 @@ -700,7 +700,7 @@ static const struct camss_subdev_resources vfe_res_845[= ] =3D { { 384000000 } }, .reg =3D { "vfe_lite" }, .interrupt =3D { "vfe_lite" }, - .line_num =3D VFE_LINE_NUM_GEN2, + .line_num =3D 4, .ops =3D &vfe_ops_170 } }; @@ -839,7 +839,7 @@ static const struct camss_subdev_resources vfe_res_8250= [] =3D { { 0 } }, .reg =3D { "vfe0" }, .interrupt =3D { "vfe0" }, - .line_num =3D 4, + .line_num =3D 3, .ops =3D &vfe_ops_480 }, /* VFE1 */ @@ -859,7 +859,7 @@ static const struct camss_subdev_resources vfe_res_8250= [] =3D { { 0 } }, .reg =3D { "vfe1" }, .interrupt =3D { "vfe1" }, - .line_num =3D 4, + .line_num =3D 3, .ops =3D &vfe_ops_480 }, /* VFE2 (lite) */ --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADE15CE7A9F for ; Mon, 25 Sep 2023 15:47:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232964AbjIYPru (ORCPT ); Mon, 25 Sep 2023 11:47:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232845AbjIYPrd (ORCPT ); Mon, 25 Sep 2023 11:47:33 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DB9B1B6 for ; Mon, 25 Sep 2023 08:47:22 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-405524e6768so44432755e9.2 for ; Mon, 25 Sep 2023 08:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656840; x=1696261640; 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=/FNhGMWyAqnTDmM0T1BgOt5wrTJ6u2MeyoOMIg65gD0=; b=lqizoEq/FP8ekp2IT6uQ7TZWuakSu6fVuj3Z5IUAoZlMH1SmU6CLRgfSOS4PQ8Ip/u ez70MLj70fgl3Rc9aRqmFd+CBmkzqMP2aDYA78Wr0QywX/+cNA+vKtiurihKPEgH64Mm bgLk+q2MWwTu6cUbQidCi3S1bSfWvMvboSaGIy5fJpWQGadlRWEhvhYLMUuff6qELhSe 0qC2O/Bl6WnRBJfqJBYoiEhd9JGAIIkH/dHXiYocez+KkQtTYyk5tISDpFYCGmxDX64F Po3B94ny2n1rWDAbp/rGNw5vtcehBD81zQfpnlS8l5WUeXobTJ6rqxGR1WW99eQBE47l c/Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656840; x=1696261640; 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=/FNhGMWyAqnTDmM0T1BgOt5wrTJ6u2MeyoOMIg65gD0=; b=Yr0G0h6W4BHVna5wbdenyDtWaLX3iSmaWk4UV41EBjBxJ6XFbIqbyJVuZzpBz2/fyc FoSRS/v81cZvTpGjIIxgMWNvX3gKEuT2cdurXresCVheecItyFn9RzmxXAEAkwYz0ZkL h2pws39Gy6H0AT1Xf0bwHEm5wXe2/6/4OCohtg+kXaU5Dsmvleik2z1NPbiqxhtuhQ5b fCzVG9OF57UjZq56JPI9bLLkgbTQBcgNfZhoTPqeJgUqMEFxEsvRtsDKW/4Akbvxepw+ SpSlpakRJDkChQW+z1ntZ/4nC5VJITFQ89aispFeJgxsw7Xy6ED0BNbxUE+jyG+kwmO7 OnCw== X-Gm-Message-State: AOJu0YwfSepd06hF1lwX4vQDLdCd+3caWKwg+RneNRxARYd2km8wWBD6 5oWlRndteNz4mdfggKhyyaoQ6g== X-Google-Smtp-Source: AGHT+IHPewfmUTn3VJZZkJ1LALUg4OCR6Ppp1kOmtKKZJ1+1wkDuA12DIwYUZw2q4FtqMfpboyjMMg== X-Received: by 2002:a05:600c:b42:b0:3f6:58ad:ed85 with SMTP id k2-20020a05600c0b4200b003f658aded85mr5876872wmr.10.1695656840766; Mon, 25 Sep 2023 08:47:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:20 -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 09/17] media: qcom: camss: Remove special case for VFE get/put Date: Mon, 25 Sep 2023 16:46:59 +0100 Message-ID: <20230925154707.837542-10-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From sdm845 onwards we need to ensure the VFE is powered on prior to switching on the CSID. Currently the code tests for sdm845, sm8250 and then does get/set. This is not extensible and it turns out is not necessary either since vfe_get and vfe_set reference count. Remove the over-conservative SoC version check. Signed-off-by: Bryan O'Donoghue Suggested-by: Laurent Pinchart Tested-by: Bryan O'Donoghue # rb3 # db410c Reviewed-by: Laurent Pinchart --- drivers/media/platform/qcom/camss/camss-csid.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media= /platform/qcom/camss/camss-csid.c index 99f651e2021cb..95873f988f7e2 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -159,15 +159,17 @@ static int csid_set_power(struct v4l2_subdev *sd, int= on) struct camss *camss =3D csid->camss; struct device *dev =3D camss->dev; struct vfe_device *vfe =3D &camss->vfe[csid->id]; - u32 version =3D camss->res->version; int ret =3D 0; =20 if (on) { - if (version =3D=3D CAMSS_8250 || version =3D=3D CAMSS_845) { - ret =3D vfe_get(vfe); - if (ret < 0) - return ret; - } + /* + * From SDM845 onwards, the VFE needs to be powered on before + * switching on the CSID. Do so unconditionally, as there is no + * drawback in following the same powering order on older SoCs. + */ + ret =3D vfe_get(vfe); + if (ret < 0) + return ret; =20 ret =3D pm_runtime_resume_and_get(dev); if (ret < 0) @@ -217,8 +219,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int o= n) regulator_bulk_disable(csid->num_supplies, csid->supplies); pm_runtime_put_sync(dev); - if (version =3D=3D CAMSS_8250 || version =3D=3D CAMSS_845) - vfe_put(vfe); + vfe_put(vfe); } =20 return ret; --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75A95CE7A8C for ; Mon, 25 Sep 2023 15:48:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233308AbjIYPsI (ORCPT ); Mon, 25 Sep 2023 11:48:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232976AbjIYPrf (ORCPT ); Mon, 25 Sep 2023 11:47:35 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA96ACCF for ; Mon, 25 Sep 2023 08:47:23 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-32001d16a14so6465551f8f.1 for ; Mon, 25 Sep 2023 08:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656842; x=1696261642; 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=379UQYxpAxza5TcrO1uyZtcU91VH4r4NWvGfZfDBNQU=; b=MNjcK0yri2jZ4587XZyaCe0i2VJcsGmlGkxv9O1tWNKLVhI2a9UyRG06GaJxFAJyVy KtxwTLJnHu9xUvvOcfUL7bcQZdbAfyo7VFro8XZ8LONc4lAloYqK5Zk/IzOd6CTuQQcv 1B4dDN/kS5e0bjYlgkty0bTvZrxlRtxubsHZxU4zQ2e119cgWDIxtVHwGWp1sZW7mR6J 4nePOLJTyef4s27kNux+p95F9fDEKWFhFdKMmCNAADPqhhdexaPjLHuSVCWlbjzXoh/b Wnh56q6qQW0hiAijH7ReLae6hMo9fna9vq6NWkp3bDuTPnxpTvV3yNqgblUJMXBCdQDI Dz3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656842; x=1696261642; 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=379UQYxpAxza5TcrO1uyZtcU91VH4r4NWvGfZfDBNQU=; b=R6irbRE2mTCiv1XFnAtv5zSC2psdyVhg5LnQ8isui1Uqk2Pa8blKcJADMsDvm9dnAD cZ9PpHjKjY2bIJusgeZwxXne0c8I1Ij8WpbYKh/Oo/o0dDGYihKlm3M0jjQW7QPfK6of eDo7RsjXyGouqKPAC5A8eHuRhxYf1xRES3GxCi+XSMKYsRS6ZzLQz9prgfMeRXiqfwG0 gY6hRwQsdA75qpUK3VnoHGDKL6ifox6uVnJrwTsU+6rFXfV0vzCflmPNHe2UKDIoOLLx Wd/go1Gx3rsIJLqqdUiR4U/ODEykYl6t9jJla/eV34WOeulRfl8lZmbS/oJAer5w5apF Hasw== X-Gm-Message-State: AOJu0YyhNrt4fL6VvGZXr7uvTp4JVrCcplKHkEjZrYjI+2uhayAb7sV6 Iu8pGaumNKRydCshvLpESLuEGw== X-Google-Smtp-Source: AGHT+IG6iYt3MQH0mw9JIrEs215Em10WXkmZFAZGh1HC0sOSCzT1bSzNVrPPhrpwnBeRUWwyL7p+Fg== X-Received: by 2002:a05:6000:11c6:b0:321:7844:de44 with SMTP id i6-20020a05600011c600b003217844de44mr5532767wrx.45.1695656842188; Mon, 25 Sep 2023 08:47:22 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:21 -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 10/17] media: qcom: camss: Untangle if/else spaghetti in camss Date: Mon, 25 Sep 2023 16:47:00 +0100 Message-ID: <20230925154707.837542-11-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" We have a very convoluted if/else legacy here which needs to be rationalised to make it more sustainable. Adding in another Soc or two will make some of these if statements into increasingly large multi-clause behemoths. Introduce switches in the obvious places to despaghetiify. Signed-off-by: Bryan O'Donoghue Acked-by: Konrad Dybcio --- .../media/platform/qcom/camss/camss-csiphy.c | 16 +++++---- drivers/media/platform/qcom/camss/camss-vfe.c | 33 +++++++++++-------- .../media/platform/qcom/camss/camss-video.c | 17 +++++----- 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/med= ia/platform/qcom/camss/camss-csiphy.c index 4310a132dcbe2..18f9a4defb2a4 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -558,19 +558,21 @@ int msm_csiphy_subdev_init(struct camss *camss, csiphy->cfg.combo_mode =3D 0; csiphy->ops =3D res->ops; =20 - if (camss->res->version =3D=3D CAMSS_8x16) { + switch (camss->res->version) { + case CAMSS_8x16: csiphy->formats =3D csiphy_formats_8x16; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_8x16); - } else if (camss->res->version =3D=3D CAMSS_8x96 || - camss->res->version =3D=3D CAMSS_660) { + break; + case CAMSS_8x96: + case CAMSS_660: csiphy->formats =3D csiphy_formats_8x96; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_8x96); - } else if (camss->res->version =3D=3D CAMSS_845 || - camss->res->version =3D=3D CAMSS_8250) { + break; + case CAMSS_845: + case CAMSS_8250: csiphy->formats =3D csiphy_formats_sdm845; csiphy->nformats =3D ARRAY_SIZE(csiphy_formats_sdm845); - } else { - return -EINVAL; + break; } =20 /* Memory */ diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/= platform/qcom/camss/camss-vfe.c index 4d5c32d3dddbf..db8f68819ded9 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -170,7 +170,8 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 = sink_code, { struct vfe_device *vfe =3D to_vfe(line); =20 - if (vfe->camss->res->version =3D=3D CAMSS_8x16) + switch (vfe->camss->res->version) { + case CAMSS_8x16: switch (sink_code) { case MEDIA_BUS_FMT_YUYV8_1X16: { @@ -218,10 +219,11 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u3= 2 sink_code, =20 return sink_code; } - else if (vfe->camss->res->version =3D=3D CAMSS_8x96 || - vfe->camss->res->version =3D=3D CAMSS_660 || - vfe->camss->res->version =3D=3D CAMSS_845 || - vfe->camss->res->version =3D=3D CAMSS_8250) + break; + case CAMSS_8x96: + case CAMSS_660: + case CAMSS_845: + case CAMSS_8250: switch (sink_code) { case MEDIA_BUS_FMT_YUYV8_1X16: { @@ -281,8 +283,9 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 = sink_code, =20 return sink_code; } - else - return 0; + break; + } + return 0; } =20 int vfe_reset(struct vfe_device *vfe) @@ -1379,7 +1382,8 @@ int msm_vfe_subdev_init(struct camss *camss, struct v= fe_device *vfe, init_completion(&l->output.sof); init_completion(&l->output.reg_update); =20 - if (camss->res->version =3D=3D CAMSS_8x16) { + switch (camss->res->version) { + case CAMSS_8x16: if (i =3D=3D VFE_LINE_PIX) { l->formats =3D formats_pix_8x16; l->nformats =3D ARRAY_SIZE(formats_pix_8x16); @@ -1387,8 +1391,9 @@ int msm_vfe_subdev_init(struct camss *camss, struct v= fe_device *vfe, l->formats =3D formats_rdi_8x16; l->nformats =3D ARRAY_SIZE(formats_rdi_8x16); } - } else if (camss->res->version =3D=3D CAMSS_8x96 || - camss->res->version =3D=3D CAMSS_660) { + break; + case CAMSS_8x96: + case CAMSS_660: if (i =3D=3D VFE_LINE_PIX) { l->formats =3D formats_pix_8x96; l->nformats =3D ARRAY_SIZE(formats_pix_8x96); @@ -1396,12 +1401,12 @@ int msm_vfe_subdev_init(struct camss *camss, struct= vfe_device *vfe, l->formats =3D formats_rdi_8x96; l->nformats =3D ARRAY_SIZE(formats_rdi_8x96); } - } else if (camss->res->version =3D=3D CAMSS_845 || - camss->res->version =3D=3D CAMSS_8250) { + break; + case CAMSS_845: + case CAMSS_8250: l->formats =3D formats_rdi_845; l->nformats =3D ARRAY_SIZE(formats_rdi_845); - } else { - return -EINVAL; + break; } } =20 diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/medi= a/platform/qcom/camss/camss-video.c index 46a89b5f6c171..a89da5ef47109 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -1006,7 +1006,8 @@ int msm_video_register(struct camss_video *video, str= uct v4l2_device *v4l2_dev, =20 mutex_init(&video->lock); =20 - if (video->camss->res->version =3D=3D CAMSS_8x16) { + switch (video->camss->res->version) { + case CAMSS_8x16: if (is_pix) { video->formats =3D formats_pix_8x16; video->nformats =3D ARRAY_SIZE(formats_pix_8x16); @@ -1014,8 +1015,9 @@ int msm_video_register(struct camss_video *video, str= uct v4l2_device *v4l2_dev, video->formats =3D formats_rdi_8x16; video->nformats =3D ARRAY_SIZE(formats_rdi_8x16); } - } else if (video->camss->res->version =3D=3D CAMSS_8x96 || - video->camss->res->version =3D=3D CAMSS_660) { + break; + case CAMSS_8x96: + case CAMSS_660: if (is_pix) { video->formats =3D formats_pix_8x96; video->nformats =3D ARRAY_SIZE(formats_pix_8x96); @@ -1023,13 +1025,12 @@ int msm_video_register(struct camss_video *video, s= truct v4l2_device *v4l2_dev, video->formats =3D formats_rdi_8x96; video->nformats =3D ARRAY_SIZE(formats_rdi_8x96); } - } else if (video->camss->res->version =3D=3D CAMSS_845 || - video->camss->res->version =3D=3D CAMSS_8250) { + break; + case CAMSS_845: + case CAMSS_8250: video->formats =3D formats_rdi_845; video->nformats =3D ARRAY_SIZE(formats_rdi_845); - } else { - ret =3D -EINVAL; - goto error_video_register; + break; } =20 ret =3D msm_video_init_format(video); --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B96F8CE7A95 for ; Mon, 25 Sep 2023 15:48:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233301AbjIYPsF (ORCPT ); Mon, 25 Sep 2023 11:48:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233000AbjIYPrg (ORCPT ); Mon, 25 Sep 2023 11:47:36 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0016CDD for ; Mon, 25 Sep 2023 08:47:24 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4050bd2e33aso70703385e9.2 for ; Mon, 25 Sep 2023 08:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656843; x=1696261643; 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=CoIa8wF5+G+9paPu3DsV7tlZQlCYsdgLjYXarfRsMUMMSlUJ113jQD1esOz1w1qWR0 ZhJ8wd2FkHqfnJVlgaCTsMF4mklKJ0m3cRIUh9VDOPBtRIY7jyShsaPI20PZ4amb371E AbUVdktik3vvr6dyde9Xaqdot/MbmtGk8J9NAJhFOOpw7hELDV+ajXSsyyd8O61xD/rl X0AS72R2scCBe5LA2hytAkZNA1Ut6RjnbaAipDwxnSgrrc9+cjSdZRfFuKjd6hasacc4 VVMXi03IZoDONXtJi53Aj23xpr7aRnw9rDWaDSCAj4teToIwQOXoSxPWnaqTrrc/R0H9 6lDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656843; x=1696261643; 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=PYCSMHnGJjbNLp4ApNLrVIHJBAQvaJMDkwqbZ6TKOwG6OEjef7JUY4NAWJig50qaeD 5suxB8xz9bADW484ccd+iNpa5rTU6rJ6VzV9859Eno/gwGHQSC3rb6GzbmXZaodXlK7w K1xJyyq8fPBkZOPu8SAvs1ESDt4M61KmTh3RzsJMyVmqLJUaW0E6aQ+tR+bqWMsVCR9C 9C4q6u3TSZ1ZmM/klJEAaJZkLjRangyx4DWn/SVT+irnVY09g0ThUqYU6ZxuEcjzHrBf l/fawZFD9bjaPRA7eOwgRLE/2w42wpjc88eNV5E91al1ROjLMTmfts2gqzbGmBG6DyhF KcVg== X-Gm-Message-State: AOJu0Yzew/CnlWXhme9jM/tS0VqwyQg+xD2YZ8ZIaIafMN+9L729iyN8 JwO1otp/dUTRWvKiCqmI/vg1nQ== X-Google-Smtp-Source: AGHT+IFaTtE2r2aD+gOeeOLNCKtL4Sp+uvnRBvHv+FBQpBtDux414w82G/M3U4xGGNghpEkdiiLbMg== X-Received: by 2002:a05:600c:2108:b0:404:7480:d821 with SMTP id u8-20020a05600c210800b004047480d821mr5866400wml.37.1695656843248; Mon, 25 Sep 2023 08:47:23 -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.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:22 -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 11/17] media: qcom: camss: Allow clocks vfeN vfe_liteN or vfe_lite Date: Mon, 25 Sep 2023 16:47:01 +0100 Message-ID: <20230925154707.837542-12-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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); } =20 +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 =3D 0; i < vfe->nclocks; i++) { struct camss_clock *clock =3D &vfe->clock[i]; =20 - if (!strcmp(clock->name, "vfe0") || - !strcmp(clock->name, "vfe1") || - !strcmp(clock->name, "vfe_lite")) { + if (vfe_match_clock_names(vfe, clock)) { u64 min_rate =3D 0; long rate; =20 @@ -537,9 +549,7 @@ static int vfe_check_clock_rates(struct vfe_device *vfe) for (i =3D 0; i < vfe->nclocks; i++) { struct camss_clock *clock =3D &vfe->clock[i]; =20 - if (!strcmp(clock->name, "vfe0") || - !strcmp(clock->name, "vfe1") || - !strcmp(clock->name, "vfe_lite")) { + if (vfe_match_clock_names(vfe, clock)) { u64 min_rate =3D 0; unsigned long rate; =20 --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCF23CE7A8C for ; Mon, 25 Sep 2023 15:47:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233259AbjIYPr5 (ORCPT ); Mon, 25 Sep 2023 11:47:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233019AbjIYPrg (ORCPT ); Mon, 25 Sep 2023 11:47:36 -0400 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBBF8C0 for ; Mon, 25 Sep 2023 08:47:25 -0700 (PDT) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-404fbfac998so75579095e9.3 for ; Mon, 25 Sep 2023 08:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656844; x=1696261644; 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=ifKMgYO+e5m0ffw4v7ouj4QBUnl9Qz7bbgTpHwp8oVo=; b=K+57JA1JTNQddncyEyFtdVtdRHABVLYfi6DobSLG9gpCkHtqW6GPQubP9Hr+vkNDZN kRu0ySF0mvgUXkFrPmHa/Gc3DFqUoM770Cb5hDS2xLLAXTMusRQmZ2Nv3Kvlod4yXyZ8 Phi7SWuaotMMRVGTQpg6IWE8H8J8yfivpR59a+FJC7Isyk7ak9+xyHiOl+JItuCFZ+Mq pUmqdOj9z8oJJTmUqQ5TTNItJeII3zvvLgQ9R6K5eb2thnf1vg0Ux5TjRyDsls7hL8aY xCcOBODJsHd9U2ywL6yVikulhCUMxnTJAWgfj6wNs3pyPtl/zdM1y1te2y2BZWMWzjNN 2CrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656844; x=1696261644; 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=ifKMgYO+e5m0ffw4v7ouj4QBUnl9Qz7bbgTpHwp8oVo=; b=XGiVxN5IxTACUDTwWY/2H1MO3JDtdtzHFjjnX3TSjduoBn/0sUjia5z9jz0noIzks+ sjhzpjDkMQ/Nz23GGp74s4Tl2IRvJyQGoh+RfngGAgohWFMKnChasBwgN0KFvUN0Qlof gc+N7+C7Pw+REHtaolikB2V+F98GNFFEkefoaUhNePnl7OfWaoFxbc5a7N5T5760CcHn U8yyqhUcgT9DOdD/wM7IGK7rTLhOVkC93sMLt6/Dg0HjqzielSD9bFLhDMkbdXgVzbGV Mw8FWsCuH83Qa4aa6VhVgK2jJQgR1VSnlTaYV2mDB45SkV6wGXSi/iMLDRDRKRZPyjG+ XqPQ== X-Gm-Message-State: AOJu0Yxgc/7dgEDyBd1ELjC3Lje2J6k2FIJ/INSJJFAUVhxWonc9MP6h 3u7jRU2F8iY1CELdujV7KVxV+qsefmAF8U/JSOw= X-Google-Smtp-Source: AGHT+IFB3x9FVfLq1RzYVJOQig2A9+R2ANR8n7wE/7G1IY2rXniFcll8+aMurXlmQ4f59RoETV2MbQ== X-Received: by 2002:a05:600c:291:b0:404:fc5c:15ed with SMTP id 17-20020a05600c029100b00404fc5c15edmr6507315wmk.35.1695656844381; Mon, 25 Sep 2023 08:47:24 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:24 -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 12/17] media: qcom: camss: Functionally decompose CSIPHY clock lookups Date: Mon, 25 Sep 2023 16:47:02 +0100 Message-ID: <20230925154707.837542-13-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The csiphyX_timer and csiX_phy values need not be hard-coded. We can functionally decompose the string matching inside of a loop. Static string values are brittle, difficult to extend and not required anyway since the camss->res->csiphy_num value informs us of the number of CSIPHYs and hence the set of potential clocks for a given CSIPHY. In simple terms if we have five CSIPHYs we can have no more and no less than five csiphy_timer clocks. Similarly csi_phy core clocks have a 1:1 relationship with the PHY they clock. Signed-off-by: Bryan O'Donoghue --- .../media/platform/qcom/camss/camss-csiphy.c | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/med= ia/platform/qcom/camss/camss-csiphy.c index 18f9a4defb2a4..20bb361e9ad05 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -536,6 +536,15 @@ static int csiphy_init_formats(struct v4l2_subdev *sd, return csiphy_set_format(sd, fh ? fh->state : NULL, &format); } =20 +static bool csiphy_match_clock_name(const char *clock_name, const char *fo= rmat, + int index) +{ + char name[16]; /* csiphyXXX_timer\0 */ + + snprintf(name, sizeof(name), format, index); + return !strcmp(clock_name, name); +} + /* * msm_csiphy_subdev_init - Initialize CSIPHY device structure and resourc= es * @csiphy: CSIPHY device @@ -550,7 +559,7 @@ int msm_csiphy_subdev_init(struct camss *camss, { struct device *dev =3D camss->dev; struct platform_device *pdev =3D to_platform_device(dev); - int i, j; + int i, j, k; int ret; =20 csiphy->camss =3D camss; @@ -656,19 +665,19 @@ int msm_csiphy_subdev_init(struct camss *camss, for (j =3D 0; j < clock->nfreqs; j++) clock->freq[j] =3D res->clock_rate[i][j]; =20 - if (!strcmp(clock->name, "csiphy0_timer") || - !strcmp(clock->name, "csiphy1_timer") || - !strcmp(clock->name, "csiphy2_timer") || - !strcmp(clock->name, "csiphy3_timer") || - !strcmp(clock->name, "csiphy4_timer") || - !strcmp(clock->name, "csiphy5_timer")) - csiphy->rate_set[i] =3D true; - - if (camss->res->version =3D=3D CAMSS_660 && - (!strcmp(clock->name, "csi0_phy") || - !strcmp(clock->name, "csi1_phy") || - !strcmp(clock->name, "csi2_phy"))) - csiphy->rate_set[i] =3D true; + for (k =3D 0; k < camss->res->csiphy_num; k++) { + csiphy->rate_set[i] =3D csiphy_match_clock_name(clock->name, + "csiphy%d_timer", k); + if (csiphy->rate_set[i]) + break; + + if (camss->res->version =3D=3D CAMSS_660) { + csiphy->rate_set[i] =3D csiphy_match_clock_name(clock->name, + "csi%d_phy", k); + if (csiphy->rate_set[i]) + break; + } + } } =20 return 0; --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10C7FCE7A99 for ; Mon, 25 Sep 2023 15:47:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232766AbjIYPsB (ORCPT ); Mon, 25 Sep 2023 11:48:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233035AbjIYPrg (ORCPT ); Mon, 25 Sep 2023 11:47:36 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3C9E109 for ; Mon, 25 Sep 2023 08:47:26 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-307d58b3efbso5658960f8f.0 for ; Mon, 25 Sep 2023 08:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656845; x=1696261645; 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=5xDdHYwLfg0JHODBOnX5/PYY4PGuDuMNIjsuATRv640=; b=yi39ZKbwvkkRU1QBDvj6QMHYmLSVA/E1dXe57UugoqF6n9nqJWeWweRdaDtvQnylV7 Ci0GeN8jZ4VtWa0xZIHNHmDwEuLzjogNfdtmqiQ0ldcFFhToFg07oRQs+mn0HlgStrcw fJ4KXwtr2TIpCjACpRJmeQglXFjbIhyTpGR5ObEpqrUxUOr6nEqnbcGpbeZjfs70B9a5 BhqSatkKdmOr9+8tiwr535JvLWRmkjVJ+pffC5CvibPTEznDXVd9WnhRDryOqTYexHkT 8oa6rsrVR1ftDyW66PH+3T6zXGIcFHGC6JFrBYXY6MTd47qWvyWxiVyhSBU0jmt97OPB sKSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656845; x=1696261645; 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=5xDdHYwLfg0JHODBOnX5/PYY4PGuDuMNIjsuATRv640=; b=Pk4mxtqlbSEytgEXPFdTxjb4wwLHtncZXQY+kLTYY/Y6Pvu//vCUKpjR9KZodiSHf0 390+6cuHEFw3vroBTbkZ66pJlBwcDxJOoTr2UI+bS0IcytE8ZyoXN7FKbQUyDsClQtoA Kilbtp7SJVH5eP4zVYFDpr9I+R1h/bg9GpFEicvdnPYWXcRt5KW6y9vS8M4KDMypY43r gKHQzx4qnWdEuujHs/MDcSw/8fYOQY4Ibd2vdeOPLT4HDcqWahPBEF3PDICVIcUxi1W4 4R9Px3BtxyFh2quVzrNCPdfrxHpUGow/yfWPoveIEE6+UO+QJMXCvJDl4OCX7BMWXtQE WbUg== X-Gm-Message-State: AOJu0YzLep0Mr/f5uBHNJ1RkcbYYpPy4be4qQmbwTasAYaA6TQq/gOaE x/05kynvRDkGdbPN9gY9bZGTKg== X-Google-Smtp-Source: AGHT+IHSCTlbHdkPGAqDOco6h4l/Y2ePHoAE9D7YIGnMLawkb6DROeXAHd6DcQpVRXOfaDnDr4TRvw== X-Received: by 2002:adf:f485:0:b0:317:f046:25ef with SMTP id l5-20020adff485000000b00317f04625efmr6665188wro.44.1695656845402; Mon, 25 Sep 2023 08:47:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:25 -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 13/17] media: qcom: camss: Fix support for setting CSIPHY clock name csiphyX Date: Mon, 25 Sep 2023 16:47:03 +0100 Message-ID: <20230925154707.837542-14-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Several of our upstream and soon-to-be upstream SoC CAMSS dtsi declare csiphyX as opposed to the older clock name csiX_phy. Right now the CAMSS code will fail to set the csiphyX clock even if we have declared it in our list of clocks. For sdm845 and sm8250 we appear to "get away" with this error, however on sc8280xp we don't. The right approach here is to set the clock when it is declared. If a SoC doesn't require or a SoC driver implementer doesn't think we need, then the clock ought to simply be omitted from the clock list. Include csiphyX in the set of permissible strings which will subsequently lead to the csiphyX clock being set during csiphy_set_clock_rates() phase. sdm845 and sm8250 will work with the code as-is so I've omitted this from a suggested Fixes list. Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csiphy.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/med= ia/platform/qcom/camss/camss-csiphy.c index 20bb361e9ad05..edd573606a6ae 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -677,6 +677,10 @@ int msm_csiphy_subdev_init(struct camss *camss, if (csiphy->rate_set[i]) break; } + + csiphy->rate_set[i] =3D csiphy_match_clock_name(clock->name, "csiphy%d"= , k); + if (csiphy->rate_set[i]) + break; } } =20 --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E5CACE7A8C for ; Mon, 25 Sep 2023 15:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233325AbjIYPsR (ORCPT ); Mon, 25 Sep 2023 11:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233065AbjIYPrh (ORCPT ); Mon, 25 Sep 2023 11:47:37 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C324CE0 for ; Mon, 25 Sep 2023 08:47:28 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-32001d16a14so6465695f8f.1 for ; Mon, 25 Sep 2023 08:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656846; x=1696261646; 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=3XAtVUAyBOvnRtU7QZlyMg2OvJJmAGTuY+WdBD311GM=; b=S4hVx2sg6CupCNOx2qU7m93mxgYGuycrwGF4RdfeS3PfCKN3/fYUZTRLd3O8ISaoir 6Mzo7pnZj/VHQH0SYSvsp3ePdn+aJ/DthJ0aK6gSyB622+ezndn5WnRqn0/nVl3zn8kh kL1D123DlCtzdZJ3dwQ760VMASOhkWvX8wJZWOoVx5CT+bk6c3Pkcfh83shyjYh7rEeO zLb0SR1WmW9w6b2IYqNPLijne8nUu8HaayGkIUr8j3JKwjjxAlvcFFEdP5YDjZjNTIGt nIonMwDMNyZD7FJyyK6TYGRZkTeOh8R9Orb8cCTDOXEOpG/134JbYyJi1LJHr/MaVRD5 0Yww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656846; x=1696261646; 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=3XAtVUAyBOvnRtU7QZlyMg2OvJJmAGTuY+WdBD311GM=; b=eS+YZ1OtbAMlFN0s9WhGUMSBGSsJKK62jR9bgHeDjJNP2zo5fnwyvnerJFZIYZUEet fb960DIbtK+86uNz/je2U4V4KZKrSrh43u2oitgX3lRrp5KHQooCj4J3Ycolun60O5LM dkRCYJj2A5JbjA+i9ao3r4n7OHdZ/o4usYL8sMpeiulI9dxs7rO8cnmR5YNLVivBYj+G 9IakpJkkKqjs4HkZnsAq27VDjczT/ehKPwQibq/RE/kGjpeEy3Z0qQVTZcc3EcpKzDcE 0202S/ryUA0jPrcW2+9wHhsDK9cLrEOHR8jDyfPSouiIEgI2jwQvBXmpQ7euFUhhXF3f G8fA== X-Gm-Message-State: AOJu0Yw+2mtldd+7kVemSHN4dLXfWe4fItYTdFPMgGiUAhmxDcTKHPko m3L0mzrKmRN2mn7xvPbv+B3yGw== X-Google-Smtp-Source: AGHT+IGIsB4mLYETZvmkEyZcLWQPGapkBfLeHfY3+rXnsGeMiVp+S19QaagA0CKyurcmaGBgvdGfAQ== X-Received: by 2002:adf:e4c9:0:b0:322:db93:41ab with SMTP id v9-20020adfe4c9000000b00322db9341abmr6252935wrm.0.1695656846518; Mon, 25 Sep 2023 08:47:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:26 -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 14/17] media: qcom: camss: Support RDI3 for VFE 17x Date: Mon, 25 Sep 2023 16:47:04 +0100 Message-ID: <20230925154707.837542-15-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Some VFEs have four RDIs apiece. Right now the ISR code has a hard-coded value which tops-out at RDI2 meaning only three RDIs can be utilised in practice. Extend out the various routines in camss-vfe-17x.c to support the higher RDI count. Signed-off-by: Bryan O'Donoghue Acked-by: Konrad Dybcio Reviewed-by: Laurent Pinchart --- drivers/media/platform/qcom/camss/camss-vfe-170.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-170.c index 2ba7160b3bd1e..a5aa799501861 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-170.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c @@ -209,7 +209,8 @@ static void vfe_global_reset(struct vfe_device *vfe) GLOBAL_RESET_CMD_IDLE_CGC | GLOBAL_RESET_CMD_RDI0 | GLOBAL_RESET_CMD_RDI1 | - GLOBAL_RESET_CMD_RDI2; + GLOBAL_RESET_CMD_RDI2 | + GLOBAL_RESET_CMD_RDI3; =20 writel_relaxed(BIT(31), vfe->base + VFE_IRQ_MASK_0); =20 @@ -343,7 +344,7 @@ static void vfe_violation_read(struct vfe_device *vfe) static irqreturn_t vfe_isr(int irq, void *dev) { struct vfe_device *vfe =3D dev; - u32 status0, status1, vfe_bus_status[3]; + u32 status0, status1, vfe_bus_status[VFE_LINE_NUM_MAX]; int i, wm; =20 status0 =3D readl_relaxed(vfe->base + VFE_IRQ_STATUS_0); @@ -352,7 +353,7 @@ static irqreturn_t vfe_isr(int irq, void *dev) writel_relaxed(status0, vfe->base + VFE_IRQ_CLEAR_0); writel_relaxed(status1, vfe->base + VFE_IRQ_CLEAR_1); =20 - for (i =3D VFE_LINE_RDI0; i <=3D VFE_LINE_RDI2; i++) { + for (i =3D VFE_LINE_RDI0; i < vfe->line_num; i++) { vfe_bus_status[i] =3D readl_relaxed(vfe->base + VFE_BUS_IRQ_STATUS(i)); writel_relaxed(vfe_bus_status[i], vfe->base + VFE_BUS_IRQ_CLEAR(i)); } @@ -366,11 +367,11 @@ static irqreturn_t vfe_isr(int irq, void *dev) if (status0 & STATUS_0_RESET_ACK) vfe->isr_ops.reset_ack(vfe); =20 - for (i =3D VFE_LINE_RDI0; i <=3D VFE_LINE_RDI2; i++) + for (i =3D VFE_LINE_RDI0; i < vfe->line_num; i++) if (status0 & STATUS_0_RDI_REG_UPDATE(i)) vfe->isr_ops.reg_update(vfe, i); =20 - for (i =3D VFE_LINE_RDI0; i <=3D VFE_LINE_RDI2; i++) + for (i =3D VFE_LINE_RDI0; i < vfe->line_num; i++) if (status0 & STATUS_1_RDI_SOF(i)) vfe->isr_ops.sof(vfe, i); =20 --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A1EBCE7A95 for ; Mon, 25 Sep 2023 15:48:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233330AbjIYPsT (ORCPT ); Mon, 25 Sep 2023 11:48:19 -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-Google-Smtp-Source: AGHT+IHcWoDdMuI7kSu4vsSLJ/2Y1jUOmLeUhLb9CixcS6s9pjJzhkwAOlxSNCMo5Q4G/AyLyW/ajQ== 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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/me= dia/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; } =20 -static void vfe_disable_output(struct vfe_line *line) -{ - struct vfe_device *vfe =3D to_vfe(line); - struct vfe_output *output =3D &line->output; - unsigned long flags; - unsigned int i; - - spin_lock_irqsave(&vfe->output_lock, flags); - for (i =3D 0; i < output->wm_num; i++) - vfe_wm_stop(vfe, output->wm_idx[i]); - output->gen2.active_num =3D 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; } =20 -/* - * 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 =3D 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 =3D { .vfe_enable =3D vfe_enable, .vfe_halt =3D vfe_halt, .violation_read =3D vfe_violation_read, + .vfe_wm_stop =3D vfe_wm_stop, }; diff --git a/drivers/media/platform/qcom/camss/camss-vfe-480.c b/drivers/me= dia/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; } =20 -static void vfe_disable_output(struct vfe_line *line) -{ - struct vfe_device *vfe =3D to_vfe(line); - struct vfe_output *output =3D &line->output; - unsigned long flags; - unsigned int i; - - spin_lock_irqsave(&vfe->output_lock, flags); - for (i =3D 0; i < output->wm_num; i++) - vfe_wm_stop(vfe, output->wm_idx[i]); - output->gen2.active_num =3D 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; } =20 -/* - * 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 =3D 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 =3D { .vfe_disable =3D vfe_disable, .vfe_enable =3D vfe_enable, .vfe_halt =3D vfe_halt, + .vfe_wm_stop =3D 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; } =20 +static int vfe_disable_output(struct vfe_line *line) +{ + struct vfe_device *vfe =3D to_vfe(line); + struct vfe_output *output =3D &line->output; + unsigned long flags; + unsigned int i; + + spin_lock_irqsave(&vfe->output_lock, flags); + for (i =3D 0; i < output->wm_num; i++) + vfe->ops->vfe_wm_stop(vfe, output->wm_idx[i]); + output->gen2.active_num =3D 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 =3D 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); }; =20 struct vfe_isr_ops { @@ -192,6 +193,14 @@ int vfe_reserve_wm(struct vfe_device *vfe, enum vfe_li= ne_id line_id); */ int vfe_reset(struct vfe_device *vfe); =20 +/* + * 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; --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E52AACE7A8C for ; Mon, 25 Sep 2023 15:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233150AbjIYPsW (ORCPT ); Mon, 25 Sep 2023 11:48:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233116AbjIYPri (ORCPT ); Mon, 25 Sep 2023 11:47:38 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FB2F12A for ; Mon, 25 Sep 2023 08:47:30 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3215f19a13aso6600153f8f.3 for ; Mon, 25 Sep 2023 08:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656848; x=1696261648; 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=8DxLhsFGQa0BTkz7p4gD6/w8EaSRpwpvd+XFr08IQZw=; b=LZlnh0xUnVJ5e6ELnJk4teq+a0xyXb9CtxIjXENsIDXStmEHIVNNWK2sP+9iGIbkP8 VXeWqQdAO7TISU4WvEG8vHRjmYtN8u9dqVvGwVTnG1qouaZuBKMguT+QP0UfAR9958Bg 20ysUECGyEV0di8JW/2EG/wXcdGbftZ+AjHlphhnuIsn3RoUEZNZ48XNrXUPebHgHDrc 8Zy3jxg8mkMD9r/44tZVZO4wrFheb6I7F8xEOcYxARLp3EiDwk0eYMabVlR8P5XH1O5d 2zz7YjGpTD/IS5yCVWAbnNNRE40cwPr5JsP2oyVcmApBMsUf3YCrl1nvJnR9pw0cz1os objA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656848; x=1696261648; 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=8DxLhsFGQa0BTkz7p4gD6/w8EaSRpwpvd+XFr08IQZw=; b=Xszweacip0+1oCIgh6TiUm0wx+OYF3eJneZ/M5tmBagSHiIkToCz4fSY/9d4r8unWU QW12XCIfvZqZ0z7t164jcWG8Eally4W0HwsoGjk8ch07c9O6Y5j7BzuuAE29sMaUvfZf fKolMylv0AoY3hNjEtSBw7MU3AqQBjqC7CZ/27b6r1McwPHhy/gKCL9fuy7I1fIAV++Q vGu5qjofaGeonhhz3159pPlqad5Z36nGWCABMHu6jjWBjwyA0oMCdN2ZeJTCCAkpoxE7 Kmi0/wtTSg9Pp8JVNKow6QdqNUjbpcNIcXXsIucxFync8qTAEI29SJdZTauGQ7/lxcwk AaHA== X-Gm-Message-State: AOJu0YzXT/tltqIFevoR+k4IHPJhPmZ/L4CkK96jzhZbGhg4QuI8Kho0 UqQNeXZAFIc1wvtNcZ87ftvmug== X-Google-Smtp-Source: AGHT+IH+9c2e0yXhNRnuueGYs+KCwAvyqn08ir8+5lwMbxXYdPD4eJuMwQeJXJEHlMDrbQ2hom055Q== X-Received: by 2002:a5d:6a0c:0:b0:314:ca7:f30b with SMTP id m12-20020a5d6a0c000000b003140ca7f30bmr6183611wru.54.1695656848598; Mon, 25 Sep 2023 08:47:28 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:28 -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 16/17] media: qcom: camss: Propagate vfe_reset error up the callstack Date: Mon, 25 Sep 2023 16:47:06 +0100 Message-ID: <20230925154707.837542-17-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" A previous patch I had removed the returns from vfe_disable() since we didn't trap any meaningful errors. Konrad pointed out vfe_reset() could return an error, which is true. Trap the vfe_reset() error code and throw it up the callstack. Suggested-by: Konrad Dybcio Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-vfe.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/= platform/qcom/camss/camss-vfe.c index b3d5af7f09690..4839e2cedfe58 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -435,8 +435,11 @@ static int vfe_disable_output(struct vfe_line *line) int vfe_disable(struct vfe_line *line) { struct vfe_device *vfe =3D to_vfe(line); + int ret; =20 - vfe_disable_output(line); + ret =3D vfe_disable_output(line); + if (ret) + goto error; =20 vfe_put_output(line); =20 @@ -446,7 +449,8 @@ int vfe_disable(struct vfe_line *line) =20 mutex_unlock(&vfe->stream_lock); =20 - return 0; +error: + return ret; } =20 /** --=20 2.42.0 From nobody Wed Dec 17 05:48:18 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8493DCE7A8C for ; Mon, 25 Sep 2023 15:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233346AbjIYPs1 (ORCPT ); Mon, 25 Sep 2023 11:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232889AbjIYPri (ORCPT ); Mon, 25 Sep 2023 11:47:38 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 373271B3 for ; Mon, 25 Sep 2023 08:47:31 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4053c6f1087so57795415e9.0 for ; Mon, 25 Sep 2023 08:47:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695656849; x=1696261649; 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=yKTR9FGAJbp1Nit0RKPxQtBceNed5p1nXP0aMRVoGew=; b=fHa419QvOcMY3fX1MkE/QRM/XI/th837ZFDNaLME2XfJn65nuWG0W1GjL9Mh7toEMO xfDltwaBv+WgSYDIGDKJFFdxvfFjfep96BwPItoeXfLnj/QigJSIerF1H5lJVm2jYZSY hzYvBjJWMS5mBAAAc2CVtaCmlxFvfOuGRdPT4CWmFmJqaYkJACXsd04pAeIfxYNZ/EMj QOx81lZQ6WqitIKgim1Z0ldwGloM7v/xp8z9vwWHGZjKmLXT9nDWzRQ9Mep2egV5d18W 5Wr07w03xPpP9IMmU3Ztdqc9dR++CnPz5nywekPUqpE9UaxXCfASOVF3gCQDoD8Qy8i+ KL9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695656849; x=1696261649; 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=yKTR9FGAJbp1Nit0RKPxQtBceNed5p1nXP0aMRVoGew=; b=wv9/u3hnBV8t63kwyu+o8pcHZQzW9xcsSabWcWAHcozeY1EQrVZv/6MV8yimQeGV2M 4eTlzGOr/BncLRuxjNpw/tCCG10AwYTj06pQ6Q2wymQXV0urJviYFGxw1TJ6PrT7jEBF p0sL50ZpfIPJ0FHizxDI3oYMYUNIwrjawk56PZuOV04WmOKR1s7osswtyO9/UTfiJE7L ATm3KAr7E/0MllyBYb8YIbOqyMEodksow24ZUvqz86aoowjFYlWEymSiwwV/D2RhZFnv 6Gu80GPKd4auSZZKAM/xY4A+oXC/yTdoAOECyqJqk+Hd2aK91TRW4JkCeLe5KJUy3IzW livQ== X-Gm-Message-State: AOJu0YxD8833UK9Of5CisCC9zHL5iUJBRgVNkdJwNG0ic2Kc2NBKh1/z wLjyEVkggl81/uM0lO9x0JIf3A== X-Google-Smtp-Source: AGHT+IFKeZu788gHWgsRongPTtFe1L8P+ypwnDHQNU1kHF/IJhSKZslu+Zrp5iqyGWbQVXRGeB/6pA== X-Received: by 2002:a7b:c456:0:b0:405:2d23:16d9 with SMTP id l22-20020a7bc456000000b004052d2316d9mr5885861wmi.21.1695656849715; Mon, 25 Sep 2023 08:47:29 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:47:29 -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 17/17] media: qcom: camss: Comment CSID dt_id field Date: Mon, 25 Sep 2023 16:47:07 +0100 Message-ID: <20230925154707.837542-18-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Digging into the documentation we find that the DT_ID bitfield is used to map the six bit DT to a two bit ID code. This value is concatenated to the VC bitfield to create a CID value. DT_ID is the two least significant bits of CID and VC the most significant bits. Originally we set dt_id =3D vc * 4 in and then subsequently set dt_id =3D v= c. commit 3c4ed72a16bc ("media: camss: sm8250: Virtual channels for CSID") silently fixed the multiplication by four which would give a better value for the generated CID without mentioning what was being done or why. Next up I haplessly changed the value back to "dt_id =3D vc * 4" since there didn't appear to be any logic behind it. Hans asked what the change was for and I honestly couldn't remember the provenance of it, so I dug in. Link: https://lore.kernel.org/linux-arm-msm/edd4bf9b-0e1b-883c-1a4d-50f4102= c3924@xs4all.nl/ Add a comment so the next hapless programmer doesn't make this same mistake. Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csid-gen2.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/media/platform/qcom/camss/camss-csid-gen2.c b/drivers/= media/platform/qcom/camss/camss-csid-gen2.c index 6ba2b10326444..791f27b18c394 100644 --- a/drivers/media/platform/qcom/camss/camss-csid-gen2.c +++ b/drivers/media/platform/qcom/camss/camss-csid-gen2.c @@ -352,6 +352,18 @@ static void __csid_configure_stream(struct csid_device= *csid, u8 enable, u8 vc) phy_sel =3D csid->phy.csiphy_id; =20 if (enable) { + /* + * DT_ID is a two bit bitfield that is concatenated with + * the four least significant bits of the six bit VC + * bitfield to generate an internal CID value. + * + * CSID_RDI_CFG0(vc) + * DT_ID : 28:27 + * VC : 26:22 + * DT : 21:16 + * + * CID : VC 3:0 << 2 | DT_ID 1:0 + */ u8 dt_id =3D vc; =20 if (tg->enabled) { --=20 2.42.0