Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5389028pxb; Sun, 13 Feb 2022 19:37:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCyI4YgX/ej+vY1Qjj+hATky6GN2JS2I08yM1ZzeMCJgMCkNDizagIWHHbk2ogKNVuMQvG X-Received: by 2002:aa7:c94a:: with SMTP id h10mr13722229edt.392.1644809821933; Sun, 13 Feb 2022 19:37:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644809821; cv=none; d=google.com; s=arc-20160816; b=a/WMxOy0KXFiQjYs34+GtE2unemZ42/594DB22XKFaa6+bZ9KbxlgEnRmSC2diqWUG Vw+7URwdd5CPPclSouiPjPmFJzQ2AWwBbTjaoe01Fvc7FRSY5GdTkRRKtK+2kcI1+mcl 8Q7Xl6nDwA1l41CNObJ7dfz2CVrCjQ+gBho1s+I8am/XvyFJjHhFN/n5UPJmbWXNjmIk 8bt9EXkAhDLxKqAg9rnu3f/7TZHWp2u9rAEH0RLjRjDzUWSe2BniTZbXB0ijFMRdiJp4 S7DR2AgSYB1ZAtfldZGnOjIZdmgxCumLPT4L1C9rOtYiZ/Xhn4iwCeGDd2ola/5zF1HQ bi/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=CcTWUpyP6crQchv2+TdBPTejG08hMJ2PcQJnpbq8DqI=; b=mILMuwn0QxIBKxTON2RT8jxEzx4Jv1ydOLugRvzK/kaXQ078TbfwPZBZsbLtK1yWBt ZBCB1oAWTvURKKGVVNmpivHRzdtvOQjXMuQNpZLGmex0Ucv2RglNjxX5ZWd1QfNgaCnb 9wUgAivO9j1T6nkuTqn+mXxZWBvEDoZfDUg1UZsr6RtdVypI1v/Yf+KbpOt0zkfR3MTQ wfwlidsRlkkkADrAoRK6q5Kzc7BDZ7vxw5thp3zodVFje25Pnl0Oh6ykVQxXSgvP+LTV m9ZZvSmoNSBJrZ+p8TOqHHq1127OhWqKzORNNLZ7Z9e6xCGHz5W8iPmgmj0+hwtH7d8P WXAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=GaBycSLv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s17si15638180edr.568.2022.02.13.19.36.39; Sun, 13 Feb 2022 19:37:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=GaBycSLv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236047AbiBMMwO (ORCPT + 99 others); Sun, 13 Feb 2022 07:52:14 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbiBMMwN (ORCPT ); Sun, 13 Feb 2022 07:52:13 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FDCF5B3E3; Sun, 13 Feb 2022 04:52:07 -0800 (PST) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 80B0455A; Sun, 13 Feb 2022 13:52:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1644756725; bh=2Lb3ypDKzFK5NF5PwGxz5r1s5an8XhBxr0UQzJN7mXw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GaBycSLvcUWVZZLAplz+x0BucW85k2OavpFcYAOhV+EJ1j8lFcF2fuXiP25BZT23i ylRCFsb5hQ0TxqdI26lbHdhRDLQxFmHOefQlIOXOsOR+y/zrEd3qYTzXYWTK8hygBh 3Oc0p+5IdeEuWgjcjLepW5bo897ur2ITTieUkWgQ= Date: Sun, 13 Feb 2022 14:52:00 +0200 From: Laurent Pinchart To: Stefan Wahren Cc: Jean-Michel Hautbois , dave.stevenson@raspberrypi.com, devicetree@vger.kernel.org, kernel-list@raspberrypi.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, lukasz@jany.st, mchehab@kernel.org, naush@raspberrypi.com, robh@kernel.org, tomi.valkeinen@ideasonboard.com, bcm-kernel-feedback-list@broadcom.com Subject: Re: [PATCH v5 04/11] media: bcm2835-unicam: Add support for CCP2/CSI2 camera interface Message-ID: References: <20220208155027.891055-1-jeanmichel.hautbois@ideasonboard.com> <20220208155027.891055-5-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 08, 2022 at 10:00:23PM +0100, Stefan Wahren wrote: > Hi Jean-Michel, > > Am 08.02.22 um 16:50 schrieb Jean-Michel Hautbois: > > Add driver for the Unicam camera receiver block on BCM283x processors. > > It is represented as two video device nodes: unicam-image and > > unicam-embedded which are connected to an internal subdev (named > > unicam-subdev) in order to manage streams routing. > > > > Signed-off-by: Dave Stevenson > > Signed-off-by: Naushir Patuck > > Signed-off-by: Jean-Michel Hautbois > > > > --- > > v4: > > - Add the vendor prefox for DT name > > - Use the reg-names in DT parsing > > - Remove MAINTAINERS entry > > > > v3 main changes: > > - Change code organization > > - Remove unused variables > > - Correct the fmt_meta functions > > - Rewrite the start/stop streaming > > - You can now start the image node alone, but not the metadata one > > - The buffers are allocated per-node > > - only the required stream is started, if the route exists and is > > enabled > > - Prefix the macros with UNICAM_ to not have too generic names > > - Drop colorspace support > > -> This is causing issues in the try-fmt v4l2-compliance test > > test VIDIOC_G_FMT: OK > > fail: v4l2-test-formats.cpp(363): colorspace >= 0xff > > fail: v4l2-test-formats.cpp(465): testColorspace(!node->is_io_mc, pix.pixelformat, pix.colorspace, pix.ycbcr_enc, pix.quantization) > > test VIDIOC_TRY_FMT: FAIL > > fail: v4l2-test-formats.cpp(363): colorspace >= 0xff > > fail: v4l2-test-formats.cpp(465): testColorspace(!node->is_io_mc, pix.pixelformat, pix.colorspace, pix.ycbcr_enc, pix.quantization) > > test VIDIOC_S_FMT: FAIL > > > > v2: Remove the unicam_{info,debug,error} macros and use > > dev_dbg/dev_err instead. > > --- > > drivers/media/platform/Kconfig | 1 + > > drivers/media/platform/Makefile | 2 + > > drivers/media/platform/bcm2835/Kconfig | 21 + > > drivers/media/platform/bcm2835/Makefile | 3 + > > .../platform/bcm2835/bcm2835-unicam-regs.h | 253 ++ > > .../media/platform/bcm2835/bcm2835-unicam.c | 2570 +++++++++++++++++ > > 6 files changed, 2850 insertions(+) > > create mode 100644 drivers/media/platform/bcm2835/Kconfig > > create mode 100644 drivers/media/platform/bcm2835/Makefile > > create mode 100644 drivers/media/platform/bcm2835/bcm2835-unicam-regs.h > > create mode 100644 drivers/media/platform/bcm2835/bcm2835-unicam.c [snip] > > diff --git a/drivers/media/platform/bcm2835/bcm2835-unicam.c b/drivers/media/platform/bcm2835/bcm2835-unicam.c > > new file mode 100644 > > index 000000000000..470e691637c7 > > --- /dev/null > > +++ b/drivers/media/platform/bcm2835/bcm2835-unicam.c > > @@ -0,0 +1,2570 @@ [snip] > > +static int unicam_start_streaming(struct vb2_queue *vq, unsigned int count) > > +{ > > + struct unicam_node *node = vb2_get_drv_priv(vq); > > + struct unicam_device *unicam = node->dev; > > + dma_addr_t buffer_addr[UNICAM_MAX_NODES] = { 0 }; > > + struct unicam_buffer *buf; > > + struct v4l2_subdev_state *state; > > + unsigned long flags; > > + unsigned int i; > > + int ret; > > + u32 pad, stream; > > + u32 remote_pad_index = is_image_node(node) ? UNICAM_SD_PAD_SOURCE_IMAGE > > + : UNICAM_SD_PAD_SOURCE_METADATA; > > + > > + /* Look for the route for the given pad and stream. */ > > + state = v4l2_subdev_lock_active_state(&unicam->subdev.sd); > > + > > + ret = v4l2_subdev_routing_find_opposite_end(&state->routing, > > + remote_pad_index, 0, > > + &pad, &stream); > > + if (ret) > > + goto err_streaming; > > + > > + v4l2_subdev_unlock_state(state); > > + > > + dev_dbg(unicam->dev, "Starting stream 0 on pad %d on subdev %s\n", > > + remote_pad_index, unicam->subdev.sd.name); > > + > > + /* The metadata node can't be started alone. */ > > + if (is_metadata_node(node)) { > > + if (!unicam->node[UNICAM_IMAGE_NODE].streaming) { > > + dev_err(unicam->dev, > > + "Can't start metadata without image\n"); > > + return -EINVAL; > > + } > > + dev_dbg(unicam->dev, "starting metadata node\n"); > > + > > + spin_lock_irqsave(&node->dma_queue_lock, flags); > > + buf = list_first_entry(&node->dma_queue, > > + struct unicam_buffer, list); > > + dev_dbg(unicam->dev, "buffer %d: %p\n", i, buf); > > + node->cur_frm = buf; > > + node->next_frm = buf; > > + list_del(&buf->list); > > + spin_unlock_irqrestore(&node->dma_queue_lock, flags); > > + > > + buffer_addr[UNICAM_METADATA_NODE] = > > + vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 0); > > + dev_dbg(unicam->dev, "buffer %d addr: %lld\n", i, buffer_addr[i]); > > i tried to compile the driver and get the following warning. I think the > easiest solution would be to drop this debug message. For the record, the right format specifier would be dev_dbg(unicam->dev, "buffer %d addr: %pad\n", i, &buffer_addr[i]); (note the & before buffer_addr) > In file included from ./include/linux/printk.h:555:0, > >                  from ./include/linux/kernel.h:29, >                  from ./include/linux/clk.h:13, >                  from drivers/media/platform/bcm2835/bcm2835-unicam.c:47: > drivers/media/platform/bcm2835/bcm2835-unicam.c: In function > ‘unicam_start_streaming’: > drivers/media/platform/bcm2835/bcm2835-unicam.c:1676:24: warning: format > ‘%lld’ expects argument of type ‘long long int’, but argument 5 has type > ‘dma_addr_t {aka unsigned int}’ [-Wformat=] >    dev_dbg(unicam->dev, "buffer %d addr: %lld\n", i, buffer_addr[i]); >                         ^ > ./include/linux/dynamic_debug.h:134:15: note: in definition of macro > ‘__dynamic_func_call’ >    func(&id, ##__VA_ARGS__);  \ >                ^~~~~~~~~~~ > ./include/linux/dynamic_debug.h:166:2: note: in expansion of macro > ‘_dynamic_func_call’ >   _dynamic_func_call(fmt,__dynamic_dev_dbg,   \ >   ^~~~~~~~~~~~~~~~~~ > ./include/linux/dev_printk.h:155:2: note: in expansion of macro > ‘dynamic_dev_dbg’ >   dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) >   ^~~~~~~~~~~~~~~ > ./include/linux/dev_printk.h:155:23: note: in expansion of macro ‘dev_fmt’ >   dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) >                        ^~~~~~~ > drivers/media/platform/bcm2835/bcm2835-unicam.c:1676:3: note: in > expansion of macro ‘dev_dbg’ >    dev_dbg(unicam->dev, "buffer %d addr: %lld\n", i, buffer_addr[i]); >    ^~~~~~~ -- Regards, Laurent Pinchart