Skip to contentSkip to conversation

h1940 updates

RFC PATCH In review [email protected] 2 participants 6 messages Nov 17, 2009 – Nov 18, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover h1940 updates

Hi,

This patchset gives an update to h1940 support. It contains:

- add mmc host device
- add rtc device
- add a lcd and backlight devices using platform-lcd and pwm-backlight
- converts the bluetooth support to use the rfkill framework

This has been tested on a 2.6.31 and build tested on your next-s3c24xx-dev-updates branch.

Please, also note that I'm not really good at giving patch descriptions so feel free to correct them if needed.

Thanks,
Arnaud

#1 lore raw

PATCH 1/4 h1940: add mmc device

Hi,
Content-Disposition: inline; filename=h1940_add_mmc.patch

This patch add mmc host support to h1940

---
arch/arm/mach-s3c2410/mach-h1940.c | 19 18 + 1 - 0 !

 1 file changed, 18 insertions(+), 1 deletion(-)
arch/arm/mach-s3c2410/mach-h1940.c +18 -1
Index: linux/arch/arm/mach-s3c2410/mach-h1940.c
===================================================================
@@ -21,6 +21,9 @@
 #include <linux/serial_core.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/gpio.h>
+
+#include <linux/mmc/host.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -32,9 +35,12 @@
 
 #include <plat/regs-serial.h>
 #include <mach/regs-lcd.h>
-#include <mach/regs-gpio.h>
 #include <mach/regs-clock.h>
 
+#include <mach/regs-gpio.h>
+#include <mach/gpio-fns.h>
+#include <mach/gpio-nrs.h>
+
 #include <mach/h1940.h>
 #include <mach/h1940-latch.h>
 #include <mach/fb.h>
@@ -46,6 +52,7 @@
 #include <plat/cpu.h>
 #include <plat/pll.h>
 #include <plat/pm.h>
+#include <plat/mci.h>
 
 static struct map_desc h1940_iodesc[] __initdata = {
 	[0] = {
@@ -181,6 +188,13 @@ static struct platform_device h1940_devi
 	.id               = -1,
 };
 
+static struct s3c24xx_mci_pdata h1940_mmc_cfg = {
+	.gpio_detect   = S3C2410_GPF(5),
+	.gpio_wprotect = S3C2410_GPH(8),
+	.set_power     = NULL,
+	.ocr_avail     = MMC_VDD_32_33,
+};
+
 static struct platform_device *h1940_devices[] __initdata = {
 	&s3c_device_usb,
 	&s3c_device_lcd,
@@ -190,6 +204,7 @@ static struct platform_device *h1940_dev
 	&s3c_device_usbgadget,
 	&h1940_device_leds,
 	&h1940_device_bluetooth,
+	&s3c_device_sdi,
 };
 
 static void __init h1940_map_io(void)
@@ -219,6 +234,8 @@ static void __init h1940_init(void)
  	s3c24xx_udc_set_platdata(&h1940_udc_cfg);
 	s3c_i2c0_set_platdata(NULL);
 
+	s3c_device_sdi.dev.platform_data = &h1940_mmc_cfg;
+
 	/* Turn off suspend on both USB ports, and switch the
 	 * selectable USB port to USB device mode. */
 
#2 lore raw

PATCH 2/4 h1940: enable rtc

In reply to [email protected]

Hi,
Content-Disposition: inline; filename=rtc.patch

Enable 2410 rtc on h1940

---
arch/arm/mach-s3c2410/mach-h1940.c | 1 1 + 0 - 0 !

 1 file changed, 1 insertion(+)
arch/arm/mach-s3c2410/mach-h1940.c +1 -0
Index: linux/arch/arm/mach-s3c2410/mach-h1940.c
===================================================================
@@ -205,6 +205,7 @@ static struct platform_device *h1940_dev
 	&h1940_device_leds,
 	&h1940_device_bluetooth,
 	&s3c_device_sdi,
+	&s3c_device_rtc,
 };
 
 static void __init h1940_map_io(void)
#3 lore raw

PATCH 3/4 h1940: add lcd/backlight device definition

In reply to [email protected]

Hi,
Content-Disposition: inline; filename=h1940_lcd_backlight.patch

Add lcd and backlight device definition. The pwm backlight stuff does not allow to really set maximum pwm as with my custom driver but it's better to use standard driver instead of out of tree driver.

---
arch/arm/mach-s3c2410/mach-h1940.c | 77 77 + 0 - 0 !

 1 file changed, 77 insertions(+)
arch/arm/mach-s3c2410/mach-h1940.c +77 -0
Index: linux/arch/arm/mach-s3c2410/mach-h1940.c
===================================================================
@@ -22,6 +22,8 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/pwm_backlight.h>
+#include <video/platform_lcd.h>
 
 #include <linux/mmc/host.h>
 
@@ -195,6 +197,73 @@ static struct s3c24xx_mci_pdata h1940_mm
 	.ocr_avail     = MMC_VDD_32_33,
 };
 
+static int h1940_backlight_init(struct device *dev)
+{
+	gpio_request(S3C2410_GPB(0), "Backlight");
+
+	s3c2410_gpio_setpin(S3C2410_GPB(0), 0);
+	s3c2410_gpio_pullup(S3C2410_GPB(0), 0);
+	s3c2410_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
+
+	return 0;
+}
+
+static void h1940_backlight_exit(struct device *dev)
+{
+	s3c2410_gpio_cfgpin(S3C2410_GPB(0), 1/*S3C2410_GPB0_OUTP*/);
+}
+
+static struct platform_pwm_backlight_data backlight_data = {
+	.pwm_id         = 0,
+	.max_brightness = 100,
+	.dft_brightness = 50,
+	/* tcnt = 0x31 */
+	.pwm_period_ns  = 36296,
+	.init           = h1940_backlight_init,
+	.exit           = h1940_backlight_exit,
+};
+
+static struct platform_device h1940_backlight = {
+	.name = "pwm-backlight",
+	.dev  = {
+		.parent = &s3c_device_timer[0].dev,
+		.platform_data = &backlight_data,
+	},
+	.id   = -1,
+};
+
+static void h1940_lcd_power_set(struct plat_lcd_data *pd,
+					unsigned int power)
+{
+	int value;
+
+	if (!power) {
+		/* set to 3ec */
+		s3c2410_gpio_setpin(S3C2410_GPC(0), 0);
+		/* wait for 3ac */
+		do {
+			value = s3c2410_gpio_getpin(S3C2410_GPC(6));
+		} while (value);
+		/* set to 38c */
+		s3c2410_gpio_setpin(S3C2410_GPC(5), 0);
+	} else {
+		/* Set to 3ac */
+		s3c2410_gpio_setpin(S3C2410_GPC(5), 1);
+		/* Set to 3ad */
+		s3c2410_gpio_setpin(S3C2410_GPC(0), 1);
+	}
+}
+
+static struct plat_lcd_data h1940_lcd_power_data = {
+	.set_power      = h1940_lcd_power_set,
+};
+
+static struct platform_device h1940_lcd_powerdev = {
+	.name                   = "platform-lcd",
+	.dev.parent             = &s3c_device_lcd.dev,
+	.dev.platform_data      = &h1940_lcd_power_data,
+};
+
 static struct platform_device *h1940_devices[] __initdata = {
 	&s3c_device_usb,
 	&s3c_device_lcd,
@@ -206,6 +275,9 @@ static struct platform_device *h1940_dev
 	&h1940_device_bluetooth,
 	&s3c_device_sdi,
 	&s3c_device_rtc,
+	&s3c_device_timer[0],
+	&h1940_backlight,
+	&h1940_lcd_powerdev,
 };
 
 static void __init h1940_map_io(void)
@@ -249,6 +321,11 @@ static void __init h1940_init(void)
 	      | (0x03 << S3C24XX_PLLCON_SDIVSHIFT);
 	writel(tmp, S3C2410_UPLLCON);
 
+	gpio_request(S3C2410_GPC(0), "LCD power");
+	gpio_request(S3C2410_GPC(5), "LCD power");
+	gpio_request(S3C2410_GPC(6), "LCD power");
+
+
 	platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
 }
 
#4 lore raw

PATCH 4/4 Convert h1940 bluetooth driver to rfkill

In reply to [email protected]

Hi,
Content-Disposition: inline; filename=h1940bt_rfkill.patch

Better using standard interfaces to enable/disable bluetooth

---

 arch/arm/mach-s3c2410/Kconfig           |    8 	8 +	0 -	0 !
 arch/arm/mach-s3c2410/Makefile          |    3 	2 +	1 -	0 !
 arch/arm/mach-s3c2410/h1940-bluetooth.c |   88 	42 +	46 -	0 !
 3 files changed, 52 insertions(+), 47 deletions(-)
arch/arm/mach-s3c2410/Kconfig +8 -0
Index: linux/arch/arm/mach-s3c2410/Kconfig
===================================================================
@@ -81,6 +81,14 @@ config ARCH_H1940
 	help
 	  Say Y here if you are using the HP IPAQ H1940
 
+config H1940BT
+        tristate "Control the state of H1940 bluetooth chip"
+        depends on ARCH_H1940
+        select RFKILL
+        help
+          This is a simple driver that is able to control
+          the state of built in bluetooth chip on h1940.
+
 config PM_H1940
 	bool
 	help
arch/arm/mach-s3c2410/Makefile +2 -1
Index: linux/arch/arm/mach-s3c2410/Makefile
===================================================================
@@ -21,7 +21,8 @@ obj-$(CONFIG_S3C2410_PLLTABLE)	+= pll.o
 # Machine support
 
 obj-$(CONFIG_ARCH_SMDK2410)	+= mach-smdk2410.o
-obj-$(CONFIG_ARCH_H1940)	+= mach-h1940.o h1940-bluetooth.o
+obj-$(CONFIG_ARCH_H1940)	+= mach-h1940.o
+obj-$(CONFIG_H1940BT)		+= h1940-bluetooth.o
 obj-$(CONFIG_PM_H1940)		+= pm-h1940.o
 obj-$(CONFIG_MACH_N30)		+= mach-n30.o
 obj-$(CONFIG_ARCH_BAST)		+= mach-bast.o usb-simtec.o
arch/arm/mach-s3c2410/h1940-bluetooth.c +42 -46

138 lines not on this page · raw message

#5 lore raw
In reply to [email protected]
Quoted 9 lines · On Tue, Nov 17, 2009 at 02:54:55PM +0100, [email protected] wrote:

Hi,

This patchset gives an update to h1940 support. It contains:

- add mmc host device
- add rtc device
- add a lcd and backlight devices using platform-lcd and pwm-backlight
- converts the bluetooth support to use the rfkill framework

Quoted 4 lines

This has been tested on a 2.6.31 and build tested on your next-s3c24xx-dev-updates branch.

Please, also note that I'm not really good at giving patch descriptions so feel free to correct them if needed.

I've put these in a branch, howerver it showing your realname as '[email protected]' so if you want this changing please resubmit (privately will be ok) with a better realname in the email

Also, it left 'Content-Disposition: inline; filename=h1940_lcd_backlight.patch ' in the patch.

Please also wrap descriptions to 77 or less characters per line.

If possible, prefix subjects with 'ARM: H1940' instead of 'h1940:'

Signature · 4 lines
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.