Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 199084
b: refs/heads/master
c: 67e67df
h: refs/heads/master
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Richard Purdie committed May 26, 2010
1 parent 84cf61c commit 2178000
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 68 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: f5bf403a9dc944bf560f49dd029195e54fcbc41c
refs/heads/master: 67e67df8da723debf24f7763605776891203e8d5
76 changes: 9 additions & 67 deletions trunk/arch/arm/mach-s3c2440/mach-gta02.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@
#include <linux/io.h>

#include <linux/i2c.h>
#include <linux/backlight.h>
#include <linux/regulator/machine.h>

#include <linux/mfd/pcf50633/core.h>
#include <linux/mfd/pcf50633/mbc.h>
#include <linux/mfd/pcf50633/adc.h>
#include <linux/mfd/pcf50633/gpio.h>
#include <linux/mfd/pcf50633/pmic.h>
#include <linux/mfd/pcf50633/backlight.h>

#include <asm/mach/arch.h>
#include <asm/mach/map.h>
Expand Down Expand Up @@ -254,6 +254,12 @@ static char *gta02_batteries[] = {
"battery",
};

static struct pcf50633_bl_platform_data gta02_backlight_data = {
.default_brightness = 0x3f,
.default_brightness_limit = 0,
.ramp_time = 5,
};

struct pcf50633_platform_data gta02_pcf_pdata = {
.resumers = {
[0] = PCF50633_INT1_USBINS |
Expand All @@ -271,6 +277,8 @@ struct pcf50633_platform_data gta02_pcf_pdata = {

.charger_reference_current_ma = 1000,

.backlight_data = &gta02_backlight_data,

.reg_init_data = {
[PCF50633_REGULATOR_AUTO] = {
.constraints = {
Expand Down Expand Up @@ -478,71 +486,6 @@ static struct s3c2410_udc_mach_info gta02_udc_cfg = {

};



static void gta02_bl_set_intensity(int intensity)
{
struct pcf50633 *pcf = gta02_pcf;
int old_intensity = pcf50633_reg_read(pcf, PCF50633_REG_LEDOUT);

/* We map 8-bit intensity to 6-bit intensity in hardware. */
intensity >>= 2;

/*
* This can happen during, eg, print of panic on blanked console,
* but we can't service i2c without interrupts active, so abort.
*/
if (in_atomic()) {
printk(KERN_ERR "gta02_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);

/* Illegal to set LEDOUT to 0. */
if (!intensity)
pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_LEDOUT, 0x3f, 2);
else
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 gta02_bl_info = {
.name = "gta02-bl",
.max_intensity = 0xff,
.default_intensity = 0xff,
.set_bl_intensity = gta02_bl_set_intensity,
};

static struct platform_device gta02_bl_dev = {
.name = "generic-bl",
.id = 1,
.dev = {
.platform_data = &gta02_bl_info,
},
};



/* USB */
static struct s3c2410_hcd_info gta02_usb_info __initdata = {
.port[0] = {
Expand Down Expand Up @@ -579,7 +522,6 @@ static struct platform_device *gta02_devices[] __initdata = {
/* These guys DO need to be children of PMU. */

static struct platform_device *gta02_devices_pmu_children[] = {
&gta02_bl_dev,
};


Expand Down

0 comments on commit 2178000

Please sign in to comment.