All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Philippe Leduc <ledphilippe@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [RFC 1/1] i.MX: IPUv3: Add parallel display support
Date: Mon, 29 Feb 2016 07:50:19 +0100	[thread overview]
Message-ID: <20160229065019.GC9224@pengutronix.de> (raw)
In-Reply-To: <1456416080-486-1-git-send-email-ledphilippe@gmail.com>

Hi Philippe,

Looks good overall, some small points.

On Thu, Feb 25, 2016 at 05:01:20PM +0100, Philippe Leduc wrote:
> Add a driver compatible with "fsl,imx-parallel-display" in order
> to enable parallel display with the i.MX IPUv3.
> 
> Signed-off-by: Philippe Leduc<ledphilippe@gmail.com>
> --
> +struct imx_pd {
> +	struct device_d *dev;
> +	struct display_timings *timings;
> +	u32 interface_pix_fmt;
> +	struct vpl vpl;
> +};
> +
> +
> +

Plese drop multiple blank lines here.

> +static int imx_pd_ioctl(struct vpl *vpl, unsigned int port,
> +		unsigned int cmd, void *data)
> +{
> +	struct imx_pd *imx_pd = container_of(vpl, struct imx_pd, vpl);
> +	struct ipu_di_mode *mode;
> +	struct display_timings *timings;
> +
> +	switch (cmd) {
> +	case IMX_IPU_VPL_DI_MODE:
> +		mode = data;
> +
> +		mode->di_clkflags = IPU_DI_CLKMODE_SYNC;
> +		mode->interface_pix_fmt = imx_pd->interface_pix_fmt;
> +		return 0;
> +
> +	case VPL_GET_VIDEOMODES:
> +		timings = data;
> +
> +		timings->num_modes   = imx_pd->timings->num_modes;
> +		timings->native_mode = imx_pd->timings->native_mode;
> +		timings->modes       = imx_pd->timings->modes;
> +		timings->edid        = NULL;
> +		return 0;
> +	}
> +
> +	return 0;
> +}
> +
> +static int imx_pd_probe(struct device_d *dev)
> +{
> +	struct device_node *node = dev->device_node;
> +	struct imx_pd *imx_pd;
> +	const char *fmt;
> +	int ret;
> +
> +	imx_pd = xzalloc(sizeof(*imx_pd));
> +	imx_pd->dev = dev;
> +
> +	ret = of_property_read_string(node, "interface-pix-fmt", &fmt);
> +	if (!ret) {
> +		if (!strcmp(fmt, "rgb24"))
> +			imx_pd->interface_pix_fmt = V4L2_PIX_FMT_RGB24;
> +		else if (!strcmp(fmt, "rgb565"))
> +			imx_pd->interface_pix_fmt = V4L2_PIX_FMT_RGB565;
> +		else if (!strcmp(fmt, "bgr666"))
> +			imx_pd->interface_pix_fmt = V4L2_PIX_FMT_BGR666;

else? You should probably bail out with an error here.

> +	}
> +
> +	imx_pd->timings = of_get_display_timings(node);

You should check the result. If no display timing is found then barebox
will crash in the ioctl function.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2016-02-29  6:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25 16:01 [RFC 1/1] i.MX: IPUv3: Add parallel display support Philippe Leduc
2016-02-29  6:50 ` Sascha Hauer [this message]
2016-03-14  8:48   ` Philippe Leduc

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=20160229065019.GC9224@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=ledphilippe@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.