linux-rp: refreshed sharpsl-rc patch

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4978 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Marcin Juszkiewicz 2008-07-29 10:15:13 +00:00
parent f7ba3aad31
commit a257966198
1 changed files with 139 additions and 92 deletions

View File

@ -8,11 +8,60 @@ It is not clean enough to be upstreamed:
* linear input device
* virtual keyboard on top of linear input device
Index: linux-2.6.26-rc4/arch/arm/mach-pxa/spitz.c
===================================================================
--- linux-2.6.26-rc4.orig/arch/arm/mach-pxa/spitz.c 2008-06-02 00:20:03.000000000 +0100
+++ linux-2.6.26-rc4/arch/arm/mach-pxa/spitz.c 2008-06-02 00:20:05.000000000 +0100
@@ -261,6 +261,13 @@
---
arch/arm/mach-pxa/sharpsl.h | 7
arch/arm/mach-pxa/sharpsl_pm.c | 2
arch/arm/mach-pxa/spitz.c | 8
arch/arm/mach-pxa/spitz_pm.c | 7
drivers/input/keyboard/Kconfig | 11 +
drivers/input/keyboard/Makefile | 1
drivers/input/keyboard/sharpsl_rc.c | 319 ++++++++++++++++++++++++++++++++++
drivers/input/keyboard/spitzkbd.c | 27 ++
include/asm-arm/hardware/sharpsl_pm.h | 7
include/linux/input.h | 1
10 files changed, 382 insertions(+), 8 deletions(-)
--- linux-2.6.26.orig/arch/arm/mach-pxa/sharpsl.h
+++ linux-2.6.26/arch/arm/mach-pxa/sharpsl.h
@@ -35,17 +35,12 @@ void corgi_lcdtg_hw_init(int mode);
/*
* SharpSL Battery/PM Driver
*/
#define READ_GPIO_BIT(x) (GPLR(x) & GPIO_bit(x))
-/* MAX1111 Channel Definitions */
-#define MAX1111_BATT_VOLT 4u
-#define MAX1111_BATT_TEMP 2u
-#define MAX1111_ACIN_VOLT 6u
-
extern struct battery_thresh spitz_battery_levels_acin[];
extern struct battery_thresh spitz_battery_levels_noac[];
void sharpsl_pm_pxa_init(void);
void sharpsl_pm_pxa_remove(void);
-int sharpsl_pm_pxa_read_max1111(int channel);
+
--- linux-2.6.26.orig/arch/arm/mach-pxa/sharpsl_pm.c
+++ linux-2.6.26/arch/arm/mach-pxa/sharpsl_pm.c
@@ -134,10 +134,12 @@ int sharpsl_pm_pxa_read_max1111(int chan
return corgi_ssp_max1111_get((channel << MAXCTRL_SEL_SH) | MAXCTRL_PD0 | MAXCTRL_PD1
| MAXCTRL_SGL | MAXCTRL_UNI | MAXCTRL_STR);
}
+EXPORT_SYMBOL(sharpsl_pm_pxa_read_max1111);
+
void sharpsl_pm_pxa_init(void)
{
pxa_gpio_mode(sharpsl_pm.machinfo->gpio_acin | GPIO_IN);
pxa_gpio_mode(sharpsl_pm.machinfo->gpio_batfull | GPIO_IN);
pxa_gpio_mode(sharpsl_pm.machinfo->gpio_batlock | GPIO_IN);
--- linux-2.6.26.orig/arch/arm/mach-pxa/spitz.c
+++ linux-2.6.26/arch/arm/mach-pxa/spitz.c
@@ -259,10 +259,17 @@ static struct platform_device spitzbl_de
static struct platform_device spitzkbd_device = {
.name = "spitz-keyboard",
.id = -1,
};
@ -26,7 +75,11 @@ Index: linux-2.6.26-rc4/arch/arm/mach-pxa/spitz.c
/*
* Spitz LEDs
@@ -522,6 +529,7 @@
*/
static struct platform_device spitzled_device = {
@@ -520,10 +527,11 @@ static struct pxafb_mach_info spitz_pxaf
static struct platform_device *devices[] __initdata = {
&spitzscoop_device,
&spitzssp_device,
&spitzkbd_device,
@ -34,11 +87,33 @@ Index: linux-2.6.26-rc4/arch/arm/mach-pxa/spitz.c
&spitzts_device,
&spitzbl_device,
&spitzled_device,
Index: linux-2.6.26-rc4/drivers/input/keyboard/Kconfig
===================================================================
--- linux-2.6.26-rc4.orig/drivers/input/keyboard/Kconfig 2008-06-02 00:20:03.000000000 +0100
+++ linux-2.6.26-rc4/drivers/input/keyboard/Kconfig 2008-06-02 09:46:10.000000000 +0100
@@ -175,6 +175,17 @@
};
--- linux-2.6.26.orig/arch/arm/mach-pxa/spitz_pm.c
+++ linux-2.6.26/arch/arm/mach-pxa/spitz_pm.c
@@ -158,10 +158,17 @@ static int spitz_should_wakeup(unsigned
is_resume |= GPIO_bit(SPITZ_GPIO_SYNC);
if (resume_on_alarm && (PEDR & PWER_RTC))
is_resume |= PWER_RTC;
+ printk("wakeup: PEDR: %x, PKSR: %x, HP_IN: %x, AK_INT: %x\n", PEDR, PKSR, GPIO_bit(SPITZ_GPIO_HP_IN), GPIO_bit(SPITZ_GPIO_AK_INT));
+
+ //remote/headphone interrupt, wakeup
+ if (PEDR == 0 && (PKSR & 0xc0d01) != 0) {
+ is_resume |= PWER_RTC;
+ }
+
dev_dbg(sharpsl_pm.dev, "is_resume: %x\n",is_resume);
return is_resume;
}
static unsigned long spitz_charger_wakeup(void)
--- linux-2.6.26.orig/drivers/input/keyboard/Kconfig
+++ linux-2.6.26/drivers/input/keyboard/Kconfig
@@ -173,10 +173,21 @@ config KEYBOARD_TOSA_USE_EXT_KEYCODES
(>= 127) keycodes. Be aware, that they can't be correctly interpreted
by either console keyboard driver or by Kdrive keybd driver.
Say Y only if you know, what you are doing!
@ -56,20 +131,20 @@ Index: linux-2.6.26-rc4/drivers/input/keyboard/Kconfig
config KEYBOARD_AMIGA
tristate "Amiga keyboard"
depends on AMIGA
Index: linux-2.6.26-rc4/drivers/input/keyboard/Makefile
===================================================================
--- linux-2.6.26-rc4.orig/drivers/input/keyboard/Makefile 2008-06-02 00:20:03.000000000 +0100
+++ linux-2.6.26-rc4/drivers/input/keyboard/Makefile 2008-06-02 09:46:10.000000000 +0100
@@ -26,4 +26,5 @@
help
Say Y here if you are running Linux on any AMIGA and have a keyboard
--- linux-2.6.26.orig/drivers/input/keyboard/Makefile
+++ linux-2.6.26/drivers/input/keyboard/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_KEYBOARD_AAED2000) += aaed
obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
obj-$(CONFIG_KEYBOARD_HP6XX) += jornada680_kbd.o
obj-$(CONFIG_KEYBOARD_HP7XX) += jornada720_kbd.o
obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o
obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o
+obj-$(CONFIG_SHARPSL_RC) += sharpsl_rc.o
obj-$(CONFIG_KEYBOARD_SH_KEYSC) += sh_keysc.o
Index: linux-2.6.26-rc4/drivers/input/keyboard/sharpsl_rc.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.26-rc4/drivers/input/keyboard/sharpsl_rc.c 2008-06-02 09:47:39.000000000 +0100
--- /dev/null
+++ linux-2.6.26/drivers/input/keyboard/sharpsl_rc.c
@@ -0,0 +1,319 @@
+/*
+ * Keyboard driver for Sharp Clamshell Models (SL-Cxx00)
@ -390,11 +465,11 @@ Index: linux-2.6.26-rc4/drivers/input/keyboard/sharpsl_rc.c
+MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
+MODULE_DESCRIPTION("SharpSL Remote Control Driver");
+MODULE_LICENSE("GPL");
Index: linux-2.6.26-rc4/drivers/input/keyboard/spitzkbd.c
===================================================================
--- linux-2.6.26-rc4.orig/drivers/input/keyboard/spitzkbd.c 2008-06-02 00:20:03.000000000 +0100
+++ linux-2.6.26-rc4/drivers/input/keyboard/spitzkbd.c 2008-06-02 00:20:05.000000000 +0100
@@ -19,6 +19,7 @@
--- linux-2.6.26.orig/drivers/input/keyboard/spitzkbd.c
+++ linux-2.6.26/drivers/input/keyboard/spitzkbd.c
@@ -17,10 +17,11 @@
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/jiffies.h>
#include <linux/module.h>
#include <linux/slab.h>
@ -402,7 +477,11 @@ Index: linux-2.6.26-rc4/drivers/input/keyboard/spitzkbd.c
#include <asm/arch/spitz.h>
#include <asm/arch/hardware.h>
@@ -280,13 +281,21 @@
#include <asm/arch/pxa-regs.h>
#include <asm/arch/pxa2xx-gpio.h>
@@ -278,17 +279,25 @@ static irqreturn_t spitzkbd_hinge_isr(in
#define HINGE_STABLE_COUNT 2
static int sharpsl_hinge_state;
static int hinge_count;
@ -424,7 +503,11 @@ Index: linux-2.6.26-rc4/drivers/input/keyboard/spitzkbd.c
state |= (GPLR(SPITZ_GPIO_AK_INT) & GPIO_bit(SPITZ_GPIO_AK_INT));
if (state != sharpsl_hinge_state) {
hinge_count = 0;
@@ -300,9 +309,18 @@
sharpsl_hinge_state = state;
} else if (hinge_count < HINGE_STABLE_COUNT) {
@@ -298,13 +307,22 @@ static void spitzkbd_hinge_timer(unsigne
if (hinge_count >= HINGE_STABLE_COUNT) {
spin_lock_irqsave(&spitzkbd_data->lock, flags);
input_report_switch(spitzkbd_data->input, SW_LID, ((GPLR(SPITZ_GPIO_SWA) & GPIO_bit(SPITZ_GPIO_SWA)) != 0));
input_report_switch(spitzkbd_data->input, SW_TABLET_MODE, ((GPLR(SPITZ_GPIO_SWB) & GPIO_bit(SPITZ_GPIO_SWB)) != 0));
@ -444,7 +527,11 @@ Index: linux-2.6.26-rc4/drivers/input/keyboard/spitzkbd.c
spin_unlock_irqrestore(&spitzkbd_data->lock, flags);
} else {
mod_timer(&spitzkbd_data->htimer, jiffies + msecs_to_jiffies(HINGE_SCAN_INTERVAL));
@@ -396,6 +414,7 @@
}
}
@@ -394,10 +412,11 @@ static int __init spitzkbd_probe(struct
clear_bit(0, input_dev->keybit);
set_bit(KEY_SUSPEND, input_dev->keybit);
set_bit(SW_LID, input_dev->swbit);
set_bit(SW_TABLET_MODE, input_dev->swbit);
set_bit(SW_HEADPHONE_INSERT, input_dev->swbit);
@ -452,7 +539,11 @@ Index: linux-2.6.26-rc4/drivers/input/keyboard/spitzkbd.c
err = input_register_device(input_dev);
if (err)
@@ -433,9 +452,12 @@
goto fail;
@@ -431,13 +450,16 @@ static int __init spitzkbd_probe(struct
IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
"Spitzkbd SWA", spitzkbd);
request_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd_hinge_isr,
IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
"Spitzkbd SWB", spitzkbd);
@ -466,7 +557,11 @@ Index: linux-2.6.26-rc4/drivers/input/keyboard/spitzkbd.c
return 0;
@@ -456,6 +478,7 @@
fail: input_free_device(input_dev);
kfree(spitzkbd);
@@ -454,10 +476,11 @@ static int spitzkbd_remove(struct platfo
free_irq(SPITZ_IRQ_GPIO_SYNC, spitzkbd);
free_irq(SPITZ_IRQ_GPIO_ON_KEY, spitzkbd);
free_irq(SPITZ_IRQ_GPIO_SWA, spitzkbd);
free_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd);
@ -474,45 +569,13 @@ Index: linux-2.6.26-rc4/drivers/input/keyboard/spitzkbd.c
free_irq(SPITZ_IRQ_GPIO_AK_INT, spitzkbd);
del_timer_sync(&spitzkbd->htimer);
Index: linux-2.6.26-rc4/arch/arm/mach-pxa/sharpsl.h
===================================================================
--- linux-2.6.26-rc4.orig/arch/arm/mach-pxa/sharpsl.h 2008-06-02 00:20:03.000000000 +0100
+++ linux-2.6.26-rc4/arch/arm/mach-pxa/sharpsl.h 2008-06-02 00:20:05.000000000 +0100
@@ -37,15 +37,10 @@
*/
#define READ_GPIO_BIT(x) (GPLR(x) & GPIO_bit(x))
del_timer_sync(&spitzkbd->timer);
-/* MAX1111 Channel Definitions */
-#define MAX1111_BATT_VOLT 4u
-#define MAX1111_BATT_TEMP 2u
-#define MAX1111_ACIN_VOLT 6u
-
extern struct battery_thresh spitz_battery_levels_acin[];
extern struct battery_thresh spitz_battery_levels_noac[];
void sharpsl_pm_pxa_init(void);
void sharpsl_pm_pxa_remove(void);
-int sharpsl_pm_pxa_read_max1111(int channel);
+
Index: linux-2.6.26-rc4/arch/arm/mach-pxa/sharpsl_pm.c
===================================================================
--- linux-2.6.26-rc4.orig/arch/arm/mach-pxa/sharpsl_pm.c 2008-06-02 00:20:03.000000000 +0100
+++ linux-2.6.26-rc4/arch/arm/mach-pxa/sharpsl_pm.c 2008-06-02 00:20:05.000000000 +0100
@@ -136,6 +136,8 @@
| MAXCTRL_SGL | MAXCTRL_UNI | MAXCTRL_STR);
}
+EXPORT_SYMBOL(sharpsl_pm_pxa_read_max1111);
+
void sharpsl_pm_pxa_init(void)
{
pxa_gpio_mode(sharpsl_pm.machinfo->gpio_acin | GPIO_IN);
Index: linux-2.6.26-rc4/include/asm-arm/hardware/sharpsl_pm.h
===================================================================
--- linux-2.6.26-rc4.orig/include/asm-arm/hardware/sharpsl_pm.h 2008-06-02 00:20:03.000000000 +0100
+++ linux-2.6.26-rc4/include/asm-arm/hardware/sharpsl_pm.h 2008-06-02 00:20:05.000000000 +0100
@@ -104,3 +104,10 @@
--- linux-2.6.26.orig/include/asm-arm/hardware/sharpsl_pm.h
+++ linux-2.6.26/include/asm-arm/hardware/sharpsl_pm.h
@@ -102,5 +102,12 @@ void sharpsl_battery_kick(void);
void sharpsl_pm_led(int val);
irqreturn_t sharpsl_ac_isr(int irq, void *dev_id);
irqreturn_t sharpsl_chrg_full_isr(int irq, void *dev_id);
irqreturn_t sharpsl_fatal_isr(int irq, void *dev_id);
@ -523,33 +586,17 @@ Index: linux-2.6.26-rc4/include/asm-arm/hardware/sharpsl_pm.h
+#define MAX1111_ACIN_VOLT 6u
+
+int sharpsl_pm_pxa_read_max1111(int channel);
Index: linux-2.6.26-rc4/include/linux/input.h
===================================================================
--- linux-2.6.26-rc4.orig/include/linux/input.h 2008-06-02 00:20:03.000000000 +0100
+++ linux-2.6.26-rc4/include/linux/input.h 2008-06-02 00:20:05.000000000 +0100
@@ -638,6 +638,7 @@
--- linux-2.6.26.orig/include/linux/input.h
+++ linux-2.6.26/include/linux/input.h
@@ -638,10 +638,11 @@ struct input_absinfo {
#define SW_TABLET_MODE 0x01 /* set = tablet mode */
#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */
#define SW_RADIO 0x03 /* set = radio enabled */
#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any"
set = radio enabled */
#define SW_RADIO SW_RFKILL_ALL /* deprecated */
+#define SW_REMOTE_INSERT 0x04 /* set = remote */
#define SW_MAX 0x0f
#define SW_CNT (SW_MAX+1)
Index: linux-2.6.26-rc4/arch/arm/mach-pxa/spitz_pm.c
===================================================================
--- linux-2.6.26-rc4.orig/arch/arm/mach-pxa/spitz_pm.c 2008-06-02 00:20:03.000000000 +0100
+++ linux-2.6.26-rc4/arch/arm/mach-pxa/spitz_pm.c 2008-06-02 09:46:10.000000000 +0100
@@ -160,6 +160,13 @@
if (resume_on_alarm && (PEDR & PWER_RTC))
is_resume |= PWER_RTC;
+ printk("wakeup: PEDR: %x, PKSR: %x, HP_IN: %x, AK_INT: %x\n", PEDR, PKSR, GPIO_bit(SPITZ_GPIO_HP_IN), GPIO_bit(SPITZ_GPIO_AK_INT));
+
+ //remote/headphone interrupt, wakeup
+ if (PEDR == 0 && (PKSR & 0xc0d01) != 0) {
+ is_resume |= PWER_RTC;
+ }
+
dev_dbg(sharpsl_pm.dev, "is_resume: %x\n",is_resume);
return is_resume;
}
/*
* Misc events