From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 46644CD3431 for ; Wed, 4 Sep 2024 10:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cM2nyG/nFeNlf0Y3+4j2wGNR+3yF+s8fDqlmX/tH0iw=; b=VLk+Ozp6BEGQG+E1XAcQXplLOT 4FoBwubGnbpb3HDVMcFNyAq318oz4eMsG/sKL4vvderUUR3ZpbpghYmNbuqH2vncfxoOVJ1uxELze h82DGcB/QaQTy+1CZU9BG8r4bSFBpMa/WNcuxJQOTthsmtaDsYMZELqT62HRs/Yl2b1QSnyC/2842 ufGkRqRqWnpNmkxzDEkcPelo/cIxYTiJCHnhjgJQtgexjyp5GOTgqoeV+1cBv3r1jWOp0iQ4yj4zv hSwBSMJa/l9dSEw8SkIm9jNsRzsBc2nKNg9hEMo8X7iwc5vlYM2ilo6S6vJJmZFYUkxjgrEc/oSCA 7ODqO0Gw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slndP-000000040P7-1n1b; Wed, 04 Sep 2024 10:53:11 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slncQ-0000000408K-1njP; Wed, 04 Sep 2024 10:52:12 +0000 Received: from [192.168.88.20] (91-156-87-48.elisa-laajakaista.fi [91.156.87.48]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 07A322E3; Wed, 4 Sep 2024 12:50:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1725447052; bh=kbFrdq9xxLycol7fPFRViV6Wik6wBNW/To8Oii874UA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=pPlo8gFg6Pzfh7O+DVvty0+XAoGU7U5mxfWtLf+b83zmqDDfwiYPgFmEpH2Qe+Vmc 8HNTFn1jU5Mok9BoXvC40Y4LETkWBnq33HMj1DEJYDdpj6LdSGuDuqkrMxBww1U8nM 1vgmwiZmEYz1XmUIhSiagF6KNEIs/QwHs3PLQK0I= Message-ID: <26aa28fd-63f0-4b31-8022-24e0e234374b@ideasonboard.com> Date: Wed, 4 Sep 2024 13:52:01 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 3/4] media: raspberrypi: Add support for RP1-CFE To: Sakari Ailus Cc: Mauro Carvalho Chehab , Raspberry Pi Kernel Maintenance , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Rob Herring , Krzysztof Kozlowski , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Naushir Patuck , Laurent Pinchart , Jacopo Mondi , Kieran Bingham References: <20240815-rp1-cfe-v3-0-e15a979db327@ideasonboard.com> <20240815-rp1-cfe-v3-3-e15a979db327@ideasonboard.com> <0a9f8470-606b-47e2-a622-038a2c070b5e@ideasonboard.com> Content-Language: en-US From: Tomi Valkeinen Autocrypt: addr=tomi.valkeinen@ideasonboard.com; keydata= xsFNBE6ms0cBEAC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4IkLmZwEXpZcIOQjQ71fqlpiXkXSIaQ6YMEs8WjBbpP81h7QxWIfWtp+VnwNGc6nq5IQDESH mvQcsFS7d3eGVI6eyjCFdcAO8eMAEQEAAcLBXwQYAQIACQUCTqazRwIbDAAKCRD6PaqMvJYe 9fA7EACS6exUedsBKmt4pT7nqXBcRsqm6YzT6DeCM8PWMTeaVGHiR4TnNFiT3otD5UpYQI7S suYxoTdHrrrBzdlKe5rUWpzoZkVK6p0s9OIvGzLT0lrb0HC9iNDWT3JgpYDnk4Z2mFi6tTbq xKMtpVFRA6FjviGDRsfkfoURZI51nf2RSAk/A8BEDDZ7lgJHskYoklSpwyrXhkp9FHGMaYII m9EKuUTX9JPDG2FTthCBrdsgWYPdJQvM+zscq09vFMQ9Fykbx5N8z/oFEUy3ACyPqW2oyfvU CH5WDpWBG0s5BALp1gBJPytIAd/pY/5ZdNoi0Cx3+Z7jaBFEyYJdWy1hGddpkgnMjyOfLI7B CFrdecTZbR5upjNSDvQ7RG85SnpYJTIin+SAUazAeA2nS6gTZzumgtdw8XmVXZwdBfF+ICof 92UkbYcYNbzWO/GHgsNT1WnM4sa9lwCSWH8Fw1o/3bX1VVPEsnESOfxkNdu+gAF5S6+I6n3a ueeIlwJl5CpT5l8RpoZXEOVtXYn8zzOJ7oGZYINRV9Pf8qKGLf3Dft7zKBP832I3PQjeok7F yjt+9S+KgSFSHP3Pa4E7lsSdWhSlHYNdG/czhoUkSCN09C0rEK93wxACx3vtxPLjXu6RptBw 3dRq7n+mQChEB1am0BueV1JZaBboIL0AGlSJkm23kw== In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_035210_796723_55B565BC X-CRM114-Status: GOOD ( 34.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 04/09/2024 10:07, Sakari Ailus wrote: > Moi, > > On Mon, Sep 02, 2024 at 01:05:42PM +0300, Tomi Valkeinen wrote: >> Hi Sakari, >> >> Thanks for the review! > > You're welcome. > >>>> +#define cfe_dbg(fmt, arg...) dev_dbg(&cfe->pdev->dev, fmt, ##arg) >>> >>> cfe should be an argument to cfe_dbg(). >> >> Why? This, and the ones below, is an internal macro to make it easier and >> shorter to do prints. Adding the parameter gives no benefit that I can see. > > Generally macros shouldn't expect certain variables not defined on the same > level the macros themselves. It gets harder to maintain this way. I agree, but I'm fine taking shortcuts in private macros to make the code a bit shorter and more readable. In any case, I don't feel strongly about this so I'll make the change, it's an easy find and replace. >>>> +#define node_supports_image_output(node) \ >>>> + (!!(node_desc[(node)->id].caps & V4L2_CAP_VIDEO_CAPTURE)) >>> >>> No need to cast to bool through !!. Same below. >> >> I like my bools to be bools, not ints... But at the same time, I don't see >> how that would cause issues in the uses we have in this driver. So I'll drop >> these. > > Alternatively, explicitly cast to bool. But I don't think it's needed. > >> >>>> +#define node_supports_meta_output(node) \ >>>> + (!!(node_desc[(node)->id].caps & V4L2_CAP_META_CAPTURE)) >>>> +#define node_supports_image_input(node) \ >>>> + (!!(node_desc[(node)->id].caps & V4L2_CAP_VIDEO_OUTPUT)) >>>> +#define node_supports_meta_input(node) \ >>>> + (!!(node_desc[(node)->id].caps & V4L2_CAP_META_OUTPUT)) >>>> +#define node_supports_image(node) \ >>>> + (node_supports_image_output(node) || node_supports_image_input(node)) >>>> +#define node_supports_meta(node) \ >>>> + (node_supports_meta_output(node) || node_supports_meta_input(node)) >>>> + >>>> +#define is_image_output_node(node) \ >>>> + ((node)->buffer_queue.type == V4L2_BUF_TYPE_VIDEO_CAPTURE) >>>> +#define is_image_input_node(node) \ >>>> + ((node)->buffer_queue.type == V4L2_BUF_TYPE_VIDEO_OUTPUT) >>>> +#define is_image_node(node) \ >>>> + (is_image_output_node(node) || is_image_input_node(node)) >>>> +#define is_meta_output_node(node) \ >>>> + ((node)->buffer_queue.type == V4L2_BUF_TYPE_META_CAPTURE) >>>> +#define is_meta_input_node(node) \ >>>> + ((node)->buffer_queue.type == V4L2_BUF_TYPE_META_OUTPUT) >>>> +#define is_meta_node(node) \ >>>> + (is_meta_output_node(node) || is_meta_input_node(node)) >>>> + >>>> +/* To track state across all nodes. */ >>>> +#define NUM_STATES 5 > > This might be nicer if declared as last. Sure. >>>> +#define NODE_REGISTERED BIT(0) >>>> +#define NODE_ENABLED BIT(1) >>>> +#define NODE_STREAMING BIT(2) >>>> +#define FS_INT BIT(3) >>>> +#define FE_INT BIT(4) > > ... > >>>> +static int cfe_start_channel(struct cfe_node *node) >>>> +{ >>>> + struct cfe_device *cfe = node->cfe; >>>> + struct v4l2_subdev_state *state; >>>> + struct v4l2_mbus_framefmt *source_fmt; >>>> + const struct cfe_fmt *fmt; >>>> + unsigned long flags; >>>> + bool start_fe; >>>> + int ret; >>>> + >>>> + cfe_dbg("%s: [%s]\n", __func__, node_desc[node->id].name); >>> >>> This looks like a development time leftover. There are quite a few such >>> prints that provide little information anyway. How about removing them all? >> >> These are very valuable when testing, fixing or improving the driver. If I >> were to remove them, I would just have to add them back whenever I'd be >> doing something with the driver and things would not work perfectly. >> >> The debug prints we have are all low frequency. There's a bunch printed when >> starting the streaming and when stopping it, but the debug prints are not >> used while streaming is on-going, and instead we have trace events for that. > > I'm fine with debug prints when they do print useful information but you > have many of them just in the beginning of the function, printing only the > function name (and possibly the node name). I'd remove those, except in > cases where calling the function itself is useful information, such as on > returning the buffers. I have removed a few debug prints, but I ended up adding a few too. The useful information here in many cases is the function name and the node name. With multiple streams, and with the different possibilities in handling enable and disable (start streaming when the first video node is enabled? or only when all of them are enabled? what happens when one of the enabled nodes is disabled? is the csi side enabled along with the fe, and which csi channel?), it's very beneficial to see what goes on. >>>> +static int cfe_link_node_pads(struct cfe_device *cfe) >>>> +{ >>>> + int ret; >>>> + int pad; >>>> + >>>> + /* Source -> CSI2 */ >>>> + >>>> + pad = media_entity_get_fwnode_pad(&cfe->source_sd->entity, >>>> + cfe->remote_ep_fwnode, >>>> + MEDIA_PAD_FL_SOURCE); >>>> + if (pad < 0) { >>>> + cfe_err("Source %s has no connected source pad\n", >>>> + cfe->source_sd->name); >>>> + return pad; >>>> + } >>>> + >>>> + cfe->source_pad = pad; >>>> + >>>> + ret = media_create_pad_link(&cfe->source_sd->entity, pad, >>>> + &cfe->csi2.sd.entity, CSI2_PAD_SINK, >>>> + MEDIA_LNK_FL_IMMUTABLE | >>>> + MEDIA_LNK_FL_ENABLED); >>>> + if (ret) >>>> + return ret; >>>> + >>>> + for (unsigned int i = 0; i < CSI2_NUM_CHANNELS; i++) { >>>> + struct cfe_node *node = &cfe->node[i]; >>>> + >>>> + if (!check_state(cfe, NODE_REGISTERED, i)) >>>> + continue; >>>> + >>>> + /* CSI2 channel # -> /dev/video# */ >>>> + ret = media_create_pad_link(&cfe->csi2.sd.entity, >>>> + node_desc[i].link_pad, >>>> + &node->video_dev.entity, 0, 0); >>>> + if (ret) >>>> + return ret; >>>> + >>>> + if (node_supports_image(node)) { >>>> + /* CSI2 channel # -> FE Input */ >>>> + ret = media_create_pad_link(&cfe->csi2.sd.entity, >>>> + node_desc[i].link_pad, >>>> + &cfe->fe.sd.entity, >>>> + FE_STREAM_PAD, 0); >>>> + if (ret) >>>> + return ret; >>>> + } >>>> + } >>>> + >>>> + for (unsigned int i = CSI2_NUM_CHANNELS; i < NUM_NODES; i++) { >>>> + struct cfe_node *node = &cfe->node[i]; >>>> + struct media_entity *src, *dst; >>>> + unsigned int src_pad, dst_pad; >>>> + >>>> + if (node_desc[i].pad_flags & MEDIA_PAD_FL_SINK) { >>>> + /* FE -> /dev/video# */ >>>> + src = &cfe->fe.sd.entity; >>>> + src_pad = node_desc[i].link_pad; >>>> + dst = &node->video_dev.entity; >>>> + dst_pad = 0; >>>> + } else { >>>> + /* /dev/video# -> FE */ >>>> + dst = &cfe->fe.sd.entity; >>>> + dst_pad = node_desc[i].link_pad; >>>> + src = &node->video_dev.entity; >>>> + src_pad = 0; >>>> + } >>>> + >>>> + ret = media_create_pad_link(src, src_pad, dst, dst_pad, 0); >>>> + if (ret) >>>> + return ret; >>>> + } >>>> + >>>> + return 0; >>>> +} >>>> + >>>> +static int cfe_probe_complete(struct cfe_device *cfe) >>>> +{ >>>> + int ret; >>>> + >>>> + cfe->v4l2_dev.notify = cfe_notify; >>>> + >>>> + for (unsigned int i = 0; i < NUM_NODES; i++) { >>>> + ret = cfe_register_node(cfe, i); >>>> + if (ret) { >>>> + cfe_err("Unable to register video node %u.\n", i); >>>> + goto unregister; >>>> + } >>>> + } >>>> + >>>> + ret = cfe_link_node_pads(cfe); >>>> + if (ret) { >>>> + cfe_err("Unable to link node pads.\n"); >>>> + goto unregister; >>>> + } >>>> + >>>> + ret = v4l2_device_register_subdev_nodes(&cfe->v4l2_dev); >>>> + if (ret) { >>>> + cfe_err("Unable to register subdev nodes.\n"); >>>> + goto unregister; >>>> + } >>>> + >>>> + return 0; >>>> + >>>> +unregister: >>>> + cfe_unregister_nodes(cfe); >>>> + return ret; >>>> +} >>>> + >>>> +static int cfe_async_bound(struct v4l2_async_notifier *notifier, >>>> + struct v4l2_subdev *subdev, >>>> + struct v4l2_async_connection *asd) >>>> +{ >>>> + struct cfe_device *cfe = to_cfe_device(notifier->v4l2_dev); >>>> + >>>> + if (cfe->source_sd) { >>>> + cfe_err("Rejecting subdev %s (Already set!!)", subdev->name); >>>> + return 0; >>>> + } >>>> + >>>> + cfe->source_sd = subdev; >>>> + >>>> + cfe_dbg("Using source %s for capture\n", subdev->name); >>>> + >>>> + return 0; >>>> +} >>>> + >>>> +static int cfe_async_complete(struct v4l2_async_notifier *notifier) >>>> +{ >>>> + struct cfe_device *cfe = to_cfe_device(notifier->v4l2_dev); >>>> + >>>> + return cfe_probe_complete(cfe); >>>> +} >>>> + >>>> +static const struct v4l2_async_notifier_operations cfe_async_ops = { >>>> + .bound = cfe_async_bound, >>>> + .complete = cfe_async_complete, >>>> +}; >>>> + >>>> +static int cfe_register_async_nf(struct cfe_device *cfe) >>>> +{ >>>> + struct platform_device *pdev = cfe->pdev; >>>> + struct v4l2_fwnode_endpoint ep = { .bus_type = V4L2_MBUS_CSI2_DPHY }; >>>> + int ret = -EINVAL; > > Is the assignment necessary? No, doesn't look like it. >>>> + struct fwnode_handle *local_ep_fwnode; >>>> + struct fwnode_handle *remote_ep_fwnode; >>>> + struct v4l2_async_connection *asd; >>>> + >>>> + local_ep_fwnode = fwnode_graph_get_endpoint_by_id(pdev->dev.fwnode, 0, 0, 0); >>>> + if (!local_ep_fwnode) { >>>> + cfe_err("Failed to find local endpoint fwnode\n"); >>>> + return -ENODEV; >>>> + } >>>> + >>>> + remote_ep_fwnode = fwnode_graph_get_remote_endpoint(local_ep_fwnode); >>>> + if (!remote_ep_fwnode) { >>>> + cfe_err("Failed to find remote endpoint fwnode\n"); >>>> + ret = -ENODEV; >>>> + goto err_put_local_fwnode; >>>> + } >>>> + >>>> + /* Parse the local endpoint and validate its configuration. */ >>>> + v4l2_fwnode_endpoint_parse(local_ep_fwnode, &ep); > > You'll need to check the return value here. I'll add that. >>>> + >>>> + if (ep.bus_type != V4L2_MBUS_CSI2_DPHY) { > > This check is redundant. Indeed. >>>> + cfe_err("endpoint node type != CSI2\n"); >>>> + ret = -EINVAL; >>>> + goto err_put_remote_fwnode; >>>> + } >>>> + >>>> + for (unsigned int lane = 0; lane < ep.bus.mipi_csi2.num_data_lanes; lane++) { >>>> + if (ep.bus.mipi_csi2.data_lanes[lane] != lane + 1) { >>>> + cfe_err("subdevice %pfwf: data lanes reordering not supported\n", >>>> + remote_ep_fwnode); >>>> + ret = -EINVAL; >>>> + goto err_put_remote_fwnode; >>>> + } >>>> + } >>>> + >>>> + cfe->csi2.dphy.max_lanes = ep.bus.mipi_csi2.num_data_lanes; >>>> + cfe->csi2.bus_flags = ep.bus.mipi_csi2.flags; >>>> + >>>> + cfe->remote_ep_fwnode = remote_ep_fwnode; >>>> + >>>> + cfe_dbg("source %pfwf: %u data lanes, flags=0x%08x\n", >>>> + remote_ep_fwnode, cfe->csi2.dphy.max_lanes, cfe->csi2.bus_flags); >>>> + >>>> + /* Initialize and register the async notifier. */ >>>> + v4l2_async_nf_init(&cfe->notifier, &cfe->v4l2_dev); >>>> + cfe->notifier.ops = &cfe_async_ops; >>>> + >>>> + asd = v4l2_async_nf_add_fwnode(&cfe->notifier, remote_ep_fwnode, >>>> + struct v4l2_async_connection); >>> >>> Could you use v4l2_async_nf_add_fwnode_remote() and just not bother with >>> remote_ep_fwnode at all? >> >> I need the remote_ep_fwnode in cfe_link_node_pads() when creating the links. >> >> Is there some other way to get the remote pad so that I can call the >> media_create_pad_link()? > > Could you use v4l2_create_fwnode_links_to_pad() for that? Yes, seems to work. However, I don't know why it works, as the docs say the sink has to implement .get_fwnode_pad(), which I don't have, yet everything seems to work fine... Ah, the code looks for the first sink pad if .get_fwnode_pad() is not implemented. So either the code or the doc is not right. I still need to get the remote pad number, which I previously got from media_entity_get_fwnode_pad(), but I can now create the link first with v4l2_create_fwnode_links_to_pad() and then get the pad with media_pad_remote_pad_unique(). Tomi