|
From: <cri...@us...> - 2006-10-20 18:49:51
|
Revision: 639
http://svn.sourceforge.net/hackndev/?rev=639&view=rev
Author: cristianop
Date: 2006-10-20 11:49:32 -0700 (Fri, 20 Oct 2006)
Log Message:
-----------
palmtx: first batch of changes for new kernel
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/configs/palmtx_defconfig
linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Kconfig
linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Makefile
linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmld_ac97.c
linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx.c
linux4palm/linux/trunk/drivers/input/keyboard/Kconfig
linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-ac97.h
Modified: linux4palm/linux/trunk/arch/arm/configs/palmtx_defconfig
===================================================================
--- linux4palm/linux/trunk/arch/arm/configs/palmtx_defconfig 2006-10-20 18:31:37 UTC (rev 638)
+++ linux4palm/linux/trunk/arch/arm/configs/palmtx_defconfig 2006-10-20 18:49:32 UTC (rev 639)
@@ -1,13 +1,15 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.16-hnd0
-# Mon Sep 18 19:46:51 2006
+# Linux kernel version: 2.6.17-hnd0
+# Fri Oct 20 20:36:57 2006
#
CONFIG_ARM=y
CONFIG_MMU=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_MTD_XIP=y
+CONFIG_VECTORS_BASE=0xffff0000
#
# Code maturity level options
@@ -29,7 +31,10 @@
# CONFIG_AUDIT is not set
# CONFIG_IKCONFIG is not set
# CONFIG_MINIMAL_OOPS is not set
-CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_RELAY is not set
+CONFIG_INITRAMFS_SOURCE="../initramfs/root"
+CONFIG_INITRAMFS_ROOT_UID=0
+CONFIG_INITRAMFS_ROOT_GID=0
CONFIG_UID16=y
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
# CONFIG_EMBEDDED is not set
@@ -45,10 +50,6 @@
CONFIG_SHMEM=y
CONFIG_USELIB=y
CONFIG_CORE_DUMP=y
-CONFIG_CC_ALIGN_FUNCTIONS=0
-CONFIG_CC_ALIGN_LABELS=0
-CONFIG_CC_ALIGN_LOOPS=0
-CONFIG_CC_ALIGN_JUMPS=0
CONFIG_SLAB=y
# CONFIG_TINY_SHMEM is not set
CONFIG_BASE_SMALL=0
@@ -60,7 +61,6 @@
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
-CONFIG_OBSOLETE_MODPARM=y
# CONFIG_MODVERSIONS is not set
# CONFIG_MODULE_SRCVERSION_ALL is not set
# CONFIG_KMOD is not set
@@ -68,6 +68,7 @@
#
# Block layer
#
+# CONFIG_BLK_DEV_IO_TRACE is not set
#
# IO Schedulers
@@ -89,11 +90,13 @@
# CONFIG_ARCH_CLPS711X is not set
# CONFIG_ARCH_CO285 is not set
# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
# CONFIG_ARCH_FOOTBRIDGE is not set
# CONFIG_ARCH_INTEGRATOR is not set
# CONFIG_ARCH_IOP3XX is not set
# CONFIG_ARCH_IXP4XX is not set
# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP23XX is not set
# CONFIG_ARCH_L7200 is not set
CONFIG_ARCH_PXA=y
# CONFIG_ARCH_RPC is not set
@@ -113,6 +116,7 @@
# Intel PXA2xx Implementations
#
# CONFIG_ARCH_LUBBOCK is not set
+# CONFIG_MACH_LOGICPD_PXA270 is not set
# CONFIG_MACH_MAINSTONE is not set
# CONFIG_ARCH_PXA_IDP is not set
# CONFIG_ARCH_ESERIES is not set
@@ -126,6 +130,12 @@
# CONFIG_MACH_HX2750 is not set
# CONFIG_ARCH_H5400 is not set
# CONFIG_MACH_HIMALAYA is not set
+# CONFIG_MACH_HTCUNIVERSAL is not set
+# CONFIG_MACH_HTCALPINE is not set
+# CONFIG_MACH_MAGICIAN is not set
+# CONFIG_MACH_HTCAPACHE is not set
+# CONFIG_MACH_BLUEANGEL is not set
+# CONFIG_MACH_HTCBEETLES is not set
# CONFIG_ARCH_AXIMX5 is not set
# CONFIG_ARCH_AXIMX3 is not set
# CONFIG_ARCH_ROVERP1 is not set
@@ -142,6 +152,7 @@
# CONFIG_MACH_OMAP_PALMTC is not set
# CONFIG_PXA_SHARPSL is not set
CONFIG_PXA27x=y
+CONFIG_PXA_RTC_EPOCH=1970
# CONFIG_SA1100_H3100 is not set
# CONFIG_SA1100_H3600 is not set
# CONFIG_SA1100_H3800 is not set
@@ -167,6 +178,7 @@
CONFIG_ARM_THUMB=y
# CONFIG_ARMBOOT_PROC is not set
CONFIG_XSCALE_PMU=y
+# CONFIG_KEXEC is not set
#
# Compaq/iPAQ Platforms
@@ -195,6 +207,7 @@
#
# CONFIG_PREEMPT is not set
CONFIG_NO_IDLE_HZ=y
+CONFIG_HZ=100
# CONFIG_AEABI is not set
# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
CONFIG_SELECT_MEMORY_MODEL=y
@@ -212,7 +225,7 @@
#
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_CMDLINE="root=/dev/ram0 rw mem=32m init=/linuxrc initrd=0xa0400000,330615"
+CONFIG_CMDLINE="mem=32M"
# CONFIG_XIP_KERNEL is not set
#
@@ -272,12 +285,15 @@
# CONFIG_INET_AH is not set
# CONFIG_INET_ESP is not set
# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
# CONFIG_INET_TUNNEL is not set
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
# CONFIG_TCP_CONG_ADVANCED is not set
CONFIG_TCP_CONG_BIC=y
# CONFIG_IPV6 is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
# CONFIG_NETFILTER is not set
#
@@ -524,12 +540,13 @@
# CONFIG_KEYBOARD_XTKBD is not set
# CONFIG_KEYBOARD_NEWTON is not set
# CONFIG_KEYBOARD_STOWAWAY is not set
+CONFIG_KEYBOARD_PXA27x=m
CONFIG_KEYBOARD_PALMIR=m
-CONFIG_KEYBOARD_PXA27X=m
# CONFIG_INPUT_MOUSE is not set
# CONFIG_INPUT_JOYSTICK is not set
# CONFIG_INPUT_TOUCHSCREEN is not set
-# CONFIG_INPUT_MISC is not set
+CONFIG_INPUT_MISC=y
+# CONFIG_INPUT_UINPUT is not set
#
# Hardware I/O ports
@@ -599,9 +616,7 @@
# CONFIG_SENSORS_PCA9539 is not set
# CONFIG_SENSORS_PCA9535 is not set
# CONFIG_SENSORS_PCF8591 is not set
-# CONFIG_SENSORS_RTC8564 is not set
# CONFIG_SENSORS_MAX6875 is not set
-# CONFIG_RTC_X1205_I2C is not set
# CONFIG_I2C_DEBUG_CORE is not set
# CONFIG_I2C_DEBUG_ALGO is not set
# CONFIG_I2C_DEBUG_BUS is not set
@@ -652,6 +667,7 @@
# SPI Master Controller Drivers
#
CONFIG_SPI_BITBANG=y
+CONFIG_SPI_PXA2XX=y
#
# SPI Protocol Masters
@@ -723,13 +739,23 @@
# CONFIG_MCP is not set
#
-# Multimedia Capabilities Port drivers
+# LED devices
#
+# CONFIG_NEW_LEDS is not set
#
+# LED drivers
+#
+
+#
+# LED Triggers
+#
+
+#
# Multimedia devices
#
# CONFIG_VIDEO_DEV is not set
+CONFIG_VIDEO_V4L2=y
#
# Digital Video Broadcasting Devices
@@ -744,6 +770,7 @@
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_IMAGEBLIT=y
# CONFIG_FB_MACMODES is not set
+CONFIG_FB_FIRMWARE_EDID=y
CONFIG_FB_MODE_HELPERS=y
# CONFIG_FB_TILEBLITTING is not set
# CONFIG_FB_IMAGEON is not set
@@ -773,6 +800,7 @@
CONFIG_BACKLIGHT_LCD_SUPPORT=y
CONFIG_BACKLIGHT_CLASS_DEVICE=m
CONFIG_BACKLIGHT_DEVICE=y
+# CONFIG_BACKLIGHT_CORGI is not set
CONFIG_BACKLIGHT_PXAPWM=m
CONFIG_LCD_CLASS_DEVICE=m
CONFIG_LCD_DEVICE=y
@@ -793,9 +821,11 @@
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=m
CONFIG_SND_PCM_OSS=m
+CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_SEQUENCER_OSS=y
# CONFIG_SND_DYNAMIC_MINORS is not set
# CONFIG_SND_SUPPORT_OLD_API is not set
+# CONFIG_SND_VERBOSE_PROCFS is not set
# CONFIG_SND_VERBOSE_PRINTK is not set
# CONFIG_SND_DEBUG is not set
@@ -816,7 +846,10 @@
# CONFIG_SND_A716 is not set
# CONFIG_SND_H1910 is not set
# CONFIG_SND_H2200 is not set
+# CONFIG_SND_H4000 is not set
+# CONFIG_SND_HTCMAGICIAN is not set
# CONFIG_SND_HX4700 is not set
+# CONFIG_SND_HTCUNIVERSAL is not set
# CONFIG_SND_H5XXX_AK4535 is not set
CONFIG_SND_PXA2xx_I2SOUND=m
CONFIG_SND_PXA2XX_PCM=m
@@ -832,6 +865,7 @@
#
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_ARCH_HAS_OHCI=y
+# CONFIG_USB_ARCH_HAS_EHCI is not set
# CONFIG_USB is not set
#
@@ -841,18 +875,19 @@
#
# USB Gadget Support
#
-CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET=m
# CONFIG_USB_GADGET_DEBUG_FILES is not set
CONFIG_USB_GADGET_SELECTED=y
# CONFIG_USB_GADGET_NET2280 is not set
# CONFIG_USB_GADGET_PXA2XX is not set
CONFIG_USB_GADGET_PXA27X=y
-CONFIG_USB_PXA27X=y
+CONFIG_USB_PXA27X=m
# CONFIG_USB_PXA27X_DMA is not set
# CONFIG_USB_GADGET_GOKU is not set
# CONFIG_USB_GADGET_MQ11XX is not set
# CONFIG_USB_GADGET_LH7A40X is not set
# CONFIG_USB_GADGET_OMAP is not set
+# CONFIG_USB_GADGET_AT91 is not set
# CONFIG_USB_GADGET_DUMMY_HCD is not set
# CONFIG_USB_GADGET_DUALSPEED is not set
# CONFIG_USB_ZERO is not set
@@ -877,11 +912,30 @@
# CONFIG_MMC_WBSD_PALMT3 is not set
#
-# LED devices
+# Real Time Clock
#
-# CONFIG_CLASS_LEDS is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=m
#
+# RTC interfaces
+#
+CONFIG_RTC_INTF_SYSFS=m
+CONFIG_RTC_INTF_PROC=m
+CONFIG_RTC_INTF_DEV=m
+
+#
+# RTC drivers
+#
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+CONFIG_RTC_DRV_SA1100=m
+# CONFIG_RTC_DRV_TEST is not set
+
+#
# File systems
#
CONFIG_EXT2_FS=y
@@ -926,7 +980,6 @@
CONFIG_TMPFS=y
# CONFIG_HUGETLB_PAGE is not set
CONFIG_RAMFS=y
-# CONFIG_RELAYFS_FS is not set
# CONFIG_CONFIGFS_FS is not set
#
@@ -949,7 +1002,7 @@
# CONFIG_QNX4FS_FS is not set
# CONFIG_SYSV_FS is not set
# CONFIG_UFS_FS is not set
-# CONFIG_UNION_FS is not set
+CONFIG_UNION_FS=m
#
# Network File Systems
@@ -1036,7 +1089,9 @@
# CONFIG_DEBUG_KERNEL is not set
CONFIG_LOG_BUF_SHIFT=14
CONFIG_DEBUG_BUGVERBOSE=y
+# CONFIG_DEBUG_FS is not set
CONFIG_FRAME_POINTER=y
+# CONFIG_UNWIND_INFO is not set
# CONFIG_DEBUG_USER is not set
#
@@ -1058,7 +1113,7 @@
# Library routines
#
CONFIG_CRC_CCITT=y
-# CONFIG_CRC16 is not set
+CONFIG_CRC16=m
CONFIG_CRC32=y
-# CONFIG_LIBCRC32C is not set
+CONFIG_LIBCRC32C=m
CONFIG_ZLIB_INFLATE=m
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Kconfig
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Kconfig 2006-10-20 18:31:37 UTC (rev 638)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Kconfig 2006-10-20 18:49:32 UTC (rev 639)
@@ -10,7 +10,9 @@
depends on MACH_XSCALE_PALMTX
default y if MACH_XSCALE_PALMTX
help
- AC97 codec for Palm TX
+ AC97 codec for Palm TX.
+ Enable support for WM9712 touchscreen and battery for
+ the Palm TX PDA
config PALMTX_PCMCIA
tristate "Palm TX PCMCIA driver"
@@ -27,10 +29,3 @@
help
Enable core debug output for Palm TX modules.
-config PALMTX_AC97_DEBUG
- bool "Debug for Palm TX AC97 driver"
- depends on PALMTX_DEBUG && PALMTX_AC97
- default y if PALMTX_DEBUG && PALMTX_AC97
- help
- Enable debug output for Palm TX AC97 module.
-
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Makefile
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Makefile 2006-10-20 18:31:37 UTC (rev 638)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Makefile 2006-10-20 18:49:32 UTC (rev 639)
@@ -4,4 +4,4 @@
#
obj-$(CONFIG_MACH_XSCALE_PALMTX) += palmtx.o
obj-$(CONFIG_PALMTX_AC97) += palmld_ac97.o
-obj-$(CONFIG_PALMTX_PCMCIA) += palmld_pcmcia.o
+#obj-$(CONFIG_PALMTX_PCMCIA) += palmtx_pcmcia.o
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmld_ac97.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmld_ac97.c 2006-10-20 18:31:37 UTC (rev 638)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmld_ac97.c 2006-10-20 18:49:32 UTC (rev 639)
@@ -1,12 +1,19 @@
/*
- * linux/arch/arm/mach-pxa/palmld/palmld_ac97.c
+ * linux/arch/arm/mach-pxa/palmtx/palmld_ac97.c
*
- * Touchscreen/battery driver for Palm LifeDrive's WM9712 AC97 codec.
+ * Touchscreen/battery driver for Palm TX' WM9712 AC97 codec
*
- * Author: Alex Osborne <bob...@gm...>
- * Cristiano P. - adapted for Palm TX
+ * Based on palmld_ac97.c code from Alex Osborne
+ *
*/
+/* TODO:
+ - change DIG2_INIT to DIG2_BASE (useless to make an aasignment)
+ - fix battery code
+ - add battery charge
+ - suspend/resume (after having the TX ready for PM ...)
+*/
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
@@ -19,41 +26,41 @@
#include <asm/apm.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/palmtx-gpio.h>
-#include <asm/arch/palmtx-init.h>
-#include <asm/arch/palmld-ac97.h>
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-
#include <sound/driver.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/initval.h>
#include <sound/ac97_codec.h>
-#define X_AXIS_MAX 3900 //3630
-#define X_AXIS_MIN 350 //200
-#define Y_AXIS_MAX 3750 //3880
-#define Y_AXIS_MIN 320 //160
-#define PRESSURE_MIN 0
-#define PRESSURE_MAX 150 //300
+#include <asm/arch/palmtx-gpio.h>
+#include <asm/arch/palmtx-init.h>
+#include <asm/arch/palmld-ac97.h>
-#define DIG2_INIT 0x0001 /* initial value for digitiser2 register */
-#define AC97_LINK_FRAME 21 /* time in uS for AC97 link frame */
+#define X_AXIS_MAX 3900
+#define X_AXIS_MIN 350
+#define Y_AXIS_MAX 3750
+#define Y_AXIS_MIN 320
+#define PRESSURE_MIN 0
+#define PRESSURE_MAX 150
+#define DIG2_INIT 0x0001 /* initial value for digitiser2 reg */
+
#define DEFAULT_PRESSURE_TRESHOLD 45160 /* default pressure treshold for pen up/down */
#define DEFAULT_X_AXIS_FUZZ 5 /* default x axis noise treshold */
#define DEFAULT_Y_AXIS_FUZZ 35 /* default y axis noise treshold */
#define PRESSURE_FUZZ 5 /* default pressure noise treshold */
-#define palmld_ac97_WORK_QUEUE_NAME "palmld_ac97.c"
+#define palmld_ac97_WORK_QUEUE_NAME "palmld_ac97_workqueue"
+/* module parameters */
static int ptrsh = DEFAULT_PRESSURE_TRESHOLD;
module_param(ptrsh, int, 0);
@@ -71,6 +78,7 @@
module_param(ydjtrsh, int, 0);
MODULE_PARM_DESC(ydjtrsh, "treshold for y axis jitter");
+
static DECLARE_MUTEX_LOCKED(queue_sem);
static DECLARE_MUTEX(digitiser_sem);
static DECLARE_MUTEX(battery_update_mutex);
@@ -81,23 +89,18 @@
struct input_dev *palmld_ac97_input;
struct device *palmld_ac97_dev;
+static ac97_t *ac97;
+
static unsigned long last_update = 0;
-static int battery_voltage;
+static int current_voltage;
static int previous_voltage;
static u16 d2base;
-
-#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
-/* original APM hook */
-static void (*apm_get_power_status_orig)(struct apm_power_info *info);
-#endif
-
-
/*
* ac97 codec
*/
-void wm97xx_gpio_func(ac97_t *ac97, int gpio, int func)
+void wm97xx_gpio_func(int gpio, int func)
{
int GEn;
GEn = ac97->bus->ops->read(ac97, 0x56);
@@ -109,8 +112,7 @@
}
-void wm97xx_gpio_mode(ac97_t *ac97, int gpio, int config, int polarity,
- int sticky, int wakeup)
+void wm97xx_gpio_mode(int gpio, int config, int polarity, int sticky, int wakeup)
{
int GCn, GPn, GSn, GWn;
GCn = ac97->bus->ops->read(ac97, 0x4c);
@@ -145,10 +147,8 @@
}
-static void wm97xx_set_digitiser_power(struct device *dev, int value)
+static void wm97xx_set_digitiser_power(int value)
{
- ac97_t *ac97 = dev->platform_data;
-
ac97->bus->ops->write(ac97, AC97_WM97XX_DIGITISER2, d2base | value);
}
@@ -160,18 +160,18 @@
* (PXA27x Specification Update: 28007109.pdf sec.: E54)
*/
-static int palmld_ac97_take_reading(struct device *dev, int adcsel)
+static int palmld_ac97_take_reading(int adcsel)
{
- ac97_t *ac97 = dev->platform_data;
int timeout = 15;
u16 r76 = 0;
u16 r7a;
- r76 |= adcsel; /* set ADCSEL (ADC source) */
- r76 |= WM97XX_DELAY(3); /* set settling time delay DELAY */
- r76 &= ~(1<<11); /* COO = 0 (single measurement) */
- r76 &= ~(1<<10); /* CTC = 0 (polling mode) */
- r76 |= (1<<15); /* initiate measurement (POLL) */
+ r76 |= adcsel; /* set ADCSEL (ADC source) */
+ r76 |= WM97XX_DELAY(3); /* set settling time delay */
+ r76 &= ~(1<<11); /* COO = 0 (single measurement) */
+ r76 &= ~(1<<10); /* CTC = 0 (polling mode) */
+ r76 |= (1<<15); /* initiate measurement (POLL) */
+
ac97->bus->ops->write(ac97, 0x76, r76);
// wait settling time
@@ -184,14 +184,14 @@
}
if (timeout == 0){
- printk("wm9712: discarding reading due to POLL wait timout on 0x76\n");
+ printk("palmld_ac97: discarding reading due to POLL wait timout on 0x76\n");
return 0;
}
r7a = ac97->bus->ops->read(ac97, 0x7a);
if ((r7a & WM97XX_ADCSEL_MASK) != adcsel){
- printk("wm9712: discarding reading -> wrong ADC source\n");
+ printk("palmld_ac97: discarding reading -> wrong ADC source\n");
return 0;
}
@@ -199,158 +199,17 @@
}
-
-/*
- * battery
- */
-
-void update_data(int force)
+static void palmld_ac97_pendown(void)
{
- u16 reading;
-
- if(!force && ((last_update + 10 *HZ) > jiffies))
- return;
-
- if(down_trylock(&battery_update_mutex))
- return;
-
- down(&digitiser_sem);
- //wm97xx_set_digitiser_power(palmld_ac97_dev, WM97XX_PRP_DET_DIG);
- wm97xx_set_digitiser_power(palmld_ac97_dev, WM97XX_PRP_DET_DIG);
- // todo: check if reading is valid
- reading = palmld_ac97_take_reading(palmld_ac97_dev, WM97XX_ADCSEL_BMON);
- wm97xx_set_digitiser_power(palmld_ac97_dev, WM97XX_PRP_DET);
- up(&digitiser_sem);
- previous_voltage = battery_voltage;
- battery_voltage = reading & 0xfff;
- //printk("wm9712: battery -> %d\n", battery_voltage);
- last_update = jiffies;
-
- up(&battery_update_mutex);
-}
-
-#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
-static void palmtx_apm_get_power_status(struct apm_power_info *info){
- update_data(0);
- info->ac_line_status = (GET_GPIO(GPIO_NR_PALMTX_POWER_DETECT)) ? APM_AC_ONLINE : APM_AC_OFFLINE;
- // TODO: correct this stuff ... (see correct formula into get_voltage() )
- if (info->ac_line_status == APM_AC_ONLINE)
- info->battery_status = APM_BATTERY_STATUS_CHARGING;
-
- if (battery_voltage * 3 > PALMTX_BAT_MAX_VOLTAGE - 200)
- info->battery_status = APM_BATTERY_STATUS_HIGH;
- else if (battery_voltage * 3 <= PALMTX_BAT_MIN_VOLTAGE)
- info->battery_status = APM_BATTERY_STATUS_CRITICAL;
- else
- info->battery_status = APM_BATTERY_STATUS_LOW;
-
-}
-#endif
-
-
-int get_min_voltage(struct battery *b)
-{
- return PALMTX_BAT_MIN_VOLTAGE;
-}
-
-int get_min_charge(struct battery *b)
-{
- return PALMTX_BAT_MIN_CHARGE;
-}
-
-int get_max_voltage(struct battery *b)
-{
- return PALMTX_BAT_MAX_VOLTAGE; /* mV */
-}
-
-int get_max_charge(struct battery *b)
-{
- return PALMTX_BAT_MAX_CHARGE;
-}
-
-// let's suppose AVDD=+3.3v so battV = intV * 3 * 0.80586
-// note: 0.80586 = 3.3/4095
-int get_voltage(struct battery *b)
-{
- update_data(0);
- return battery_voltage * 3 * 80586 / 100000;
-}
-
-int get_charge(struct battery *b)
-{
- return 0;
-}
-
-int get_status(struct battery *b)
-{
- int ac_connected = 0;
-
- ac_connected = GET_GPIO(GPIO_NR_PALMTX_POWER_DETECT);
-
- if (battery_voltage <= 0)
- return BATTERY_STATUS_UNKNOWN;
-
- if (ac_connected){
- // TODO: ok maybe this is too stupid ... to be reviewed
- if ( ( battery_voltage > previous_voltage ) || (battery_voltage <= PALMTX_BAT_MAX_VOLTAGE) )
- return BATTERY_STATUS_CHARGING;
- return BATTERY_STATUS_NOT_CHARGING;
- }
- else
- return BATTERY_STATUS_DISCHARGING;
-}
-
-static struct battery palmld_battery = {
- .name = "palmtx-battery",
- .id = "battery0",
- .get_min_voltage = get_min_voltage,
- .get_min_current = NULL,
- .get_min_charge = get_min_charge,
- .get_max_voltage = get_max_voltage,
- .get_max_current = NULL,
- .get_max_charge = get_max_charge,
- .get_temp = NULL,
- .get_voltage = get_voltage,
- .get_current = NULL,
- .get_charge = get_charge,
- .get_status = get_status,
-};
-
-/*
-static int
-battery_class_hotplug(struct class_device *dev, char **envp, int num_envp,
- char *buffer, int buffer_size)
-{
- return 0;
-}
-*/
-
-static void
-battery_class_release(struct class_device *dev)
-{
-}
-
-static void
-battery_class_class_release(struct class *class)
-{
-}
-
-
-/*
- * touchscreen
- */
-
-static void palmld_ac97_pendown(struct device *dev)
-{
int xread, yread, pressure;
int valid_coords=0, btn_pressed = 0;
/* take readings until the pen goes up */
do {
/* take readings */
- xread = palmld_ac97_take_reading(dev, WM97XX_ADCSEL_X);
- yread = palmld_ac97_take_reading(dev, WM97XX_ADCSEL_Y);
- pressure = palmld_ac97_take_reading(dev, WM97XX_ADCSEL_PRES);
+ xread = palmld_ac97_take_reading(WM97XX_ADCSEL_X);
+ yread = palmld_ac97_take_reading(WM97XX_ADCSEL_Y);
+ pressure = palmld_ac97_take_reading(WM97XX_ADCSEL_PRES);
valid_coords = (xread & 0xfff) && (yread & 0xfff) && (pressure & 0xfff);
@@ -382,8 +241,8 @@
static void palmld_ac97_irq_work(void *data)
{
- struct device *dev = data;
- ac97_t *ac97 = dev->platform_data;
+ //struct device *dev = data;
+ //ac97_t *ac97 = dev->platform_data;
u16 levels;
u16 polarity;
@@ -393,12 +252,12 @@
if(polarity & levels & WM97XX_GPIO_13) {
// power up digitiser:
down(&digitiser_sem);
- wm97xx_set_digitiser_power(dev, WM97XX_PRP_DET_DIG);
+ wm97xx_set_digitiser_power(WM97XX_PRP_DET_DIG);
- palmld_ac97_pendown(dev);
+ palmld_ac97_pendown();
/* power down digitiser to conserve power */
- wm97xx_set_digitiser_power(dev, WM97XX_PRP_DET);
+ wm97xx_set_digitiser_power(WM97XX_PRP_DET);
ac97->bus->ops->write(ac97, 0x4e, polarity & ~WM97XX_GPIO_13);
up(&digitiser_sem);
}
@@ -420,6 +279,7 @@
disable_irq(IRQ_GPIO_PALMTX_WM9712_IRQ);
queue_work(palmld_ac97_workqueue, &palmld_ac97_irq_task);
}
+
return IRQ_HANDLED;
}
@@ -428,19 +288,18 @@
static int __init palmld_ac97_probe(struct device *dev)
{
int err;
- ac97_t *ac97 = dev->platform_data;
u16 d2 = DIG2_INIT; // init d1 too?
-
+
if(!machine_is_xscale_palmtx())
return -ENODEV;
- /* for use by battery level monitor */
- palmld_ac97_dev = dev;
+ ac97 = to_ac97_t(dev);
set_irq_type(IRQ_GPIO_PALMTX_WM9712_IRQ, IRQT_RISING);
+
err = request_irq(IRQ_GPIO_PALMTX_WM9712_IRQ, palmld_ac97_irq_handler,
SA_INTERRUPT, "WM9712 pendown IRQ", dev);
-
+
if(err) {
printk(KERN_ERR "palmld_ac97_probe: cannot request pen down IRQ\n");
return -1;
@@ -453,25 +312,29 @@
d2 |= WM97XX_PRP_DET;
d2base = d2;
ac97->bus->ops->write(ac97, AC97_WM97XX_DIGITISER2, d2base);
-
+
/* enable interrupts on codec's gpio 2 (connected to cpu gpio 27) */
- wm97xx_gpio_mode(ac97, WM97XX_GPIO_2, WM97XX_GPIO_IN,
- WM97XX_GPIO_POL_HIGH, WM97XX_GPIO_NOTSTICKY, WM97XX_GPIO_NOWAKE);
- wm97xx_gpio_func(ac97, WM97XX_GPIO_2, 0);
+ wm97xx_gpio_mode(WM97XX_GPIO_2, WM97XX_GPIO_IN, WM97XX_GPIO_POL_HIGH,
+ WM97XX_GPIO_NOTSTICKY, WM97XX_GPIO_NOWAKE);
+ wm97xx_gpio_func(WM97XX_GPIO_2, 0);
/* enable pen detect interrupt */
- wm97xx_gpio_mode(ac97, WM97XX_GPIO_13, WM97XX_GPIO_IN,
- WM97XX_GPIO_POL_HIGH, WM97XX_GPIO_STICKY, WM97XX_GPIO_WAKE);
-
-
+ wm97xx_gpio_mode(WM97XX_GPIO_13, WM97XX_GPIO_IN, WM97XX_GPIO_POL_HIGH,
+ WM97XX_GPIO_STICKY, WM97XX_GPIO_WAKE);
+
/* turn off irq gpio inverting */
ac97->bus->ops->write(ac97, 0x58, ac97->bus->ops->read(ac97, 0x58)&~1);
/* turn on the digitiser and pen down detector */
ac97->bus->ops->write(ac97, AC97_WM97XX_DIGITISER2, d2base | WM97XX_PRP_DETW);
-
+
/* setup the input device */
palmld_ac97_input = input_allocate_device();
+ if (palmld_ac97_input == NULL){
+ printk ("palmld_ac97_probe: cannot allocate input device\n");
+ return -ENOMEM;
+ }
+
palmld_ac97_input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
palmld_ac97_input->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
@@ -479,71 +342,62 @@
input_set_abs_params(palmld_ac97_input, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, ydjtrsh, 0);
input_set_abs_params(palmld_ac97_input, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, PRESSURE_FUZZ, 0);
- palmld_ac97_input->name = "Palm TX touchscreen (Wolfson WM9712)";
+ palmld_ac97_input->name = "palmtx touchscreen";
palmld_ac97_input->dev = dev;
palmld_ac97_input->id.bustype = BUS_HOST;
input_register_device(palmld_ac97_input);
-
-#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
- apm_get_power_status = palmtx_apm_get_power_status;
-#endif
/* setup work queue */
palmld_ac97_workqueue = create_workqueue(palmld_ac97_WORK_QUEUE_NAME);
INIT_WORK(&palmld_ac97_irq_task, palmld_ac97_irq_work, dev);
- /* register battery */
-
- if(battery_class_register(&palmld_battery)) {
- printk(KERN_ERR "palmld_ac97_probe: Could not register battery class\n");
- } else {
- palmld_battery.class_dev.class->release = battery_class_release;
- // palmld_battery.class_dev.class->hotplug = battery_class_hotplug;
- palmld_battery.class_dev.class->class_release = battery_class_class_release;
- }
-
-
up(&queue_sem);
return 0;
}
+
static int palmld_ac97_remove (struct device *dev)
{
- ac97_t *ac97 = dev->platform_data;
- printk("x: %x\n", ac97->bus->ops->read(ac97, AC97_WM97XX_DIGITISER2));
+ // TODO: stop running tasks if any?
+
+ ac97 = NULL;
input_unregister_device(palmld_ac97_input);
- free_irq(IRQ_GPIO_PALMTX_WM9712_IRQ, dev);
return 0;
}
+
static struct device_driver palmld_ac97_driver = {
- .name = "WM9712",
+ .name = "palmld_ac97 (WM9712)",
.bus = &ac97_bus_type,
+ .owner = THIS_MODULE,
.probe = palmld_ac97_probe,
.remove = palmld_ac97_remove,
+
#ifdef CONFIG_PM
.suspend = NULL,
.resume = NULL,
#endif
};
+
static int __init palmld_ac97_init(void)
{
if(!machine_is_xscale_palmtx())
return -ENODEV;
-
return driver_register(&palmld_ac97_driver);
}
+
static void __exit palmld_ac97_exit(void)
{
driver_unregister(&palmld_ac97_driver);
}
+
module_init(palmld_ac97_init);
module_exit(palmld_ac97_exit);
MODULE_AUTHOR ("Alex Osborne <bob...@gm...>");
-MODULE_DESCRIPTION ("WM9712 AC97 codec support for Palm LifeDrive");
+MODULE_DESCRIPTION ("WM9712 AC97 codec support for Palm TX");
MODULE_LICENSE ("GPL");
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx.c 2006-10-20 18:31:37 UTC (rev 638)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx.c 2006-10-20 18:49:32 UTC (rev 639)
@@ -22,6 +22,7 @@
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/fb.h>
+#include <linux/input.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -30,20 +31,17 @@
#include <asm/arch/audio.h>
#include <asm/arch/hardware.h>
#include <asm/arch/mmc.h>
+#include <asm/arch/pxafb.h>
#include <asm/arch/pxa-dmabounce.h>
-#include <asm/arch/pxafb.h>
#include <asm/arch/pxa-regs.h>
+#include <asm/arch/udc.h>
+#include <asm/arch/pxa27x_keyboard.h>
+#include <asm/arch/pxapwm-bl.h>
#include "../generic.h"
#include "../drivers/serial/pxa-serial.h"
-
-#include <asm/arch/udc.h>
-
#include <../drivers/pcmcia/soc_common.h>
-#include <asm/arch/pxa27x-keypad.h>
-#include <asm/arch/pxapwm-bl.h>
-
#include "asm-arm/arch-pxa/palmtx-init.h"
#include "asm-arm/arch-pxa/palmtx-gpio.h"
@@ -101,27 +99,74 @@
// Keypad driver
+static struct pxa27x_keyboard_platform_data palmtx_kbd_data = {
+ .nr_rows = 4,
+ .nr_cols = 3,
+ .keycodes = {
+ { /* row 0 */
+ KEY_POWER,
+ KEY_F9,
+ KEY_ENTER,
+ },
+ { /* row 1 */
+ KEY_F10,
+ KEY_F11,
+ KEY_F12,
+ },
+ { /* row 2 */
+ KEY_UP,
+ -1,
+ KEY_DOWN,
+ },
+ {
+ /* row 3 */
+ KEY_RIGHT,
+ -1,
+ KEY_LEFT,
+ },
-static int palmtx_keypad_matrix[] = {
- /* row 0 */
- KEY_POWER,
- KEY_F9,
- KEY_ENTER,
- /* row 1 */
- KEY_F10,
- KEY_F11,
- KEY_F12,
- /* row 2 */
- KEY_UP,
- -1,
- KEY_DOWN,
- /* row 3 */
- KEY_RIGHT,
- -1,
- KEY_LEFT,
- };
+ },
+ .gpio_modes = {
+ GPIO_NR_PALMTX_KP_MKIN0_MD,
+ GPIO_NR_PALMTX_KP_MKIN1_MD,
+ GPIO_NR_PALMTX_KP_MKIN2_MD,
+ GPIO_NR_PALMTX_KP_MKIN3_MD,
+ GPIO_NR_PALMTX_KP_MKOUT0_MD,
+ GPIO_NR_PALMTX_KP_MKOUT1_MD,
+ GPIO_NR_PALMTX_KP_MKOUT2_MD,
+ },
+};
+static struct platform_device palmtx_keypad = {
+ .name = "pxa27x-keyboard",
+ .id = -1,
+ .dev = {
+ .platform_data = &palmtx_kbd_data,
+ },
+};
+
+// static int palmtx_keypad_matrix[] = {
+// /* row 0 */
+// KEY_POWER,
+// KEY_F9,
+// KEY_ENTER,
+// /* row 1 */
+// KEY_F10,
+// KEY_F11,
+// KEY_F12,
+// /* row 2 */
+// KEY_UP,
+// -1,
+// KEY_DOWN,
+// /* row 3 */
+// KEY_RIGHT,
+// -1,
+// KEY_LEFT,
+// };
+
+
+/*
static struct pxa27x_keypad_platform_data palmtx_keypad_data = {
.matrix = palmtx_keypad_matrix,
.rows = 4,
@@ -136,6 +181,8 @@
},
};
+*/
+
// backlight
static struct pxapwmbl_platform_data palmtx_backlight_data = {
@@ -230,7 +277,7 @@
};
-// UDC
+// UDC (USB gadget controller)
static int palmtx_udc_is_connected (void){
int ret = !(GET_GPIO(GPIO_NR_PALMTX_USB_DETECT));
@@ -392,9 +439,11 @@
MACHINE_START(XSCALE_PALMTX, "Palm TX")
- .phys_ram = PALMTX_PHYS_RAM_START,
+ //.phys_ram = PALMTX_PHYS_RAM_START,
.phys_io = PALMTX_PHYS_IO_START,
- .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
+ //.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
+ .io_pg_offst = io_p2v(0x40000000),
+ .boot_params = 0xa0000100,
.map_io = palmtx_map_io,
.init_irq = pxa_init_irq,
.timer = &pxa_timer,
Modified: linux4palm/linux/trunk/drivers/input/keyboard/Kconfig
===================================================================
--- linux4palm/linux/trunk/drivers/input/keyboard/Kconfig 2006-10-20 18:31:37 UTC (rev 638)
+++ linux4palm/linux/trunk/drivers/input/keyboard/Kconfig 2006-10-20 18:49:32 UTC (rev 639)
@@ -201,7 +201,7 @@
This enables support for the buttons and joypad on HP iPAQ H2200.
config KEYBOARD_PXA27x
- tristate
+ tristate "PXA27x keypad and buttons Driver"
depends on PXA27x
help
Enable support for PXA27x matrix keyboard controller
Modified: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-ac97.h
===================================================================
--- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-ac97.h 2006-10-20 18:31:37 UTC (rev 638)
+++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-ac97.h 2006-10-20 18:49:32 UTC (rev 639)
@@ -87,4 +87,6 @@
#define WM97XX_GPIO_14 (1 << 14)
#define WM97XX_GPIO_15 (1 << 15)
+#define AC97_LINK_FRAME 21 /* time in uS for AC97 link frame */
+
#endif /* _PALMLD_AC97_H_ */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|