- Acer n35 fixes and features
Subsystems (2)
cover - Acer n35 fixes and features
This series fix some minor bugs on Acer n35 and add new features:
* fix invalid key codes (typing error)
* Replace hardcoded numbers by named constants in UART configuration
* Fix MMC power management
* Add touchscreen support
* Add LCD backlight regulation
PATCH 1/6 n35: fix key codes and types
--- arch/arm/mach-s3c2410/mach-n30.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
(quoted diff) +0 -0
b/arch/arm/mach-s3c2410/mach-n30.c
index 41f299d..e732619 100644
arch/arm/mach-s3c2410/mach-n30.c +2 -3
@@ -174,7 +174,6 @@ static struct gpio_keys_button n35_buttons[] = { { .gpio = S3C2410_GPF(0), .code = KEY_POWER, - .type = EV_PWR, .desc = "Power", .active_low = 0, .wakeup = 1,
@@ -193,13 +192,13 @@ static struct gpio_keys_button n35_buttons[] = { }, { .gpio = S3C2410_GPG(6), - .code = KEY_DOWN, + .code = KEY_LEFT, .desc = "Joystick Left", .active_low = 0, }, { .gpio = S3C2410_GPG(5), - .code = KEY_DOWN, + .code = KEY_RIGHT, .desc = "Joystick Right", .active_low = 0, },
Signature · 1 line
1.7.3.1
PATCH 2/6 n35: Update GPIO documentation for Acer n35
--- arch/arm/mach-s3c2410/mach-n30.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-)
(quoted diff) +0 -0
b/arch/arm/mach-s3c2410/mach-n30.c
index e732619..abbb9b5 100644
arch/arm/mach-s3c2410/mach-n30.c +0 -0
@@ -410,13 +410,11 @@ static struct s3c2410_platform_i2c __initdata
n30_i2ccfg = {
static void __init n30_hwinit(void)
{
/* GPA0-11 special functions -- unknown what they do
- * GPA12 N30 special function -- unknown what it does
- * N35/PiN output -- unknown what it does
- *
- * A12 is nGCS1 on the N30 and an output on the N35/PiN. I
- * don't think it does anything useful on the N30, so I ought
- * to make it an output there too since it always driven to 0
- * as far as I can tell. */
+ * GPA12 N30 special function (nGCS1) -- unknown what it does
+ * PiN output -- unknown function + * N35 output -- turn on/off red led, 0 = normal operation, + * 1 = turn off red led at all. Note: GPD9 must be input or + * output with value set to 1 before setting GPA12 to 0. */
if (machine_is_n30())
__raw_writel(0x007fffff, S3C2410_GPACON);
if (machine_is_n35())
Signature · 1 line
1.7.3.1
PATCH 3/6] n30: Clean up UARTs configuration
--- arch/arm/mach-s3c2410/mach-n30.c | 28 +++++++++++++++------- arch/arm/plat-samsung/include/plat/regs-serial.h | 3 ++ 2 files changed, 22 insertions(+), 9 deletions(-)
(quoted diff) +0 -0
b/arch/arm/mach-s3c2410/mach-n30.c
index abbb9b5..895e1e9a 100644
arch/arm/mach-s3c2410/mach-n30.c +19 -9
@@ -55,32 +55,42 @@ static struct map_desc n30_iodesc[] __initdata = {/* nothing here yet */ }; +#define UCON (S3C2410_UCON_DEFAULT | \ + S3C2443_UCON_RXERR_IRQEN) + +#define ULCON (S3C2410_LCON_CS8 | \ + S3C2410_LCON_PNONE) + +#define UFCON (S3C2410_UFCON_FIFOMODE | \ + S3C2410_UFCON_RXTRIG8 | \ + S3C2410_UFCON_TXTRIG4) +static struct s3c2410_uartcfg n30_uartcfgs[] = {/* Normal serial port */ [0 ] = { .hwport =0 , .flags =0 , - .ucon =0x2c5 , - .ulcon =0x03 , - .ufcon =0x51 , + .ucon =UCON , + .ulcon =ULCON , + .ufcon =UFCON , },/* IR port */ [1 ] = { .hwport =1 , .flags =0 , .uart_flags =UPF_CONS_FLOW , - .ucon =0x2c5 , - .ulcon =0x43 , - .ufcon =0x51 , + .ucon =UCON , + .ulcon =ULCON |S3C2410_LCON_IRM , + .ufcon =UFCON , },/* On the N30 the bluetooth controller is connected here. * On the N35 and variants the GPS receiver is connected here. */ [2 ] = { .hwport =2 , .flags =0 , - .ucon =0x2c5 , - .ulcon =0x03 , - .ufcon =0x51 , + .ucon =UCON , + .ulcon =ULCON , + .ufcon =UFCON , }, };
(quoted diff) +0 -0
b/arch/arm/plat-samsung/include/plat/regs-serial.h index 788837e..c64beca 100644
arch/arm/plat-samsung/include/plat/regs-serial.h +3 -0
@@ -114,6 +114,9 @@#define S3C2410_UFCON_FIFOMODE (1<<0)#define S3C2410_UFCON_TXTRIG0 (0<<6) +#define S3C2410_UFCON_TXTRIG4 (1<<6) +#define S3C2410_UFCON_TXTRIG8 (2<<6) +#define S3C2410_UFCON_TXTRIG12 (3<<6)#define S3C2410_UFCON_RXTRIG8 (1<<4)#define S3C2410_UFCON_RXTRIG12 (2<<4)
Signature · 1 line
1.7.3.1
PATCH 4/6 n30: Fix MMC power management
MMC "works" in both on or off state, but when operate in off causes serious data corruptions.
--- arch/arm/mach-s3c2410/mach-n30.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0
b/arch/arm/mach-s3c2410/mach-n30.c
index 895e1e9a..ecc039a 100644
arch/arm/mach-s3c2410/mach-n30.c +0 -0
@@ -366,11 +366,11 @@ static void n30_sdi_set_power(unsigned char
power_mode, unsigned short vdd)
switch (power_mode) {
case MMC_POWER_ON:
case MMC_POWER_UP:
- gpio_set_value(S3C2410_GPG(4), 1);
+ gpio_set_value(S3C2410_GPG(4), 0);
break;
case MMC_POWER_OFF:
default:
- gpio_set_value(S3C2410_GPG(4), 0);
+ gpio_set_value(S3C2410_GPG(4), 1);
break;
}
}
Signature · 1 line
1.7.3.1
PATCH 5/6 n30: Add touchscreen support for Ace n35
--- arch/arm/mach-s3c2410/Kconfig | 1 + arch/arm/mach-s3c2410/mach-n30.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2410/Kconfig +1 -0
@@ -100,6 +100,7 @@ config MACH_N30 select MACH_N35 select S3C_DEV_USB_HOST select S3C_DEV_NAND + select S3C2410_SETUP_TS help Say Y here if you want suppt for the Acer N30, Acer N35, Navman PiN570, Yakumo AlphaX or Airis NC05 PDAs.
(quoted diff) +0 -0
b/arch/arm/mach-s3c2410/mach-n30.c
index ecc039a..be5235d 100644
arch/arm/mach-s3c2410/mach-n30.c +1 -0
@@ -49,6 +49,7 @@#include <plat/devs.h> #include <plat/mci.h> #include <plat/s3c2410.h> +#include <plat/ts.h> #include <plat/udc.h> static struct map_desc n30_iodesc[]__initdata = {
@@ -116,6 +117,13 @@ static struct s3c2410_udc_mach_info n30_udc_cfg
__initdata = {
.vbus_pin_inverted = 0,
};
+static struct s3c2410_ts_mach_info n30_ts_cfg __initdata = {
+ .delay = 16383,
+ .presc = 49,
+ .oversampling_shift = 3,
+ .cfg_gpio = s3c24xx_ts_cfg_gpio,
+};
+
static struct gpio_keys_button n30_buttons[] = {
{
.gpio = S3C2410_GPF(0),
@@ -391,6 +399,8 @@ static struct platform_device *n30_devices[] __initdata = {
&s3c_device_rtc,
&s3c_device_usbgadget,
&s3c_device_sdi,
+ &s3c_device_adc,
+ &s3c_device_ts,
&n30_button_device,
&n30_blue_led,
&n30_warning_led,
@@ -404,6 +414,8 @@ static struct platform_device *n35_devices[] __initdata = {
&s3c_device_rtc,
&s3c_device_usbgadget,
&s3c_device_sdi,
+ &s3c_device_adc,
+ &s3c_device_ts,
&n35_button_device,
&n35_blue_led,
&n35_warning_led,
@@ -566,6 +578,7 @@ static void __init n30_init(void)
WARN_ON(gpio_request(S3C2410_GPG(4), "mmc power"));
s3c24xx_fb_set_platdata(&n30_fb_info);
+ s3c24xx_ts_set_platdata(&n30_ts_cfg);
s3c24xx_udc_set_platdata(&n30_udc_cfg);
s3c24xx_mci_set_platdata(&n30_mci_cfg);
s3c_i2c0_set_platdata(&n30_i2ccfg);
Signature · 1 line
1.7.3.1
PATCH 6/6 n35: Add LCD backlight regulation
--- arch/arm/mach-s3c2410/mach-n30.c | 71 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 71 insertions(+), 0 deletions(-)
(quoted diff) +0 -0
b/arch/arm/mach-s3c2410/mach-n30.c
index be5235d..4199143 100644
arch/arm/mach-s3c2410/mach-n30.c +1 -0
@@ -23,6 +23,7 @@#include <linux/input.h> #include <linux/interrupt.h> #include <linux/platform_device.h> +#include <linux/pwm_backlight.h> #include <linux/serial_core.h> #include <linux/timer.h> #include <linux/io.h>
@@ -369,6 +370,74 @@ static struct s3c2410fb_mach_info n30_fb_info
__initdata = {
.lpcsel = 0x06,
};
+static int n35_backlight_init(struct device *dev)
+{
+ int ret;
+
+ ret = gpio_request(S3C2410_GPB(0), "Backlight PWM output");
+ if (ret)
+ goto request_gpb0_fail;
+ ret = gpio_request(S3C2410_GPB(1), "Backlight power");
+ if (ret)
+ goto request_gpb1_fail;
+
+ /* set GPB0 as output of PWM timer */
+ gpio_set_value(S3C2410_GPB(0), 0);
+ s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_DOWN);
+ s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
+
+ /* backlight power */
+ ret = gpio_direction_output(S3C2410_GPB(1), 1);
+ if (ret)
+ goto direction_gpb1_fail;
+ s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_UP);
+
+ return 0;
+
+direction_gpb1_fail:
+ gpio_free(S3C2410_GPB(1));
+request_gpb1_fail:
+ gpio_free(S3C2410_GPB(0));
+request_gpb0_fail:
+ return ret;
+}
+
+static int n35_backlight_notify(struct device *dev, int brightness) +{
+ /* power off backlight, values less than 14 are useless */
+ gpio_set_value(S3C2410_GPB(1), brightness > 14 ? 1 : 0);
+ return (brightness > 14 ? brightness : 0);
+}
+
+static void n35_backlight_exit(struct device *dev)
+{
+ gpio_direction_output(S3C2410_GPB(0), 0);
+ gpio_free(S3C2410_GPB(0));
+
+ gpio_set_value(S3C2410_GPB(1), 0);
+ s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_UP);
+ gpio_free(S3C2410_GPB(1));
+}
+
+static struct platform_pwm_backlight_data backlight_data = {
+ .pwm_id = 0,
+ .max_brightness = 100,
+ .dft_brightness = 50,
+ .pwm_period_ns = 3*1000*1000, + .init = n35_backlight_init, + .notify = n35_backlight_notify, + .exit = n35_backlight_exit,
+};
+
+static struct platform_device n35_backlight = {
+ .name = "pwm-backlight",
+ .dev = {
+ .parent = &s3c_device_timer[0].dev,
+ .platform_data = &backlight_data,
+ },
+ .id = -1,
+};
+
static void n30_sdi_set_power(unsigned char power_mode, unsigned short
vdd)
{
switch (power_mode) {
@@ -416,6 +485,8 @@ static struct platform_device *n35_devices[] __initdata = {
&s3c_device_sdi,
&s3c_device_adc,
&s3c_device_ts,
+ &s3c_device_timer[0],
+ &n35_backlight,
&n35_button_device,
&n35_blue_led,
&n35_warning_led,
Signature · 1 line
1.7.3.1
PATCH 1/6 n35: fix key codes and types
In reply to Jiří PinkavaOn 04/10/10 01:24, Ji?? Pinkava wrote:
A non-empty description would be helpful.
Quoted 1 line
Signed-off-by Jiri Pinkava <[email protected]>
Hi, this doesn't apply to latest linux git.
Is there something this depends on, or does it need to be re-done?
PATCH 1/6 n35: fix key codes and types
Dne 11.10.2010 01:38, Ben Dooks napsal(a):
Quoted 7 lines · Ji?? Pinkava
A non-empty description would be helpful.
Quoted 1 line
Signed-off-by Jiri Pinkava<[email protected]>Hi, this doesn't apply to latest linux git.
It is against latest linux git no extra pre-requisities, may be something messed up by my email client, resending with more comments and with git sedn-email.
Quoted 3 lines
Is there something this depends on, or does it need to be re-done?
cover - Acer n35 fixes and features
In reply to Jiří PinkavaQuoted 7 lines · Ji?? Pinkava
This series fix some minor bugs on Acer n35 and add new features:
* fix invalid key codes (typing error)
* Replace hardcoded numbers by named constants in UART configuration
* Fix MMC power management
* Add touchscreen support
* Add LCD backlight regulation
first pass looks ok, will try and ensure they're in a branch in the next day or so.
cover - Acer n35 fixes and features
In reply to Jiří PinkavaQuoted 7 lines · Ji?? Pinkava
This series fix some minor bugs on Acer n35 and add new features:
* fix invalid key codes (typing error)
* Replace hardcoded numbers by named constants in UART configuration
* Fix MMC power management
* Add touchscreen support
* Add LCD backlight regulation
Hi, could you repost with some more informative patch descriptions please, and give pointers to any pre-requisities.
PATCH 1/6 n35: fix key codes
In reply to Jiří PinkavaPower is ordinary button, marking as type EV_POWER is incorrect.
About KEY_DOWN, someone just copied the code and forgot to asociate proper keycodes. (Descriptions are correct, keycodes are not.)
--- arch/arm/mach-s3c2410/mach-n30.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
arch/arm/mach-s3c2410/mach-n30.c +2 -3
@@ -174,7 +174,6 @@ static struct gpio_keys_button n35_buttons[] = { { .gpio = S3C2410_GPF(0), .code = KEY_POWER, - .type = EV_PWR, .desc = "Power", .active_low = 0, .wakeup = 1,
@@ -193,13 +192,13 @@ static struct gpio_keys_button n35_buttons[] = { }, { .gpio = S3C2410_GPG(6), - .code = KEY_DOWN, + .code = KEY_LEFT, .desc = "Joystick Left", .active_low = 0, }, { .gpio = S3C2410_GPG(5), - .code = KEY_DOWN, + .code = KEY_RIGHT, .desc = "Joystick Right", .active_low = 0, },
Signature · 1 line
1.7.3.1
PATCH 2/6 n35: Update GPIO documentation for Acer n35
In reply to Jiří PinkavaMore precise and detailed information about GPA12 on Acer n35.
--- arch/arm/mach-s3c2410/mach-n30.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-)
arch/arm/mach-s3c2410/mach-n30.c +5 -7
@@ -410,13 +410,11 @@ static struct s3c2410_platform_i2c __initdata n30_i2ccfg = {static void __init n30_hwinit (void ) {/* GPA0-11 special functions -- unknown what they do -* GPA12 N30 special function -- unknown what it does -* N35/PiN output -- unknown what it does -* -* A12 is nGCS1 on the N30 and an output on the N35/PiN. I -* don't think it does anything useful on the N30, so I ought -* to make it an output there too since it always driven to 0 -* as far as I can tell. */ +* GPA12 N30 special function (nGCS1) -- unknown what it does +* PiN output -- unknown function +* N35 output -- turn on/off red led, 0 = normal operation, +* 1 = turn off red led at all. Note: GPD9 must be input or +* output with value set to 1 before setting GPA12 to 0. */ if (machine_is_n30 ())__raw_writel (0x007fffff ,S3C2410_GPACON );if (machine_is_n35 ())
Signature · 1 line
1.7.3.1
PATCH 3/6 n30: Clean up UARTs configuration
In reply to Jiří PinkavaJust replace numeric constatns with macros in style used in other platforms. Define missing macros for UART register configuration.
--- arch/arm/mach-s3c2410/mach-n30.c | 28 +++++++++++++++------- arch/arm/plat-samsung/include/plat/regs-serial.h | 3 ++ 2 files changed, 22 insertions(+), 9 deletions(-)
arch/arm/mach-s3c2410/mach-n30.c +19 -9
@@ -55,32 +55,42 @@ static struct map_desc n30_iodesc[] __initdata = {/* nothing here yet */ }; +#define UCON (S3C2410_UCON_DEFAULT | \ + S3C2443_UCON_RXERR_IRQEN) + +#define ULCON (S3C2410_LCON_CS8 | \ + S3C2410_LCON_PNONE) + +#define UFCON (S3C2410_UFCON_FIFOMODE | \ + S3C2410_UFCON_RXTRIG8 | \ + S3C2410_UFCON_TXTRIG4) +static struct s3c2410_uartcfg n30_uartcfgs[] = {/* Normal serial port */ [0 ] = { .hwport =0 , .flags =0 , - .ucon =0x2c5 , - .ulcon =0x03 , - .ufcon =0x51 , + .ucon =UCON , + .ulcon =ULCON , + .ufcon =UFCON , },/* IR port */ [1 ] = { .hwport =1 , .flags =0 , .uart_flags =UPF_CONS_FLOW , - .ucon =0x2c5 , - .ulcon =0x43 , - .ufcon =0x51 , + .ucon =UCON , + .ulcon =ULCON |S3C2410_LCON_IRM , + .ufcon =UFCON , },/* On the N30 the bluetooth controller is connected here. * On the N35 and variants the GPS receiver is connected here. */ [2 ] = { .hwport =2 , .flags =0 , - .ucon =0x2c5 , - .ulcon =0x03 , - .ufcon =0x51 , + .ucon =UCON , + .ulcon =ULCON , + .ufcon =UFCON , }, };
arch/arm/plat-samsung/include/plat/regs-serial.h +3 -0
@@ -114,6 +114,9 @@#define S3C2410_UFCON_FIFOMODE (1<<0)#define S3C2410_UFCON_TXTRIG0 (0<<6) +#define S3C2410_UFCON_TXTRIG4 (1<<6) +#define S3C2410_UFCON_TXTRIG8 (2<<6) +#define S3C2410_UFCON_TXTRIG12 (3<<6)#define S3C2410_UFCON_RXTRIG8 (1<<4)#define S3C2410_UFCON_RXTRIG12 (2<<4)
Signature · 1 line
1.7.3.1
PATCH 4/6 n30: Fix MMC power management on Acer n30 / n35
In reply to Jiří PinkavaSomeone (me) messed this up. MMC works even in off state, but causes serious data corruptions during write.
--- arch/arm/mach-s3c2410/mach-n30.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-s3c2410/mach-n30.c +2 -2
@@ -366,11 +366,11 @@ static void n30_sdi_set_power(unsigned char power_mode, unsigned short vdd)switch (power_mode) {case MMC_POWER_ON :case MMC_POWER_UP : -gpio_set_value (S3C2410_GPG (4 ),1 ); +gpio_set_value (S3C2410_GPG (4 ),0 );break ;case MMC_POWER_OFF :default : -gpio_set_value (S3C2410_GPG (4 ),0 ); +gpio_set_value (S3C2410_GPG (4 ),1 );break ; } }
Signature · 1 line
1.7.3.1
PATCH 5/6 n30: Add touchscreen support for Acer n30 / n35
In reply to Jiří Pinkava--- arch/arm/mach-s3c2410/Kconfig | 1 + arch/arm/mach-s3c2410/mach-n30.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2410/Kconfig +1 -0
@@ -100,6 +100,7 @@ config MACH_N30 select MACH_N35 select S3C_DEV_USB_HOST select S3C_DEV_NAND + select S3C2410_SETUP_TS help Say Y here if you want suppt for the Acer N30, Acer N35, Navman PiN570, Yakumo AlphaX or Airis NC05 PDAs.
arch/arm/mach-s3c2410/mach-n30.c +13 -0
@@ -49,6 +49,7 @@#include <plat/devs.h> #include <plat/mci.h> #include <plat/s3c2410.h> +#include <plat/ts.h> #include <plat/udc.h> static struct map_desc n30_iodesc[]__initdata = {
@@ -116,6 +117,13 @@ static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = { .vbus_pin_inverted = 0, }; +static struct s3c2410_ts_mach_info n30_ts_cfg__initdata = { + .delay =16383 , + .presc =49 , + .oversampling_shift =3 , + .cfg_gpio = s3c24xx_ts_cfg_gpio, +}; +static struct gpio_keys_button n30_buttons[] = { { .gpio =S3C2410_GPF (0 ),
@@ -391,6 +399,8 @@ static struct platform_device *n30_devices[] __initdata = { &s3c_device_rtc, &s3c_device_usbgadget, &s3c_device_sdi, + &s3c_device_adc, + &s3c_device_ts, &n30_button_device, &n30_blue_led, &n30_warning_led,
@@ -404,6 +414,8 @@ static struct platform_device *n35_devices[] __initdata = { &s3c_device_rtc, &s3c_device_usbgadget, &s3c_device_sdi, + &s3c_device_adc, + &s3c_device_ts, &n35_button_device, &n35_blue_led, &n35_warning_led,
@@ -566,6 +578,7 @@ static void __init n30_init(void)WARN_ON (gpio_request (S3C2410_GPG (4 ),"mmc power" ));s3c24xx_fb_set_platdata (&n30_fb_info); +s3c24xx_ts_set_platdata (&n30_ts_cfg);s3c24xx_udc_set_platdata (&n30_udc_cfg);s3c24xx_mci_set_platdata (&n30_mci_cfg);s3c_i2c0_set_platdata (&n30_i2ccfg);
Signature · 1 line
1.7.3.1
PATCH 6/6 n35: Add LCD backlight regulation on Acer n35
In reply to Jiří Pinkava--- arch/arm/mach-s3c2410/mach-n30.c | 71 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 71 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2410/mach-n30.c +71 -0
@@ -23,6 +23,7 @@#include <linux/input.h> #include <linux/interrupt.h> #include <linux/platform_device.h> +#include <linux/pwm_backlight.h> #include <linux/serial_core.h> #include <linux/timer.h> #include <linux/io.h>
@@ -369,6 +370,74 @@ static struct s3c2410fb_mach_info n30_fb_info __initdata = { .lpcsel = 0x06, }; +static int n35_backlight_init (struct device *dev) +{ +int ret; + + ret =gpio_request (S3C2410_GPB (0 ),"Backlight PWM output" ); +if (ret) + goto request_gpb0_fail; + ret =gpio_request (S3C2410_GPB (1 ),"Backlight power" ); +if (ret) + goto request_gpb1_fail; + +/* set GPB0 as output of PWM timer */ +gpio_set_value (S3C2410_GPB (0 ),0 ); +s3c_gpio_setpull (S3C2410_GPB (0 ),S3C_GPIO_PULL_DOWN ); +s3c_gpio_cfgpin (S3C2410_GPB (0 ),S3C2410_GPB0_TOUT0 ); + +/* backlight power */ + ret =gpio_direction_output (S3C2410_GPB (1 ),1 ); +if (ret) + goto direction_gpb1_fail; +s3c_gpio_setpull (S3C2410_GPB (1 ),S3C_GPIO_PULL_UP ); + +return 0 ; + +direction_gpb1_fail: +gpio_free (S3C2410_GPB (1 )); +request_gpb1_fail: +gpio_free (S3C2410_GPB (0 )); +request_gpb0_fail: +return ret; +} + +static int n35_backlight_notify (struct device *dev,int brightness) +{ +/* power off backlight, values less than 14 are useless */ +gpio_set_value (S3C2410_GPB (1 ), brightness >14 ?1 :0 ); +return (brightness >14 ? brightness :0 ); +} + +static void n35_backlight_exit (struct device *dev) +{ +gpio_direction_output (S3C2410_GPB (0 ),0 ); +gpio_free (S3C2410_GPB (0 )); + +gpio_set_value (S3C2410_GPB (1 ),0 ); +s3c_gpio_setpull (S3C2410_GPB (1 ),S3C_GPIO_PULL_UP ); +gpio_free (S3C2410_GPB (1 )); +} + +static struct platform_pwm_backlight_data backlight_data = { + .pwm_id =0 , + .max_brightness =100 , + .dft_brightness =50 , + .pwm_period_ns =3 *1000 *1000 , + .init = n35_backlight_init, + .notify = n35_backlight_notify, + .exit = n35_backlight_exit, +}; + +static struct platform_device n35_backlight = { + .name ="pwm-backlight" , + .dev = { + .parent = &s3c_device_timer[0 ].dev, + .platform_data = &backlight_data, + }, + .id =-1 , +}; +static void n30_sdi_set_power (unsigned char power_mode,unsigned short vdd) {switch (power_mode) {
@@ -416,6 +485,8 @@ static struct platform_device *n35_devices[] __initdata = { &s3c_device_sdi, &s3c_device_adc, &s3c_device_ts, + &s3c_device_timer[0 ], + &n35_backlight, &n35_button_device, &n35_blue_led, &n35_warning_led,
Signature · 1 line
1.7.3.1