mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Afzal Mohammed <afzal@ti.com>
To: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	Rob Landley <rob@landley.net>, Sekhar Nori <nsekhar@ti.com>,
	<linux-omap@vger.kernel.org>, <linux-fbdev@vger.kernel.org>,
	<devicetree-discuss@lists.ozlabs.org>,
	<linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v2 11/12] video: da8xx-fb: setup struct lcd_ctrl_config for dt
Date: Tue, 15 Jan 2013 19:13:14 +0530	[thread overview]
Message-ID: <6d09674a99d62d752f87dfd0e6bb625d142c68ba.1358251448.git.afzal@ti.com> (raw)
In-Reply-To: <cover.1358251447.git.afzal@ti.com>

strcut lcd_ctrl_config information required for driver is currently
obtained via platform data. To handle DT probing, create
lcd_ctrl_config and populate it with default values, these values are
sufficient for the panels so far used with this controller to work.

Signed-off-by: Afzal Mohammed <afzal@ti.com>
---
 drivers/video/da8xx-fb.c |   34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 1c1a616..5455682 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -1254,6 +1254,35 @@ static struct fb_ops da8xx_fb_ops = {
 	.fb_blank = cfb_blank,
 };
 
+static struct lcd_ctrl_config *da8xx_fb_create_cfg(struct platform_device *dev)
+{
+	struct lcd_ctrl_config *cfg;
+
+	cfg = devm_kzalloc(&dev->dev, sizeof(struct fb_videomode), GFP_KERNEL);
+	if (!cfg) {
+		dev_err(&dev->dev, "memory allocation failed\n");
+		return NULL;
+	}
+
+	/* default values */
+
+	if (lcd_revision == LCD_VERSION_1)
+		cfg->bpp = 16;
+	else
+		cfg->bpp = 32;
+
+	/*
+	 * For panels so far used with this LCDC, below statement is sufficient.
+	 * For new panels, if required, struct lcd_ctrl_cfg fields to be updated
+	 * with additional/modified values. Those values would have to be then
+	 * obtained from dt(requiring new dt bindings).
+	 */
+
+	cfg->panel_shade = COLOR_ACTIVE;
+
+	return cfg;
+}
+
 static struct fb_videomode *da8xx_fb_get_videomode(struct platform_device *dev)
 {
 	struct da8xx_lcdc_platform_data *fb_pdata = dev->dev.platform_data;
@@ -1345,7 +1374,10 @@ static int fb_probe(struct platform_device *device)
 		break;
 	}
 
-	lcd_cfg = (struct lcd_ctrl_config *)fb_pdata->controller_data;
+	if (device->dev.of_node)
+		lcd_cfg = da8xx_fb_create_cfg(device);
+	else
+		lcd_cfg = (struct lcd_ctrl_config *)fb_pdata->controller_data;
 
 	if (!lcd_cfg) {
 		ret = -EINVAL;
-- 
1.7.9.5


  parent reply	other threads:[~2013-01-15 13:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15 13:41 [PATCH v2 00/12] video: da8xx-fb: DT support Afzal Mohammed
2013-01-15 13:41 ` [PATCH v2 01/12] video: da8xx-fb: make io operations safe Afzal Mohammed
2013-01-15 13:41 ` [PATCH v2 02/12] video: da8xx-fb: fix 24bpp raster configuration Afzal Mohammed
2013-01-15 13:42 ` [PATCH v2 03/12] video: da8xx-fb: enable sync lost intr for v2 ip Afzal Mohammed
2013-01-15 13:42 ` [PATCH v2 04/12] video: da8xx-fb: use devres Afzal Mohammed
2013-01-15 13:42 ` [PATCH v2 05/12] video: da8xx-fb: ensure non-null cfg in pdata Afzal Mohammed
2013-01-15 13:42 ` [PATCH v2 06/12] video: da8xx-fb: reorganize panel detection Afzal Mohammed
2013-01-15 13:42 ` [PATCH v2 07/12] video: da8xx-fb: minimal dt support Afzal Mohammed
2013-01-15 13:42 ` [PATCH v2 08/12] video: da8xx-fb: invoke platform callback safely Afzal Mohammed
2013-01-15 13:42 ` [PATCH v2 09/12] video: da8xx-fb: obtain fb_videomode info from dt Afzal Mohammed
2013-01-15 13:43 ` [PATCH v2 10/12] video: da8xx-fb: ensure pdata only for non-dt Afzal Mohammed
2013-01-15 13:43 ` Afzal Mohammed [this message]
2013-01-15 13:44 ` [PATCH v2 12/12] video: da8xx-fb: set upstream clock rate (if reqd) Afzal Mohammed
2013-01-15 15:32   ` Mike Turquette
2013-01-16  5:02     ` Sekhar Nori
2013-01-23 13:00       ` Mohammed, Afzal

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=6d09674a99d62d752f87dfd0e6bb625d142c68ba.1358251448.git.afzal@ti.com \
    --to=afzal@ti.com \
    --cc=FlorianSchandinat@gmx.de \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=tomi.valkeinen@ti.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

all inboxes | Powered by JetHome®