Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6919eb4 authored by Stanislav Brabec's avatar Stanislav Brabec Committed by Eric Miao
Browse files

[ARM] pxa/spitz: add gpio button support (fixes regression)



Updating desc for lid keys and resending patch with proper comments:
Define Spitz buttons as GPIO keys in a way compatible with the old driver:

On/Off: As Suspend EV_PWR key
Raw values of lid sensors SWA and SWB: As EV_SW switches
SWA: Display Down
SWB: Lid Closed
Recommended user space decoding:
SWA==0 & SWB==0: lid opened (landscape mode)
SWA==1 & SWB==0: invalid (or mechanic race condition)
SWA==0 & SWB==1: lid closed with display up (portrait mode or mechanic
                 race condition while closing to display-less mode)
SWA==1 & SWB==1: lid closed with display down (display-less mode)

AK_INT remote trigger is not mapped as input event. Without complete
remote driver and remote pull-up control it has no useful
interpretation.

Signed-off-by: default avatarStanislav Brabec <utx@penguin.cz>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Signed-off-by: default avatarEric Miao <eric.y.miao@gmail.com>
parent 0bff2fc3
Loading
Loading
Loading
Loading
+39 −0
Original line number Original line Diff line number Diff line
@@ -15,6 +15,7 @@
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/gpio_keys.h>
#include <linux/gpio.h>
#include <linux/gpio.h>
#include <linux/leds.h>
#include <linux/leds.h>
#include <linux/mtd/physmap.h>
#include <linux/mtd/physmap.h>
@@ -375,6 +376,43 @@ static struct platform_device spitzkbd_device = {
};
};




static struct gpio_keys_button spitz_gpio_keys[] = {
	{
		.type	= EV_PWR,
		.code	= KEY_SUSPEND,
		.gpio	= SPITZ_GPIO_ON_KEY,
		.desc	= "On/Off",
		.wakeup	= 1,
	},
	/* Two buttons detecting the lid state */
	{
		.type	= EV_SW,
		.code	= 0,
		.gpio	= SPITZ_GPIO_SWA,
		.desc	= "Display Down",
	},
	{
		.type	= EV_SW,
		.code	= 1,
		.gpio	= SPITZ_GPIO_SWB,
		.desc	= "Lid Closed",
	},
};

static struct gpio_keys_platform_data spitz_gpio_keys_platform_data = {
	.buttons	= spitz_gpio_keys,
	.nbuttons	= ARRAY_SIZE(spitz_gpio_keys),
};

static struct platform_device spitz_gpio_keys_device = {
	.name	= "gpio-keys",
	.id	= -1,
	.dev	= {
		.platform_data	= &spitz_gpio_keys_platform_data,
	},
};


/*
/*
 * Spitz LEDs
 * Spitz LEDs
 */
 */
@@ -689,6 +727,7 @@ static struct platform_device sharpsl_rom_device = {
static struct platform_device *devices[] __initdata = {
static struct platform_device *devices[] __initdata = {
	&spitzscoop_device,
	&spitzscoop_device,
	&spitzkbd_device,
	&spitzkbd_device,
	&spitz_gpio_keys_device,
	&spitzled_device,
	&spitzled_device,
	&sharpsl_nand_device,
	&sharpsl_nand_device,
	&sharpsl_rom_device,
	&sharpsl_rom_device,