diff options
| -rw-r--r-- | meta/packages/linux/linux-rp-2.6.22/defconfig-htcuniversal | 26 | ||||
| -rw-r--r-- | meta/packages/linux/linux-rp-2.6.22/htcuni.patch | 944 | ||||
| -rw-r--r-- | meta/packages/linux/linux-rp-2.6.22/pda-power.patch | 3373 | ||||
| -rw-r--r-- | meta/packages/linux/linux-rp_2.6.22.bb | 1 |
4 files changed, 4121 insertions, 223 deletions
diff --git a/meta/packages/linux/linux-rp-2.6.22/defconfig-htcuniversal b/meta/packages/linux/linux-rp-2.6.22/defconfig-htcuniversal index 87cc5c081e..0df4c6a10b 100644 --- a/meta/packages/linux/linux-rp-2.6.22/defconfig-htcuniversal +++ b/meta/packages/linux/linux-rp-2.6.22/defconfig-htcuniversal | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | # | 1 | # |
| 2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
| 3 | # Linux kernel version: 2.6.22 | 3 | # Linux kernel version: 2.6.22 |
| 4 | # Thu Jul 19 00:38:46 2007 | 4 | # Thu Aug 23 14:47:39 2007 |
| 5 | # | 5 | # |
| 6 | CONFIG_ARM=y | 6 | CONFIG_ARM=y |
| 7 | CONFIG_SYS_SUPPORTS_APM_EMULATION=y | 7 | CONFIG_SYS_SUPPORTS_APM_EMULATION=y |
| @@ -160,6 +160,10 @@ CONFIG_ARCH_PXA=y | |||
| 160 | # CONFIG_MACH_TRIZEPS4 is not set | 160 | # CONFIG_MACH_TRIZEPS4 is not set |
| 161 | # CONFIG_MACH_HX2750 is not set | 161 | # CONFIG_MACH_HX2750 is not set |
| 162 | CONFIG_MACH_HTCUNIVERSAL=y | 162 | CONFIG_MACH_HTCUNIVERSAL=y |
| 163 | |||
| 164 | # | ||
| 165 | # HTC Universal support | ||
| 166 | # | ||
| 163 | CONFIG_HTCUNIVERSAL_CORE=y | 167 | CONFIG_HTCUNIVERSAL_CORE=y |
| 164 | CONFIG_HTCUNIVERSAL_UDC=y | 168 | CONFIG_HTCUNIVERSAL_UDC=y |
| 165 | CONFIG_HTCUNIVERSAL_POWER=y | 169 | CONFIG_HTCUNIVERSAL_POWER=y |
| @@ -232,7 +236,7 @@ CONFIG_ALIGNMENT_TRAP=y | |||
| 232 | # | 236 | # |
| 233 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 237 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
| 234 | CONFIG_ZBOOT_ROM_BSS=0x0 | 238 | CONFIG_ZBOOT_ROM_BSS=0x0 |
| 235 | CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 dyntick=enable quiet" | 239 | CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 dyntick=enable debug" |
| 236 | # CONFIG_XIP_KERNEL is not set | 240 | # CONFIG_XIP_KERNEL is not set |
| 237 | CONFIG_KEXEC=y | 241 | CONFIG_KEXEC=y |
| 238 | 242 | ||
| @@ -762,6 +766,12 @@ CONFIG_W1_MASTER_DS1WM=y | |||
| 762 | # CONFIG_W1_SLAVE_THERM is not set | 766 | # CONFIG_W1_SLAVE_THERM is not set |
| 763 | # CONFIG_W1_SLAVE_SMEM is not set | 767 | # CONFIG_W1_SLAVE_SMEM is not set |
| 764 | # CONFIG_W1_SLAVE_DS2433 is not set | 768 | # CONFIG_W1_SLAVE_DS2433 is not set |
| 769 | CONFIG_W1_SLAVE_DS2760=y | ||
| 770 | CONFIG_POWER_SUPPLY=y | ||
| 771 | # CONFIG_POWER_SUPPLY_DEBUG is not set | ||
| 772 | CONFIG_PDA_POWER=y | ||
| 773 | CONFIG_APM_POWER=y | ||
| 774 | CONFIG_BATTERY_DS2760=y | ||
| 765 | # CONFIG_HWMON is not set | 775 | # CONFIG_HWMON is not set |
| 766 | 776 | ||
| 767 | # | 777 | # |
| @@ -773,6 +783,7 @@ CONFIG_W1_MASTER_DS1WM=y | |||
| 773 | # | 783 | # |
| 774 | # CONFIG_MFD_SM501 is not set | 784 | # CONFIG_MFD_SM501 is not set |
| 775 | CONFIG_HTC_ASIC3=y | 785 | CONFIG_HTC_ASIC3=y |
| 786 | CONFIG_HTC_ASIC3_DS1WM=y | ||
| 776 | 787 | ||
| 777 | # | 788 | # |
| 778 | # Multi-Function Devices | 789 | # Multi-Function Devices |
| @@ -880,13 +891,13 @@ CONFIG_SOUND=y | |||
| 880 | # | 891 | # |
| 881 | # Advanced Linux Sound Architecture | 892 | # Advanced Linux Sound Architecture |
| 882 | # | 893 | # |
| 883 | CONFIG_SND=m | 894 | CONFIG_SND=y |
| 884 | CONFIG_SND_TIMER=m | 895 | CONFIG_SND_TIMER=y |
| 885 | CONFIG_SND_PCM=m | 896 | CONFIG_SND_PCM=y |
| 886 | # CONFIG_SND_SEQUENCER is not set | 897 | # CONFIG_SND_SEQUENCER is not set |
| 887 | CONFIG_SND_OSSEMUL=y | 898 | CONFIG_SND_OSSEMUL=y |
| 888 | CONFIG_SND_MIXER_OSS=m | 899 | CONFIG_SND_MIXER_OSS=y |
| 889 | CONFIG_SND_PCM_OSS=m | 900 | CONFIG_SND_PCM_OSS=y |
| 890 | CONFIG_SND_PCM_OSS_PLUGINS=y | 901 | CONFIG_SND_PCM_OSS_PLUGINS=y |
| 891 | # CONFIG_SND_DYNAMIC_MINORS is not set | 902 | # CONFIG_SND_DYNAMIC_MINORS is not set |
| 892 | CONFIG_SND_SUPPORT_OLD_API=y | 903 | CONFIG_SND_SUPPORT_OLD_API=y |
| @@ -1089,6 +1100,7 @@ CONFIG_RAMFS=y | |||
| 1089 | # CONFIG_EFS_FS is not set | 1100 | # CONFIG_EFS_FS is not set |
| 1090 | # CONFIG_JFFS2_FS is not set | 1101 | # CONFIG_JFFS2_FS is not set |
| 1091 | # CONFIG_CRAMFS is not set | 1102 | # CONFIG_CRAMFS is not set |
| 1103 | # CONFIG_SQUASHFS is not set | ||
| 1092 | # CONFIG_VXFS_FS is not set | 1104 | # CONFIG_VXFS_FS is not set |
| 1093 | # CONFIG_HPFS_FS is not set | 1105 | # CONFIG_HPFS_FS is not set |
| 1094 | # CONFIG_QNX4FS_FS is not set | 1106 | # CONFIG_QNX4FS_FS is not set |
diff --git a/meta/packages/linux/linux-rp-2.6.22/htcuni.patch b/meta/packages/linux/linux-rp-2.6.22/htcuni.patch index 6958129ca1..a83c7afa34 100644 --- a/meta/packages/linux/linux-rp-2.6.22/htcuni.patch +++ b/meta/packages/linux/linux-rp-2.6.22/htcuni.patch | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | --- | 1 | --- |
| 2 | arch/arm/mach-pxa/Kconfig | 2 | 2 | arch/arm/mach-pxa/Kconfig | 89 + |
| 3 | arch/arm/mach-pxa/Makefile | 1 | 3 | arch/arm/mach-pxa/Makefile | 1 |
| 4 | arch/arm/mach-pxa/corgi.c | 3 | 4 | arch/arm/mach-pxa/corgi.c | 3 |
| 5 | arch/arm/mach-pxa/htcuniversal/Kconfig | 80 | 5 | arch/arm/mach-pxa/generic.c | 12 |
| 6 | arch/arm/mach-pxa/htcuniversal/Makefile | 19 | 6 | arch/arm/mach-pxa/htcuniversal/Makefile | 19 |
| 7 | arch/arm/mach-pxa/htcuniversal/htcuniversal.c | 470 +++++ | 7 | arch/arm/mach-pxa/htcuniversal/htcuniversal.c | 468 +++++ |
| 8 | arch/arm/mach-pxa/htcuniversal/htcuniversal_ak4641.c | 917 +++++++++++ | 8 | arch/arm/mach-pxa/htcuniversal/htcuniversal_ak4641.c | 917 +++++++++++ |
| 9 | arch/arm/mach-pxa/htcuniversal/htcuniversal_ak4641.h | 65 | 9 | arch/arm/mach-pxa/htcuniversal/htcuniversal_ak4641.h | 65 |
| 10 | arch/arm/mach-pxa/htcuniversal/htcuniversal_asic3_leds.c | 143 + | 10 | arch/arm/mach-pxa/htcuniversal/htcuniversal_asic3_leds.c | 143 + |
| @@ -29,17 +29,23 @@ | |||
| 29 | drivers/leds/Kconfig | 7 | 29 | drivers/leds/Kconfig | 7 |
| 30 | drivers/leds/Makefile | 1 | 30 | drivers/leds/Makefile | 1 |
| 31 | drivers/leds/leds-asic3.c | 189 ++ | 31 | drivers/leds/leds-asic3.c | 189 ++ |
| 32 | drivers/mfd/Kconfig | 3 | 32 | drivers/mfd/Kconfig | 10 |
| 33 | drivers/mfd/Makefile | 2 | 33 | drivers/mfd/Makefile | 2 |
| 34 | drivers/mfd/asic3_base.c | 1208 +++++++++++++++ | 34 | drivers/mfd/asic3_base.c | 1208 +++++++++++++++ |
| 35 | drivers/mfd/soc-core.c | 106 + | 35 | drivers/mfd/soc-core.c | 106 + |
| 36 | drivers/mfd/soc-core.h | 30 | 36 | drivers/mfd/soc-core.h | 30 |
| 37 | drivers/mmc/host/Kconfig | 8 | 37 | drivers/mmc/host/Kconfig | 6 |
| 38 | drivers/mmc/host/Makefile | 2 | 38 | drivers/mmc/host/Makefile | 2 |
| 39 | drivers/mmc/host/asic3_mmc.c | 900 +++++++++++ | 39 | drivers/mmc/host/asic3_mmc.c | 900 +++++++++++ |
| 40 | drivers/mmc/host/asic3_mmc.h | 25 | 40 | drivers/mmc/host/asic3_mmc.h | 25 |
| 41 | drivers/serial/pxa.c | 22 | ||
| 41 | drivers/video/backlight/Kconfig | 2 | 42 | drivers/video/backlight/Kconfig | 2 |
| 42 | drivers/video/backlight/corgi_bl.c | 4 | 43 | drivers/video/backlight/corgi_bl.c | 4 |
| 44 | drivers/w1/slaves/Kconfig | 11 | ||
| 45 | drivers/w1/slaves/Makefile | 2 | ||
| 46 | drivers/w1/slaves/w1_ds2760.c | 213 ++ | ||
| 47 | drivers/w1/slaves/w1_ds2760.h | 50 | ||
| 48 | drivers/w1/w1_family.h | 1 | ||
| 43 | include/asm-arm/arch-pxa/clock.h | 27 | 49 | include/asm-arm/arch-pxa/clock.h | 27 |
| 44 | include/asm-arm/arch-pxa/htcuniversal-asic.h | 213 ++ | 50 | include/asm-arm/arch-pxa/htcuniversal-asic.h | 213 ++ |
| 45 | include/asm-arm/arch-pxa/htcuniversal-gpio.h | 220 ++ | 51 | include/asm-arm/arch-pxa/htcuniversal-gpio.h | 220 ++ |
| @@ -48,6 +54,7 @@ | |||
| 48 | include/asm-arm/arch-pxa/irqs.h | 2 | 54 | include/asm-arm/arch-pxa/irqs.h | 2 |
| 49 | include/asm-arm/arch-pxa/pxa-pm_ll.h | 6 | 55 | include/asm-arm/arch-pxa/pxa-pm_ll.h | 6 |
| 50 | include/asm-arm/arch-pxa/pxa-regs.h | 2 | 56 | include/asm-arm/arch-pxa/pxa-regs.h | 2 |
| 57 | include/asm-arm/arch-pxa/serial.h | 78 | ||
| 51 | include/asm-arm/arch-pxa/sharpsl.h | 6 | 58 | include/asm-arm/arch-pxa/sharpsl.h | 6 |
| 52 | include/asm-arm/hardware/asic3_keys.h | 18 | 59 | include/asm-arm/hardware/asic3_keys.h | 18 |
| 53 | include/asm-arm/hardware/asic3_leds.h | 34 | 60 | include/asm-arm/hardware/asic3_leds.h | 34 |
| @@ -59,97 +66,12 @@ | |||
| 59 | include/linux/pda_power.h | 31 | 66 | include/linux/pda_power.h | 31 |
| 60 | include/linux/soc/asic3_base.h | 104 + | 67 | include/linux/soc/asic3_base.h | 104 + |
| 61 | include/linux/soc/tmio_mmc.h | 17 | 68 | include/linux/soc/tmio_mmc.h | 17 |
| 62 | 60 files changed, 7410 insertions(+), 16 deletions(-) | 69 | 67 files changed, 7808 insertions(+), 17 deletions(-) |
| 63 | 70 | ||
| 64 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/Kconfig | ||
| 65 | =================================================================== | ||
| 66 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 67 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/Kconfig 2007-07-27 16:10:40.000000000 +0100 | ||
| 68 | @@ -0,0 +1,80 @@ | ||
| 69 | +menuconfig MACH_HTCUNIVERSAL | ||
| 70 | + bool "HTC Universal" | ||
| 71 | + select PXA27x | ||
| 72 | + select BOARD_IRQ_MAP_BIG | ||
| 73 | + help | ||
| 74 | + Say Y here if you intend to run this kernel on a | ||
| 75 | + HTC Universal. Currently there is only basic support | ||
| 76 | + for this PDA. | ||
| 77 | + | ||
| 78 | +config HTCUNIVERSAL_CORE | ||
| 79 | + tristate "HTC Universal core" | ||
| 80 | + depends on MACH_HTCUNIVERSAL | ||
| 81 | + help | ||
| 82 | + This selection enables HTC Universal core support. | ||
| 83 | + | ||
| 84 | +config HTCUNIVERSAL_UDC | ||
| 85 | + bool "USB Device Controller support" | ||
| 86 | + depends on MACH_HTCUNIVERSAL && HTC_ASIC3 && USB_PXA27X | ||
| 87 | + help | ||
| 88 | + Enables HTC Universal specific USB detection | ||
| 89 | + | ||
| 90 | +config HTCUNIVERSAL_POWER | ||
| 91 | + tristate "HTC Universal power" | ||
| 92 | + depends on MACH_HTCUNIVERSAL && HTC_ASIC3 | ||
| 93 | + help | ||
| 94 | + This selection enables HTC Universal power monitoring | ||
| 95 | + hardware support (through ASIC3). | ||
| 96 | + | ||
| 97 | +config HTCUNIVERSAL_BACKLIGHT | ||
| 98 | + bool "HTC Universal Backlight" | ||
| 99 | + depends on MACH_HTCUNIVERSAL && HTC_ASIC3 && BACKLIGHT_CLASS_DEVICE | ||
| 100 | + help | ||
| 101 | + This driver provides support for changing power and brightness | ||
| 102 | + on HTC Universal LCD backlight. | ||
| 103 | + | ||
| 104 | +config HTCUNIVERSAL_LCD | ||
| 105 | + tristate "HTC Universal LCD" | ||
| 106 | + depends on MACH_HTCUNIVERSAL && HTC_ASIC3 && LCD_CLASS_DEVICE | ||
| 107 | + help | ||
| 108 | + This driver provides support for changing power and brightness | ||
| 109 | + on HTC Universal LCD display. | ||
| 110 | + | ||
| 111 | +config HTCUNIVERSAL_TS2 | ||
| 112 | + tristate "HTC Universal Touchscreen (old)" | ||
| 113 | + depends on MACH_HTCUNIVERSAL && HTC_ASIC3 | ||
| 114 | + help | ||
| 115 | + Enable support for the HTC Universal Touchscreen Panel. | ||
| 116 | + | ||
| 117 | +config HTCUNIVERSAL_BUTTONS | ||
| 118 | + tristate "HTC Universal buttons support" | ||
| 119 | + depends on MACH_HTCUNIVERSAL && HTC_ASIC3 | ||
| 120 | + | ||
| 121 | +config HTCUNIVERSAL_BLUETOOTH | ||
| 122 | + tristate "HTC Universal Bluetooth" | ||
| 123 | + depends on MACH_HTCUNIVERSAL && HTCUNIVERSAL_CORE && HTC_ASIC3 | ||
| 124 | + help | ||
| 125 | + Enables support for the TI BRF6150 Bluetooth Module | ||
| 126 | + in the HTC Universal. | ||
| 127 | + | ||
| 128 | +config HTCUNIVERSAL_ASIC3_LEDS | ||
| 129 | + tristate "HTC Universal ASIC3 LED support" | ||
| 130 | + select LEDS_ASIC3 | ||
| 131 | + depends on MACH_HTCUNIVERSAL && HTCUNIVERSAL_CORE && HTC_ASIC3 | ||
| 132 | + ---help--- | ||
| 133 | + Support for right (colors red+green+(amber)) and left (green+blue) led | ||
| 134 | + Off/on hook keys LED backlight | ||
| 135 | + Keyboard backlight | ||
| 136 | + Vibra | ||
| 137 | + Flashlight | ||
| 138 | + | ||
| 139 | +config HTCUNIVERSAL_PHONE | ||
| 140 | + tristate "HTC Universal Phone" | ||
| 141 | + depends on MACH_HTCUNIVERSAL && HTCUNIVERSAL_CORE && HTC_ASIC3 | ||
| 142 | + help | ||
| 143 | + Enables support for the Qualcomm MSM6520 Phone Module | ||
| 144 | + in the HTC Universal. | ||
| 145 | + | ||
| 146 | +config HTCUNIVERSAL_AK4641 | ||
| 147 | + depends on SND && I2C | ||
| 148 | + tristate | ||
| 149 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/Makefile | 71 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/Makefile |
| 150 | =================================================================== | 72 | =================================================================== |
| 151 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 73 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 152 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/Makefile 2007-07-27 16:10:40.000000000 +0100 | 74 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/Makefile 2007-08-23 13:09:22.000000000 +0200 |
| 153 | @@ -0,0 +1,19 @@ | 75 | @@ -0,0 +1,19 @@ |
| 154 | +# | 76 | +# |
| 155 | +# Makefile for HTC Universal | 77 | +# Makefile for HTC Universal |
| @@ -164,8 +86,8 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/Makefile | |||
| 164 | +obj-$(CONFIG_HTCUNIVERSAL_BACKLIGHT) += htcuniversal_bl.o | 86 | +obj-$(CONFIG_HTCUNIVERSAL_BACKLIGHT) += htcuniversal_bl.o |
| 165 | +obj-$(CONFIG_HTCUNIVERSAL_TS2) += htcuniversal_ts2.o | 87 | +obj-$(CONFIG_HTCUNIVERSAL_TS2) += htcuniversal_ts2.o |
| 166 | +obj-$(CONFIG_HTCUNIVERSAL_BUTTONS) += htcuniversal_buttons.o | 88 | +obj-$(CONFIG_HTCUNIVERSAL_BUTTONS) += htcuniversal_buttons.o |
| 167 | +#obj-$(CONFIG_HTCUNIVERSAL_BLUETOOTH) += htcuniversal_bt.o | 89 | +obj-$(CONFIG_HTCUNIVERSAL_BLUETOOTH) += htcuniversal_bt.o |
| 168 | +#obj-$(CONFIG_HTCUNIVERSAL_PHONE) += htcuniversal_phone.o | 90 | +obj-$(CONFIG_HTCUNIVERSAL_PHONE) += htcuniversal_phone.o |
| 169 | +obj-$(CONFIG_HTCUNIVERSAL_ASIC3_LEDS) += htcuniversal_asic3_leds.o | 91 | +obj-$(CONFIG_HTCUNIVERSAL_ASIC3_LEDS) += htcuniversal_asic3_leds.o |
| 170 | +obj-$(CONFIG_HTCUNIVERSAL_UDC) += htcuniversal_udc.o | 92 | +obj-$(CONFIG_HTCUNIVERSAL_UDC) += htcuniversal_udc.o |
| 171 | + | 93 | + |
| @@ -173,8 +95,8 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/Makefile | |||
| 173 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal.c | 95 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal.c |
| 174 | =================================================================== | 96 | =================================================================== |
| 175 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 97 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 176 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal.c 2007-07-27 16:10:40.000000000 +0100 | 98 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal.c 2007-08-23 13:09:22.000000000 +0200 |
| 177 | @@ -0,0 +1,470 @@ | 99 | @@ -0,0 +1,468 @@ |
| 178 | +/* | 100 | +/* |
| 179 | + * Hardware definitions for HTC Universal | 101 | + * Hardware definitions for HTC Universal |
| 180 | + * | 102 | + * |
| @@ -203,7 +125,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal.c | |||
| 203 | + | 125 | + |
| 204 | +#include <asm/arch/bitfield.h> | 126 | +#include <asm/arch/bitfield.h> |
| 205 | +#include <asm/arch/pxa-regs.h> | 127 | +#include <asm/arch/pxa-regs.h> |
| 206 | +//#include <asm/arch/serial.h> | 128 | +#include <asm/arch/serial.h> |
| 207 | +#include <asm/arch/pxa27x_keyboard.h> | 129 | +#include <asm/arch/pxa27x_keyboard.h> |
| 208 | +#include <asm/arch/pxafb.h> | 130 | +#include <asm/arch/pxafb.h> |
| 209 | +#include <asm/arch/irda.h> | 131 | +#include <asm/arch/irda.h> |
| @@ -591,13 +513,12 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal.c | |||
| 591 | + pxa_init_irq(); | 513 | + pxa_init_irq(); |
| 592 | +} | 514 | +} |
| 593 | + | 515 | + |
| 594 | +//FIXME | 516 | +static struct platform_pxa_serial_funcs htcuniversal_pxa_bt_funcs = { |
| 595 | +//static struct platform_pxa_serial_funcs htcuniversal_pxa_bt_funcs = { | 517 | + .configure = htcuniversal_bt_configure, |
| 596 | +// .configure = htcuniversal_bt_configure, | 518 | +}; |
| 597 | +//}; | 519 | +static struct platform_pxa_serial_funcs htcuniversal_pxa_phone_funcs = { |
| 598 | +//static struct platform_pxa_serial_funcs htcuniversal_pxa_phone_funcs = { | 520 | + .configure = htcuniversal_phone_configure, |
| 599 | +// .configure = htcuniversal_phone_configure, | 521 | +}; |
| 600 | +//}; | ||
| 601 | + | 522 | + |
| 602 | +/* USB OHCI */ | 523 | +/* USB OHCI */ |
| 603 | + | 524 | + |
| @@ -620,9 +541,8 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal.c | |||
| 620 | +{ | 541 | +{ |
| 621 | + pxa_map_io(); | 542 | + pxa_map_io(); |
| 622 | + | 543 | + |
| 623 | +// FIXME | 544 | + pxa_set_btuart_info(&htcuniversal_pxa_bt_funcs); |
| 624 | +// pxa_set_btuart_info(&htcuniversal_pxa_bt_funcs); | 545 | + pxa_set_ffuart_info(&htcuniversal_pxa_phone_funcs); |
| 625 | +// pxa_set_ffuart_info(&htcuniversal_pxa_phone_funcs); | ||
| 626 | +} | 546 | +} |
| 627 | + | 547 | + |
| 628 | +static void __init htcuniversal_init(void) | 548 | +static void __init htcuniversal_init(void) |
| @@ -648,7 +568,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal.c | |||
| 648 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ak4641.c | 568 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ak4641.c |
| 649 | =================================================================== | 569 | =================================================================== |
| 650 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 570 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 651 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ak4641.c 2007-07-27 16:10:40.000000000 +0100 | 571 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ak4641.c 2007-08-23 13:09:22.000000000 +0200 |
| 652 | @@ -0,0 +1,917 @@ | 572 | @@ -0,0 +1,917 @@ |
| 653 | +/* | 573 | +/* |
| 654 | + * Audio support for codec Asahi Kasei AK4641 | 574 | + * Audio support for codec Asahi Kasei AK4641 |
| @@ -1570,7 +1490,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ak4641.c | |||
| 1570 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ak4641.h | 1490 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ak4641.h |
| 1571 | =================================================================== | 1491 | =================================================================== |
| 1572 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 1492 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 1573 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ak4641.h 2007-07-27 16:10:40.000000000 +0100 | 1493 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ak4641.h 2007-08-23 13:09:22.000000000 +0200 |
| 1574 | @@ -0,0 +1,65 @@ | 1494 | @@ -0,0 +1,65 @@ |
| 1575 | +/* | 1495 | +/* |
| 1576 | + * Audio support for codec Asahi Kasei AK4641 | 1496 | + * Audio support for codec Asahi Kasei AK4641 |
| @@ -1640,7 +1560,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ak4641.h | |||
| 1640 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_asic3_leds.c | 1560 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_asic3_leds.c |
| 1641 | =================================================================== | 1561 | =================================================================== |
| 1642 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 1562 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 1643 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_asic3_leds.c 2007-07-27 16:10:40.000000000 +0100 | 1563 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_asic3_leds.c 2007-08-23 13:09:22.000000000 +0200 |
| 1644 | @@ -0,0 +1,143 @@ | 1564 | @@ -0,0 +1,143 @@ |
| 1645 | +/* | 1565 | +/* |
| 1646 | + * LEDs support for the HP iPaq hx4700 | 1566 | + * LEDs support for the HP iPaq hx4700 |
| @@ -1788,7 +1708,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_asic3_leds.c | |||
| 1788 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bl.c | 1708 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bl.c |
| 1789 | =================================================================== | 1709 | =================================================================== |
| 1790 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 1710 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 1791 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bl.c 2007-07-27 16:10:40.000000000 +0100 | 1711 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bl.c 2007-08-23 13:09:22.000000000 +0200 |
| 1792 | @@ -0,0 +1,61 @@ | 1712 | @@ -0,0 +1,61 @@ |
| 1793 | +/* | 1713 | +/* |
| 1794 | + * Use consistent with the GNU GPL is permitted, | 1714 | + * Use consistent with the GNU GPL is permitted, |
| @@ -1854,7 +1774,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bl.c | |||
| 1854 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bt.c | 1774 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bt.c |
| 1855 | =================================================================== | 1775 | =================================================================== |
| 1856 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 1776 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 1857 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bt.c 2007-07-27 16:10:40.000000000 +0100 | 1777 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bt.c 2007-08-23 13:09:22.000000000 +0200 |
| 1858 | @@ -0,0 +1,135 @@ | 1778 | @@ -0,0 +1,135 @@ |
| 1859 | +/* Bluetooth interface driver for TI BRF6150 on HX4700 | 1779 | +/* Bluetooth interface driver for TI BRF6150 on HX4700 |
| 1860 | + * | 1780 | + * |
| @@ -1870,7 +1790,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bt.c | |||
| 1870 | +#include <linux/soc/asic3_base.h> | 1790 | +#include <linux/soc/asic3_base.h> |
| 1871 | + | 1791 | + |
| 1872 | +#include <asm/hardware.h> | 1792 | +#include <asm/hardware.h> |
| 1873 | +//#include <asm/arch/serial.h> | 1793 | +#include <asm/arch/serial.h> |
| 1874 | +#include <asm/hardware/ipaq-asic3.h> | 1794 | +#include <asm/hardware/ipaq-asic3.h> |
| 1875 | +#include <asm/arch/htcuniversal-gpio.h> | 1795 | +#include <asm/arch/htcuniversal-gpio.h> |
| 1876 | +#include <asm/arch/htcuniversal-asic.h> | 1796 | +#include <asm/arch/htcuniversal-asic.h> |
| @@ -1994,7 +1914,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bt.c | |||
| 1994 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bt.h | 1914 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bt.h |
| 1995 | =================================================================== | 1915 | =================================================================== |
| 1996 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 1916 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 1997 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bt.h 2007-07-27 16:10:40.000000000 +0100 | 1917 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bt.h 2007-08-23 13:09:22.000000000 +0200 |
| 1998 | @@ -0,0 +1,17 @@ | 1918 | @@ -0,0 +1,17 @@ |
| 1999 | +/* | 1919 | +/* |
| 2000 | + * Bluetooth support file for calling bluetooth configuration functions | 1920 | + * Bluetooth support file for calling bluetooth configuration functions |
| @@ -2016,7 +1936,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_bt.h | |||
| 2016 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_buttons.c | 1936 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_buttons.c |
| 2017 | =================================================================== | 1937 | =================================================================== |
| 2018 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 1938 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 2019 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_buttons.c 2007-07-27 16:10:40.000000000 +0100 | 1939 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_buttons.c 2007-08-23 13:09:22.000000000 +0200 |
| 2020 | @@ -0,0 +1,87 @@ | 1940 | @@ -0,0 +1,87 @@ |
| 2021 | +/* | 1941 | +/* |
| 2022 | + * Buttons driver for HTC Universal | 1942 | + * Buttons driver for HTC Universal |
| @@ -2108,7 +2028,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_buttons.c | |||
| 2108 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_core.c | 2028 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_core.c |
| 2109 | =================================================================== | 2029 | =================================================================== |
| 2110 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 2030 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 2111 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_core.c 2007-07-27 16:10:40.000000000 +0100 | 2031 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_core.c 2007-08-23 13:09:22.000000000 +0200 |
| 2112 | @@ -0,0 +1,226 @@ | 2032 | @@ -0,0 +1,226 @@ |
| 2113 | +/* Core Hardware driver for Hx4700 (Serial, ASIC3, EGPIOs) | 2033 | +/* Core Hardware driver for Hx4700 (Serial, ASIC3, EGPIOs) |
| 2114 | + * | 2034 | + * |
| @@ -2339,7 +2259,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_core.c | |||
| 2339 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_lcd.c | 2259 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_lcd.c |
| 2340 | =================================================================== | 2260 | =================================================================== |
| 2341 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 2261 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 2342 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_lcd.c 2007-07-27 16:10:40.000000000 +0100 | 2262 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_lcd.c 2007-08-23 13:09:22.000000000 +0200 |
| 2343 | @@ -0,0 +1,212 @@ | 2263 | @@ -0,0 +1,212 @@ |
| 2344 | +/* | 2264 | +/* |
| 2345 | + * Use consistent with the GNU GPL is permitted, | 2265 | + * Use consistent with the GNU GPL is permitted, |
| @@ -2556,7 +2476,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_lcd.c | |||
| 2556 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_phone.c | 2476 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_phone.c |
| 2557 | =================================================================== | 2477 | =================================================================== |
| 2558 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 2478 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 2559 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_phone.c 2007-07-27 16:10:40.000000000 +0100 | 2479 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_phone.c 2007-08-23 13:09:22.000000000 +0200 |
| 2560 | @@ -0,0 +1,167 @@ | 2480 | @@ -0,0 +1,167 @@ |
| 2561 | + | 2481 | + |
| 2562 | +/* Phone interface driver for Qualcomm MSM6250 on HTC Universal | 2482 | +/* Phone interface driver for Qualcomm MSM6250 on HTC Universal |
| @@ -2728,7 +2648,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_phone.c | |||
| 2728 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_phone.h | 2648 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_phone.h |
| 2729 | =================================================================== | 2649 | =================================================================== |
| 2730 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 2650 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 2731 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_phone.h 2007-07-27 16:10:40.000000000 +0100 | 2651 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_phone.h 2007-08-23 13:09:22.000000000 +0200 |
| 2732 | @@ -0,0 +1,16 @@ | 2652 | @@ -0,0 +1,16 @@ |
| 2733 | +/* | 2653 | +/* |
| 2734 | + * Bluetooth support file for calling bluetooth configuration functions | 2654 | + * Bluetooth support file for calling bluetooth configuration functions |
| @@ -2749,7 +2669,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_phone.h | |||
| 2749 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_pm.c | 2669 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_pm.c |
| 2750 | =================================================================== | 2670 | =================================================================== |
| 2751 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 2671 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 2752 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_pm.c 2007-07-27 16:10:40.000000000 +0100 | 2672 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_pm.c 2007-08-23 13:09:22.000000000 +0200 |
| 2753 | @@ -0,0 +1,69 @@ | 2673 | @@ -0,0 +1,69 @@ |
| 2754 | +/* | 2674 | +/* |
| 2755 | + * MyPal 716 power management support for the original HTC IPL in DoC G3 | 2675 | + * MyPal 716 power management support for the original HTC IPL in DoC G3 |
| @@ -2823,7 +2743,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_pm.c | |||
| 2823 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_power2.c | 2743 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_power2.c |
| 2824 | =================================================================== | 2744 | =================================================================== |
| 2825 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 2745 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 2826 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_power2.c 2007-07-27 16:10:40.000000000 +0100 | 2746 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_power2.c 2007-08-23 13:09:22.000000000 +0200 |
| 2827 | @@ -0,0 +1,97 @@ | 2747 | @@ -0,0 +1,97 @@ |
| 2828 | +/* | 2748 | +/* |
| 2829 | + * pda_power driver for HTC Universal | 2749 | + * pda_power driver for HTC Universal |
| @@ -2925,7 +2845,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_power2.c | |||
| 2925 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ts2.c | 2845 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ts2.c |
| 2926 | =================================================================== | 2846 | =================================================================== |
| 2927 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 2847 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 2928 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ts2.c 2007-07-27 16:10:40.000000000 +0100 | 2848 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ts2.c 2007-08-23 13:09:22.000000000 +0200 |
| 2929 | @@ -0,0 +1,490 @@ | 2849 | @@ -0,0 +1,490 @@ |
| 2930 | +/* Touch screen driver for the TI something-or-other | 2850 | +/* Touch screen driver for the TI something-or-other |
| 2931 | + * | 2851 | + * |
| @@ -3420,7 +3340,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_ts2.c | |||
| 3420 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_udc.c | 3340 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_udc.c |
| 3421 | =================================================================== | 3341 | =================================================================== |
| 3422 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 3342 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 3423 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_udc.c 2007-07-27 16:10:40.000000000 +0100 | 3343 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_udc.c 2007-08-23 13:09:22.000000000 +0200 |
| 3424 | @@ -0,0 +1,71 @@ | 3344 | @@ -0,0 +1,71 @@ |
| 3425 | + | 3345 | + |
| 3426 | +/* | 3346 | +/* |
| @@ -3496,7 +3416,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/htcuniversal_udc.c | |||
| 3496 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/tsc2046_ts.h | 3416 | Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/tsc2046_ts.h |
| 3497 | =================================================================== | 3417 | =================================================================== |
| 3498 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 3418 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 3499 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/tsc2046_ts.h 2007-07-27 16:10:40.000000000 +0100 | 3419 | +++ linux-2.6.22/arch/arm/mach-pxa/htcuniversal/tsc2046_ts.h 2007-08-23 13:09:22.000000000 +0200 |
| 3500 | @@ -0,0 +1,20 @@ | 3420 | @@ -0,0 +1,20 @@ |
| 3501 | +/* | 3421 | +/* |
| 3502 | + * temporary TSC2046 touchscreen hack | 3422 | + * temporary TSC2046 touchscreen hack |
| @@ -3520,22 +3440,120 @@ Index: linux-2.6.22/arch/arm/mach-pxa/htcuniversal/tsc2046_ts.h | |||
| 3520 | +#endif | 3440 | +#endif |
| 3521 | Index: linux-2.6.22/arch/arm/mach-pxa/Kconfig | 3441 | Index: linux-2.6.22/arch/arm/mach-pxa/Kconfig |
| 3522 | =================================================================== | 3442 | =================================================================== |
| 3523 | --- linux-2.6.22.orig/arch/arm/mach-pxa/Kconfig 2007-07-27 16:10:20.000000000 +0100 | 3443 | --- linux-2.6.22.orig/arch/arm/mach-pxa/Kconfig 2007-08-23 13:09:21.000000000 +0200 |
| 3524 | +++ linux-2.6.22/arch/arm/mach-pxa/Kconfig 2007-07-27 16:10:40.000000000 +0100 | 3444 | +++ linux-2.6.22/arch/arm/mach-pxa/Kconfig 2007-08-23 13:09:22.000000000 +0200 |
| 3525 | @@ -46,6 +46,8 @@ config MACH_HX2750 | 3445 | @@ -46,6 +46,14 @@ |
| 3526 | help | 3446 | help |
| 3527 | This enables support for the HP iPAQ HX2750 handheld. | 3447 | This enables support for the HP iPAQ HX2750 handheld. |
| 3528 | 3448 | ||
| 3529 | +source "arch/arm/mach-pxa/htcuniversal/Kconfig" | 3449 | +config MACH_HTCUNIVERSAL |
| 3450 | + bool "HTC Universal" | ||
| 3451 | + select PXA27x | ||
| 3452 | + help | ||
| 3453 | + Say Y here if you intend to run this kernel on a | ||
| 3454 | + HTC Universal. Currently there is only basic support | ||
| 3455 | + for this PDA. | ||
| 3530 | + | 3456 | + |
| 3531 | endchoice | 3457 | endchoice |
| 3532 | 3458 | ||
| 3533 | if PXA_SHARPSL | 3459 | if PXA_SHARPSL |
| 3460 | @@ -80,6 +88,86 @@ | ||
| 3461 | |||
| 3462 | endif | ||
| 3463 | |||
| 3464 | +if MACH_HTCUNIVERSAL | ||
| 3465 | + | ||
| 3466 | +menu "HTC Universal support" | ||
| 3467 | + | ||
| 3468 | +config HTCUNIVERSAL_CORE | ||
| 3469 | + tristate "HTC Universal core" | ||
| 3470 | + depends on MACH_HTCUNIVERSAL | ||
| 3471 | + help | ||
| 3472 | + This selection enables HTC Universal core support. | ||
| 3473 | + | ||
| 3474 | +config HTCUNIVERSAL_UDC | ||
| 3475 | + bool "USB Device Controller support" | ||
| 3476 | + depends on MACH_HTCUNIVERSAL && HTC_ASIC3 && USB_PXA27X | ||
| 3477 | + help | ||
| 3478 | + Enables HTC Universal specific USB detection | ||
| 3479 | + | ||
| 3480 | +config HTCUNIVERSAL_POWER | ||
| 3481 | + tristate "HTC Universal power" | ||
| 3482 | + depends on MACH_HTCUNIVERSAL && HTC_ASIC3 | ||
| 3483 | + help | ||
| 3484 | + This selection enables HTC Universal power monitoring | ||
| 3485 | + hardware support (through ASIC3). | ||
| 3486 | + | ||
| 3487 | +config HTCUNIVERSAL_BACKLIGHT | ||
| 3488 | + bool "HTC Universal Backlight" | ||
| 3489 | + depends on MACH_HTCUNIVERSAL && HTC_ASIC3 && BACKLIGHT_CLASS_DEVICE | ||
| 3490 | + help | ||
| 3491 | + This driver provides support for changing power and brightness | ||
| 3492 | + on HTC Universal LCD backlight. | ||
| 3493 | + | ||
| 3494 | +config HTCUNIVERSAL_LCD | ||
| 3495 | + tristate "HTC Universal LCD" | ||
| 3496 | + depends on MACH_HTCUNIVERSAL && HTC_ASIC3 && LCD_CLASS_DEVICE | ||
| 3497 | + help | ||
| 3498 | + This driver provides support for changing power and brightness | ||
| 3499 | + on HTC Universal LCD display. | ||
| 3500 | + | ||
| 3501 | +config HTCUNIVERSAL_TS2 | ||
| 3502 | + tristate "HTC Universal Touchscreen (old)" | ||
| 3503 | + depends on MACH_HTCUNIVERSAL && HTC_ASIC3 | ||
| 3504 | + help | ||
| 3505 | + Enable support for the HTC Universal Touchscreen Panel. | ||
| 3506 | + | ||
| 3507 | +config HTCUNIVERSAL_BUTTONS | ||
| 3508 | + tristate "HTC Universal buttons support" | ||
| 3509 | + depends on MACH_HTCUNIVERSAL && HTC_ASIC3 | ||
| 3510 | + | ||
| 3511 | +config HTCUNIVERSAL_BLUETOOTH | ||
| 3512 | + tristate "HTC Universal Bluetooth" | ||
| 3513 | + depends on MACH_HTCUNIVERSAL && HTCUNIVERSAL_CORE && HTC_ASIC3 | ||
| 3514 | + help | ||
| 3515 | + Enables support for the TI BRF6150 Bluetooth Module | ||
| 3516 | + in the HTC Universal. | ||
| 3517 | + | ||
| 3518 | +config HTCUNIVERSAL_ASIC3_LEDS | ||
| 3519 | + tristate "HTC Universal ASIC3 LED support" | ||
| 3520 | + select LEDS_ASIC3 | ||
| 3521 | + depends on MACH_HTCUNIVERSAL && HTCUNIVERSAL_CORE && HTC_ASIC3 | ||
| 3522 | + ---help--- | ||
| 3523 | + Support for right (colors red+green+(amber)) and left (green+blue) led | ||
| 3524 | + Off/on hook keys LED backlight | ||
| 3525 | + Keyboard backlight | ||
| 3526 | + Vibra | ||
| 3527 | + Flashlight | ||
| 3528 | + | ||
| 3529 | +config HTCUNIVERSAL_PHONE | ||
| 3530 | + tristate "HTC Universal Phone" | ||
| 3531 | + depends on MACH_HTCUNIVERSAL && HTCUNIVERSAL_CORE && HTC_ASIC3 | ||
| 3532 | + help | ||
| 3533 | + Enables support for the Qualcomm MSM6520 Phone Module | ||
| 3534 | + in the HTC Universal. | ||
| 3535 | + | ||
| 3536 | +config HTCUNIVERSAL_AK4641 | ||
| 3537 | + depends on SND && I2C | ||
| 3538 | + tristate "AK4641 chipset support" | ||
| 3539 | + | ||
| 3540 | +endmenu | ||
| 3541 | + | ||
| 3542 | +endif | ||
| 3543 | + | ||
| 3544 | endmenu | ||
| 3545 | |||
| 3546 | config MACH_POODLE | ||
| 3547 | @@ -160,4 +248,3 @@ | ||
| 3548 | depends on (PXA25x || PXA27x) && INPUT | ||
| 3549 | |||
| 3550 | endif | ||
| 3551 | - | ||
| 3534 | Index: linux-2.6.22/arch/arm/mach-pxa/Makefile | 3552 | Index: linux-2.6.22/arch/arm/mach-pxa/Makefile |
| 3535 | =================================================================== | 3553 | =================================================================== |
| 3536 | --- linux-2.6.22.orig/arch/arm/mach-pxa/Makefile 2007-07-27 16:10:20.000000000 +0100 | 3554 | --- linux-2.6.22.orig/arch/arm/mach-pxa/Makefile 2007-08-23 13:09:21.000000000 +0200 |
| 3537 | +++ linux-2.6.22/arch/arm/mach-pxa/Makefile 2007-07-27 16:10:40.000000000 +0100 | 3555 | +++ linux-2.6.22/arch/arm/mach-pxa/Makefile 2007-08-23 13:09:22.000000000 +0200 |
| 3538 | @@ -19,6 +19,7 @@ obj-$(CONFIG_MACH_AKITA) += akita-ioexp. | 3556 | @@ -19,6 +19,7 @@ |
| 3539 | obj-$(CONFIG_MACH_POODLE) += poodle.o corgi_ssp.o sharpsl_pm.o poodle_pm.o | 3557 | obj-$(CONFIG_MACH_POODLE) += poodle.o corgi_ssp.o sharpsl_pm.o poodle_pm.o |
| 3540 | obj-$(CONFIG_MACH_TOSA) += tosa.o | 3558 | obj-$(CONFIG_MACH_TOSA) += tosa.o |
| 3541 | obj-$(CONFIG_MACH_HX2750) += hx2750.o hx2750_test.o | 3559 | obj-$(CONFIG_MACH_HX2750) += hx2750.o hx2750_test.o |
| @@ -3545,8 +3563,8 @@ Index: linux-2.6.22/arch/arm/mach-pxa/Makefile | |||
| 3545 | led-y := leds.o | 3563 | led-y := leds.o |
| 3546 | Index: linux-2.6.22/arch/arm/mach-pxa/pm.c | 3564 | Index: linux-2.6.22/arch/arm/mach-pxa/pm.c |
| 3547 | =================================================================== | 3565 | =================================================================== |
| 3548 | --- linux-2.6.22.orig/arch/arm/mach-pxa/pm.c 2007-07-27 16:10:08.000000000 +0100 | 3566 | --- linux-2.6.22.orig/arch/arm/mach-pxa/pm.c 2007-08-23 13:09:20.000000000 +0200 |
| 3549 | +++ linux-2.6.22/arch/arm/mach-pxa/pm.c 2007-07-27 16:10:40.000000000 +0100 | 3567 | +++ linux-2.6.22/arch/arm/mach-pxa/pm.c 2007-08-23 13:09:22.000000000 +0200 |
| 3550 | @@ -22,6 +22,7 @@ | 3568 | @@ -22,6 +22,7 @@ |
| 3551 | #include <asm/system.h> | 3569 | #include <asm/system.h> |
| 3552 | #include <asm/arch/pm.h> | 3570 | #include <asm/arch/pm.h> |
| @@ -3555,7 +3573,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/pm.c | |||
| 3555 | #include <asm/arch/lubbock.h> | 3573 | #include <asm/arch/lubbock.h> |
| 3556 | #include <asm/mach/time.h> | 3574 | #include <asm/mach/time.h> |
| 3557 | 3575 | ||
| 3558 | @@ -75,12 +76,16 @@ enum { SLEEP_SAVE_START = 0, | 3576 | @@ -75,12 +76,16 @@ |
| 3559 | }; | 3577 | }; |
| 3560 | 3578 | ||
| 3561 | 3579 | ||
| @@ -3572,7 +3590,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/pm.c | |||
| 3572 | 3590 | ||
| 3573 | #ifdef CONFIG_IWMMXT | 3591 | #ifdef CONFIG_IWMMXT |
| 3574 | /* force any iWMMXt context to ram **/ | 3592 | /* force any iWMMXt context to ram **/ |
| 3575 | @@ -88,6 +93,11 @@ int pxa_pm_enter(suspend_state_t state) | 3593 | @@ -88,6 +93,11 @@ |
| 3576 | iwmmxt_task_disable(NULL); | 3594 | iwmmxt_task_disable(NULL); |
| 3577 | #endif | 3595 | #endif |
| 3578 | 3596 | ||
| @@ -3584,7 +3602,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/pm.c | |||
| 3584 | SAVE(GPLR0); SAVE(GPLR1); SAVE(GPLR2); | 3602 | SAVE(GPLR0); SAVE(GPLR1); SAVE(GPLR2); |
| 3585 | SAVE(GPDR0); SAVE(GPDR1); SAVE(GPDR2); | 3603 | SAVE(GPDR0); SAVE(GPDR1); SAVE(GPDR2); |
| 3586 | SAVE(GRER0); SAVE(GRER1); SAVE(GRER2); | 3604 | SAVE(GRER0); SAVE(GRER1); SAVE(GRER2); |
| 3587 | @@ -123,6 +133,15 @@ int pxa_pm_enter(suspend_state_t state) | 3605 | @@ -123,6 +133,15 @@ |
| 3588 | /* Clear sleep reset status */ | 3606 | /* Clear sleep reset status */ |
| 3589 | RCSR = RCSR_SMR; | 3607 | RCSR = RCSR_SMR; |
| 3590 | 3608 | ||
| @@ -3600,7 +3618,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/pm.c | |||
| 3600 | /* before sleeping, calculate and save a checksum */ | 3618 | /* before sleeping, calculate and save a checksum */ |
| 3601 | for (i = 0; i < SLEEP_SAVE_SIZE - 1; i++) | 3619 | for (i = 0; i < SLEEP_SAVE_SIZE - 1; i++) |
| 3602 | checksum += sleep_save[i]; | 3620 | checksum += sleep_save[i]; |
| 3603 | @@ -138,6 +157,9 @@ int pxa_pm_enter(suspend_state_t state) | 3621 | @@ -138,6 +157,9 @@ |
| 3604 | for (i = 0; i < SLEEP_SAVE_SIZE - 1; i++) | 3622 | for (i = 0; i < SLEEP_SAVE_SIZE - 1; i++) |
| 3605 | checksum += sleep_save[i]; | 3623 | checksum += sleep_save[i]; |
| 3606 | 3624 | ||
| @@ -3610,7 +3628,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/pm.c | |||
| 3610 | /* if invalid, display message and wait for a hardware reset */ | 3628 | /* if invalid, display message and wait for a hardware reset */ |
| 3611 | if (checksum != sleep_save[SLEEP_SAVE_CKSUM]) { | 3629 | if (checksum != sleep_save[SLEEP_SAVE_CKSUM]) { |
| 3612 | #ifdef CONFIG_ARCH_LUBBOCK | 3630 | #ifdef CONFIG_ARCH_LUBBOCK |
| 3613 | @@ -179,6 +201,10 @@ int pxa_pm_enter(suspend_state_t state) | 3631 | @@ -179,6 +201,10 @@ |
| 3614 | 3632 | ||
| 3615 | RESTORE(PSTR); | 3633 | RESTORE(PSTR); |
| 3616 | 3634 | ||
| @@ -3621,7 +3639,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/pm.c | |||
| 3621 | #ifdef DEBUG | 3639 | #ifdef DEBUG |
| 3622 | printk(KERN_DEBUG "*** made it back from resume\n"); | 3640 | printk(KERN_DEBUG "*** made it back from resume\n"); |
| 3623 | #endif | 3641 | #endif |
| 3624 | @@ -188,6 +214,13 @@ int pxa_pm_enter(suspend_state_t state) | 3642 | @@ -188,6 +214,13 @@ |
| 3625 | 3643 | ||
| 3626 | EXPORT_SYMBOL_GPL(pxa_pm_enter); | 3644 | EXPORT_SYMBOL_GPL(pxa_pm_enter); |
| 3627 | 3645 | ||
| @@ -3635,7 +3653,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/pm.c | |||
| 3635 | unsigned long sleep_phys_sp(void *sp) | 3653 | unsigned long sleep_phys_sp(void *sp) |
| 3636 | { | 3654 | { |
| 3637 | return virt_to_phys(sp); | 3655 | return virt_to_phys(sp); |
| 3638 | @@ -219,8 +252,9 @@ static struct pm_ops pxa_pm_ops = { | 3656 | @@ -219,8 +252,9 @@ |
| 3639 | .prepare = pxa_pm_prepare, | 3657 | .prepare = pxa_pm_prepare, |
| 3640 | .enter = pxa_pm_enter, | 3658 | .enter = pxa_pm_enter, |
| 3641 | .finish = pxa_pm_finish, | 3659 | .finish = pxa_pm_finish, |
| @@ -3648,9 +3666,9 @@ Index: linux-2.6.22/arch/arm/mach-pxa/pm.c | |||
| 3648 | 3666 | ||
| 3649 | Index: linux-2.6.22/drivers/input/keyboard/pxa27x_keyboard.c | 3667 | Index: linux-2.6.22/drivers/input/keyboard/pxa27x_keyboard.c |
| 3650 | =================================================================== | 3668 | =================================================================== |
| 3651 | --- linux-2.6.22.orig/drivers/input/keyboard/pxa27x_keyboard.c 2007-07-09 00:32:17.000000000 +0100 | 3669 | --- linux-2.6.22.orig/drivers/input/keyboard/pxa27x_keyboard.c 2007-07-09 01:32:17.000000000 +0200 |
| 3652 | +++ linux-2.6.22/drivers/input/keyboard/pxa27x_keyboard.c 2007-07-27 16:10:40.000000000 +0100 | 3670 | +++ linux-2.6.22/drivers/input/keyboard/pxa27x_keyboard.c 2007-08-23 13:09:22.000000000 +0200 |
| 3653 | @@ -140,7 +140,7 @@ static int pxakbd_resume(struct platform | 3671 | @@ -140,7 +140,7 @@ |
| 3654 | KPREC = pdata->reg_kprec; | 3672 | KPREC = pdata->reg_kprec; |
| 3655 | 3673 | ||
| 3656 | /* Enable unit clock */ | 3674 | /* Enable unit clock */ |
| @@ -3661,9 +3679,9 @@ Index: linux-2.6.22/drivers/input/keyboard/pxa27x_keyboard.c | |||
| 3661 | mutex_unlock(&input_dev->mutex); | 3679 | mutex_unlock(&input_dev->mutex); |
| 3662 | Index: linux-2.6.22/drivers/leds/Kconfig | 3680 | Index: linux-2.6.22/drivers/leds/Kconfig |
| 3663 | =================================================================== | 3681 | =================================================================== |
| 3664 | --- linux-2.6.22.orig/drivers/leds/Kconfig 2007-07-09 00:32:17.000000000 +0100 | 3682 | --- linux-2.6.22.orig/drivers/leds/Kconfig 2007-07-09 01:32:17.000000000 +0200 |
| 3665 | +++ linux-2.6.22/drivers/leds/Kconfig 2007-07-27 16:10:40.000000000 +0100 | 3683 | +++ linux-2.6.22/drivers/leds/Kconfig 2007-08-23 13:09:22.000000000 +0200 |
| 3666 | @@ -95,6 +95,13 @@ config LEDS_COBALT | 3684 | @@ -95,6 +95,13 @@ |
| 3667 | help | 3685 | help |
| 3668 | This option enables support for the front LED on Cobalt Server | 3686 | This option enables support for the front LED on Cobalt Server |
| 3669 | 3687 | ||
| @@ -3679,9 +3697,9 @@ Index: linux-2.6.22/drivers/leds/Kconfig | |||
| 3679 | config LEDS_TRIGGERS | 3697 | config LEDS_TRIGGERS |
| 3680 | Index: linux-2.6.22/drivers/leds/Makefile | 3698 | Index: linux-2.6.22/drivers/leds/Makefile |
| 3681 | =================================================================== | 3699 | =================================================================== |
| 3682 | --- linux-2.6.22.orig/drivers/leds/Makefile 2007-07-09 00:32:17.000000000 +0100 | 3700 | --- linux-2.6.22.orig/drivers/leds/Makefile 2007-07-09 01:32:17.000000000 +0200 |
| 3683 | +++ linux-2.6.22/drivers/leds/Makefile 2007-07-27 16:10:40.000000000 +0100 | 3701 | +++ linux-2.6.22/drivers/leds/Makefile 2007-08-23 13:09:22.000000000 +0200 |
| 3684 | @@ -16,6 +16,7 @@ obj-$(CONFIG_LEDS_NET48XX) += leds-net4 | 3702 | @@ -16,6 +16,7 @@ |
| 3685 | obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o | 3703 | obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o |
| 3686 | obj-$(CONFIG_LEDS_H1940) += leds-h1940.o | 3704 | obj-$(CONFIG_LEDS_H1940) += leds-h1940.o |
| 3687 | obj-$(CONFIG_LEDS_COBALT) += leds-cobalt.o | 3705 | obj-$(CONFIG_LEDS_COBALT) += leds-cobalt.o |
| @@ -3692,7 +3710,7 @@ Index: linux-2.6.22/drivers/leds/Makefile | |||
| 3692 | Index: linux-2.6.22/drivers/leds/leds-asic3.c | 3710 | Index: linux-2.6.22/drivers/leds/leds-asic3.c |
| 3693 | =================================================================== | 3711 | =================================================================== |
| 3694 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 3712 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 3695 | +++ linux-2.6.22/drivers/leds/leds-asic3.c 2007-07-27 16:10:40.000000000 +0100 | 3713 | +++ linux-2.6.22/drivers/leds/leds-asic3.c 2007-08-23 13:09:22.000000000 +0200 |
| 3696 | @@ -0,0 +1,189 @@ | 3714 | @@ -0,0 +1,189 @@ |
| 3697 | +/* | 3715 | +/* |
| 3698 | + * LEDs support for HTC ASIC3 devices. | 3716 | + * LEDs support for HTC ASIC3 devices. |
| @@ -3885,22 +3903,29 @@ Index: linux-2.6.22/drivers/leds/leds-asic3.c | |||
| 3885 | +MODULE_LICENSE("GPL"); | 3903 | +MODULE_LICENSE("GPL"); |
| 3886 | Index: linux-2.6.22/drivers/mfd/Kconfig | 3904 | Index: linux-2.6.22/drivers/mfd/Kconfig |
| 3887 | =================================================================== | 3905 | =================================================================== |
| 3888 | --- linux-2.6.22.orig/drivers/mfd/Kconfig 2007-07-27 16:10:05.000000000 +0100 | 3906 | --- linux-2.6.22.orig/drivers/mfd/Kconfig 2007-08-23 13:09:19.000000000 +0200 |
| 3889 | +++ linux-2.6.22/drivers/mfd/Kconfig 2007-07-27 16:10:40.000000000 +0100 | 3907 | +++ linux-2.6.22/drivers/mfd/Kconfig 2007-08-23 13:09:22.000000000 +0200 |
| 3890 | @@ -17,6 +17,9 @@ config MFD_SM501 | 3908 | @@ -15,6 +15,16 @@ |
| 3891 | 3909 | interface. The device may be connected by PCI or local bus with | |
| 3892 | endmenu | 3910 | varying functions enabled. |
| 3893 | 3911 | ||
| 3894 | +config HTC_ASIC3 | 3912 | +config HTC_ASIC3 |
| 3895 | + tristate "HTC ASIC3 (iPAQ h1900/h3900/h4000/hx4700/rx3000) support" | 3913 | + tristate "HTC ASIC3 (iPAQ h1900/h3900/h4000/hx4700/rx3000) support" |
| 3896 | + | 3914 | + |
| 3897 | menu "Multimedia Capabilities Port drivers" | 3915 | +config HTC_ASIC3_DS1WM |
| 3898 | depends on ARCH_SA1100 | 3916 | + bool "Support HTC ASIC3 builtin DS1WM block" |
| 3917 | + help | ||
| 3918 | + Choose Y here if you want to include support for ASIC3's builtin | ||
| 3919 | + W1 controller. Some devices do not use it, and yet other have | ||
| 3920 | + separate DS1WM controller. For them, choose N. | ||
| 3921 | + | ||
| 3922 | endmenu | ||
| 3899 | 3923 | ||
| 3924 | menu "Multimedia Capabilities Port drivers" | ||
| 3900 | Index: linux-2.6.22/drivers/mfd/Makefile | 3925 | Index: linux-2.6.22/drivers/mfd/Makefile |
| 3901 | =================================================================== | 3926 | =================================================================== |
| 3902 | --- linux-2.6.22.orig/drivers/mfd/Makefile 2007-07-27 16:10:05.000000000 +0100 | 3927 | --- linux-2.6.22.orig/drivers/mfd/Makefile 2007-08-23 13:09:19.000000000 +0200 |
| 3903 | +++ linux-2.6.22/drivers/mfd/Makefile 2007-07-27 16:10:40.000000000 +0100 | 3928 | +++ linux-2.6.22/drivers/mfd/Makefile 2007-08-23 13:09:22.000000000 +0200 |
| 3904 | @@ -2,6 +2,8 @@ | 3929 | @@ -2,6 +2,8 @@ |
| 3905 | # Makefile for multifunction miscellaneous devices | 3930 | # Makefile for multifunction miscellaneous devices |
| 3906 | # | 3931 | # |
| @@ -3913,7 +3938,7 @@ Index: linux-2.6.22/drivers/mfd/Makefile | |||
| 3913 | Index: linux-2.6.22/drivers/mfd/asic3_base.c | 3938 | Index: linux-2.6.22/drivers/mfd/asic3_base.c |
| 3914 | =================================================================== | 3939 | =================================================================== |
| 3915 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 3940 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 3916 | +++ linux-2.6.22/drivers/mfd/asic3_base.c 2007-07-27 16:10:40.000000000 +0100 | 3941 | +++ linux-2.6.22/drivers/mfd/asic3_base.c 2007-08-23 13:09:22.000000000 +0200 |
| 3917 | @@ -0,0 +1,1208 @@ | 3942 | @@ -0,0 +1,1208 @@ |
| 3918 | +/* | 3943 | +/* |
| 3919 | + * Driver interface to HTC "ASIC3" | 3944 | + * Driver interface to HTC "ASIC3" |
| @@ -5126,7 +5151,7 @@ Index: linux-2.6.22/drivers/mfd/asic3_base.c | |||
| 5126 | Index: linux-2.6.22/drivers/mfd/soc-core.c | 5151 | Index: linux-2.6.22/drivers/mfd/soc-core.c |
| 5127 | =================================================================== | 5152 | =================================================================== |
| 5128 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 5153 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 5129 | +++ linux-2.6.22/drivers/mfd/soc-core.c 2007-07-27 16:10:40.000000000 +0100 | 5154 | +++ linux-2.6.22/drivers/mfd/soc-core.c 2007-08-23 13:09:22.000000000 +0200 |
| 5130 | @@ -0,0 +1,106 @@ | 5155 | @@ -0,0 +1,106 @@ |
| 5131 | +/* | 5156 | +/* |
| 5132 | + * drivers/soc/soc-core.c | 5157 | + * drivers/soc/soc-core.c |
| @@ -5237,7 +5262,7 @@ Index: linux-2.6.22/drivers/mfd/soc-core.c | |||
| 5237 | Index: linux-2.6.22/drivers/mfd/soc-core.h | 5262 | Index: linux-2.6.22/drivers/mfd/soc-core.h |
| 5238 | =================================================================== | 5263 | =================================================================== |
| 5239 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 5264 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 5240 | +++ linux-2.6.22/drivers/mfd/soc-core.h 2007-07-27 16:10:40.000000000 +0100 | 5265 | +++ linux-2.6.22/drivers/mfd/soc-core.h 2007-08-23 13:09:22.000000000 +0200 |
| 5241 | @@ -0,0 +1,30 @@ | 5266 | @@ -0,0 +1,30 @@ |
| 5242 | +/* | 5267 | +/* |
| 5243 | + * drivers/soc/soc-core.h | 5268 | + * drivers/soc/soc-core.h |
| @@ -5272,7 +5297,7 @@ Index: linux-2.6.22/drivers/mfd/soc-core.h | |||
| 5272 | Index: linux-2.6.22/include/asm-arm/arch-pxa/clock.h | 5297 | Index: linux-2.6.22/include/asm-arm/arch-pxa/clock.h |
| 5273 | =================================================================== | 5298 | =================================================================== |
| 5274 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 5299 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 5275 | +++ linux-2.6.22/include/asm-arm/arch-pxa/clock.h 2007-07-27 16:10:40.000000000 +0100 | 5300 | +++ linux-2.6.22/include/asm-arm/arch-pxa/clock.h 2007-08-23 13:09:22.000000000 +0200 |
| 5276 | @@ -0,0 +1,27 @@ | 5301 | @@ -0,0 +1,27 @@ |
| 5277 | +/* | 5302 | +/* |
| 5278 | + * linux/include/asm-arm/arch-pxa/clock.h | 5303 | + * linux/include/asm-arm/arch-pxa/clock.h |
| @@ -5304,7 +5329,7 @@ Index: linux-2.6.22/include/asm-arm/arch-pxa/clock.h | |||
| 5304 | Index: linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-asic.h | 5329 | Index: linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-asic.h |
| 5305 | =================================================================== | 5330 | =================================================================== |
| 5306 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 5331 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 5307 | +++ linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-asic.h 2007-07-27 16:10:40.000000000 +0100 | 5332 | +++ linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-asic.h 2007-08-23 13:09:22.000000000 +0200 |
| 5308 | @@ -0,0 +1,213 @@ | 5333 | @@ -0,0 +1,213 @@ |
| 5309 | +/* | 5334 | +/* |
| 5310 | + * include/asm/arm/arch-pxa/htcuniversal-asic.h | 5335 | + * include/asm/arm/arch-pxa/htcuniversal-asic.h |
| @@ -5522,7 +5547,7 @@ Index: linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-asic.h | |||
| 5522 | Index: linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-gpio.h | 5547 | Index: linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-gpio.h |
| 5523 | =================================================================== | 5548 | =================================================================== |
| 5524 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 5549 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 5525 | +++ linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-gpio.h 2007-07-27 16:10:40.000000000 +0100 | 5550 | +++ linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-gpio.h 2007-08-23 13:09:22.000000000 +0200 |
| 5526 | @@ -0,0 +1,220 @@ | 5551 | @@ -0,0 +1,220 @@ |
| 5527 | +/* | 5552 | +/* |
| 5528 | + * include/asm-arm/arch-pxa/htcuniversal-gpio.h | 5553 | + * include/asm-arm/arch-pxa/htcuniversal-gpio.h |
| @@ -5747,7 +5772,7 @@ Index: linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-gpio.h | |||
| 5747 | Index: linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-init.h | 5772 | Index: linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-init.h |
| 5748 | =================================================================== | 5773 | =================================================================== |
| 5749 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 5774 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 5750 | +++ linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-init.h 2007-07-27 16:10:40.000000000 +0100 | 5775 | +++ linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-init.h 2007-08-23 13:09:22.000000000 +0200 |
| 5751 | @@ -0,0 +1,14 @@ | 5776 | @@ -0,0 +1,14 @@ |
| 5752 | +/* | 5777 | +/* |
| 5753 | + * include/asm/arm/arch-pxa/htcuniversal-init.h | 5778 | + * include/asm/arm/arch-pxa/htcuniversal-init.h |
| @@ -5766,7 +5791,7 @@ Index: linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal-init.h | |||
| 5766 | Index: linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal.h | 5791 | Index: linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal.h |
| 5767 | =================================================================== | 5792 | =================================================================== |
| 5768 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 5793 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 5769 | +++ linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal.h 2007-07-27 16:10:40.000000000 +0100 | 5794 | +++ linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal.h 2007-08-23 13:09:22.000000000 +0200 |
| 5770 | @@ -0,0 +1,3 @@ | 5795 | @@ -0,0 +1,3 @@ |
| 5771 | +#include <asm/arch/irqs.h> | 5796 | +#include <asm/arch/irqs.h> |
| 5772 | + | 5797 | + |
| @@ -5774,7 +5799,7 @@ Index: linux-2.6.22/include/asm-arm/arch-pxa/htcuniversal.h | |||
| 5774 | Index: linux-2.6.22/include/asm-arm/arch-pxa/pxa-pm_ll.h | 5799 | Index: linux-2.6.22/include/asm-arm/arch-pxa/pxa-pm_ll.h |
| 5775 | =================================================================== | 5800 | =================================================================== |
| 5776 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 5801 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 5777 | +++ linux-2.6.22/include/asm-arm/arch-pxa/pxa-pm_ll.h 2007-07-27 16:10:40.000000000 +0100 | 5802 | +++ linux-2.6.22/include/asm-arm/arch-pxa/pxa-pm_ll.h 2007-08-23 13:09:22.000000000 +0200 |
| 5778 | @@ -0,0 +1,6 @@ | 5803 | @@ -0,0 +1,6 @@ |
| 5779 | +struct pxa_ll_pm_ops { | 5804 | +struct pxa_ll_pm_ops { |
| 5780 | + void (*suspend)(unsigned long); | 5805 | + void (*suspend)(unsigned long); |
| @@ -5784,9 +5809,9 @@ Index: linux-2.6.22/include/asm-arm/arch-pxa/pxa-pm_ll.h | |||
| 5784 | +extern struct pxa_ll_pm_ops *pxa_pm_set_ll_ops(struct pxa_ll_pm_ops *new_ops); | 5809 | +extern struct pxa_ll_pm_ops *pxa_pm_set_ll_ops(struct pxa_ll_pm_ops *new_ops); |
| 5785 | Index: linux-2.6.22/include/asm-arm/arch-pxa/sharpsl.h | 5810 | Index: linux-2.6.22/include/asm-arm/arch-pxa/sharpsl.h |
| 5786 | =================================================================== | 5811 | =================================================================== |
| 5787 | --- linux-2.6.22.orig/include/asm-arm/arch-pxa/sharpsl.h 2007-07-09 00:32:17.000000000 +0100 | 5812 | --- linux-2.6.22.orig/include/asm-arm/arch-pxa/sharpsl.h 2007-07-09 01:32:17.000000000 +0200 |
| 5788 | +++ linux-2.6.22/include/asm-arm/arch-pxa/sharpsl.h 2007-07-27 16:10:40.000000000 +0100 | 5813 | +++ linux-2.6.22/include/asm-arm/arch-pxa/sharpsl.h 2007-08-23 13:09:22.000000000 +0200 |
| 5789 | @@ -25,12 +25,6 @@ struct corgits_machinfo { | 5814 | @@ -25,12 +25,6 @@ |
| 5790 | /* | 5815 | /* |
| 5791 | * SharpSL Backlight | 5816 | * SharpSL Backlight |
| 5792 | */ | 5817 | */ |
| @@ -5802,7 +5827,7 @@ Index: linux-2.6.22/include/asm-arm/arch-pxa/sharpsl.h | |||
| 5802 | Index: linux-2.6.22/include/asm-arm/hardware/asic3_keys.h | 5827 | Index: linux-2.6.22/include/asm-arm/hardware/asic3_keys.h |
| 5803 | =================================================================== | 5828 | =================================================================== |
| 5804 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 5829 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 5805 | +++ linux-2.6.22/include/asm-arm/hardware/asic3_keys.h 2007-07-27 16:10:40.000000000 +0100 | 5830 | +++ linux-2.6.22/include/asm-arm/hardware/asic3_keys.h 2007-08-23 13:09:22.000000000 +0200 |
| 5806 | @@ -0,0 +1,18 @@ | 5831 | @@ -0,0 +1,18 @@ |
| 5807 | +#include <linux/input.h> | 5832 | +#include <linux/input.h> |
| 5808 | + | 5833 | + |
| @@ -5825,7 +5850,7 @@ Index: linux-2.6.22/include/asm-arm/hardware/asic3_keys.h | |||
| 5825 | Index: linux-2.6.22/include/asm-arm/hardware/asic3_leds.h | 5850 | Index: linux-2.6.22/include/asm-arm/hardware/asic3_leds.h |
| 5826 | =================================================================== | 5851 | =================================================================== |
| 5827 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 5852 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 5828 | +++ linux-2.6.22/include/asm-arm/hardware/asic3_leds.h 2007-07-27 16:10:40.000000000 +0100 | 5853 | +++ linux-2.6.22/include/asm-arm/hardware/asic3_leds.h 2007-08-23 13:09:22.000000000 +0200 |
| 5829 | @@ -0,0 +1,34 @@ | 5854 | @@ -0,0 +1,34 @@ |
| 5830 | +/* | 5855 | +/* |
| 5831 | + * LEDs support for HTC ASIC3 devices. | 5856 | + * LEDs support for HTC ASIC3 devices. |
| @@ -5864,7 +5889,7 @@ Index: linux-2.6.22/include/asm-arm/hardware/asic3_leds.h | |||
| 5864 | Index: linux-2.6.22/include/asm-arm/hardware/ipaq-asic3.h | 5889 | Index: linux-2.6.22/include/asm-arm/hardware/ipaq-asic3.h |
| 5865 | =================================================================== | 5890 | =================================================================== |
| 5866 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 5891 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 5867 | +++ linux-2.6.22/include/asm-arm/hardware/ipaq-asic3.h 2007-07-27 16:10:40.000000000 +0100 | 5892 | +++ linux-2.6.22/include/asm-arm/hardware/ipaq-asic3.h 2007-08-23 13:09:22.000000000 +0200 |
| 5868 | @@ -0,0 +1,602 @@ | 5893 | @@ -0,0 +1,602 @@ |
| 5869 | +/* | 5894 | +/* |
| 5870 | + * | 5895 | + * |
| @@ -6470,9 +6495,9 @@ Index: linux-2.6.22/include/asm-arm/hardware/ipaq-asic3.h | |||
| 6470 | +#endif | 6495 | +#endif |
| 6471 | Index: linux-2.6.22/include/linux/backlight.h | 6496 | Index: linux-2.6.22/include/linux/backlight.h |
| 6472 | =================================================================== | 6497 | =================================================================== |
| 6473 | --- linux-2.6.22.orig/include/linux/backlight.h 2007-07-09 00:32:17.000000000 +0100 | 6498 | --- linux-2.6.22.orig/include/linux/backlight.h 2007-07-09 01:32:17.000000000 +0200 |
| 6474 | +++ linux-2.6.22/include/linux/backlight.h 2007-07-27 16:10:40.000000000 +0100 | 6499 | +++ linux-2.6.22/include/linux/backlight.h 2007-08-23 13:09:22.000000000 +0200 |
| 6475 | @@ -87,4 +87,11 @@ extern void backlight_device_unregister( | 6500 | @@ -87,4 +87,11 @@ |
| 6476 | 6501 | ||
| 6477 | #define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev) | 6502 | #define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev) |
| 6478 | 6503 | ||
| @@ -6487,7 +6512,7 @@ Index: linux-2.6.22/include/linux/backlight.h | |||
| 6487 | Index: linux-2.6.22/include/linux/gpiodev.h | 6512 | Index: linux-2.6.22/include/linux/gpiodev.h |
| 6488 | =================================================================== | 6513 | =================================================================== |
| 6489 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 6514 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 6490 | +++ linux-2.6.22/include/linux/gpiodev.h 2007-07-27 16:10:40.000000000 +0100 | 6515 | +++ linux-2.6.22/include/linux/gpiodev.h 2007-08-23 13:09:22.000000000 +0200 |
| 6491 | @@ -0,0 +1,44 @@ | 6516 | @@ -0,0 +1,44 @@ |
| 6492 | +#ifndef __GPIODEV_H | 6517 | +#ifndef __GPIODEV_H |
| 6493 | +#define __GPIODEV_H | 6518 | +#define __GPIODEV_H |
| @@ -6536,7 +6561,7 @@ Index: linux-2.6.22/include/linux/gpiodev.h | |||
| 6536 | Index: linux-2.6.22/include/linux/input_pda.h | 6561 | Index: linux-2.6.22/include/linux/input_pda.h |
| 6537 | =================================================================== | 6562 | =================================================================== |
| 6538 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 6563 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 6539 | +++ linux-2.6.22/include/linux/input_pda.h 2007-07-27 16:10:40.000000000 +0100 | 6564 | +++ linux-2.6.22/include/linux/input_pda.h 2007-08-23 13:09:22.000000000 +0200 |
| 6540 | @@ -0,0 +1,47 @@ | 6565 | @@ -0,0 +1,47 @@ |
| 6541 | +#ifndef _INPUT_PDA_H | 6566 | +#ifndef _INPUT_PDA_H |
| 6542 | +#define _INPUT_PDA_H | 6567 | +#define _INPUT_PDA_H |
| @@ -6588,7 +6613,7 @@ Index: linux-2.6.22/include/linux/input_pda.h | |||
| 6588 | Index: linux-2.6.22/include/linux/pda_power.h | 6613 | Index: linux-2.6.22/include/linux/pda_power.h |
| 6589 | =================================================================== | 6614 | =================================================================== |
| 6590 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 6615 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 6591 | +++ linux-2.6.22/include/linux/pda_power.h 2007-07-27 16:10:40.000000000 +0100 | 6616 | +++ linux-2.6.22/include/linux/pda_power.h 2007-08-23 13:09:22.000000000 +0200 |
| 6592 | @@ -0,0 +1,31 @@ | 6617 | @@ -0,0 +1,31 @@ |
| 6593 | +/* | 6618 | +/* |
| 6594 | + * Common power driver for PDAs and phones with one or two external | 6619 | + * Common power driver for PDAs and phones with one or two external |
| @@ -6624,7 +6649,7 @@ Index: linux-2.6.22/include/linux/pda_power.h | |||
| 6624 | Index: linux-2.6.22/include/linux/soc/asic3_base.h | 6649 | Index: linux-2.6.22/include/linux/soc/asic3_base.h |
| 6625 | =================================================================== | 6650 | =================================================================== |
| 6626 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 6651 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 6627 | +++ linux-2.6.22/include/linux/soc/asic3_base.h 2007-07-27 16:10:40.000000000 +0100 | 6652 | +++ linux-2.6.22/include/linux/soc/asic3_base.h 2007-08-23 13:09:22.000000000 +0200 |
| 6628 | @@ -0,0 +1,104 @@ | 6653 | @@ -0,0 +1,104 @@ |
| 6629 | +#include <asm/types.h> | 6654 | +#include <asm/types.h> |
| 6630 | +#include <linux/gpiodev.h> | 6655 | +#include <linux/gpiodev.h> |
| @@ -6733,7 +6758,7 @@ Index: linux-2.6.22/include/linux/soc/asic3_base.h | |||
| 6733 | Index: linux-2.6.22/include/linux/soc/tmio_mmc.h | 6758 | Index: linux-2.6.22/include/linux/soc/tmio_mmc.h |
| 6734 | =================================================================== | 6759 | =================================================================== |
| 6735 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 6760 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 6736 | +++ linux-2.6.22/include/linux/soc/tmio_mmc.h 2007-07-27 16:10:40.000000000 +0100 | 6761 | +++ linux-2.6.22/include/linux/soc/tmio_mmc.h 2007-08-23 13:09:22.000000000 +0200 |
| 6737 | @@ -0,0 +1,17 @@ | 6762 | @@ -0,0 +1,17 @@ |
| 6738 | +#include <linux/platform_device.h> | 6763 | +#include <linux/platform_device.h> |
| 6739 | + | 6764 | + |
| @@ -6754,8 +6779,8 @@ Index: linux-2.6.22/include/linux/soc/tmio_mmc.h | |||
| 6754 | +}; | 6779 | +}; |
| 6755 | Index: linux-2.6.22/include/asm-arm/arch-pxa/pxa-regs.h | 6780 | Index: linux-2.6.22/include/asm-arm/arch-pxa/pxa-regs.h |
| 6756 | =================================================================== | 6781 | =================================================================== |
| 6757 | --- linux-2.6.22.orig/include/asm-arm/arch-pxa/pxa-regs.h 2007-07-27 16:10:22.000000000 +0100 | 6782 | --- linux-2.6.22.orig/include/asm-arm/arch-pxa/pxa-regs.h 2007-08-23 13:09:21.000000000 +0200 |
| 6758 | +++ linux-2.6.22/include/asm-arm/arch-pxa/pxa-regs.h 2007-07-27 16:10:40.000000000 +0100 | 6783 | +++ linux-2.6.22/include/asm-arm/arch-pxa/pxa-regs.h 2007-08-23 13:09:22.000000000 +0200 |
| 6759 | @@ -2063,6 +2063,8 @@ | 6784 | @@ -2063,6 +2063,8 @@ |
| 6760 | #define LDCMD_SOFINT (1 << 22) | 6785 | #define LDCMD_SOFINT (1 << 22) |
| 6761 | #define LDCMD_EOFINT (1 << 21) | 6786 | #define LDCMD_EOFINT (1 << 21) |
| @@ -6767,14 +6792,12 @@ Index: linux-2.6.22/include/asm-arm/arch-pxa/pxa-regs.h | |||
| 6767 | #define LCCR5_SOFM2 (1<<1) /* Start Of Frame Mask for Overlay 2 (channel 2) */ | 6792 | #define LCCR5_SOFM2 (1<<1) /* Start Of Frame Mask for Overlay 2 (channel 2) */ |
| 6768 | Index: linux-2.6.22/drivers/mmc/host/Kconfig | 6793 | Index: linux-2.6.22/drivers/mmc/host/Kconfig |
| 6769 | =================================================================== | 6794 | =================================================================== |
| 6770 | --- linux-2.6.22.orig/drivers/mmc/host/Kconfig 2007-07-09 00:32:17.000000000 +0100 | 6795 | --- linux-2.6.22.orig/drivers/mmc/host/Kconfig 2007-07-09 01:32:17.000000000 +0200 |
| 6771 | +++ linux-2.6.22/drivers/mmc/host/Kconfig 2007-07-27 16:10:40.000000000 +0100 | 6796 | +++ linux-2.6.22/drivers/mmc/host/Kconfig 2007-08-23 13:09:22.000000000 +0200 |
| 6772 | @@ -99,4 +99,10 @@ config MMC_TIFM_SD | 6797 | @@ -100,3 +100,9 @@ |
| 6773 | |||
| 6774 | To compile this driver as a module, choose M here: the | 6798 | To compile this driver as a module, choose M here: the |
| 6775 | module will be called tifm_sd. | 6799 | module will be called tifm_sd. |
| 6776 | - | 6800 | |
| 6777 | + | ||
| 6778 | +config MMC_ASIC3 | 6801 | +config MMC_ASIC3 |
| 6779 | + tristate "HTC ASIC3 SD/MMC support" | 6802 | + tristate "HTC ASIC3 SD/MMC support" |
| 6780 | + depends on MMC && HTC_ASIC3 | 6803 | + depends on MMC && HTC_ASIC3 |
| @@ -6783,9 +6806,9 @@ Index: linux-2.6.22/drivers/mmc/host/Kconfig | |||
| 6783 | + in the iPAQ hx4700 and others. | 6806 | + in the iPAQ hx4700 and others. |
| 6784 | Index: linux-2.6.22/drivers/mmc/host/Makefile | 6807 | Index: linux-2.6.22/drivers/mmc/host/Makefile |
| 6785 | =================================================================== | 6808 | =================================================================== |
| 6786 | --- linux-2.6.22.orig/drivers/mmc/host/Makefile 2007-07-09 00:32:17.000000000 +0100 | 6809 | --- linux-2.6.22.orig/drivers/mmc/host/Makefile 2007-07-09 01:32:17.000000000 +0200 |
| 6787 | +++ linux-2.6.22/drivers/mmc/host/Makefile 2007-07-27 16:10:40.000000000 +0100 | 6810 | +++ linux-2.6.22/drivers/mmc/host/Makefile 2007-08-23 13:09:22.000000000 +0200 |
| 6788 | @@ -15,4 +15,4 @@ obj-$(CONFIG_MMC_AU1X) += au1xmmc.o | 6811 | @@ -15,4 +15,4 @@ |
| 6789 | obj-$(CONFIG_MMC_OMAP) += omap.o | 6812 | obj-$(CONFIG_MMC_OMAP) += omap.o |
| 6790 | obj-$(CONFIG_MMC_AT91) += at91_mci.o | 6813 | obj-$(CONFIG_MMC_AT91) += at91_mci.o |
| 6791 | obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o | 6814 | obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o |
| @@ -6794,7 +6817,7 @@ Index: linux-2.6.22/drivers/mmc/host/Makefile | |||
| 6794 | Index: linux-2.6.22/drivers/mmc/host/asic3_mmc.c | 6817 | Index: linux-2.6.22/drivers/mmc/host/asic3_mmc.c |
| 6795 | =================================================================== | 6818 | =================================================================== |
| 6796 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 6819 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 6797 | +++ linux-2.6.22/drivers/mmc/host/asic3_mmc.c 2007-07-27 16:10:40.000000000 +0100 | 6820 | +++ linux-2.6.22/drivers/mmc/host/asic3_mmc.c 2007-08-23 13:09:22.000000000 +0200 |
| 6798 | @@ -0,0 +1,900 @@ | 6821 | @@ -0,0 +1,900 @@ |
| 6799 | +/* Note that this driver can likely be merged into the tmio driver, so | 6822 | +/* Note that this driver can likely be merged into the tmio driver, so |
| 6800 | + * consider this code temporary. It works, though. | 6823 | + * consider this code temporary. It works, though. |
| @@ -7699,7 +7722,7 @@ Index: linux-2.6.22/drivers/mmc/host/asic3_mmc.c | |||
| 7699 | Index: linux-2.6.22/drivers/mmc/host/asic3_mmc.h | 7722 | Index: linux-2.6.22/drivers/mmc/host/asic3_mmc.h |
| 7700 | =================================================================== | 7723 | =================================================================== |
| 7701 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 7724 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 7702 | +++ linux-2.6.22/drivers/mmc/host/asic3_mmc.h 2007-07-27 16:10:40.000000000 +0100 | 7725 | +++ linux-2.6.22/drivers/mmc/host/asic3_mmc.h 2007-08-23 13:09:22.000000000 +0200 |
| 7703 | @@ -0,0 +1,25 @@ | 7726 | @@ -0,0 +1,25 @@ |
| 7704 | +#ifndef __ASIC3_MMC_H | 7727 | +#ifndef __ASIC3_MMC_H |
| 7705 | +#define __ASIC3_MMC_H | 7728 | +#define __ASIC3_MMC_H |
| @@ -7728,9 +7751,9 @@ Index: linux-2.6.22/drivers/mmc/host/asic3_mmc.h | |||
| 7728 | +#endif // __ASIC3_MMC_H | 7751 | +#endif // __ASIC3_MMC_H |
| 7729 | Index: linux-2.6.22/drivers/input/keyboard/Makefile | 7752 | Index: linux-2.6.22/drivers/input/keyboard/Makefile |
| 7730 | =================================================================== | 7753 | =================================================================== |
| 7731 | --- linux-2.6.22.orig/drivers/input/keyboard/Makefile 2007-07-09 00:32:17.000000000 +0100 | 7754 | --- linux-2.6.22.orig/drivers/input/keyboard/Makefile 2007-07-09 01:32:17.000000000 +0200 |
| 7732 | +++ linux-2.6.22/drivers/input/keyboard/Makefile 2007-07-27 16:10:41.000000000 +0100 | 7755 | +++ linux-2.6.22/drivers/input/keyboard/Makefile 2007-08-23 13:09:22.000000000 +0200 |
| 7733 | @@ -21,4 +21,4 @@ obj-$(CONFIG_KEYBOARD_OMAP) += omap-key | 7756 | @@ -21,4 +21,4 @@ |
| 7734 | obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keyboard.o | 7757 | obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keyboard.o |
| 7735 | obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o | 7758 | obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o |
| 7736 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o | 7759 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o |
| @@ -7739,7 +7762,7 @@ Index: linux-2.6.22/drivers/input/keyboard/Makefile | |||
| 7739 | Index: linux-2.6.22/drivers/input/keyboard/asic3_keys.c | 7762 | Index: linux-2.6.22/drivers/input/keyboard/asic3_keys.c |
| 7740 | =================================================================== | 7763 | =================================================================== |
| 7741 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | 7764 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 7742 | +++ linux-2.6.22/drivers/input/keyboard/asic3_keys.c 2007-07-27 16:10:41.000000000 +0100 | 7765 | +++ linux-2.6.22/drivers/input/keyboard/asic3_keys.c 2007-08-23 13:09:22.000000000 +0200 |
| 7743 | @@ -0,0 +1,131 @@ | 7766 | @@ -0,0 +1,131 @@ |
| 7744 | +/* | 7767 | +/* |
| 7745 | + * Generic buttons driver for ASIC3 SoC. | 7768 | + * Generic buttons driver for ASIC3 SoC. |
| @@ -7874,8 +7897,8 @@ Index: linux-2.6.22/drivers/input/keyboard/asic3_keys.c | |||
| 7874 | +MODULE_LICENSE("GPL"); | 7897 | +MODULE_LICENSE("GPL"); |
| 7875 | Index: linux-2.6.22/include/asm-arm/arch-pxa/irqs.h | 7898 | Index: linux-2.6.22/include/asm-arm/arch-pxa/irqs.h |
| 7876 | =================================================================== | 7899 | =================================================================== |
| 7877 | --- linux-2.6.22.orig/include/asm-arm/arch-pxa/irqs.h 2007-07-09 00:32:17.000000000 +0100 | 7900 | --- linux-2.6.22.orig/include/asm-arm/arch-pxa/irqs.h 2007-07-09 01:32:17.000000000 +0200 |
| 7878 | +++ linux-2.6.22/include/asm-arm/arch-pxa/irqs.h 2007-07-27 16:10:41.000000000 +0100 | 7901 | +++ linux-2.6.22/include/asm-arm/arch-pxa/irqs.h 2007-08-23 13:09:22.000000000 +0200 |
| 7879 | @@ -178,6 +178,8 @@ | 7902 | @@ -178,6 +178,8 @@ |
| 7880 | defined(CONFIG_MACH_LOGICPD_PXA270) || \ | 7903 | defined(CONFIG_MACH_LOGICPD_PXA270) || \ |
| 7881 | defined(CONFIG_MACH_MAINSTONE) | 7904 | defined(CONFIG_MACH_MAINSTONE) |
| @@ -7887,9 +7910,9 @@ Index: linux-2.6.22/include/asm-arm/arch-pxa/irqs.h | |||
| 7887 | #endif | 7910 | #endif |
| 7888 | Index: linux-2.6.22/include/linux/ioport.h | 7911 | Index: linux-2.6.22/include/linux/ioport.h |
| 7889 | =================================================================== | 7912 | =================================================================== |
| 7890 | --- linux-2.6.22.orig/include/linux/ioport.h 2007-07-09 00:32:17.000000000 +0100 | 7913 | --- linux-2.6.22.orig/include/linux/ioport.h 2007-07-09 01:32:17.000000000 +0200 |
| 7891 | +++ linux-2.6.22/include/linux/ioport.h 2007-07-27 16:10:41.000000000 +0100 | 7914 | +++ linux-2.6.22/include/linux/ioport.h 2007-08-23 13:09:22.000000000 +0200 |
| 7892 | @@ -56,6 +56,7 @@ struct resource_list { | 7915 | @@ -56,6 +56,7 @@ |
| 7893 | #define IORESOURCE_IRQ_HIGHLEVEL (1<<2) | 7916 | #define IORESOURCE_IRQ_HIGHLEVEL (1<<2) |
| 7894 | #define IORESOURCE_IRQ_LOWLEVEL (1<<3) | 7917 | #define IORESOURCE_IRQ_LOWLEVEL (1<<3) |
| 7895 | #define IORESOURCE_IRQ_SHAREABLE (1<<4) | 7918 | #define IORESOURCE_IRQ_SHAREABLE (1<<4) |
| @@ -7899,9 +7922,9 @@ Index: linux-2.6.22/include/linux/ioport.h | |||
| 7899 | #define IORESOURCE_DMA_TYPE_MASK (3<<0) | 7922 | #define IORESOURCE_DMA_TYPE_MASK (3<<0) |
| 7900 | Index: linux-2.6.22/drivers/video/backlight/Kconfig | 7923 | Index: linux-2.6.22/drivers/video/backlight/Kconfig |
| 7901 | =================================================================== | 7924 | =================================================================== |
| 7902 | --- linux-2.6.22.orig/drivers/video/backlight/Kconfig 2007-07-27 16:10:00.000000000 +0100 | 7925 | --- linux-2.6.22.orig/drivers/video/backlight/Kconfig 2007-08-23 13:09:19.000000000 +0200 |
| 7903 | +++ linux-2.6.22/drivers/video/backlight/Kconfig 2007-07-27 16:10:41.000000000 +0100 | 7926 | +++ linux-2.6.22/drivers/video/backlight/Kconfig 2007-08-23 13:09:22.000000000 +0200 |
| 7904 | @@ -34,7 +34,7 @@ config LCD_CLASS_DEVICE | 7927 | @@ -34,7 +34,7 @@ |
| 7905 | 7928 | ||
| 7906 | config BACKLIGHT_CORGI | 7929 | config BACKLIGHT_CORGI |
| 7907 | tristate "Sharp Corgi Backlight Driver (SL Series)" | 7930 | tristate "Sharp Corgi Backlight Driver (SL Series)" |
| @@ -7912,8 +7935,8 @@ Index: linux-2.6.22/drivers/video/backlight/Kconfig | |||
| 7912 | If you have a Sharp Zaurus SL-C7xx, SL-Cxx00 or SL-6000x say y to enable the | 7935 | If you have a Sharp Zaurus SL-C7xx, SL-Cxx00 or SL-6000x say y to enable the |
| 7913 | Index: linux-2.6.22/drivers/video/backlight/corgi_bl.c | 7936 | Index: linux-2.6.22/drivers/video/backlight/corgi_bl.c |
| 7914 | =================================================================== | 7937 | =================================================================== |
| 7915 | --- linux-2.6.22.orig/drivers/video/backlight/corgi_bl.c 2007-07-09 00:32:17.000000000 +0100 | 7938 | --- linux-2.6.22.orig/drivers/video/backlight/corgi_bl.c 2007-07-09 01:32:17.000000000 +0200 |
| 7916 | +++ linux-2.6.22/drivers/video/backlight/corgi_bl.c 2007-07-27 16:10:41.000000000 +0100 | 7939 | +++ linux-2.6.22/drivers/video/backlight/corgi_bl.c 2007-08-23 13:09:22.000000000 +0200 |
| 7917 | @@ -24,7 +24,7 @@ | 7940 | @@ -24,7 +24,7 @@ |
| 7918 | static int corgibl_intensity; | 7941 | static int corgibl_intensity; |
| 7919 | static struct backlight_properties corgibl_data; | 7942 | static struct backlight_properties corgibl_data; |
| @@ -7923,7 +7946,7 @@ Index: linux-2.6.22/drivers/video/backlight/corgi_bl.c | |||
| 7923 | 7946 | ||
| 7924 | static unsigned long corgibl_flags; | 7947 | static unsigned long corgibl_flags; |
| 7925 | #define CORGIBL_SUSPENDED 0x01 | 7948 | #define CORGIBL_SUSPENDED 0x01 |
| 7926 | @@ -107,7 +107,7 @@ static struct backlight_ops corgibl_ops | 7949 | @@ -107,7 +107,7 @@ |
| 7927 | 7950 | ||
| 7928 | static int corgibl_probe(struct platform_device *pdev) | 7951 | static int corgibl_probe(struct platform_device *pdev) |
| 7929 | { | 7952 | { |
| @@ -7934,8 +7957,8 @@ Index: linux-2.6.22/drivers/video/backlight/corgi_bl.c | |||
| 7934 | if (!machinfo->limit_mask) | 7957 | if (!machinfo->limit_mask) |
| 7935 | Index: linux-2.6.22/arch/arm/mach-pxa/corgi.c | 7958 | Index: linux-2.6.22/arch/arm/mach-pxa/corgi.c |
| 7936 | =================================================================== | 7959 | =================================================================== |
| 7937 | --- linux-2.6.22.orig/arch/arm/mach-pxa/corgi.c 2007-07-27 16:10:13.000000000 +0100 | 7960 | --- linux-2.6.22.orig/arch/arm/mach-pxa/corgi.c 2007-08-23 13:09:20.000000000 +0200 |
| 7938 | +++ linux-2.6.22/arch/arm/mach-pxa/corgi.c 2007-07-27 16:13:54.000000000 +0100 | 7961 | +++ linux-2.6.22/arch/arm/mach-pxa/corgi.c 2007-08-23 13:09:22.000000000 +0200 |
| 7939 | @@ -20,6 +20,7 @@ | 7962 | @@ -20,6 +20,7 @@ |
| 7940 | #include <linux/interrupt.h> | 7963 | #include <linux/interrupt.h> |
| 7941 | #include <linux/mmc/host.h> | 7964 | #include <linux/mmc/host.h> |
| @@ -7944,7 +7967,7 @@ Index: linux-2.6.22/arch/arm/mach-pxa/corgi.c | |||
| 7944 | 7967 | ||
| 7945 | #include <asm/setup.h> | 7968 | #include <asm/setup.h> |
| 7946 | #include <asm/memory.h> | 7969 | #include <asm/memory.h> |
| 7947 | @@ -142,7 +143,7 @@ struct corgissp_machinfo corgi_ssp_machi | 7970 | @@ -142,7 +143,7 @@ |
| 7948 | /* | 7971 | /* |
| 7949 | * Corgi Backlight Device | 7972 | * Corgi Backlight Device |
| 7950 | */ | 7973 | */ |
| @@ -7955,9 +7978,9 @@ Index: linux-2.6.22/arch/arm/mach-pxa/corgi.c | |||
| 7955 | .limit_mask = 0x0b, | 7978 | .limit_mask = 0x0b, |
| 7956 | Index: linux-2.6.22/arch/arm/mach-pxa/spitz.c | 7979 | Index: linux-2.6.22/arch/arm/mach-pxa/spitz.c |
| 7957 | =================================================================== | 7980 | =================================================================== |
| 7958 | --- linux-2.6.22.orig/arch/arm/mach-pxa/spitz.c 2007-07-27 16:10:17.000000000 +0100 | 7981 | --- linux-2.6.22.orig/arch/arm/mach-pxa/spitz.c 2007-08-23 13:09:20.000000000 +0200 |
| 7959 | +++ linux-2.6.22/arch/arm/mach-pxa/spitz.c 2007-07-27 16:10:41.000000000 +0100 | 7982 | +++ linux-2.6.22/arch/arm/mach-pxa/spitz.c 2007-08-23 13:09:22.000000000 +0200 |
| 7960 | @@ -221,7 +221,7 @@ struct corgissp_machinfo spitz_ssp_machi | 7983 | @@ -221,7 +221,7 @@ |
| 7961 | /* | 7984 | /* |
| 7962 | * Spitz Backlight Device | 7985 | * Spitz Backlight Device |
| 7963 | */ | 7986 | */ |
| @@ -7966,3 +7989,492 @@ Index: linux-2.6.22/arch/arm/mach-pxa/spitz.c | |||
| 7966 | .default_intensity = 0x1f, | 7989 | .default_intensity = 0x1f, |
| 7967 | .limit_mask = 0x0b, | 7990 | .limit_mask = 0x0b, |
| 7968 | .max_intensity = 0x2f, | 7991 | .max_intensity = 0x2f, |
| 7992 | Index: linux-2.6.22/arch/arm/mach-pxa/generic.c | ||
| 7993 | =================================================================== | ||
| 7994 | --- linux-2.6.22.orig/arch/arm/mach-pxa/generic.c 2007-07-09 01:32:17.000000000 +0200 | ||
| 7995 | +++ linux-2.6.22/arch/arm/mach-pxa/generic.c 2007-08-23 13:09:22.000000000 +0200 | ||
| 7996 | @@ -345,6 +345,18 @@ | ||
| 7997 | .id = 3, | ||
| 7998 | }; | ||
| 7999 | |||
| 8000 | +void __init pxa_set_ffuart_info(struct platform_pxa_serial_funcs *info) | ||
| 8001 | +{ | ||
| 8002 | + ffuart_device.dev.platform_data = info; | ||
| 8003 | +} | ||
| 8004 | +EXPORT_SYMBOL(pxa_set_ffuart_info); | ||
| 8005 | + | ||
| 8006 | +void __init pxa_set_btuart_info(struct platform_pxa_serial_funcs *info) | ||
| 8007 | +{ | ||
| 8008 | + btuart_device.dev.platform_data = info; | ||
| 8009 | +} | ||
| 8010 | +EXPORT_SYMBOL(pxa_set_btuart_info); | ||
| 8011 | + | ||
| 8012 | static struct resource i2c_resources[] = { | ||
| 8013 | { | ||
| 8014 | .start = 0x40301680, | ||
| 8015 | Index: linux-2.6.22/drivers/w1/slaves/Kconfig | ||
| 8016 | =================================================================== | ||
| 8017 | --- linux-2.6.22.orig/drivers/w1/slaves/Kconfig 2007-07-09 01:32:17.000000000 +0200 | ||
| 8018 | +++ linux-2.6.22/drivers/w1/slaves/Kconfig 2007-08-23 13:09:22.000000000 +0200 | ||
| 8019 | @@ -35,4 +35,15 @@ | ||
| 8020 | Each block has 30 bytes of data and a two byte CRC16. | ||
| 8021 | Full block writes are only allowed if the CRC is valid. | ||
| 8022 | |||
| 8023 | +config W1_SLAVE_DS2760 | ||
| 8024 | + tristate "Dallas 2760 battery monitor chip (HP iPAQ & others)" | ||
| 8025 | + depends on W1 | ||
| 8026 | + help | ||
| 8027 | + If you enable this you will have the DS2760 battery monitor | ||
| 8028 | + chip support. | ||
| 8029 | + The battery monitor chip is used in many batteries/devices | ||
| 8030 | + as the one who is responsible for charging/discharging/monitoring | ||
| 8031 | + Li+ batteries. | ||
| 8032 | + If you are unsure, say N. | ||
| 8033 | + | ||
| 8034 | endmenu | ||
| 8035 | Index: linux-2.6.22/drivers/w1/slaves/Makefile | ||
| 8036 | =================================================================== | ||
| 8037 | --- linux-2.6.22.orig/drivers/w1/slaves/Makefile 2007-07-09 01:32:17.000000000 +0200 | ||
| 8038 | +++ linux-2.6.22/drivers/w1/slaves/Makefile 2007-08-23 13:09:22.000000000 +0200 | ||
| 8039 | @@ -5,4 +5,4 @@ | ||
| 8040 | obj-$(CONFIG_W1_SLAVE_THERM) += w1_therm.o | ||
| 8041 | obj-$(CONFIG_W1_SLAVE_SMEM) += w1_smem.o | ||
| 8042 | obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o | ||
| 8043 | - | ||
| 8044 | +obj-$(CONFIG_W1_SLAVE_DS2760) += w1_ds2760.o | ||
| 8045 | Index: linux-2.6.22/drivers/w1/w1_family.h | ||
| 8046 | =================================================================== | ||
| 8047 | --- linux-2.6.22.orig/drivers/w1/w1_family.h 2007-07-09 01:32:17.000000000 +0200 | ||
| 8048 | +++ linux-2.6.22/drivers/w1/w1_family.h 2007-08-23 13:09:22.000000000 +0200 | ||
| 8049 | @@ -33,6 +33,7 @@ | ||
| 8050 | #define W1_THERM_DS1822 0x22 | ||
| 8051 | #define W1_EEPROM_DS2433 0x23 | ||
| 8052 | #define W1_THERM_DS18B20 0x28 | ||
| 8053 | +#define W1_FAMILY_DS2760 0x30 | ||
| 8054 | |||
| 8055 | #define MAXNAMELEN 32 | ||
| 8056 | |||
| 8057 | Index: linux-2.6.22/include/asm-arm/arch-pxa/serial.h | ||
| 8058 | =================================================================== | ||
| 8059 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 8060 | +++ linux-2.6.22/include/asm-arm/arch-pxa/serial.h 2007-08-23 13:09:22.000000000 +0200 | ||
| 8061 | @@ -0,0 +1,78 @@ | ||
| 8062 | +/* | ||
| 8063 | + * linux/include/asm-arm/arch-pxa/serial.h | ||
| 8064 | + * | ||
| 8065 | + * Author: Nicolas Pitre | ||
| 8066 | + * Copyright: (C) 2001 MontaVista Software Inc. | ||
| 8067 | + * | ||
| 8068 | + * This program is free software; you can redistribute it and/or modify | ||
| 8069 | + * it under the terms of the GNU General Public License version 2 as | ||
| 8070 | + * published by the Free Software Foundation. | ||
| 8071 | + */ | ||
| 8072 | + | ||
| 8073 | +#include <asm/arch/pxa-regs.h> | ||
| 8074 | + | ||
| 8075 | +#define BAUD_BASE 921600 | ||
| 8076 | + | ||
| 8077 | +/* Standard COM flags */ | ||
| 8078 | +#define STD_COM_FLAGS (ASYNC_SKIP_TEST) | ||
| 8079 | + | ||
| 8080 | +#define STD_SERIAL_PORT_DEFNS \ | ||
| 8081 | + { \ | ||
| 8082 | + type: PORT_PXA, \ | ||
| 8083 | + xmit_fifo_size: 64, \ | ||
| 8084 | + baud_base: BAUD_BASE, \ | ||
| 8085 | + iomem_base: &FFUART, \ | ||
| 8086 | + iomem_reg_shift: 2, \ | ||
| 8087 | + io_type: SERIAL_IO_MEM, \ | ||
| 8088 | + irq: IRQ_FFUART, \ | ||
| 8089 | + flags: STD_COM_FLAGS, \ | ||
| 8090 | + }, { \ | ||
| 8091 | + type: PORT_PXA, \ | ||
| 8092 | + xmit_fifo_size: 64, \ | ||
| 8093 | + baud_base: BAUD_BASE, \ | ||
| 8094 | + iomem_base: &STUART, \ | ||
| 8095 | + iomem_reg_shift: 2, \ | ||
| 8096 | + io_type: SERIAL_IO_MEM, \ | ||
| 8097 | + irq: IRQ_STUART, \ | ||
| 8098 | + flags: STD_COM_FLAGS, \ | ||
| 8099 | + }, { \ | ||
| 8100 | + type: PORT_PXA, \ | ||
| 8101 | + xmit_fifo_size: 64, \ | ||
| 8102 | + baud_base: BAUD_BASE, \ | ||
| 8103 | + iomem_base: &BTUART, \ | ||
| 8104 | + iomem_reg_shift: 2, \ | ||
| 8105 | + io_type: SERIAL_IO_MEM, \ | ||
| 8106 | + irq: IRQ_BTUART, \ | ||
| 8107 | + flags: STD_COM_FLAGS, \ | ||
| 8108 | + } | ||
| 8109 | + | ||
| 8110 | +#define EXTRA_SERIAL_PORT_DEFNS | ||
| 8111 | + | ||
| 8112 | +struct platform_pxa_serial_funcs { | ||
| 8113 | + | ||
| 8114 | + /* Initialize whatever is connected to this serial port. */ | ||
| 8115 | + void (*configure)(int state); | ||
| 8116 | +#define PXA_UART_CFG_PRE_STARTUP 0 | ||
| 8117 | +#define PXA_UART_CFG_POST_STARTUP 1 | ||
| 8118 | +#define PXA_UART_CFG_PRE_SHUTDOWN 2 | ||
| 8119 | +#define PXA_UART_CFG_POST_SHUTDOWN 3 | ||
| 8120 | + | ||
| 8121 | + /* Enable or disable the individual transmitter/receiver submodules. | ||
| 8122 | + * On transceivers without echo cancellation (e.g. SIR) | ||
| 8123 | + * transmitter always has priority; e.g. if both bits are set, | ||
| 8124 | + * only the transmitter is enabled. */ | ||
| 8125 | + void (*set_txrx)(int txrx); | ||
| 8126 | +#define PXA_SERIAL_TX 1 | ||
| 8127 | +#define PXA_SERIAL_RX 2 | ||
| 8128 | + | ||
| 8129 | + /* Get the current state of tx/rx. */ | ||
| 8130 | + int (*get_txrx)(void); | ||
| 8131 | + | ||
| 8132 | + int (*suspend)(struct platform_device *dev, pm_message_t state); | ||
| 8133 | + int (*resume)(struct platform_device *dev); | ||
| 8134 | +}; | ||
| 8135 | + | ||
| 8136 | +void pxa_set_ffuart_info(struct platform_pxa_serial_funcs *ffuart_funcs); | ||
| 8137 | +void pxa_set_btuart_info(struct platform_pxa_serial_funcs *btuart_funcs); | ||
| 8138 | +void pxa_set_stuart_info(struct platform_pxa_serial_funcs *stuart_funcs); | ||
| 8139 | +void pxa_set_hwuart_info(struct platform_pxa_serial_funcs *hwuart_funcs); | ||
| 8140 | Index: linux-2.6.22/drivers/w1/slaves/w1_ds2760.c | ||
| 8141 | =================================================================== | ||
| 8142 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 8143 | +++ linux-2.6.22/drivers/w1/slaves/w1_ds2760.c 2007-08-23 13:09:22.000000000 +0200 | ||
| 8144 | @@ -0,0 +1,213 @@ | ||
| 8145 | +/* | ||
| 8146 | + * 1-Wire implementation for the ds2760 chip | ||
| 8147 | + * | ||
| 8148 | + * Copyright (c) 2004-2005, Szabolcs Gyurko <szabolcs.gyurko@tlt.hu> | ||
| 8149 | + * | ||
| 8150 | + * Use consistent with the GNU GPL is permitted, | ||
| 8151 | + * provided that this copyright notice is | ||
| 8152 | + * preserved in its entirety in all copies and derived works. | ||
| 8153 | + * | ||
| 8154 | + */ | ||
| 8155 | + | ||
| 8156 | +#include <linux/kernel.h> | ||
| 8157 | +#include <linux/module.h> | ||
| 8158 | +#include <linux/device.h> | ||
| 8159 | +#include <linux/types.h> | ||
| 8160 | +#include <linux/platform_device.h> | ||
| 8161 | +#include <linux/mutex.h> | ||
| 8162 | +#include <linux/idr.h> | ||
| 8163 | + | ||
| 8164 | +#include "../w1.h" | ||
| 8165 | +#include "../w1_int.h" | ||
| 8166 | +#include "../w1_family.h" | ||
| 8167 | +#include "w1_ds2760.h" | ||
| 8168 | + | ||
| 8169 | +static int w1_ds2760_io(struct device *dev, char *buf, int addr, size_t count, | ||
| 8170 | + int io) | ||
| 8171 | +{ | ||
| 8172 | + struct w1_slave *sl = container_of(dev, struct w1_slave, dev); | ||
| 8173 | + | ||
| 8174 | + if (!dev) | ||
| 8175 | + return 0; | ||
| 8176 | + | ||
| 8177 | + mutex_lock(&sl->master->mutex); | ||
| 8178 | + | ||
| 8179 | + if (addr > DS2760_DATA_SIZE || addr < 0) { | ||
| 8180 | + count = 0; | ||
| 8181 | + goto out; | ||
| 8182 | + } | ||
| 8183 | + if (addr + count > DS2760_DATA_SIZE) | ||
| 8184 | + count = DS2760_DATA_SIZE - addr; | ||
| 8185 | + | ||
| 8186 | + if (!w1_reset_select_slave(sl)) { | ||
| 8187 | + if (!io) { | ||
| 8188 | + w1_write_8(sl->master, W1_DS2760_READ_DATA); | ||
| 8189 | + w1_write_8(sl->master, addr); | ||
| 8190 | + count = w1_read_block(sl->master, buf, count); | ||
| 8191 | + } else { | ||
| 8192 | + w1_write_8(sl->master, W1_DS2760_WRITE_DATA); | ||
| 8193 | + w1_write_8(sl->master, addr); | ||
| 8194 | + w1_write_block(sl->master, buf, count); | ||
| 8195 | + /* XXX w1_write_block returns void, not n_written */ | ||
| 8196 | + } | ||
| 8197 | + } | ||
| 8198 | + | ||
| 8199 | +out: | ||
| 8200 | + mutex_unlock(&sl->master->mutex); | ||
| 8201 | + | ||
| 8202 | + return count; | ||
| 8203 | +} | ||
| 8204 | + | ||
| 8205 | +int w1_ds2760_read(struct device *dev, char *buf, int addr, size_t count) | ||
| 8206 | +{ | ||
| 8207 | + return w1_ds2760_io(dev, buf, addr, count, 0); | ||
| 8208 | +} | ||
| 8209 | + | ||
| 8210 | +int w1_ds2760_write(struct device *dev, char *buf, int addr, size_t count) | ||
| 8211 | +{ | ||
| 8212 | + return w1_ds2760_io(dev, buf, addr, count, 1); | ||
| 8213 | +} | ||
| 8214 | + | ||
| 8215 | +static ssize_t w1_ds2760_read_bin(struct kobject *kobj, char *buf, loff_t off, | ||
| 8216 | + size_t count) | ||
| 8217 | +{ | ||
| 8218 | + struct device *dev = container_of(kobj, struct device, kobj); | ||
| 8219 | + return w1_ds2760_read(dev, buf, off, count); | ||
| 8220 | +} | ||
| 8221 | + | ||
| 8222 | +static struct bin_attribute w1_ds2760_bin_attr = { | ||
| 8223 | + .attr = { | ||
| 8224 | + .name = "w1_slave", | ||
| 8225 | + .mode = S_IRUGO, | ||
| 8226 | + .owner = THIS_MODULE, | ||
| 8227 | + }, | ||
| 8228 | + .size = DS2760_DATA_SIZE, | ||
| 8229 | + .read = w1_ds2760_read_bin, | ||
| 8230 | +}; | ||
| 8231 | + | ||
| 8232 | +static DEFINE_IDR(bat_idr); | ||
| 8233 | +static DEFINE_MUTEX(bat_idr_lock); | ||
| 8234 | + | ||
| 8235 | +static int new_bat_id(void) | ||
| 8236 | +{ | ||
| 8237 | + int ret; | ||
| 8238 | + | ||
| 8239 | + while (1) { | ||
| 8240 | + int id; | ||
| 8241 | + | ||
| 8242 | + ret = idr_pre_get(&bat_idr, GFP_KERNEL); | ||
| 8243 | + if (ret == 0) | ||
| 8244 | + return -ENOMEM; | ||
| 8245 | + | ||
| 8246 | + mutex_lock(&bat_idr_lock); | ||
| 8247 | + ret = idr_get_new(&bat_idr, NULL, &id); | ||
| 8248 | + mutex_unlock(&bat_idr_lock); | ||
| 8249 | + | ||
| 8250 | + if (ret == 0) { | ||
| 8251 | + ret = id & MAX_ID_MASK; | ||
| 8252 | + break; | ||
| 8253 | + } | ||
| 8254 | + else if (ret == -EAGAIN) | ||
| 8255 | + continue; | ||
| 8256 | + else | ||
| 8257 | + break; | ||
| 8258 | + } | ||
| 8259 | + | ||
| 8260 | + return ret; | ||
| 8261 | +} | ||
| 8262 | + | ||
| 8263 | +static void release_bat_id(int id) | ||
| 8264 | +{ | ||
| 8265 | + mutex_lock(&bat_idr_lock); | ||
| 8266 | + idr_remove(&bat_idr, id); | ||
| 8267 | + mutex_unlock(&bat_idr_lock); | ||
| 8268 | + | ||
| 8269 | + return; | ||
| 8270 | +} | ||
| 8271 | + | ||
| 8272 | +static int w1_ds2760_add_slave(struct w1_slave *sl) | ||
| 8273 | +{ | ||
| 8274 | + int ret; | ||
| 8275 | + int id; | ||
| 8276 | + struct platform_device *pdev; | ||
| 8277 | + | ||
| 8278 | + id = new_bat_id(); | ||
| 8279 | + if (id < 0) { | ||
| 8280 | + ret = id; | ||
| 8281 | + goto noid; | ||
| 8282 | + } | ||
| 8283 | + | ||
| 8284 | + pdev = platform_device_alloc("ds2760-battery", id); | ||
| 8285 | + if (!pdev) { | ||
| 8286 | + ret = -ENOMEM; | ||
| 8287 | + goto pdev_alloc_failed; | ||
| 8288 | + } | ||
| 8289 | + pdev->dev.parent = &sl->dev; | ||
| 8290 | + | ||
| 8291 | + ret = platform_device_add(pdev); | ||
| 8292 | + if (ret) | ||
| 8293 | + goto pdev_add_failed; | ||
| 8294 | + | ||
| 8295 | + ret = sysfs_create_bin_file(&sl->dev.kobj, &w1_ds2760_bin_attr); | ||
| 8296 | + if (ret) | ||
| 8297 | + goto bin_attr_failed; | ||
| 8298 | + | ||
| 8299 | + dev_set_drvdata(&sl->dev, pdev); | ||
| 8300 | + | ||
| 8301 | + goto success; | ||
| 8302 | + | ||
| 8303 | +bin_attr_failed: | ||
| 8304 | +pdev_add_failed: | ||
| 8305 | + platform_device_unregister(pdev); | ||
| 8306 | +pdev_alloc_failed: | ||
| 8307 | + release_bat_id(id); | ||
| 8308 | +noid: | ||
| 8309 | +success: | ||
| 8310 | + return ret; | ||
| 8311 | +} | ||
| 8312 | + | ||
| 8313 | +static void w1_ds2760_remove_slave(struct w1_slave *sl) | ||
| 8314 | +{ | ||
| 8315 | + struct platform_device *pdev = dev_get_drvdata(&sl->dev); | ||
| 8316 | + int id = pdev->id; | ||
| 8317 | + | ||
| 8318 | + platform_device_unregister(pdev); | ||
| 8319 | + release_bat_id(id); | ||
| 8320 | + sysfs_remove_bin_file(&sl->dev.kobj, &w1_ds2760_bin_attr); | ||
| 8321 | + | ||
| 8322 | + return; | ||
| 8323 | +} | ||
| 8324 | + | ||
| 8325 | +static struct w1_family_ops w1_ds2760_fops = { | ||
| 8326 | + .add_slave = w1_ds2760_add_slave, | ||
| 8327 | + .remove_slave = w1_ds2760_remove_slave, | ||
| 8328 | +}; | ||
| 8329 | + | ||
| 8330 | +static struct w1_family w1_ds2760_family = { | ||
| 8331 | + .fid = W1_FAMILY_DS2760, | ||
| 8332 | + .fops = &w1_ds2760_fops, | ||
| 8333 | +}; | ||
| 8334 | + | ||
| 8335 | +static int __init w1_ds2760_init(void) | ||
| 8336 | +{ | ||
| 8337 | + printk(KERN_INFO "1-Wire driver for the DS2760 battery monitor " | ||
| 8338 | + " chip - (c) 2004-2005, Szabolcs Gyurko\n"); | ||
| 8339 | + idr_init(&bat_idr); | ||
| 8340 | + return w1_register_family(&w1_ds2760_family); | ||
| 8341 | +} | ||
| 8342 | + | ||
| 8343 | +static void __exit w1_ds2760_exit(void) | ||
| 8344 | +{ | ||
| 8345 | + w1_unregister_family(&w1_ds2760_family); | ||
| 8346 | + idr_destroy(&bat_idr); | ||
| 8347 | +} | ||
| 8348 | + | ||
| 8349 | +EXPORT_SYMBOL(w1_ds2760_read); | ||
| 8350 | +EXPORT_SYMBOL(w1_ds2760_write); | ||
| 8351 | + | ||
| 8352 | +module_init(w1_ds2760_init); | ||
| 8353 | +module_exit(w1_ds2760_exit); | ||
| 8354 | + | ||
| 8355 | +MODULE_LICENSE("GPL"); | ||
| 8356 | +MODULE_AUTHOR("Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>"); | ||
| 8357 | +MODULE_DESCRIPTION("1-wire Driver Dallas 2760 battery monitor chip"); | ||
| 8358 | Index: linux-2.6.22/drivers/w1/slaves/w1_ds2760.h | ||
| 8359 | =================================================================== | ||
| 8360 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 8361 | +++ linux-2.6.22/drivers/w1/slaves/w1_ds2760.h 2007-08-23 13:09:22.000000000 +0200 | ||
| 8362 | @@ -0,0 +1,50 @@ | ||
| 8363 | +/* | ||
| 8364 | + * 1-Wire implementation for the ds2760 chip | ||
| 8365 | + * | ||
| 8366 | + * Copyright (c) 2004-2005, Szabolcs Gyurko <szabolcs.gyurko@tlt.hu> | ||
| 8367 | + * | ||
| 8368 | + * Use consistent with the GNU GPL is permitted, | ||
| 8369 | + * provided that this copyright notice is | ||
| 8370 | + * preserved in its entirety in all copies and derived works. | ||
| 8371 | + * | ||
| 8372 | + */ | ||
| 8373 | + | ||
| 8374 | +#ifndef __w1_ds2760_h__ | ||
| 8375 | +#define __w1_ds2760_h__ | ||
| 8376 | + | ||
| 8377 | +/* Known commands to the DS2760 chip */ | ||
| 8378 | +#define W1_DS2760_SWAP 0xAA | ||
| 8379 | +#define W1_DS2760_READ_DATA 0x69 | ||
| 8380 | +#define W1_DS2760_WRITE_DATA 0x6C | ||
| 8381 | +#define W1_DS2760_COPY_DATA 0x48 | ||
| 8382 | +#define W1_DS2760_RECALL_DATA 0xB8 | ||
| 8383 | +#define W1_DS2760_LOCK 0x6A | ||
| 8384 | + | ||
| 8385 | +/* Number of valid register addresses */ | ||
| 8386 | +#define DS2760_DATA_SIZE 0x40 | ||
| 8387 | + | ||
| 8388 | +#define DS2760_PROTECTION_REG 0x00 | ||
| 8389 | +#define DS2760_STATUS_REG 0x01 | ||
| 8390 | +#define DS2760_EEPROM_REG 0x07 | ||
| 8391 | +#define DS2760_SPECIAL_FEATURE_REG 0x08 | ||
| 8392 | +#define DS2760_VOLTAGE_MSB 0x0c | ||
| 8393 | +#define DS2760_VOLTAGE_LSB 0x0d | ||
| 8394 | +#define DS2760_CURRENT_MSB 0x0e | ||
| 8395 | +#define DS2760_CURRENT_LSB 0x0f | ||
| 8396 | +#define DS2760_CURRENT_ACCUM_MSB 0x10 | ||
| 8397 | +#define DS2760_CURRENT_ACCUM_LSB 0x11 | ||
| 8398 | +#define DS2760_TEMP_MSB 0x18 | ||
| 8399 | +#define DS2760_TEMP_LSB 0x19 | ||
| 8400 | +#define DS2760_EEPROM_BLOCK0 0x20 | ||
| 8401 | +#define DS2760_ACTIVE_FULL 0x20 | ||
| 8402 | +#define DS2760_EEPROM_BLOCK1 0x30 | ||
| 8403 | +#define DS2760_RATED_CAPACITY 0x32 | ||
| 8404 | +#define DS2760_CURRENT_OFFSET_BIAS 0x33 | ||
| 8405 | +#define DS2760_ACTIVE_EMPTY 0x3b | ||
| 8406 | + | ||
| 8407 | +extern int w1_ds2760_read(struct device *dev, char *buf, int addr, | ||
| 8408 | + size_t count); | ||
| 8409 | +extern int w1_ds2760_write(struct device *dev, char *buf, int addr, | ||
| 8410 | + size_t count); | ||
| 8411 | + | ||
| 8412 | +#endif /* !__w1_ds2760_h__ */ | ||
| 8413 | Index: linux-2.6.22/drivers/serial/pxa.c | ||
| 8414 | =================================================================== | ||
| 8415 | --- linux-2.6.22.orig/drivers/serial/pxa.c 2007-08-23 13:21:54.000000000 +0200 | ||
| 8416 | +++ linux-2.6.22/drivers/serial/pxa.c 2007-08-23 13:22:54.000000000 +0200 | ||
| 8417 | @@ -46,6 +46,7 @@ | ||
| 8418 | #include <asm/io.h> | ||
| 8419 | #include <asm/hardware.h> | ||
| 8420 | #include <asm/irq.h> | ||
| 8421 | +#include <asm/arch/serial.h> | ||
| 8422 | #include <asm/arch/pxa-regs.h> | ||
| 8423 | |||
| 8424 | |||
| 8425 | @@ -59,6 +60,14 @@ | ||
| 8426 | char *name; | ||
| 8427 | }; | ||
| 8428 | |||
| 8429 | + | ||
| 8430 | +#define IS_METHOD(dev, method) (dev && (dev)->platform_data && ((struct platform_pxa_serial_funcs *)(dev)->platform_data)->method) | ||
| 8431 | +#define METHOD_CALL(dev, method) \ | ||
| 8432 | + ((struct platform_pxa_serial_funcs *)(dev)->platform_data)->method() | ||
| 8433 | +#define SAFE_METHOD_CALL(dev, method, args...) \ | ||
| 8434 | + if (IS_METHOD(dev, method)) \ | ||
| 8435 | + ((struct platform_pxa_serial_funcs *)(dev)->platform_data)->method(args) | ||
| 8436 | + | ||
| 8437 | static inline unsigned int serial_in(struct uart_pxa_port *up, int offset) | ||
| 8438 | { | ||
| 8439 | offset <<= 2; | ||
| 8440 | @@ -346,6 +355,9 @@ | ||
| 8441 | unsigned long flags; | ||
| 8442 | int retval; | ||
| 8443 | |||
| 8444 | + /* Perform platform-specific port initialization, if needed. */ | ||
| 8445 | + SAFE_METHOD_CALL(port->dev, configure, PXA_UART_CFG_PRE_STARTUP); | ||
| 8446 | + | ||
| 8447 | if (port->line == 3) /* HWUART */ | ||
| 8448 | up->mcr |= UART_MCR_AFE; | ||
| 8449 | else | ||
| 8450 | @@ -401,6 +413,12 @@ | ||
| 8451 | (void) serial_in(up, UART_IIR); | ||
| 8452 | (void) serial_in(up, UART_MSR); | ||
| 8453 | |||
| 8454 | + /* | ||
| 8455 | + * Perform platform-specific port initialization if needed | ||
| 8456 | + */ | ||
| 8457 | + SAFE_METHOD_CALL(port->dev, configure, PXA_UART_CFG_POST_STARTUP); | ||
| 8458 | + SAFE_METHOD_CALL(port->dev, set_txrx, PXA_SERIAL_RX); | ||
| 8459 | + | ||
| 8460 | return 0; | ||
| 8461 | } | ||
| 8462 | |||
| 8463 | @@ -409,6 +427,8 @@ | ||
| 8464 | struct uart_pxa_port *up = (struct uart_pxa_port *)port; | ||
| 8465 | unsigned long flags; | ||
| 8466 | |||
| 8467 | + SAFE_METHOD_CALL(port->dev, configure, PXA_UART_CFG_PRE_SHUTDOWN); | ||
| 8468 | + | ||
| 8469 | free_irq(up->port.irq, up); | ||
| 8470 | |||
| 8471 | /* | ||
| 8472 | @@ -430,6 +450,8 @@ | ||
| 8473 | UART_FCR_CLEAR_RCVR | | ||
| 8474 | UART_FCR_CLEAR_XMIT); | ||
| 8475 | serial_out(up, UART_FCR, 0); | ||
| 8476 | + | ||
| 8477 | + SAFE_METHOD_CALL(port->dev, configure, PXA_UART_CFG_POST_SHUTDOWN); | ||
| 8478 | } | ||
| 8479 | |||
| 8480 | static void | ||
diff --git a/meta/packages/linux/linux-rp-2.6.22/pda-power.patch b/meta/packages/linux/linux-rp-2.6.22/pda-power.patch new file mode 100644 index 0000000000..face2f4ef2 --- /dev/null +++ b/meta/packages/linux/linux-rp-2.6.22/pda-power.patch | |||
| @@ -0,0 +1,3373 @@ | |||
| 1 | --- | ||
| 2 | arch/arm/Kconfig | 2 | ||
| 3 | drivers/Kconfig | 2 | ||
| 4 | drivers/Makefile | 1 | ||
| 5 | drivers/power/Kconfig | 70 +++++ | ||
| 6 | drivers/power/Makefile | 28 ++ | ||
| 7 | drivers/power/adc_battery.c | 278 +++++++++++++++++++++ | ||
| 8 | drivers/power/apm_power.c | 247 +++++++++++++++++++ | ||
| 9 | drivers/power/ds2760_battery.c | 475 +++++++++++++++++++++++++++++++++++++ | ||
| 10 | drivers/power/micro_battery.c | 257 ++++++++++++++++++++ | ||
| 11 | drivers/power/olpc_battery.c | 302 +++++++++++++++++++++++ | ||
| 12 | drivers/power/pda_power.c | 263 ++++++++++++++++++++ | ||
| 13 | drivers/power/pmu_battery.c | 215 ++++++++++++++++ | ||
| 14 | drivers/power/power_supply.h | 42 +++ | ||
| 15 | drivers/power/power_supply_core.c | 168 +++++++++++++ | ||
| 16 | drivers/power/power_supply_leds.c | 188 ++++++++++++++ | ||
| 17 | drivers/power/power_supply_sysfs.c | 289 ++++++++++++++++++++++ | ||
| 18 | drivers/power/simpad-battery.c | 242 ++++++++++++++++++ | ||
| 19 | include/linux/power_supply.h | 175 +++++++++++++ | ||
| 20 | 18 files changed, 3244 insertions(+) | ||
| 21 | |||
| 22 | Index: linux-2.6.22/drivers/power/adc_battery.c | ||
| 23 | =================================================================== | ||
| 24 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 25 | +++ linux-2.6.22/drivers/power/adc_battery.c 2007-08-23 12:26:28.000000000 +0200 | ||
| 26 | @@ -0,0 +1,278 @@ | ||
| 27 | +/* | ||
| 28 | + * Copyright (c) 2007 Paul Sokolovsky | ||
| 29 | + * | ||
| 30 | + * This program is free software; you can redistribute it and/or modify | ||
| 31 | + * it under the terms of the GNU General Public License as published by | ||
| 32 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 33 | + * (at your option) any later version. | ||
| 34 | + * | ||
| 35 | + */ | ||
| 36 | + | ||
| 37 | +//#define DEBUG | ||
| 38 | + | ||
| 39 | +#include <linux/module.h> | ||
| 40 | +#include <linux/interrupt.h> | ||
| 41 | +#include <linux/pm.h> | ||
| 42 | +#include <linux/delay.h> | ||
| 43 | +#include <linux/workqueue.h> | ||
| 44 | +#include <linux/platform_device.h> | ||
| 45 | +#include <linux/power_supply.h> | ||
| 46 | +#include <linux/adc.h> | ||
| 47 | +#include <linux/adc_battery.h> | ||
| 48 | + | ||
| 49 | +#include <asm/irq.h> | ||
| 50 | + | ||
| 51 | +#define PIN_NO_VOLT 0 | ||
| 52 | +#define PIN_NO_CURR 1 | ||
| 53 | +#define PIN_NO_TEMP 2 | ||
| 54 | + | ||
| 55 | +struct battery_adc_priv { | ||
| 56 | + struct power_supply batt_cdev; | ||
| 57 | + | ||
| 58 | + struct battery_adc_platform_data *pdata; | ||
| 59 | + | ||
| 60 | + struct adc_request req; | ||
| 61 | + struct adc_sense pins[3]; | ||
| 62 | + struct adc_sense last_good_pins[3]; | ||
| 63 | + | ||
| 64 | + struct workqueue_struct *wq; | ||
| 65 | + struct delayed_work work; | ||
| 66 | +}; | ||
| 67 | + | ||
| 68 | +/* | ||
| 69 | + * Battery properties | ||
| 70 | + */ | ||
| 71 | + | ||
| 72 | +static int adc_battery_get_property(struct power_supply *psy, | ||
| 73 | + enum power_supply_property psp, | ||
| 74 | + union power_supply_propval *val) | ||
| 75 | +{ | ||
| 76 | + struct battery_adc_priv* drvdata = (struct battery_adc_priv*)psy; | ||
| 77 | + int voltage; | ||
| 78 | + | ||
| 79 | + switch (psp) { | ||
| 80 | + case POWER_SUPPLY_PROP_STATUS: | ||
| 81 | + val->intval = drvdata->pdata->charge_status; | ||
| 82 | + break; | ||
| 83 | + case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: | ||
| 84 | + val->intval = drvdata->pdata->battery_info.voltage_max_design; | ||
| 85 | + break; | ||
| 86 | + case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: | ||
| 87 | + val->intval = drvdata->pdata->battery_info.voltage_min_design; | ||
| 88 | + break; | ||
| 89 | + case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: | ||
| 90 | + val->intval = drvdata->pdata->battery_info.charge_full_design; | ||
| 91 | + break; | ||
| 92 | + case POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN: | ||
| 93 | + val->intval = drvdata->pdata->battery_info.charge_empty_design; | ||
| 94 | + break; | ||
| 95 | + case POWER_SUPPLY_PROP_VOLTAGE_NOW: | ||
| 96 | + val->intval = drvdata->last_good_pins[PIN_NO_VOLT].value * drvdata->pdata->voltage_mult; | ||
| 97 | + break; | ||
| 98 | + case POWER_SUPPLY_PROP_CURRENT_NOW: | ||
| 99 | + val->intval = drvdata->last_good_pins[PIN_NO_CURR].value * drvdata->pdata->current_mult; | ||
| 100 | + break; | ||
| 101 | + case POWER_SUPPLY_PROP_CHARGE_NOW: | ||
| 102 | + /* We do calculations in mX, not uX, because todo it in uX we should use "long long"s, | ||
| 103 | + * which is a mess (need to use do_div) when you need divide operation). */ | ||
| 104 | + voltage = drvdata->last_good_pins[PIN_NO_VOLT].value * drvdata->pdata->voltage_mult; | ||
| 105 | + val->intval = ((voltage/1000 - drvdata->pdata->battery_info.voltage_min_design/1000) * | ||
| 106 | + (drvdata->pdata->battery_info.charge_full_design/1000 - | ||
| 107 | + drvdata->pdata->battery_info.charge_empty_design/1000)) / | ||
| 108 | + (drvdata->pdata->battery_info.voltage_max_design/1000 - | ||
| 109 | + drvdata->pdata->battery_info.voltage_min_design/1000); | ||
| 110 | + val->intval *= 1000; /* convert final result to uX */ | ||
| 111 | + break; | ||
| 112 | + case POWER_SUPPLY_PROP_TEMP: | ||
| 113 | + val->intval = drvdata->last_good_pins[PIN_NO_TEMP].value * drvdata->pdata->temperature_mult / 1000; | ||
| 114 | + break; | ||
| 115 | + default: | ||
| 116 | + return -EINVAL; | ||
| 117 | + }; | ||
| 118 | + return 0; | ||
| 119 | +} | ||
| 120 | + | ||
| 121 | +/* | ||
| 122 | + * Driver body | ||
| 123 | + */ | ||
| 124 | + | ||
| 125 | +static void adc_battery_query(struct battery_adc_priv *drvdata) | ||
| 126 | +{ | ||
| 127 | + struct battery_adc_platform_data *pdata = drvdata->pdata; | ||
| 128 | + int powered, charging; | ||
| 129 | + | ||
| 130 | + adc_request_sample(&drvdata->req); | ||
| 131 | + | ||
| 132 | + powered = power_supply_am_i_supplied(&drvdata->batt_cdev); | ||
| 133 | + charging = pdata->is_charging ? pdata->is_charging() : -1; | ||
| 134 | + | ||
| 135 | + if (powered && charging) | ||
| 136 | + pdata->charge_status = POWER_SUPPLY_STATUS_CHARGING; | ||
| 137 | + else if (powered && !charging && charging != -1) | ||
| 138 | + pdata->charge_status = POWER_SUPPLY_STATUS_FULL; | ||
| 139 | + else | ||
| 140 | + pdata->charge_status = POWER_SUPPLY_STATUS_DISCHARGING; | ||
| 141 | + | ||
| 142 | + /* Throw away invalid samples, this may happen soon after resume for example. */ | ||
| 143 | + if (drvdata->pins[PIN_NO_VOLT].value > 0) { | ||
| 144 | + memcpy(drvdata->last_good_pins, drvdata->pins, sizeof(drvdata->pins)); | ||
| 145 | +#ifdef DEBUG | ||
| 146 | + printk("%d %d %d\n", drvdata->pins[PIN_NO_VOLT].value, | ||
| 147 | + drvdata->pins[PIN_NO_CURR].value, | ||
| 148 | + drvdata->pins[PIN_NO_TEMP].value); | ||
| 149 | +#endif | ||
| 150 | + } | ||
| 151 | +} | ||
| 152 | + | ||
| 153 | +static void adc_battery_charge_power_changed(struct power_supply *bat) | ||
| 154 | +{ | ||
| 155 | + struct battery_adc_priv *drvdata = (struct battery_adc_priv*)bat; | ||
| 156 | + cancel_delayed_work(&drvdata->work); | ||
| 157 | + queue_delayed_work(drvdata->wq, &drvdata->work, 0); | ||
| 158 | +} | ||
| 159 | + | ||
| 160 | +static void adc_battery_work_func(struct work_struct *work) | ||
| 161 | +{ | ||
| 162 | + struct delayed_work *delayed_work = container_of(work, struct delayed_work, work); | ||
| 163 | + struct battery_adc_priv *drvdata = container_of(delayed_work, struct battery_adc_priv, work); | ||
| 164 | + | ||
| 165 | + adc_battery_query(drvdata); | ||
| 166 | + power_supply_changed(&drvdata->batt_cdev); | ||
| 167 | + | ||
| 168 | + queue_delayed_work(drvdata->wq, &drvdata->work, (5000 * HZ) / 1000); | ||
| 169 | +} | ||
| 170 | + | ||
| 171 | +static int adc_battery_probe(struct platform_device *pdev) | ||
| 172 | +{ | ||
| 173 | + int retval; | ||
| 174 | + struct battery_adc_platform_data *pdata = pdev->dev.platform_data; | ||
| 175 | + struct battery_adc_priv *drvdata; | ||
| 176 | + int i, j; | ||
| 177 | + enum power_supply_property props[] = { | ||
| 178 | + POWER_SUPPLY_PROP_STATUS, | ||
| 179 | + POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, | ||
| 180 | + POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, | ||
| 181 | + POWER_SUPPLY_PROP_VOLTAGE_NOW, | ||
| 182 | + POWER_SUPPLY_PROP_CURRENT_NOW, | ||
| 183 | + POWER_SUPPLY_PROP_CHARGE_NOW, | ||
| 184 | + POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, | ||
| 185 | + POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN, | ||
| 186 | + POWER_SUPPLY_PROP_TEMP, | ||
| 187 | + }; | ||
| 188 | + | ||
| 189 | + // Initialize ts data structure. | ||
| 190 | + drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); | ||
| 191 | + if (!drvdata) | ||
| 192 | + return -ENOMEM; | ||
| 193 | + | ||
| 194 | + drvdata->batt_cdev.name = pdata->battery_info.name; | ||
| 195 | + drvdata->batt_cdev.use_for_apm = pdata->battery_info.use_for_apm; | ||
| 196 | + drvdata->batt_cdev.num_properties = ARRAY_SIZE(props); | ||
| 197 | + drvdata->batt_cdev.get_property = adc_battery_get_property; | ||
| 198 | + drvdata->batt_cdev.external_power_changed = | ||
| 199 | + adc_battery_charge_power_changed; | ||
| 200 | + | ||
| 201 | + if (!pdata->voltage_pin) { | ||
| 202 | + drvdata->batt_cdev.num_properties--; | ||
| 203 | + props[3] = -1; | ||
| 204 | + } | ||
| 205 | + if (!pdata->current_pin) { | ||
| 206 | + drvdata->batt_cdev.num_properties--; | ||
| 207 | + props[4] = -1; | ||
| 208 | + } | ||
| 209 | + if (!pdata->temperature_pin) { | ||
| 210 | + drvdata->batt_cdev.num_properties--; | ||
| 211 | + props[8] = -1; | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | + drvdata->batt_cdev.properties = kmalloc( | ||
| 215 | + sizeof(*drvdata->batt_cdev.properties) * | ||
| 216 | + drvdata->batt_cdev.num_properties, GFP_KERNEL); | ||
| 217 | + if (!drvdata->batt_cdev.properties) | ||
| 218 | + return -ENOMEM; | ||
| 219 | + | ||
| 220 | + j = 0; | ||
| 221 | + for (i = 0; i < ARRAY_SIZE(props); i++) { | ||
| 222 | + if (props[i] == -1) | ||
| 223 | + continue; | ||
| 224 | + drvdata->batt_cdev.properties[j++] = props[i]; | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + retval = power_supply_register(&pdev->dev, &drvdata->batt_cdev); | ||
| 228 | + if (retval) { | ||
| 229 | + printk("adc-battery: Error registering battery classdev"); | ||
| 230 | + return retval; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + drvdata->req.senses = drvdata->pins; | ||
| 234 | + drvdata->req.num_senses = ARRAY_SIZE(drvdata->pins); | ||
| 235 | + drvdata->pins[PIN_NO_VOLT].name = pdata->voltage_pin; | ||
| 236 | + drvdata->pins[PIN_NO_CURR].name = pdata->current_pin; | ||
| 237 | + drvdata->pins[PIN_NO_TEMP].name = pdata->temperature_pin; | ||
| 238 | + | ||
| 239 | + adc_request_register(&drvdata->req); | ||
| 240 | + | ||
| 241 | + /* Here we assume raw values in mV */ | ||
| 242 | + if (!pdata->voltage_mult) | ||
| 243 | + pdata->voltage_mult = 1000; | ||
| 244 | + /* Here we assume raw values in mA */ | ||
| 245 | + if (!pdata->current_mult) | ||
| 246 | + pdata->current_mult = 1000; | ||
| 247 | + /* Here we assume raw values in 1/10 C */ | ||
| 248 | + if (!pdata->temperature_mult) | ||
| 249 | + pdata->temperature_mult = 1000; | ||
| 250 | + | ||
| 251 | + drvdata->pdata = pdata; | ||
| 252 | + pdata->drvdata = drvdata; /* Seems ugly, we need better solution */ | ||
| 253 | + | ||
| 254 | + platform_set_drvdata(pdev, drvdata); | ||
| 255 | + | ||
| 256 | + // Load initial values ASAP | ||
| 257 | + adc_battery_query(drvdata); | ||
| 258 | + | ||
| 259 | + // Still schedule next sampling soon | ||
| 260 | + INIT_DELAYED_WORK(&drvdata->work, adc_battery_work_func); | ||
| 261 | + drvdata->wq = create_workqueue(pdev->dev.bus_id); | ||
| 262 | + if (!drvdata->wq) | ||
| 263 | + return -ESRCH; | ||
| 264 | + | ||
| 265 | + queue_delayed_work(drvdata->wq, &drvdata->work, (5000 * HZ) / 1000); | ||
| 266 | + | ||
| 267 | + return retval; | ||
| 268 | +} | ||
| 269 | + | ||
| 270 | +static int adc_battery_remove(struct platform_device *pdev) | ||
| 271 | +{ | ||
| 272 | + struct battery_adc_priv *drvdata = platform_get_drvdata(pdev); | ||
| 273 | + cancel_delayed_work(&drvdata->work); | ||
| 274 | + destroy_workqueue(drvdata->wq); | ||
| 275 | + power_supply_unregister(&drvdata->batt_cdev); | ||
| 276 | + adc_request_unregister(&drvdata->req); | ||
| 277 | + kfree(drvdata->batt_cdev.properties); | ||
| 278 | + return 0; | ||
| 279 | +} | ||
| 280 | + | ||
| 281 | +static struct platform_driver adc_battery_driver = { | ||
| 282 | + .driver = { | ||
| 283 | + .name = "adc-battery", | ||
| 284 | + }, | ||
| 285 | + .probe = adc_battery_probe, | ||
| 286 | + .remove = adc_battery_remove, | ||
| 287 | +}; | ||
| 288 | + | ||
| 289 | +static int __init adc_battery_init(void) | ||
| 290 | +{ | ||
| 291 | + return platform_driver_register(&adc_battery_driver); | ||
| 292 | +} | ||
| 293 | + | ||
| 294 | +static void __exit adc_battery_exit(void) | ||
| 295 | +{ | ||
| 296 | + platform_driver_unregister(&adc_battery_driver); | ||
| 297 | +} | ||
| 298 | + | ||
| 299 | +module_init(adc_battery_init) | ||
| 300 | +module_exit(adc_battery_exit) | ||
| 301 | + | ||
| 302 | +MODULE_AUTHOR("Paul Sokolovsky"); | ||
| 303 | +MODULE_DESCRIPTION("Battery driver for ADC device"); | ||
| 304 | +MODULE_LICENSE("GPL"); | ||
| 305 | Index: linux-2.6.22/drivers/power/apm_power.c | ||
| 306 | =================================================================== | ||
| 307 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 308 | +++ linux-2.6.22/drivers/power/apm_power.c 2007-08-23 12:13:52.000000000 +0200 | ||
| 309 | @@ -0,0 +1,247 @@ | ||
| 310 | +/* | ||
| 311 | + * Copyright (c) 2007 Anton Vorontsov <cbou@mail.ru> | ||
| 312 | + * Copyright (c) 2007 Eugeny Boger <eugenyboger@dgap.mipt.ru> | ||
| 313 | + * | ||
| 314 | + * Author: Eugeny Boger <eugenyboger@dgap.mipt.ru> | ||
| 315 | + * | ||
| 316 | + * Use consistent with the GNU GPL is permitted, | ||
| 317 | + * provided that this copyright notice is | ||
| 318 | + * preserved in its entirety in all copies and derived works. | ||
| 319 | + */ | ||
| 320 | + | ||
| 321 | +#include <linux/module.h> | ||
| 322 | +#include <linux/power_supply.h> | ||
| 323 | +#include <linux/apm-emulation.h> | ||
| 324 | + | ||
| 325 | +#define PSY_PROP(psy, prop, val) psy->get_property(psy, \ | ||
| 326 | + POWER_SUPPLY_PROP_##prop, val) | ||
| 327 | + | ||
| 328 | +#define _MPSY_PROP(prop, val) main_battery->get_property(main_battery, \ | ||
| 329 | + prop, val) | ||
| 330 | + | ||
| 331 | +#define MPSY_PROP(prop, val) _MPSY_PROP(POWER_SUPPLY_PROP_##prop, val) | ||
| 332 | + | ||
| 333 | +static struct power_supply *main_battery; | ||
| 334 | + | ||
| 335 | +static void find_main_battery(void) | ||
| 336 | +{ | ||
| 337 | + struct device *dev; | ||
| 338 | + struct power_supply *bat, *batm; | ||
| 339 | + union power_supply_propval full; | ||
| 340 | + int max_charge = 0; | ||
| 341 | + | ||
| 342 | + main_battery = NULL; | ||
| 343 | + batm = NULL; | ||
| 344 | + list_for_each_entry(dev, &power_supply_class->devices, node) { | ||
| 345 | + bat = dev_get_drvdata(dev); | ||
| 346 | + /* If none of battery devices cantains 'use_for_apm' flag, | ||
| 347 | + choice one with maximum design charge */ | ||
| 348 | + if (!PSY_PROP(bat, CHARGE_FULL_DESIGN, &full)) { | ||
| 349 | + if (full.intval > max_charge) { | ||
| 350 | + batm = bat; | ||
| 351 | + max_charge = full.intval; | ||
| 352 | + } | ||
| 353 | + } | ||
| 354 | + | ||
| 355 | + if (bat->use_for_apm) | ||
| 356 | + main_battery = bat; | ||
| 357 | + } | ||
| 358 | + if (!main_battery) | ||
| 359 | + main_battery = batm; | ||
| 360 | + | ||
| 361 | + return; | ||
| 362 | +} | ||
| 363 | + | ||
| 364 | +static int calculate_time(int status) | ||
| 365 | +{ | ||
| 366 | + union power_supply_propval charge_full, charge_empty; | ||
| 367 | + union power_supply_propval charge, I; | ||
| 368 | + | ||
| 369 | + if (MPSY_PROP(CHARGE_FULL, &charge_full)) { | ||
| 370 | + /* if battery can't report this property, use design value */ | ||
| 371 | + if (MPSY_PROP(CHARGE_FULL_DESIGN, &charge_full)) | ||
| 372 | + return -1; | ||
| 373 | + } | ||
| 374 | + | ||
| 375 | + if (MPSY_PROP(CHARGE_EMPTY, &charge_empty)) { | ||
| 376 | + /* if battery can't report this property, use design value */ | ||
| 377 | + if (MPSY_PROP(CHARGE_EMPTY_DESIGN, &charge_empty)) | ||
| 378 | + charge_empty.intval = 0; | ||
| 379 | + } | ||
| 380 | + | ||
| 381 | + if (MPSY_PROP(CHARGE_AVG, &charge)) { | ||
| 382 | + /* if battery can't report average value, use momentary */ | ||
| 383 | + if (MPSY_PROP(CHARGE_NOW, &charge)) | ||
| 384 | + return -1; | ||
| 385 | + } | ||
| 386 | + | ||
| 387 | + if (MPSY_PROP(CURRENT_AVG, &I)) { | ||
| 388 | + /* if battery can't report average value, use momentary */ | ||
| 389 | + if (MPSY_PROP(CURRENT_NOW, &I)) | ||
| 390 | + return -1; | ||
| 391 | + } | ||
| 392 | + | ||
| 393 | + if (I.intval == 0) | ||
| 394 | + return 0; | ||
| 395 | + else if (status == POWER_SUPPLY_STATUS_CHARGING) | ||
| 396 | + return ((charge.intval - charge_full.intval) * 60L) / | ||
| 397 | + I.intval; | ||
| 398 | + else | ||
| 399 | + return -((charge.intval - charge_empty.intval) * 60L) / | ||
| 400 | + I.intval; | ||
| 401 | +} | ||
| 402 | + | ||
| 403 | +static int calculate_capacity(int using_charge) | ||
| 404 | +{ | ||
| 405 | + enum power_supply_property full_prop, empty_prop; | ||
| 406 | + enum power_supply_property full_design_prop, empty_design_prop; | ||
| 407 | + enum power_supply_property now_prop, avg_prop; | ||
| 408 | + union power_supply_propval empty, full, cur; | ||
| 409 | + int ret; | ||
| 410 | + | ||
| 411 | + if (using_charge) { | ||
| 412 | + full_prop = POWER_SUPPLY_PROP_CHARGE_FULL; | ||
| 413 | + empty_prop = POWER_SUPPLY_PROP_CHARGE_EMPTY; | ||
| 414 | + full_design_prop = POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN; | ||
| 415 | + empty_design_prop = POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN; | ||
| 416 | + now_prop = POWER_SUPPLY_PROP_CHARGE_NOW; | ||
| 417 | + avg_prop = POWER_SUPPLY_PROP_CHARGE_AVG; | ||
| 418 | + } | ||
| 419 | + else { | ||
| 420 | + full_prop = POWER_SUPPLY_PROP_ENERGY_FULL; | ||
| 421 | + empty_prop = POWER_SUPPLY_PROP_ENERGY_EMPTY; | ||
| 422 | + full_design_prop = POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN; | ||
| 423 | + empty_design_prop = POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN; | ||
| 424 | + now_prop = POWER_SUPPLY_PROP_ENERGY_NOW; | ||
| 425 | + avg_prop = POWER_SUPPLY_PROP_ENERGY_AVG; | ||
| 426 | + } | ||
| 427 | + | ||
| 428 | + if (_MPSY_PROP(full_prop, &full)) { | ||
| 429 | + /* if battery can't report this property, use design value */ | ||
| 430 | + if (_MPSY_PROP(full_design_prop, &full)) | ||
| 431 | + return -1; | ||
| 432 | + } | ||
| 433 | + | ||
| 434 | + if (_MPSY_PROP(avg_prop, &cur)) { | ||
| 435 | + /* if battery can't report average value, use momentary */ | ||
| 436 | + if (_MPSY_PROP(now_prop, &cur)) | ||
| 437 | + return -1; | ||
| 438 | + } | ||
| 439 | + | ||
| 440 | + if (_MPSY_PROP(empty_prop, &empty)) { | ||
| 441 | + /* if battery can't report this property, use design value */ | ||
| 442 | + if (_MPSY_PROP(empty_design_prop, &empty)) | ||
| 443 | + empty.intval = 0; | ||
| 444 | + } | ||
| 445 | + | ||
| 446 | + if (full.intval - empty.intval) | ||
| 447 | + ret = ((cur.intval - empty.intval) * 100L) / | ||
| 448 | + (full.intval - empty.intval); | ||
| 449 | + else | ||
| 450 | + return -1; | ||
| 451 | + | ||
| 452 | + if (ret > 100) | ||
| 453 | + return 100; | ||
| 454 | + else if (ret < 0) | ||
| 455 | + return 0; | ||
| 456 | + | ||
| 457 | + return ret; | ||
| 458 | +} | ||
| 459 | + | ||
| 460 | +static void apm_battery_apm_get_power_status(struct apm_power_info *info) | ||
| 461 | +{ | ||
| 462 | + union power_supply_propval status; | ||
| 463 | + union power_supply_propval capacity, time_to_full, time_to_empty; | ||
| 464 | + | ||
| 465 | + down(&power_supply_class->sem); | ||
| 466 | + find_main_battery(); | ||
| 467 | + if (!main_battery) { | ||
| 468 | + up(&power_supply_class->sem); | ||
| 469 | + return; | ||
| 470 | + } | ||
| 471 | + | ||
| 472 | + /* status */ | ||
| 473 | + | ||
| 474 | + if (MPSY_PROP(STATUS, &status)) | ||
| 475 | + status.intval = POWER_SUPPLY_STATUS_UNKNOWN; | ||
| 476 | + | ||
| 477 | + /* ac line status */ | ||
| 478 | + | ||
| 479 | + if ((status.intval == POWER_SUPPLY_STATUS_CHARGING) || | ||
| 480 | + (status.intval == POWER_SUPPLY_STATUS_NOT_CHARGING) || | ||
| 481 | + (status.intval == POWER_SUPPLY_STATUS_FULL)) | ||
| 482 | + info->ac_line_status = APM_AC_ONLINE; | ||
| 483 | + else | ||
| 484 | + info->ac_line_status = APM_AC_OFFLINE; | ||
| 485 | + | ||
| 486 | + /* battery life (i.e. capacity, in percents) */ | ||
| 487 | + | ||
| 488 | + if (MPSY_PROP(CAPACITY, &capacity) == 0) | ||
| 489 | + info->battery_life = capacity.intval; | ||
| 490 | + else { | ||
| 491 | + /* try calculate using energy */ | ||
| 492 | + info->battery_life = calculate_capacity(0); | ||
| 493 | + /* if failed try calculate using charge instead */ | ||
| 494 | + if (info->battery_life == -1) | ||
| 495 | + info->battery_life = calculate_capacity(1); | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | + /* charging status */ | ||
| 499 | + | ||
| 500 | + if (status.intval == POWER_SUPPLY_STATUS_CHARGING) | ||
| 501 | + info->battery_status = APM_BATTERY_STATUS_CHARGING; | ||
| 502 | + else { | ||
| 503 | + if (info->battery_life > 50) | ||
| 504 | + info->battery_status = APM_BATTERY_STATUS_HIGH; | ||
| 505 | + else if (info->battery_life > 5) | ||
| 506 | + info->battery_status = APM_BATTERY_STATUS_LOW; | ||
| 507 | + else | ||
| 508 | + info->battery_status = APM_BATTERY_STATUS_CRITICAL; | ||
| 509 | + } | ||
| 510 | + info->battery_flag = info->battery_status; | ||
| 511 | + | ||
| 512 | + /* time */ | ||
| 513 | + | ||
| 514 | + info->units = APM_UNITS_MINS; | ||
| 515 | + | ||
| 516 | + if (status.intval == POWER_SUPPLY_STATUS_CHARGING) { | ||
| 517 | + if (MPSY_PROP(TIME_TO_FULL_AVG, &time_to_full)) { | ||
| 518 | + if (MPSY_PROP(TIME_TO_FULL_NOW, &time_to_full)) | ||
| 519 | + info->time = calculate_time(status.intval); | ||
| 520 | + else | ||
| 521 | + info->time = time_to_full.intval / 60; | ||
| 522 | + } | ||
| 523 | + } | ||
| 524 | + else { | ||
| 525 | + if (MPSY_PROP(TIME_TO_EMPTY_AVG, &time_to_empty)) { | ||
| 526 | + if (MPSY_PROP(TIME_TO_EMPTY_NOW, &time_to_empty)) | ||
| 527 | + info->time = calculate_time(status.intval); | ||
| 528 | + else | ||
| 529 | + info->time = time_to_empty.intval / 60; | ||
| 530 | + } | ||
| 531 | + } | ||
| 532 | + | ||
| 533 | + up(&power_supply_class->sem); | ||
| 534 | + return; | ||
| 535 | +} | ||
| 536 | + | ||
| 537 | +static int __init apm_battery_init(void) | ||
| 538 | +{ | ||
| 539 | + printk(KERN_INFO "APM Battery Driver\n"); | ||
| 540 | + | ||
| 541 | + apm_get_power_status = apm_battery_apm_get_power_status; | ||
| 542 | + return 0; | ||
| 543 | +} | ||
| 544 | + | ||
| 545 | +static void __exit apm_battery_exit(void) | ||
| 546 | +{ | ||
| 547 | + apm_get_power_status = NULL; | ||
| 548 | + return; | ||
| 549 | +} | ||
| 550 | + | ||
| 551 | +module_init(apm_battery_init); | ||
| 552 | +module_exit(apm_battery_exit); | ||
| 553 | + | ||
| 554 | +MODULE_AUTHOR("Eugeny Boger <eugenyboger@dgap.mipt.ru>"); | ||
| 555 | +MODULE_DESCRIPTION("APM emulation driver for battery monitoring class"); | ||
| 556 | +MODULE_LICENSE("GPL"); | ||
| 557 | Index: linux-2.6.22/drivers/power/ds2760_battery.c | ||
| 558 | =================================================================== | ||
| 559 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 560 | +++ linux-2.6.22/drivers/power/ds2760_battery.c 2007-08-23 12:13:52.000000000 +0200 | ||
| 561 | @@ -0,0 +1,475 @@ | ||
| 562 | +/* | ||
| 563 | + * Driver for batteries with DS2760 chips inside. | ||
| 564 | + * | ||
| 565 | + * Copyright (c) 2007 Anton Vorontsov | ||
| 566 | + * 2004-2007 Matt Reimer | ||
| 567 | + * 2004 Szabolcs Gyurko | ||
| 568 | + * | ||
| 569 | + * Use consistent with the GNU GPL is permitted, | ||
| 570 | + * provided that this copyright notice is | ||
| 571 | + * preserved in its entirety in all copies and derived works. | ||
| 572 | + * | ||
| 573 | + * Author: Anton Vorontsov <cbou@mail.ru> | ||
| 574 | + * February 2007 | ||
| 575 | + * | ||
| 576 | + * Matt Reimer <mreimer@vpop.net> | ||
| 577 | + * April 2004, 2005, 2007 | ||
| 578 | + * | ||
| 579 | + * Szabolcs Gyurko <szabolcs.gyurko@tlt.hu> | ||
| 580 | + * September 2004 | ||
| 581 | + */ | ||
| 582 | + | ||
| 583 | +#include <linux/module.h> | ||
| 584 | +#include <linux/param.h> | ||
| 585 | +#include <linux/jiffies.h> | ||
| 586 | +#include <linux/workqueue.h> | ||
| 587 | +#include <linux/pm.h> | ||
| 588 | +#include <linux/platform_device.h> | ||
| 589 | +#include <linux/power_supply.h> | ||
| 590 | + | ||
| 591 | +#include "../w1/w1.h" | ||
| 592 | +#include "../w1/slaves/w1_ds2760.h" | ||
| 593 | + | ||
| 594 | +struct ds2760_device_info { | ||
| 595 | + struct device *dev; | ||
| 596 | + | ||
| 597 | + /* DS2760 data, valid after calling ds2760_battery_read_status() */ | ||
| 598 | + unsigned long update_time; /* jiffies when data read */ | ||
| 599 | + char raw[DS2760_DATA_SIZE]; /* raw DS2760 data */ | ||
| 600 | + int voltage_raw; /* units of 4.88 mV */ | ||
| 601 | + int voltage_uV; /* units of uV */ | ||
| 602 | + int current_raw; /* units of 0.625 mA */ | ||
| 603 | + int current_uA; /* units of uA */ | ||
| 604 | + int accum_current_raw; /* units of 0.25 mAh */ | ||
| 605 | + int accum_current_uAh; /* units of uAh */ | ||
| 606 | + int temp_raw; /* units of 0.125 C */ | ||
| 607 | + int temp_C; /* units of 0.1 C */ | ||
| 608 | + int rated_capacity; /* units of uAh */ | ||
| 609 | + int rem_capacity; /* percentage */ | ||
| 610 | + int full_active_uAh; /* units of uAh */ | ||
| 611 | + int empty_uAh; /* units of uAh */ | ||
| 612 | + int life_sec; /* units of seconds */ | ||
| 613 | + int charge_status; /* POWER_SUPPLY_STATUS_* */ | ||
| 614 | + | ||
| 615 | + int full_counter; | ||
| 616 | + struct power_supply bat; | ||
| 617 | + struct device *w1_dev; | ||
| 618 | + struct workqueue_struct *monitor_wqueue; | ||
| 619 | + struct delayed_work monitor_work; | ||
| 620 | +}; | ||
| 621 | + | ||
| 622 | +static unsigned int cache_time = 1000; | ||
| 623 | +module_param(cache_time, uint, 0644); | ||
| 624 | +MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); | ||
| 625 | + | ||
| 626 | +/* Some batteries have their rated capacity stored a N * 10 mAh, while | ||
| 627 | + * others use an index into this table. */ | ||
| 628 | +static int rated_capacities[] = { | ||
| 629 | + 0, | ||
| 630 | + 920, /* Samsung */ | ||
| 631 | + 920, /* BYD */ | ||
| 632 | + 920, /* Lishen */ | ||
| 633 | + 920, /* NEC */ | ||
| 634 | + 1440, /* Samsung */ | ||
| 635 | + 1440, /* BYD */ | ||
| 636 | + 1440, /* Lishen */ | ||
| 637 | + 1440, /* NEC */ | ||
| 638 | + 2880, /* Samsung */ | ||
| 639 | + 2880, /* BYD */ | ||
| 640 | + 2880, /* Lishen */ | ||
| 641 | + 2880 /* NEC */ | ||
| 642 | +}; | ||
| 643 | + | ||
| 644 | +/* array is level at temps 0C, 10C, 20C, 30C, 40C | ||
| 645 | + * temp is in Celsius */ | ||
| 646 | +static int battery_interpolate(int array[], int temp) | ||
| 647 | +{ | ||
| 648 | + int index, dt; | ||
| 649 | + | ||
| 650 | + if (temp <= 0) | ||
| 651 | + return array[0]; | ||
| 652 | + if (temp >= 40) | ||
| 653 | + return array[4]; | ||
| 654 | + | ||
| 655 | + index = temp / 10; | ||
| 656 | + dt = temp % 10; | ||
| 657 | + | ||
| 658 | + return array[index] + (((array[index + 1] - array[index]) * dt) / 10); | ||
| 659 | +} | ||
| 660 | + | ||
| 661 | +static int ds2760_battery_read_status(struct ds2760_device_info *di) | ||
| 662 | +{ | ||
| 663 | + int ret, i, start, count, scale[5]; | ||
| 664 | + | ||
| 665 | + if (di->update_time && time_before(jiffies, di->update_time + | ||
| 666 | + msecs_to_jiffies(cache_time))) | ||
| 667 | + return 0; | ||
| 668 | + | ||
| 669 | + /* The first time we read the entire contents of SRAM/EEPROM, | ||
| 670 | + * but after that we just read the interesting bits that change. */ | ||
| 671 | + if (di->update_time == 0) { | ||
| 672 | + start = 0; | ||
| 673 | + count = DS2760_DATA_SIZE; | ||
| 674 | + } | ||
| 675 | + else { | ||
| 676 | + start = DS2760_VOLTAGE_MSB; | ||
| 677 | + count = DS2760_TEMP_LSB - start + 1; | ||
| 678 | + } | ||
| 679 | + | ||
| 680 | + ret = w1_ds2760_read(di->w1_dev, di->raw + start, start, count); | ||
| 681 | + if (ret != count) { | ||
| 682 | + dev_warn(di->dev, "call to w1_ds2760_read failed (0x%p)\n", | ||
| 683 | + di->w1_dev); | ||
| 684 | + return 1; | ||
| 685 | + } | ||
| 686 | + | ||
| 687 | + di->update_time = jiffies; | ||
| 688 | + | ||
| 689 | + /* DS2760 reports voltage in units of 4.88mV, but the battery class | ||
| 690 | + * reports in units of uV, so convert by multiplying by 4880. */ | ||
| 691 | + di->voltage_raw = (di->raw[DS2760_VOLTAGE_MSB] << 3) | | ||
| 692 | + (di->raw[DS2760_VOLTAGE_LSB] >> 5); | ||
| 693 | + di->voltage_uV = di->voltage_raw * 4880; | ||
| 694 | + | ||
| 695 | + /* DS2760 reports current in signed units of 0.625mA, but the battery | ||
| 696 | + * class reports in units of uA, so convert by multiplying by 625. */ | ||
| 697 | + di->current_raw = | ||
| 698 | + (((signed char)di->raw[DS2760_CURRENT_MSB]) << 5) | | ||
| 699 | + (di->raw[DS2760_CURRENT_LSB] >> 3); | ||
| 700 | + di->current_uA = di->current_raw * 625; | ||
| 701 | + | ||
| 702 | + /* DS2760 reports accumulated current in signed units of 0.25mAh. */ | ||
| 703 | + di->accum_current_raw = | ||
| 704 | + (((signed char)di->raw[DS2760_CURRENT_ACCUM_MSB]) << 8) | | ||
| 705 | + di->raw[DS2760_CURRENT_ACCUM_LSB]; | ||
| 706 | + di->accum_current_uAh = di->accum_current_raw * 250; | ||
| 707 | + | ||
| 708 | + /* DS2760 reports temperature in signed units of 0.125C, but the | ||
| 709 | + * battery class reports in units of 1/10 C, so we convert by | ||
| 710 | + * multiplying by .125 * 10 = 1.25. */ | ||
| 711 | + di->temp_raw = (((signed char)di->raw[DS2760_TEMP_MSB]) << 3) | | ||
| 712 | + (di->raw[DS2760_TEMP_LSB] >> 5); | ||
| 713 | + di->temp_C = di->temp_raw + (di->temp_raw / 4); | ||
| 714 | + | ||
| 715 | + /* At least some battery monitors (e.g. HP iPAQ) store the battery's | ||
| 716 | + * maximum rated capacity. */ | ||
| 717 | + if (di->raw[DS2760_RATED_CAPACITY] < ARRAY_SIZE(rated_capacities)) | ||
| 718 | + di->rated_capacity = rated_capacities[ | ||
| 719 | + (unsigned int)di->raw[DS2760_RATED_CAPACITY]]; | ||
| 720 | + else | ||
| 721 | + di->rated_capacity = di->raw[DS2760_RATED_CAPACITY] * 10; | ||
| 722 | + | ||
| 723 | + di->rated_capacity *= 1000; /* convert to uAh */ | ||
| 724 | + | ||
| 725 | + /* Calculate the full level at the present temperature. */ | ||
| 726 | + di->full_active_uAh = di->raw[DS2760_ACTIVE_FULL] << 8 | | ||
| 727 | + di->raw[DS2760_ACTIVE_FULL + 1]; | ||
| 728 | + | ||
| 729 | + scale[0] = di->raw[DS2760_ACTIVE_FULL] << 8 | | ||
| 730 | + di->raw[DS2760_ACTIVE_FULL + 1]; | ||
| 731 | + for (i = 1; i < 5; i++) | ||
| 732 | + scale[i] = scale[i - 1] + di->raw[DS2760_ACTIVE_FULL + 2 + i]; | ||
| 733 | + | ||
| 734 | + di->full_active_uAh = battery_interpolate(scale, di->temp_C / 10); | ||
| 735 | + di->full_active_uAh *= 1000; /* convert to uAh */ | ||
| 736 | + | ||
| 737 | + /* Calculate the empty level at the present temperature. */ | ||
| 738 | + scale[4] = di->raw[DS2760_ACTIVE_EMPTY + 4]; | ||
| 739 | + for (i = 3; i >= 0; i--) | ||
| 740 | + scale[i] = scale[i + 1] + di->raw[DS2760_ACTIVE_EMPTY + i]; | ||
| 741 | + | ||
| 742 | + di->empty_uAh = battery_interpolate(scale, di->temp_C / 10); | ||
| 743 | + di->empty_uAh *= 1000; /* convert to uAh */ | ||
| 744 | + | ||
| 745 | + /* From Maxim Application Note 131: remaining capacity = | ||
| 746 | + * ((ICA - Empty Value) / (Full Value - Empty Value)) x 100% */ | ||
| 747 | + di->rem_capacity = ((di->accum_current_uAh - di->empty_uAh) * 100L) / | ||
| 748 | + (di->full_active_uAh - di->empty_uAh); | ||
| 749 | + | ||
| 750 | + if (di->rem_capacity < 0) | ||
| 751 | + di->rem_capacity = 0; | ||
| 752 | + if (di->rem_capacity > 100) | ||
| 753 | + di->rem_capacity = 100; | ||
| 754 | + | ||
| 755 | + if (di->current_uA) | ||
| 756 | + di->life_sec = -((di->accum_current_uAh - di->empty_uAh) * | ||
| 757 | + 3600L) / di->current_uA; | ||
| 758 | + else | ||
| 759 | + di->life_sec = 0; | ||
| 760 | + | ||
| 761 | + return 0; | ||
| 762 | +} | ||
| 763 | + | ||
| 764 | +static void ds2760_battery_update_status(struct ds2760_device_info *di) | ||
| 765 | +{ | ||
| 766 | + int old_charge_status = di->charge_status; | ||
| 767 | + | ||
| 768 | + ds2760_battery_read_status(di); | ||
| 769 | + | ||
| 770 | + if (di->charge_status == POWER_SUPPLY_STATUS_UNKNOWN) | ||
| 771 | + di->full_counter = 0; | ||
| 772 | + | ||
| 773 | + if (power_supply_am_i_supplied(&di->bat)) { | ||
| 774 | + if (di->current_uA > 10000) { | ||
| 775 | + di->charge_status = POWER_SUPPLY_STATUS_CHARGING; | ||
| 776 | + di->full_counter = 0; | ||
| 777 | + } | ||
| 778 | + else if (di->current_uA < -5000) { | ||
| 779 | + if (di->charge_status != POWER_SUPPLY_STATUS_NOT_CHARGING) | ||
| 780 | + dev_notice(di->dev, "not enough power to " | ||
| 781 | + "charge\n"); | ||
| 782 | + di->charge_status = POWER_SUPPLY_STATUS_NOT_CHARGING; | ||
| 783 | + di->full_counter = 0; | ||
| 784 | + } | ||
| 785 | + else if (di->current_uA < 10000 && | ||
| 786 | + di->charge_status != POWER_SUPPLY_STATUS_FULL) { | ||
| 787 | + | ||
| 788 | + /* Don't consider the battery to be full unless | ||
| 789 | + * we've seen the current < 10 mA at least two | ||
| 790 | + * consecutive times. */ | ||
| 791 | + | ||
| 792 | + di->full_counter++; | ||
| 793 | + | ||
| 794 | + if (di->full_counter < 2) | ||
| 795 | + di->charge_status = POWER_SUPPLY_STATUS_CHARGING; | ||
| 796 | + else { | ||
| 797 | + unsigned char acr[2]; | ||
| 798 | + int acr_val; | ||
| 799 | + | ||
| 800 | + /* acr is in units of 0.25 mAh */ | ||
| 801 | + acr_val = di->full_active_uAh * 4L / 1000; | ||
| 802 | + | ||
| 803 | + acr[0] = acr_val >> 8; | ||
| 804 | + acr[1] = acr_val & 0xff; | ||
| 805 | + | ||
| 806 | + if (w1_ds2760_write(di->w1_dev, acr, | ||
| 807 | + DS2760_CURRENT_ACCUM_MSB, 2) < 2) | ||
| 808 | + dev_warn(di->dev, | ||
| 809 | + "ACR reset failed\n"); | ||
| 810 | + | ||
| 811 | + di->charge_status = POWER_SUPPLY_STATUS_FULL; | ||
| 812 | + } | ||
| 813 | + } | ||
| 814 | + } | ||
| 815 | + else { | ||
| 816 | + di->charge_status = POWER_SUPPLY_STATUS_DISCHARGING; | ||
| 817 | + di->full_counter = 0; | ||
| 818 | + } | ||
| 819 | + | ||
| 820 | + if (di->charge_status != old_charge_status) | ||
| 821 | + power_supply_changed(&di->bat); | ||
| 822 | + | ||
| 823 | + return; | ||
| 824 | +} | ||
| 825 | + | ||
| 826 | +static void ds2760_battery_work(struct work_struct *work) | ||
| 827 | +{ | ||
| 828 | + struct ds2760_device_info *di = container_of(work, | ||
| 829 | + struct ds2760_device_info, monitor_work.work); | ||
| 830 | + const int interval = HZ * 60; | ||
| 831 | + | ||
| 832 | + dev_dbg(di->dev, "%s\n", __FUNCTION__); | ||
| 833 | + | ||
| 834 | + ds2760_battery_update_status(di); | ||
| 835 | + queue_delayed_work(di->monitor_wqueue, &di->monitor_work, interval); | ||
| 836 | + | ||
| 837 | + return; | ||
| 838 | +} | ||
| 839 | + | ||
| 840 | +#define to_ds2760_device_info(x) container_of((x), struct ds2760_device_info, \ | ||
| 841 | + bat); | ||
| 842 | + | ||
| 843 | +static void ds2760_battery_external_power_changed(struct power_supply *psy) | ||
| 844 | +{ | ||
| 845 | + struct ds2760_device_info *di = to_ds2760_device_info(psy); | ||
| 846 | + | ||
| 847 | + dev_dbg(di->dev, "%s\n", __FUNCTION__); | ||
| 848 | + | ||
| 849 | + cancel_delayed_work(&di->monitor_work); | ||
| 850 | + queue_delayed_work(di->monitor_wqueue, &di->monitor_work, HZ/10); | ||
| 851 | + | ||
| 852 | + return; | ||
| 853 | +} | ||
| 854 | + | ||
| 855 | +static int ds2760_battery_get_property(struct power_supply *psy, | ||
| 856 | + enum power_supply_property psp, | ||
| 857 | + union power_supply_propval *val) | ||
| 858 | +{ | ||
| 859 | + struct ds2760_device_info *di = to_ds2760_device_info(psy); | ||
| 860 | + | ||
| 861 | + switch (psp) { | ||
| 862 | + case POWER_SUPPLY_PROP_STATUS: | ||
| 863 | + val->intval = di->charge_status; | ||
| 864 | + return 0; | ||
| 865 | + default: | ||
| 866 | + break; | ||
| 867 | + } | ||
| 868 | + | ||
| 869 | + ds2760_battery_read_status(di); | ||
| 870 | + | ||
| 871 | + switch (psp) { | ||
| 872 | + case POWER_SUPPLY_PROP_VOLTAGE_NOW: | ||
| 873 | + val->intval = di->voltage_uV; | ||
| 874 | + break; | ||
| 875 | + case POWER_SUPPLY_PROP_CURRENT_NOW: | ||
| 876 | + val->intval = di->current_uA; | ||
| 877 | + break; | ||
| 878 | + case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: | ||
| 879 | + val->intval = di->rated_capacity; | ||
| 880 | + break; | ||
| 881 | + case POWER_SUPPLY_PROP_CHARGE_FULL: | ||
| 882 | + val->intval = di->full_active_uAh; | ||
| 883 | + break; | ||
| 884 | + case POWER_SUPPLY_PROP_CHARGE_EMPTY: | ||
| 885 | + val->intval = di->empty_uAh; | ||
| 886 | + break; | ||
| 887 | + case POWER_SUPPLY_PROP_CHARGE_NOW: | ||
| 888 | + val->intval = di->accum_current_uAh; | ||
| 889 | + break; | ||
| 890 | + case POWER_SUPPLY_PROP_TEMP: | ||
| 891 | + val->intval = di->temp_C; | ||
| 892 | + break; | ||
| 893 | + default: | ||
| 894 | + return -EINVAL; | ||
| 895 | + } | ||
| 896 | + | ||
| 897 | + return 0; | ||
| 898 | +} | ||
| 899 | + | ||
| 900 | +static enum power_supply_property ds2760_battery_props[] = { | ||
| 901 | + POWER_SUPPLY_PROP_STATUS, | ||
| 902 | + POWER_SUPPLY_PROP_VOLTAGE_NOW, | ||
| 903 | + POWER_SUPPLY_PROP_CURRENT_NOW, | ||
| 904 | + POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, | ||
| 905 | + POWER_SUPPLY_PROP_CHARGE_FULL, | ||
| 906 | + POWER_SUPPLY_PROP_CHARGE_EMPTY, | ||
| 907 | + POWER_SUPPLY_PROP_CHARGE_NOW, | ||
| 908 | + POWER_SUPPLY_PROP_TEMP, | ||
| 909 | +}; | ||
| 910 | + | ||
| 911 | +static int ds2760_battery_probe(struct platform_device *pdev) | ||
| 912 | +{ | ||
| 913 | + int retval = 0; | ||
| 914 | + struct ds2760_device_info *di; | ||
| 915 | + struct ds2760_platform_data *pdata; | ||
| 916 | + | ||
| 917 | + di = kzalloc(sizeof(*di), GFP_KERNEL); | ||
| 918 | + if (!di) { | ||
| 919 | + retval = -ENOMEM; | ||
| 920 | + goto di_alloc_failed; | ||
| 921 | + } | ||
| 922 | + | ||
| 923 | + platform_set_drvdata(pdev, di); | ||
| 924 | + | ||
| 925 | + pdata = pdev->dev.platform_data; | ||
| 926 | + di->dev = &pdev->dev; | ||
| 927 | + di->w1_dev = pdev->dev.parent; | ||
| 928 | + di->bat.name = pdev->dev.bus_id; | ||
| 929 | + di->bat.type = POWER_SUPPLY_TYPE_BATTERY; | ||
| 930 | + di->bat.properties = ds2760_battery_props; | ||
| 931 | + di->bat.num_properties = ARRAY_SIZE(ds2760_battery_props); | ||
| 932 | + di->bat.get_property = ds2760_battery_get_property; | ||
| 933 | + di->bat.external_power_changed = | ||
| 934 | + ds2760_battery_external_power_changed; | ||
| 935 | + di->bat.use_for_apm = 1; | ||
| 936 | + | ||
| 937 | + di->charge_status = POWER_SUPPLY_STATUS_UNKNOWN; | ||
| 938 | + | ||
| 939 | + retval = power_supply_register(&pdev->dev, &di->bat); | ||
| 940 | + if (retval) { | ||
| 941 | + dev_err(di->dev, "failed to register battery"); | ||
| 942 | + goto batt_failed; | ||
| 943 | + } | ||
| 944 | + | ||
| 945 | + INIT_DELAYED_WORK(&di->monitor_work, ds2760_battery_work); | ||
| 946 | + di->monitor_wqueue = create_singlethread_workqueue(pdev->dev.bus_id); | ||
| 947 | + if (!di->monitor_wqueue) { | ||
| 948 | + retval = -ESRCH; | ||
| 949 | + goto workqueue_failed; | ||
| 950 | + } | ||
| 951 | + queue_delayed_work(di->monitor_wqueue, &di->monitor_work, HZ * 1); | ||
| 952 | + | ||
| 953 | + goto success; | ||
| 954 | + | ||
| 955 | +workqueue_failed: | ||
| 956 | + power_supply_unregister(&di->bat); | ||
| 957 | +batt_failed: | ||
| 958 | + kfree(di); | ||
| 959 | +di_alloc_failed: | ||
| 960 | +success: | ||
| 961 | + return retval; | ||
| 962 | +} | ||
| 963 | + | ||
| 964 | +static int ds2760_battery_remove(struct platform_device *pdev) | ||
| 965 | +{ | ||
| 966 | + struct ds2760_device_info *di = platform_get_drvdata(pdev); | ||
| 967 | + | ||
| 968 | + cancel_rearming_delayed_workqueue(di->monitor_wqueue, | ||
| 969 | + &di->monitor_work); | ||
| 970 | + destroy_workqueue(di->monitor_wqueue); | ||
| 971 | + power_supply_unregister(&di->bat); | ||
| 972 | + | ||
| 973 | + return 0; | ||
| 974 | +} | ||
| 975 | + | ||
| 976 | +#ifdef CONFIG_PM | ||
| 977 | + | ||
| 978 | +static int ds2760_battery_suspend(struct platform_device *pdev, | ||
| 979 | + pm_message_t state) | ||
| 980 | +{ | ||
| 981 | + struct ds2760_device_info *di = platform_get_drvdata(pdev); | ||
| 982 | + | ||
| 983 | + di->charge_status = POWER_SUPPLY_STATUS_UNKNOWN; | ||
| 984 | + | ||
| 985 | + return 0; | ||
| 986 | +} | ||
| 987 | + | ||
| 988 | +static int ds2760_battery_resume(struct platform_device *pdev) | ||
| 989 | +{ | ||
| 990 | + struct ds2760_device_info *di = platform_get_drvdata(pdev); | ||
| 991 | + | ||
| 992 | + di->charge_status = POWER_SUPPLY_STATUS_UNKNOWN; | ||
| 993 | + power_supply_changed(&di->bat); | ||
| 994 | + | ||
| 995 | + cancel_delayed_work(&di->monitor_work); | ||
| 996 | + queue_delayed_work(di->monitor_wqueue, &di->monitor_work, HZ); | ||
| 997 | + | ||
| 998 | + return 0; | ||
| 999 | +} | ||
| 1000 | + | ||
| 1001 | +#else | ||
| 1002 | + | ||
| 1003 | +#define ds2760_battery_suspend NULL | ||
| 1004 | +#define ds2760_battery_resume NULL | ||
| 1005 | + | ||
| 1006 | +#endif /* CONFIG_PM */ | ||
| 1007 | + | ||
| 1008 | +static struct platform_driver ds2760_battery_driver = { | ||
| 1009 | + .driver = { | ||
| 1010 | + .name = "ds2760-battery", | ||
| 1011 | + }, | ||
| 1012 | + .probe = ds2760_battery_probe, | ||
| 1013 | + .remove = ds2760_battery_remove, | ||
| 1014 | + .suspend = ds2760_battery_suspend, | ||
| 1015 | + .resume = ds2760_battery_resume, | ||
| 1016 | +}; | ||
| 1017 | + | ||
| 1018 | +static int __init ds2760_battery_init(void) | ||
| 1019 | +{ | ||
| 1020 | + return platform_driver_register(&ds2760_battery_driver); | ||
| 1021 | +} | ||
| 1022 | + | ||
| 1023 | +static void __exit ds2760_battery_exit(void) | ||
| 1024 | +{ | ||
| 1025 | + platform_driver_unregister(&ds2760_battery_driver); | ||
| 1026 | + return; | ||
| 1027 | +} | ||
| 1028 | + | ||
| 1029 | +module_init(ds2760_battery_init); | ||
| 1030 | +module_exit(ds2760_battery_exit); | ||
| 1031 | + | ||
| 1032 | +MODULE_LICENSE("GPL"); | ||
| 1033 | +MODULE_AUTHOR("Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>, " | ||
| 1034 | + "Matt Reimer <mreimer@vpop.net>, " | ||
| 1035 | + "Anton Vorontsov <cbou@mail.ru>"); | ||
| 1036 | +MODULE_DESCRIPTION("ds2760 battery driver"); | ||
| 1037 | Index: linux-2.6.22/drivers/power/Kconfig | ||
| 1038 | =================================================================== | ||
| 1039 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 1040 | +++ linux-2.6.22/drivers/power/Kconfig 2007-08-23 12:13:52.000000000 +0200 | ||
| 1041 | @@ -0,0 +1,70 @@ | ||
| 1042 | +menuconfig POWER_SUPPLY | ||
| 1043 | + tristate "Power supply class support" | ||
| 1044 | + help | ||
| 1045 | + Say Y here to enable power supply class support. This allows | ||
| 1046 | + power supply (batteries, AC, USB) monitoring by userspace | ||
| 1047 | + via sysfs and uevent (if available) and/or APM kernel interface | ||
| 1048 | + (if selected below). | ||
| 1049 | + | ||
| 1050 | +if POWER_SUPPLY | ||
| 1051 | + | ||
| 1052 | +config POWER_SUPPLY_DEBUG | ||
| 1053 | + bool "Power supply debug" | ||
| 1054 | + help | ||
| 1055 | + Say Y here to enable debugging messages for power supply class | ||
| 1056 | + and drivers. | ||
| 1057 | + | ||
| 1058 | +config PDA_POWER | ||
| 1059 | + tristate "Generic PDA/phone power driver" | ||
| 1060 | + help | ||
| 1061 | + Say Y here to enable generic power driver for PDAs and phones with | ||
| 1062 | + one or two external power supplies (AC/USB) connected to main and | ||
| 1063 | + backup batteries, and optional builtin charger. | ||
| 1064 | + | ||
| 1065 | +config APM_POWER | ||
| 1066 | + tristate "APM emulation for class batteries" | ||
| 1067 | + depends on APM_EMULATION | ||
| 1068 | + help | ||
| 1069 | + Say Y here to enable support APM status emulation using | ||
| 1070 | + battery class devices. | ||
| 1071 | + | ||
| 1072 | +config BATTERY_DS2760 | ||
| 1073 | + tristate "DS2760 battery driver (HP iPAQ & others)" | ||
| 1074 | + select W1 | ||
| 1075 | + select W1_SLAVE_DS2760 | ||
| 1076 | + help | ||
| 1077 | + Say Y here to enable support for batteries with ds2760 chip. | ||
| 1078 | + | ||
| 1079 | +config BATTERY_PMU | ||
| 1080 | + tristate "Apple PMU battery" | ||
| 1081 | + depends on ADB_PMU | ||
| 1082 | + help | ||
| 1083 | + Say Y here to expose battery information on Apple machines | ||
| 1084 | + through the generic battery class. | ||
| 1085 | + | ||
| 1086 | +config BATTERY_OLPC | ||
| 1087 | + tristate "One Laptop Per Child battery" | ||
| 1088 | + depends on X86_32 | ||
| 1089 | + help | ||
| 1090 | + Say Y to enable support for the battery on the OLPC laptop. | ||
| 1091 | + | ||
| 1092 | +# drivers below are not in battery2-2.6 tree | ||
| 1093 | + | ||
| 1094 | +config ADC_BATTERY | ||
| 1095 | + tristate "Generic ADC battery driver" | ||
| 1096 | + depends on ADC && POWER_SUPPLY | ||
| 1097 | + help | ||
| 1098 | + Say Y here to enable support for battery monitoring using generic ADC device. | ||
| 1099 | + | ||
| 1100 | +config IPAQ_MICRO_BATTERY | ||
| 1101 | + tristate "HP iPAQ Micro ASIC battery driver" | ||
| 1102 | + depends on IPAQ_MICRO && POWER_SUPPLY | ||
| 1103 | + help | ||
| 1104 | + Choose this option if you want to monitor battery status on | ||
| 1105 | + Compaq/HP iPAQ h3100 h3600 | ||
| 1106 | + | ||
| 1107 | +config MCP_UCB1x00_SIMPAD_BATTERY | ||
| 1108 | + tristate "SIMpad Battery Reading Support" | ||
| 1109 | + depends on MCP_UCB1x00 && POWER_SUPPLY | ||
| 1110 | + | ||
| 1111 | +endif # POWER_SUPPLY | ||
| 1112 | Index: linux-2.6.22/drivers/power/Makefile | ||
| 1113 | =================================================================== | ||
| 1114 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 1115 | +++ linux-2.6.22/drivers/power/Makefile 2007-08-23 12:13:52.000000000 +0200 | ||
| 1116 | @@ -0,0 +1,28 @@ | ||
| 1117 | +power_supply-objs := power_supply_core.o | ||
| 1118 | + | ||
| 1119 | +ifeq ($(CONFIG_SYSFS),y) | ||
| 1120 | +power_supply-objs += power_supply_sysfs.o | ||
| 1121 | +endif | ||
| 1122 | + | ||
| 1123 | +ifeq ($(CONFIG_LEDS_TRIGGERS),y) | ||
| 1124 | +power_supply-objs += power_supply_leds.o | ||
| 1125 | +endif | ||
| 1126 | + | ||
| 1127 | +ifeq ($(CONFIG_POWER_SUPPLY_DEBUG),y) | ||
| 1128 | +EXTRA_CFLAGS += -DDEBUG | ||
| 1129 | +endif | ||
| 1130 | + | ||
| 1131 | +obj-$(CONFIG_POWER_SUPPLY) += power_supply.o | ||
| 1132 | + | ||
| 1133 | +obj-$(CONFIG_PDA_POWER) += pda_power.o | ||
| 1134 | +obj-$(CONFIG_APM_POWER) += apm_power.o | ||
| 1135 | + | ||
| 1136 | +obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o | ||
| 1137 | +obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o | ||
| 1138 | +obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o | ||
| 1139 | + | ||
| 1140 | +# drivers below are not in battery2-2.6 tree | ||
| 1141 | + | ||
| 1142 | +obj-$(CONFIG_ADC_BATTERY) += adc_battery.o | ||
| 1143 | +obj-$(CONFIG_IPAQ_MICRO_BATTERY) += micro_battery.o | ||
| 1144 | +obj-$(CONFIG_MCP_UCB1x00_SIMPAD_BATTERY) += simpad-battery.o | ||
| 1145 | Index: linux-2.6.22/drivers/power/micro_battery.c | ||
| 1146 | =================================================================== | ||
| 1147 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 1148 | +++ linux-2.6.22/drivers/power/micro_battery.c 2007-08-23 12:25:20.000000000 +0200 | ||
| 1149 | @@ -0,0 +1,257 @@ | ||
| 1150 | +/* | ||
| 1151 | + * This program is free software; you can redistribute it and/or modify | ||
| 1152 | + * it under the terms of the GNU General Public License version 2 as | ||
| 1153 | + * published by the Free Software Foundation. | ||
| 1154 | + * | ||
| 1155 | + * h3600 atmel micro companion support, battery subdevice | ||
| 1156 | + * based on previous kernel 2.4 version | ||
| 1157 | + * Author : Alessandro Gardich <gremlin@gremlin.it> | ||
| 1158 | + * | ||
| 1159 | + */ | ||
| 1160 | + | ||
| 1161 | + | ||
| 1162 | +#include <linux/module.h> | ||
| 1163 | +#include <linux/version.h> | ||
| 1164 | + | ||
| 1165 | +#include <linux/init.h> | ||
| 1166 | +#include <linux/fs.h> | ||
| 1167 | +#include <linux/interrupt.h> | ||
| 1168 | +#include <linux/sched.h> | ||
| 1169 | +#include <linux/pm.h> | ||
| 1170 | +#include <linux/sysctl.h> | ||
| 1171 | +#include <linux/proc_fs.h> | ||
| 1172 | +#include <linux/delay.h> | ||
| 1173 | +#include <linux/device.h> | ||
| 1174 | +#include <linux/power_supply.h> | ||
| 1175 | +#include <linux/platform_device.h> | ||
| 1176 | +#include <linux/timer.h> | ||
| 1177 | + | ||
| 1178 | +#include <asm/arch/hardware.h> | ||
| 1179 | + | ||
| 1180 | +#include <asm/arch/h3600.h> | ||
| 1181 | +#include <asm/arch/SA-1100.h> | ||
| 1182 | + | ||
| 1183 | +#include <asm/hardware/micro.h> | ||
| 1184 | + | ||
| 1185 | +#define BATT_PERIOD 10*HZ | ||
| 1186 | + | ||
| 1187 | +#define H3600_BATT_STATUS_HIGH 0x01 | ||
| 1188 | +#define H3600_BATT_STATUS_LOW 0x02 | ||
| 1189 | +#define H3600_BATT_STATUS_CRITICAL 0x04 | ||
| 1190 | +#define H3600_BATT_STATUS_CHARGING 0x08 | ||
| 1191 | +#define H3600_BATT_STATUS_CHARGEMAIN 0x10 | ||
| 1192 | +#define H3600_BATT_STATUS_DEAD 0x20 /* Battery will not charge */ | ||
| 1193 | +#define H3600_BATT_STATUS_NOTINSTALLED 0x20 /* For expansion pack batteries */ | ||
| 1194 | +#define H3600_BATT_STATUS_FULL 0x40 /* Battery fully charged (and connected to AC) */ | ||
| 1195 | +#define H3600_BATT_STATUS_NOBATTERY 0x80 | ||
| 1196 | +#define H3600_BATT_STATUS_UNKNOWN 0xff | ||
| 1197 | + | ||
| 1198 | + | ||
| 1199 | +//static struct power_supply_dev *micro_battery; | ||
| 1200 | + | ||
| 1201 | +static micro_private_t *p_micro; | ||
| 1202 | + | ||
| 1203 | +struct timer_list batt_timer; | ||
| 1204 | + | ||
| 1205 | +struct { | ||
| 1206 | + int ac; | ||
| 1207 | + int update_time; | ||
| 1208 | + int chemistry; | ||
| 1209 | + int voltage; | ||
| 1210 | + int temperature; | ||
| 1211 | + int flag; | ||
| 1212 | +} micro_battery; | ||
| 1213 | + | ||
| 1214 | +static void micro_battery_receive (int len, unsigned char *data) { | ||
| 1215 | + if (0) { | ||
| 1216 | + printk(KERN_ERR "h3600_battery - AC = %02x\n", data[0]); | ||
| 1217 | + printk(KERN_ERR "h3600_battery - BAT1 chemistry = %02x\n", data[1]); | ||
| 1218 | + printk(KERN_ERR "h3600_battery - BAT1 voltage = %d %02x%02x\n", (data[3]<<8)+data[2], data[2], data[3]); | ||
| 1219 | + printk(KERN_ERR "h3600_battery - BAT1 status = %02x\n", data[4]); | ||
| 1220 | + } | ||
| 1221 | + | ||
| 1222 | + micro_battery.ac = data[0]; | ||
| 1223 | + micro_battery.chemistry = data[1]; | ||
| 1224 | + micro_battery.voltage = ((((unsigned short)data[3]<<8)+data[2]) * 5000L ) * 1000 / 1024; | ||
| 1225 | + micro_battery.flag = data[4]; | ||
| 1226 | + | ||
| 1227 | + if (len == 9) { | ||
| 1228 | + if (0) { | ||
| 1229 | + printk(KERN_ERR "h3600_battery - BAT2 chemistry = %02x\n", data[5]); | ||
| 1230 | + printk(KERN_ERR "h3600_battery - BAT2 voltage = %d %02x%02x\n", (data[7]<<8)+data[6], data[6], data[7]); | ||
| 1231 | + printk(KERN_ERR "h3600_battery - BAT2 status = %02x\n", data[8]); | ||
| 1232 | + } | ||
| 1233 | + } | ||
| 1234 | +} | ||
| 1235 | + | ||
| 1236 | +static void micro_temperature_receive (int len, unsigned char *data) { | ||
| 1237 | + micro_battery.temperature = ((unsigned short)data[1]<<8)+data[0]; | ||
| 1238 | +} | ||
| 1239 | + | ||
| 1240 | +void h3600_battery_read_status(unsigned long data) { | ||
| 1241 | + | ||
| 1242 | + if (++data % 2) | ||
| 1243 | + h3600_micro_tx_msg(0x09,0,NULL); | ||
| 1244 | + else | ||
| 1245 | + h3600_micro_tx_msg(0x06,0,NULL); | ||
| 1246 | + | ||
| 1247 | + batt_timer.expires += BATT_PERIOD; | ||
| 1248 | + batt_timer.data = data; | ||
| 1249 | + | ||
| 1250 | + add_timer(&batt_timer); | ||
| 1251 | +} | ||
| 1252 | + | ||
| 1253 | +int get_capacity(struct power_supply *b) { | ||
| 1254 | + switch (micro_battery.flag) { | ||
| 1255 | + case H3600_BATT_STATUS_HIGH : return 100; break; | ||
| 1256 | + case H3600_BATT_STATUS_LOW : return 50; break; | ||
| 1257 | + case H3600_BATT_STATUS_CRITICAL : return 5; break; | ||
| 1258 | + default: break; | ||
| 1259 | + } | ||
| 1260 | + return 0; | ||
| 1261 | +} | ||
| 1262 | + | ||
| 1263 | +int get_status(struct power_supply *b) { | ||
| 1264 | + | ||
| 1265 | + if (micro_battery.flag == H3600_BATT_STATUS_UNKNOWN) | ||
| 1266 | + return POWER_SUPPLY_STATUS_UNKNOWN; | ||
| 1267 | + | ||
| 1268 | + if (micro_battery.flag & H3600_BATT_STATUS_FULL) | ||
| 1269 | + return POWER_SUPPLY_STATUS_FULL; | ||
| 1270 | + | ||
| 1271 | + if ((micro_battery.flag & H3600_BATT_STATUS_CHARGING) || | ||
| 1272 | + (micro_battery.flag & H3600_BATT_STATUS_CHARGEMAIN)) | ||
| 1273 | + return POWER_SUPPLY_STATUS_CHARGING; | ||
| 1274 | + | ||
| 1275 | + return POWER_SUPPLY_STATUS_DISCHARGING; | ||
| 1276 | +} | ||
| 1277 | + | ||
| 1278 | +static int micro_batt_get_property(struct power_supply *b, | ||
| 1279 | + enum power_supply_property psp, | ||
| 1280 | + union power_supply_propval *val) | ||
| 1281 | +{ | ||
| 1282 | + switch (psp) { | ||
| 1283 | + case POWER_SUPPLY_PROP_STATUS: | ||
| 1284 | + val->intval = get_status(b); | ||
| 1285 | + break; | ||
| 1286 | + case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: | ||
| 1287 | + val->intval = 4700000; | ||
| 1288 | + break; | ||
| 1289 | + case POWER_SUPPLY_PROP_CAPACITY: | ||
| 1290 | + val->intval = get_capacity(b); | ||
| 1291 | + break; | ||
| 1292 | + case POWER_SUPPLY_PROP_TEMP: | ||
| 1293 | + val->intval = micro_battery.temperature; | ||
| 1294 | + break; | ||
| 1295 | + case POWER_SUPPLY_PROP_VOLTAGE_NOW: | ||
| 1296 | + val->intval = micro_battery.voltage; | ||
| 1297 | + break; | ||
| 1298 | + default: | ||
| 1299 | + return -EINVAL; | ||
| 1300 | + }; | ||
| 1301 | + | ||
| 1302 | + return 0; | ||
| 1303 | +} | ||
| 1304 | + | ||
| 1305 | +static enum power_supply_property micro_batt_props[] = { | ||
| 1306 | + POWER_SUPPLY_PROP_STATUS, | ||
| 1307 | + POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, | ||
| 1308 | + POWER_SUPPLY_PROP_CAPACITY, | ||
| 1309 | + POWER_SUPPLY_PROP_TEMP, | ||
| 1310 | + POWER_SUPPLY_PROP_VOLTAGE_NOW, | ||
| 1311 | +}; | ||
| 1312 | + | ||
| 1313 | +static struct power_supply h3600_battery = { | ||
| 1314 | + .name = "main-battery", | ||
| 1315 | + .properties = micro_batt_props, | ||
| 1316 | + .num_properties = ARRAY_SIZE(micro_batt_props), | ||
| 1317 | + .get_property = micro_batt_get_property, | ||
| 1318 | + .use_for_apm = 1, | ||
| 1319 | +}; | ||
| 1320 | + | ||
| 1321 | +static int micro_batt_probe (struct platform_device *pdev) | ||
| 1322 | +{ | ||
| 1323 | + if (1) printk(KERN_ERR "micro battery probe : begin\n"); | ||
| 1324 | + | ||
| 1325 | + power_supply_register(&pdev->dev, &h3600_battery); | ||
| 1326 | + | ||
| 1327 | + { /*--- callback ---*/ | ||
| 1328 | + p_micro = platform_get_drvdata(pdev); | ||
| 1329 | + spin_lock(p_micro->lock); | ||
| 1330 | + p_micro->h_batt = micro_battery_receive; | ||
| 1331 | + p_micro->h_temp = micro_temperature_receive; | ||
| 1332 | + spin_unlock(p_micro->lock); | ||
| 1333 | + } | ||
| 1334 | + | ||
| 1335 | + { /*--- timer ---*/ | ||
| 1336 | + init_timer(&batt_timer); | ||
| 1337 | + batt_timer.expires = jiffies + BATT_PERIOD; | ||
| 1338 | + batt_timer.data = 0; | ||
| 1339 | + batt_timer.function = h3600_battery_read_status; | ||
| 1340 | + | ||
| 1341 | + add_timer(&batt_timer); | ||
| 1342 | + } | ||
| 1343 | + | ||
| 1344 | + if (1) printk(KERN_ERR "micro battery probe : end\n"); | ||
| 1345 | + return 0; | ||
| 1346 | +} | ||
| 1347 | + | ||
| 1348 | +static int micro_batt_remove (struct platform_device *pdev) | ||
| 1349 | +{ | ||
| 1350 | + power_supply_unregister(&h3600_battery); | ||
| 1351 | + { /*--- callback ---*/ | ||
| 1352 | + init_timer(&batt_timer); | ||
| 1353 | + p_micro->h_batt = NULL; | ||
| 1354 | + p_micro->h_temp = NULL; | ||
| 1355 | + spin_unlock(p_micro->lock); | ||
| 1356 | + } | ||
| 1357 | + { /*--- timer ---*/ | ||
| 1358 | + del_timer_sync(&batt_timer); | ||
| 1359 | + } | ||
| 1360 | + return 0; | ||
| 1361 | +} | ||
| 1362 | + | ||
| 1363 | +static int micro_batt_suspend ( struct platform_device *pdev, pm_message_t state) | ||
| 1364 | +{ | ||
| 1365 | + { /*--- timer ---*/ | ||
| 1366 | + del_timer(&batt_timer); | ||
| 1367 | + } | ||
| 1368 | + return 0; | ||
| 1369 | +} | ||
| 1370 | + | ||
| 1371 | +static int micro_batt_resume ( struct platform_device *pdev) | ||
| 1372 | +{ | ||
| 1373 | + { /*--- timer ---*/ | ||
| 1374 | + add_timer(&batt_timer); | ||
| 1375 | + } | ||
| 1376 | + return 0; | ||
| 1377 | +} | ||
| 1378 | + | ||
| 1379 | +struct platform_driver micro_batt_device_driver = { | ||
| 1380 | + .driver = { | ||
| 1381 | + .name = "h3600-micro-battery", | ||
| 1382 | + }, | ||
| 1383 | + .probe = micro_batt_probe, | ||
| 1384 | + .remove = micro_batt_remove, | ||
| 1385 | + .suspend = micro_batt_suspend, | ||
| 1386 | + .resume = micro_batt_resume, | ||
| 1387 | +}; | ||
| 1388 | + | ||
| 1389 | +static int micro_batt_init (void) | ||
| 1390 | +{ | ||
| 1391 | + return platform_driver_register(µ_batt_device_driver); | ||
| 1392 | +} | ||
| 1393 | + | ||
| 1394 | +static void micro_batt_cleanup (void) | ||
| 1395 | +{ | ||
| 1396 | + platform_driver_unregister (µ_batt_device_driver); | ||
| 1397 | +} | ||
| 1398 | + | ||
| 1399 | +module_init (micro_batt_init); | ||
| 1400 | +module_exit (micro_batt_cleanup); | ||
| 1401 | + | ||
| 1402 | +MODULE_LICENSE("GPL"); | ||
| 1403 | +MODULE_AUTHOR("gremlin.it"); | ||
| 1404 | +MODULE_DESCRIPTION("driver for iPAQ Atmel micro battery"); | ||
| 1405 | + | ||
| 1406 | + | ||
| 1407 | Index: linux-2.6.22/drivers/power/olpc_battery.c | ||
| 1408 | =================================================================== | ||
| 1409 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 1410 | +++ linux-2.6.22/drivers/power/olpc_battery.c 2007-08-23 12:13:52.000000000 +0200 | ||
| 1411 | @@ -0,0 +1,302 @@ | ||
| 1412 | +/* | ||
| 1413 | + * Battery driver for One Laptop Per Child board. | ||
| 1414 | + * | ||
| 1415 | + * Copyright © 2006 David Woodhouse <dwmw2@infradead.org> | ||
| 1416 | + * | ||
| 1417 | + * This program is free software; you can redistribute it and/or modify | ||
| 1418 | + * it under the terms of the GNU General Public License version 2 as | ||
| 1419 | + * published by the Free Software Foundation. | ||
| 1420 | + */ | ||
| 1421 | + | ||
| 1422 | +#include <linux/module.h> | ||
| 1423 | +#include <linux/err.h> | ||
| 1424 | +#include <linux/platform_device.h> | ||
| 1425 | +#include <linux/power_supply.h> | ||
| 1426 | +#include <linux/jiffies.h> | ||
| 1427 | +#include <linux/sched.h> | ||
| 1428 | +#include <asm/io.h> | ||
| 1429 | + | ||
| 1430 | +#define wBAT_VOLTAGE 0xf900 /* *9.76/32, mV */ | ||
| 1431 | +#define wBAT_CURRENT 0xf902 /* *15.625/120, mA */ | ||
| 1432 | +#define wBAT_TEMP 0xf906 /* *256/1000, °C */ | ||
| 1433 | +#define wAMB_TEMP 0xf908 /* *256/1000, °C */ | ||
| 1434 | +#define SOC 0xf910 /* percentage */ | ||
| 1435 | +#define sMBAT_STATUS 0xfaa4 | ||
| 1436 | +#define sBAT_PRESENT 1 | ||
| 1437 | +#define sBAT_FULL 2 | ||
| 1438 | +#define sBAT_DESTROY 4 /* what is this exactly? */ | ||
| 1439 | +#define sBAT_LOW 32 | ||
| 1440 | +#define sBAT_DISCHG 64 | ||
| 1441 | +#define sMCHARGE_STATUS 0xfaa5 | ||
| 1442 | +#define sBAT_CHARGE 1 | ||
| 1443 | +#define sBAT_OVERTEMP 4 | ||
| 1444 | +#define sBAT_NiMH 8 | ||
| 1445 | +#define sPOWER_FLAG 0xfa40 | ||
| 1446 | +#define ADAPTER_IN 1 | ||
| 1447 | + | ||
| 1448 | +/********************************************************************* | ||
| 1449 | + * EC locking and access | ||
| 1450 | + *********************************************************************/ | ||
| 1451 | + | ||
| 1452 | +static int lock_ec(void) | ||
| 1453 | +{ | ||
| 1454 | + unsigned long timeo = jiffies + HZ / 20; | ||
| 1455 | + | ||
| 1456 | + while (1) { | ||
| 1457 | + unsigned char lock = inb(0x6c) & 0x80; | ||
| 1458 | + if (!lock) | ||
| 1459 | + return 0; | ||
| 1460 | + if (time_after(jiffies, timeo)) { | ||
| 1461 | + printk(KERN_ERR "olpc_battery: failed to lock EC for " | ||
| 1462 | + "battery access\n"); | ||
| 1463 | + return 1; | ||
| 1464 | + } | ||
| 1465 | + yield(); | ||
| 1466 | + } | ||
| 1467 | +} | ||
| 1468 | + | ||
| 1469 | +static void unlock_ec(void) | ||
| 1470 | +{ | ||
| 1471 | + outb(0xff, 0x6c); | ||
| 1472 | + return; | ||
| 1473 | +} | ||
| 1474 | + | ||
| 1475 | +static unsigned char read_ec_byte(unsigned short adr) | ||
| 1476 | +{ | ||
| 1477 | + outb(adr >> 8, 0x381); | ||
| 1478 | + outb(adr, 0x382); | ||
| 1479 | + return inb(0x383); | ||
| 1480 | +} | ||
| 1481 | + | ||
| 1482 | +static unsigned short read_ec_word(unsigned short adr) | ||
| 1483 | +{ | ||
| 1484 | + return (read_ec_byte(adr) << 8) | read_ec_byte(adr + 1); | ||
| 1485 | +} | ||
| 1486 | + | ||
| 1487 | +/********************************************************************* | ||
| 1488 | + * Power | ||
| 1489 | + *********************************************************************/ | ||
| 1490 | + | ||
| 1491 | +static int olpc_ac_get_prop(struct power_supply *psy, | ||
| 1492 | + enum power_supply_property psp, | ||
| 1493 | + union power_supply_propval *val) | ||
| 1494 | +{ | ||
| 1495 | + int ret = 0; | ||
| 1496 | + | ||
| 1497 | + if (lock_ec()) | ||
| 1498 | + return -EIO; | ||
| 1499 | + | ||
| 1500 | + switch (psp) { | ||
| 1501 | + case POWER_SUPPLY_PROP_ONLINE: | ||
| 1502 | + if (!(read_ec_byte(sMBAT_STATUS) & sBAT_PRESENT)) { | ||
| 1503 | + ret = -ENODEV; | ||
| 1504 | + goto out; | ||
| 1505 | + } | ||
| 1506 | + val->intval = !!(read_ec_byte(sPOWER_FLAG) & ADAPTER_IN); | ||
| 1507 | + break; | ||
| 1508 | + default: | ||
| 1509 | + ret = -EINVAL; | ||
| 1510 | + break; | ||
| 1511 | + } | ||
| 1512 | +out: | ||
| 1513 | + unlock_ec(); | ||
| 1514 | + return ret; | ||
| 1515 | +} | ||
| 1516 | + | ||
| 1517 | +static enum power_supply_property olpc_ac_props[] = { | ||
| 1518 | + POWER_SUPPLY_PROP_ONLINE, | ||
| 1519 | +}; | ||
| 1520 | + | ||
| 1521 | +static struct power_supply olpc_ac = { | ||
| 1522 | + .name = "olpc-ac", | ||
| 1523 | + .type = POWER_SUPPLY_TYPE_MAINS, | ||
| 1524 | + .properties = olpc_ac_props, | ||
| 1525 | + .num_properties = ARRAY_SIZE(olpc_ac_props), | ||
| 1526 | + .get_property = olpc_ac_get_prop, | ||
| 1527 | +}; | ||
| 1528 | + | ||
| 1529 | +/********************************************************************* | ||
| 1530 | + * Battery properties | ||
| 1531 | + *********************************************************************/ | ||
| 1532 | + | ||
| 1533 | +static int olpc_bat_get_property(struct power_supply *psy, | ||
| 1534 | + enum power_supply_property psp, | ||
| 1535 | + union power_supply_propval *val) | ||
| 1536 | +{ | ||
| 1537 | + int ret = 0; | ||
| 1538 | + | ||
| 1539 | + if (lock_ec()) | ||
| 1540 | + return -EIO; | ||
| 1541 | + | ||
| 1542 | + switch (psp) { | ||
| 1543 | + case POWER_SUPPLY_PROP_STATUS: | ||
| 1544 | + { | ||
| 1545 | + int status = POWER_SUPPLY_STATUS_UNKNOWN; | ||
| 1546 | + | ||
| 1547 | + val->intval = read_ec_byte(sMBAT_STATUS); | ||
| 1548 | + | ||
| 1549 | + if (!(val->intval & sBAT_PRESENT)) { | ||
| 1550 | + ret = -ENODEV; | ||
| 1551 | + goto out; | ||
| 1552 | + } | ||
| 1553 | + | ||
| 1554 | + if (val->intval & sBAT_DISCHG) | ||
| 1555 | + status = POWER_SUPPLY_STATUS_DISCHARGING; | ||
| 1556 | + else if (val->intval & sBAT_FULL) | ||
| 1557 | + status = POWER_SUPPLY_STATUS_FULL; | ||
| 1558 | + | ||
| 1559 | + val->intval = read_ec_byte(sMCHARGE_STATUS); | ||
| 1560 | + if (val->intval & sBAT_CHARGE) | ||
| 1561 | + status = POWER_SUPPLY_STATUS_CHARGING; | ||
| 1562 | + | ||
| 1563 | + val->intval = status; | ||
| 1564 | + break; | ||
| 1565 | + } | ||
| 1566 | + case POWER_SUPPLY_PROP_PRESENT: | ||
| 1567 | + val->intval = !!(read_ec_byte(sMBAT_STATUS) & sBAT_PRESENT); | ||
| 1568 | + break; | ||
| 1569 | + case POWER_SUPPLY_PROP_HEALTH: | ||
| 1570 | + val->intval = read_ec_byte(sMCHARGE_STATUS); | ||
| 1571 | + if (val->intval & sBAT_OVERTEMP) | ||
| 1572 | + val->intval = POWER_SUPPLY_HEALTH_OVERHEAT; | ||
| 1573 | + else | ||
| 1574 | + val->intval = POWER_SUPPLY_HEALTH_GOOD; | ||
| 1575 | + break; | ||
| 1576 | + case POWER_SUPPLY_PROP_TECHNOLOGY: | ||
| 1577 | + val->intval = read_ec_byte(sMCHARGE_STATUS); | ||
| 1578 | + if (val->intval & sBAT_NiMH) | ||
| 1579 | + val->intval = POWER_SUPPLY_TECHNOLOGY_NIMH; | ||
| 1580 | + else | ||
| 1581 | + val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN; | ||
| 1582 | + break; | ||
| 1583 | + case POWER_SUPPLY_PROP_VOLTAGE_AVG: | ||
| 1584 | + val->intval = read_ec_byte(wBAT_VOLTAGE) * 9760L / 32; | ||
| 1585 | + break; | ||
| 1586 | + case POWER_SUPPLY_PROP_CURRENT_AVG: | ||
| 1587 | + val->intval = read_ec_byte(wBAT_CURRENT) * 15625L / 120; | ||
| 1588 | + break; | ||
| 1589 | + case POWER_SUPPLY_PROP_CAPACITY: | ||
| 1590 | + val->intval = read_ec_byte(SOC); | ||
| 1591 | + break; | ||
| 1592 | + case POWER_SUPPLY_PROP_CAPACITY_LEVEL: | ||
| 1593 | + val->intval = read_ec_byte(sMBAT_STATUS); | ||
| 1594 | + if (val->intval & sBAT_FULL) | ||
| 1595 | + val->intval = POWER_SUPPLY_CAPACITY_LEVEL_FULL; | ||
| 1596 | + else if (val->intval & sBAT_LOW) | ||
| 1597 | + val->intval = POWER_SUPPLY_CAPACITY_LEVEL_LOW; | ||
| 1598 | + else | ||
| 1599 | + val->intval = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL; | ||
| 1600 | + break; | ||
| 1601 | + case POWER_SUPPLY_PROP_TEMP: | ||
| 1602 | + val->intval = read_ec_byte(wBAT_TEMP) * 256 / 100; | ||
| 1603 | + break; | ||
| 1604 | + case POWER_SUPPLY_PROP_TEMP_AMBIENT: | ||
| 1605 | + val->intval = read_ec_byte(wAMB_TEMP) * 256 / 100; | ||
| 1606 | + break; | ||
| 1607 | + default: | ||
| 1608 | + ret = -EINVAL; | ||
| 1609 | + break; | ||
| 1610 | + } | ||
| 1611 | + | ||
| 1612 | +out: | ||
| 1613 | + unlock_ec(); | ||
| 1614 | + return ret; | ||
| 1615 | +} | ||
| 1616 | + | ||
| 1617 | +static enum power_supply_property olpc_bat_props[] = { | ||
| 1618 | + POWER_SUPPLY_PROP_STATUS, | ||
| 1619 | + POWER_SUPPLY_PROP_PRESENT, | ||
| 1620 | + POWER_SUPPLY_PROP_HEALTH, | ||
| 1621 | + POWER_SUPPLY_PROP_TECHNOLOGY, | ||
| 1622 | + POWER_SUPPLY_PROP_VOLTAGE_AVG, | ||
| 1623 | + POWER_SUPPLY_PROP_CURRENT_AVG, | ||
| 1624 | + POWER_SUPPLY_PROP_CAPACITY, | ||
| 1625 | + POWER_SUPPLY_PROP_CAPACITY_LEVEL, | ||
| 1626 | + POWER_SUPPLY_PROP_TEMP, | ||
| 1627 | + POWER_SUPPLY_PROP_TEMP_AMBIENT, | ||
| 1628 | +}; | ||
| 1629 | + | ||
| 1630 | +/********************************************************************* | ||
| 1631 | + * Initialisation | ||
| 1632 | + *********************************************************************/ | ||
| 1633 | + | ||
| 1634 | +static struct platform_device *bat_pdev; | ||
| 1635 | + | ||
| 1636 | +static struct power_supply olpc_bat = { | ||
| 1637 | + .properties = olpc_bat_props, | ||
| 1638 | + .num_properties = ARRAY_SIZE(olpc_bat_props), | ||
| 1639 | + .get_property = olpc_bat_get_property, | ||
| 1640 | + .use_for_apm = 1, | ||
| 1641 | +}; | ||
| 1642 | + | ||
| 1643 | +static int __init olpc_bat_init(void) | ||
| 1644 | +{ | ||
| 1645 | + int ret = 0; | ||
| 1646 | + unsigned short tmp; | ||
| 1647 | + | ||
| 1648 | + if (!request_region(0x380, 4, "olpc-battery")) { | ||
| 1649 | + ret = -EIO; | ||
| 1650 | + goto region_failed; | ||
| 1651 | + } | ||
| 1652 | + | ||
| 1653 | + if (lock_ec()) { | ||
| 1654 | + ret = -EIO; | ||
| 1655 | + goto lock_failed; | ||
| 1656 | + } | ||
| 1657 | + | ||
| 1658 | + tmp = read_ec_word(0xfe92); | ||
| 1659 | + unlock_ec(); | ||
| 1660 | + | ||
| 1661 | + if (tmp != 0x380) { | ||
| 1662 | + /* Doesn't look like OLPC EC */ | ||
| 1663 | + ret = -ENODEV; | ||
| 1664 | + goto not_olpc_ec; | ||
| 1665 | + } | ||
| 1666 | + | ||
| 1667 | + bat_pdev = platform_device_register_simple("olpc-battery", 0, NULL, 0); | ||
| 1668 | + if (IS_ERR(bat_pdev)) { | ||
| 1669 | + ret = PTR_ERR(bat_pdev); | ||
| 1670 | + goto pdev_failed; | ||
| 1671 | + } | ||
| 1672 | + | ||
| 1673 | + ret = power_supply_register(&bat_pdev->dev, &olpc_ac); | ||
| 1674 | + if (ret) | ||
| 1675 | + goto ac_failed; | ||
| 1676 | + | ||
| 1677 | + olpc_bat.name = bat_pdev->name; | ||
| 1678 | + | ||
| 1679 | + ret = power_supply_register(&bat_pdev->dev, &olpc_bat); | ||
| 1680 | + if (ret) | ||
| 1681 | + goto battery_failed; | ||
| 1682 | + | ||
| 1683 | + goto success; | ||
| 1684 | + | ||
| 1685 | +battery_failed: | ||
| 1686 | + power_supply_unregister(&olpc_ac); | ||
| 1687 | +ac_failed: | ||
| 1688 | + platform_device_unregister(bat_pdev); | ||
| 1689 | +pdev_failed: | ||
| 1690 | +not_olpc_ec: | ||
| 1691 | +lock_failed: | ||
| 1692 | + release_region(0x380, 4); | ||
| 1693 | +region_failed: | ||
| 1694 | +success: | ||
| 1695 | + return ret; | ||
| 1696 | +} | ||
| 1697 | + | ||
| 1698 | +static void __exit olpc_bat_exit(void) | ||
| 1699 | +{ | ||
| 1700 | + power_supply_unregister(&olpc_bat); | ||
| 1701 | + power_supply_unregister(&olpc_ac); | ||
| 1702 | + platform_device_unregister(bat_pdev); | ||
| 1703 | + release_region(0x380, 4); | ||
| 1704 | + return; | ||
| 1705 | +} | ||
| 1706 | + | ||
| 1707 | +module_init(olpc_bat_init); | ||
| 1708 | +module_exit(olpc_bat_exit); | ||
| 1709 | + | ||
| 1710 | +MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>"); | ||
| 1711 | +MODULE_LICENSE("GPL"); | ||
| 1712 | +MODULE_DESCRIPTION("Battery driver for One Laptop Per Child " | ||
| 1713 | + "($100 laptop) board."); | ||
| 1714 | Index: linux-2.6.22/drivers/power/pda_power.c | ||
| 1715 | =================================================================== | ||
| 1716 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 1717 | +++ linux-2.6.22/drivers/power/pda_power.c 2007-08-23 12:13:52.000000000 +0200 | ||
| 1718 | @@ -0,0 +1,263 @@ | ||
| 1719 | +/* | ||
| 1720 | + * Common power driver for PDAs and phones with one or two external | ||
| 1721 | + * power supplies (AC/USB) connected to main and backup batteries, | ||
| 1722 | + * and optional builtin charger. | ||
| 1723 | + * | ||
| 1724 | + * Copyright 2007 Anton Vorontsov <cbou@mail.ru> | ||
| 1725 | + * | ||
| 1726 | + * This program is free software; you can redistribute it and/or modify | ||
| 1727 | + * it under the terms of the GNU General Public License version 2 as | ||
| 1728 | + * published by the Free Software Foundation. | ||
| 1729 | + */ | ||
| 1730 | + | ||
| 1731 | +#include <linux/module.h> | ||
| 1732 | +#include <linux/platform_device.h> | ||
| 1733 | +#include <linux/interrupt.h> | ||
| 1734 | +#include <linux/power_supply.h> | ||
| 1735 | +#include <linux/pda_power.h> | ||
| 1736 | +#include <linux/timer.h> | ||
| 1737 | +#include <linux/jiffies.h> | ||
| 1738 | + | ||
| 1739 | +static inline unsigned int get_irq_flags(struct resource *res) | ||
| 1740 | +{ | ||
| 1741 | + unsigned int flags = IRQF_DISABLED | IRQF_SHARED; | ||
| 1742 | + | ||
| 1743 | + flags |= res->flags & IRQF_TRIGGER_MASK; | ||
| 1744 | + | ||
| 1745 | + return flags; | ||
| 1746 | +} | ||
| 1747 | + | ||
| 1748 | +static struct device *dev; | ||
| 1749 | +static struct pda_power_pdata *pdata; | ||
| 1750 | +static struct resource *ac_irq, *usb_irq; | ||
| 1751 | +static struct timer_list charger_timer; | ||
| 1752 | +static struct timer_list supply_timer; | ||
| 1753 | + | ||
| 1754 | +static int pda_power_get_property(struct power_supply *psy, | ||
| 1755 | + enum power_supply_property psp, | ||
| 1756 | + union power_supply_propval *val) | ||
| 1757 | +{ | ||
| 1758 | + switch (psp) { | ||
| 1759 | + case POWER_SUPPLY_PROP_ONLINE: | ||
| 1760 | + if (psy->type == POWER_SUPPLY_TYPE_MAINS) | ||
| 1761 | + val->intval = pdata->is_ac_online ? | ||
| 1762 | + pdata->is_ac_online() : 0; | ||
| 1763 | + else | ||
| 1764 | + val->intval = pdata->is_usb_online ? | ||
| 1765 | + pdata->is_usb_online() : 0; | ||
| 1766 | + break; | ||
| 1767 | + default: | ||
| 1768 | + return -EINVAL; | ||
| 1769 | + } | ||
| 1770 | + return 0; | ||
| 1771 | +} | ||
| 1772 | + | ||
| 1773 | +static enum power_supply_property pda_power_props[] = { | ||
| 1774 | + POWER_SUPPLY_PROP_ONLINE, | ||
| 1775 | +}; | ||
| 1776 | + | ||
| 1777 | +static char *pda_power_supplied_to[] = { | ||
| 1778 | + "main-battery", | ||
| 1779 | + "backup-battery", | ||
| 1780 | +}; | ||
| 1781 | + | ||
| 1782 | +static struct power_supply pda_power_supplies[] = { | ||
| 1783 | + { | ||
| 1784 | + .name = "ac", | ||
| 1785 | + .type = POWER_SUPPLY_TYPE_MAINS, | ||
| 1786 | + .supplied_to = pda_power_supplied_to, | ||
| 1787 | + .num_supplicants = ARRAY_SIZE(pda_power_supplied_to), | ||
| 1788 | + .properties = pda_power_props, | ||
| 1789 | + .num_properties = ARRAY_SIZE(pda_power_props), | ||
| 1790 | + .get_property = pda_power_get_property, | ||
| 1791 | + }, | ||
| 1792 | + { | ||
| 1793 | + .name = "usb", | ||
| 1794 | + .type = POWER_SUPPLY_TYPE_USB, | ||
| 1795 | + .supplied_to = pda_power_supplied_to, | ||
| 1796 | + .num_supplicants = ARRAY_SIZE(pda_power_supplied_to), | ||
| 1797 | + .properties = pda_power_props, | ||
| 1798 | + .num_properties = ARRAY_SIZE(pda_power_props), | ||
| 1799 | + .get_property = pda_power_get_property, | ||
| 1800 | + }, | ||
| 1801 | +}; | ||
| 1802 | + | ||
| 1803 | +static void update_charger(void) | ||
| 1804 | +{ | ||
| 1805 | + if (!pdata->set_charge) | ||
| 1806 | + return; | ||
| 1807 | + | ||
| 1808 | + if (pdata->is_ac_online && pdata->is_ac_online()) { | ||
| 1809 | + dev_dbg(dev, "charger on (AC)\n"); | ||
| 1810 | + pdata->set_charge(PDA_POWER_CHARGE_AC); | ||
| 1811 | + } | ||
| 1812 | + else if (pdata->is_usb_online && pdata->is_usb_online()) { | ||
| 1813 | + dev_dbg(dev, "charger on (USB)\n"); | ||
| 1814 | + pdata->set_charge(PDA_POWER_CHARGE_USB); | ||
| 1815 | + } | ||
| 1816 | + else { | ||
| 1817 | + dev_dbg(dev, "charger off\n"); | ||
| 1818 | + pdata->set_charge(0); | ||
| 1819 | + } | ||
| 1820 | + | ||
| 1821 | + return; | ||
| 1822 | +} | ||
| 1823 | + | ||
| 1824 | +static void supply_timer_func(unsigned long irq) | ||
| 1825 | +{ | ||
| 1826 | + if (ac_irq && irq == ac_irq->start) | ||
| 1827 | + power_supply_changed(&pda_power_supplies[0]); | ||
| 1828 | + else if (usb_irq && irq == usb_irq->start) | ||
| 1829 | + power_supply_changed(&pda_power_supplies[1]); | ||
| 1830 | + return; | ||
| 1831 | +} | ||
| 1832 | + | ||
| 1833 | +static void charger_timer_func(unsigned long irq) | ||
| 1834 | +{ | ||
| 1835 | + update_charger(); | ||
| 1836 | + | ||
| 1837 | + /* Okay, charger set. Now wait a bit before notifying supplicants, | ||
| 1838 | + * charge power should stabilize. */ | ||
| 1839 | + supply_timer.data = irq; | ||
| 1840 | + mod_timer(&supply_timer, | ||
| 1841 | + jiffies + msecs_to_jiffies(pdata->wait_for_charger)); | ||
| 1842 | + return; | ||
| 1843 | +} | ||
| 1844 | + | ||
| 1845 | +static irqreturn_t power_changed_isr(int irq, void *unused) | ||
| 1846 | +{ | ||
| 1847 | + /* Wait a bit before reading ac/usb line status and setting charger, | ||
| 1848 | + * because ac/usb status readings may lag from irq. */ | ||
| 1849 | + charger_timer.data = irq; | ||
| 1850 | + mod_timer(&charger_timer, | ||
| 1851 | + jiffies + msecs_to_jiffies(pdata->wait_for_status)); | ||
| 1852 | + return IRQ_HANDLED; | ||
| 1853 | +} | ||
| 1854 | + | ||
| 1855 | +static int pda_power_probe(struct platform_device *pdev) | ||
| 1856 | +{ | ||
| 1857 | + int ret = 0; | ||
| 1858 | + | ||
| 1859 | + dev = &pdev->dev; | ||
| 1860 | + | ||
| 1861 | + if (pdev->id != -1) { | ||
| 1862 | + dev_err(dev, "it's meaningless to register several " | ||
| 1863 | + "pda_powers, use id = -1\n"); | ||
| 1864 | + ret = -EINVAL; | ||
| 1865 | + goto wrongid; | ||
| 1866 | + } | ||
| 1867 | + | ||
| 1868 | + pdata = pdev->dev.platform_data; | ||
| 1869 | + | ||
| 1870 | + update_charger(); | ||
| 1871 | + | ||
| 1872 | + if (!pdata->wait_for_status) | ||
| 1873 | + pdata->wait_for_status = 500; | ||
| 1874 | + | ||
| 1875 | + if (!pdata->wait_for_charger) | ||
| 1876 | + pdata->wait_for_charger = 500; | ||
| 1877 | + | ||
| 1878 | + setup_timer(&charger_timer, charger_timer_func, 0); | ||
| 1879 | + setup_timer(&supply_timer, supply_timer_func, 0); | ||
| 1880 | + | ||
| 1881 | + ac_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "ac"); | ||
| 1882 | + usb_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "usb"); | ||
| 1883 | + if (!ac_irq && !usb_irq) { | ||
| 1884 | + dev_err(dev, "no ac/usb irq specified\n"); | ||
| 1885 | + ret = -ENODEV; | ||
| 1886 | + goto noirqs; | ||
| 1887 | + } | ||
| 1888 | + | ||
| 1889 | + if (pdata->supplied_to) { | ||
| 1890 | + pda_power_supplies[0].supplied_to = pdata->supplied_to; | ||
| 1891 | + pda_power_supplies[1].supplied_to = pdata->supplied_to; | ||
| 1892 | + pda_power_supplies[0].num_supplicants = pdata->num_supplicants; | ||
| 1893 | + pda_power_supplies[1].num_supplicants = pdata->num_supplicants; | ||
| 1894 | + } | ||
| 1895 | + | ||
| 1896 | + ret = power_supply_register(&pdev->dev, &pda_power_supplies[0]); | ||
| 1897 | + if (ret) { | ||
| 1898 | + dev_err(dev, "failed to register %s power supply\n", | ||
| 1899 | + pda_power_supplies[0].name); | ||
| 1900 | + goto supply0_failed; | ||
| 1901 | + } | ||
| 1902 | + | ||
| 1903 | + ret = power_supply_register(&pdev->dev, &pda_power_supplies[1]); | ||
| 1904 | + if (ret) { | ||
| 1905 | + dev_err(dev, "failed to register %s power supply\n", | ||
| 1906 | + pda_power_supplies[1].name); | ||
| 1907 | + goto supply1_failed; | ||
| 1908 | + } | ||
| 1909 | + | ||
| 1910 | + if (ac_irq) { | ||
| 1911 | + ret = request_irq(ac_irq->start, power_changed_isr, | ||
| 1912 | + get_irq_flags(ac_irq), ac_irq->name, | ||
| 1913 | + &pda_power_supplies[0]); | ||
| 1914 | + if (ret) { | ||
| 1915 | + dev_err(dev, "request ac irq failed\n"); | ||
| 1916 | + goto ac_irq_failed; | ||
| 1917 | + } | ||
| 1918 | + } | ||
| 1919 | + | ||
| 1920 | + if (usb_irq) { | ||
| 1921 | + ret = request_irq(usb_irq->start, power_changed_isr, | ||
| 1922 | + get_irq_flags(usb_irq), usb_irq->name, | ||
| 1923 | + &pda_power_supplies[1]); | ||
| 1924 | + if (ret) { | ||
| 1925 | + dev_err(dev, "request usb irq failed\n"); | ||
| 1926 | + goto usb_irq_failed; | ||
| 1927 | + } | ||
| 1928 | + } | ||
| 1929 | + | ||
| 1930 | + goto success; | ||
| 1931 | + | ||
| 1932 | +usb_irq_failed: | ||
| 1933 | + if (ac_irq) | ||
| 1934 | + free_irq(ac_irq->start, &pda_power_supplies[0]); | ||
| 1935 | +ac_irq_failed: | ||
| 1936 | + power_supply_unregister(&pda_power_supplies[1]); | ||
| 1937 | +supply1_failed: | ||
| 1938 | + power_supply_unregister(&pda_power_supplies[0]); | ||
| 1939 | +supply0_failed: | ||
| 1940 | +noirqs: | ||
| 1941 | +wrongid: | ||
| 1942 | +success: | ||
| 1943 | + return ret; | ||
| 1944 | +} | ||
| 1945 | + | ||
| 1946 | +static int pda_power_remove(struct platform_device *pdev) | ||
| 1947 | +{ | ||
| 1948 | + if (usb_irq) | ||
| 1949 | + free_irq(usb_irq->start, &pda_power_supplies[1]); | ||
| 1950 | + if (ac_irq) | ||
| 1951 | + free_irq(ac_irq->start, &pda_power_supplies[0]); | ||
| 1952 | + del_timer_sync(&charger_timer); | ||
| 1953 | + del_timer_sync(&supply_timer); | ||
| 1954 | + power_supply_unregister(&pda_power_supplies[1]); | ||
| 1955 | + power_supply_unregister(&pda_power_supplies[0]); | ||
| 1956 | + return 0; | ||
| 1957 | +} | ||
| 1958 | + | ||
| 1959 | +static struct platform_driver pda_power_pdrv = { | ||
| 1960 | + .driver = { | ||
| 1961 | + .name = "pda-power", | ||
| 1962 | + }, | ||
| 1963 | + .probe = pda_power_probe, | ||
| 1964 | + .remove = pda_power_remove, | ||
| 1965 | +}; | ||
| 1966 | + | ||
| 1967 | +static int __init pda_power_init(void) | ||
| 1968 | +{ | ||
| 1969 | + return platform_driver_register(&pda_power_pdrv); | ||
| 1970 | +} | ||
| 1971 | + | ||
| 1972 | +static void __exit pda_power_exit(void) | ||
| 1973 | +{ | ||
| 1974 | + platform_driver_unregister(&pda_power_pdrv); | ||
| 1975 | + return; | ||
| 1976 | +} | ||
| 1977 | + | ||
| 1978 | +module_init(pda_power_init); | ||
| 1979 | +module_exit(pda_power_exit); | ||
| 1980 | +MODULE_LICENSE("GPL"); | ||
| 1981 | +MODULE_AUTHOR("Anton Vorontsov <cbou@mail.ru>"); | ||
| 1982 | Index: linux-2.6.22/drivers/power/pmu_battery.c | ||
| 1983 | =================================================================== | ||
| 1984 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 1985 | +++ linux-2.6.22/drivers/power/pmu_battery.c 2007-08-23 12:13:52.000000000 +0200 | ||
| 1986 | @@ -0,0 +1,215 @@ | ||
| 1987 | +/* | ||
| 1988 | + * Battery class driver for Apple PMU | ||
| 1989 | + * | ||
| 1990 | + * Copyright © 2006 David Woodhouse <dwmw2@infradead.org> | ||
| 1991 | + * | ||
| 1992 | + * This program is free software; you can redistribute it and/or modify | ||
| 1993 | + * it under the terms of the GNU General Public License version 2 as | ||
| 1994 | + * published by the Free Software Foundation. | ||
| 1995 | + */ | ||
| 1996 | + | ||
| 1997 | +#include <linux/module.h> | ||
| 1998 | +#include <linux/platform_device.h> | ||
| 1999 | +#include <linux/err.h> | ||
| 2000 | +#include <linux/power_supply.h> | ||
| 2001 | +#include <linux/adb.h> | ||
| 2002 | +#include <linux/pmu.h> | ||
| 2003 | + | ||
| 2004 | +static struct pmu_battery_dev { | ||
| 2005 | + struct power_supply bat; | ||
| 2006 | + struct pmu_battery_info *pbi; | ||
| 2007 | + char name[16]; | ||
| 2008 | + int propval; | ||
| 2009 | +} *pbats[PMU_MAX_BATTERIES]; | ||
| 2010 | + | ||
| 2011 | +#define to_pmu_battery_dev(x) container_of(x, struct pmu_battery_dev, bat) | ||
| 2012 | + | ||
| 2013 | +/********************************************************************* | ||
| 2014 | + * Power | ||
| 2015 | + *********************************************************************/ | ||
| 2016 | + | ||
| 2017 | +static int pmu_get_ac_prop(struct power_supply *psy, | ||
| 2018 | + enum power_supply_property psp, | ||
| 2019 | + union power_supply_propval *val) | ||
| 2020 | +{ | ||
| 2021 | + switch (psp) { | ||
| 2022 | + case POWER_SUPPLY_PROP_ONLINE: | ||
| 2023 | + val->intval = (!!(pmu_power_flags & PMU_PWR_AC_PRESENT)) || | ||
| 2024 | + (pmu_battery_count == 0); | ||
| 2025 | + break; | ||
| 2026 | + default: | ||
| 2027 | + return -EINVAL; | ||
| 2028 | + } | ||
| 2029 | + | ||
| 2030 | + return 0; | ||
| 2031 | +} | ||
| 2032 | + | ||
| 2033 | +static enum power_supply_property pmu_ac_props[] = { | ||
| 2034 | + POWER_SUPPLY_PROP_ONLINE, | ||
| 2035 | +}; | ||
| 2036 | + | ||
| 2037 | +static struct power_supply pmu_ac = { | ||
| 2038 | + .name = "pmu-ac", | ||
| 2039 | + .type = POWER_SUPPLY_TYPE_MAINS, | ||
| 2040 | + .properties = pmu_ac_props, | ||
| 2041 | + .num_properties = ARRAY_SIZE(pmu_ac_props), | ||
| 2042 | + .get_property = pmu_get_ac_prop, | ||
| 2043 | +}; | ||
| 2044 | + | ||
| 2045 | +/********************************************************************* | ||
| 2046 | + * Battery properties | ||
| 2047 | + *********************************************************************/ | ||
| 2048 | + | ||
| 2049 | +static char *pmu_batt_types[] = { | ||
| 2050 | + "Smart", "Comet", "Hooper", "Unknown" | ||
| 2051 | +}; | ||
| 2052 | + | ||
| 2053 | +static char *pmu_bat_get_model_name(struct pmu_battery_info *pbi) | ||
| 2054 | +{ | ||
| 2055 | + switch (pbi->flags & PMU_BATT_TYPE_MASK) { | ||
| 2056 | + case PMU_BATT_TYPE_SMART: | ||
| 2057 | + return pmu_batt_types[0]; | ||
| 2058 | + case PMU_BATT_TYPE_COMET: | ||
| 2059 | + return pmu_batt_types[1]; | ||
| 2060 | + case PMU_BATT_TYPE_HOOPER: | ||
| 2061 | + return pmu_batt_types[2]; | ||
| 2062 | + default: break; | ||
| 2063 | + } | ||
| 2064 | + return pmu_batt_types[3]; | ||
| 2065 | +} | ||
| 2066 | + | ||
| 2067 | +static int pmu_bat_get_property(struct power_supply *psy, | ||
| 2068 | + enum power_supply_property psp, | ||
| 2069 | + union power_supply_propval *val) | ||
| 2070 | +{ | ||
| 2071 | + struct pmu_battery_dev *pbat = to_pmu_battery_dev(psy); | ||
| 2072 | + struct pmu_battery_info *pbi = pbat->pbi; | ||
| 2073 | + | ||
| 2074 | + switch (psp) { | ||
| 2075 | + case POWER_SUPPLY_PROP_STATUS: | ||
| 2076 | + if (pbi->flags & PMU_BATT_CHARGING) | ||
| 2077 | + val->intval = POWER_SUPPLY_STATUS_CHARGING; | ||
| 2078 | + else | ||
| 2079 | + val->intval = POWER_SUPPLY_STATUS_DISCHARGING; | ||
| 2080 | + break; | ||
| 2081 | + case POWER_SUPPLY_PROP_PRESENT: | ||
| 2082 | + val->intval = !!(pbi->flags & PMU_BATT_PRESENT); | ||
| 2083 | + break; | ||
| 2084 | + case POWER_SUPPLY_PROP_MODEL_NAME: | ||
| 2085 | + val->strval = pmu_bat_get_model_name(pbi); | ||
| 2086 | + break; | ||
| 2087 | + case POWER_SUPPLY_PROP_ENERGY_AVG: | ||
| 2088 | + val->intval = pbi->charge * 1000; /* mWh -> µWh */ | ||
| 2089 | + break; | ||
| 2090 | + case POWER_SUPPLY_PROP_ENERGY_FULL: | ||
| 2091 | + val->intval = pbi->max_charge * 1000; /* mWh -> µWh */ | ||
| 2092 | + break; | ||
| 2093 | + case POWER_SUPPLY_PROP_CURRENT_AVG: | ||
| 2094 | + val->intval = pbi->amperage * 1000; /* mA -> µA */ | ||
| 2095 | + break; | ||
| 2096 | + case POWER_SUPPLY_PROP_VOLTAGE_AVG: | ||
| 2097 | + val->intval = pbi->voltage * 1000; /* mV -> µV */ | ||
| 2098 | + break; | ||
| 2099 | + case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG: | ||
| 2100 | + val->intval = pbi->time_remaining; | ||
| 2101 | + break; | ||
| 2102 | + default: | ||
| 2103 | + return -EINVAL; | ||
| 2104 | + } | ||
| 2105 | + | ||
| 2106 | + return 0; | ||
| 2107 | +} | ||
| 2108 | + | ||
| 2109 | +static enum power_supply_property pmu_bat_props[] = { | ||
| 2110 | + POWER_SUPPLY_PROP_STATUS, | ||
| 2111 | + POWER_SUPPLY_PROP_PRESENT, | ||
| 2112 | + POWER_SUPPLY_PROP_MODEL_NAME, | ||
| 2113 | + POWER_SUPPLY_PROP_ENERGY_AVG, | ||
| 2114 | + POWER_SUPPLY_PROP_ENERGY_FULL, | ||
| 2115 | + POWER_SUPPLY_PROP_CURRENT_AVG, | ||
| 2116 | + POWER_SUPPLY_PROP_VOLTAGE_AVG, | ||
| 2117 | + POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, | ||
| 2118 | +}; | ||
| 2119 | + | ||
| 2120 | +/********************************************************************* | ||
| 2121 | + * Initialisation | ||
| 2122 | + *********************************************************************/ | ||
| 2123 | + | ||
| 2124 | +static struct platform_device *bat_pdev; | ||
| 2125 | + | ||
| 2126 | +static int __init pmu_bat_init(void) | ||
| 2127 | +{ | ||
| 2128 | + int ret; | ||
| 2129 | + int i; | ||
| 2130 | + | ||
| 2131 | + bat_pdev = platform_device_register_simple("pmu-battery", | ||
| 2132 | + 0, NULL, 0); | ||
| 2133 | + if (IS_ERR(bat_pdev)) { | ||
| 2134 | + ret = PTR_ERR(bat_pdev); | ||
| 2135 | + goto pdev_register_failed; | ||
| 2136 | + } | ||
| 2137 | + | ||
| 2138 | + ret = power_supply_register(&bat_pdev->dev, &pmu_ac); | ||
| 2139 | + if (ret) | ||
| 2140 | + goto ac_register_failed; | ||
| 2141 | + | ||
| 2142 | + for (i = 0; i < pmu_battery_count; i++) { | ||
| 2143 | + struct pmu_battery_dev *pbat = kzalloc(sizeof(*pbat), | ||
| 2144 | + GFP_KERNEL); | ||
| 2145 | + if (!pbat) | ||
| 2146 | + break; | ||
| 2147 | + | ||
| 2148 | + sprintf(pbat->name, "PMU battery %d", i); | ||
| 2149 | + pbat->bat.name = pbat->name; | ||
| 2150 | + pbat->bat.properties = pmu_bat_props; | ||
| 2151 | + pbat->bat.num_properties = ARRAY_SIZE(pmu_bat_props); | ||
| 2152 | + pbat->bat.get_property = pmu_bat_get_property; | ||
| 2153 | + pbat->pbi = &pmu_batteries[i]; | ||
| 2154 | + | ||
| 2155 | + ret = power_supply_register(&bat_pdev->dev, &pbat->bat); | ||
| 2156 | + if (ret) { | ||
| 2157 | + kfree(pbat); | ||
| 2158 | + goto battery_register_failed; | ||
| 2159 | + } | ||
| 2160 | + pbats[i] = pbat; | ||
| 2161 | + } | ||
| 2162 | + | ||
| 2163 | + goto success; | ||
| 2164 | + | ||
| 2165 | +battery_register_failed: | ||
| 2166 | + while (i--) { | ||
| 2167 | + if (!pbats[i]) | ||
| 2168 | + continue; | ||
| 2169 | + power_supply_unregister(&pbats[i]->bat); | ||
| 2170 | + kfree(pbats[i]); | ||
| 2171 | + } | ||
| 2172 | + power_supply_unregister(&pmu_ac); | ||
| 2173 | +ac_register_failed: | ||
| 2174 | + platform_device_unregister(bat_pdev); | ||
| 2175 | +pdev_register_failed: | ||
| 2176 | +success: | ||
| 2177 | + return ret; | ||
| 2178 | +} | ||
| 2179 | + | ||
| 2180 | +static void __exit pmu_bat_exit(void) | ||
| 2181 | +{ | ||
| 2182 | + int i; | ||
| 2183 | + | ||
| 2184 | + for (i = 0; i < PMU_MAX_BATTERIES; i++) { | ||
| 2185 | + if (!pbats[i]) | ||
| 2186 | + continue; | ||
| 2187 | + power_supply_unregister(&pbats[i]->bat); | ||
| 2188 | + kfree(pbats[i]); | ||
| 2189 | + } | ||
| 2190 | + power_supply_unregister(&pmu_ac); | ||
| 2191 | + platform_device_unregister(bat_pdev); | ||
| 2192 | + | ||
| 2193 | + return; | ||
| 2194 | +} | ||
| 2195 | + | ||
| 2196 | +module_init(pmu_bat_init); | ||
| 2197 | +module_exit(pmu_bat_exit); | ||
| 2198 | + | ||
| 2199 | +MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>"); | ||
| 2200 | +MODULE_LICENSE("GPL"); | ||
| 2201 | +MODULE_DESCRIPTION("PMU battery driver"); | ||
| 2202 | Index: linux-2.6.22/drivers/power/power_supply_core.c | ||
| 2203 | =================================================================== | ||
| 2204 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 2205 | +++ linux-2.6.22/drivers/power/power_supply_core.c 2007-08-23 12:13:52.000000000 +0200 | ||
| 2206 | @@ -0,0 +1,168 @@ | ||
| 2207 | +/* | ||
| 2208 | + * Universal power supply monitor class | ||
| 2209 | + * | ||
| 2210 | + * Copyright (c) 2007 Anton Vorontsov <cbou@mail.ru> | ||
| 2211 | + * Copyright (c) 2004 Szabolcs Gyurko | ||
| 2212 | + * Copyright (c) 2003 Ian Molton <spyro@f2s.com> | ||
| 2213 | + * | ||
| 2214 | + * Modified: 2004, Oct Szabolcs Gyurko | ||
| 2215 | + * | ||
| 2216 | + * You may use this code as per GPL version 2 | ||
| 2217 | + */ | ||
| 2218 | + | ||
| 2219 | +#include <linux/module.h> | ||
| 2220 | +#include <linux/types.h> | ||
| 2221 | +#include <linux/init.h> | ||
| 2222 | +#include <linux/device.h> | ||
| 2223 | +#include <linux/err.h> | ||
| 2224 | +#include <linux/power_supply.h> | ||
| 2225 | +#include "power_supply.h" | ||
| 2226 | + | ||
| 2227 | +struct class *power_supply_class; | ||
| 2228 | + | ||
| 2229 | +static void power_supply_changed_work(struct work_struct *work) | ||
| 2230 | +{ | ||
| 2231 | + struct power_supply *psy = container_of(work, struct power_supply, | ||
| 2232 | + changed_work); | ||
| 2233 | + int i; | ||
| 2234 | + | ||
| 2235 | + dev_dbg(psy->dev, "%s\n", __FUNCTION__); | ||
| 2236 | + | ||
| 2237 | + for (i = 0; i < psy->num_supplicants; i++) { | ||
| 2238 | + struct device *dev; | ||
| 2239 | + | ||
| 2240 | + down(&power_supply_class->sem); | ||
| 2241 | + list_for_each_entry(dev, &power_supply_class->devices, node) { | ||
| 2242 | + struct power_supply *pst = dev_get_drvdata(dev); | ||
| 2243 | + | ||
| 2244 | + if (!strcmp(psy->supplied_to[i], pst->name)) { | ||
| 2245 | + if (pst->external_power_changed) | ||
| 2246 | + pst->external_power_changed(pst); | ||
| 2247 | + } | ||
| 2248 | + } | ||
| 2249 | + up(&power_supply_class->sem); | ||
| 2250 | + } | ||
| 2251 | + | ||
| 2252 | + power_supply_update_leds(psy); | ||
| 2253 | + | ||
| 2254 | + kobject_uevent(&psy->dev->kobj, KOBJ_CHANGE); | ||
| 2255 | + | ||
| 2256 | + return; | ||
| 2257 | +} | ||
| 2258 | + | ||
| 2259 | +void power_supply_changed(struct power_supply *psy) | ||
| 2260 | +{ | ||
| 2261 | + dev_dbg(psy->dev, "%s\n", __FUNCTION__); | ||
| 2262 | + | ||
| 2263 | + schedule_work(&psy->changed_work); | ||
| 2264 | + | ||
| 2265 | + return; | ||
| 2266 | +} | ||
| 2267 | + | ||
| 2268 | +int power_supply_am_i_supplied(struct power_supply *psy) | ||
| 2269 | +{ | ||
| 2270 | + union power_supply_propval ret = {0,}; | ||
| 2271 | + struct device *dev; | ||
| 2272 | + | ||
| 2273 | + down(&power_supply_class->sem); | ||
| 2274 | + list_for_each_entry(dev, &power_supply_class->devices, node) { | ||
| 2275 | + struct power_supply *epsy = dev_get_drvdata(dev); | ||
| 2276 | + int i; | ||
| 2277 | + | ||
| 2278 | + for (i = 0; i < epsy->num_supplicants; i++) { | ||
| 2279 | + if (!strcmp(epsy->supplied_to[i], psy->name)) { | ||
| 2280 | + if (epsy->get_property(epsy, | ||
| 2281 | + POWER_SUPPLY_PROP_ONLINE, &ret)) | ||
| 2282 | + continue; | ||
| 2283 | + if (ret.intval) | ||
| 2284 | + goto out; | ||
| 2285 | + } | ||
| 2286 | + } | ||
| 2287 | + } | ||
| 2288 | +out: | ||
| 2289 | + up(&power_supply_class->sem); | ||
| 2290 | + | ||
| 2291 | + dev_dbg(psy->dev, "%s %d\n", __FUNCTION__, ret.intval); | ||
| 2292 | + | ||
| 2293 | + return ret.intval; | ||
| 2294 | +} | ||
| 2295 | + | ||
| 2296 | +int power_supply_register(struct device *parent, struct power_supply *psy) | ||
| 2297 | +{ | ||
| 2298 | + int rc = 0; | ||
| 2299 | + | ||
| 2300 | + psy->dev = device_create(power_supply_class, parent, 0, | ||
| 2301 | + "%s", psy->name); | ||
| 2302 | + if (IS_ERR(psy->dev)) { | ||
| 2303 | + rc = PTR_ERR(psy->dev); | ||
| 2304 | + goto dev_create_failed; | ||
| 2305 | + } | ||
| 2306 | + | ||
| 2307 | + dev_set_drvdata(psy->dev, psy); | ||
| 2308 | + | ||
| 2309 | + INIT_WORK(&psy->changed_work, power_supply_changed_work); | ||
| 2310 | + | ||
| 2311 | + rc = power_supply_create_attrs(psy); | ||
| 2312 | + if (rc) | ||
| 2313 | + goto create_attrs_failed; | ||
| 2314 | + | ||
| 2315 | + rc = power_supply_create_triggers(psy); | ||
| 2316 | + if (rc) | ||
| 2317 | + goto create_triggers_failed; | ||
| 2318 | + | ||
| 2319 | + power_supply_changed(psy); | ||
| 2320 | + | ||
| 2321 | + goto success; | ||
| 2322 | + | ||
| 2323 | +create_triggers_failed: | ||
| 2324 | + power_supply_remove_attrs(psy); | ||
| 2325 | +create_attrs_failed: | ||
| 2326 | + device_unregister(psy->dev); | ||
| 2327 | +dev_create_failed: | ||
| 2328 | +success: | ||
| 2329 | + return rc; | ||
| 2330 | +} | ||
| 2331 | + | ||
| 2332 | +void power_supply_unregister(struct power_supply *psy) | ||
| 2333 | +{ | ||
| 2334 | + flush_scheduled_work(); | ||
| 2335 | + power_supply_remove_triggers(psy); | ||
| 2336 | + power_supply_remove_attrs(psy); | ||
| 2337 | + device_unregister(psy->dev); | ||
| 2338 | + return; | ||
| 2339 | +} | ||
| 2340 | + | ||
| 2341 | +static int __init power_supply_class_init(void) | ||
| 2342 | +{ | ||
| 2343 | + power_supply_class = class_create(THIS_MODULE, "power_supply"); | ||
| 2344 | + | ||
| 2345 | + if (IS_ERR(power_supply_class)) | ||
| 2346 | + return PTR_ERR(power_supply_class); | ||
| 2347 | + | ||
| 2348 | + power_supply_class->dev_uevent = power_supply_uevent; | ||
| 2349 | + | ||
| 2350 | + return 0; | ||
| 2351 | +} | ||
| 2352 | + | ||
| 2353 | +static void __exit power_supply_class_exit(void) | ||
| 2354 | +{ | ||
| 2355 | + class_destroy(power_supply_class); | ||
| 2356 | + return; | ||
| 2357 | +} | ||
| 2358 | + | ||
| 2359 | +EXPORT_SYMBOL_GPL(power_supply_changed); | ||
| 2360 | +EXPORT_SYMBOL_GPL(power_supply_am_i_supplied); | ||
| 2361 | +EXPORT_SYMBOL_GPL(power_supply_register); | ||
| 2362 | +EXPORT_SYMBOL_GPL(power_supply_unregister); | ||
| 2363 | + | ||
| 2364 | +/* exported for the APM Power driver, APM emulation */ | ||
| 2365 | +EXPORT_SYMBOL_GPL(power_supply_class); | ||
| 2366 | + | ||
| 2367 | +subsys_initcall(power_supply_class_init); | ||
| 2368 | +module_exit(power_supply_class_exit); | ||
| 2369 | + | ||
| 2370 | +MODULE_DESCRIPTION("Universal power supply monitor class"); | ||
| 2371 | +MODULE_AUTHOR("Ian Molton <spyro@f2s.com>, " | ||
| 2372 | + "Szabolcs Gyurko, " | ||
| 2373 | + "Anton Vorontsov <cbou@mail.ru>"); | ||
| 2374 | +MODULE_LICENSE("GPL"); | ||
| 2375 | Index: linux-2.6.22/drivers/power/power_supply.h | ||
| 2376 | =================================================================== | ||
| 2377 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 2378 | +++ linux-2.6.22/drivers/power/power_supply.h 2007-08-23 12:13:52.000000000 +0200 | ||
| 2379 | @@ -0,0 +1,42 @@ | ||
| 2380 | +/* | ||
| 2381 | + * Functions private to power supply class | ||
| 2382 | + * | ||
| 2383 | + * Copyright (c) 2007 Anton Vorontsov <cbou@mail.ru> | ||
| 2384 | + * Copyright (c) 2004 Szabolcs Gyurko | ||
| 2385 | + * Copyright (c) 2003 Ian Molton <spyro@f2s.com> | ||
| 2386 | + * | ||
| 2387 | + * Modified: 2004, Oct Szabolcs Gyurko | ||
| 2388 | + * | ||
| 2389 | + * You may use this code as per GPL version 2 | ||
| 2390 | + */ | ||
| 2391 | + | ||
| 2392 | +#ifdef CONFIG_SYSFS | ||
| 2393 | + | ||
| 2394 | +extern int power_supply_create_attrs(struct power_supply *psy); | ||
| 2395 | +extern void power_supply_remove_attrs(struct power_supply *psy); | ||
| 2396 | +extern int power_supply_uevent(struct device *dev, char **envp, int num_envp, | ||
| 2397 | + char *buffer, int buffer_size); | ||
| 2398 | + | ||
| 2399 | +#else | ||
| 2400 | + | ||
| 2401 | +static inline int power_supply_create_attrs(struct power_supply *psy) | ||
| 2402 | +{ return 0; } | ||
| 2403 | +static inline void power_supply_remove_attrs(struct power_supply *psy) {} | ||
| 2404 | +#define power_supply_uevent NULL | ||
| 2405 | + | ||
| 2406 | +#endif /* CONFIG_SYSFS */ | ||
| 2407 | + | ||
| 2408 | +#ifdef CONFIG_LEDS_TRIGGERS | ||
| 2409 | + | ||
| 2410 | +extern void power_supply_update_leds(struct power_supply *psy); | ||
| 2411 | +extern int power_supply_create_triggers(struct power_supply *psy); | ||
| 2412 | +extern void power_supply_remove_triggers(struct power_supply *psy); | ||
| 2413 | + | ||
| 2414 | +#else | ||
| 2415 | + | ||
| 2416 | +static inline void power_supply_update_leds(struct power_supply *psy) {} | ||
| 2417 | +static inline int power_supply_create_triggers(struct power_supply *psy) | ||
| 2418 | +{ return 0; } | ||
| 2419 | +static inline void power_supply_remove_triggers(struct power_supply *psy) {} | ||
| 2420 | + | ||
| 2421 | +#endif /* CONFIG_LEDS_TRIGGERS */ | ||
| 2422 | Index: linux-2.6.22/drivers/power/power_supply_leds.c | ||
| 2423 | =================================================================== | ||
| 2424 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 2425 | +++ linux-2.6.22/drivers/power/power_supply_leds.c 2007-08-23 12:13:52.000000000 +0200 | ||
| 2426 | @@ -0,0 +1,188 @@ | ||
| 2427 | +/* | ||
| 2428 | + * LEDs triggers for power supply class | ||
| 2429 | + * | ||
| 2430 | + * Copyright (c) 2007 Anton Vorontsov <cbou@mail.ru> | ||
| 2431 | + * Copyright (c) 2004 Szabolcs Gyurko | ||
| 2432 | + * Copyright (c) 2003 Ian Molton <spyro@f2s.com> | ||
| 2433 | + * | ||
| 2434 | + * Modified: 2004, Oct Szabolcs Gyurko | ||
| 2435 | + * | ||
| 2436 | + * You may use this code as per GPL version 2 | ||
| 2437 | + */ | ||
| 2438 | + | ||
| 2439 | +#include <linux/power_supply.h> | ||
| 2440 | + | ||
| 2441 | +/* If we have hwtimer trigger, then use it to blink charging LED */ | ||
| 2442 | + | ||
| 2443 | +#if defined(CONFIG_LEDS_TRIGGER_HWTIMER) || \ | ||
| 2444 | + (defined(CONFIG_BATTERY_MODULE) && \ | ||
| 2445 | + defined(CONFIG_LEDS_TRIGGER_HWTIMER_MODULE)) | ||
| 2446 | + #define led_trigger_register_charging led_trigger_register_hwtimer | ||
| 2447 | + #define led_trigger_unregister_charging led_trigger_unregister_hwtimer | ||
| 2448 | +#else | ||
| 2449 | + #define led_trigger_register_charging led_trigger_register_simple | ||
| 2450 | + #define led_trigger_unregister_charging led_trigger_unregister_simple | ||
| 2451 | +#endif | ||
| 2452 | + | ||
| 2453 | +/* Battery specific LEDs triggers. */ | ||
| 2454 | + | ||
| 2455 | +static void power_supply_update_bat_leds(struct power_supply *psy) | ||
| 2456 | +{ | ||
| 2457 | + union power_supply_propval status; | ||
| 2458 | + | ||
| 2459 | + if (psy->get_property(psy, POWER_SUPPLY_PROP_STATUS, &status)) | ||
| 2460 | + return; | ||
| 2461 | + | ||
| 2462 | + dev_dbg(psy->dev, "%s %d\n", __FUNCTION__, status.intval); | ||
| 2463 | + | ||
| 2464 | + switch(status.intval) { | ||
| 2465 | + case POWER_SUPPLY_STATUS_FULL: | ||
| 2466 | + led_trigger_event(psy->charging_full_trig, LED_FULL); | ||
| 2467 | + led_trigger_event(psy->charging_trig, LED_OFF); | ||
| 2468 | + led_trigger_event(psy->full_trig, LED_FULL); | ||
| 2469 | + break; | ||
| 2470 | + case POWER_SUPPLY_STATUS_CHARGING: | ||
| 2471 | + led_trigger_event(psy->charging_full_trig, LED_FULL); | ||
| 2472 | + led_trigger_event(psy->charging_trig, LED_FULL); | ||
| 2473 | + led_trigger_event(psy->full_trig, LED_OFF); | ||
| 2474 | + break; | ||
| 2475 | + default: | ||
| 2476 | + led_trigger_event(psy->charging_full_trig, LED_OFF); | ||
| 2477 | + led_trigger_event(psy->charging_trig, LED_OFF); | ||
| 2478 | + led_trigger_event(psy->full_trig, LED_OFF); | ||
| 2479 | + break; | ||
| 2480 | + } | ||
| 2481 | + | ||
| 2482 | + return; | ||
| 2483 | +} | ||
| 2484 | + | ||
| 2485 | +static int power_supply_create_bat_triggers(struct power_supply *psy) | ||
| 2486 | +{ | ||
| 2487 | + int rc = 0; | ||
| 2488 | + | ||
| 2489 | + psy->charging_full_trig_name = kmalloc(strlen(psy->name) + | ||
| 2490 | + sizeof("-charging-or-full"), GFP_KERNEL); | ||
| 2491 | + if (!psy->charging_full_trig_name) | ||
| 2492 | + goto charging_full_failed; | ||
| 2493 | + | ||
| 2494 | + psy->charging_trig_name = kmalloc(strlen(psy->name) + | ||
| 2495 | + sizeof("-charging"), GFP_KERNEL); | ||
| 2496 | + if (!psy->charging_trig_name) | ||
| 2497 | + goto charging_failed; | ||
| 2498 | + | ||
| 2499 | + psy->full_trig_name = kmalloc(strlen(psy->name) + | ||
| 2500 | + sizeof("-full"), GFP_KERNEL); | ||
| 2501 | + if (!psy->full_trig_name) | ||
| 2502 | + goto full_failed; | ||
| 2503 | + | ||
| 2504 | + strcpy(psy->charging_full_trig_name, psy->name); | ||
| 2505 | + strcat(psy->charging_full_trig_name, "-charging-or-full"); | ||
| 2506 | + strcpy(psy->charging_trig_name, psy->name); | ||
| 2507 | + strcat(psy->charging_trig_name, "-charging"); | ||
| 2508 | + strcpy(psy->full_trig_name, psy->name); | ||
| 2509 | + strcat(psy->full_trig_name, "-full"); | ||
| 2510 | + | ||
| 2511 | + led_trigger_register_simple(psy->charging_full_trig_name, | ||
| 2512 | + &psy->charging_full_trig); | ||
| 2513 | + led_trigger_register_charging(psy->charging_trig_name, | ||
| 2514 | + &psy->charging_trig); | ||
| 2515 | + led_trigger_register_simple(psy->full_trig_name, | ||
| 2516 | + &psy->full_trig); | ||
| 2517 | + | ||
| 2518 | + goto success; | ||
| 2519 | + | ||
| 2520 | +full_failed: | ||
| 2521 | + kfree(psy->charging_trig_name); | ||
| 2522 | +charging_failed: | ||
| 2523 | + kfree(psy->charging_full_trig_name); | ||
| 2524 | +charging_full_failed: | ||
| 2525 | + rc = -ENOMEM; | ||
| 2526 | +success: | ||
| 2527 | + return rc; | ||
| 2528 | +} | ||
| 2529 | + | ||
| 2530 | +static void power_supply_remove_bat_triggers(struct power_supply *psy) | ||
| 2531 | +{ | ||
| 2532 | + led_trigger_unregister_simple(psy->charging_full_trig); | ||
| 2533 | + led_trigger_unregister_charging(psy->charging_trig); | ||
| 2534 | + led_trigger_unregister_simple(psy->full_trig); | ||
| 2535 | + kfree(psy->full_trig_name); | ||
| 2536 | + kfree(psy->charging_trig_name); | ||
| 2537 | + kfree(psy->charging_full_trig_name); | ||
| 2538 | + return; | ||
| 2539 | +} | ||
| 2540 | + | ||
| 2541 | +/* Generated power specific LEDs triggers. */ | ||
| 2542 | + | ||
| 2543 | +static void power_supply_update_gen_leds(struct power_supply *psy) | ||
| 2544 | +{ | ||
| 2545 | + union power_supply_propval online; | ||
| 2546 | + | ||
| 2547 | + if (psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &online)) | ||
| 2548 | + return; | ||
| 2549 | + | ||
| 2550 | + dev_dbg(psy->dev, "%s %d\n", __FUNCTION__, online.intval); | ||
| 2551 | + | ||
| 2552 | + if (online.intval) | ||
| 2553 | + led_trigger_event(psy->online_trig, LED_FULL); | ||
| 2554 | + else | ||
| 2555 | + led_trigger_event(psy->online_trig, LED_OFF); | ||
| 2556 | + | ||
| 2557 | + return; | ||
| 2558 | +} | ||
| 2559 | + | ||
| 2560 | +static int power_supply_create_gen_triggers(struct power_supply *psy) | ||
| 2561 | +{ | ||
| 2562 | + int rc = 0; | ||
| 2563 | + | ||
| 2564 | + psy->online_trig_name = kmalloc(strlen(psy->name) + sizeof("-online"), | ||
| 2565 | + GFP_KERNEL); | ||
| 2566 | + if (!psy->online_trig_name) | ||
| 2567 | + goto online_failed; | ||
| 2568 | + | ||
| 2569 | + strcpy(psy->online_trig_name, psy->name); | ||
| 2570 | + strcat(psy->online_trig_name, "-online"); | ||
| 2571 | + | ||
| 2572 | + led_trigger_register_simple(psy->online_trig_name, &psy->online_trig); | ||
| 2573 | + | ||
| 2574 | + goto success; | ||
| 2575 | + | ||
| 2576 | +online_failed: | ||
| 2577 | + rc = -ENOMEM; | ||
| 2578 | +success: | ||
| 2579 | + return rc; | ||
| 2580 | +} | ||
| 2581 | + | ||
| 2582 | +static void power_supply_remove_gen_triggers(struct power_supply *psy) | ||
| 2583 | +{ | ||
| 2584 | + led_trigger_unregister_simple(psy->online_trig); | ||
| 2585 | + kfree(psy->online_trig_name); | ||
| 2586 | + return; | ||
| 2587 | +} | ||
| 2588 | + | ||
| 2589 | +/* Choice what triggers to create&update. */ | ||
| 2590 | + | ||
| 2591 | +void power_supply_update_leds(struct power_supply *psy) | ||
| 2592 | +{ | ||
| 2593 | + if (psy->type == POWER_SUPPLY_TYPE_BATTERY) | ||
| 2594 | + power_supply_update_bat_leds(psy); | ||
| 2595 | + else | ||
| 2596 | + power_supply_update_gen_leds(psy); | ||
| 2597 | + return; | ||
| 2598 | +} | ||
| 2599 | + | ||
| 2600 | +int power_supply_create_triggers(struct power_supply *psy) | ||
| 2601 | +{ | ||
| 2602 | + if (psy->type == POWER_SUPPLY_TYPE_BATTERY) | ||
| 2603 | + return power_supply_create_bat_triggers(psy); | ||
| 2604 | + return power_supply_create_gen_triggers(psy); | ||
| 2605 | +} | ||
| 2606 | + | ||
| 2607 | +void power_supply_remove_triggers(struct power_supply *psy) | ||
| 2608 | +{ | ||
| 2609 | + if (psy->type == POWER_SUPPLY_TYPE_BATTERY) | ||
| 2610 | + power_supply_remove_bat_triggers(psy); | ||
| 2611 | + else | ||
| 2612 | + power_supply_remove_gen_triggers(psy); | ||
| 2613 | + return; | ||
| 2614 | +} | ||
| 2615 | Index: linux-2.6.22/drivers/power/power_supply_sysfs.c | ||
| 2616 | =================================================================== | ||
| 2617 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 2618 | +++ linux-2.6.22/drivers/power/power_supply_sysfs.c 2007-08-23 12:13:52.000000000 +0200 | ||
| 2619 | @@ -0,0 +1,289 @@ | ||
| 2620 | +/* | ||
| 2621 | + * Sysfs interface for the universal power supply monitor class | ||
| 2622 | + * | ||
| 2623 | + * Copyright © 2007 David Woodhouse <dwmw2@infradead.org> | ||
| 2624 | + * Copyright (c) 2007 Anton Vorontsov <cbou@mail.ru> | ||
| 2625 | + * Copyright (c) 2004 Szabolcs Gyurko | ||
| 2626 | + * Copyright (c) 2003 Ian Molton <spyro@f2s.com> | ||
| 2627 | + * | ||
| 2628 | + * Modified: 2004, Oct Szabolcs Gyurko | ||
| 2629 | + * | ||
| 2630 | + * You may use this code as per GPL version 2 | ||
| 2631 | + */ | ||
| 2632 | + | ||
| 2633 | +#include <linux/ctype.h> | ||
| 2634 | +#include <linux/power_supply.h> | ||
| 2635 | + | ||
| 2636 | +/* | ||
| 2637 | + * This is because the name "current" breaks the device attr macro. | ||
| 2638 | + * The "current" word resolvs to "(get_current())" so instead of | ||
| 2639 | + * "current" "(get_current())" appears in the sysfs. | ||
| 2640 | + * | ||
| 2641 | + * The source of this definition is the device.h which calls __ATTR | ||
| 2642 | + * macro in sysfs.h which calls the __stringify macro. | ||
| 2643 | + * | ||
| 2644 | + * Only modification that the name is not tried to be resolved | ||
| 2645 | + * (as a macro let's say). | ||
| 2646 | + */ | ||
| 2647 | + | ||
| 2648 | +#define POWER_SUPPLY_ATTR(_name) \ | ||
| 2649 | +{ \ | ||
| 2650 | + .attr = { .name = #_name, .mode = 0444, .owner = THIS_MODULE }, \ | ||
| 2651 | + .show = power_supply_show_property, \ | ||
| 2652 | + .store = NULL, \ | ||
| 2653 | +} | ||
| 2654 | + | ||
| 2655 | +static struct device_attribute power_supply_attrs[]; | ||
| 2656 | + | ||
| 2657 | +static ssize_t power_supply_show_property(struct device *dev, | ||
| 2658 | + struct device_attribute *attr, | ||
| 2659 | + char *buf) { | ||
| 2660 | + static char *status_text[] = { | ||
| 2661 | + "Unknown", "Charging", "Discharging", "Not charging", "Full" | ||
| 2662 | + }; | ||
| 2663 | + static char *health_text[] = { | ||
| 2664 | + "Unknown", "Good", "Overheat", "Dead" | ||
| 2665 | + }; | ||
| 2666 | + static char *technology_text[] = { | ||
| 2667 | + "Unknown", "NiMH", "Li-ion", "Li-poly" | ||
| 2668 | + }; | ||
| 2669 | + static char *capacity_level_text[] = { | ||
| 2670 | + "Unknown", "Critical", "Low", "Normal", "High", "Full" | ||
| 2671 | + }; | ||
| 2672 | + ssize_t ret; | ||
| 2673 | + struct power_supply *psy = dev_get_drvdata(dev); | ||
| 2674 | + const ptrdiff_t off = attr - power_supply_attrs; | ||
| 2675 | + union power_supply_propval value; | ||
| 2676 | + | ||
| 2677 | + ret = psy->get_property(psy, off, &value); | ||
| 2678 | + | ||
| 2679 | + if (ret < 0) { | ||
| 2680 | + dev_err(dev, "driver failed to report `%s' property\n", | ||
| 2681 | + attr->attr.name); | ||
| 2682 | + return ret; | ||
| 2683 | + } | ||
| 2684 | + | ||
| 2685 | + if (off == POWER_SUPPLY_PROP_STATUS) | ||
| 2686 | + return sprintf(buf, "%s\n", status_text[value.intval]); | ||
| 2687 | + else if (off == POWER_SUPPLY_PROP_HEALTH) | ||
| 2688 | + return sprintf(buf, "%s\n", health_text[value.intval]); | ||
| 2689 | + else if (off == POWER_SUPPLY_PROP_TECHNOLOGY) | ||
| 2690 | + return sprintf(buf, "%s\n", technology_text[value.intval]); | ||
| 2691 | + else if (off == POWER_SUPPLY_PROP_CAPACITY_LEVEL) | ||
| 2692 | + return sprintf(buf, "%s\n", | ||
| 2693 | + capacity_level_text[value.intval]); | ||
| 2694 | + else if (off == POWER_SUPPLY_PROP_MODEL_NAME) | ||
| 2695 | + return sprintf(buf, "%s\n", value.strval); | ||
| 2696 | + | ||
| 2697 | + return sprintf(buf, "%d\n", value.intval); | ||
| 2698 | +} | ||
| 2699 | + | ||
| 2700 | +/* Must be in the same order as POWER_SUPPLY_PROP_* */ | ||
| 2701 | +static struct device_attribute power_supply_attrs[] = { | ||
| 2702 | + /* Properties of type `int' */ | ||
| 2703 | + POWER_SUPPLY_ATTR(status), | ||
| 2704 | + POWER_SUPPLY_ATTR(health), | ||
| 2705 | + POWER_SUPPLY_ATTR(present), | ||
| 2706 | + POWER_SUPPLY_ATTR(online), | ||
| 2707 | + POWER_SUPPLY_ATTR(technology), | ||
| 2708 | + POWER_SUPPLY_ATTR(voltage_max_design), | ||
| 2709 | + POWER_SUPPLY_ATTR(voltage_min_design), | ||
| 2710 | + POWER_SUPPLY_ATTR(voltage_now), | ||
| 2711 | + POWER_SUPPLY_ATTR(voltage_avg), | ||
| 2712 | + POWER_SUPPLY_ATTR(current_now), | ||
| 2713 | + POWER_SUPPLY_ATTR(current_avg), | ||
| 2714 | + POWER_SUPPLY_ATTR(charge_full_design), | ||
| 2715 | + POWER_SUPPLY_ATTR(charge_empty_design), | ||
| 2716 | + POWER_SUPPLY_ATTR(charge_full), | ||
| 2717 | + POWER_SUPPLY_ATTR(charge_empty), | ||
| 2718 | + POWER_SUPPLY_ATTR(charge_now), | ||
| 2719 | + POWER_SUPPLY_ATTR(charge_avg), | ||
| 2720 | + POWER_SUPPLY_ATTR(energy_full_design), | ||
| 2721 | + POWER_SUPPLY_ATTR(energy_empty_design), | ||
| 2722 | + POWER_SUPPLY_ATTR(energy_full), | ||
| 2723 | + POWER_SUPPLY_ATTR(energy_empty), | ||
| 2724 | + POWER_SUPPLY_ATTR(energy_now), | ||
| 2725 | + POWER_SUPPLY_ATTR(energy_avg), | ||
| 2726 | + POWER_SUPPLY_ATTR(capacity), | ||
| 2727 | + POWER_SUPPLY_ATTR(capacity_level), | ||
| 2728 | + POWER_SUPPLY_ATTR(temp), | ||
| 2729 | + POWER_SUPPLY_ATTR(temp_ambient), | ||
| 2730 | + POWER_SUPPLY_ATTR(time_to_empty_now), | ||
| 2731 | + POWER_SUPPLY_ATTR(time_to_empty_avg), | ||
| 2732 | + POWER_SUPPLY_ATTR(time_to_full_now), | ||
| 2733 | + POWER_SUPPLY_ATTR(time_to_full_avg), | ||
| 2734 | + /* Properties of type `const char *' */ | ||
| 2735 | + POWER_SUPPLY_ATTR(model_name), | ||
| 2736 | +}; | ||
| 2737 | + | ||
| 2738 | +static ssize_t power_supply_show_static_attrs(struct device *dev, | ||
| 2739 | + struct device_attribute *attr, | ||
| 2740 | + char *buf) { | ||
| 2741 | + static char *type_text[] = { "Battery", "UPS", "Mains", "USB" }; | ||
| 2742 | + struct power_supply *psy = dev_get_drvdata(dev); | ||
| 2743 | + | ||
| 2744 | + return sprintf(buf, "%s\n", type_text[psy->type]); | ||
| 2745 | +} | ||
| 2746 | + | ||
| 2747 | +static struct device_attribute power_supply_static_attrs[] = { | ||
| 2748 | + __ATTR(type, 0444, power_supply_show_static_attrs, NULL), | ||
| 2749 | +}; | ||
| 2750 | + | ||
| 2751 | +int power_supply_create_attrs(struct power_supply *psy) | ||
| 2752 | +{ | ||
| 2753 | + int rc = 0; | ||
| 2754 | + int i, j; | ||
| 2755 | + | ||
| 2756 | + for (i = 0; i < ARRAY_SIZE(power_supply_static_attrs); i++) { | ||
| 2757 | + rc = device_create_file(psy->dev, | ||
| 2758 | + &power_supply_static_attrs[i]); | ||
| 2759 | + if (rc) | ||
| 2760 | + goto statics_failed; | ||
| 2761 | + } | ||
| 2762 | + | ||
| 2763 | + for (j = 0; j < psy->num_properties; j++) { | ||
| 2764 | + rc = device_create_file(psy->dev, | ||
| 2765 | + &power_supply_attrs[psy->properties[j]]); | ||
| 2766 | + if (rc) | ||
| 2767 | + goto dynamics_failed; | ||
| 2768 | + } | ||
| 2769 | + | ||
| 2770 | + goto succeed; | ||
| 2771 | + | ||
| 2772 | +dynamics_failed: | ||
| 2773 | + while (j--) | ||
| 2774 | + device_remove_file(psy->dev, | ||
| 2775 | + &power_supply_attrs[psy->properties[j]]); | ||
| 2776 | +statics_failed: | ||
| 2777 | + while (i--) | ||
| 2778 | + device_remove_file(psy->dev, | ||
| 2779 | + &power_supply_static_attrs[psy->properties[i]]); | ||
| 2780 | +succeed: | ||
| 2781 | + return rc; | ||
| 2782 | +} | ||
| 2783 | + | ||
| 2784 | +void power_supply_remove_attrs(struct power_supply *psy) | ||
| 2785 | +{ | ||
| 2786 | + int i; | ||
| 2787 | + | ||
| 2788 | + for (i = 0; i < ARRAY_SIZE(power_supply_static_attrs); i++) | ||
| 2789 | + device_remove_file(psy->dev, | ||
| 2790 | + &power_supply_static_attrs[i]); | ||
| 2791 | + | ||
| 2792 | + for (i = 0; i < psy->num_properties; i++) | ||
| 2793 | + device_remove_file(psy->dev, | ||
| 2794 | + &power_supply_attrs[psy->properties[i]]); | ||
| 2795 | + | ||
| 2796 | + return; | ||
| 2797 | +} | ||
| 2798 | + | ||
| 2799 | +static char *kstruprdup(const char *str, gfp_t gfp) | ||
| 2800 | +{ | ||
| 2801 | + char *ret, *ustr; | ||
| 2802 | + | ||
| 2803 | + ustr = ret = kmalloc(strlen(str) + 1, gfp); | ||
| 2804 | + | ||
| 2805 | + if (!ret) | ||
| 2806 | + return NULL; | ||
| 2807 | + | ||
| 2808 | + while (*str) | ||
| 2809 | + *ustr++ = toupper(*str++); | ||
| 2810 | + | ||
| 2811 | + *ustr = 0; | ||
| 2812 | + | ||
| 2813 | + return ret; | ||
| 2814 | +} | ||
| 2815 | + | ||
| 2816 | +int power_supply_uevent(struct device *dev, char **envp, int num_envp, | ||
| 2817 | + char *buffer, int buffer_size) | ||
| 2818 | +{ | ||
| 2819 | + struct power_supply *psy = dev_get_drvdata(dev); | ||
| 2820 | + int i = 0, length = 0, ret = 0, j; | ||
| 2821 | + char *prop_buf; | ||
| 2822 | + char *attrname; | ||
| 2823 | + | ||
| 2824 | + dev_dbg(dev, "uevent\n"); | ||
| 2825 | + | ||
| 2826 | + if (!psy) { | ||
| 2827 | + dev_dbg(dev, "No power supply yet\n"); | ||
| 2828 | + return ret; | ||
| 2829 | + } | ||
| 2830 | + | ||
| 2831 | + dev_dbg(dev, "POWER_SUPPLY_NAME=%s\n", psy->name); | ||
| 2832 | + | ||
| 2833 | + ret = add_uevent_var(envp, num_envp, &i, buffer, buffer_size, | ||
| 2834 | + &length, "POWER_SUPPLY_NAME=%s", psy->name); | ||
| 2835 | + if (ret) | ||
| 2836 | + return ret; | ||
| 2837 | + | ||
| 2838 | + prop_buf = (char *)get_zeroed_page(GFP_KERNEL); | ||
| 2839 | + if (!prop_buf) | ||
| 2840 | + return -ENOMEM; | ||
| 2841 | + | ||
| 2842 | + for (j = 0; j < ARRAY_SIZE(power_supply_static_attrs); j++) { | ||
| 2843 | + struct device_attribute *attr; | ||
| 2844 | + char *line; | ||
| 2845 | + | ||
| 2846 | + attr = &power_supply_static_attrs[j]; | ||
| 2847 | + | ||
| 2848 | + ret = power_supply_show_static_attrs(dev, attr, prop_buf); | ||
| 2849 | + if (ret < 0) | ||
| 2850 | + goto out; | ||
| 2851 | + | ||
| 2852 | + line = strchr(prop_buf, '\n'); | ||
| 2853 | + if (line) | ||
| 2854 | + *line = 0; | ||
| 2855 | + | ||
| 2856 | + attrname = kstruprdup(attr->attr.name, GFP_KERNEL); | ||
| 2857 | + if (!attrname) { | ||
| 2858 | + ret = -ENOMEM; | ||
| 2859 | + goto out; | ||
| 2860 | + } | ||
| 2861 | + | ||
| 2862 | + dev_dbg(dev, "Static prop %s=%s\n", attrname, prop_buf); | ||
| 2863 | + | ||
| 2864 | + ret = add_uevent_var(envp, num_envp, &i, buffer, buffer_size, | ||
| 2865 | + &length, "POWER_SUPPLY_%s=%s", | ||
| 2866 | + attrname, prop_buf); | ||
| 2867 | + kfree(attrname); | ||
| 2868 | + if (ret) | ||
| 2869 | + goto out; | ||
| 2870 | + } | ||
| 2871 | + | ||
| 2872 | + dev_dbg(dev, "%zd dynamic props\n", psy->num_properties); | ||
| 2873 | + | ||
| 2874 | + for (j = 0; j < psy->num_properties; j++) { | ||
| 2875 | + struct device_attribute *attr; | ||
| 2876 | + char *line; | ||
| 2877 | + | ||
| 2878 | + attr = &power_supply_attrs[psy->properties[j]]; | ||
| 2879 | + | ||
| 2880 | + ret = power_supply_show_property(dev, attr, prop_buf); | ||
| 2881 | + if (ret < 0) | ||
| 2882 | + goto out; | ||
| 2883 | + | ||
| 2884 | + line = strchr(prop_buf, '\n'); | ||
| 2885 | + if (line) | ||
| 2886 | + *line = 0; | ||
| 2887 | + | ||
| 2888 | + attrname = kstruprdup(attr->attr.name, GFP_KERNEL); | ||
| 2889 | + if (!attrname) { | ||
| 2890 | + ret = -ENOMEM; | ||
| 2891 | + goto out; | ||
| 2892 | + } | ||
| 2893 | + | ||
| 2894 | + dev_dbg(dev, "prop %s=%s\n", attrname, prop_buf); | ||
| 2895 | + | ||
| 2896 | + ret = add_uevent_var(envp, num_envp, &i, buffer, buffer_size, | ||
| 2897 | + &length, "POWER_SUPPLY_%s=%s", | ||
| 2898 | + attrname, prop_buf); | ||
| 2899 | + kfree(attrname); | ||
| 2900 | + if (ret) | ||
| 2901 | + goto out; | ||
| 2902 | + } | ||
| 2903 | + | ||
| 2904 | +out: | ||
| 2905 | + free_page((unsigned long)prop_buf); | ||
| 2906 | + | ||
| 2907 | + return ret; | ||
| 2908 | +} | ||
| 2909 | Index: linux-2.6.22/drivers/power/simpad-battery.c | ||
| 2910 | =================================================================== | ||
| 2911 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 2912 | +++ linux-2.6.22/drivers/power/simpad-battery.c 2007-08-23 12:13:52.000000000 +0200 | ||
| 2913 | @@ -0,0 +1,242 @@ | ||
| 2914 | +/* | ||
| 2915 | + * linux/drivers/misc/simpad-battery.c | ||
| 2916 | + * | ||
| 2917 | + * Copyright (C) 2005 Holger Hans Peter Freyther | ||
| 2918 | + * Copyright (C) 2001 Juergen Messerer | ||
| 2919 | + * | ||
| 2920 | + * This program is free software; you can redistribute it and/or modify | ||
| 2921 | + * it under the terms of the GNU General Public License as published by | ||
| 2922 | + * the Free Software Foundation; either version 2 of the License. | ||
| 2923 | + * | ||
| 2924 | + * Read the Battery Level through the UCB1x00 chip. T-Sinuspad is | ||
| 2925 | + * unsupported for now. | ||
| 2926 | + * | ||
| 2927 | + */ | ||
| 2928 | + | ||
| 2929 | +#include <linux/battery.h> | ||
| 2930 | +#include <asm/dma.h> | ||
| 2931 | +#include "ucb1x00.h" | ||
| 2932 | + | ||
| 2933 | + | ||
| 2934 | +/* | ||
| 2935 | + * Conversion from AD -> mV | ||
| 2936 | + * 7.5V = 1023 7.3313mV/Digit | ||
| 2937 | + * | ||
| 2938 | + * 400 Units == 9.7V | ||
| 2939 | + * a = ADC value | ||
| 2940 | + * 21 = ADC error | ||
| 2941 | + * 12600 = Divident to get 2*7.3242 | ||
| 2942 | + * 860 = Divider to get 2*7.3242 | ||
| 2943 | + * 170 = Voltagedrop over | ||
| 2944 | + */ | ||
| 2945 | +#define CALIBRATE_BATTERY(a) ((((a + 21)*12600)/860) + 170) | ||
| 2946 | + | ||
| 2947 | +/* | ||
| 2948 | + * We have two types of batteries a small and a large one | ||
| 2949 | + * To get the right value we to distinguish between those two | ||
| 2950 | + * 450 Units == 15 V | ||
| 2951 | + */ | ||
| 2952 | +#define CALIBRATE_SUPPLY(a) (((a) * 1500) / 45) | ||
| 2953 | +#define MIN_SUPPLY 12000 /* Less then 12V means no powersupply */ | ||
| 2954 | + | ||
| 2955 | +/* | ||
| 2956 | + * Charging Current | ||
| 2957 | + * if value is >= 50 then charging is on | ||
| 2958 | + */ | ||
| 2959 | +#define CALIBRATE_CHARGING(a) (((a)* 1000)/(152/4))) | ||
| 2960 | + | ||
| 2961 | +struct simpad_battery_t { | ||
| 2962 | + struct battery battery; | ||
| 2963 | + struct ucb1x00* ucb; | ||
| 2964 | + | ||
| 2965 | + /* | ||
| 2966 | + * Variables for the values to one time support | ||
| 2967 | + * T-Sinuspad as well | ||
| 2968 | + */ | ||
| 2969 | + int min_voltage; | ||
| 2970 | + int min_current; | ||
| 2971 | + int min_charge; | ||
| 2972 | + | ||
| 2973 | + int max_voltage; | ||
| 2974 | + int max_current; | ||
| 2975 | + int max_charge; | ||
| 2976 | + | ||
| 2977 | + int min_supply; | ||
| 2978 | + int charging_led_label; | ||
| 2979 | + int charging_max_label; | ||
| 2980 | + int batt_full; | ||
| 2981 | + int batt_low; | ||
| 2982 | + int batt_critical; | ||
| 2983 | + int batt_empty; | ||
| 2984 | +}; | ||
| 2985 | + | ||
| 2986 | +static int simpad_get_min_voltage(struct battery* _battery ) | ||
| 2987 | +{ | ||
| 2988 | + struct simpad_battery_t* battery = (struct simpad_battery_t*)_battery; | ||
| 2989 | + return battery->min_voltage; | ||
| 2990 | +} | ||
| 2991 | + | ||
| 2992 | +static int simpad_get_min_current(struct battery* _battery) | ||
| 2993 | +{ | ||
| 2994 | + struct simpad_battery_t* battery = (struct simpad_battery_t*)_battery; | ||
| 2995 | + return battery->min_current; | ||
| 2996 | +} | ||
| 2997 | + | ||
| 2998 | +static int simpad_get_min_charge(struct battery* _battery) | ||
| 2999 | +{ | ||
| 3000 | + struct simpad_battery_t* battery = (struct simpad_battery_t*)_battery; | ||
| 3001 | + return battery->min_charge; | ||
| 3002 | +} | ||
| 3003 | + | ||
| 3004 | +static int simpad_get_max_voltage(struct battery* _battery) | ||
| 3005 | +{ | ||
| 3006 | + struct simpad_battery_t* battery = (struct simpad_battery_t*)_battery; | ||
| 3007 | + return battery->max_voltage; | ||
| 3008 | +} | ||
| 3009 | + | ||
| 3010 | +static int simpad_get_max_current(struct battery* _battery) | ||
| 3011 | +{ | ||
| 3012 | + struct simpad_battery_t* battery = (struct simpad_battery_t*)_battery; | ||
| 3013 | + return battery->max_current; | ||
| 3014 | +} | ||
| 3015 | + | ||
| 3016 | +static int simpad_get_max_charge(struct battery* _battery) | ||
| 3017 | +{ | ||
| 3018 | + struct simpad_battery_t* battery = (struct simpad_battery_t*)_battery; | ||
| 3019 | + return battery->max_charge; | ||
| 3020 | +} | ||
| 3021 | + | ||
| 3022 | +static int simpad_get_temp(struct battery* _battery) | ||
| 3023 | +{ | ||
| 3024 | + return 0; | ||
| 3025 | +} | ||
| 3026 | + | ||
| 3027 | +static int simpad_get_voltage(struct battery* _battery) | ||
| 3028 | +{ | ||
| 3029 | + int val; | ||
| 3030 | + struct simpad_battery_t* battery = (struct simpad_battery_t*)_battery; | ||
| 3031 | + | ||
| 3032 | + | ||
| 3033 | + ucb1x00_adc_enable(battery->ucb); | ||
| 3034 | + val = ucb1x00_adc_read(battery->ucb, UCB_ADC_INP_AD1, UCB_NOSYNC); | ||
| 3035 | + ucb1x00_adc_disable(battery->ucb); | ||
| 3036 | + | ||
| 3037 | + return CALIBRATE_BATTERY(val); | ||
| 3038 | +} | ||
| 3039 | + | ||
| 3040 | +static int simpad_get_current(struct battery* _battery) | ||
| 3041 | +{ | ||
| 3042 | + int val; | ||
| 3043 | + struct simpad_battery_t* battery = (struct simpad_battery_t*)_battery; | ||
| 3044 | + | ||
| 3045 | + ucb1x00_adc_enable(battery->ucb); | ||
| 3046 | + val = ucb1x00_adc_read(battery->ucb, UCB_ADC_INP_AD3, UCB_NOSYNC); | ||
| 3047 | + ucb1x00_adc_disable(battery->ucb); | ||
| 3048 | + | ||
| 3049 | + return val; | ||
| 3050 | +} | ||
| 3051 | + | ||
| 3052 | +static int simpad_get_charge(struct battery* _battery) | ||
| 3053 | +{ | ||
| 3054 | + int val; | ||
| 3055 | + struct simpad_battery_t* battery = (struct simpad_battery_t*)_battery; | ||
| 3056 | + | ||
| 3057 | + ucb1x00_adc_enable(battery->ucb); | ||
| 3058 | + val = ucb1x00_adc_read(battery->ucb, UCB_ADC_INP_AD2, UCB_NOSYNC); | ||
| 3059 | + ucb1x00_adc_disable(battery->ucb); | ||
| 3060 | + | ||
| 3061 | + return CALIBRATE_SUPPLY(val); | ||
| 3062 | + | ||
| 3063 | +} | ||
| 3064 | + | ||
| 3065 | +static int simpad_get_status(struct battery* _battery) | ||
| 3066 | +{ | ||
| 3067 | + struct simpad_battery_t* battery = (struct simpad_battery_t*)(_battery); | ||
| 3068 | + int vcharger = simpad_get_voltage(_battery); | ||
| 3069 | + int icharger = simpad_get_current(_battery); | ||
| 3070 | + | ||
| 3071 | + int status = BATTERY_STATUS_UNKNOWN; | ||
| 3072 | + if(icharger > battery->charging_led_label) | ||
| 3073 | + status = BATTERY_STATUS_CHARGING; | ||
| 3074 | + else if(vcharger > battery->min_supply) | ||
| 3075 | + status = BATTERY_STATUS_NOT_CHARGING; | ||
| 3076 | + else | ||
| 3077 | + status = BATTERY_STATUS_DISCHARGING; | ||
| 3078 | + | ||
| 3079 | + return status; | ||
| 3080 | +} | ||
| 3081 | + | ||
| 3082 | +static struct simpad_battery_t simpad_battery = { | ||
| 3083 | + .battery = { | ||
| 3084 | + .get_min_voltage = simpad_get_min_voltage, | ||
| 3085 | + .get_min_current = simpad_get_min_current, | ||
| 3086 | + .get_min_charge = simpad_get_min_charge, | ||
| 3087 | + .get_max_voltage = simpad_get_max_voltage, | ||
| 3088 | + .get_max_current = simpad_get_max_current, | ||
| 3089 | + .get_max_charge = simpad_get_max_charge, | ||
| 3090 | + .get_temp = simpad_get_temp, | ||
| 3091 | + .get_voltage = simpad_get_voltage, | ||
| 3092 | + .get_current = simpad_get_current, | ||
| 3093 | + .get_charge = simpad_get_charge, | ||
| 3094 | + .get_status = simpad_get_status, | ||
| 3095 | + }, | ||
| 3096 | + .min_voltage = 0, | ||
| 3097 | + .min_current = 0, | ||
| 3098 | + .min_charge = 0, | ||
| 3099 | + .max_voltage = 0, | ||
| 3100 | + .max_current = 0, | ||
| 3101 | + .max_charge = 0, | ||
| 3102 | + | ||
| 3103 | + .min_supply = 1200, | ||
| 3104 | + .charging_led_label = 18, | ||
| 3105 | + .charging_max_label = 265, | ||
| 3106 | + .batt_full = 8300, | ||
| 3107 | + .batt_low = 7300, | ||
| 3108 | + .batt_critical = 6800, | ||
| 3109 | + .batt_empty = 6500, | ||
| 3110 | +}; | ||
| 3111 | + | ||
| 3112 | + | ||
| 3113 | + | ||
| 3114 | +/* | ||
| 3115 | + * UCB glue code | ||
| 3116 | + */ | ||
| 3117 | +static int ucb1x00_battery_add(struct class_device *dev) | ||
| 3118 | +{ | ||
| 3119 | + struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); | ||
| 3120 | + simpad_battery.ucb = ucb; | ||
| 3121 | + | ||
| 3122 | + battery_class_register(&simpad_battery.battery); | ||
| 3123 | + | ||
| 3124 | + return 0; | ||
| 3125 | +} | ||
| 3126 | + | ||
| 3127 | +static void ucb1x00_battery_remove(struct class_device *dev) | ||
| 3128 | +{ | ||
| 3129 | + return battery_class_unregister(&simpad_battery.battery); | ||
| 3130 | +} | ||
| 3131 | + | ||
| 3132 | + | ||
| 3133 | +static struct ucb1x00_class_interface ucb1x00_battery_interface = { | ||
| 3134 | + .interface = { | ||
| 3135 | + .add = ucb1x00_battery_add, | ||
| 3136 | + .remove = ucb1x00_battery_remove, | ||
| 3137 | + }, | ||
| 3138 | +}; | ||
| 3139 | + | ||
| 3140 | + | ||
| 3141 | +static int __init battery_register(void) | ||
| 3142 | +{ | ||
| 3143 | + return ucb1x00_register_interface(&ucb1x00_battery_interface); | ||
| 3144 | +} | ||
| 3145 | + | ||
| 3146 | +static void __exit battery_unregister(void) | ||
| 3147 | +{ | ||
| 3148 | + ucb1x00_unregister_interface(&ucb1x00_battery_interface); | ||
| 3149 | +} | ||
| 3150 | + | ||
| 3151 | +module_init(battery_register); | ||
| 3152 | +module_exit(battery_unregister); | ||
| 3153 | + | ||
| 3154 | +MODULE_AUTHOR("Holger Hans Peter Freyther"); | ||
| 3155 | +MODULE_LICENSE("GPL"); | ||
| 3156 | Index: linux-2.6.22/arch/arm/Kconfig | ||
| 3157 | =================================================================== | ||
| 3158 | --- linux-2.6.22.orig/arch/arm/Kconfig 2007-08-23 12:17:42.000000000 +0200 | ||
| 3159 | +++ linux-2.6.22/arch/arm/Kconfig 2007-08-23 12:22:28.000000000 +0200 | ||
| 3160 | @@ -1016,6 +1016,8 @@ | ||
| 3161 | |||
| 3162 | source "drivers/w1/Kconfig" | ||
| 3163 | |||
| 3164 | +source "drivers/power/Kconfig" | ||
| 3165 | + | ||
| 3166 | source "drivers/hwmon/Kconfig" | ||
| 3167 | |||
| 3168 | #source "drivers/l3/Kconfig" | ||
| 3169 | Index: linux-2.6.22/drivers/Kconfig | ||
| 3170 | =================================================================== | ||
| 3171 | --- linux-2.6.22.orig/drivers/Kconfig 2007-08-23 12:21:27.000000000 +0200 | ||
| 3172 | +++ linux-2.6.22/drivers/Kconfig 2007-08-23 12:22:03.000000000 +0200 | ||
| 3173 | @@ -54,6 +54,8 @@ | ||
| 3174 | |||
| 3175 | source "drivers/w1/Kconfig" | ||
| 3176 | |||
| 3177 | +source "drivers/power/Kconfig" | ||
| 3178 | + | ||
| 3179 | source "drivers/hwmon/Kconfig" | ||
| 3180 | |||
| 3181 | source "drivers/mfd/Kconfig" | ||
| 3182 | Index: linux-2.6.22/drivers/Makefile | ||
| 3183 | =================================================================== | ||
| 3184 | --- linux-2.6.22.orig/drivers/Makefile 2007-08-23 12:33:58.000000000 +0200 | ||
| 3185 | +++ linux-2.6.22/drivers/Makefile 2007-08-23 12:34:34.000000000 +0200 | ||
| 3186 | @@ -61,6 +61,7 @@ | ||
| 3187 | obj-$(CONFIG_RTC_LIB) += rtc/ | ||
| 3188 | obj-y += i2c/ | ||
| 3189 | obj-$(CONFIG_W1) += w1/ | ||
| 3190 | +obj-$(CONFIG_POWER_SUPPLY) += power/ | ||
| 3191 | obj-$(CONFIG_HWMON) += hwmon/ | ||
| 3192 | obj-$(CONFIG_PHONE) += telephony/ | ||
| 3193 | obj-$(CONFIG_MD) += md/ | ||
| 3194 | Index: linux-2.6.22/include/linux/power_supply.h | ||
| 3195 | =================================================================== | ||
| 3196 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 3197 | +++ linux-2.6.22/include/linux/power_supply.h 2007-08-23 12:37:10.000000000 +0200 | ||
| 3198 | @@ -0,0 +1,175 @@ | ||
| 3199 | +/* | ||
| 3200 | + * Universal power supply monitor class | ||
| 3201 | + * | ||
| 3202 | + * Copyright (c) 2007 Anton Vorontsov <cbou@mail.ru> | ||
| 3203 | + * Copyright (c) 2004 Szabolcs Gyurko | ||
| 3204 | + * Copyright (c) 2003 Ian Molton <spyro@f2s.com> | ||
| 3205 | + * | ||
| 3206 | + * Modified: 2004, Oct Szabolcs Gyurko | ||
| 3207 | + * | ||
| 3208 | + * You may use this code as per GPL version 2 | ||
| 3209 | + */ | ||
| 3210 | + | ||
| 3211 | +#ifndef __LINUX_POWER_SUPPLY_H__ | ||
| 3212 | +#define __LINUX_POWER_SUPPLY_H__ | ||
| 3213 | + | ||
| 3214 | +#include <linux/device.h> | ||
| 3215 | +#include <linux/workqueue.h> | ||
| 3216 | +#include <linux/leds.h> | ||
| 3217 | + | ||
| 3218 | +/* | ||
| 3219 | + * All voltages, currents, charges, energies, time and temperatures in uV, | ||
| 3220 | + * uA, uAh, uWh, seconds and tenths of degree Celsius unless otherwise | ||
| 3221 | + * stated. It's driver's job to convert its raw values to units in which | ||
| 3222 | + * this class operates. | ||
| 3223 | + */ | ||
| 3224 | + | ||
| 3225 | +/* | ||
| 3226 | + * For systems where the charger determines the maximum battery capacity | ||
| 3227 | + * the min and max fields should be used to present these values to user | ||
| 3228 | + * space. Unused/unknown fields will not appear in sysfs. | ||
| 3229 | + */ | ||
| 3230 | + | ||
| 3231 | +enum { | ||
| 3232 | + POWER_SUPPLY_STATUS_UNKNOWN = 0, | ||
| 3233 | + POWER_SUPPLY_STATUS_CHARGING, | ||
| 3234 | + POWER_SUPPLY_STATUS_DISCHARGING, | ||
| 3235 | + POWER_SUPPLY_STATUS_NOT_CHARGING, | ||
| 3236 | + POWER_SUPPLY_STATUS_FULL, | ||
| 3237 | +}; | ||
| 3238 | + | ||
| 3239 | +enum { | ||
| 3240 | + POWER_SUPPLY_HEALTH_UNKNOWN = 0, | ||
| 3241 | + POWER_SUPPLY_HEALTH_GOOD, | ||
| 3242 | + POWER_SUPPLY_HEALTH_OVERHEAT, | ||
| 3243 | + POWER_SUPPLY_HEALTH_DEAD, | ||
| 3244 | +}; | ||
| 3245 | + | ||
| 3246 | +enum { | ||
| 3247 | + POWER_SUPPLY_TECHNOLOGY_UNKNOWN = 0, | ||
| 3248 | + POWER_SUPPLY_TECHNOLOGY_NIMH, | ||
| 3249 | + POWER_SUPPLY_TECHNOLOGY_LION, | ||
| 3250 | + POWER_SUPPLY_TECHNOLOGY_LIPO, | ||
| 3251 | +}; | ||
| 3252 | + | ||
| 3253 | +enum { | ||
| 3254 | + POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN = 0, | ||
| 3255 | + POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL, | ||
| 3256 | + POWER_SUPPLY_CAPACITY_LEVEL_LOW, | ||
| 3257 | + POWER_SUPPLY_CAPACITY_LEVEL_NORMAL, | ||
| 3258 | + POWER_SUPPLY_CAPACITY_LEVEL_HIGH, | ||
| 3259 | + POWER_SUPPLY_CAPACITY_LEVEL_FULL, | ||
| 3260 | +}; | ||
| 3261 | + | ||
| 3262 | +enum power_supply_property { | ||
| 3263 | + /* Properties of type `int' */ | ||
| 3264 | + POWER_SUPPLY_PROP_STATUS = 0, | ||
| 3265 | + POWER_SUPPLY_PROP_HEALTH, | ||
| 3266 | + POWER_SUPPLY_PROP_PRESENT, | ||
| 3267 | + POWER_SUPPLY_PROP_ONLINE, | ||
| 3268 | + POWER_SUPPLY_PROP_TECHNOLOGY, | ||
| 3269 | + POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, | ||
| 3270 | + POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, | ||
| 3271 | + POWER_SUPPLY_PROP_VOLTAGE_NOW, | ||
| 3272 | + POWER_SUPPLY_PROP_VOLTAGE_AVG, | ||
| 3273 | + POWER_SUPPLY_PROP_CURRENT_NOW, | ||
| 3274 | + POWER_SUPPLY_PROP_CURRENT_AVG, | ||
| 3275 | + POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, | ||
| 3276 | + POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN, | ||
| 3277 | + POWER_SUPPLY_PROP_CHARGE_FULL, | ||
| 3278 | + POWER_SUPPLY_PROP_CHARGE_EMPTY, | ||
| 3279 | + POWER_SUPPLY_PROP_CHARGE_NOW, | ||
| 3280 | + POWER_SUPPLY_PROP_CHARGE_AVG, | ||
| 3281 | + POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, | ||
| 3282 | + POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, | ||
| 3283 | + POWER_SUPPLY_PROP_ENERGY_FULL, | ||
| 3284 | + POWER_SUPPLY_PROP_ENERGY_EMPTY, | ||
| 3285 | + POWER_SUPPLY_PROP_ENERGY_NOW, | ||
| 3286 | + POWER_SUPPLY_PROP_ENERGY_AVG, | ||
| 3287 | + POWER_SUPPLY_PROP_CAPACITY, /* in percents! */ | ||
| 3288 | + POWER_SUPPLY_PROP_CAPACITY_LEVEL, | ||
| 3289 | + POWER_SUPPLY_PROP_TEMP, | ||
| 3290 | + POWER_SUPPLY_PROP_TEMP_AMBIENT, | ||
| 3291 | + POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, | ||
| 3292 | + POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, | ||
| 3293 | + POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, | ||
| 3294 | + POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, | ||
| 3295 | + /* Properties of type `const char *' */ | ||
| 3296 | + POWER_SUPPLY_PROP_MODEL_NAME, | ||
| 3297 | +}; | ||
| 3298 | + | ||
| 3299 | +enum power_supply_type { | ||
| 3300 | + POWER_SUPPLY_TYPE_BATTERY = 0, | ||
| 3301 | + POWER_SUPPLY_TYPE_UPS, | ||
| 3302 | + POWER_SUPPLY_TYPE_MAINS, | ||
| 3303 | + POWER_SUPPLY_TYPE_USB, | ||
| 3304 | +}; | ||
| 3305 | + | ||
| 3306 | +union power_supply_propval { | ||
| 3307 | + int intval; | ||
| 3308 | + const char *strval; | ||
| 3309 | +}; | ||
| 3310 | + | ||
| 3311 | +struct power_supply { | ||
| 3312 | + const char *name; | ||
| 3313 | + enum power_supply_type type; | ||
| 3314 | + enum power_supply_property *properties; | ||
| 3315 | + size_t num_properties; | ||
| 3316 | + | ||
| 3317 | + char **supplied_to; | ||
| 3318 | + size_t num_supplicants; | ||
| 3319 | + | ||
| 3320 | + int (*get_property)(struct power_supply *psy, | ||
| 3321 | + enum power_supply_property psp, | ||
| 3322 | + union power_supply_propval *val); | ||
| 3323 | + void (*external_power_changed)(struct power_supply *psy); | ||
| 3324 | + | ||
| 3325 | + /* For APM emulation, think legacy userspace. */ | ||
| 3326 | + int use_for_apm; | ||
| 3327 | + | ||
| 3328 | + /* private */ | ||
| 3329 | + struct device *dev; | ||
| 3330 | + struct work_struct changed_work; | ||
| 3331 | + | ||
| 3332 | +#ifdef CONFIG_LEDS_TRIGGERS | ||
| 3333 | + struct led_trigger *charging_full_trig; | ||
| 3334 | + char *charging_full_trig_name; | ||
| 3335 | + struct led_trigger *charging_trig; | ||
| 3336 | + char *charging_trig_name; | ||
| 3337 | + struct led_trigger *full_trig; | ||
| 3338 | + char *full_trig_name; | ||
| 3339 | + struct led_trigger *online_trig; | ||
| 3340 | + char *online_trig_name; | ||
| 3341 | +#endif | ||
| 3342 | +}; | ||
| 3343 | + | ||
| 3344 | +/* | ||
| 3345 | + * This is recommended structure to specify static power supply parameters. | ||
| 3346 | + * Generic one, parametrizable for different power supplies. Power supply | ||
| 3347 | + * class itself does not use it, but that's what implementing most platform | ||
| 3348 | + * drivers, should try reuse for consistency. | ||
| 3349 | + */ | ||
| 3350 | + | ||
| 3351 | +struct power_supply_info { | ||
| 3352 | + const char *name; | ||
| 3353 | + int technology; | ||
| 3354 | + int voltage_max_design; | ||
| 3355 | + int voltage_min_design; | ||
| 3356 | + int charge_full_design; | ||
| 3357 | + int charge_empty_design; | ||
| 3358 | + int energy_full_design; | ||
| 3359 | + int energy_empty_design; | ||
| 3360 | + int use_for_apm; | ||
| 3361 | +}; | ||
| 3362 | + | ||
| 3363 | +extern void power_supply_changed(struct power_supply *psy); | ||
| 3364 | +extern int power_supply_am_i_supplied(struct power_supply *psy); | ||
| 3365 | + | ||
| 3366 | +extern int power_supply_register(struct device *parent, | ||
| 3367 | + struct power_supply *psy); | ||
| 3368 | +extern void power_supply_unregister(struct power_supply *psy); | ||
| 3369 | + | ||
| 3370 | +/* For APM emulation, think legacy userspace. */ | ||
| 3371 | +extern struct class *power_supply_class; | ||
| 3372 | + | ||
| 3373 | +#endif /* __LINUX_POWER_SUPPLY_H__ */ | ||
diff --git a/meta/packages/linux/linux-rp_2.6.22.bb b/meta/packages/linux/linux-rp_2.6.22.bb index 237fd5ec85..bd67d677c4 100644 --- a/meta/packages/linux/linux-rp_2.6.22.bb +++ b/meta/packages/linux/linux-rp_2.6.22.bb | |||
| @@ -51,6 +51,7 @@ SRC_URI = "http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.22.tar.bz2 \ | |||
| 51 | file://connectplus-remove-ide-HACK.patch;patch=1;status=hack \ | 51 | file://connectplus-remove-ide-HACK.patch;patch=1;status=hack \ |
| 52 | file://squashfs3.0-2.6.15.patch;patch=1;status=external \ | 52 | file://squashfs3.0-2.6.15.patch;patch=1;status=external \ |
| 53 | file://vesafb-tng-1.0-rc2-2.6.20-rc2.patch;patch=1;status=external \ | 53 | file://vesafb-tng-1.0-rc2-2.6.20-rc2.patch;patch=1;status=external \ |
| 54 | file://pda-power.patch;patch=1 \ | ||
| 54 | file://defconfig-c7x0 \ | 55 | file://defconfig-c7x0 \ |
| 55 | file://defconfig-hx2000 \ | 56 | file://defconfig-hx2000 \ |
| 56 | file://defconfig-collie \ | 57 | file://defconfig-collie \ |
