diff options
author | Philipp Zabel <philipp.zabel@gmail.com> | 2008-04-12 13:28:02 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-04-19 11:29:08 +0100 |
commit | 81447b2ee6a62cef884aa017e70bbe8c02f0d63b (patch) | |
tree | f54135121703e5a0175f7fa2fd2403529a3cd40e /arch | |
parent | 5dc3339aa5ba29593ea57814049ddca8c12831c8 (diff) |
[ARM] 4965/1: magician: use htc-pasic3,leds-pasic3,ds1wm,leds-gpio
This patch enables LEDs and the 1-wire bus (connected to
a DS2760 battery monitor) on the magician.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/configs/magician_defconfig | 23 | ||||
-rw-r--r-- | arch/arm/mach-pxa/magician.c | 116 |
2 files changed, 132 insertions, 7 deletions
diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig index 69ac0e4f1fe..4d11678584d 100644 --- a/arch/arm/configs/magician_defconfig +++ b/arch/arm/configs/magician_defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.24-rc6 -# Sat Dec 22 10:38:43 2007 +# Sun Dec 30 13:02:54 2007 # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -694,12 +694,26 @@ CONFIG_I2C_PXA=m # # CONFIG_SPI is not set # CONFIG_SPI_MASTER is not set -# CONFIG_W1 is not set +CONFIG_W1=y + +# +# 1-wire Bus Masters +# +# CONFIG_W1_MASTER_DS2482 is not set +CONFIG_W1_MASTER_DS1WM=y + +# +# 1-wire Slaves +# +# CONFIG_W1_SLAVE_THERM is not set +# CONFIG_W1_SLAVE_SMEM is not set +# CONFIG_W1_SLAVE_DS2433 is not set +CONFIG_W1_SLAVE_DS2760=y CONFIG_POWER_SUPPLY=y # CONFIG_POWER_SUPPLY_DEBUG is not set CONFIG_PDA_POWER=y # CONFIG_APM_POWER is not set -# CONFIG_BATTERY_DS2760 is not set +CONFIG_BATTERY_DS2760=y # CONFIG_HWMON is not set # CONFIG_WATCHDOG is not set @@ -714,6 +728,7 @@ CONFIG_SSB_POSSIBLE=y # # CONFIG_MFD_SM501 is not set CONFIG_HTC_EGPIO=y +CONFIG_HTC_PASIC3=y # # Multimedia devices @@ -855,7 +870,7 @@ CONFIG_SDIO_UART=m # MMC/SD Host Controller Drivers # CONFIG_MMC_PXA=y -# CONFIG_NEW_LEDS is not set +CONFIG_NEW_LEDS=y CONFIG_RTC_LIB=y CONFIG_RTC_CLASS=y CONFIG_RTC_HCTOSYS=y diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 9e126a90113..06dad355230 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c @@ -20,6 +20,7 @@ #include <linux/gpio_keys.h> #include <linux/input.h> #include <linux/mfd/htc-egpio.h> +#include <linux/mfd/htc-pasic3.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/physmap.h> @@ -299,6 +300,107 @@ static struct platform_device backlight = { .id = -1, }; +/* + * LEDs + */ + +struct gpio_led gpio_leds[] = { + { + .name = "magician::vibra", + .default_trigger = "none", + .gpio = GPIO22_MAGICIAN_VIBRA_EN, + }, + { + .name = "magician::phone_bl", + .default_trigger = "none", + .gpio = GPIO103_MAGICIAN_LED_KP, + }, +}; + +static struct gpio_led_platform_data gpio_led_info = { + .leds = gpio_leds, + .num_leds = ARRAY_SIZE(gpio_leds), +}; + +static struct platform_device leds_gpio = { + .name = "leds-gpio", + .id = -1, + .dev = { + .platform_data = &gpio_led_info, + }, +}; + +static struct pasic3_led pasic3_leds[] = { + { + .led = { + .name = "magician:red", + .default_trigger = "ds2760-battery.0-charging", + }, + .hw_num = 0, + .bit2 = PASIC3_BIT2_LED0, + .mask = PASIC3_MASK_LED0, + }, + { + .led = { + .name = "magician:green", + .default_trigger = "ds2760-battery.0-charging-or-full", + }, + .hw_num = 1, + .bit2 = PASIC3_BIT2_LED1, + .mask = PASIC3_MASK_LED1, + }, + { + .led = { + .name = "magician:blue", + .default_trigger = "bluetooth", + }, + .hw_num = 2, + .bit2 = PASIC3_BIT2_LED2, + .mask = PASIC3_MASK_LED2, + }, +}; + +static struct platform_device pasic3; + +static struct pasic3_leds_machinfo __devinit pasic3_leds_info = { + .num_leds = ARRAY_SIZE(pasic3_leds), + .power_gpio = EGPIO_MAGICIAN_LED_POWER, + .leds = pasic3_leds, +}; + +/* + * PASIC3 with DS1WM + */ + +static struct resource pasic3_resources[] = { + [0] = { + .start = PXA_CS2_PHYS, + .end = PXA_CS2_PHYS + 0x1b, + .flags = IORESOURCE_MEM, + }, + /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */ + [1] = { + .start = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), + .end = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, + } +}; + +static struct pasic3_platform_data pasic3_platform_data = { + .bus_shift = 2, + .led_pdata = &pasic3_leds_info, + .clock_rate = 4000000, +}; + +static struct platform_device pasic3 = { + .name = "pasic3", + .id = -1, + .num_resources = ARRAY_SIZE(pasic3_resources), + .resource = pasic3_resources, + .dev = { + .platform_data = &pasic3_platform_data, + }, +}; /* * External power @@ -320,10 +422,16 @@ static void magician_set_charge(int flags) gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags); } +static char *magician_supplicants[] = { + "ds2760-battery.0", "backup-battery" +}; + static struct pda_power_pdata power_supply_info = { - .is_ac_online = magician_is_ac_online, - .is_usb_online = magician_is_usb_online, - .set_charge = magician_set_charge, + .is_ac_online = magician_is_ac_online, + .is_usb_online = magician_is_usb_online, + .set_charge = magician_set_charge, + .supplied_to = magician_supplicants, + .num_supplicants = ARRAY_SIZE(magician_supplicants), }; static struct resource power_supply_resources[] = { @@ -449,8 +557,10 @@ static struct platform_device *devices[] __initdata = { &gpio_keys, &egpio, &backlight, + &pasic3, &power_supply, &strataflash, + &leds_gpio, }; static void __init magician_init(void) |