mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Depeng Shao <quic_depengs@quicinc.com>,
	rfoss@kernel.org, todor.too@gmail.com, mchehab@kernel.org,
	robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org
Cc: quic_eberman@quicinc.com, linux-media@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@quicinc.com
Subject: Re: [PATCH 12/13] media: qcom: camss: Add sm8550 support
Date: Wed, 10 Jul 2024 13:02:55 +0100	[thread overview]
Message-ID: <8cc2b819-8342-444e-8a31-582949cb9b3d@linaro.org> (raw)
In-Reply-To: <20240709160656.31146-13-quic_depengs@quicinc.com>

On 09/07/2024 17:06, Depeng Shao wrote:
> Add in functional logic throughout the code to support the SM8550.
> 
> Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
> ---
>   .../media/platform/qcom/camss/camss-csid.c    | 21 +++++++++++++++++++
>   .../qcom/camss/camss-csiphy-3ph-1-0.c         |  6 ++++++
>   drivers/media/platform/qcom/camss/camss-vfe.c |  6 ++++++
>   drivers/media/platform/qcom/camss/camss.h     |  1 +
>   4 files changed, 34 insertions(+)
> 
> diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
> index 858db5d4ca75..90fba25db4c6 100644
> --- a/drivers/media/platform/qcom/camss/camss-csid.c
> +++ b/drivers/media/platform/qcom/camss/camss-csid.c
> @@ -1013,6 +1013,7 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
>   {
>   	struct device *dev = camss->dev;
>   	struct platform_device *pdev = to_platform_device(dev);
> +	struct resource *top_res;
>   	int i, j;
>   	int ret;
>   
> @@ -1040,6 +1041,26 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
>   		else
>   			csid->base = csid->res->parent_dev_ops->get_base_address(camss, id)
>   				 + VFE_480_CSID_OFFSET;
> +	} else if (camss->res->version == CAMSS_8550) {
> +		/* for titan 780, CSID lite registers are inside the VFE lite region,
> +		 * between the VFE "top" and "bus" registers. this requires
> +		 * VFE to be initialized before CSID
> +		 */
> +		if (csid_is_lite(csid))
> +			csid->base =  csid->res->parent_dev_ops->get_base_address(camss, id);
> +		else {
> +			csid->base = devm_platform_ioremap_resource_byname(pdev, res->reg[0]);
> +			/* CSID "top" is a new function in Titan780.
> +			 * CSID can connect to VFE & SFE(Sensor Front End).
> +			 * This connection is ontrolled by CSID "top" registers.
> +			 * CSID "top" registers at only one region.
> +			 */
> +			top_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, res->reg[1]);
> +			csid->top_base = ioremap(top_res->start, resource_size(top_res));
> +		}

If we just specify the csid lite regs in the dts, we don't need custom 
code to get a pointer to them.

Similarly the csid->top_base = () should be generic not SoC specific, 
i.e. we should be able to add in CSID 980 without adding any custom code 
to camss-csid.c

> +
> +		if (IS_ERR(csid->base))
> +			return PTR_ERR(csid->base);
>   	} else {
>   		csid->base = devm_platform_ioremap_resource_byname(pdev, res->reg[0]);
>   		if (IS_ERR(csid->base))
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> index b6d5a27b94a6..53c46c2e5896 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
> @@ -631,6 +631,7 @@ static bool csiphy_is_gen2(u32 version)
>   	case CAMSS_845:
>   	case CAMSS_8250:
>   	case CAMSS_8280XP:
> +	case CAMSS_8550:
>   		ret = true;
>   		break;
>   	}
> @@ -718,6 +719,11 @@ static int csiphy_init(struct csiphy_device *csiphy)
>   		regs->lane_regs = &lane_regs_sc8280xp[0];
>   		regs->lane_array_size = ARRAY_SIZE(lane_regs_sc8280xp);
>   		break;
> +	case CAMSS_8550:
> +		regs->lane_regs = &lane_regs_sm8550[0];
> +		regs->lane_array_size = ARRAY_SIZE(lane_regs_sm8550);
> +		regs->offset = 0x1000;
> +		break;
>   	default:
>   		WARN(1, "unknown csiphy version\n");
>   		return -ENODEV;
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
> index 83c5a36d071f..479474c1cd95 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe.c
> @@ -338,6 +338,7 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code,
>   	case CAMSS_845:
>   	case CAMSS_8250:
>   	case CAMSS_8280XP:
> +	case CAMSS_8550:
>   		switch (sink_code) {
>   		case MEDIA_BUS_FMT_YUYV8_1X16:
>   		{
> @@ -408,6 +409,10 @@ int vfe_reset(struct vfe_device *vfe)
>   
>   	reinit_completion(&vfe->reset_complete);
>   
> +	/* The reset has been moved to csid in 8550 */
> +	if (vfe->camss->res->version == CAMSS_8550)
> +		return 0;
> +

Custom code for a specific SoC in camss.c camss-csid.c or camss-vfe.c 
indicates to me we need to do more work elsewhere.

This would do the same job for you.

static void vfe_global_reset(struct vfe_device *vfe)
{
         /* VFE780 has no global reset, simply report a completion */
         complete(&vfe->reset_complete);
}

const struct vfe_hw_ops vfe_ops_780 = {
         .global_reset = vfe_global_reset,

>   	vfe->res->hw_ops->global_reset(vfe);
>   
>   	time = wait_for_completion_timeout(&vfe->reset_complete,
> @@ -1695,6 +1700,7 @@ static int vfe_bpl_align(struct vfe_device *vfe)
>   	case CAMSS_845:
>   	case CAMSS_8250:
>   	case CAMSS_8280XP:
> +	case CAMSS_8550:
>   		ret = 16;
>   		break;
>   	default:
> diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h
> index 65fcebd42c4b..feac83510a17 100644
> --- a/drivers/media/platform/qcom/camss/camss.h
> +++ b/drivers/media/platform/qcom/camss/camss.h
> @@ -79,6 +79,7 @@ enum camss_version {
>   	CAMSS_845,
>   	CAMSS_8250,
>   	CAMSS_8280XP,
> +	CAMSS_8550,
>   };
>   
>   enum icc_count {

---
bod

  reply	other threads:[~2024-07-10 12:02 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09 16:06 [PATCH V3 00/13] " Depeng Shao
2024-07-09 16:06 ` [PATCH 01/13] media: qcom: camss: csiphy-3ph: Fix trivial indentation fault in defines Depeng Shao
2024-07-31 23:16   ` Vladimir Zapolskiy
2024-07-09 16:06 ` [PATCH 02/13] media: qcom: camss: csiphy-3ph: Remove redundant PHY init sequence control loop Depeng Shao
2024-07-31 23:27   ` Vladimir Zapolskiy
2024-07-09 16:06 ` [PATCH 03/13] media: qcom: camss: csiphy-3ph: Rename struct Depeng Shao
2024-07-31 23:28   ` Vladimir Zapolskiy
2024-07-09 16:06 ` [PATCH 04/13] media: qcom: camss: csiphy: Add an init callback to CSI PHY devices Depeng Shao
2024-07-31 23:43   ` Vladimir Zapolskiy
2024-08-01  8:16     ` Bryan O'Donoghue
2024-08-04 21:26       ` Vladimir Zapolskiy
2024-08-07 13:08         ` Depeng Shao
2024-08-07 14:04           ` Bryan O'Donoghue
2024-08-07 15:03             ` Depeng Shao
2024-08-07 15:37               ` Bryan O'Donoghue
2024-08-08 14:02                 ` Depeng Shao
2024-08-12 11:32                   ` Bryan O'Donoghue
2024-08-12 12:20                     ` Depeng Shao
2024-07-09 16:06 ` [PATCH 05/13] media: qcom: camss: csiphy-3ph: Move CSIPHY variables to data field inside csiphy struct Depeng Shao
2024-07-31 23:55   ` Vladimir Zapolskiy
2024-07-09 16:06 ` [PATCH 06/13] media: qcom: camss: csiphy-3ph: Use an offset variable to find common control regs Depeng Shao
2024-07-09 16:06 ` [PATCH 07/13] dt-bindings: media: camss: Add qcom,sm8550-camss binding Depeng Shao
2024-07-09 20:21   ` Rob Herring (Arm)
2024-07-10  9:37   ` Bryan O'Donoghue
2024-07-10 10:59     ` Depeng Shao
2024-07-10 11:07   ` Krzysztof Kozlowski
2024-07-11 10:43     ` Depeng Shao
2024-08-01  0:05   ` Vladimir Zapolskiy
2024-08-01  2:02     ` Depeng Shao
2024-07-09 16:06 ` [PATCH 08/13] media: qcom: camss: csiphy-3ph: Add Gen2 v1.2 two-phase MIPI CSI-2 DPHY init Depeng Shao
2024-07-10 11:09   ` Krzysztof Kozlowski
2024-07-10 13:14     ` Depeng Shao
2024-07-10 11:13   ` Bryan O'Donoghue
2024-07-10 13:33     ` Depeng Shao
2024-07-09 16:06 ` [PATCH 09/13] media: qcom: camss: Add CSID Gen3 support for SM8550 Depeng Shao
2024-07-10 11:20   ` Krzysztof Kozlowski
2024-07-11 11:08     ` Depeng Shao
2024-07-11 11:12       ` Krzysztof Kozlowski
2024-07-11 11:41         ` Depeng Shao
2024-07-11 12:00           ` Bryan O'Donoghue
2024-07-11 12:14             ` Depeng Shao
2024-07-11 12:17             ` Krzysztof Kozlowski
2024-07-31 15:26         ` Depeng Shao
2024-07-31 16:12           ` Bryan O'Donoghue
2024-08-01  1:53             ` Depeng Shao
2024-08-01 10:59               ` Bryan O'Donoghue
2024-08-01 11:14                 ` Bryan O'Donoghue
2024-08-01 13:49                   ` Depeng Shao
2024-07-10 11:28   ` Bryan O'Donoghue
2024-07-11 15:33     ` Depeng Shao
2024-08-07 15:10       ` Depeng Shao
2024-07-09 16:06 ` [PATCH 10/13] media: qcom: camss: Add support for VFE hardware version Titan 780 Depeng Shao
2024-07-10 11:22   ` Krzysztof Kozlowski
2024-07-10 11:47   ` Bryan O'Donoghue
2024-07-11 13:29     ` Depeng Shao
2024-07-09 16:06 ` [PATCH 11/13] media: qcom: camss: Add notify interface in camss driver Depeng Shao
2024-07-10 11:54   ` Bryan O'Donoghue
2024-07-11 11:54     ` Depeng Shao
2024-07-09 16:06 ` [PATCH 12/13] media: qcom: camss: Add sm8550 support Depeng Shao
2024-07-10 12:02   ` Bryan O'Donoghue [this message]
2024-07-11 14:36     ` Depeng Shao
2024-07-09 16:06 ` [PATCH 13/13] media: qcom: camss: Add sm8550 resources Depeng Shao
2024-07-10 11:08 ` [PATCH V3 00/13] media: qcom: camss: Add sm8550 support Krzysztof Kozlowski
2024-07-10 11:27   ` Depeng Shao
2024-07-10 12:30     ` Krzysztof Kozlowski
2024-07-11 11:14       ` Depeng Shao
2024-08-24 17:05 ` Bryan O'Donoghue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8cc2b819-8342-444e-8a31-582949cb9b3d@linaro.org \
    --to=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@quicinc.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=quic_depengs@quicinc.com \
    --cc=quic_eberman@quicinc.com \
    --cc=rfoss@kernel.org \
    --cc=robh@kernel.org \
    --cc=todor.too@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®