Skip to contentSkip to conversation

ipu3-cio2: Fix pixel-rate derived link frequency

PATCH In review Sakari Ailus 3 participants 4 messages Feb 15, 2021 – Mar 23, 2021

Subsystems (2)
lore
Share & tools
lore

Sakari Ailus

author maintainer
#0 lore raw

PATCH 1/1 ipu3-cio2: Fix pixel-rate derived link frequency

The driver uses v4l2_get_link_freq() helper to obtain the link frequency using the LINK_FREQ but also the PIXEL_RATE control. The divisor for the pixel rate derived link frequency was wrong, missing the bus uses double data rate. Fix this.

Fixes 4b6c129e87a3 ("media: ipu3-cio2: Use v4l2_get_link_freq helper")
---
 drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +1 -1
index 6e8c0c230e11..fecef85bd62e 100644
@@ -302,7 +302,7 @@ static int cio2_csi2_calc_timing(struct cio2_device *cio2, struct cio2_queue *q,
 	if (!q->sensor)
 		return -ENODEV;
 
-	freq = v4l2_get_link_freq(q->sensor->ctrl_handler, bpp, lanes);
+	freq = v4l2_get_link_freq(q->sensor->ctrl_handler, bpp, lanes * 2);
 	if (freq < 0) {
 		dev_err(dev, "error %lld, invalid link_freq\n", freq);
 		return freq;
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw

Hi Sakari,

Thank you for the patch.

Quoted 8 lines · Sakari Ailus

The driver uses v4l2_get_link_freq() helper to obtain the link frequency using the LINK_FREQ but also the PIXEL_RATE control. The divisor for the pixel rate derived link frequency was wrong, missing the bus uses double data rate. Fix this.

Fixes 4b6c129e87a3 ("media: ipu3-cio2: Use v4l2_get_link_freq helper")
Quoted 17 lines
---
 drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +1 -1
index 6e8c0c230e11..fecef85bd62e 100644
@@ -302,7 +302,7 @@ static int cio2_csi2_calc_timing(struct cio2_device *cio2, struct cio2_queue *q,
 	if (!q->sensor)
 		return -ENODEV;
 
-	freq = v4l2_get_link_freq(q->sensor->ctrl_handler, bpp, lanes);
+	freq = v4l2_get_link_freq(q->sensor->ctrl_handler, bpp, lanes * 2);
 	if (freq < 0) {
 		dev_err(dev, "error %lld, invalid link_freq\n", freq);
 		return freq;
Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw

Hi Sakari,

Do you plan to send a pull request for this ? I don't see the patch in neither the master nor fixes branches of Mauro's tree.

Quoted 33 lines · Laurent Pinchart

Hi Sakari,

Thank you for the patch.

Quoted 8 lines · Sakari Ailus

The driver uses v4l2_get_link_freq() helper to obtain the link frequency using the LINK_FREQ but also the PIXEL_RATE control. The divisor for the pixel rate derived link frequency was wrong, missing the bus uses double data rate. Fix this.

Fixes 4b6c129e87a3 ("media: ipu3-cio2: Use v4l2_get_link_freq helper")
Quoted 17 lines
---
 drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +1 -1
index 6e8c0c230e11..fecef85bd62e 100644
@@ -302,7 +302,7 @@ static int cio2_csi2_calc_timing(struct cio2_device *cio2, struct cio2_queue *q,
 	if (!q->sensor)
 		return -ENODEV;
 
-	freq = v4l2_get_link_freq(q->sensor->ctrl_handler, bpp, lanes);
+	freq = v4l2_get_link_freq(q->sensor->ctrl_handler, bpp, lanes * 2);
 	if (freq < 0) {
 		dev_err(dev, "error %lld, invalid link_freq\n", freq);
 		return freq;
Signature · 3 lines
Regards,

Laurent Pinchart
Reviewed-by on v1 1/1
#3 lore raw
In reply to Sakari Ailus

Laurent and Sakari, thanks.

Quoted 18 lines · Sakari Ailus

The driver uses v4l2_get_link_freq() helper to obtain the link frequency using the LINK_FREQ but also the PIXEL_RATE control. The divisor for the pixel rate derived link frequency was wrong, missing the bus uses double data rate. Fix this.

Fixes 4b6c129e87a3 ("media: ipu3-cio2: Use v4l2_get_link_freq helper")
---
 drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +0 -0
index 6e8c0c230e11..fecef85bd62e 100644

drivers/media/pci/intel/ipu3/ipu3-cio2-main.c static int cio2_csi2_calc_timing(struct cio2_device *cio2, struct cio2_queue *q, · line 308

Quoted 8 lines
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +1 -1
@@ -302,7 +302,7 @@ static int cio2_csi2_calc_timing(struct cio2_device *cio2, struct cio2_queue *q,
 	if (!q->sensor)
 		return -ENODEV;
 
-	freq = v4l2_get_link_freq(q->sensor->ctrl_handler, bpp, lanes);
+	freq = v4l2_get_link_freq(q->sensor->ctrl_handler, bpp, lanes * 2);
 	if (freq < 0) {
 		dev_err(dev, "error %lld, invalid link_freq\n", freq);
 		return freq;
Signature · 2 lines
Best regards,
Bingbu Cao