linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,
	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
Date: Sun, 13 Feb 2022 14:52:00 +0200	[thread overview]
Message-ID: <Ygj+8Ovplpo7xR91@pendragon.ideasonboard.com> (raw)
In-Reply-To: <fc5700c5-0b64-056a-2775-d0ab0f6521e8@i2se.com>

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 <dave.stevenson@raspberrypi.com>
> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
> > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
> >
> > ---
> > 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

  reply	other threads:[~2022-02-13 12:52 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08 15:50 [PATCH v5 00/11] Add support for BCM2835 camera interface (unicam) Jean-Michel Hautbois
2022-02-08 15:50 ` [PATCH v5 01/11] media: v4l: Add V4L2-PIX-FMT-Y12P format Jean-Michel Hautbois
2022-02-08 15:50 ` [PATCH v5 02/11] media: v4l: Add V4L2-PIX-FMT-Y14P format Jean-Michel Hautbois
2022-02-08 15:50 ` [PATCH v5 03/11] dt-bindings: media: Add bindings for bcm2835-unicam Jean-Michel Hautbois
2022-02-09 18:56   ` Rob Herring
2022-02-13 15:48   ` Stefan Wahren
2022-02-14  9:39     ` Maxime Ripard
2022-02-14  9:54       ` Laurent Pinchart
2022-02-14 11:32         ` Stefan Wahren
2022-02-21  7:10           ` Laurent Pinchart
2022-02-21 10:03             ` Maxime Ripard
2022-02-21 12:45             ` Stefan Wahren
2022-02-21 12:52               ` Laurent Pinchart
2022-02-25  8:19   ` Sakari Ailus
2022-02-08 15:50 ` [PATCH v5 04/11] media: bcm2835-unicam: Add support for CCP2/CSI2 camera interface Jean-Michel Hautbois
2022-02-08 21:00   ` Stefan Wahren
2022-02-13 12:52     ` Laurent Pinchart [this message]
2022-02-13 11:17   ` Stefan Wahren
2022-02-13 12:49     ` Laurent Pinchart
2022-02-20 10:01   ` Stefan Wahren
2022-02-20 10:08     ` Laurent Pinchart
2022-02-21  9:55   ` Laurent Pinchart
2022-02-25  9:29   ` Sakari Ailus
2023-07-02 15:23     ` Laurent Pinchart
2023-07-02 18:18       ` Sakari Ailus
2023-07-02 21:45         ` Laurent Pinchart
2023-07-02 21:47           ` Laurent Pinchart
2023-07-02 21:56             ` Sakari Ailus
2023-07-02 22:01               ` Laurent Pinchart
2023-07-02 22:20                 ` Sakari Ailus
2023-07-02 22:28                   ` Laurent Pinchart
2023-07-02 22:33                     ` Sakari Ailus
2023-07-02 21:53           ` Sakari Ailus
2023-07-02 21:58             ` Laurent Pinchart
2022-02-08 15:50 ` [PATCH v5 05/11] media: MAINTAINERS: add bcm2835 unicam driver Jean-Michel Hautbois
2022-02-08 15:58   ` Laurent Pinchart
2022-02-08 15:50 ` [PATCH v5 06/11] ARM: dts: bcm2711: Add unicam CSI nodes Jean-Michel Hautbois
2022-02-13 10:35   ` Stefan Wahren
2022-02-13 13:51     ` Stefan Wahren
2022-02-08 15:50 ` [PATCH v5 07/11] media: imx219: Rename mbus codes array Jean-Michel Hautbois
2022-02-08 15:50 ` [PATCH v5 08/11] media: imx219: Switch from open to init_cfg Jean-Michel Hautbois
2022-02-08 16:02   ` Laurent Pinchart
2022-02-08 16:05     ` Laurent Pinchart
2022-02-08 15:50 ` [PATCH v5 09/11] media: imx219: Introduce the set_routing operation Jean-Michel Hautbois
2022-02-21  7:17   ` Laurent Pinchart
2022-02-08 15:50 ` [PATCH v5 10/11] media: imx219: use a local v4l2_subdev to simplify reading Jean-Michel Hautbois
2022-02-08 15:50 ` [PATCH v5 11/11] media: imx219: Add support for the V4L2 subdev active state Jean-Michel Hautbois
2022-02-21  7:25   ` Laurent Pinchart
2022-02-16 20:57 ` [PATCH v5 00/11] Add support for BCM2835 camera interface (unicam) Stefan Wahren
2022-02-20 14:30   ` Jean-Michel Hautbois
2022-02-26 17:18     ` Stefan Wahren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ygj+8Ovplpo7xR91@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jeanmichel.hautbois@ideasonboard.com \
    --cc=kernel-list@raspberrypi.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=lukasz@jany.st \
    --cc=mchehab@kernel.org \
    --cc=naush@raspberrypi.com \
    --cc=robh@kernel.org \
    --cc=stefan.wahren@i2se.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).