linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: InKi Dae <daeinki@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Pavel Machek <pavel@ucw.cz>,
	linux-fbdev-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, kyungmin.park@samsung.com
Subject: Re: [PATCH] added S6E63M0 AMOLED LCD Panel driver.
Date: Thu, 29 Apr 2010 12:30:17 +0900	[thread overview]
Message-ID: <l2n90b950fc1004282030j173e7c47ua21b92a56881f559@mail.gmail.com> (raw)
In-Reply-To: <20100427120516.c18b3bbb.akpm@linux-foundation.org>

[-- Attachment #1: Type: text/plain, Size: 1384 bytes --]

I'm sorry for being late.

this is second patch that your concern is solved.

Please review this patch.

Thank you.

Best Regards,
InKi Dae.

2010/4/28 Andrew Morton <akpm@linux-foundation.org>:
> On Tue, 30 Mar 2010 19:55:01 -0400
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
>> On Wed, 31 Mar 2010 11:41:54 +0900 InKi Dae <daeinki@gmail.com> wrote:
>>
>> > Hi Andrew,
>> >
>> > all the calls to s6e63m0_panel_send_sequence() would return -EINVAL.
>> > by api_async() of driver/spi/spi.c
>>
>> No, spi_async() does
>>
>>       master->transfer(spi, message);
>>
>> which can return at least EIO, EINPROGRESS, EINVAL or ETIMEDOUT.
>>
>> > so I think that those return values aren't changed to other.
>> >
>> > and final step is to check only whether the return value is 0 or not.
>> > if you still think that this code has minor problem or you want it to
>> > be corrected
>> > then I will patch this code to be corrected anytime.
>>
>> It's a bug.
>>
>> Also s6e63m0_power_on() is sloppy.  It again or's together disparate
>> errnos.  Then if _anything_ failed it returns hardwired -EIO, but it
>> should instead propagate the callee's errno back up to the caller.
>>
>> And s6e63m0_power_on() can return -EFAULT in several places, which is
>> nonsensical.
>>
>> None of this is very critical, just ... sloppy.
>>
>
> ping?
>

[-- Attachment #2: s6e63m0_second.patch --]
[-- Type: application/octet-stream, Size: 2954 bytes --]

diff --git a/drivers/video/backlight/s6e63m0.c b/drivers/video/backlight/s6e63m0.c
index e4793df..254a099 100644
--- a/drivers/video/backlight/s6e63m0.c
+++ b/drivers/video/backlight/s6e63m0.c
@@ -420,13 +420,25 @@ static int _s6e63m0_gamma_ctl(struct s6e63m0 *lcd, const unsigned int *gamma)
 
 	/* disable gamma table updating. */
 	ret = s6e63m0_spi_write(lcd, 0xfa, 0x00);
+	if (ret) {
+		dev_err(lcd->dev, "failed to disable gamma table updating.\n");
+		goto gamma_err;
+	}
 
-	for (i = 0 ; i < GAMMA_TABLE_COUNT; i++)
-		ret |= s6e63m0_spi_write(lcd, DATA_ONLY, gamma[i]);
+	for (i = 0 ; i < GAMMA_TABLE_COUNT; i++) {
+		ret = s6e63m0_spi_write(lcd, DATA_ONLY, gamma[i]);
+		if (ret) {
+			dev_err(lcd->dev, "failed to set gamma table.\n");
+			goto gamma_err;
+		}
+	}
 
 	/* update gamma table. */
-	ret |= s6e63m0_spi_write(lcd, 0xfa, 0x01);
+	ret = s6e63m0_spi_write(lcd, 0xfa, 0x01);
+	if (ret)
+		dev_err(lcd->dev, "failed to update gamma table.\n");
 
+gamma_err:
 	return ret;
 }
 
@@ -442,24 +454,38 @@ static int s6e63m0_gamma_ctl(struct s6e63m0 *lcd, int gamma)
 
 static int s6e63m0_ldi_init(struct s6e63m0 *lcd)
 {
-	int ret;
+	int ret, i;
+	const unsigned short *init_seq[] = {
+		SEQ_PANEL_CONDITION_SET,
+		SEQ_DISPLAY_CONDITION_SET,
+		SEQ_GAMMA_SETTING,
+		SEQ_ETC_CONDITION_SET,
+		SEQ_ACL_ON,
+		SEQ_ELVSS_ON,
+	};
 
-	ret = s6e63m0_panel_send_sequence(lcd, SEQ_PANEL_CONDITION_SET);
-	ret |= s6e63m0_panel_send_sequence(lcd, SEQ_DISPLAY_CONDITION_SET);
-	ret |= s6e63m0_panel_send_sequence(lcd, SEQ_GAMMA_SETTING);
-	ret |= s6e63m0_panel_send_sequence(lcd, SEQ_ETC_CONDITION_SET);
-	ret |= s6e63m0_panel_send_sequence(lcd, SEQ_ACL_ON);
-	ret |= s6e63m0_panel_send_sequence(lcd, SEQ_ELVSS_ON);
+	for (i = 0; i < ARRAY_SIZE(init_seq); i++) {
+		ret = s6e63m0_panel_send_sequence(lcd, init_seq[i]);
+		if (ret)
+			break;
+	}
 
 	return ret;
 }
 
 static int s6e63m0_ldi_enable(struct s6e63m0 *lcd)
 {
-	int ret = 0;
+	int ret = 0, i;
+	const unsigned short *enable_seq[] = {
+		SEQ_STAND_BY_OFF,
+		SEQ_DISPLAY_ON,
+	};
 
-	ret = s6e63m0_panel_send_sequence(lcd, SEQ_STAND_BY_OFF);
-	ret = s6e63m0_panel_send_sequence(lcd, SEQ_DISPLAY_ON);
+	for (i = 0; i < ARRAY_SIZE(enable_seq); i++) {
+		ret = s6e63m0_panel_send_sequence(lcd, enable_seq[i]);
+		if (ret)
+			break;
+	}
 
 	return ret;
 }
@@ -508,12 +534,22 @@ static int s6e63m0_power_on(struct s6e63m0 *lcd)
 	}
 
 	ret = s6e63m0_ldi_init(lcd);
-	ret |= s6e63m0_ldi_enable(lcd);
+	if (ret) {
+		dev_err(lcd->dev, "failed to initialize ldi.\n");
+		return ret;
+	}
+
+	ret = s6e63m0_ldi_enable(lcd);
+	if (ret) {
+		dev_err(lcd->dev, "failed to enable ldi.\n");
+		return ret;
+	}
+
 	/* set brightness to current value after power on or resume. */
-	ret |= s6e63m0_gamma_ctl(lcd, bd->props.brightness);
+	ret = s6e63m0_gamma_ctl(lcd, bd->props.brightness);
 	if (ret) {
 		dev_err(lcd->dev, "lcd gamma setting failed.\n");
-		return -EIO;
+		return ret;
 	}
 
 	return 0;

      reply	other threads:[~2010-04-29  3:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-26  3:24 [PATCH] added S6E63M0 AMOLED LCD Panel driver InKi Dae
2010-03-30 23:02 ` Andrew Morton
2010-03-30 23:24   ` [Linux-fbdev-devel] " H Hartley Sweeten
2010-03-31  2:56     ` InKi Dae
2010-03-31  2:41   ` InKi Dae
2010-03-30 23:55     ` Andrew Morton
2010-04-27 19:05       ` Andrew Morton
2010-04-29  3:30         ` InKi Dae [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=l2n90b950fc1004282030j173e7c47ua21b92a56881f559@mail.gmail.com \
    --to=daeinki@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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;
as well as URLs for NNTP newsgroup(s).