|
From: <z7...@us...> - 2007-09-10 07:17:02
|
Revision: 1302
http://hackndev.svn.sourceforge.net/hackndev/?rev=1302&view=rev
Author: z72ka
Date: 2007-09-10 00:16:56 -0700 (Mon, 10 Sep 2007)
Log Message:
-----------
palmz72: Added border switch driver
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmz72-gpio.h
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-09-03 07:19:52 UTC (rev 1301)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-09-10 07:16:56 UTC (rev 1302)
@@ -21,3 +21,9 @@
help
Enable support for PalmOne Zire 72 battery to APM.
ATM use it only as module, otherwise it hangs.
+
+config PALMZ72_BORDER
+ tristate "Palm Zire 72 Display border switch"
+ depends on MACH_PALMZ72
+ help
+ Enable support for turning LCD border on/off
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-09-03 07:19:52 UTC (rev 1301)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-09-10 07:16:56 UTC (rev 1302)
@@ -5,3 +5,4 @@
obj-$(CONFIG_MACH_PALMZ72) += palmz72.o
obj-$(CONFIG_PALMZ72_PM) += palmz72_pm.o
obj-$(CONFIG_PALMZ72_BATTERY) += palmz72_battery.o
+obj-$(CONFIG_PALMZ72_BORDER) += palmz72_border.o
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt 2007-09-03 07:19:52 UTC (rev 1301)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt 2007-09-10 07:16:56 UTC (rev 1302)
@@ -20,8 +20,8 @@
GPIO_18 0 O 00
GPIO_19 1 O 00 Screen goes white when 0
GPIO_20 1 O 00 BL_POWER // Backlight goes off when 0
-GPIO_21 0 O 00
-GPIO_22 0 O 00
+GPIO_21 0 O 00 LCD border switch
+GPIO_22 0 O 00 LCD border select
GPIO_23 0 O 02 SSPSCLK
GPIO_24 1 O 02 SSPSFRM
GPIO_25 0 O 02 SSPSTXD
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-09-03 07:19:52 UTC (rev 1301)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-09-10 07:16:56 UTC (rev 1302)
@@ -316,6 +316,14 @@
.dev = { .platform_data = &palmz72_audio_ops },
};
+/**************
+ * LCD Border *
+ **************/
+struct platform_device palmz72_border = {
+ .name = "palmz72-border",
+ .id = -1,
+};
+
/*************
* Backlight *
*************/
@@ -457,6 +465,7 @@
#if 0
&ov9640,
#endif
+ &palmz72_border,
};
/***********************************************************************
Modified: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmz72-gpio.h
===================================================================
--- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmz72-gpio.h 2007-09-03 07:19:52 UTC (rev 1301)
+++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmz72-gpio.h 2007-09-10 07:16:56 UTC (rev 1302)
@@ -89,6 +89,11 @@
#define GPIO_NR_PALMZ72_BL_POWER 20
+/* LCD Border */
+
+#define GPIO_NR_PALMZ72_BORDER_SWITCH 21
+#define GPIO_NR_PALMZ72_BORDER_SELECT 22
+
/* Others */
#define GPIO_NR_PALMZ72_GPIO_RESET 1
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2007-09-21 00:12:32
|
Revision: 1332
http://hackndev.svn.sourceforge.net/hackndev/?rev=1332&view=rev
Author: marex_z71
Date: 2007-09-20 17:12:29 -0700 (Thu, 20 Sep 2007)
Log Message:
-----------
PalmLD: add general lcd border driver and migrate palmld to it
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig
linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile
linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c
linux4palm/linux/trunk/drivers/misc/Kconfig
linux4palm/linux/trunk/drivers/misc/Makefile
Added Paths:
-----------
linux4palm/linux/trunk/drivers/misc/palmlcd_border.c
linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmlcd-border.h
Removed Paths:
-------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_border.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig 2007-09-17 20:13:33 UTC (rev 1331)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig 2007-09-21 00:12:29 UTC (rev 1332)
@@ -34,9 +34,3 @@
default y if MACH_XSCALE_PALMLD
help
Enable support for suspend/resume the PalmOne LifeDrive PDA.
-
-config PALMLD_BORDER
- tristate "Palm LifeDrive Display border switch"
- depends on MACH_XSCALE_PALMLD
- help
- Enable support for turning LCD border on/off
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile 2007-09-17 20:13:33 UTC (rev 1331)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile 2007-09-21 00:12:29 UTC (rev 1332)
@@ -7,4 +7,3 @@
obj-$(CONFIG_PALMLD_IDE) += palmld_ide.o
obj-$(CONFIG_PALMLD_PM) += palmld_pm.o
obj-$(CONFIG_PALMLD_BATTERY) += palmld_battery.o
-obj-$(CONFIG_PALMLD_BORDER) += palmld_border.o
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c 2007-09-17 20:13:33 UTC (rev 1331)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c 2007-09-21 00:12:29 UTC (rev 1332)
@@ -34,6 +34,7 @@
#include <asm/arch/pxa27x_keyboard.h>
#include <asm/arch/pxa-pm_ll.h>
#include <asm/arch/serial.h>
+#include <asm/arch/palmlcd-border.h>
#include <sound/driver.h>
#include <sound/core.h>
@@ -215,9 +216,17 @@
/*********************************************************
* LCD Border
*********************************************************/
+static struct palmlcd_border_pdata border_machinfo = {
+ .select_gpio = GPIO_NR_PALMLD_BORDER_SELECT,
+ .switch_gpio = GPIO_NR_PALMLD_BORDER_SWITCH,
+};
+
struct platform_device palmld_border = {
- .name = "palmld-border",
- .id = -1,
+ .name = "palmlcd-border",
+ .id = 0,
+ .dev = {
+ .platform_data = &border_machinfo,
+ },
};
/*********************************************************
Deleted: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_border.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_border.c 2007-09-17 20:13:33 UTC (rev 1331)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_border.c 2007-09-21 00:12:29 UTC (rev 1332)
@@ -1,100 +0,0 @@
-/*
- * Palm LifeDrive LCD Border switch
- *
- * Copyright (C) 2007 Marek Vasut <mar...@gm...>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/delay.h>
-
-#include <asm/arch/hardware.h>
-#include <asm/arch/palmld-gpio.h>
-
-static ssize_t palmld_border_write(struct device *dev, struct device_attribute *attr,
- const char *buf, size_t count)
-{
- signed long state = simple_strtol(buf, NULL, 10);
-
- if ( state >= 1 )
- SET_PALMLD_GPIO(BORDER_SELECT, 1);
- else
- SET_PALMLD_GPIO(BORDER_SELECT, 0);
-
- msleep(50);
- SET_PALMLD_GPIO(BORDER_SWITCH, 1);
-
- if ((state == 1) || (state == 0)) /* default - switch border on/off */
- msleep(200);
- else { /* hidden functionality - colored border */
- if (state >= 0)
- msleep(state);
- else
- msleep(-state);
- }
-
- SET_PALMLD_GPIO(BORDER_SWITCH, 0);
-
- return count;
-}
-
-static ssize_t palmld_border_read(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- return strlcpy(buf, GET_PALMLD_GPIO(BORDER_SELECT) ? "1\n" : "0\n", 3);
-}
-
-static DEVICE_ATTR(border_power, 0644, palmld_border_read, palmld_border_write);
-
-static struct attribute *palmld_border_attrs[] = {
- &dev_attr_border_power.attr,
- NULL
-};
-
-static struct attribute_group palmld_border_attr_group = {
- .attrs = palmld_border_attrs,
-};
-
-static int __devinit palmld_border_probe(struct platform_device *pdev)
-{
- return sysfs_create_group(&pdev->dev.kobj, &palmld_border_attr_group);
-}
-
-static int palmld_border_remove(struct platform_device *pdev)
-{
- sysfs_remove_group(&pdev->dev.kobj, &palmld_border_attr_group);
- return 0;
-}
-
-static struct platform_driver palmld_border_driver = {
- .probe = palmld_border_probe,
- .remove = palmld_border_remove,
- .suspend = NULL,
- .resume = NULL,
- .driver = {
- .name = "palmld-border",
- }
-};
-
-static int __init palmld_border_init(void)
-{
- return platform_driver_register(&palmld_border_driver);
-}
-
-static void palmld_border_exit(void)
-{
- platform_driver_unregister(&palmld_border_driver);
-}
-
-module_init(palmld_border_init);
-module_exit(palmld_border_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Marek Vasut <mar...@gm...>");
-MODULE_DESCRIPTION("Palm LifeDrive Border switch");
Modified: linux4palm/linux/trunk/drivers/misc/Kconfig
===================================================================
--- linux4palm/linux/trunk/drivers/misc/Kconfig 2007-09-17 20:13:33 UTC (rev 1331)
+++ linux4palm/linux/trunk/drivers/misc/Kconfig 2007-09-21 00:12:29 UTC (rev 1332)
@@ -48,6 +48,12 @@
help
Gpioed-ng: only for debuging and testing!
+config PALMLCD_BORDER
+ tristate "Palm LCD Display border switch"
+ depends on ARCH_PXA
+ help
+ Enable support for turning LCD border on/off
+
menu "Multimedia Capabilities Port drivers"
config MCP_UCB1x00_AUDIO
Modified: linux4palm/linux/trunk/drivers/misc/Makefile
===================================================================
--- linux4palm/linux/trunk/drivers/misc/Makefile 2007-09-17 20:13:33 UTC (rev 1331)
+++ linux4palm/linux/trunk/drivers/misc/Makefile 2007-09-21 00:12:29 UTC (rev 1332)
@@ -17,6 +17,7 @@
obj-$(CONFIG_BATTCHARGE_MONITOR) += battchargemon.o
obj-$(CONFIG_GPIOED) += gpioed.o
obj-$(CONFIG_GPIOEDNG) += gpioed-ng.o
+obj-$(CONFIG_PALMLCD_BORDER) += palmlcd_border.o
obj-$(CONFIG_MCP_UCB1x00_AUDIO) += ucb1x00-audio.o
obj-$(CONFIG_MCP_UCB1x00_SIMPAD_SWITCHES) += simpad-switches.o
Added: linux4palm/linux/trunk/drivers/misc/palmlcd_border.c
===================================================================
--- linux4palm/linux/trunk/drivers/misc/palmlcd_border.c (rev 0)
+++ linux4palm/linux/trunk/drivers/misc/palmlcd_border.c 2007-09-21 00:12:29 UTC (rev 1332)
@@ -0,0 +1,107 @@
+/*
+ * Palm LCD Border switch
+ *
+ * Copyright (C) 2007 Marek Vasut <mar...@gm...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+
+#include <asm/arch/palmlcd-border.h>
+#include <asm/arch/gpio.h>
+
+struct palmlcd_border_pdata *pdata;
+
+static ssize_t palmlcd_border_write(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ signed long state = simple_strtol(buf, NULL, 10);
+
+ if ( state >= 1 )
+ __gpio_set_value(pdata->select_gpio, 1);
+ else
+ __gpio_set_value(pdata->select_gpio, 0);
+
+ msleep(50);
+ __gpio_set_value(pdata->switch_gpio, 1);
+
+ if ((state == 1) || (state == 0)) /* default - switch border on/off */
+ msleep(200);
+ else { /* hidden functionality - colored border */
+ if (state >= 0)
+ msleep(state);
+ else
+ msleep(-state);
+ }
+
+ __gpio_set_value(pdata->switch_gpio, 0);
+
+ return count;
+}
+
+static ssize_t palmlcd_border_read(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ return strlcpy(buf, __gpio_get_value(pdata->select_gpio) ? "1\n" : "0\n", 3);
+}
+
+static DEVICE_ATTR(border_power, 0644, palmlcd_border_read, palmlcd_border_write);
+
+static struct attribute *palmlcd_border_attrs[] = {
+ &dev_attr_border_power.attr,
+ NULL
+};
+
+static struct attribute_group palmlcd_border_attr_group = {
+ .attrs = palmlcd_border_attrs,
+};
+
+static int __devinit palmlcd_border_probe(struct platform_device *pdev)
+{
+ if(!pdev->dev.platform_data)
+ return -ENODEV;
+
+ pdata = pdev->dev.platform_data;
+
+ return sysfs_create_group(&pdev->dev.kobj, &palmlcd_border_attr_group);
+}
+
+static int palmlcd_border_remove(struct platform_device *pdev)
+{
+ sysfs_remove_group(&pdev->dev.kobj, &palmlcd_border_attr_group);
+ return 0;
+}
+
+static struct platform_driver palmlcd_border_driver = {
+ .probe = palmlcd_border_probe,
+ .remove = palmlcd_border_remove,
+ .suspend = NULL,
+ .resume = NULL,
+ .driver = {
+ .name = "palmlcd-border",
+ }
+};
+
+static int __init palmlcd_border_init(void)
+{
+ return platform_driver_register(&palmlcd_border_driver);
+}
+
+static void palmlcd_border_exit(void)
+{
+ platform_driver_unregister(&palmlcd_border_driver);
+}
+
+module_init(palmlcd_border_init);
+module_exit(palmlcd_border_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Marek Vasut <mar...@gm...>");
+MODULE_DESCRIPTION("Palm LCD Border switch");
Added: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmlcd-border.h
===================================================================
--- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmlcd-border.h (rev 0)
+++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmlcd-border.h 2007-09-21 00:12:29 UTC (rev 1332)
@@ -0,0 +1,8 @@
+/*
+ * Palm LCD Border info structure
+ */
+
+struct palmlcd_border_pdata {
+ unsigned char select_gpio;
+ unsigned char switch_gpio;
+};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mis...@us...> - 2007-09-26 14:42:20
|
Revision: 1341
http://hackndev.svn.sourceforge.net/hackndev/?rev=1341&view=rev
Author: miska_tx
Date: 2007-09-26 07:42:12 -0700 (Wed, 26 Sep 2007)
Log Message:
-----------
All: Model independent Palm battery driver
Signed-off-by: Michal Hrusecky <Mic...@se...>
Modified Paths:
--------------
linux4palm/linux/trunk/drivers/power/Kconfig
linux4palm/linux/trunk/drivers/power/Makefile
Added Paths:
-----------
linux4palm/linux/trunk/drivers/power/palm_battery.c
linux4palm/linux/trunk/include/asm-arm/arch-pxa/palm-battery.h
Modified: linux4palm/linux/trunk/drivers/power/Kconfig
===================================================================
--- linux4palm/linux/trunk/drivers/power/Kconfig 2007-09-24 18:33:52 UTC (rev 1340)
+++ linux4palm/linux/trunk/drivers/power/Kconfig 2007-09-26 14:42:12 UTC (rev 1341)
@@ -28,6 +28,14 @@
Say Y here to enable support APM status emulation using
battery class devices.
+config BATTERY_PALM
+ tristate "Palm battery driver"
+ select TOUCHSCREEN_WM97XX
+ depends on APM_POWER
+ default m
+ help
+ Say Y here to enable support for batteries in Palm devices.
+
config BATTERY_DS2760
tristate "DS2760 battery driver (HP iPAQ & others)"
select W1
Modified: linux4palm/linux/trunk/drivers/power/Makefile
===================================================================
--- linux4palm/linux/trunk/drivers/power/Makefile 2007-09-24 18:33:52 UTC (rev 1340)
+++ linux4palm/linux/trunk/drivers/power/Makefile 2007-09-26 14:42:12 UTC (rev 1341)
@@ -18,6 +18,7 @@
obj-$(CONFIG_APM_POWER) += apm_power.o
obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o
+obj-$(CONFIG_BATTERY_PALM) += palm_battery.o
obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o
Added: linux4palm/linux/trunk/drivers/power/palm_battery.c
===================================================================
--- linux4palm/linux/trunk/drivers/power/palm_battery.c (rev 0)
+++ linux4palm/linux/trunk/drivers/power/palm_battery.c 2007-09-26 14:42:12 UTC (rev 1341)
@@ -0,0 +1,269 @@
+/************************************************************************
+ * drivers/power/palm_battery.c *
+ * Battery driver for Palm devices *
+ * *
+ * Author: Michal Hrusecky <Mic...@se...> *
+ * *
+ * Based on code for Palm TX by *
+ * *
+ * Authors: Jan Herman <2h...@se...> *
+ * *
+ ************************************************************************/
+
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/input.h>
+#include <linux/device.h>
+#include <linux/workqueue.h>
+#include <linux/power_supply.h>
+#include <linux/apm-emulation.h>
+#include <linux/wm97xx.h>
+
+#include <asm/delay.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/arch/irqs.h>
+
+#include <sound/driver.h>
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/initval.h>
+#include <asm/arch/palm-battery.h>
+
+extern struct palm_battery_data palm_battery_info;
+
+struct palm_battery_dev
+{
+ struct wm97xx * wm;
+ int battery_registered;
+ int current_voltage;
+ int previous_voltage;
+ u32 last_battery_update;
+};
+
+struct palm_battery_dev bat;
+
+#if defined(CONFIG_APM_EMULATION) || defined(CONFIG_APM_MODULE)
+/* original APM hook */
+static void (*apm_get_power_status_orig)(struct apm_power_info *info);
+#endif
+
+/*
+ This formula is based on battery life of my battery 1100mAh. Original battery in Zire72 is Li-On 920mAh
+ V_batt = ADCSEL_BMON * 1,889 + 767,8 [mV]
+*/
+
+int palm_battery_get_voltage(struct power_supply *b)
+{
+ if (bat.battery_registered) {
+ bat.previous_voltage = bat.current_voltage;
+ bat.current_voltage = wm97xx_read_aux_adc(bat.wm, WM97XX_AUX_ID3);
+ bat.last_battery_update = jiffies;
+ return bat.current_voltage * 1889/1000 + 7678/10;
+ } else {
+ printk("palm_battery: cannot get voltage -> battery driver unregistered\n");
+ return 0;
+ }
+}
+
+int palm_battery_get_capacity(struct power_supply *b)
+{
+ if (bat.battery_registered)
+ return (((palm_battery_get_voltage(b)-palm_battery_info.bat_min_voltage)
+ /(palm_battery_info.bat_max_voltage-palm_battery_info.bat_min_voltage))*100);
+ else{
+ printk("palm_battery: cannot get capacity -> battery driver unregistered\n");
+ return 0;
+ }
+}
+
+int palm_battery_get_status(struct power_supply *b)
+{
+ if ( palm_battery_info.ac_connected() &&
+ ( ( bat.current_voltage > bat.previous_voltage ) ||
+ (bat.current_voltage <= palm_battery_info.bat_max_voltage) ) )
+ return POWER_SUPPLY_STATUS_CHARGING;
+ else
+ return POWER_SUPPLY_STATUS_NOT_CHARGING;
+}
+
+static int palm_battery_get_property(struct power_supply *b,
+ enum power_supply_property psp,
+ union power_supply_propval *val)
+{
+ switch (psp) {
+ case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
+ val->intval = palm_battery_info.bat_max_voltage;
+ break;
+ case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
+ val->intval = palm_battery_info.bat_min_voltage;
+ break;
+ case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
+ val->intval = 100;
+ break;
+ case POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN:
+ val->intval = 0;
+ break;
+ case POWER_SUPPLY_PROP_CHARGE_NOW:
+ val->intval = palm_battery_get_capacity(b);
+ break;
+ case POWER_SUPPLY_PROP_VOLTAGE_NOW:
+ val->intval = palm_battery_get_voltage(b);
+ break;
+ case POWER_SUPPLY_PROP_STATUS:
+ val->intval = palm_battery_get_status(b);
+ break;
+ default:
+ break;
+ };
+
+ return 0;
+}
+
+static enum power_supply_property palm_battery_props[] = {
+ POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
+ POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
+ POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
+ POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN,
+ POWER_SUPPLY_PROP_CHARGE_NOW,
+ POWER_SUPPLY_PROP_VOLTAGE_NOW,
+ POWER_SUPPLY_PROP_STATUS,
+};
+
+struct power_supply palm_battery = {
+ .name = "palm_battery",
+ .get_property = palm_battery_get_property,
+ .properties = palm_battery_props,
+ .num_properties = ARRAY_SIZE(palm_battery_props),
+};
+
+static int palm_wm97xx_probe(struct device *dev)
+{
+ struct wm97xx *wm = dev->driver_data;
+ bat.wm = wm;
+ return 0;
+}
+
+static int palm_wm97xx_remove(struct device *dev)
+{
+ return 0;
+}
+
+static void
+palm_wm97xx_shutdown(struct device *dev)
+{
+#if defined(CONFIG_APM_EMULATION) || defined(CONFIG_APM_MODULE)
+ apm_get_power_status = apm_get_power_status_orig;
+#endif
+}
+
+static int
+palm_wm97xx_suspend(struct device *dev, pm_message_t state)
+{
+ return 0;
+}
+
+static int
+palm_wm97xx_resume(struct device *dev)
+{
+ return 0;
+}
+
+
+static struct device_driver palm_wm97xx_driver = {
+ .name = "wm97xx-touchscreen",
+ .bus = &wm97xx_bus_type,
+ .owner = THIS_MODULE,
+ .probe = palm_wm97xx_probe,
+ .remove = palm_wm97xx_remove,
+ .suspend = palm_wm97xx_suspend,
+ .resume = palm_wm97xx_resume,
+ .shutdown = palm_wm97xx_shutdown
+};
+
+
+#if defined(CONFIG_APM_EMULATION) || defined(CONFIG_APM_MODULE)
+
+/* APM status query callback implementation */
+static void palm_apm_get_power_status(struct apm_power_info *info)
+{
+ int min, max, curr, percent;
+
+ curr = palm_battery_get_voltage(&palm_battery);
+ min = palm_battery_info.bat_min_voltage;
+ max = palm_battery_info.bat_max_voltage;
+
+ curr = curr - min;
+ if (curr < 0) curr = 0;
+ max = max - min;
+
+ percent = curr*100/max;
+
+ info->battery_life = percent;
+
+ info->ac_line_status = palm_battery_info.ac_connected() ? APM_AC_ONLINE : APM_AC_OFFLINE;
+
+ if (info->ac_line_status)
+ info->battery_status = APM_BATTERY_STATUS_CHARGING;
+ else {
+ if (percent > 50)
+ info->battery_status = APM_BATTERY_STATUS_HIGH;
+ else if (percent < 5)
+ info->battery_status = APM_BATTERY_STATUS_CRITICAL;
+ else
+ info->battery_status = APM_BATTERY_STATUS_LOW;
+ }
+
+ info->time = percent * palm_battery_info.bat_max_life_mins/100;
+ info->units = APM_UNITS_MINS;
+}
+#endif
+static int __init palm_wm97xx_init(void)
+{
+#ifndef MODULE
+ int ret;
+#endif
+
+ /* register battery to APM layer */
+ bat.battery_registered = 0;
+
+ if(power_supply_register(NULL, &palm_battery))
+ printk(KERN_ERR "palm_ac97_probe: could not register battery class\n");
+ else {
+ bat.battery_registered = 1;
+ printk("Battery registered\n");
+ }
+#if defined(CONFIG_APM_EMULATION) || defined(CONFIG_APM_MODULE)
+ apm_get_power_status_orig = apm_get_power_status;
+ apm_get_power_status = palm_apm_get_power_status;
+#endif
+#ifndef MODULE
+ /* If we're in kernel, we could accidentally be run before wm97xx
+ and thus have panic */
+ if((ret = bus_register(&wm97xx_bus_type)) < 0)
+ return ret;
+#endif
+ return driver_register(&palm_wm97xx_driver);
+}
+
+static void __exit palm_wm97xx_exit(void)
+{
+ /* TODO - recover APM callback to original state */
+ power_supply_unregister(&palm_battery);
+ driver_unregister(&palm_wm97xx_driver);
+}
+
+module_init(palm_wm97xx_init);
+module_exit(palm_wm97xx_exit);
+
+/* Module information */
+MODULE_AUTHOR("Michal Hrusecky <Mic...@se...>");
+MODULE_DESCRIPTION("Universal battery driver for Palm devices");
+MODULE_LICENSE("GPL");
Added: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palm-battery.h
===================================================================
--- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palm-battery.h (rev 0)
+++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palm-battery.h 2007-09-26 14:42:12 UTC (rev 1341)
@@ -0,0 +1,10 @@
+/*
+ * Palm battery info structure.
+ */
+
+struct palm_battery_data {
+ int bat_min_voltage;
+ int bat_max_voltage;
+ int bat_max_life_mins;
+ int (*ac_connected)();
+};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <z7...@us...> - 2007-09-27 13:02:16
|
Revision: 1346
http://hackndev.svn.sourceforge.net/hackndev/?rev=1346&view=rev
Author: z72ka
Date: 2007-09-27 06:02:11 -0700 (Thu, 27 Sep 2007)
Log Message:
-----------
palmz72: migrate to universal palm_battery driver
palm_battery.h: fixed compilation warning
palmz72: updated defconfig to new palm battery driver, added userinput support, pxaficp as module
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
linux4palm/linux/trunk/include/asm-arm/arch-pxa/palm-battery.h
Modified: linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig
===================================================================
--- linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig 2007-09-26 20:02:39 UTC (rev 1345)
+++ linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig 2007-09-27 13:02:11 UTC (rev 1346)
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.21-hnd3
-# Wed Sep 12 11:26:32 2007
+# Thu Sep 27 14:33:48 2007
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -183,8 +183,6 @@
CONFIG_GPIOEDNG=m
CONFIG_MACH_PALMZ72=y
CONFIG_PALMZ72_PM=y
-CONFIG_PALMZ72_BATTERY=m
-CONFIG_PALMZ72_BORDER=m
# CONFIG_MACH_XSCALE_PALMTREO650 is not set
# CONFIG_MACH_XSCALE_TREO680 is not set
# CONFIG_MACH_T700WX is not set
@@ -421,7 +419,7 @@
#
# FIR device drivers
#
-CONFIG_PXA_FICP=y
+CONFIG_PXA_FICP=m
CONFIG_BT=y
CONFIG_BT_L2CAP=m
CONFIG_BT_SCO=m
@@ -626,7 +624,7 @@
# CONFIG_GPIODEV_DIAGONAL is not set
CONFIG_KEYBOARD_PXA27x=y
# CONFIG_KEYBOARD_PALMIR is not set
-CONFIG_KEYBOARD_PALMWK=m
+# CONFIG_KEYBOARD_PALMWK is not set
CONFIG_KEYBOARD_GPIO=y
# CONFIG_INPUT_MOUSE is not set
# CONFIG_INPUT_JOYSTICK is not set
@@ -646,7 +644,8 @@
CONFIG_TOUCHSCREEN_WM9712=y
# CONFIG_TOUCHSCREEN_WM9713 is not set
# CONFIG_TOUCHSCREEN_WM97XX_PXA is not set
-# CONFIG_INPUT_MISC is not set
+CONFIG_INPUT_MISC=y
+CONFIG_INPUT_UINPUT=y
#
# Hardware I/O ports
@@ -677,7 +676,7 @@
CONFIG_SERIAL_PXA=y
# CONFIG_SERIAL_PXA_CONSOLE is not set
CONFIG_SERIAL_PXA_COUNT=4
-# CONFIG_SERIAL_PXA_IR is not set
+CONFIG_SERIAL_PXA_IR=y
CONFIG_SERIAL_CORE=y
# CONFIG_RS232_SERIAL is not set
CONFIG_UNIX98_PTYS=y
@@ -822,6 +821,7 @@
# CONFIG_POWER_SUPPLY_DEBUG is not set
CONFIG_PDA_POWER=y
CONFIG_APM_POWER=y
+CONFIG_BATTERY_PALM=m
# CONFIG_BATTERY_DS2760 is not set
#
@@ -833,6 +833,7 @@
# Misc devices
#
# CONFIG_BATTCHARGE_MONITOR is not set
+# CONFIG_PALMLCD_BORDER is not set
#
# Multimedia Capabilities Port drivers
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-09-26 20:02:39 UTC (rev 1345)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-09-27 13:02:11 UTC (rev 1346)
@@ -12,12 +12,3 @@
help
Enable support for suspend/resume the PalmOne Zire 72 PDA.
-config PALMZ72_BATTERY
- tristate "Palm Zire 72 Battery support"
- select TOUCHSCREEN_WM97XX
- select POWER_SUPPLY
- depends on MACH_PALMZ72
- default m
- help
- Enable support for PalmOne Zire 72 battery to APM.
- ATM use it only as module, otherwise it hangs.
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-09-26 20:02:39 UTC (rev 1345)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-09-27 13:02:11 UTC (rev 1346)
@@ -4,4 +4,3 @@
obj-$(CONFIG_MACH_PALMZ72) += palmz72.o
obj-$(CONFIG_PALMZ72_PM) += palmz72_pm.o
-obj-$(CONFIG_PALMZ72_BATTERY) += palmz72_battery.o
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-09-26 20:02:39 UTC (rev 1345)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-09-27 13:02:11 UTC (rev 1346)
@@ -43,6 +43,7 @@
#include <asm/arch/pxa_camera.h>
#include <asm/arch/pxa2xx_udc_gpio.h>
#include <asm/arch/palmlcd-border.h>
+#include <asm/arch/palm-battery.h>
#include <sound/driver.h>
#include <sound/core.h>
@@ -330,6 +331,24 @@
};
/*************
+ * Batery *
+ *************/
+
+int palmz72_ac_is_connected (void){
+ /* when charger is plugged in and USB is not connected, then status is ONLINE */
+ return (!(GET_GPIO(GPIO_NR_PALMZ72_USB_PULLUP)) && !(GET_GPIO(GPIO_NR_PALMZ72_USB_DETECT)));
+}
+
+static struct palm_battery_data palm_battery_info = {
+ .bat_min_voltage = PALMZ72_BAT_MIN_VOLTAGE,
+ .bat_max_voltage = PALMZ72_BAT_MAX_VOLTAGE,
+ .bat_max_life_mins = PALMZ72_MAX_LIFE_MINS,
+ .ac_connected = &palmz72_ac_is_connected,
+};
+
+EXPORT_SYMBOL_GPL(palm_battery_info);
+
+/*************
* Backlight *
*************/
Modified: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palm-battery.h
===================================================================
--- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palm-battery.h 2007-09-26 20:02:39 UTC (rev 1345)
+++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palm-battery.h 2007-09-27 13:02:11 UTC (rev 1346)
@@ -6,5 +6,5 @@
int bat_min_voltage;
int bat_max_voltage;
int bat_max_life_mins;
- int (*ac_connected)();
+ int (*ac_connected)(void);
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mar...@us...> - 2007-09-27 13:26:09
|
Revision: 1348
http://hackndev.svn.sourceforge.net/hackndev/?rev=1348&view=rev
Author: marex_z71
Date: 2007-09-27 06:25:21 -0700 (Thu, 27 Sep 2007)
Log Message:
-----------
PalmLD: migrate to new battery driver, thanks |miska|
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig
linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile
linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c
linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h
Removed Paths:
-------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_battery.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig 2007-09-27 13:12:35 UTC (rev 1347)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig 2007-09-27 13:25:21 UTC (rev 1348)
@@ -18,16 +18,6 @@
tristate "Palm LifeDrive IDE driver"
depends on MACH_XSCALE_PALMLD
-config PALMLD_BATTERY
- tristate "Palm LifeDrive Battery support"
- select TOUCHSCREEN_WM97XX
- select POWER_SUPPLY
- depends on MACH_XSCALE_PALMLD
- default m
- help
- Enable support for PalmOne LifeDrive battery to APM.
- ATM use it only as module, otherwise it hangs.
-
config PALMLD_PM
tristate "Palm LifeDrive Power Management support"
depends on MACH_XSCALE_PALMLD
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile 2007-09-27 13:12:35 UTC (rev 1347)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile 2007-09-27 13:25:21 UTC (rev 1348)
@@ -6,4 +6,3 @@
obj-$(CONFIG_PALMLD_PCMCIA) += palmld_pcmcia.o
obj-$(CONFIG_PALMLD_IDE) += palmld_ide.o
obj-$(CONFIG_PALMLD_PM) += palmld_pm.o
-obj-$(CONFIG_PALMLD_BATTERY) += palmld_battery.o
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c 2007-09-27 13:12:35 UTC (rev 1347)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c 2007-09-27 13:25:21 UTC (rev 1348)
@@ -35,6 +35,7 @@
#include <asm/arch/pxa-pm_ll.h>
#include <asm/arch/serial.h>
#include <asm/arch/palmlcd-border.h>
+#include <asm/arch/palm-battery.h>
#include <sound/driver.h>
#include <sound/core.h>
@@ -224,6 +225,26 @@
};
/*********************************************************
+ * Battery
+ *********************************************************/
+
+int palmld_ac_is_connected (void){
+ /* when charger is plugged in and USB is not connected,
+ then status is ONLINE */
+ return ((GET_PALMLD_GPIO(POWER_DETECT)) &&
+ !(GET_PALMLD_GPIO(USB_DETECT_N)));
+}
+
+static struct palm_battery_data palm_battery_info = {
+ .bat_min_voltage = PALMLD_BAT_MIN_VOLTAGE,
+ .bat_max_voltage = PALMLD_BAT_MAX_VOLTAGE,
+ .bat_max_life_mins = PALMLD_MAX_LIFE_MINS,
+ .ac_connected = &palmld_ac_is_connected,
+};
+
+EXPORT_SYMBOL_GPL(palm_battery_info);
+
+/*********************************************************
* Backlight
*********************************************************/
Deleted: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_battery.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_battery.c 2007-09-27 13:12:35 UTC (rev 1347)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_battery.c 2007-09-27 13:25:21 UTC (rev 1348)
@@ -1,278 +0,0 @@
-/************************************************************************
- * linux/arch/arm/mach-pxa/palmld/palmld_battery.c *
- * *
- * Touchscreen/battery driver for WM9712 AC97 codec *
- * Authros: Jan Herman <2h...@se...> *
- * Sergey Lapin <sl...@ha...> *
- * Changes for PalmLD: Marek Vasut <mar...@gm...> *
- * *
- ************************************************************************/
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/input.h>
-#include <linux/device.h>
-#include <linux/workqueue.h>
-#include <linux/power_supply.h>
-#include <linux/apm-emulation.h>
-#include <linux/wm97xx.h>
-
-#include <asm/delay.h>
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/pxa-regs.h>
-#include <asm/arch/irqs.h>
-#include <asm/arch/palmld-gpio.h>
-#include <asm/arch/palmld-init.h>
-
-#include <sound/driver.h>
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/initval.h>
-
-struct palmld_battery_dev
-{
- struct wm97xx *wm;
- int battery_registered;
- int current_voltage;
- int previous_voltage;
- u32 last_battery_update;
-};
-
-struct palmld_battery_dev bat;
-
-#if defined(CONFIG_APM_EMULATION) || defined(CONFIG_APM_MODULE)
-/* original APM hook */
-static void (*apm_get_power_status_orig)(struct apm_power_info *info);
-#endif
-
-int palmld_battery_min_voltage(struct power_supply *b)
-{
- return PALMLD_BAT_MIN_VOLTAGE;
-}
-
-
-int palmld_battery_max_voltage(struct power_supply *b)
-{
- return PALMLD_BAT_MAX_VOLTAGE; /* mV */
-}
-
-/*
- This formula is based on battery life of my battery 1100mAh. Original battery in Zire72 is Li-On 920mAh
- V_batt = ADCSEL_BMON * 1,889 + 767,8 [mV]
-*/
-
-int palmld_battery_get_voltage(struct power_supply *b)
-{
- if (bat.battery_registered) {
- bat.previous_voltage = bat.current_voltage;
- bat.current_voltage = wm97xx_read_aux_adc(bat.wm, WM97XX_AUX_ID3);
- bat.last_battery_update = jiffies;
- return bat.current_voltage * 1889/1000 + 7678/10;
- }
-
- printk("palmld_battery: cannot get voltage -> battery driver unregistered\n");
- return 0;
-}
-
-int palmld_battery_get_capacity(struct power_supply *b)
-{
- if (bat.battery_registered)
- return (((palmld_battery_get_voltage(b)-palmld_battery_min_voltage(b))/
- (palmld_battery_max_voltage(b)-palmld_battery_min_voltage(b)))*100);
-
- printk("palmld_battery: cannot get capacity -> battery driver unregistered\n");
- return 0;
-}
-
-int palmld_battery_get_status(struct power_supply *b)
-{
- int ac_connected = GET_PALMLD_GPIO(POWER_DETECT);
- int usb_connected = !GET_PALMLD_GPIO(USB_DETECT);
-
- if ( (ac_connected || usb_connected) &&
- ( ( bat.current_voltage > bat.previous_voltage ) ||
- (bat.current_voltage <= PALMLD_BAT_MAX_VOLTAGE) ) )
- return POWER_SUPPLY_STATUS_CHARGING;
- else
- return POWER_SUPPLY_STATUS_NOT_CHARGING;
-}
-
-static int palmld_battery_get_property(struct power_supply *b,
- enum power_supply_property psp,
- union power_supply_propval *val)
-{
- switch (psp) {
- case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
- val->intval = palmld_battery_max_voltage(b);
- break;
- case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
- val->intval = palmld_battery_min_voltage(b);
- break;
- case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
- val->intval = 100;
- break;
- case POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN:
- val->intval = 0;
- break;
- case POWER_SUPPLY_PROP_CHARGE_NOW:
- val->intval = palmld_battery_get_capacity(b);
- break;
- case POWER_SUPPLY_PROP_VOLTAGE_NOW:
- val->intval = palmld_battery_get_voltage(b);
- break;
- case POWER_SUPPLY_PROP_STATUS:
- val->intval = palmld_battery_get_status(b);
- break;
- default:
- break;
- };
-
- return 0;
-}
-
-static enum power_supply_property palmld_battery_props[] = {
- POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
- POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
- POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
- POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN,
- POWER_SUPPLY_PROP_CHARGE_NOW,
- POWER_SUPPLY_PROP_VOLTAGE_NOW,
- POWER_SUPPLY_PROP_STATUS,
-};
-
-struct power_supply palmld_battery = {
- .name = "palmld_battery",
- .get_property = palmld_battery_get_property,
- .properties = palmld_battery_props,
- .num_properties = ARRAY_SIZE(palmld_battery_props),
-};
-
-static int palmld_wm97xx_probe(struct device *dev)
-{
- struct wm97xx *wm = dev->driver_data;
- bat.wm = wm;
- return 0;
-}
-
-static int palmld_wm97xx_remove(struct device *dev)
-{
- return 0;
-}
-
-static void
-palmld_wm97xx_shutdown(struct device *dev)
-{
-#if defined(CONFIG_APM_EMULATION) || defined(CONFIG_APM_MODULE)
- apm_get_power_status = apm_get_power_status_orig;
-#endif
-}
-
-static int
-palmld_wm97xx_suspend(struct device *dev, pm_message_t state)
-{
- return 0;
-}
-
-static int
-palmld_wm97xx_resume(struct device *dev)
-{
- return 0;
-}
-
-
-static struct device_driver palmld_wm97xx_driver = {
- .name = "wm97xx-touchscreen",
- .bus = &wm97xx_bus_type,
- .owner = THIS_MODULE,
- .probe = palmld_wm97xx_probe,
- .remove = palmld_wm97xx_remove,
- .suspend = palmld_wm97xx_suspend,
- .resume = palmld_wm97xx_resume,
- .shutdown = palmld_wm97xx_shutdown
-};
-
-#if defined(CONFIG_APM_EMULATION) || defined(CONFIG_APM_MODULE)
-
-/* APM status query callback implementation */
-static void palmld_apm_get_power_status(struct apm_power_info *info)
-{
- int min, max, curr, percent;
-
- curr = palmld_battery_get_voltage(&palmld_battery);
- min = palmld_battery_min_voltage(&palmld_battery);
- max = palmld_battery_max_voltage(&palmld_battery);
-
- curr = curr - min;
- if (curr < 0) curr = 0;
- max = max - min;
-
- percent = curr*100/max;
-
- info->battery_life = percent;
-
- info->ac_line_status = (GET_PALMLD_GPIO(POWER_DETECT)
- ? APM_AC_ONLINE : APM_AC_OFFLINE);
-
- if (info->ac_line_status) {
- info->battery_status = APM_BATTERY_STATUS_CHARGING;
- } else {
- if (percent > 50)
- info->battery_status = APM_BATTERY_STATUS_HIGH;
- else if (percent < 5)
- info->battery_status = APM_BATTERY_STATUS_CRITICAL;
- else
- info->battery_status = APM_BATTERY_STATUS_LOW;
- }
-
- info->time = percent * PALMLD_MAX_LIFE_MINS/100;
- info->units = APM_UNITS_MINS;
-}
-#endif
-static int __init palmld_wm97xx_init(void)
-{
-#ifndef MODULE
- int ret;
-#endif
-
- /* register battery to APM layer */
- bat.battery_registered = 0;
- if(power_supply_register(NULL, &palmld_battery))
- printk(KERN_ERR "palmld_ac97_probe: could not register battery class\n");
- else {
- bat.battery_registered = 1;
- printk("Battery registered\n");
- }
-#if defined(CONFIG_APM_EMULATION) || defined(CONFIG_APM_MODULE)
- apm_get_power_status_orig = apm_get_power_status;
- apm_get_power_status = palmld_apm_get_power_status;
-#endif
-#ifndef MODULE
- /* If we're in kernel, we could accidentally be run before wm97xx
- and thus have panic */
- if((ret = bus_register(&wm97xx_bus_type)) < 0)
- return ret;
-#endif
- return driver_register(&palmld_wm97xx_driver);
-}
-
-static void __exit palmld_wm97xx_exit(void)
-{
-/* TODO - recover APM callback to original state */
- power_supply_unregister(&palmld_battery);
- driver_unregister(&palmld_wm97xx_driver);
-}
-
-module_init(palmld_wm97xx_init);
-module_exit(palmld_wm97xx_exit);
-
-/* Module information */
-MODULE_AUTHOR("Sergey Lapin <sl...@ha...> Jan Herman <2h...@se...>"
- "Marek Vasut <mar...@gm...");
-MODULE_DESCRIPTION("wm97xx battery driver");
-MODULE_LICENSE("GPL");
Modified: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h
===================================================================
--- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h 2007-09-27 13:12:35 UTC (rev 1347)
+++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h 2007-09-27 13:25:21 UTC (rev 1348)
@@ -77,7 +77,7 @@
#define IRQ_GPIO_PALMLD_IDE_IRQ IRQ_GPIO(GPIO_NR_PALMLD_IDE_IRQ)
/* USB */
-#define GPIO_NR_PALMLD_USB_DETECT 3
+#define GPIO_NR_PALMLD_USB_DETECT_N 3
#define GPIO_NR_PALMLD_USB_READY 86
#define GPIO_NR_PALMLD_USB_RESET 88
#define GPIO_NR_PALMLD_USB_INT 106
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|