Re: [PATCH 2/4] media: i2c: replace of_graph_get_next_endpoint()

2024-02-07 Thread Krzysztof Hałasa
Laurent,

Laurent Pinchart  writes:

>> +++ b/drivers/media/i2c/adv7604.c
>> @@ -3205,7 +3205,7 @@ static int adv76xx_parse_dt(struct adv76xx_state 
>> *state)
>>   np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node;
>>
>>   /* Parse the endpoint. */
>> - endpoint = of_graph_get_next_endpoint(np, NULL);
>> + endpoint = of_graph_get_endpoint_by_regs(np, 0, -1);
>
> I think this should be port 1 for the adv7611 and port2 for the adv7612.
> The adv7610 may need to use port 1 too, but the bindings likely need to
> be updated.

To be honest I have no idea about ADV7611 and 7612.
The 7610 I have on Tinyrex "mobo" seems to be single port.

ADV7611 seems to be mostly a 7610 in a different package (LQFP 64
instead of some BGA 76). The driver simply treats ADV7610 as a 7611.

ADV7612 is apparently dual port (only one port can be used at a time)
though:

[ADV7612] = {
.type = ADV7612,
.has_afe = false,
.max_port = ADV76XX_PAD_HDMI_PORT_A,/* B not supported */
.num_dv_ports = 1,  /* normally 2 */


All related in-tree DTS entries (as of v6.8.0-rc1) seem to be ADV7612.

To me it seems all known devices use the first port only.
-- 
Krzysztof "Chris" Hałasa

Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa


Re: [PATCH 2/4] media: i2c: replace of_graph_get_next_endpoint()

2024-02-07 Thread Krzysztof Hałasa
Hans,

Hans Verkuil  writes:

> Ideally someone would have to actually test this, perhaps with one of those
> Renesas boards. While I do have one, it got bricked after I attempted a
> u-boot update :-(

May be reversible, though.
-- 
Krzysztof "Chris" Hałasa

Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa


[PATCH REPOST] Fix i.MX IPU-v3 offset calculations for (semi)planar U/V formats

2021-07-19 Thread Krzysztof Hałasa
Video captured in 1400x1050 resolution (bytesperline aka stride = 1408
bytes) is invalid. Fix it.

Signed-off-by: Krzysztof Halasa 

--- a/drivers/gpu/ipu-v3/ipu-cpmem.c
+++ b/drivers/gpu/ipu-v3/ipu-cpmem.c
@@ -585,21 +585,21 @@ static const struct ipu_rgb def_bgra_16 = {
.bits_per_pixel = 16,
 };
 
-#define Y_OFFSET(pix, x, y)((x) + pix->width * (y))
-#define U_OFFSET(pix, x, y)((pix->width * pix->height) +   \
-(pix->width * ((y) / 2) / 2) + (x) / 2)
-#define V_OFFSET(pix, x, y)((pix->width * pix->height) +   \
-(pix->width * pix->height / 4) +   \
-(pix->width * ((y) / 2) / 2) + (x) / 2)
-#define U2_OFFSET(pix, x, y)   ((pix->width * pix->height) +   \
-(pix->width * (y) / 2) + (x) / 2)
-#define V2_OFFSET(pix, x, y)   ((pix->width * pix->height) +   \
-(pix->width * pix->height / 2) +   \
-(pix->width * (y) / 2) + (x) / 2)
-#define UV_OFFSET(pix, x, y)   ((pix->width * pix->height) +   \
-(pix->width * ((y) / 2)) + (x))
-#define UV2_OFFSET(pix, x, y)  ((pix->width * pix->height) +   \
-(pix->width * y) + (x))
+#define Y_OFFSET(pix, x, y)((x) + pix->bytesperline * (y))
+#define U_OFFSET(pix, x, y)((pix->bytesperline * pix->height) + \
+(pix->bytesperline * ((y) / 2) / 2) + (x) / 2)
+#define V_OFFSET(pix, x, y)((pix->bytesperline * pix->height) + \
+(pix->bytesperline * pix->height / 4) + \
+(pix->bytesperline * ((y) / 2) / 2) + (x) / 2)
+#define U2_OFFSET(pix, x, y)   ((pix->bytesperline * pix->height) + \
+(pix->bytesperline * (y) / 2) + (x) / 2)
+#define V2_OFFSET(pix, x, y)   ((pix->bytesperline * pix->height) + \
+(pix->bytesperline * pix->height / 2) + \
+(pix->bytesperline * (y) / 2) + (x) / 2)
+#define UV_OFFSET(pix, x, y)   ((pix->bytesperline * pix->height) + \
+(pix->bytesperline * ((y) / 2)) + (x))
+#define UV2_OFFSET(pix, x, y)  ((pix->bytesperline * pix->height) + \
+(pix->bytesperline * y) + (x))
 
 #define NUM_ALPHA_CHANNELS 7
 

-- 
Krzysztof Hałasa

Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa


[PATCH] Fix i.MX IPU-v3 offset calculations for (semi)planar U/V formats

2021-06-07 Thread Krzysztof Hałasa
Video captured in 1400x1050 resolution (bytesperline aka stride = 1408
bytes) is invalid. Fix it.

Signed-off-by: Krzysztof Halasa 

--- a/drivers/gpu/ipu-v3/ipu-cpmem.c
+++ b/drivers/gpu/ipu-v3/ipu-cpmem.c
@@ -585,21 +585,21 @@ static const struct ipu_rgb def_bgra_16 = {
.bits_per_pixel = 16,
 };
 
-#define Y_OFFSET(pix, x, y)((x) + pix->width * (y))
-#define U_OFFSET(pix, x, y)((pix->width * pix->height) +   \
-(pix->width * ((y) / 2) / 2) + (x) / 2)
-#define V_OFFSET(pix, x, y)((pix->width * pix->height) +   \
-(pix->width * pix->height / 4) +   \
-(pix->width * ((y) / 2) / 2) + (x) / 2)
-#define U2_OFFSET(pix, x, y)   ((pix->width * pix->height) +   \
-(pix->width * (y) / 2) + (x) / 2)
-#define V2_OFFSET(pix, x, y)   ((pix->width * pix->height) +   \
-(pix->width * pix->height / 2) +   \
-(pix->width * (y) / 2) + (x) / 2)
-#define UV_OFFSET(pix, x, y)   ((pix->width * pix->height) +   \
-(pix->width * ((y) / 2)) + (x))
-#define UV2_OFFSET(pix, x, y)  ((pix->width * pix->height) +   \
-(pix->width * y) + (x))
+#define Y_OFFSET(pix, x, y)((x) + pix->bytesperline * (y))
+#define U_OFFSET(pix, x, y)((pix->bytesperline * pix->height) + \
+(pix->bytesperline * ((y) / 2) / 2) + (x) / 2)
+#define V_OFFSET(pix, x, y)((pix->bytesperline * pix->height) + \
+(pix->bytesperline * pix->height / 4) + \
+(pix->bytesperline * ((y) / 2) / 2) + (x) / 2)
+#define U2_OFFSET(pix, x, y)   ((pix->bytesperline * pix->height) + \
+(pix->bytesperline * (y) / 2) + (x) / 2)
+#define V2_OFFSET(pix, x, y)   ((pix->bytesperline * pix->height) + \
+(pix->bytesperline * pix->height / 2) + \
+(pix->bytesperline * (y) / 2) + (x) / 2)
+#define UV_OFFSET(pix, x, y)   ((pix->bytesperline * pix->height) + \
+(pix->bytesperline * ((y) / 2)) + (x))
+#define UV2_OFFSET(pix, x, y)  ((pix->bytesperline * pix->height) + \
+(pix->bytesperline * y) + (x))
 
 #define NUM_ALPHA_CHANNELS 7
 

-- 
Krzysztof Hałasa

Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa


[i.MX6 DRM IPUv3] Regression 4.9-rc5: greenish screen with YUV420 video

2016-12-02 Thread Krzysztof Hałasa
Philipp Zabel  writes:

> I had already (accidentally) fixed this with 3fd8b292ae6b ("drm/imx:
> ipuv3-plane: merge ipu_plane_atomic_set_base into atomic_update").

Thanks, I've merged your pza/imx-drm/next and it now works.
-- 
Krzysztof Halasa

Industrial Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland


[i.MX6 DRM IPUv3] Regression 4.9-rc5: greenish screen with YUV420 video

2016-11-17 Thread Krzysztof Hałasa
Hi,

The following GStreamer pipeline causes screen to become green with
v4.9-rc4+:

gst-launch-1.0 udpsrc uri=udp://239.1.2.2:5100 reuse=true 
caps="application/x-rtp,media=(string)video,clock-rate=(int)9,encoding-name=(string)H264"
 ! rtph264depay ! h264parse ! v4l2video1dec capture-io-mode=dmabuf ! kmssink 
name=imx-drm sync=0

Reverting "drm/imx: ipuv3-plane: Skip setting u/vbo only when we don't
need modeset", commit 81d553545a1510ff7c7c00cbc9b57d6172d411a4, fixes
the problem.

Hardware is Gateworks Ventana GW5400, i.MX6Q, HDMI output, no X (console
only).
-- 
Krzysztof Halasa

Industrial Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland