diff mbox series

[v0,8/9] media: qcom: camss: Fix set CSI2_RX_CFG1_VC_MODE when VC is greater than 3

Message ID 20230814141007.3721197-9-bryan.odonoghue@linaro.org
State New
Headers show
Series media: qcom: camss: Bugfix series | expand

Commit Message

Bryan O'Donoghue Aug. 14, 2023, 2:10 p.m. UTC
VC_MODE = 0 implies a two bit VC address.
VC_MODE = 1 is required for VCs with a larger address than two bits.

Fixes: eebe6d00e9bf ("media: camss: Add support for CSID hardware version Titan 170")
Cc: stable@vger.kernel.org
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/media/platform/qcom/camss/camss-csid-gen2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Bryan O'Donoghue Aug. 21, 2023, 10:13 a.m. UTC | #1
On 21/08/2023 10:53, Hans Verkuil wrote:
> Hi Bryan,
> 
> On 14/08/2023 16:10, Bryan O'Donoghue wrote:
>> VC_MODE = 0 implies a two bit VC address.
>> VC_MODE = 1 is required for VCs with a larger address than two bits.
> 
> This explains the second chunk in the patch below, but it doesn't explain
> why dt_id is now suddenly vc * 4 instead of vc.
> 
> I don't feel comfortable merging this patch since I'm not sure if that
> dt_id change was perhaps an error.
> 
> If the change IS correct, then please reply and provide a better commit
> log.

 From memory that's a copy/paste from the original qcom code.

I'll verify that and repost a better commit log.

---
bod
Bryan O'Donoghue Aug. 21, 2023, 6:51 p.m. UTC | #2
On 21/08/2023 10:53, Hans Verkuil wrote:
> +		u8 dt_id = vc * 4;

You're right.

dt_id = vc is wrong but so is dt_id = vc * 4.

I'll post a fix for the dt_id as a separate patch.

---
bod
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/camss/camss-csid-gen2.c b/drivers/media/platform/qcom/camss/camss-csid-gen2.c
index 45c7986d4a8d0..9ac253111e572 100644
--- a/drivers/media/platform/qcom/camss/camss-csid-gen2.c
+++ b/drivers/media/platform/qcom/camss/camss-csid-gen2.c
@@ -352,7 +352,7 @@  static void __csid_configure_stream(struct csid_device *csid, u8 enable, u8 vc)
 		phy_sel = csid->phy.csiphy_id;
 
 	if (enable) {
-		u8 dt_id = vc;
+		u8 dt_id = vc * 4;
 
 		if (tg->enabled) {
 			/* Config Test Generator */
@@ -449,6 +449,8 @@  static void __csid_configure_stream(struct csid_device *csid, u8 enable, u8 vc)
 	writel_relaxed(val, csid->base + CSID_CSI2_RX_CFG0);
 
 	val = 1 << CSI2_RX_CFG1_PACKET_ECC_CORRECTION_EN;
+	if (vc > 3)
+		val |= 1 << CSI2_RX_CFG1_VC_MODE;
 	val |= 1 << CSI2_RX_CFG1_MISR_EN;
 	writel_relaxed(val, csid->base + CSID_CSI2_RX_CFG1);