linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Diamand <chris.diamand@gmail.com>
To: kristoffer.ericson@gmail.com
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
	Chris Diamand <chris.diamand@gmail.com>
Subject: [PATCH] Jornada 720: Fixes "Invalid argument" when changing backlight brightness.
Date: Thu, 23 Feb 2012 00:36:01 +0000	[thread overview]
Message-ID: <1329957361-8010-1-git-send-email-chris.diamand@gmail.com> (raw)

On jornada 720. Running:
echo n > /sys/class/backlight/s1d13806fb/brightness
would give a "write error: Invalid argument" as the max_brightness
was not set, so any value other that 0 exceeds it. Now sets
max_brightness to 255 when the module is loaded.

Backlight can also be turned on and off using
echo 0-4 > /sys/class/backlight/s1d13806fb/bl_power

Also added some extra braces so jornada720_ssp.c.

Signed-off-by: Chris Diamand <chris.diamand@gmail.com>
---
 arch/arm/mach-sa1100/jornada720_ssp.c      |    3 ++-
 drivers/video/backlight/jornada720_bllcd.c |   12 +++++-------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-sa1100/jornada720_ssp.c b/arch/arm/mach-sa1100/jornada720_ssp.c
index 7ab256a..289ae0f 100644
--- a/arch/arm/mach-sa1100/jornada720_ssp.c
+++ b/arch/arm/mach-sa1100/jornada720_ssp.c
@@ -95,9 +95,10 @@ int jornada_ssp_inout(u8 byte)
 		ret = jornada_ssp_byte(byte);
 		/* Proper return to commands is TxDummy */
 		if (ret != TXDUMMY) {
-			for (i = 0; i < 256; i++)/* flushing bus */
+			for (i = 0; i < 256; i++) { /* flushing bus */
 				if (jornada_ssp_byte(TXDUMMY) == -1)
 					break;
+			}
 			return -ETIMEDOUT;
 		}
 	} else /* Exchange TxDummy for data */
diff --git a/drivers/video/backlight/jornada720_bllcd.c b/drivers/video/backlight/jornada720_bllcd.c
index 645f9ba..bc30faa 100644
--- a/drivers/video/backlight/jornada720_bllcd.c
+++ b/drivers/video/backlight/jornada720_bllcd.c
@@ -71,12 +71,11 @@ static int jornada_bl_update_status(struct backlight_device *dev)
 	if (dev->props.power != FB_BLANK_UNBLANK ||
 	dev->props.fb_blank != FB_BLANK_UNBLANK) {
 		ret = jornada_ssp_inout(BRIGHTNESSOFF);
-		if (ret == -ETIMEDOUT) {
-			printk(KERN_ERR "bl : brightness off timeout\n");
+		if (ret == -ETIMEDOUT)
+			printk(KERN_ERR "bl :brightness off timeout\n");
 			/* backlight off */
-			PPSR &= ~PPC_LDD1;
-			PPDR |= PPC_LDD1;
-		}
+		PPSR &= ~PPC_LDD1;
+		PPDR |= PPC_LDD1;
 	} else { /* backlight on */
 		PPSR |= PPC_LDD1;
 		/* send setbrightness cmd */
@@ -233,6 +232,7 @@ static int jornada_bl_probe(struct platform_device *pdev)
 
 	bllcd->bl_device->props.power = FB_BLANK_UNBLANK;
 	bllcd->bl_device->props.brightness = BL_DEF_BRIGHT;
+	bllcd->bl_device->props.max_brightness = BL_MAX_BRIGHT;
 	jornada_bl_update_status(bllcd->bl_device);
 
 	platform_set_drvdata(pdev, bllcd);
@@ -261,7 +261,6 @@ static int jornada_bl_suspend(struct platform_device *pdev, pm_message_t state)
 
 	bllcd->bl_device->props.power = FB_BLANK_POWERDOWN;
 	bllcd->bl_device->props.brightness = 0;
-	bllcd->bl_device->props.max_brightness = 0;
 	jornada_bl_update_status(bllcd->bl_device);
 
 	jornada_lcd_set_power(bllcd->lcd_device, FB_BLANK_POWERDOWN);
@@ -275,7 +274,6 @@ static int jornada_bl_resume(struct platform_device *pdev)
 
 	bllcd->bl_device->props.power = FB_BLANK_UNBLANK;
 	bllcd->bl_device->props.brightness = BL_DEF_BRIGHT;
-	bllcd->bl_device->props.max_brightness = BL_MAX_BRIGHT;
 	jornada_bl_update_status(bllcd->bl_device);
 
 	jornada_lcd_set_power(bllcd->lcd_device, FB_BLANK_UNBLANK);
-- 
1.7.9


             reply	other threads:[~2012-02-23  0:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23  0:36 Chris Diamand [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-02-23  0:57 [PATCH] Jornada 720: Fixes "Invalid argument" when changing backlight brightness Chris Diamand

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=1329957361-8010-1-git-send-email-chris.diamand@gmail.com \
    --to=chris.diamand@gmail.com \
    --cc=kristoffer.ericson@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).