Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77538
b: refs/heads/master
c: 3777f77
h: refs/heads/master
v: v3
  • Loading branch information
Russell King authored and Russell King committed Jan 26, 2008
1 parent e132df2 commit 617c66b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 03f5b2cee6cabd0400b9f89956c373a0b5d3802a
refs/heads/master: 3777f7748a5d10222a55ce88f753a19b16c17032
60 changes: 50 additions & 10 deletions trunk/arch/arm/mach-pxa/mainstone.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/ioport.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/backlight.h>

#include <asm/types.h>
#include <asm/setup.h>
Expand Down Expand Up @@ -263,21 +264,60 @@ static struct platform_device mst_flash_device[2] = {
},
};

static void mainstone_backlight_power(int on)
#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
static int mainstone_backlight_update_status(struct backlight_device *bl)
{
if (on) {
int brightness = bl->props.brightness;

if (bl->props.power != FB_BLANK_UNBLANK ||
bl->props.fb_blank != FB_BLANK_UNBLANK)
brightness = 0;

if (brightness != 0) {
pxa_gpio_mode(GPIO16_PWM0_MD);
pxa_set_cken(CKEN_PWM0, 1);
PWM_CTRL0 = 0;
PWM_PWDUTY0 = 0x3ff;
PWM_PERVAL0 = 0x3ff;
} else {
PWM_CTRL0 = 0;
PWM_PWDUTY0 = 0x0;
PWM_PERVAL0 = 0x3FF;
}
PWM_CTRL0 = 0;
PWM_PWDUTY0 = brightness;
PWM_PERVAL0 = bl->props.max_brightness;
if (brightness == 0)
pxa_set_cken(CKEN_PWM0, 0);
return 0; /* pointless return value */
}

static int mainstone_backlight_get_brightness(struct backlight_device *bl)
{
return PWM_PWDUTY0;
}

static /*const*/ struct backlight_ops mainstone_backlight_ops = {
.update_status = mainstone_backlight_update_status,
.get_brightness = mainstone_backlight_get_brightness,
};

static void __init mainstone_backlight_register(void)
{
struct backlight_device *bl;

bl = backlight_device_register("mainstone-bl", &pxa_device_fb.dev,
NULL, &mainstone_backlight_ops);
if (IS_ERR(bl)) {
printk(KERN_ERR "mainstone: unable to register backlight: %ld\n",
PTR_ERR(bl));
return;
}

/*
* broken design - register-then-setup interfaces are
* utterly broken by definition.
*/
bl->props.max_brightness = 1023;
bl->props.brightness = 1023;
backlight_update_status(bl);
}
#else
#define mainstone_backlight_register() do { } while (0)
#endif

static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
.pixclock = 50000,
Expand Down Expand Up @@ -311,7 +351,6 @@ static struct pxafb_mach_info mainstone_pxafb_info = {
.num_modes = 1,
.lccr0 = LCCR0_Act,
.lccr3 = LCCR3_PCP,
.pxafb_backlight_power = mainstone_backlight_power,
};

static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_int, void *data)
Expand Down Expand Up @@ -473,6 +512,7 @@ static void __init mainstone_init(void)
mainstone_pxafb_info.modes = &toshiba_ltm035a776c_mode;

set_pxa_fb_info(&mainstone_pxafb_info);
mainstone_backlight_register();

pxa_set_mci_info(&mainstone_mci_platform_data);
pxa_set_ficp_info(&mainstone_ficp_platform_data);
Expand Down

0 comments on commit 617c66b

Please sign in to comment.