-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Somebody in the thread at some point said:
| Signed-off-by: Matt Hsu <[email protected]>
| ---
| arch/arm/mach-s3c6410/mach-om-gta03.c | 74
++++++++++++++++++++++++++++++++-
| 1 files changed, 72 insertions(+), 2 deletions(-)
|
| diff --git a/arch/arm/mach-s3c6410/mach-om-gta03.c
b/arch/arm/mach-s3c6410/mach-om-gta03.c
| index 4f90239..355f523 100644
| --- a/arch/arm/mach-s3c6410/mach-om-gta03.c
| +++ b/arch/arm/mach-s3c6410/mach-om-gta03.c
| @@ -1,4 +1,4 @@
| -/* linux/arch/arm/mach-s3c6410/mach-om_gta03.c
| +a/* linux/arch/arm/mach-s3c6410/mach-om_gta03.c
Some kind of stray 'a' there
Hi Andy,
I remake the patch based on the new machine code, 3d7k.
Matt
From: Matt Hsu <[email protected]>
Date: Wed, 4 Mar 2009 12:36:08 +0800
Introduce generic backlight device on 3d7k.
The code is borrowed from gta02.
Signed-off-by: Matt Hsu <[email protected]>
---
arch/arm/mach-s3c6410/mach-om-3d7k.c | 71 +++++++++++++++++++++++++++++++++-
1 files changed, 70 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-s3c6410/mach-om-3d7k.c b/arch/arm/mach-s3c6410/mach-om-3d7k.c
index e52561d..628f2af 100644
--- a/arch/arm/mach-s3c6410/mach-om-3d7k.c
+++ b/arch/arm/mach-s3c6410/mach-om-3d7k.c
@@ -718,6 +718,72 @@ struct pcf50633_platform_data om_3d7k_pcf_pdata = {
.mbc_event_callback = om_3d7k_pmu_event_callback,
};
+static void om_3d7k_bl_set_intensity(int intensity)
+{
+ struct pcf50633 *pcf = om_3d7k_pcf;
+ int old_intensity = pcf50633_reg_read(pcf, PCF50633_REG_LEDOUT);
+ int ret;
+
+ intensity >>= 2;
+
+ /*
+ * One code path that leads here is from a kernel panic. Trying to turn
+ * the backlight on just gives us a nearly endless stream of complaints
+ * and accomplishes nothing. We can't win. Just give up.
+ *
+ * In the unlikely event that there's another path leading here while
+ * we're atomic, we print at least a warning.
+ */
+ if (in_atomic()) {
+ printk(KERN_ERR
+ "3d7k_bl_set_intensity called while atomic\n");
+ return;
+ }
+
+ old_intensity = pcf50633_reg_read(pcf, PCF50633_REG_LEDOUT);
+ if (intensity == old_intensity)
+ return;
+
+ /* We can't do this anywhere else */
+ pcf50633_reg_write(pcf, PCF50633_REG_LEDDIM, 5);
+
+ if (!(pcf50633_reg_read(pcf, PCF50633_REG_LEDENA) & 3))
+ old_intensity = 0;
+
+ /*
+ * The PCF50633 cannot handle LEDOUT = 0 (datasheet p60)
+ * if seen, you have to re-enable the LED unit
+ */
+ if (!intensity || !old_intensity)
+ pcf50633_reg_write(pcf, PCF50633_REG_LEDENA, 0);
+
+ if (!intensity) /* illegal to set LEDOUT to 0 */
+ ret = pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_LEDOUT, 0x3f,
+ 2);
+ else
+ ret = pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_LEDOUT, 0x3f,
+ intensity);
+
+ if (intensity)
+ pcf50633_reg_write(pcf, PCF50633_REG_LEDENA, 2);
+
+}
+
+static struct generic_bl_info om_3d7k_bl_info = {
+ .name = "om-3d7k-bl",
+ .max_intensity = 0xff,
+ .default_intensity = 0x7f,
+ .set_bl_intensity = om_3d7k_bl_set_intensity,
+};
+
+static struct platform_device om_3d7k_bl_dev = {
+ .name = "generic-bl",
+ .id = 1,
+ .dev = {
+ .platform_data = &om_3d7k_bl_info,
+ },
+};
+
/* BQ27000 Battery */
static int om_3d7k_get_charger_online_status(void)
{
@@ -947,11 +1013,14 @@ static void om_3d7k_pcf50633_attach_child_devices(struct pcf50633 *pcf)
platform_add_devices(om_3d7k_devices_pmu_children,
ARRAY_SIZE(om_3d7k_devices_pmu_children));
+ /* backlight device should be registered until pcf50633 probe is done */
+ om_3d7k_bl_dev.dev.parent = &om_3d7k_device_spi_lcm.dev;
+ platform_device_register(&om_3d7k_bl_dev);
+
/* Switch on backlight. Qi does not do it for us */
pcf50633_reg_write(pcf, PCF50633_REG_LEDENA, 0x00);
pcf50633_reg_write(pcf, PCF50633_REG_LEDDIM, 0x01);
pcf50633_reg_write(pcf, PCF50633_REG_LEDENA, 0x01);
- pcf50633_reg_write(pcf, PCF50633_REG_LEDOUT, 0x3f);
}
--
1.5.6.5