Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 340096
b: refs/heads/master
c: 87c37b5
h: refs/heads/master
v: v3
  • Loading branch information
Alexander Shiyan authored and Olof Johansson committed Nov 21, 2012
1 parent 28fa18f commit 98f7495
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 41 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: 90383e0ac2ae3df283f2b56997040f71f6d1df08
refs/heads/master: 87c37b51ade7d1296ab99ed8f237637bed7779c7
34 changes: 34 additions & 0 deletions trunk/arch/arm/mach-clps711x/edb7211.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
*/

#include <linux/init.h>
#include <linux/gpio.h>
#include <linux/delay.h>
#include <linux/memblock.h>
#include <linux/types.h>
#include <linux/interrupt.h>
Expand All @@ -18,12 +20,17 @@
#include <asm/mach/arch.h>
#include <asm/mach-types.h>

#include <video/platform_lcd.h>

#include <mach/hardware.h>

#include "common.h"

#define VIDEORAM_SIZE SZ_128K

#define EDB7211_LCD_DC_DC_EN CLPS711X_GPIO(3, 1)
#define EDB7211_LCDEN CLPS711X_GPIO(3, 2)

#define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300)
#define EDB7211_CS8900_IRQ (IRQ_EINT3)

Expand All @@ -32,6 +39,28 @@ static struct resource edb7211_cs8900_resource[] __initdata = {
DEFINE_RES_IRQ(EDB7211_CS8900_IRQ),
};

static void edb7211_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
{
if (power) {
gpio_set_value(EDB7211_LCDEN, 1);
udelay(100);
gpio_set_value(EDB7211_LCD_DC_DC_EN, 1);
} else {
gpio_set_value(EDB7211_LCD_DC_DC_EN, 0);
udelay(100);
gpio_set_value(EDB7211_LCDEN, 0);
}
}

static struct plat_lcd_data edb7211_lcd_power_pdata = {
.set_power = edb7211_lcd_power_set,
};

static struct gpio edb7211_gpios[] __initconst = {
{ EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" },
{ EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" },
};

static struct map_desc edb7211_io_desc[] __initdata = {
{ /* Memory-mapped extra keyboard row */
.virtual = IO_ADDRESS(EP7211_PHYS_EXTKBD),
Expand Down Expand Up @@ -83,6 +112,11 @@ fixup_edb7211(struct tag *tags, char **cmdline, struct meminfo *mi)

static void __init edb7211_init(void)
{
gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));

platform_device_register_data(&platform_bus, "platform-lcd", 0,
&edb7211_lcd_power_pdata,
sizeof(edb7211_lcd_power_pdata));
platform_device_register_simple("video-clps711x", 0, NULL, 0);
platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource,
ARRAY_SIZE(edb7211_cs8900_resource));
Expand Down
2 changes: 0 additions & 2 deletions trunk/arch/arm/mach-clps711x/include/mach/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@
* Relevant bits in port D, which controls power to the various parts of
* the LCD on the EDB7211.
*/
#define EDB_PD1_LCD_DC_DC_EN (1<<1)
#define EDB_PD2_LCDEN (1<<2)
#define EDB_PD3_LCDBL (1<<3)

#endif
20 changes: 20 additions & 0 deletions trunk/arch/arm/mach-clps711x/p720t.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,27 @@
#include <asm/mach/map.h>
#include <mach/syspld.h>

#include <video/platform_lcd.h>

#include "common.h"

#define GPIO_USERLED CLPS711X_GPIO(3, 0)

static void p720t_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
{
if (power) {
PLD_LCDEN = PLD_LCDEN_EN;
PLD_PWR |= PLD_S4_ON | PLD_S2_ON | PLD_S1_ON;
} else {
PLD_PWR &= ~(PLD_S4_ON | PLD_S2_ON | PLD_S1_ON);
PLD_LCDEN = 0;
}
}

static struct plat_lcd_data p720t_lcd_power_pdata = {
.set_power = p720t_lcd_power_set,
};

/*
* Map the P720T system PLD. It occupies two address spaces:
* 0x10000000 and 0x10400000. We map both regions as one.
Expand Down Expand Up @@ -121,6 +138,9 @@ static struct gpio_led_platform_data p720t_gpio_led_pdata __initdata = {

static void __init p720t_init(void)
{
platform_device_register_data(&platform_bus, "platform-lcd", 0,
&p720t_lcd_power_pdata,
sizeof(p720t_lcd_power_pdata));
platform_device_register_simple("video-clps711x", 0, NULL, 0);
}

Expand Down
44 changes: 6 additions & 38 deletions trunk/drivers/video/clps711xfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,35 +167,16 @@ static int clps7111fb_blank(int blank, struct fb_info *info)
/* Turn off the LCD backlight. */
clps_writeb(clps_readb(PDDR) & ~EDB_PD3_LCDBL, PDDR);

/* Power off the LCD DC-DC converter. */
clps_writeb(clps_readb(PDDR) & ~EDB_PD1_LCD_DC_DC_EN, PDDR);

/* Delay for a little while (half a second). */
udelay(100);

/* Power off the LCD panel. */
clps_writeb(clps_readb(PDDR) & ~EDB_PD2_LCDEN, PDDR);

/* Power off the LCD controller. */
/* Disable LCD controller. */
clps_writel(clps_readl(SYSCON1) & ~SYSCON1_LCDEN,
SYSCON1);
}
} else {
if (machine_is_edb7211()) {
/* Power up the LCD controller. */
/* Enable LCD controller. */
clps_writel(clps_readl(SYSCON1) | SYSCON1_LCDEN,
SYSCON1);

/* Power up the LCD panel. */
clps_writeb(clps_readb(PDDR) | EDB_PD2_LCDEN, PDDR);

/* Delay for a little while. */
udelay(100);

/* Power up the LCD DC-DC converter. */
clps_writeb(clps_readb(PDDR) | EDB_PD1_LCD_DC_DC_EN,
PDDR);

/* Turn on the LCD backlight. */
clps_writeb(clps_readb(PDDR) | EDB_PD3_LCDBL, PDDR);
}
Expand Down Expand Up @@ -386,21 +367,10 @@ static int __devinit clps711x_fb_probe(struct platform_device *pdev)
/*
* Power up the LCD
*/
if (machine_is_p720t()) {
PLD_LCDEN = PLD_LCDEN_EN;
PLD_PWR |= (PLD_S4_ON|PLD_S3_ON|PLD_S2_ON|PLD_S1_ON);
}
if (machine_is_p720t())
PLD_PWR |= PLD_S3_ON;

if (machine_is_edb7211()) {
/* Power up the LCD panel. */
clps_writeb(clps_readb(PDDR) | EDB_PD2_LCDEN, PDDR);

/* Delay for a little while. */
udelay(100);

/* Power up the LCD DC-DC converter. */
clps_writeb(clps_readb(PDDR) | EDB_PD1_LCD_DC_DC_EN, PDDR);

/* Turn on the LCD backlight. */
clps_writeb(clps_readb(PDDR) | EDB_PD3_LCDBL, PDDR);
}
Expand All @@ -418,10 +388,8 @@ static int __devexit clps711x_fb_remove(struct platform_device *pdev)
/*
* Power down the LCD
*/
if (machine_is_p720t()) {
PLD_LCDEN = 0;
PLD_PWR &= ~(PLD_S4_ON|PLD_S3_ON|PLD_S2_ON|PLD_S1_ON);
}
if (machine_is_p720t())
PLD_PWR &= ~PLD_S3_ON;

return 0;
}
Expand Down

0 comments on commit 98f7495

Please sign in to comment.