public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Scott Jiang <scott.jiang.linux@gmail.com>
Cc: linux-media@vger.kernel.org,
	uclinux-dist-devel@blackfin.uclinux.org, hverkuil@xs4all.nl,
	mchehab@redhat.com
Subject: Re: [PATCH RFC v2] [media] blackfin: add video display device driver
Date: Mon, 29 Apr 2013 19:20:15 +0200	[thread overview]
Message-ID: <517EABCF.2020805@samsung.com> (raw)
In-Reply-To: <1367184052-688-1-git-send-email-scott.jiang.linux@gmail.com>

Hi Scott,

On 04/28/2013 11:20 PM, Scott Jiang wrote:
> This is a V4L2 driver for Blackfin video display (E)PPI interface.
> This module is common for BF537/BF561/BF548/BF609.
> 
> Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com>

>From a quick review this patch looks good to me. Feel free to add

Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

Just couple remarks below.

> +static const struct bfin_disp_format bfin_disp_formats[] = {
> +	{
> +		.desc        = "YCbCr 4:2:2 Interleaved UYVY 8bits",

This string will like get truncated, since buffer is only 32 character
long, including trailing 0. It could be verified with e.g. v4l2-ctl
how much of this string actually shows up in user space.
	
> +		.pixelformat = V4L2_PIX_FMT_UYVY,
> +		.mbus_code   = V4L2_MBUS_FMT_UYVY8_2X8,
> +		.bpp         = 16,
> +		.dlen        = 8,
> +	},
> +	{
> +		.desc        = "YCbCr 4:2:2 Interleaved YUYV 8bits",

Ditto.

> +		.pixelformat = V4L2_PIX_FMT_YUYV,
> +		.mbus_code   = V4L2_MBUS_FMT_YUYV8_2X8,
> +		.bpp         = 16,
> +		.dlen        = 8,
> +	},
> +	{
> +		.desc        = "YCbCr 4:2:2 Interleaved UYVY 16bits",

Ditto.

> +		.pixelformat = V4L2_PIX_FMT_UYVY,
> +		.mbus_code   = V4L2_MBUS_FMT_UYVY8_1X16,
> +		.bpp         = 16,
> +		.dlen        = 16,
> +	},
[...]

> +static irqreturn_t bfin_disp_isr(int irq, void *dev_id)
> +{
> +	struct ppi_if *ppi = dev_id;
> +	struct bfin_disp_device *disp = ppi->priv;
> +	struct vb2_buffer *vb = &disp->cur_frm->vb;
> +	dma_addr_t addr;
> +
> +	spin_lock(&disp->lock);
> +
> +	if (!list_empty(&disp->dma_queue)) {
> +		v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
> +		vb->v4l2_buf.flags |= V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;

There is no need to set this flag for each buffer, it will be done internally
in videbuf2, if timestamp_type type is set before calling vb2_queue_init().

> +		vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
> +		disp->cur_frm = list_entry(disp->dma_queue.next,
> +				struct bfin_disp_buffer, list);
> +		list_del(&disp->cur_frm->list);
> +	}
> +
> +	clear_dma_irqstat(ppi->info->dma_ch);
> +
> +	addr = vb2_dma_contig_plane_dma_addr(&disp->cur_frm->vb, 0);
> +	ppi->ops->update_addr(ppi, (unsigned long)addr);
> +	ppi->ops->start(ppi);
> +
> +	spin_unlock(&disp->lock);
> +
> +	return IRQ_HANDLED;
> +}

> +static int bfin_disp_probe(struct platform_device *pdev)
> +{
> +	struct bfin_disp_device *disp;
> +	struct video_device *vfd;
> +	struct i2c_adapter *i2c_adap;
> +	struct bfin_display_config *config;
> +	struct vb2_queue *q;
> +	struct disp_route *route;
> +	int ret;
> +
> +	config = pdev->dev.platform_data;
> +	if (!config || !config->num_outputs) {
> +		v4l2_err(pdev->dev.driver, "Invalid board config\n");
> +		return -ENODEV;
> +	}
> +
> +	disp = kzalloc(sizeof(*disp), GFP_KERNEL);

devm_kzalloc() ?

> +	if (!disp)
> +		return -ENOMEM;
[...]
> +
> +	/* initialize queue */
> +	q = &disp->buffer_queue;
> +	q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
> +	q->io_modes = VB2_MMAP;
> +	q->drv_priv = disp;
> +	q->buf_struct_size = sizeof(struct bfin_disp_buffer);
> +	q->ops = &bfin_disp_video_qops;
> +	q->mem_ops = &vb2_dma_contig_memops;
> +	/* provide a mutex to vb2 queue */
> +	q->lock = &disp->qlock;

And the timestamp type set up:

	q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;

> +	ret = vb2_queue_init(q);
> +	if (ret) {
> +		v4l2_err(&disp->v4l2_dev,
> +				"Unable to init videobuf2 queue\n");
> +		goto err_free_handler;
> +	}

Thanks,
Sylwester

      reply	other threads:[~2013-04-29 17:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-28 21:20 [PATCH RFC v2] [media] blackfin: add video display device driver Scott Jiang
2013-04-29 17:20 ` Sylwester Nawrocki [this message]

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=517EABCF.2020805@samsung.com \
    --to=s.nawrocki@samsung.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=scott.jiang.linux@gmail.com \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    /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