All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Rob Clark <robdclark@gmail.com>
Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	dri-devel@lists.freedesktop.org, patches@linaro.org
Subject: Re: [PATCH 2/4] RFC: drm/lcdc: add support for LCD panels (v2)
Date: Fri, 11 Jan 2013 14:13:53 +0100	[thread overview]
Message-ID: <20130111131353.GA4247@pengutronix.de> (raw)
In-Reply-To: <1357704685-3600-3-git-send-email-robdclark@gmail.com>

Hi Rob,

On Tue, Jan 08, 2013 at 10:11:23PM -0600, Rob Clark wrote:
> Add an output panel driver for LCD panels.  Tested with LCD3 cape on
> beaglebone.
> 
> TODO: need some way to control the appropriate backlight device
> TODO: probably want to make the DT bindings more generic for panel-info
> 
> v1: original
> v2: s/of_find_node_by_name()/of_get_child_by_name()/ from Pantelis
>     Antoniou
> 
> Signed-off-by: Rob Clark <robdclark@gmail.com>

> +static enum drm_connector_status panel_connector_detect(
> +		struct drm_connector *connector,
> +		bool force)
> +{
> +	return connector_status_connected;
> +}
> +
> +/* maybe this should be helper in drm-core? */
> +static inline void copy_timings_to_drm(struct drm_display_mode *mode,
> +		struct display_timing *timing)
> +{

This actually is a helper already and is called of_get_drm_display_mode.

> +	mode->clock = timing->pixelclock.typ / 1000;
> +
> +	mode->hdisplay = timing->hactive.typ;
> +	mode->hsync_start = mode->hdisplay + timing->hfront_porch.typ;
> +	mode->hsync_end = mode->hsync_start + timing->hsync_len.typ;
> +	mode->htotal = mode->hsync_end + timing->hback_porch.typ;
> +
> +	mode->vdisplay = timing->vactive.typ;
> +	mode->vsync_start = mode->vdisplay + timing->vfront_porch.typ;
> +	mode->vsync_end = mode->vsync_start + timing->vsync_len.typ;
> +	mode->vtotal = mode->vsync_end + timing->vback_porch.typ;
> +
> +	mode->flags = 0;
> +
> +	if (timing->interlaced)
> +		mode->flags |= DRM_MODE_FLAG_INTERLACE;
> +
> +	if (timing->doublescan)
> +		mode->flags |= DRM_MODE_FLAG_DBLSCAN;
> +
> +	if (timing->hsync_pol_active)
> +		mode->flags |= DRM_MODE_FLAG_PHSYNC;
> +	else
> +		mode->flags |= DRM_MODE_FLAG_NHSYNC;
> +
> +	if (timing->vsync_pol_active)
> +		mode->flags |= DRM_MODE_FLAG_PVSYNC;
> +	else
> +		mode->flags |= DRM_MODE_FLAG_NVSYNC;
> +}
> +

[...]

> +
> +static struct of_device_id panel_of_match[];
> +
> +static int __devinit panel_probe(struct platform_device *pdev)
> +{
> +	struct device_node *node = pdev->dev.of_node;
> +	struct panel_module *panel_mod;
> +	struct lcdc_module *mod;
> +	struct pinctrl *pinctrl;
> +	int ret = -EINVAL;
> +
> +	/* bail out early if no DT data: */
> +	if (!of_match_device(panel_of_match, &pdev->dev)) {
> +		dev_err(&pdev->dev, "device-tree data is missing\n");
> +		return -ENXIO;
> +	}

You wouldn't be here if the device didn't match. How about

	if (!node)
		return -ENXIO;

instead which prevents you from trying to probe the device when
somebody registered a device without dt support?
Same for the other platform devices in this series.

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 |

WARNING: multiple messages have this Message-ID (diff)
From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] RFC: drm/lcdc: add support for LCD panels (v2)
Date: Fri, 11 Jan 2013 14:13:53 +0100	[thread overview]
Message-ID: <20130111131353.GA4247@pengutronix.de> (raw)
In-Reply-To: <1357704685-3600-3-git-send-email-robdclark@gmail.com>

Hi Rob,

On Tue, Jan 08, 2013 at 10:11:23PM -0600, Rob Clark wrote:
> Add an output panel driver for LCD panels.  Tested with LCD3 cape on
> beaglebone.
> 
> TODO: need some way to control the appropriate backlight device
> TODO: probably want to make the DT bindings more generic for panel-info
> 
> v1: original
> v2: s/of_find_node_by_name()/of_get_child_by_name()/ from Pantelis
>     Antoniou
> 
> Signed-off-by: Rob Clark <robdclark@gmail.com>

> +static enum drm_connector_status panel_connector_detect(
> +		struct drm_connector *connector,
> +		bool force)
> +{
> +	return connector_status_connected;
> +}
> +
> +/* maybe this should be helper in drm-core? */
> +static inline void copy_timings_to_drm(struct drm_display_mode *mode,
> +		struct display_timing *timing)
> +{

This actually is a helper already and is called of_get_drm_display_mode.

> +	mode->clock = timing->pixelclock.typ / 1000;
> +
> +	mode->hdisplay = timing->hactive.typ;
> +	mode->hsync_start = mode->hdisplay + timing->hfront_porch.typ;
> +	mode->hsync_end = mode->hsync_start + timing->hsync_len.typ;
> +	mode->htotal = mode->hsync_end + timing->hback_porch.typ;
> +
> +	mode->vdisplay = timing->vactive.typ;
> +	mode->vsync_start = mode->vdisplay + timing->vfront_porch.typ;
> +	mode->vsync_end = mode->vsync_start + timing->vsync_len.typ;
> +	mode->vtotal = mode->vsync_end + timing->vback_porch.typ;
> +
> +	mode->flags = 0;
> +
> +	if (timing->interlaced)
> +		mode->flags |= DRM_MODE_FLAG_INTERLACE;
> +
> +	if (timing->doublescan)
> +		mode->flags |= DRM_MODE_FLAG_DBLSCAN;
> +
> +	if (timing->hsync_pol_active)
> +		mode->flags |= DRM_MODE_FLAG_PHSYNC;
> +	else
> +		mode->flags |= DRM_MODE_FLAG_NHSYNC;
> +
> +	if (timing->vsync_pol_active)
> +		mode->flags |= DRM_MODE_FLAG_PVSYNC;
> +	else
> +		mode->flags |= DRM_MODE_FLAG_NVSYNC;
> +}
> +

[...]

> +
> +static struct of_device_id panel_of_match[];
> +
> +static int __devinit panel_probe(struct platform_device *pdev)
> +{
> +	struct device_node *node = pdev->dev.of_node;
> +	struct panel_module *panel_mod;
> +	struct lcdc_module *mod;
> +	struct pinctrl *pinctrl;
> +	int ret = -EINVAL;
> +
> +	/* bail out early if no DT data: */
> +	if (!of_match_device(panel_of_match, &pdev->dev)) {
> +		dev_err(&pdev->dev, "device-tree data is missing\n");
> +		return -ENXIO;
> +	}

You wouldn't be here if the device didn't match. How about

	if (!node)
		return -ENXIO;

instead which prevents you from trying to probe the device when
somebody registered a device without dt support?
Same for the other platform devices in this series.

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 |

  reply	other threads:[~2013-01-11 13:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-09  4:11 [RFC 0/4] TI LCDC DRM driver Rob Clark
2013-01-09  4:11 ` Rob Clark
2013-01-09  4:11 ` [PATCH 1/4] RFC: drm/lcdc: add TI LCD Controller DRM driver (v2) Rob Clark
2013-01-09  4:11   ` Rob Clark
2013-01-09  4:11 ` [PATCH 2/4] RFC: drm/lcdc: add support for LCD panels (v2) Rob Clark
2013-01-09  4:11   ` Rob Clark
2013-01-11 13:13   ` Sascha Hauer [this message]
2013-01-11 13:13     ` Sascha Hauer
2013-01-09  4:11 ` [PATCH 3/4] RFC: drm/i2c: nxp-tda998x Rob Clark
2013-01-09  4:11   ` Rob Clark
2013-01-09  4:11 ` [PATCH 4/4] RFC: drm/lcdc: add encoder slave Rob Clark
2013-01-09  4:11   ` Rob Clark
2013-01-10  0:16 ` [RFC 0/4] TI LCDC DRM driver Dave Airlie
2013-01-10  0:16   ` Dave Airlie
2013-01-11  0:05   ` Laurent Pinchart
2013-01-11  0:05     ` Laurent Pinchart
2013-01-11  3:15     ` Rob Clark
2013-01-11  3:15       ` Rob Clark
2013-01-11  9:43       ` Laurent Pinchart
2013-01-11  9:43         ` Laurent Pinchart

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=20130111131353.GA4247@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=robdclark@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.