mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 04/10] video: simple-panel: Add debug/error messages
Date: Wed, 23 Sep 2015 13:47:25 +0200	[thread overview]
Message-ID: <1443008851-26596-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1443008851-26596-1-git-send-email-s.hauer@pengutronix.de>

Let the driver be more informative when something goes wrong.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/simple-panel.c | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/video/simple-panel.c b/drivers/video/simple-panel.c
index 3dd760b..4775509 100644
--- a/drivers/video/simple-panel.c
+++ b/drivers/video/simple-panel.c
@@ -30,6 +30,7 @@
 #include <i2c/i2c.h>
 
 struct simple_panel {
+	struct device_d *dev;
 	struct vpl vpl;
 	int enable_gpio;
 	int enable_active_high;
@@ -44,10 +45,14 @@ static int simple_panel_enable(struct simple_panel *panel)
 {
 	int ret;
 
+	dev_dbg(panel->dev, "enabling\n");
+
 	if (panel->backlight_node && !panel->backlight) {
 		panel->backlight = of_backlight_find(panel->backlight_node);
-		if (!panel->backlight)
+		if (!panel->backlight) {
+			dev_err(panel->dev, "Cannot find backlight\n");
 			return -ENODEV;
+		}
 	}
 
 	if (gpio_is_valid(panel->enable_gpio))
@@ -68,6 +73,8 @@ static int simple_panel_enable(struct simple_panel *panel)
 
 static int simple_panel_disable(struct simple_panel *panel)
 {
+	dev_dbg(panel->dev, "disabling\n");
+
 	if (panel->backlight)
 		backlight_set_brightness(panel->backlight, 0);
 
@@ -80,23 +87,33 @@ static int simple_panel_disable(struct simple_panel *panel)
 
 static int simple_panel_get_modes(struct simple_panel *panel, struct display_timings *timings)
 {
-	int ret = -ENOENT;
+	int ret;
 
 	if (panel->ddc_node && IS_ENABLED(CONFIG_DRIVER_VIDEO_EDID) &&
 	    IS_ENABLED(CONFIG_I2C)) {
 		struct i2c_adapter *i2c;
 
                 i2c = of_find_i2c_adapter_by_node(panel->ddc_node);
-		if (!i2c)
+		if (!i2c) {
+			dev_err(panel->dev, "cannot find edid i2c node\n");
 			return -ENODEV;
+		}
 		timings->edid = edid_read_i2c(i2c);
-		if (!timings->edid)
+		if (!timings->edid) {
+			dev_err(panel->dev, "cannot read edid data\n");
 			return -EINVAL;
+		}
 
 		ret = edid_to_display_timings(timings, timings->edid);
+		if (ret) {
+			dev_err(panel->dev, "cannot convert edid data to timings\n");
+			return ret;
+		}
 	}
 
-	return ret;
+	dev_err(panel->dev, "No modes found\n");
+
+	return -ENOENT;
 }
 
 static int simple_panel_ioctl(struct vpl *vpl, unsigned int port,
@@ -129,6 +146,7 @@ static int simple_panel_probe(struct device_d *dev)
 	panel->enable_gpio = of_get_named_gpio_flags(node, "enable-gpios", 0, &flags);
 	panel->vpl.node = node;
 	panel->vpl.ioctl = simple_panel_ioctl;
+	panel->dev = dev;
 
 	if (gpio_is_valid(panel->enable_gpio)) {
 		if (!(flags & OF_GPIO_ACTIVE_LOW))
-- 
2.5.1


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

  parent reply	other threads:[~2015-09-23 11:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23 11:47 [PATCH v2] video: imx-ipu-v3: ldb fixes Sascha Hauer
2015-09-23 11:47 ` [PATCH 01/10] video: ipuv3: Do not crash when no mode is found Sascha Hauer
2015-09-23 11:47 ` [PATCH 02/10] video: ipuv3: imx-ldb: remove unused variable Sascha Hauer
2015-09-23 11:47 ` [PATCH 03/10] video: ipuv3: imx-ldb: Support video modes in ldb node Sascha Hauer
2015-09-23 11:47 ` Sascha Hauer [this message]
2015-09-23 11:47 ` [PATCH 05/10] video: simple-panel: Add support for device tree provided nodes Sascha Hauer
2015-09-23 11:47 ` [PATCH 06/10] video: ipuv3: print error message when no modes are found Sascha Hauer
2015-09-23 11:47 ` [PATCH 07/10] video: backlight-pwm: Add error message Sascha Hauer
2015-09-23 11:47 ` [PATCH 08/10] video: backlight-pwm: Add regulator support Sascha Hauer
2015-09-23 11:47 ` [PATCH 09/10] ARM: i.MX: GuF Santaro: enable PWM Sascha Hauer
2015-09-23 11:47 ` [PATCH 10/10] ARM: i.MX: GuF Santaro: Fix panel support Sascha Hauer

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=1443008851-26596-5-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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