linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] media: qcom: camss: tpg: Add tpg support for qcs8300
@ 2025-07-17  4:18 Wenmeng Liu
  2025-07-28 15:28 ` Bryan O'Donoghue
  0 siblings, 1 reply; 2+ messages in thread
From: Wenmeng Liu @ 2025-07-17  4:18 UTC (permalink / raw)
  To: Robert Foss, Todor Tomov, Bryan O'Donoghue,
	Mauro Carvalho Chehab
  Cc: linux-media, linux-arm-msm, linux-kernel, Wenmeng Liu

Add support for TPG found on QCS8300.

Signed-off-by: Wenmeng Liu <quic_wenmliu@quicinc.com>
---
QCS8300 is a Qualcomm SoC. This series adds driver changes to
bring up TPG in QCS8300.

Tested with following commands:
- media-ctl --reset
- v4l2-ctl -d /dev/v4l-subdev0 -c test_pattern=0
- media-ctl -V '"msm_tpg0":0[fmt:SRGGB10/4608x2592 field:none]'
- media-ctl -V '"msm_csid0":0[fmt:SRGGB10/4608x2592 field:none]'
- media-ctl -V '"msm_vfe0_rdi0":0[fmt:SRGGB10/4608x2592 field:none]'
- media-ctl -l '"msm_tpg0":1->"msm_csid0":0[1]'
- media-ctl -l '"msm_csid0":1->"msm_vfe0_rdi0":0[1]'
- v4l2-ctl -d /dev/v4l-subdev3 -c test_pattern=9
- yavta -B capture-mplane -n 5 -f SRGGB10P -s 4608x2592 /dev/video0
  --capture=7

Dependencies:
https://lore.kernel.org/all/20250717-lemans_tpg-v2-0-a2538659349c@quicinc.com/

Changes in v2:
- rebase tpg changes based on new versions of sa8775p and qcs8300 camss patches
- Link to v1: https://lore.kernel.org/all/20250217-qcs8300_tpg-v1-1-6e0f4dd3ad1f@quicinc.com/
---
 drivers/media/platform/qcom/camss/camss.c | 52 ++++++++++++++++++++++++++++++-
 1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
index ced31e3655a52a7b2e55b109085cf24a9e230f1d..68411e4a5c55b394145ba907f18cb03e235dcc23 100644
--- a/drivers/media/platform/qcom/camss/camss.c
+++ b/drivers/media/platform/qcom/camss/camss.c
@@ -2548,6 +2548,53 @@ static const struct camss_subdev_resources csiphy_res_8300[] = {
 	},
 };
 
+static const struct camss_subdev_resources tpg_res_8300[] = {
+	/* TPG0 */
+	{
+		.regulators = {  },
+		.clock = { "csiphy_rx" },
+		.clock_rate = { { 400000000 } },
+		.reg = { "tpg0" },
+		.interrupt = { "tpg0" },
+		.tpg = {
+			.lane_cnt = 4,
+			.vc_cnt = 1,
+			.formats = &tpg_formats_gen1,
+			.hw_ops = &tpg_ops_gen1
+		}
+	},
+
+	/* TPG1 */
+	{
+		.regulators = {  },
+		.clock = { "csiphy_rx" },
+		.clock_rate = { { 400000000 } },
+		.reg = { "tpg1" },
+		.interrupt = { "tpg1" },
+		.tpg = {
+			.lane_cnt = 4,
+			.vc_cnt = 1,
+			.formats = &tpg_formats_gen1,
+			.hw_ops = &tpg_ops_gen1
+		}
+	},
+
+	/* TPG2 */
+	{
+		.regulators = {  },
+		.clock = { "csiphy_rx" },
+		.clock_rate = { { 400000000 } },
+		.reg = { "tpg2" },
+		.interrupt = { "tpg2" },
+		.tpg = {
+			.lane_cnt = 4,
+			.vc_cnt = 1,
+			.formats = &tpg_formats_gen1,
+			.hw_ops = &tpg_ops_gen1
+		}
+	},
+};
+
 static const struct camss_subdev_resources csid_res_8300[] = {
 	/* CSID0 */
 	{
@@ -4492,7 +4539,8 @@ static int camss_probe(struct platform_device *pdev)
 	if (!camss->csiphy)
 		return -ENOMEM;
 
-	if (camss->res->version == CAMSS_8775P) {
+	if (camss->res->version == CAMSS_8775P ||
+	    camss->res->version == CAMSS_8300) {
 		camss->tpg = devm_kcalloc(dev, camss->res->tpg_num,
 					  sizeof(*camss->tpg), GFP_KERNEL);
 		if (!camss->tpg)
@@ -4677,11 +4725,13 @@ static const struct camss_resources qcs8300_resources = {
 	.version = CAMSS_8300,
 	.pd_name = "top",
 	.csiphy_res = csiphy_res_8300,
+	.tpg_res = tpg_res_8300,
 	.csid_res = csid_res_8300,
 	.csid_wrapper_res = &csid_wrapper_res_qcs8300,
 	.vfe_res = vfe_res_8300,
 	.icc_res = icc_res_qcs8300,
 	.csiphy_num = ARRAY_SIZE(csiphy_res_8300),
+	.tpg_num = ARRAY_SIZE(tpg_res_8300),
 	.csid_num = ARRAY_SIZE(csid_res_8300),
 	.vfe_num = ARRAY_SIZE(vfe_res_8300),
 	.icc_path_num = ARRAY_SIZE(icc_res_qcs8300),

---
base-commit: dc3d6ecbfebec02791feea0b08062540badcb5a2
change-id: 20250717-qcs8300_tpg-f7735e998310

Best regards,
-- 
Wenmeng Liu <quic_wenmliu@quicinc.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] media: qcom: camss: tpg: Add tpg support for qcs8300
  2025-07-17  4:18 [PATCH v2] media: qcom: camss: tpg: Add tpg support for qcs8300 Wenmeng Liu
@ 2025-07-28 15:28 ` Bryan O'Donoghue
  0 siblings, 0 replies; 2+ messages in thread
From: Bryan O'Donoghue @ 2025-07-28 15:28 UTC (permalink / raw)
  To: Wenmeng Liu, Robert Foss, Todor Tomov, Mauro Carvalho Chehab
  Cc: linux-media, linux-arm-msm, linux-kernel

On 17/07/2025 05:18, Wenmeng Liu wrote:
> Add support for TPG found on QCS8300.
> 
> Signed-off-by: Wenmeng Liu <quic_wenmliu@quicinc.com>
> ---
> QCS8300 is a Qualcomm SoC. This series adds driver changes to
> bring up TPG in QCS8300.
> 
> Tested with following commands:
> - media-ctl --reset
> - v4l2-ctl -d /dev/v4l-subdev0 -c test_pattern=0
> - media-ctl -V '"msm_tpg0":0[fmt:SRGGB10/4608x2592 field:none]'
> - media-ctl -V '"msm_csid0":0[fmt:SRGGB10/4608x2592 field:none]'
> - media-ctl -V '"msm_vfe0_rdi0":0[fmt:SRGGB10/4608x2592 field:none]'
> - media-ctl -l '"msm_tpg0":1->"msm_csid0":0[1]'
> - media-ctl -l '"msm_csid0":1->"msm_vfe0_rdi0":0[1]'
> - v4l2-ctl -d /dev/v4l-subdev3 -c test_pattern=9
> - yavta -B capture-mplane -n 5 -f SRGGB10P -s 4608x2592 /dev/video0
>    --capture=7
> 
> Dependencies:
> https://lore.kernel.org/all/20250717-lemans_tpg-v2-0-a2538659349c@quicinc.com/
> 
> Changes in v2:
> - rebase tpg changes based on new versions of sa8775p and qcs8300 camss patches
> - Link to v1: https://lore.kernel.org/all/20250217-qcs8300_tpg-v1-1-6e0f4dd3ad1f@quicinc.com/
> ---
>   drivers/media/platform/qcom/camss/camss.c | 52 ++++++++++++++++++++++++++++++-
>   1 file changed, 51 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index ced31e3655a52a7b2e55b109085cf24a9e230f1d..68411e4a5c55b394145ba907f18cb03e235dcc23 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c
> @@ -2548,6 +2548,53 @@ static const struct camss_subdev_resources csiphy_res_8300[] = {
>   	},
>   };
>   
> +static const struct camss_subdev_resources tpg_res_8300[] = {
> +	/* TPG0 */
> +	{
> +		.regulators = {  },

you can drop the explicit empty set.

> +		.clock = { "csiphy_rx" },
> +		.clock_rate = { { 400000000 } },
> +		.reg = { "tpg0" },
> +		.interrupt = { "tpg0" },
> +		.tpg = {
> +			.lane_cnt = 4,
> +			.vc_cnt = 1,
> +			.formats = &tpg_formats_gen1,
> +			.hw_ops = &tpg_ops_gen1
> +		}
> +	},
> +
> +	/* TPG1 */
> +	{
> +		.regulators = {  },
> +		.clock = { "csiphy_rx" },
> +		.clock_rate = { { 400000000 } },
> +		.reg = { "tpg1" },
> +		.interrupt = { "tpg1" },
> +		.tpg = {
> +			.lane_cnt = 4,
> +			.vc_cnt = 1,
> +			.formats = &tpg_formats_gen1,
> +			.hw_ops = &tpg_ops_gen1
> +		}
> +	},
> +
> +	/* TPG2 */
> +	{
> +		.regulators = {  },
> +		.clock = { "csiphy_rx" },
> +		.clock_rate = { { 400000000 } },
> +		.reg = { "tpg2" },
> +		.interrupt = { "tpg2" },

Does the TPG interrupt do something ? AFIAK it does not.

Drop dead array entries and unused ISRs.

> +		.tpg = {
> +			.lane_cnt = 4,
> +			.vc_cnt = 1,
> +			.formats = &tpg_formats_gen1,
> +			.hw_ops = &tpg_ops_gen1
> +		}
> +	},
> +};

> +
>   static const struct camss_subdev_resources csid_res_8300[] = {
>   	/* CSID0 */
>   	{
> @@ -4492,7 +4539,8 @@ static int camss_probe(struct platform_device *pdev)
>   	if (!camss->csiphy)
>   		return -ENOMEM;
>   
> -	if (camss->res->version == CAMSS_8775P) {
> +	if (camss->res->version == CAMSS_8775P ||
> +	    camss->res->version == CAMSS_8300) {
>   		camss->tpg = devm_kcalloc(dev, camss->res->tpg_num,

You already know the number of tpgs so there's no sense in pivoting on 
version number.

if (res->tpg_num) {
	devm_kzalloc()
}

>   					  sizeof(*camss->tpg), GFP_KERNEL);
>   		if (!camss->tpg)
> @@ -4677,11 +4725,13 @@ static const struct camss_resources qcs8300_resources = {
>   	.version = CAMSS_8300,
>   	.pd_name = "top",
>   	.csiphy_res = csiphy_res_8300,
> +	.tpg_res = tpg_res_8300,
>   	.csid_res = csid_res_8300,
>   	.csid_wrapper_res = &csid_wrapper_res_qcs8300,
>   	.vfe_res = vfe_res_8300,
>   	.icc_res = icc_res_qcs8300,
>   	.csiphy_num = ARRAY_SIZE(csiphy_res_8300),
> +	.tpg_num = ARRAY_SIZE(tpg_res_8300),
>   	.csid_num = ARRAY_SIZE(csid_res_8300),
>   	.vfe_num = ARRAY_SIZE(vfe_res_8300),
>   	.icc_path_num = ARRAY_SIZE(icc_res_qcs8300),
> 
> ---
> base-commit: dc3d6ecbfebec02791feea0b08062540badcb5a2
> change-id: 20250717-qcs8300_tpg-f7735e998310
> 
> Best regards,
---
bod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-28 15:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-17  4:18 [PATCH v2] media: qcom: camss: tpg: Add tpg support for qcs8300 Wenmeng Liu
2025-07-28 15:28 ` Bryan O'Donoghue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).