Loading arch/arm/mach-s3c2410/Kconfig +8 −0 Original line number Diff line number Diff line Loading @@ -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 Loading arch/arm/mach-s3c2410/Makefile +2 −1 Original line number Diff line number Diff line Loading @@ -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 Loading arch/arm/mach-s3c2410/h1940-bluetooth.c +42 −46 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <linux/ctype.h> #include <linux/leds.h> #include <linux/gpio.h> #include <linux/rfkill.h> #include <mach/regs-gpio.h> #include <mach/hardware.h> Loading @@ -24,21 +25,10 @@ #define DRV_NAME "h1940-bt" #ifdef CONFIG_LEDS_H1940 DEFINE_LED_TRIGGER(bt_led_trigger); #endif static int state; /* Bluetooth control */ static void h1940bt_enable(int on) { if (on) { #ifdef CONFIG_LEDS_H1940 /* flashing Blue */ led_trigger_event(bt_led_trigger, LED_HALF); #endif /* Power on the chip */ h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER); /* Reset the chip */ Loading @@ -46,48 +36,31 @@ static void h1940bt_enable(int on) s3c2410_gpio_setpin(S3C2410_GPH(1), 1); mdelay(10); s3c2410_gpio_setpin(S3C2410_GPH(1), 0); state = 1; } else { #ifdef CONFIG_LEDS_H1940 led_trigger_event(bt_led_trigger, 0); #endif s3c2410_gpio_setpin(S3C2410_GPH(1), 1); mdelay(10); s3c2410_gpio_setpin(S3C2410_GPH(1), 0); mdelay(10); h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0); state = 0; } } static ssize_t h1940bt_show(struct device *dev, struct device_attribute *attr, char *buf) static int h1940bt_set_block(void *data, bool blocked) { return snprintf(buf, PAGE_SIZE, "%d\n", state); h1940bt_enable(!blocked); return 0; } static ssize_t h1940bt_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int new_state; char *endp; new_state = simple_strtoul(buf, &endp, 0); if (*endp && !isspace(*endp)) return -EINVAL; h1940bt_enable(new_state); return count; } static DEVICE_ATTR(enable, 0644, h1940bt_show, h1940bt_store); static const struct rfkill_ops h1940bt_rfkill_ops = { .set_block = h1940bt_set_block, }; static int __init h1940bt_probe(struct platform_device *pdev) { struct rfkill *rfk; int ret = 0; /* Configures BT serial port GPIOs */ s3c2410_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0); s3c2410_gpio_pullup(S3C2410_GPH(0), 1); Loading @@ -98,21 +71,44 @@ static int __init h1940bt_probe(struct platform_device *pdev) s3c2410_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0); s3c2410_gpio_pullup(S3C2410_GPH(3), 1); #ifdef CONFIG_LEDS_H1940 led_trigger_register_simple("h1940-bluetooth", &bt_led_trigger); #endif /* disable BT by default */ h1940bt_enable(0); rfk = rfkill_alloc(DRV_NAME, &pdev->dev, RFKILL_TYPE_BLUETOOTH, &h1940bt_rfkill_ops, NULL); if (!rfk) { ret = -ENOMEM; goto err_rfk_alloc; } rfkill_set_led_trigger_name(rfk, "h1940-bluetooth"); ret = rfkill_register(rfk); if (ret) goto err_rfkill; platform_set_drvdata(pdev, rfk); return 0; return device_create_file(&pdev->dev, &dev_attr_enable); err_rfkill: rfkill_destroy(rfk); err_rfk_alloc: return ret; } static int h1940bt_remove(struct platform_device *pdev) { #ifdef CONFIG_LEDS_H1940 led_trigger_unregister_simple(bt_led_trigger); #endif struct rfkill *rfk = platform_get_drvdata(pdev); platform_set_drvdata(pdev, NULL); if (rfk) { rfkill_unregister(rfk); rfkill_destroy(rfk); } rfk = NULL; h1940bt_enable(0); return 0; } Loading arch/arm/mach-s3c2410/mach-bast.c +4 −4 Original line number Diff line number Diff line Loading @@ -248,7 +248,7 @@ static int chip0_map[] = { 1 }; static int chip1_map[] = { 2 }; static int chip2_map[] = { 3 }; static struct mtd_partition bast_default_nand_part[] = { static struct mtd_partition __initdata bast_default_nand_part[] = { [0] = { .name = "Boot Agent", .size = SZ_16K, Loading @@ -274,7 +274,7 @@ static struct mtd_partition bast_default_nand_part[] = { * socket. */ static struct s3c2410_nand_set bast_nand_sets[] = { static struct s3c2410_nand_set __initdata bast_nand_sets[] = { [0] = { .name = "SmartMedia", .nr_chips = 1, Loading Loading @@ -324,7 +324,7 @@ static void bast_nand_select(struct s3c2410_nand_set *set, int slot) __raw_writeb(tmp, BAST_VA_CTRL2); } static struct s3c2410_platform_nand bast_nand_info = { static struct s3c2410_platform_nand __initdata bast_nand_info = { .tacls = 30, .twrph0 = 60, .twrph1 = 60, Loading Loading @@ -631,7 +631,6 @@ static void __init bast_map_io(void) s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks)); s3c_device_nand.dev.platform_data = &bast_nand_info; s3c_device_hwmon.dev.platform_data = &bast_hwmon_info; s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); Loading @@ -645,6 +644,7 @@ static void __init bast_init(void) sysdev_register(&bast_pm_sysdev); s3c_i2c0_set_platdata(&bast_i2c_info); s3c_nand_set_platdata(&bast_nand_info); s3c24xx_fb_set_platdata(&bast_fb_info); platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices)); Loading arch/arm/mach-s3c2410/mach-h1940.c +100 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,11 @@ #include <linux/serial_core.h> #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> #include <asm/mach/arch.h> #include <asm/mach/map.h> Loading @@ -32,9 +37,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> Loading @@ -46,6 +54,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] = { Loading Loading @@ -171,16 +180,90 @@ static struct s3c2410fb_mach_info h1940_fb_info __initdata = { .gpdup_mask= 0xffffffff, }; static struct platform_device s3c_device_leds = { static struct platform_device h1940_device_leds = { .name = "h1940-leds", .id = -1, }; static struct platform_device s3c_device_bluetooth = { static struct platform_device h1940_device_bluetooth = { .name = "h1940-bt", .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 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, Loading @@ -188,8 +271,13 @@ static struct platform_device *h1940_devices[] __initdata = { &s3c_device_i2c0, &s3c_device_iis, &s3c_device_usbgadget, &s3c_device_leds, &s3c_device_bluetooth, &h1940_device_leds, &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) Loading Loading @@ -219,6 +307,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. */ Loading @@ -231,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)); } Loading Loading
arch/arm/mach-s3c2410/Kconfig +8 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
arch/arm/mach-s3c2410/Makefile +2 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
arch/arm/mach-s3c2410/h1940-bluetooth.c +42 −46 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <linux/ctype.h> #include <linux/leds.h> #include <linux/gpio.h> #include <linux/rfkill.h> #include <mach/regs-gpio.h> #include <mach/hardware.h> Loading @@ -24,21 +25,10 @@ #define DRV_NAME "h1940-bt" #ifdef CONFIG_LEDS_H1940 DEFINE_LED_TRIGGER(bt_led_trigger); #endif static int state; /* Bluetooth control */ static void h1940bt_enable(int on) { if (on) { #ifdef CONFIG_LEDS_H1940 /* flashing Blue */ led_trigger_event(bt_led_trigger, LED_HALF); #endif /* Power on the chip */ h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER); /* Reset the chip */ Loading @@ -46,48 +36,31 @@ static void h1940bt_enable(int on) s3c2410_gpio_setpin(S3C2410_GPH(1), 1); mdelay(10); s3c2410_gpio_setpin(S3C2410_GPH(1), 0); state = 1; } else { #ifdef CONFIG_LEDS_H1940 led_trigger_event(bt_led_trigger, 0); #endif s3c2410_gpio_setpin(S3C2410_GPH(1), 1); mdelay(10); s3c2410_gpio_setpin(S3C2410_GPH(1), 0); mdelay(10); h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0); state = 0; } } static ssize_t h1940bt_show(struct device *dev, struct device_attribute *attr, char *buf) static int h1940bt_set_block(void *data, bool blocked) { return snprintf(buf, PAGE_SIZE, "%d\n", state); h1940bt_enable(!blocked); return 0; } static ssize_t h1940bt_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int new_state; char *endp; new_state = simple_strtoul(buf, &endp, 0); if (*endp && !isspace(*endp)) return -EINVAL; h1940bt_enable(new_state); return count; } static DEVICE_ATTR(enable, 0644, h1940bt_show, h1940bt_store); static const struct rfkill_ops h1940bt_rfkill_ops = { .set_block = h1940bt_set_block, }; static int __init h1940bt_probe(struct platform_device *pdev) { struct rfkill *rfk; int ret = 0; /* Configures BT serial port GPIOs */ s3c2410_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0); s3c2410_gpio_pullup(S3C2410_GPH(0), 1); Loading @@ -98,21 +71,44 @@ static int __init h1940bt_probe(struct platform_device *pdev) s3c2410_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0); s3c2410_gpio_pullup(S3C2410_GPH(3), 1); #ifdef CONFIG_LEDS_H1940 led_trigger_register_simple("h1940-bluetooth", &bt_led_trigger); #endif /* disable BT by default */ h1940bt_enable(0); rfk = rfkill_alloc(DRV_NAME, &pdev->dev, RFKILL_TYPE_BLUETOOTH, &h1940bt_rfkill_ops, NULL); if (!rfk) { ret = -ENOMEM; goto err_rfk_alloc; } rfkill_set_led_trigger_name(rfk, "h1940-bluetooth"); ret = rfkill_register(rfk); if (ret) goto err_rfkill; platform_set_drvdata(pdev, rfk); return 0; return device_create_file(&pdev->dev, &dev_attr_enable); err_rfkill: rfkill_destroy(rfk); err_rfk_alloc: return ret; } static int h1940bt_remove(struct platform_device *pdev) { #ifdef CONFIG_LEDS_H1940 led_trigger_unregister_simple(bt_led_trigger); #endif struct rfkill *rfk = platform_get_drvdata(pdev); platform_set_drvdata(pdev, NULL); if (rfk) { rfkill_unregister(rfk); rfkill_destroy(rfk); } rfk = NULL; h1940bt_enable(0); return 0; } Loading
arch/arm/mach-s3c2410/mach-bast.c +4 −4 Original line number Diff line number Diff line Loading @@ -248,7 +248,7 @@ static int chip0_map[] = { 1 }; static int chip1_map[] = { 2 }; static int chip2_map[] = { 3 }; static struct mtd_partition bast_default_nand_part[] = { static struct mtd_partition __initdata bast_default_nand_part[] = { [0] = { .name = "Boot Agent", .size = SZ_16K, Loading @@ -274,7 +274,7 @@ static struct mtd_partition bast_default_nand_part[] = { * socket. */ static struct s3c2410_nand_set bast_nand_sets[] = { static struct s3c2410_nand_set __initdata bast_nand_sets[] = { [0] = { .name = "SmartMedia", .nr_chips = 1, Loading Loading @@ -324,7 +324,7 @@ static void bast_nand_select(struct s3c2410_nand_set *set, int slot) __raw_writeb(tmp, BAST_VA_CTRL2); } static struct s3c2410_platform_nand bast_nand_info = { static struct s3c2410_platform_nand __initdata bast_nand_info = { .tacls = 30, .twrph0 = 60, .twrph1 = 60, Loading Loading @@ -631,7 +631,6 @@ static void __init bast_map_io(void) s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks)); s3c_device_nand.dev.platform_data = &bast_nand_info; s3c_device_hwmon.dev.platform_data = &bast_hwmon_info; s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); Loading @@ -645,6 +644,7 @@ static void __init bast_init(void) sysdev_register(&bast_pm_sysdev); s3c_i2c0_set_platdata(&bast_i2c_info); s3c_nand_set_platdata(&bast_nand_info); s3c24xx_fb_set_platdata(&bast_fb_info); platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices)); Loading
arch/arm/mach-s3c2410/mach-h1940.c +100 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,11 @@ #include <linux/serial_core.h> #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> #include <asm/mach/arch.h> #include <asm/mach/map.h> Loading @@ -32,9 +37,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> Loading @@ -46,6 +54,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] = { Loading Loading @@ -171,16 +180,90 @@ static struct s3c2410fb_mach_info h1940_fb_info __initdata = { .gpdup_mask= 0xffffffff, }; static struct platform_device s3c_device_leds = { static struct platform_device h1940_device_leds = { .name = "h1940-leds", .id = -1, }; static struct platform_device s3c_device_bluetooth = { static struct platform_device h1940_device_bluetooth = { .name = "h1940-bt", .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 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, Loading @@ -188,8 +271,13 @@ static struct platform_device *h1940_devices[] __initdata = { &s3c_device_i2c0, &s3c_device_iis, &s3c_device_usbgadget, &s3c_device_leds, &s3c_device_bluetooth, &h1940_device_leds, &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) Loading Loading @@ -219,6 +307,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. */ Loading @@ -231,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)); } Loading