Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Depeng Shao <quic_depengs@quicinc.com>
To: Krzysztof Kozlowski <krzk@kernel.org>, <rfoss@kernel.org>,
	<todor.too@gmail.com>, <bryan.odonoghue@linaro.org>,
	<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>,
	Yongsheng Li <quic_yon@quicinc.com>
Subject: Re: [PATCH 09/13] media: qcom: camss: Add CSID Gen3 support for SM8550
Date: Thu, 11 Jul 2024 19:08:54 +0800	[thread overview]
Message-ID: <4c8095dd-4f96-4b0e-9282-8bdfb5badbc3@quicinc.com> (raw)
In-Reply-To: <1da50dd1-b170-4775-94fc-19a10b7f9c47@kernel.org>

Hi Krzysztof,

On 7/10/2024 7:20 PM, Krzysztof Kozlowski wrote:
> On 09/07/2024 18:06, Depeng Shao wrote:
>> The CSID in SM8550 is gen3, it has new register offset and new
>> functionality. The buf done irq,register update and reset are
>> moved to CSID gen3. And CSID gen3 has a new register block which
>> is named as CSID top, it controls the output of CSID, since the
>> CSID can connect to Sensor Front End (SFE) or original VFE, the
>> register in top block is used to control the HW connection.
>>
>> Co-developed-by: Yongsheng Li <quic_yon@quicinc.com>
>> Signed-off-by: Yongsheng Li <quic_yon@quicinc.com>
>> Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
>> ---
>>   drivers/media/platform/qcom/camss/Makefile    |   1 +
>>   .../platform/qcom/camss/camss-csid-gen3.c     | 445 ++++++++++++++++++
>>   .../platform/qcom/camss/camss-csid-gen3.h     |  26 +
>>   .../media/platform/qcom/camss/camss-csid.h    |   2 +
>>   4 files changed, 474 insertions(+)
>>   create mode 100644 drivers/media/platform/qcom/camss/camss-csid-gen3.c
>>   create mode 100644 drivers/media/platform/qcom/camss/camss-csid-gen3.h
>>
>> diff --git a/drivers/media/platform/qcom/camss/Makefile b/drivers/media/platform/qcom/camss/Makefile
>> index e636968a1126..c336e4c1a399 100644
>> --- a/drivers/media/platform/qcom/camss/Makefile
>> +++ b/drivers/media/platform/qcom/camss/Makefile
>> @@ -7,6 +7,7 @@ qcom-camss-objs += \
>>   		camss-csid-4-1.o \
>>   		camss-csid-4-7.o \
>>   		camss-csid-gen2.o \
>> +		camss-csid-gen3.o \
>>   		camss-csiphy-2ph-1-0.o \
>>   		camss-csiphy-3ph-1-0.o \
>>   		camss-csiphy.o \
>> diff --git a/drivers/media/platform/qcom/camss/camss-csid-gen3.c b/drivers/media/platform/qcom/camss/camss-csid-gen3.c
>> new file mode 100644
>> index 000000000000..17fd7c5499de
>> --- /dev/null
>> +++ b/drivers/media/platform/qcom/camss/camss-csid-gen3.c
>> @@ -0,0 +1,445 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * camss-csid-gen3.c
>> + *
>> + * Qualcomm MSM Camera Subsystem - CSID (CSI Decoder) Module
>> + *
>> + * Copyright (c) 2024 Qualcomm Technologies, Inc.
>> + */
>> +#include <linux/completion.h>
>> +#include <linux/delay.h>
>> +#include <linux/interrupt.h>
>> +#include <linux/io.h>
>> +#include <linux/kernel.h>
>> +#include <linux/of.h>
>> +
>> +#include "camss.h"
>> +#include "camss-csid.h"
>> +#include "camss-csid-gen3.h"
>> +
>> +
>> +#define CSID_TOP_IO_PATH_CFG0(csid)	(0x4 * (csid))
>> +#define		OUTPUT_IFE_EN 0x100
>> +#define		INTERNAL_CSID 1
>> +
>> +#define CSID_HW_VERSION		0x0
>> +#define		HW_VERSION_STEPPING	0
>> +#define		HW_VERSION_REVISION	16
>> +#define		HW_VERSION_GENERATION	28
>> +
>> +#define CSID_RST_CFG	0xC
>> +#define		RST_MODE		0
>> +#define		RST_LOCATION	4
>> +
>> +#define CSID_RST_CMD	0x10
>> +#define		SELECT_HW_RST	0
>> +#define		SELECT_SW_RST	1
>> +#define		SELECT_IRQ_RST	2
>> +
>> +#define CSID_CSI2_RX_IRQ_STATUS	0x9C
>> +#define	CSID_CSI2_RX_IRQ_MASK	0xA0
>> +#define CSID_CSI2_RX_IRQ_CLEAR	0xA4
>> +#define CSID_CSI2_RX_IRQ_SET	0xA8
>> +
>> +#define CSID_CSI2_RDIN_IRQ_STATUS(rdi)		(0xEC + 0x10 * (rdi))
>> +#define CSID_CSI2_RDIN_IRQ_MASK(rdi)		(0xF0 + 0x10 * (rdi))
>> +#define   CSID_CSI2_RDIN_INFO_FIFO_FULL 2
> 
> That's a random set of indentations.
> 

Thanks, will fixes this.

>> +#define   CSID_CSI2_RDIN_INFO_CAMIF_EOF 3
>> +#define   CSID_CSI2_RDIN_INFO_CAMIF_SOF 4
>> +#define   CSID_CSI2_RDIN_INFO_INPUT_EOF 9
>> +#define   CSID_CSI2_RDIN_INFO_INPUT_SOF 12
> 
> 
> ...
> 
>> +
>> +	writel_relaxed(val, csid->base + CSID_RDI_CFG0(vc));
>> +
>> +	val = 1 << RDI_CFG1_PACKING_FORMAT;
>> +	val |= 1 << RDI_CFG1_PIX_STORE;
>> +	val |= 1 << RDI_CFG1_DROP_H_EN;
>> +	val |= 1 << RDI_CFG1_DROP_V_EN;
>> +	val |= 1 << RDI_CFG1_CROP_H_EN;
>> +	val |= 1 << RDI_CFG1_CROP_V_EN;
>> +	val |= RDI_CFG1_EARLY_EOF_EN;
>> +
>> +	writel_relaxed(val, csid->base + CSID_RDI_CFG1(vc));
>> +
>> +	val = 0;
>> +	writel_relaxed(val, csid->base + CSID_RDI_IRQ_SUBSAMPLE_PERIOD(vc));
>> +
>> +	val = 1;
>> +	writel_relaxed(val, csid->base + CSID_RDI_IRQ_SUBSAMPLE_PATTERN(vc));
>> +
>> +	val = 0;
>> +	writel_relaxed(val, csid->base + CSID_RDI_CTRL(vc));
>> +
>> +	val = readl_relaxed(csid->base + CSID_RDI_CFG0(vc));
>> +	val |=  enable << RDI_CFG0_EN;
>> +	writel_relaxed(val, csid->base + CSID_RDI_CFG0(vc));
>> +}
>> +
> 
> such patterns and...
> 
>> + */
>> +static int csid_reset(struct csid_device *csid)
>> +{
>> +	unsigned long time;
>> +	u32 val;
>> +	int i;
>> +
>> +	reinit_completion(&csid->reset_complete);
>> +
>> +	writel_relaxed(1, csid->base + CSID_TOP_IRQ_CLEAR);
>> +	writel_relaxed(1, csid->base + CSID_IRQ_CMD);
>> +	writel_relaxed(1, csid->base + CSID_TOP_IRQ_MASK);
>> +
>> +	for (i = 0; i < MSM_CSID_MAX_SRC_STREAMS; i++)
>> +		if (csid->phy.en_vc & BIT(i)) {
>> +			writel_relaxed(BIT(BUF_DONE_IRQ_STATUS_RDI_OFFSET + i),
>> +						csid->base + CSID_BUF_DONE_IRQ_CLEAR);
>> +			writel_relaxed(0x1 << IRQ_CMD_CLEAR, csid->base + CSID_IRQ_CMD);
>> +			writel_relaxed(BIT(BUF_DONE_IRQ_STATUS_RDI_OFFSET + i),
>> +						csid->base + CSID_BUF_DONE_IRQ_MASK);
>> +		}
>> +
>> +	/* preserve registers */
>> +	val = (0x1 << RST_LOCATION) | (0x1 << RST_MODE);
>> +	writel_relaxed(val, csid->base + CSID_RST_CFG);
> 
> ... here - using everywhere relaxed here is odd and looks racy. These
> looks like some strict sequences.
> 
Yes, these are some sequences to initialize the HW.

> 
>> +
>> +	val = (0x1 << SELECT_HW_RST) | (0x1 << SELECT_IRQ_RST);
>> +	writel_relaxed(val, csid->base + CSID_RST_CMD);
>> +
>> +	time = wait_for_completion_timeout(&csid->reset_complete,
>> +					   msecs_to_jiffies(CSID_RESET_TIMEOUT_MS));
>> +	if (!time) {
>> +		dev_err(csid->camss->dev, "CSID reset timeout\n");
>> +		return -EIO;
>> +	}
>> +
> 
> 
>> +
>> +static void csid_subdev_init(struct csid_device *csid)
>> +{
>> +	csid->testgen.modes = csid_testgen_modes;
>> +	csid->testgen.nmodes = CSID_PAYLOAD_MODE_NUM_SUPPORTED_GEN2;
>> +}
>> +
>> +const struct csid_hw_ops csid_ops_gen3 = {
> 
> Isn't there a warning here?
> 
>> +	.configure_stream = csid_configure_stream,
>> +	.configure_testgen_pattern = csid_configure_testgen_pattern,
>> +	.hw_version = csid_hw_version,
>> +	.isr = csid_isr,
>> +	.reset = csid_reset,
>> +	.src_pad_code = csid_src_pad_code,
>> +	.subdev_init = csid_subdev_init,
>> +};
> 
> Your patchset does not apply at all. Tried v6.9, v6.10, next. I see some
> dependency above, but that means no one can test it and no one can apply it.
> 
> Fix the warnings, I cannot verify it but I am sure you have them.
> 

My code base is next master branch, do you mean the 'declared and not 
used' warning? I don't see this warning with below two version compiler 
even though I just pick this patch and pull the code the latest version. 
But it indeed have this issue, these structures are declared and will be 
used later in "media: qcom: camss: Add sm8550 resources" patch, will 
think about how to avoid this.

aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
aarch64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

---

  CALL    scripts/checksyscalls.sh
   CC [M]  drivers/media/platform/qcom/camss/camss-csid.o
   CC [M]  drivers/media/platform/qcom/camss/camss-csid-4-1.o
   CC [M]  drivers/media/platform/qcom/camss/camss-csid-4-7.o
   CC [M]  drivers/media/platform/qcom/camss/camss-csid-gen2.o
   CC [M]  drivers/media/platform/qcom/camss/camss-csid-gen3.o
   CC [M]  drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.o
   CC [M]  drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.o

---

89a4a25b7b56 (HEAD -> master) media: qcom: camss: Add CSID Gen3 support 
for SM8550
d0cfd24496d3 media: qcom: camss: csiphy-3ph: Add Gen2 v1.2 two-phase 
MIPI CSI-2 DPHY init
5795fd39a8ee dt-bindings: media: camss: Add qcom,sm8550-camss binding

> Best regards,
> Krzysztof
> 

Thanks,
Depeng

  reply	other threads:[~2024-07-11 11:09 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09 16:06 [PATCH V3 00/13] media: qcom: camss: Add sm8550 support 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 [this message]
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
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=4c8095dd-4f96-4b0e-9282-8bdfb5badbc3@quicinc.com \
    --to=quic_depengs@quicinc.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@quicinc.com \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@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_eberman@quicinc.com \
    --cc=quic_yon@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