Re: [RESEND Patch v13 2/3] media: rockchip: Add a driver for Rockchip's camera interface

From: Val Packett
Date: Wed May 29 2024 - 20:22:46 EST


Hi,

On Sun, Feb 11 2024 at 20:03:31 +01:00:00, Mehdi Djait <mehdi.djait.k@xxxxxxxxx> wrote:
This introduces a V4L2 driver for the Rockchip CIF video capture controller.

This controller can be found on RK3066, PX30, RK1808, RK3128 and RK3288,
but for now it's only been tested on the PX30.

I've been testing it on an RK3066 tablet I'm bringing up mainline on, recently figured out the clock situation that made the cameras appear on I2C and got a camera driver to attach, but still not getting a frame and will need to debug more.. Since you're familiar with the hardware, could you quickly tell me what exactly causes the CIF interrupt to fire? Is it a signal from the camera?

Anyway, two things I noticed with the code:

+static int cif_enum_input(struct file *file, void *priv,
+ struct v4l2_input *input)
+{
+ struct cif_stream *stream = video_drvdata(file);
+ struct v4l2_subdev *sd = stream->cifdev->remote.sd;
+ int ret;
+
+ if (input->index > 0)
+ return -EINVAL;
+
+ ret = v4l2_subdev_call(sd, video, g_input_status, &input->status);
+ if (ret && ret != -EOPNOTSUPP)
+ return ret;

v4l2_subdev_call actually returns -ENOIOCTLCMD when the camera driver does not handle the requested call.

+static int cif_plat_probe(struct platform_device *pdev)
+{
[…]
+ ret = devm_clk_bulk_get(dev, cif_dev->match_data->clks_num,
+ cif_dev->match_data->clks);

This looks like it's just modifying the `static` clocks array shared between all instances of the driver and not copying the clock references into the instance's private struct.

Thanks,
~val