linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 01/36]  [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue
@ 2010-07-26  8:30 Wayne Lin
  2010-07-26  8:30 ` [RFC 02/36] [Driver][Qualcomm 1070][USB] Register GPIO#109 for USB analog switch configuration Wayne Lin
                   ` (31 more replies)
  0 siblings, 32 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 drivers/video/msm/lcdc_st15.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/video/msm/lcdc_st15.c b/drivers/video/msm/lcdc_st15.c
index c554193..1fc228d 100644
--- a/drivers/video/msm/lcdc_st15.c
+++ b/drivers/video/msm/lcdc_st15.c
@@ -506,7 +506,7 @@ static int __init lcdc_st15_init(void)
 	pinfo->type = LCDC_PANEL;
 	pinfo->pdest = DISPLAY_1;
 	pinfo->wait_cycle = 0;
-	pinfo->bpp = 24;
+	pinfo->bpp = 18;
 	pinfo->fb_num = 2;
 	pinfo->clk_rate = 74250000;
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 02/36]  [Driver][Qualcomm 1070][USB] Register GPIO#109 for USB analog switch configuration
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 04/36] [Driver][Qualcomm 1070][EC_KB] Adding new qci keyboard driver Wayne Lin
                   ` (30 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/mach-msm/board-qsd8x50.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 0cab166..633514a 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -416,7 +416,7 @@ static struct msm_gpio hsusb_gpio_config_data[] = {
 	{ GPIO_CFG(98, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), "fs_power" },
 	{ GPIO_CFG(HUB_RESET_GPIO, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA),
 								"swch_ctrl" },
-	{ GPIO_CFG(108, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), "hub_reset" },
+	{ GPIO_CFG(109, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), "hub_reset" },
 };
 
 static int msm_otg_gpio_init(void)
@@ -441,12 +441,12 @@ static void msm_otg_setup_gpio(unsigned int enable)
 			/* Config analog switch as USB host. */
 			gpio_set_value(98, 0); /* USB_FS_POWER_EN */
 			gpio_set_value(HUB_RESET_GPIO, 0); /* SWITCH_CONTROL */
-			gpio_set_value(108, 1); /* USB_HUB_RESET */
+			gpio_set_value(109, 1); /* USB_HUB_RESET */
 		} else {
 			/* Config analog switch as USB peripheral. */
 			gpio_set_value(98, 0); /* USB_FS_POWER_EN */
 			gpio_set_value(HUB_RESET_GPIO, 1); /* SWITCH_CONTROL */
-			gpio_set_value(108, 0); /* USB_HUB_RESET */
+			gpio_set_value(109, 0); /* USB_HUB_RESET */
 		}
 	}
 }
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 04/36]  [Driver][Qualcomm 1070][EC_KB] Adding new qci keyboard driver
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
  2010-07-26  8:30 ` [RFC 02/36] [Driver][Qualcomm 1070][USB] Register GPIO#109 for USB analog switch configuration Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:55   ` Dmitry Torokhov
  2010-07-26  8:59   ` Datta, Shubhrajyoti
  2010-07-26  8:30 ` [RFC 05/36] [Driver][Qualcomm 1070][TPM] Enable TPM module Wayne Lin
                   ` (29 subsequent siblings)
  31 siblings, 2 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 drivers/input/keyboard/qci_kbd.c | 1101 +++++++++++++++++++-------------------
 1 files changed, 551 insertions(+), 550 deletions(-)

diff --git a/drivers/input/keyboard/qci_kbd.c b/drivers/input/keyboard/qci_kbd.c
index aa7a64a..0cf2f7e 100755
--- a/drivers/input/keyboard/qci_kbd.c
+++ b/drivers/input/keyboard/qci_kbd.c
@@ -1,550 +1,551 @@
-/* Quanta I2C Keyboard Driver
- *
- * Copyright (C) 2009 Quanta Computer Inc.
- * Author: Hsin Wu <hsin.wu@quantatw.com>
- * Author: Austin Lai <austin.lai@quantatw.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
- /*
- *
- *  The Driver with I/O communications via the I2C Interface for ON2 of AP BU.
- *  And it is only working on the nuvoTon WPCE775x Embedded Controller.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/jiffies.h>
-#include <linux/i2c.h>
-#include <linux/mutex.h>
-#include <linux/interrupt.h>
-#include <linux/input.h>
-#include <linux/keyboard.h>
-#include <linux/gpio.h>
-#include <linux/delay.h>
-
-/* Keyboard special scancode */
-#define RC_KEY_FN          0x70
-#define RC_KEY_BREAK       0x80
-#define KEY_ACK_FA      0xFA
-
-/* Keyboard keycodes */
-#define NOKEY           KEY_RESERVED
-#define KEY_LEFTWIN     KEY_LEFTMETA
-#define KEY_RIGHTWIN    KEY_RIGHTMETA
-#define KEY_APPS        KEY_COMPOSE
-#define KEY_PRINTSCR    KEY_SYSRQ
-
-#define KEYBOARD_ID_NAME          "qci-i2ckbd"
-#define KEYBOARD_NAME                "Quanta Keyboard"
-#define KEYBOARD_DEVICE             "/i2c/input0"
-#define KEYBOARD_CMD_ENABLE             0xF4
-
-/*-----------------------------------------------------------------------------
- * Keyboard scancode to linux keycode translation table
- *---------------------------------------------------------------------------*/
-
-static const unsigned char on2_keycode[256] = {
-	[0]   = NOKEY,
-	[1]   = NOKEY,
-	[2]   = NOKEY,
-	[3]   = KEY_5,
-	[4]   = KEY_7,
-	[5]   = KEY_9,
-	[6]   = KEY_MINUS,
-	[7]   = NOKEY,
-	[8]   = NOKEY,
-	[9]   = NOKEY,
-	[10]  = NOKEY,
-	[11]  = KEY_LEFTBRACE,
-	[12]  = KEY_F10,
-	[13]  = KEY_INSERT,
-	[14]  = KEY_F11,
-	[15]  = KEY_ESC,
-	[16]  = NOKEY,
-	[17]  = NOKEY,
-	[18]  = NOKEY,
-	[19]  = KEY_4,
-	[20]  = KEY_6,
-	[21]  = KEY_8,
-	[22]  = KEY_0,
-	[23]  = KEY_EQUAL,
-	[24]  = NOKEY,
-	[25]  = NOKEY,
-	[26]  = NOKEY,
-	[27]  = KEY_P,
-	[28]  = KEY_F9,
-	[29]  = KEY_DELETE,
-	[30]  = KEY_F12,
-	[31]  = KEY_GRAVE,
-	[32]  = KEY_W,
-	[33]  = NOKEY,
-	[34]  = NOKEY,
-	[35]  = KEY_R,
-	[36]  = KEY_T,
-	[37]  = KEY_U,
-	[38]  = KEY_O,
-	[39]  = KEY_RIGHTBRACE,
-	[40]  = NOKEY,
-	[41]  = NOKEY,
-	[42]  = NOKEY,
-	[43]  = KEY_APOSTROPHE,
-	[44]  = KEY_BACKSPACE,
-	[45]  = NOKEY,
-	[46]  = KEY_F8,
-	[47]  = KEY_F5,
-	[48]  = KEY_S,
-	[49]  = NOKEY,
-	[50]  = NOKEY,
-	[51]  = KEY_E,
-	[52]  = KEY_H,
-	[53]  = KEY_Y,
-	[54]  = KEY_I,
-	[55]  = KEY_ENTER,
-	[56]  = NOKEY,
-	[57]  = NOKEY,
-	[58]  = NOKEY,
-	[59]  = KEY_SEMICOLON,
-	[60]  = KEY_3,
-	[61]  = KEY_PAGEUP,
-	[62]  = KEY_Q,
-	[63]  = KEY_TAB,
-	[64]  = KEY_A,
-	[65]  = NOKEY,
-	[66]  = NOKEY,
-	[67]  = KEY_F,
-	[68]  = KEY_G,
-	[69]  = KEY_J,
-	[70]  = KEY_L,
-	[71]  = NOKEY,
-	[72]  = KEY_RIGHTSHIFT,
-	[73]  = NOKEY,
-	[74]  = NOKEY,
-	[75]  = KEY_SLASH,
-	[76]  = KEY_2,
-	[77]  = KEY_PAGEDOWN,
-	[78]  = KEY_F4,
-	[79]  = KEY_F1,
-	[80]  = KEY_Z,
-	[81]  = NOKEY,
-	[82]  = NOKEY,
-	[83]  = KEY_D,
-	[84]  = KEY_V,
-	[85]  = KEY_N,
-	[86]  = KEY_K,
-	[87]  = NOKEY,
-	[88]  = KEY_LEFTSHIFT,
-	[89]  = KEY_RIGHTCTRL,
-	[90]  = NOKEY,
-	[91]  = KEY_DOT,
-	[92]  = KEY_UP,
-	[93]  = KEY_RIGHT,
-	[94]  = KEY_F3,
-	[95]  = KEY_F2,
-	[96]  = NOKEY,
-	[97]  = NOKEY,
-	[98]  = KEY_RIGHTALT,
-	[99]  = KEY_X,
-	[100] = KEY_C,
-	[101] = KEY_B,
-	[102] = KEY_COMMA,
-	[103] = NOKEY,
-	[104] = NOKEY,
-	[105] = NOKEY,
-	[106] = NOKEY,
-	[107] = NOKEY,
-	[108] = KEY_PRINTSCR,
-	[109] = KEY_DOWN,
-	[110] = KEY_1,
-	[111] = KEY_CAPSLOCK,
-	[112] = KEY_F24,
-	[113] = KEY_HOME,
-	[114] = KEY_LEFTALT,
-	[115] = NOKEY,
-	[116] = KEY_SPACE,
-	[117] = KEY_BACKSLASH,
-	[118] = KEY_M,
-	[119] = KEY_COMPOSE,
-	[120] = NOKEY,
-	[121] = KEY_LEFTCTRL,
-	[122] = NOKEY,
-	[123] = NOKEY,
-	[124] = KEY_PAUSE,
-	[125] = KEY_LEFT,
-	[126] = KEY_F7,
-	[127] = KEY_F6,
-	[128] = NOKEY,
-	[129] = NOKEY,
-	[130] = NOKEY,
-	[131] = NOKEY,
-	[132] = NOKEY,
-	[133] = NOKEY,
-	[134] = NOKEY,
-	[135] = NOKEY,
-	[136] = NOKEY,
-	[137] = NOKEY,
-	[138] = NOKEY,
-	[139] = NOKEY,
-	[140] = NOKEY,
-	[141] = NOKEY,
-	[142] = NOKEY,
-	[143] = NOKEY,
-	[144] = NOKEY,
-	[145] = NOKEY,
-	[146] = NOKEY,
-	[147] = NOKEY,
-	[148] = NOKEY,
-	[149] = NOKEY,
-	[150] = NOKEY,
-	[151] = NOKEY,
-	[152] = NOKEY,
-	[153] = NOKEY,
-	[154] = NOKEY,
-	[155] = NOKEY,
-	[156] = NOKEY,
-	[157] = NOKEY,
-	[158] = NOKEY,
-	[159] = NOKEY,
-	[160] = NOKEY,
-	[161] = NOKEY,
-	[162] = NOKEY,
-	[163] = NOKEY,
-	[164] = NOKEY,
-	[165] = NOKEY,
-	[166] = NOKEY,
-	[167] = NOKEY,
-	[168] = NOKEY,
-	[169] = NOKEY,
-	[170] = NOKEY,
-	[171] = NOKEY,
-	[172] = NOKEY,
-	[173] = NOKEY,
-	[174] = NOKEY,
-	[175] = NOKEY,
-	[176] = NOKEY,
-	[177] = NOKEY,
-	[178] = NOKEY,
-	[179] = NOKEY,
-	[180] = NOKEY,
-	[181] = NOKEY,
-	[182] = NOKEY,
-	[183] = NOKEY,
-	[184] = NOKEY,
-	[185] = NOKEY,
-	[186] = NOKEY,
-	[187] = NOKEY,
-	[188] = NOKEY,
-	[189] = KEY_HOME,
-	[190] = NOKEY,
-	[191] = NOKEY,
-	[192] = NOKEY,
-	[193] = NOKEY,
-	[194] = NOKEY,
-	[195] = NOKEY,
-	[196] = NOKEY,
-	[197] = NOKEY,
-	[198] = NOKEY,
-	[199] = NOKEY,
-	[200] = NOKEY,
-	[201] = NOKEY,
-	[202] = NOKEY,
-	[203] = NOKEY,
-	[204] = NOKEY,
-	[205] = KEY_END,
-	[206] = NOKEY,
-	[207] = NOKEY,
-	[208] = NOKEY,
-	[209] = NOKEY,
-	[210] = NOKEY,
-	[211] = NOKEY,
-	[212] = NOKEY,
-	[213] = NOKEY,
-	[214] = NOKEY,
-	[215] = NOKEY,
-	[216] = NOKEY,
-	[217] = NOKEY,
-	[218] = NOKEY,
-	[219] = NOKEY,
-	[220] = KEY_VOLUMEUP,
-	[221] = KEY_BRIGHTNESSUP,
-	[222] = NOKEY,
-	[223] = NOKEY,
-	[224] = NOKEY,
-	[225] = NOKEY,
-	[226] = NOKEY,
-	[227] = NOKEY,
-	[228] = NOKEY,
-	[229] = NOKEY,
-	[230] = NOKEY,
-	[231] = NOKEY,
-	[232] = NOKEY,
-	[233] = NOKEY,
-	[234] = NOKEY,
-	[235] = NOKEY,
-	[236] = NOKEY,
-	[237] = KEY_VOLUMEDOWN,
-	[238] = NOKEY,
-	[239] = NOKEY,
-	[240] = NOKEY,
-	[241] = NOKEY,
-	[242] = NOKEY,
-	[243] = NOKEY,
-	[244] = NOKEY,
-	[245] = NOKEY,
-	[246] = NOKEY,
-	[247] = NOKEY,
-	[248] = NOKEY,
-	[249] = NOKEY,
-	[250] = NOKEY,
-	[251] = NOKEY,
-	[252] = NOKEY,
-	[253] = KEY_BRIGHTNESSDOWN,
-	[254] = NOKEY,
-	[255] = NOKEY,
-};
-/*-----------------------------------------------------------------------------
- * Global variables
- *---------------------------------------------------------------------------*/
-
-struct input_dev *g_qci_keyboard_dev;
-
-/* General structure to hold the driver data */
-struct i2ckbd_drv_data {
-	struct i2c_client *ki2c_client;
-	struct work_struct work;
-	struct input_dev *qcikbd_dev;
-	unsigned int qcikbd_gpio; /* GPIO used for interrupt */
-	unsigned int qcikbd_irq;
-	unsigned int key_down;
-	unsigned int escape;
-	unsigned int pause_seq;
-	unsigned int fn;
-};
-#ifdef CONFIG_PM
-static int qcikbd_suspend(struct device *dev)
-{
-	return 0;
-}
-
-static int qcikbd_resume(struct device *dev)
-{
-	return 0;
-}
-#endif
-static int __devinit qcikbd_probe(struct i2c_client *client,
-	const struct i2c_device_id *id);
-static int __devexit qcikbd_remove(struct i2c_client *kbd);
-
-static const struct i2c_device_id qcikbd_idtable[] = {
-	{ KEYBOARD_ID_NAME, 0 },
-	{ }
-};
-
-MODULE_DEVICE_TABLE(i2c, qcikbd_idtable);
-
-#ifdef CONFIG_PM
-static struct dev_pm_ops qcikbd_pm_ops = {
-	.suspend  = qcikbd_suspend,
-	.resume   = qcikbd_resume,
-};
-#endif
-static struct i2c_driver i2ckbd_driver = {
-	.driver = {
-		.owner = THIS_MODULE,
-		.name  = KEYBOARD_ID_NAME,
-#ifdef CONFIG_PM
-		.pm = &qcikbd_pm_ops,
-#endif
-	},
-	.probe	  = qcikbd_probe,
-	.remove = __devexit_p(qcikbd_remove),
-	.id_table = qcikbd_idtable,
-};
-
-/*-----------------------------------------------------------------------------
- * Driver functions
- *---------------------------------------------------------------------------*/
-
-static irqreturn_t qcikbd_interrupt(int irq, void *dev_id)
-{
-	struct i2ckbd_drv_data *ikbd_drv_data = dev_id;
-	schedule_work(&ikbd_drv_data->work);
-	return IRQ_HANDLED;
-}
-
-static void qcikbd_work_handler(struct work_struct *_work)
-{
-	unsigned char scancode;
-	unsigned int  keycode;
-
-	struct i2ckbd_drv_data *ikbd_drv_data =
-		container_of(_work, struct i2ckbd_drv_data, work);
-
-	struct i2c_client *ikbdclient = ikbd_drv_data->ki2c_client;
-	struct input_dev *ikbdev = ikbd_drv_data->qcikbd_dev;
-
-	scancode = i2c_smbus_read_byte(ikbdclient);
-
-	if (scancode == KEY_ACK_FA) {
-		return;
-	} else if (scancode == RC_KEY_FN) {
-		ikbd_drv_data->fn = 0x80;     /* select keycode table  > 0x7F */
-	} else {
-		ikbd_drv_data->key_down = 1;
-		if (scancode & RC_KEY_BREAK) {
-			ikbd_drv_data->key_down = 0;
-			if ((scancode & 0x7F) == RC_KEY_FN)
-				ikbd_drv_data->fn = 0;
-		}
-		keycode = on2_keycode[(scancode & 0x7F) | ikbd_drv_data->fn];
-		if (keycode != NOKEY) {
-			input_report_key(ikbdev,
-					 keycode,
-					 ikbd_drv_data->key_down);
-			input_sync(ikbdev);
-		}
-	}
-}
-
-
-static int qcikbd_open(struct input_dev *dev)
-{
-	struct i2ckbd_drv_data *ikbd_drv_data = input_get_drvdata(dev);
-	struct i2c_client *ikbdclient = ikbd_drv_data->ki2c_client;
-
-	/* Send F4h - enable keyboard */
-	i2c_smbus_write_byte(ikbdclient, KEYBOARD_CMD_ENABLE);
-	return 0;
-}
-
-static int __devinit qcikbd_probe(struct i2c_client *client,
-				    const struct i2c_device_id *id)
-{
-	int err;
-	int i;
-	struct i2ckbd_drv_data *context;
-	context = kzalloc(sizeof(struct i2ckbd_drv_data), GFP_KERNEL);
-	if (!context)
-		return -ENOMEM;
-	i2c_set_clientdata(client, context);
-	context->ki2c_client = client;
-	context->qcikbd_gpio = client->irq;
-	client->driver = &i2ckbd_driver;
-
-	INIT_WORK(&context->work, qcikbd_work_handler);
-
-	err = gpio_request(context->qcikbd_gpio, "qci-kbd");
-	if (err) {
-		pr_err("[KBD] err gpio request\n");
-		goto gpio_request_fail;
-	}
-
-	context->qcikbd_irq = gpio_to_irq(context->qcikbd_gpio);
-	err = request_irq(context->qcikbd_irq,
-			  qcikbd_interrupt,
-			  IRQF_TRIGGER_FALLING,
-			  KEYBOARD_ID_NAME,
-			  context);
-	if (err) {
-		pr_err("[KBD] err unable to get IRQ\n");
-		goto request_irq_fail;
-	}
-
-	context->qcikbd_dev = input_allocate_device();
-	if (!context->qcikbd_dev) {
-		pr_err("[KBD]allocting memory err\n");
-		err = -ENOMEM;
-		goto allocate_fail;
-	}
-
-	context->qcikbd_dev->name       = KEYBOARD_NAME;
-	context->qcikbd_dev->phys       = KEYBOARD_DEVICE;
-	context->qcikbd_dev->id.bustype = BUS_I2C;
-	context->qcikbd_dev->id.vendor  = 0x1050;
-	context->qcikbd_dev->id.product = 0x0006;
-	context->qcikbd_dev->id.version = 0x0004;
-	context->qcikbd_dev->open       = qcikbd_open;
-	set_bit(EV_KEY, context->qcikbd_dev->evbit);
-	set_bit(EV_REP, context->qcikbd_dev->evbit);
-
-	/* Enable all supported keys */
-	for (i = 1; i < ARRAY_SIZE(on2_keycode) ; i++)
-		set_bit(on2_keycode[i], context->qcikbd_dev->keybit);
-
-	set_bit(KEY_POWER, context->qcikbd_dev->keybit);
-	set_bit(KEY_END, context->qcikbd_dev->keybit);
-	set_bit(KEY_VOLUMEUP, context->qcikbd_dev->keybit);
-	set_bit(KEY_VOLUMEDOWN, context->qcikbd_dev->keybit);
-	set_bit(KEY_ZOOMIN, context->qcikbd_dev->keybit);
-	set_bit(KEY_ZOOMOUT, context->qcikbd_dev->keybit);
-
-	input_set_drvdata(context->qcikbd_dev, context);
-	err = input_register_device(context->qcikbd_dev);
-	if (err) {
-		pr_err("[KBD] err input register device\n");
-		goto register_fail;
-	}
-	g_qci_keyboard_dev = context->qcikbd_dev;
-	return 0;
-register_fail:
-	input_free_device(context->qcikbd_dev);
-
-allocate_fail:
-	free_irq(context->qcikbd_irq, context);
-
-request_irq_fail:
-	gpio_free(context->qcikbd_gpio);
-
-gpio_request_fail:
-	i2c_set_clientdata(client, NULL);
-	kfree(context);
-	return err;
-}
-
-static int __devexit qcikbd_remove(struct i2c_client *dev)
-{
-	struct i2ckbd_drv_data *context = i2c_get_clientdata(dev);
-
-	free_irq(context->qcikbd_irq, context);
-	gpio_free(context->qcikbd_gpio);
-	input_free_device(context->qcikbd_dev);
-	input_unregister_device(context->qcikbd_dev);
-	kfree(context);
-
-	return 0;
-}
-
-static int __init qcikbd_init(void)
-{
-	return i2c_add_driver(&i2ckbd_driver);
-}
-
-static void __exit qcikbd_exit(void)
-{
-	i2c_del_driver(&i2ckbd_driver);
-}
-
-struct input_dev *nkbc_keypad_get_input_dev(void)
-{
-	return g_qci_keyboard_dev;
-}
-EXPORT_SYMBOL(nkbc_keypad_get_input_dev);
-module_init(qcikbd_init);
-module_exit(qcikbd_exit);
-
-MODULE_AUTHOR("Quanta Computer Inc.");
-MODULE_DESCRIPTION("Quanta Embedded Controller I2C Keyboard Driver");
-MODULE_LICENSE("GPL v2");
-
+/* Quanta I2C Keyboard Driver
+ *
+ * Copyright (C) 2009 Quanta Computer Inc.
+ * Author: Hsin Wu <hsin.wu@quantatw.com>
+ * Author: Austin Lai <austin.lai@quantatw.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+ /*
+ *
+ *  The Driver with I/O communications via the I2C Interface for ON2 of AP BU.
+ *  And it is only working on the nuvoTon WPCE775x Embedded Controller.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/jiffies.h>
+#include <linux/i2c.h>
+#include <linux/mutex.h>
+#include <linux/interrupt.h>
+#include <linux/input.h>
+#include <linux/keyboard.h>
+#include <linux/gpio.h>
+#include <linux/delay.h>
+
+/* Keyboard special scancode */
+#define RC_KEY_FN          0x70
+#define RC_KEY_BREAK       0x80
+#define KEY_ACK_FA      0xFA
+
+/* Keyboard keycodes */
+#define NOKEY           KEY_RESERVED
+#define KEY_LEFTWIN     KEY_LEFTMETA
+#define KEY_RIGHTWIN    KEY_RIGHTMETA
+#define KEY_APPS        KEY_COMPOSE
+#define KEY_PRINTSCR    KEY_SYSRQ
+
+#define KEYBOARD_ID_NAME          "qci-i2ckbd"
+#define KEYBOARD_NAME                "Quanta Keyboard"
+#define KEYBOARD_DEVICE             "/i2c/input0"
+#define KEYBOARD_CMD_ENABLE             0xF4
+
+/*-----------------------------------------------------------------------------
+ * Keyboard scancode to linux keycode translation table
+ *---------------------------------------------------------------------------*/
+
+static const unsigned char on2_keycode[256] = {
+        [0]   = KEY_RESERVED,
+        [1]   = KEY_ESC,
+        [2]   = KEY_1,
+        [3]   = KEY_2,
+        [4]   = KEY_3,
+        [5]   = KEY_4,
+        [6]   = KEY_5,
+        [7]   = KEY_6,
+        [8]   = KEY_7,
+        [9]   = KEY_8,
+        [10]  = KEY_9,
+        [11]  = KEY_0,
+        [12]  = KEY_MINUS,
+        [13]  = KEY_EQUAL,
+        [14]  = KEY_BACKSPACE,
+        [15]  = KEY_TAB,
+        [16]  = KEY_Q,
+        [17]  = KEY_W,
+        [18]  = KEY_E,
+        [19]  = KEY_R,
+        [20]  = KEY_T,
+        [21]  = KEY_Y,
+        [22]  = KEY_U,
+        [23]  = KEY_I,
+        [24]  = KEY_O,
+        [25]  = KEY_P,
+        [26]  = KEY_LEFTBRACE,
+        [27]  = KEY_RIGHTBRACE,
+        [28]  = KEY_ENTER,
+        [29]  = KEY_LEFTCTRL,
+        [30]  = KEY_A,
+        [31]  = KEY_S,
+        [32]  = KEY_D,
+        [33]  = KEY_F,
+        [34]  = KEY_G,
+        [35]  = KEY_H,
+        [36]  = KEY_J,
+        [37]  = KEY_K,
+        [38]  = KEY_L,
+        [39]  = KEY_SEMICOLON,
+        [40]  = KEY_APOSTROPHE,
+        [41]  = KEY_GRAVE,
+        [42]  = KEY_LEFTSHIFT,
+        [43]  = KEY_BACKSLASH,
+        [44]  = KEY_Z,
+        [45]  = KEY_X,
+        [46]  = KEY_C,
+        [47]  = KEY_V,
+        [48]  = KEY_B,
+        [49]  = KEY_N,
+        [50]  = KEY_M,
+        [51]  = KEY_COMMA,
+        [52]  = KEY_DOT,
+        [53]  = KEY_SLASH,
+        [54]  = KEY_RIGHTSHIFT,
+        [55]  = KEY_KPASTERISK,
+        [56]  = KEY_LEFTALT,
+        [57]  = KEY_SPACE,
+        [58]  = KEY_CAPSLOCK,
+        [59]  = KEY_F1,
+        [60]  = KEY_F2,
+        [61]  = KEY_F3,
+        [62]  = KEY_F4,
+        [63]  = KEY_F5,
+        [64]  = KEY_F6,
+        [65]  = KEY_F7,
+        [66]  = KEY_F8,
+        [67]  = KEY_F9,
+        [68]  = KEY_F10,
+        [69]  = KEY_NUMLOCK,
+        [70]  = KEY_SCROLLLOCK,
+        [71]  = KEY_KP7,
+        [72]  = KEY_KP8,
+        [73]  = KEY_KP9,
+        [74]  = KEY_KPMINUS,
+        [75]  = KEY_KP4,
+        [76]  = KEY_KP5,
+        [77]  = KEY_KP6,
+        [78]  = KEY_KPPLUS,
+        [79]  = KEY_KP1,
+        [80]  = KEY_KP2,
+        [81]  = KEY_KP3,
+        [82]  = KEY_KP0,
+        [83]  = KEY_KPDOT,
+        [84]  = KEY_RESERVED,
+        [85]  = KEY_ZENKAKUHANKAKU,
+        [86]  = KEY_102ND,
+        [87]  = KEY_F11,
+        [88]  = KEY_F12,
+        [89]  = KEY_RO,
+        [90]  = KEY_KATAKANA,
+        [91]  = KEY_HIRAGANA,
+        [92]  = KEY_HENKAN,
+        [93]  = KEY_KATAKANAHIRAGANA,
+        [94]  = KEY_MUHENKAN,
+        [95]  = KEY_KPJPCOMMA,
+        [96]  = KEY_KPENTER,
+        [97]  = KEY_RIGHTCTRL,
+        [98]  = KEY_KPSLASH,
+        [99]  = KEY_SYSRQ,
+        [100] = KEY_RIGHTALT,
+        [101] = KEY_LINEFEED,
+        [102] = KEY_HOME,
+        [103] = KEY_UP,
+        [104] = KEY_PAGEUP,
+        [105] = KEY_LEFT,
+        [106] = KEY_RIGHT,
+        [107] = KEY_END,
+        [108] = KEY_DOWN,
+        [109] = KEY_PAGEDOWN,
+        [110] = KEY_INSERT,
+        [111] = KEY_DELETE,
+        [112] = KEY_MACRO,
+        [113] = KEY_MUTE,
+        [114] = KEY_VOLUMEDOWN,
+        [115] = KEY_VOLUMEUP,
+        [116] = KEY_POWER,
+        [117] = KEY_KPEQUAL,
+        [118] = KEY_KPPLUSMINUS,
+        [119] = KEY_PAUSE,
+        [120] = KEY_SCALE,
+        [121] = KEY_KPCOMMA,
+        [122] = KEY_HANGEUL,
+        [123] = KEY_HANGUEL,
+        [124] = KEY_HANJA,
+        [125] = KEY_YEN,
+        [126] = KEY_LEFTMETA,
+        [127] = KEY_RIGHTMETA,
+        [128] = KEY_COMPOSE,
+        [129] = NOKEY,
+        [130] = NOKEY,
+        [131] = NOKEY,
+        [132] = NOKEY,
+        [133] = NOKEY,
+        [134] = NOKEY,
+        [135] = NOKEY,
+        [136] = NOKEY,
+        [137] = NOKEY,
+        [138] = NOKEY,
+        [139] = NOKEY,
+        [140] = NOKEY,
+        [141] = NOKEY,
+        [142] = NOKEY,
+        [143] = NOKEY,
+        [144] = NOKEY,
+        [145] = NOKEY,
+        [146] = NOKEY,
+        [147] = NOKEY,
+        [148] = NOKEY,
+        [149] = NOKEY,
+        [150] = NOKEY,
+        [151] = NOKEY,
+        [152] = NOKEY,
+        [153] = NOKEY,
+        [154] = NOKEY,
+        [155] = NOKEY,
+        [156] = NOKEY,
+        [157] = NOKEY,
+        [158] = NOKEY,
+        [159] = NOKEY,
+        [160] = NOKEY,
+        [161] = NOKEY,
+        [162] = NOKEY,
+        [163] = NOKEY,
+        [164] = NOKEY,
+        [165] = NOKEY,
+        [166] = NOKEY,
+        [167] = NOKEY,
+        [168] = NOKEY,
+        [169] = NOKEY,
+        [170] = NOKEY,
+        [171] = NOKEY,
+        [172] = NOKEY,
+        [173] = NOKEY,
+        [174] = NOKEY,
+        [175] = NOKEY,
+        [176] = NOKEY,
+        [177] = NOKEY,
+        [178] = NOKEY,
+        [179] = NOKEY,
+        [180] = NOKEY,
+        [181] = NOKEY,
+        [182] = NOKEY,
+        [183] = NOKEY,
+        [184] = NOKEY,
+        [185] = NOKEY,
+        [186] = NOKEY,
+        [187] = NOKEY,
+        [188] = NOKEY,
+        [189] = KEY_HOME,
+        [190] = NOKEY,
+        [191] = NOKEY,
+        [192] = NOKEY,
+        [193] = NOKEY,
+        [194] = NOKEY,
+        [195] = NOKEY,
+        [196] = NOKEY,
+        [197] = NOKEY,
+        [198] = NOKEY,
+        [199] = NOKEY,
+        [200] = NOKEY,
+        [201] = NOKEY,
+        [202] = NOKEY,
+        [203] = NOKEY,
+        [204] = NOKEY,
+        [205] = KEY_END,
+        [206] = NOKEY,
+        [207] = NOKEY,
+        [208] = NOKEY,
+        [209] = NOKEY,
+        [210] = NOKEY,
+        [211] = NOKEY,
+        [212] = NOKEY,
+        [213] = NOKEY,
+        [214] = NOKEY,
+        [215] = NOKEY,
+        [216] = NOKEY,
+        [217] = NOKEY,
+        [218] = NOKEY,
+        [219] = NOKEY,
+        [220] = KEY_VOLUMEUP,
+        [221] = KEY_BRIGHTNESSUP,
+        [222] = NOKEY,
+        [223] = NOKEY,
+        [224] = NOKEY,
+        [225] = NOKEY,
+        [226] = NOKEY,
+        [227] = NOKEY,
+        [228] = NOKEY,
+        [229] = NOKEY,
+        [230] = NOKEY,
+        [231] = NOKEY,
+        [232] = NOKEY,
+        [233] = NOKEY,
+        [234] = NOKEY,
+        [235] = NOKEY,
+        [236] = NOKEY,
+        [237] = KEY_VOLUMEDOWN,
+        [238] = NOKEY,
+        [239] = NOKEY,
+        [240] = NOKEY,
+        [241] = NOKEY,
+        [242] = NOKEY,
+        [243] = NOKEY,
+        [244] = NOKEY,
+        [245] = NOKEY,
+        [246] = NOKEY,
+        [247] = NOKEY,
+        [248] = NOKEY,
+        [249] = NOKEY,
+        [250] = NOKEY,
+        [251] = NOKEY,
+        [252] = NOKEY,
+        [253] = KEY_BRIGHTNESSDOWN,
+        [254] = NOKEY,
+        [255] = NOKEY,
+};
+/*-----------------------------------------------------------------------------
+ * Global variables
+ *---------------------------------------------------------------------------*/
+
+struct input_dev *g_qci_keyboard_dev;
+
+/* General structure to hold the driver data */
+struct i2ckbd_drv_data {
+        struct i2c_client *ki2c_client;
+        struct work_struct work;
+        struct input_dev *qcikbd_dev;
+        unsigned int qcikbd_gpio; /* GPIO used for interrupt */
+        unsigned int qcikbd_irq;
+        unsigned int key_down;
+        unsigned int escape;
+        unsigned int pause_seq;
+        unsigned int fn;
+};
+#ifdef CONFIG_PM
+static int qcikbd_suspend(struct device *dev)
+{
+        return 0;
+}
+
+static int qcikbd_resume(struct device *dev)
+{
+        return 0;
+}
+#endif
+static int __devinit qcikbd_probe(struct i2c_client *client,
+        const struct i2c_device_id *id);
+static int __devexit qcikbd_remove(struct i2c_client *kbd);
+
+static const struct i2c_device_id qcikbd_idtable[] = {
+        { KEYBOARD_ID_NAME, 0 },
+        { }
+};
+
+MODULE_DEVICE_TABLE(i2c, qcikbd_idtable);
+
+#ifdef CONFIG_PM
+static struct dev_pm_ops qcikbd_pm_ops = {
+        .suspend  = qcikbd_suspend,
+        .resume   = qcikbd_resume,
+};
+#endif
+static struct i2c_driver i2ckbd_driver = {
+        .driver = {
+                .owner = THIS_MODULE,
+                .name  = KEYBOARD_ID_NAME,
+#ifdef CONFIG_PM
+                .pm = &qcikbd_pm_ops,
+#endif
+        },
+        .probe    = qcikbd_probe,
+        .remove = __devexit_p(qcikbd_remove),
+        .id_table = qcikbd_idtable,
+};
+
+/*-----------------------------------------------------------------------------
+ * Driver functions
+ *---------------------------------------------------------------------------*/
+
+static irqreturn_t qcikbd_interrupt(int irq, void *dev_id)
+{
+        struct i2ckbd_drv_data *ikbd_drv_data = dev_id;
+        schedule_work(&ikbd_drv_data->work);
+        return IRQ_HANDLED;
+}
+
+static void qcikbd_work_handler(struct work_struct *_work)
+{
+        unsigned char scancode;
+        unsigned int  keycode;
+
+        struct i2ckbd_drv_data *ikbd_drv_data =
+                container_of(_work, struct i2ckbd_drv_data, work);
+
+        struct i2c_client *ikbdclient = ikbd_drv_data->ki2c_client;
+        struct input_dev *ikbdev = ikbd_drv_data->qcikbd_dev;
+
+        scancode = i2c_smbus_read_byte(ikbdclient);
+      printk("   scancode = %x\n", scancode);
+
+        if (scancode == 0xFA)
+        {
+                return;
+        } else {
+                ikbd_drv_data->key_down = 1;
+                if (scancode & 0x80) {
+                        ikbd_drv_data->key_down = 0;
+                }
+                keycode = on2_keycode[(scancode & 0x7F)];
+                if (keycode != NOKEY) {
+
+                        input_event(ikbdev, EV_MSC, MSC_SCAN, scancode);
+
+                        input_report_key(ikbdev,
+                                         keycode,
+                                         ikbd_drv_data->key_down);
+                        input_sync(ikbdev);
+                }
+        }
+}
+
+
+static int qcikbd_open(struct input_dev *dev)
+{
+        struct i2ckbd_drv_data *ikbd_drv_data = input_get_drvdata(dev);
+        struct i2c_client *ikbdclient = ikbd_drv_data->ki2c_client;
+
+        /* Send F4h - enable keyboard */
+        i2c_smbus_write_byte(ikbdclient, KEYBOARD_CMD_ENABLE);
+        return 0;
+}
+
+static int __devinit qcikbd_probe(struct i2c_client *client,
+                                    const struct i2c_device_id *id)
+{
+        int err;
+        int i;
+        struct i2ckbd_drv_data *context;
+        context = kzalloc(sizeof(struct i2ckbd_drv_data), GFP_KERNEL);
+        if (!context)
+                return -ENOMEM;
+        i2c_set_clientdata(client, context);
+        context->ki2c_client = client;
+        context->qcikbd_gpio = client->irq;
+        client->driver = &i2ckbd_driver;
+
+        INIT_WORK(&context->work, qcikbd_work_handler);
+
+        err = gpio_request(context->qcikbd_gpio, "qci-kbd");
+        if (err) {
+                pr_err("[KBD] err gpio request\n");
+                goto gpio_request_fail;
+        }
+
+        context->qcikbd_irq = gpio_to_irq(context->qcikbd_gpio);
+        err = request_irq(context->qcikbd_irq,
+                          qcikbd_interrupt,
+                          IRQF_TRIGGER_FALLING,
+                          KEYBOARD_ID_NAME,
+                          context);
+        if (err) {
+                pr_err("[KBD] err unable to get IRQ\n");
+                goto request_irq_fail;
+        }
+
+        context->qcikbd_dev = input_allocate_device();
+        if (!context->qcikbd_dev) {
+                pr_err("[KBD]allocting memory err\n");
+                err = -ENOMEM;
+                goto allocate_fail;
+        }
+
+        context->qcikbd_dev->name       = KEYBOARD_NAME;
+        context->qcikbd_dev->phys       = KEYBOARD_DEVICE;
+        context->qcikbd_dev->id.bustype = BUS_I2C;
+        context->qcikbd_dev->id.vendor  = 0x1050;
+        context->qcikbd_dev->id.product = 0x0006;
+        context->qcikbd_dev->id.version = 0x0004;
+        context->qcikbd_dev->open       = qcikbd_open;
+        context->qcikbd_dev->evbit[0]   = BIT_MASK(EV_KEY);
+
+        /* Enable all supported keys */
+        for (i = 1; i < ARRAY_SIZE(on2_keycode) ; i++)
+                set_bit(on2_keycode[i], context->qcikbd_dev->keybit);
+
+        set_bit(KEY_POWER, context->qcikbd_dev->keybit);
+        set_bit(KEY_END, context->qcikbd_dev->keybit);
+        set_bit(KEY_VOLUMEUP, context->qcikbd_dev->keybit);
+        set_bit(KEY_VOLUMEDOWN, context->qcikbd_dev->keybit);
+        set_bit(KEY_ZOOMIN, context->qcikbd_dev->keybit);
+        set_bit(KEY_ZOOMOUT, context->qcikbd_dev->keybit);
+
+        input_set_drvdata(context->qcikbd_dev, context);
+        err = input_register_device(context->qcikbd_dev);
+        if (err) {
+                pr_err("[KBD] err input register device\n");
+                goto register_fail;
+        }
+        g_qci_keyboard_dev = context->qcikbd_dev;
+	printk("QCI_KBD PROBE\n");
+        return 0;
+register_fail:
+        input_free_device(context->qcikbd_dev);
+
+allocate_fail:
+        free_irq(context->qcikbd_irq, context);
+
+request_irq_fail:
+        gpio_free(context->qcikbd_gpio);
+
+gpio_request_fail:
+        i2c_set_clientdata(client, NULL);
+        kfree(context);
+        return err;
+}
+
+static int __devexit qcikbd_remove(struct i2c_client *dev)
+{
+        struct i2ckbd_drv_data *context = i2c_get_clientdata(dev);
+
+        free_irq(context->qcikbd_irq, context);
+        gpio_free(context->qcikbd_gpio);
+        input_free_device(context->qcikbd_dev);
+        input_unregister_device(context->qcikbd_dev);
+        kfree(context);
+
+        return 0;
+}
+
+static int __init qcikbd_init(void)
+{
+        return i2c_add_driver(&i2ckbd_driver);
+}
+
+static void __exit qcikbd_exit(void)
+{
+        i2c_del_driver(&i2ckbd_driver);
+}
+
+struct input_dev *nkbc_keypad_get_input_dev(void)
+{
+        return g_qci_keyboard_dev;
+}
+EXPORT_SYMBOL(nkbc_keypad_get_input_dev);
+module_init(qcikbd_init);
+module_exit(qcikbd_exit);
+
+MODULE_AUTHOR("Quanta Computer Inc.");
+MODULE_DESCRIPTION("Quanta Embedded Controller I2C Keyboard Driver");
+MODULE_LICENSE("GPL v2");
+
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 05/36]  [Driver][Qualcomm 1070][TPM] Enable TPM module
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
  2010-07-26  8:30 ` [RFC 02/36] [Driver][Qualcomm 1070][USB] Register GPIO#109 for USB analog switch configuration Wayne Lin
  2010-07-26  8:30 ` [RFC 04/36] [Driver][Qualcomm 1070][EC_KB] Adding new qci keyboard driver Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 06/36] [Driver][Qualcomm 1070][EC_BRG] EC Bridge driver porting Wayne Lin
                   ` (28 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/configs/qsd8650a-st1_5_defconfig |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/arm/configs/qsd8650a-st1_5_defconfig b/arch/arm/configs/qsd8650a-st1_5_defconfig
index 4778703..d72bd03 100644
--- a/arch/arm/configs/qsd8650a-st1_5_defconfig
+++ b/arch/arm/configs/qsd8650a-st1_5_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.32.9
-# Fri Jun  4 15:48:06 2010
+# Sat Jun  5 18:26:10 2010
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -907,7 +907,10 @@ CONFIG_UNIX98_PTYS=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
-# CONFIG_TCG_TPM is not set
+CONFIG_TCG_TPM=y
+# CONFIG_TCG_NSC is not set
+# CONFIG_TCG_ATMEL is not set
+CONFIG_TCG_ST_I2C=y
 CONFIG_Q6_VENC=y
 CONFIG_MSM_KGSL=y
 CONFIG_MSM_KGSL_DRM=y
@@ -1973,7 +1976,7 @@ CONFIG_DEBUG_LL=y
 #
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
-# CONFIG_SECURITYFS is not set
+CONFIG_SECURITYFS=y
 CONFIG_SECURITY_FILE_CAPABILITIES=y
 # CONFIG_CRYPTO is not set
 CONFIG_BINARY_PRINTF=y
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 06/36]  [Driver][Qualcomm 1070][EC_BRG] EC Bridge driver porting
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (2 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 05/36] [Driver][Qualcomm 1070][TPM] Enable TPM module Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 07/36] [Driver][Qualcomm 1070][EC_BRG] Enable EC Bridge Wayne Lin
                   ` (27 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 drivers/hwmon/Kconfig    |    8 ++
 drivers/hwmon/Makefile   |    1 +
 drivers/hwmon/wpce775x.c |  166 ++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/wpce775x.h |   30 ++++++++
 4 files changed, 205 insertions(+), 0 deletions(-)
 create mode 100755 drivers/hwmon/wpce775x.c
 create mode 100755 include/linux/wpce775x.h

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 83a283e..d652272 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1061,4 +1061,12 @@ config SENSORS_ISL29011
         help
           ISL29011 Light Sensor Driver implemented by Quanta.
 
+config SENSORS_WPCE775X
+  	tristate "Winbond WPCE775X"
+  	depends on I2C
+  	default n
+        help
+	  This driver provides support for the Winbond WPCE775XX Embedded
+	  Controller, which provides lcd backlight, LEDs, and Battery control.
+
 endif # HWMON
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 6237580..fb99aa8 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -94,6 +94,7 @@ obj-$(CONFIG_SENSORS_W83L786NG)	+= w83l786ng.o
 obj-$(CONFIG_SENSORS_WM831X)	+= wm831x-hwmon.o
 obj-$(CONFIG_SENSORS_WM8350)	+= wm8350-hwmon.o
 obj-$(CONFIG_SENSORS_ISL29011)  += isl29011.o
+obj-$(CONFIG_SENSORS_WPCE775X)  += wpce775x.o
 
 ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
 EXTRA_CFLAGS += -DDEBUG
diff --git a/drivers/hwmon/wpce775x.c b/drivers/hwmon/wpce775x.c
new file mode 100755
index 0000000..dc296ea
--- /dev/null
+++ b/drivers/hwmon/wpce775x.c
@@ -0,0 +1,166 @@
+/* Quanta EC driver for the Winbond Embedded Controller
+ *
+ * Copyright (C) 2009 Quanta Computer Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+
+#define EC_ID_NAME          "qci-i2cec"
+#define EC_BUFFER_LEN		16
+#define EC_CMD_POWER_OFF	0xAC
+#define EC_CMD_RESTART	0xAB
+
+static struct i2c_client *g_i2cec_client;
+
+/* General structure to hold the driver data */
+struct i2cec_drv_data {
+		struct i2c_client *i2cec_client;
+		struct work_struct work;
+		char ec_data[EC_BUFFER_LEN+1];
+};
+
+static int __devinit wpce_probe(struct i2c_client *client,
+	const struct i2c_device_id *id);
+static int __devexit wpce_remove(struct i2c_client *kbd);
+
+#ifdef CONFIG_PM
+static int wpce_suspend(struct device *dev)
+{
+	return 0;
+}
+
+static int wpce_resume(struct device *dev)
+{
+	return 0;
+}
+#endif
+
+#ifdef CONFIG_PM
+static struct dev_pm_ops wpce_pm_ops = {
+	.suspend  = wpce_suspend,
+	.resume   = wpce_resume,
+};
+#endif
+
+static const struct i2c_device_id wpce_idtable[] = {
+       { EC_ID_NAME, 0 },
+       { }
+};
+
+static struct i2c_driver wpce_driver = {
+	.driver = {
+		.owner = THIS_MODULE,
+		.name  = EC_ID_NAME,
+#ifdef CONFIG_PM
+		.pm = &wpce_pm_ops,
+#endif
+	},
+	.probe	  = wpce_probe,
+	.remove	  = __devexit_p(wpce_remove),
+	.id_table   = wpce_idtable,
+};
+
+static int __devinit wpce_probe(struct i2c_client *client,
+				    const struct i2c_device_id *id)
+{
+	int err = -ENOMEM;
+	struct i2cec_drv_data *context = 0;
+
+	/* there is no need to call i2c_check_functionality() since it is the
+	client's job to use the interface (I2C vs SMBUS) appropriate for it. */
+	client->driver = &wpce_driver;
+	context = kzalloc(sizeof(struct i2cec_drv_data), GFP_KERNEL);
+	if (!context)
+		return err;
+
+	context->i2cec_client = client;
+	g_i2cec_client = client;
+	i2c_set_clientdata(context->i2cec_client, context);
+
+	return 0;
+}
+
+static int __devexit wpce_remove(struct i2c_client *dev)
+{
+	struct i2cec_drv_data *context = i2c_get_clientdata(dev);
+	g_i2cec_client = NULL;
+	kfree(context);
+
+	return 0;
+}
+
+static int __init wpce_init(void)
+{
+	return i2c_add_driver(&wpce_driver);
+}
+
+static void __exit wpce_exit(void)
+{
+	i2c_del_driver(&wpce_driver);
+}
+
+struct i2c_client *wpce_get_i2c_client(void)
+{
+	return g_i2cec_client;
+}
+EXPORT_SYMBOL_GPL(wpce_get_i2c_client);
+
+void wpce_poweroff(void)
+{
+	if (g_i2cec_client == NULL)
+		return;
+	i2c_smbus_write_byte(g_i2cec_client, EC_CMD_POWER_OFF);
+}
+EXPORT_SYMBOL_GPL(wpce_poweroff);
+
+void wpce_restart(void)
+{
+	if (g_i2cec_client == NULL)
+		return;
+	i2c_smbus_write_byte(g_i2cec_client, EC_CMD_RESTART);
+}
+EXPORT_SYMBOL_GPL(wpce_restart);
+
+int wpce_i2c_transfer(struct i2c_msg *msg)
+{
+	if (g_i2cec_client == NULL)
+		return -1;
+	msg->addr = g_i2cec_client->addr;
+	return i2c_transfer(g_i2cec_client->adapter, msg, 1);
+}
+EXPORT_SYMBOL_GPL(wpce_i2c_transfer);
+
+int wpce_smbus_write_word_data(u8 command, u16 value)
+{
+	if (g_i2cec_client == NULL)
+		return -1;
+	return i2c_smbus_write_word_data(g_i2cec_client, command, value);
+}
+EXPORT_SYMBOL_GPL(wpce_smbus_write_word_data);
+
+int wpce_smbus_write_byte_data(u8 command, u8 value)
+{
+	if (g_i2cec_client == NULL)
+		return -1;
+	return i2c_smbus_write_byte_data(g_i2cec_client, command, value);
+}
+EXPORT_SYMBOL_GPL(wpce_smbus_write_byte_data);
+
+module_init(wpce_init);
+module_exit(wpce_exit);
+
+MODULE_AUTHOR("Quanta Computer Inc.");
+MODULE_DESCRIPTION("Quanta Embedded Controller I2C Bridge Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/include/linux/wpce775x.h b/include/linux/wpce775x.h
new file mode 100755
index 0000000..1803122
--- /dev/null
+++ b/include/linux/wpce775x.h
@@ -0,0 +1,30 @@
+/* Quanta EC driver for the Winbond Embedded Controller
+ *
+ * Copyright (C) 2009 Quanta Computer Inc.
+ * 
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef WPCE775X_DRV_H
+#define WPCE775X_DRV_H
+
+#include <linux/i2c.h>
+
+struct i2c_client *wpce_get_i2c_client(void);
+int wpce_smbus_write_word_data(u8 command, u16 value);
+struct i2c_client *wpce_get_i2c_client(void);
+void wpce_poweroff(void);
+void wpce_restart(void);
+int wpce_i2c_transfer(struct i2c_msg *msg);
+int wpce_smbus_write_word_data(u8 command, u16 value);
+int wpce_smbus_write_byte_data(u8 command, u8 value);
+
+#endif
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 07/36]  [Driver][Qualcomm 1070][EC_BRG] Enable EC Bridge
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (3 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 06/36] [Driver][Qualcomm 1070][EC_BRG] EC Bridge driver porting Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 08/36] [Driver][Qualcomm 1070][EC_BAT] EC battery driver porting Wayne Lin
                   ` (26 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/configs/qsd8650a-st1_5_defconfig |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/qsd8650a-st1_5_defconfig b/arch/arm/configs/qsd8650a-st1_5_defconfig
index d72bd03..efb0f05 100644
--- a/arch/arm/configs/qsd8650a-st1_5_defconfig
+++ b/arch/arm/configs/qsd8650a-st1_5_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.32.9
-# Sat Jun  5 18:26:10 2010
+# Mon Jun  7 11:20:32 2010
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -1057,6 +1057,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_SENSORS_LIS3_SPI is not set
 CONFIG_SENSORS_ISL29011=y
+CONFIG_SENSORS_WPCE775X=y
 # CONFIG_THERMAL is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 08/36]  [Driver][Qualcomm 1070][EC_BAT] EC battery driver porting
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (4 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 07/36] [Driver][Qualcomm 1070][EC_BRG] Enable EC Bridge Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 09/36] [Driver][Qualcomm 1070][EC_BAT] Enable EC battery Wayne Lin
                   ` (25 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 drivers/power/Kconfig       |    8 +
 drivers/power/Makefile      |    1 +
 drivers/power/qci_battery.c |  356 +++++++++++++++++++++++++++++++++++++++++++
 drivers/power/qci_battery.h |   61 ++++++++
 4 files changed, 426 insertions(+), 0 deletions(-)
 create mode 100644 drivers/power/qci_battery.c
 create mode 100644 drivers/power/qci_battery.h

diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index cea6cef..c837ba8 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -110,4 +110,12 @@ config CHARGER_PCF50633
 	help
 	 Say Y to include support for NXP PCF50633 Main Battery Charger.
 
+config BATTERY_QCIBAT
+	tristate "Quanta Computer Inc. Battery"
+	depends on SENSORS_WPCE775X && ARCH_MSM_SCORPION
+	default n
+	help
+	 Say Y here if you want to use the Quanta battery driver for ST15
+	 platform.
+
 endif # POWER_SUPPLY
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index b96f29d..131fbe8 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -29,3 +29,4 @@ obj-$(CONFIG_BATTERY_BQ27x00)	+= bq27x00_battery.o
 obj-$(CONFIG_BATTERY_DA9030)	+= da9030_battery.o
 obj-$(CONFIG_BATTERY_MAX17040)	+= max17040_battery.o
 obj-$(CONFIG_CHARGER_PCF50633)	+= pcf50633-charger.o
+obj-$(CONFIG_BATTERY_QCIBAT)	+= qci_battery.o
diff --git a/drivers/power/qci_battery.c b/drivers/power/qci_battery.c
new file mode 100644
index 0000000..593d720
--- /dev/null
+++ b/drivers/power/qci_battery.c
@@ -0,0 +1,356 @@
+/* Quanta I2C Battery Driver
+ *
+ * Copyright (C) 2009 Quanta Computer Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+/*
+ *
+ *  The Driver with I/O communications via the I2C Interface for ST15 platform.
+ *  And it is only working on the nuvoTon WPCE775x Embedded Controller.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/power_supply.h>
+#include <linux/sched.h>
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/wpce775x.h>
+
+#include "qci_battery.h"
+
+struct qci_bat_info {
+	u8 type_id;
+	u8 power_flag;
+	u8 ec_ver_lsb;
+	u8 ec_ver_msb;
+	u8 mbat_rsoc;
+	u8 mbat_volt_lsb;
+	u8 mbat_volt_msb;
+	u8 mbat_status;
+	u8 mbchg_status;
+	u8 mbat_temp_lsb;
+	u8 mbat_temp_msb;
+};
+
+/* General structure to hold the driver data */
+struct i2cbat_drv_data {
+	struct i2c_client *bi2c_client;
+	struct work_struct work;
+	char batt_data[I2C_BAT_BUFFER_LEN+1];
+	unsigned int qcibat_irq;
+	unsigned int qcibat_gpio;
+	struct qci_bat_info bif;
+};
+
+static struct i2cbat_drv_data context;
+/*********************************************************************
+ *		Power
+ *********************************************************************/
+
+static int qci_ac_get_prop(struct power_supply *psy,
+			    enum power_supply_property psp,
+			    union power_supply_propval *val)
+{
+	int ret = 0;
+	switch (psp) {
+	case POWER_SUPPLY_PROP_ONLINE:
+		if (context.bif.power_flag & EC_FLAG_ADAPTER_IN)
+			val->intval =  EC_ADAPTER_PRESENT;
+		else
+			val->intval =  EC_ADAPTER_NOT_PRESENT;
+	break;
+	default:
+		ret = -EINVAL;
+	break;
+	}
+	return ret;
+}
+
+static enum power_supply_property qci_ac_props[] = {
+	POWER_SUPPLY_PROP_ONLINE,
+};
+
+static enum power_supply_property qci_bat_props[] = {
+	POWER_SUPPLY_PROP_STATUS,
+	POWER_SUPPLY_PROP_PRESENT,
+	POWER_SUPPLY_PROP_HEALTH,
+	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_VOLTAGE_AVG,
+	POWER_SUPPLY_PROP_CURRENT_AVG,
+	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_TEMP,
+	POWER_SUPPLY_PROP_TEMP_AMBIENT,
+	POWER_SUPPLY_PROP_MANUFACTURER,
+	POWER_SUPPLY_PROP_SERIAL_NUMBER,
+	POWER_SUPPLY_PROP_CHARGE_COUNTER,
+};
+
+static int qbat_get_status(union power_supply_propval *val)
+{
+	if ((context.bif.mbat_status & MAIN_BATTERY_STATUS_BAT_IN) == 0x0)
+		val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
+	else if (context.bif.mbchg_status & CHG_STATUS_BAT_INCHARGE)
+		val->intval = POWER_SUPPLY_STATUS_CHARGING;
+	else if (context.bif.mbat_status & MAIN_BATTERY_STATUS_BAT_FULL)
+		val->intval = POWER_SUPPLY_STATUS_FULL;
+	else
+		val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
+
+	return 0;
+}
+
+static int qbat_get_present(union power_supply_propval *val)
+{
+	if (context.bif.mbat_status & MAIN_BATTERY_STATUS_BAT_IN)
+		val->intval = EC_BAT_PRESENT;
+	else
+		val->intval = EC_BAT_NOT_PRESENT;
+	return 0;
+}
+
+static int qbat_get_health(union power_supply_propval *val)
+{
+	if ((context.bif.mbat_status & MAIN_BATTERY_STATUS_BAT_IN) == 0x0)
+		val->intval = POWER_SUPPLY_HEALTH_UNKNOWN;
+	else
+		val->intval = POWER_SUPPLY_HEALTH_GOOD;
+	return 0;
+}
+
+static int qbat_get_voltage_avg(union power_supply_propval *val)
+{
+	val->intval = (context.bif.mbat_volt_msb << 8 |
+		       context.bif.mbat_volt_lsb);
+	return 0;
+}
+
+static int qbat_get_capacity(union power_supply_propval *val)
+{
+	if ((context.bif.mbat_status & MAIN_BATTERY_STATUS_BAT_IN) == 0x0)
+		val->intval = 0xFF;
+	else
+		val->intval = context.bif.mbat_rsoc;
+	return 0;
+}
+
+static int qbat_get_temp_avg(union power_supply_propval *val)
+{
+	if ((context.bif.mbat_status & MAIN_BATTERY_STATUS_BAT_IN) == 0x0)
+		val->intval = 0xFFFF;
+	else
+		val->intval = ((context.bif.mbat_temp_msb << 8) |
+			       context.bif.mbat_temp_lsb) - 2731;
+	return 0;
+}
+
+static int qbat_get_mfr(union power_supply_propval *val)
+{
+	val->strval = "Unknown";
+	return 0;
+}
+
+static int qbat_get_tech(union power_supply_propval *val)
+{
+	if ((context.bif.mbat_status & MAIN_BATTERY_STATUS_BAT_IN) == 0x0)
+		val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
+	else
+		val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
+	return 0;
+}
+
+/*********************************************************************
+ *		Battery properties
+ *********************************************************************/
+static int qbat_get_property(struct power_supply *psy,
+			     enum power_supply_property psp,
+			     union power_supply_propval *val)
+{
+	int ret = 0;
+	switch (psp) {
+	case POWER_SUPPLY_PROP_STATUS:
+		ret = qbat_get_status(val);
+		break;
+	case POWER_SUPPLY_PROP_PRESENT:
+		ret = qbat_get_present(val);
+		break;
+	case POWER_SUPPLY_PROP_HEALTH:
+		ret = qbat_get_health(val);
+		break;
+	case POWER_SUPPLY_PROP_MANUFACTURER:
+		ret = qbat_get_mfr(val);
+		break;
+	case POWER_SUPPLY_PROP_TECHNOLOGY:
+		ret = qbat_get_tech(val);
+		break;
+	case POWER_SUPPLY_PROP_VOLTAGE_AVG:
+		ret = qbat_get_voltage_avg(val);
+		break;
+	case POWER_SUPPLY_PROP_CURRENT_AVG:
+		break;
+	case POWER_SUPPLY_PROP_CAPACITY:
+		ret = qbat_get_capacity(val);
+		break;
+	case POWER_SUPPLY_PROP_TEMP:
+		ret = qbat_get_temp_avg(val);
+		break;
+	case POWER_SUPPLY_PROP_TEMP_AMBIENT:
+		ret = qbat_get_temp_avg(val);
+		break;
+	case POWER_SUPPLY_PROP_CHARGE_COUNTER:
+		break;
+	case POWER_SUPPLY_PROP_SERIAL_NUMBER:
+		break;
+	default:
+		ret = -EINVAL;
+		break;
+	}
+
+	return ret;
+}
+
+/*********************************************************************
+ *		Initialisation
+ *********************************************************************/
+
+static struct power_supply qci_ac = {
+	.name = "ac",
+	.type = POWER_SUPPLY_TYPE_MAINS,
+	.properties = qci_ac_props,
+	.num_properties = ARRAY_SIZE(qci_ac_props),
+	.get_property = qci_ac_get_prop,
+};
+
+static struct power_supply qci_bat = {
+	.name = "battery",
+	.type = POWER_SUPPLY_TYPE_BATTERY,
+	.properties = qci_bat_props,
+	.num_properties = ARRAY_SIZE(qci_bat_props),
+	.get_property = qbat_get_property,
+	.use_for_apm = 1,
+};
+
+static irqreturn_t qbat_interrupt(int irq, void *dev_id)
+{
+	struct i2cbat_drv_data *ibat_drv_data = dev_id;
+	schedule_work(&ibat_drv_data->work);
+	return IRQ_HANDLED;
+}
+
+static int qci_get_bat_info(struct i2c_client *client, char *ec_data)
+{
+	struct i2c_msg bat_msg;
+	bat_msg.addr = client->addr;
+	bat_msg.flags = I2C_M_RD;
+	bat_msg.len = I2C_BAT_BUFFER_LEN;
+	bat_msg.buf = ec_data;
+	return i2c_transfer(client->adapter, &bat_msg, 1);
+}
+
+static void qbat_work(struct work_struct *_work)
+{
+	struct i2cbat_drv_data *ibat_drv_data =
+		container_of(_work, struct i2cbat_drv_data, work);
+	struct i2c_client *ibatclient = ibat_drv_data->bi2c_client;
+
+	qci_get_bat_info(ibatclient, ibat_drv_data->batt_data);
+	memcpy(&context.bif,
+	       ibat_drv_data->batt_data,
+	       sizeof(struct qci_bat_info));
+	power_supply_changed(&qci_ac);
+	power_supply_changed(&qci_bat);
+}
+
+static struct platform_device *bat_pdev;
+
+static int __init qbat_init(void)
+{
+	int err = 0;
+
+	context.bi2c_client = wpce_get_i2c_client();
+	if (context.bi2c_client == NULL)
+		return -1;
+
+	i2c_set_clientdata(context.bi2c_client, &context);
+	context.qcibat_gpio = context.bi2c_client->irq;
+
+	/*battery device register*/
+	bat_pdev = platform_device_register_simple("battery", 0, NULL, 0);
+	if (IS_ERR(bat_pdev))
+		return PTR_ERR(bat_pdev);
+
+	err = power_supply_register(&bat_pdev->dev, &qci_ac);
+	if (err)
+		goto ac_failed;
+
+	qci_bat.name = bat_pdev->name;
+	err = power_supply_register(&bat_pdev->dev, &qci_bat);
+	if (err)
+		goto battery_failed;
+
+	/*battery irq configure*/
+	INIT_WORK(&context.work, qbat_work);
+	err = gpio_request(context.qcibat_gpio, "qci-bat");
+	if (err) {
+		dev_err(&context.bi2c_client->dev,
+			"[BAT] err gpio request\n");
+		goto gpio_request_fail;
+	}
+	context.qcibat_irq = gpio_to_irq(context.qcibat_gpio);
+	err = request_irq(context.qcibat_irq, qbat_interrupt,
+		IRQF_TRIGGER_FALLING, BATTERY_ID_NAME, &context);
+	if (err) {
+		dev_err(&context.bi2c_client->dev,
+			"[BAT] unable to get IRQ\n");
+		goto request_irq_fail;
+	}
+	err = qci_get_bat_info(context.bi2c_client, context.batt_data);
+
+	goto success;
+
+request_irq_fail:
+	gpio_free(context.qcibat_gpio);
+
+gpio_request_fail:
+	power_supply_unregister(&qci_bat);
+
+battery_failed:
+	power_supply_unregister(&qci_ac);
+
+ac_failed:
+	platform_device_unregister(bat_pdev);
+
+	i2c_set_clientdata(context.bi2c_client, NULL);
+success:
+	return err;
+}
+
+static void __exit qbat_exit(void)
+{
+	free_irq(context.qcibat_irq, &context);
+	gpio_free(context.qcibat_gpio);
+	power_supply_unregister(&qci_bat);
+	power_supply_unregister(&qci_ac);
+	platform_device_unregister(bat_pdev);
+	i2c_set_clientdata(context.bi2c_client, NULL);
+}
+
+late_initcall(qbat_init);
+module_exit(qbat_exit);
+
+MODULE_AUTHOR("Quanta Computer Inc.");
+MODULE_DESCRIPTION("Quanta Embedded Controller I2C Battery Driver");
+MODULE_LICENSE("GPL v2");
+
diff --git a/drivers/power/qci_battery.h b/drivers/power/qci_battery.h
new file mode 100644
index 0000000..abf55fb
--- /dev/null
+++ b/drivers/power/qci_battery.h
@@ -0,0 +1,61 @@
+/* Header file for Quanta I2C Battery Driver
+ *
+ * Copyright (C) 2009 Quanta Computer Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+ /*
+ *
+ *  The Driver with I/O communications via the I2C Interface for ON2 of AP BU.
+ *  And it is only working on the nuvoTon WPCE775x Embedded Controller.
+ *
+ */
+
+#ifndef __QCI_BATTERY_H__
+#define __QCI_BATTERY_H__
+
+#define BAT_I2C_ADDRESS 0x1A
+#define BATTERY_ID_NAME          "qci-i2cbat"
+#define EC_FLAG_ADAPTER_IN		0x01
+#define EC_FLAG_POWER_ON		0x02
+#define EC_FLAG_ENTER_S3		0x04
+#define EC_FLAG_ENTER_S4		0x08
+#define EC_FLAG_IN_STANDBY		0x10
+#define EC_FLAG_SYSTEM_ON		0x20
+#define EC_FLAG_WAIT_HWPG		0x40
+#define EC_FLAG_S5_POWER_ON	0x80
+
+#define MAIN_BATTERY_STATUS_BAT_IN			0x01
+#define MAIN_BATTERY_STATUS_BAT_FULL			0x02
+#define MAIN_BATTERY_STATUS_BAT_ABNORMAL	0x04
+#define MAIN_BATTERY_STATUS_BAT_CHARGING	0x08
+#define MAIN_BATTERY_STATUS_BAT_CRITICAL		0x10
+#define MAIN_BATTERY_STATUS_BAT_LOW			0x20
+#define MAIN_BATTERY_STATUS_BAT_DISCHRG		0x40
+#define MAIN_BATTERY_STATUS_BAT_SMB_VALID	0x80
+
+#define CHG_STATUS_BAT_CHARGE			0x01
+#define CHG_STATUS_BAT_PRECHG				0x02
+#define CHG_STATUS_BAT_OVERTEMP			0x04
+#define CHG_STATUS_BAT_TYPE				0x08
+#define CHG_STATUS_BAT_GWROK				0x10
+#define CHG_STATUS_BAT_INCHARGE			0x20
+#define CHG_STATUS_BAT_WAKECHRG			0x40
+#define CHG_STATUS_BAT_CHGTIMEOUT		0x80
+
+#define EC_ADAPTER_PRESENT		0x1
+#define EC_BAT_PRESENT		0x1
+#define EC_ADAPTER_NOT_PRESENT		0x0
+#define EC_BAT_NOT_PRESENT		0x0
+#define I2C_BAT_BUFFER_LEN		12
+
+#endif
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 09/36]  [Driver][Qualcomm 1070][EC_BAT] Enable EC battery
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (5 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 08/36] [Driver][Qualcomm 1070][EC_BAT] EC battery driver porting Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 11/36] [Driver][Qualcomm 1070][EC_G_SENSOR] Enable EC gravitation sensor Wayne Lin
                   ` (24 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/configs/qsd8650a-st1_5_defconfig |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/qsd8650a-st1_5_defconfig b/arch/arm/configs/qsd8650a-st1_5_defconfig
index efb0f05..365137b 100644
--- a/arch/arm/configs/qsd8650a-st1_5_defconfig
+++ b/arch/arm/configs/qsd8650a-st1_5_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.32.9
-# Mon Jun  7 11:20:32 2010
+# Mon Jun  7 11:24:52 2010
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -987,6 +987,7 @@ CONFIG_POWER_SUPPLY=y
 # CONFIG_BATTERY_DS2782 is not set
 # CONFIG_BATTERY_BQ27x00 is not set
 # CONFIG_BATTERY_MAX17040 is not set
+CONFIG_BATTERY_QCIBAT=y
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
 # CONFIG_HWMON_DEBUG_CHIP is not set
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 11/36]  [Driver][Qualcomm 1070][EC_G_SENSOR] Enable EC gravitation sensor
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (6 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 09/36] [Driver][Qualcomm 1070][EC_BAT] Enable EC battery Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 12/36] [Driver][Qualcomm 1070][EC_C_SENSOR] EC compass sensor driver porting Wayne Lin
                   ` (23 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/configs/qsd8650a-st1_5_defconfig |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/qsd8650a-st1_5_defconfig b/arch/arm/configs/qsd8650a-st1_5_defconfig
index 365137b..c8e87c9 100644
--- a/arch/arm/configs/qsd8650a-st1_5_defconfig
+++ b/arch/arm/configs/qsd8650a-st1_5_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.32.9
-# Mon Jun  7 11:24:52 2010
+# Mon Jun  7 11:33:09 2010
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -1059,6 +1059,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_LIS3_SPI is not set
 CONFIG_SENSORS_ISL29011=y
 CONFIG_SENSORS_WPCE775X=y
+CONFIG_SENSORS_BOSCH_BMA150=y
 # CONFIG_THERMAL is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 12/36]  [Driver][Qualcomm 1070][EC_C_SENSOR] EC compass sensor driver porting
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (7 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 11/36] [Driver][Qualcomm 1070][EC_G_SENSOR] Enable EC gravitation sensor Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 13/36] [Driver][Qualcomm 1070][EC_C_SENSOR] Enable EC compass sensor driver Wayne Lin
                   ` (22 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 drivers/hwmon/Kconfig   |    7 +
 drivers/hwmon/Makefile  |    1 +
 drivers/hwmon/hmc5843.c |  501 +++++++++++++++++++++++++++++++++++++++++++++++
 drivers/hwmon/hmc5843.h |   37 ++++
 4 files changed, 546 insertions(+), 0 deletions(-)
 create mode 100755 drivers/hwmon/hmc5843.c
 create mode 100755 drivers/hwmon/hmc5843.h

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 30ac82d..123749d 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1069,6 +1069,13 @@ config SENSORS_WPCE775X
 	  This driver provides support for the Winbond WPCE775XX Embedded
 	  Controller, which provides lcd backlight, LEDs, and Battery control.
 
+config SENSORS_HMC5843
+        tristate "HMC5843 Compass Sensor Driver"
+        depends on I2C && ARCH_MSM_SCORPION
+        default n
+        help
+          HMC5843 Compass Sensor Driver implemented by Quanta.
+
 config SENSORS_BOSCH_BMA150
         tristate "SMB380/BMA150 acceleration sensor support"
         depends on I2C
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 87f75e1..5ba2984 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -96,6 +96,7 @@ obj-$(CONFIG_SENSORS_WM8350)	+= wm8350-hwmon.o
 obj-$(CONFIG_SENSORS_ISL29011)  += isl29011.o
 obj-$(CONFIG_SENSORS_WPCE775X)  += wpce775x.o
 obj-$(CONFIG_SENSORS_BOSCH_BMA150)      += bma150.o
+obj-$(CONFIG_SENSORS_HMC5843)   += hmc5843.o
 
 ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
 EXTRA_CFLAGS += -DDEBUG
diff --git a/drivers/hwmon/hmc5843.c b/drivers/hwmon/hmc5843.c
new file mode 100755
index 0000000..7a0a22c
--- /dev/null
+++ b/drivers/hwmon/hmc5843.c
@@ -0,0 +1,501 @@
+/* Quanta I2C Compass sensor Driver
+ *
+ * Copyright (C) 2009 Quanta Computer Inc.
+ * Author: Ivan Chang <Ivan.Chang@quantatw.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/jiffies.h>
+#include <linux/i2c.h>
+#include <linux/mutex.h>
+#include <linux/interrupt.h>
+#include <linux/input.h>
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include <linux/poll.h>
+#include <linux/miscdevice.h>
+#include <linux/fs.h>
+#include "hmc5843.h"
+
+#define MSENSOR_DRV_NAME 		"hmc5843"
+#define MSENSOR_DEV_NAME 		"hmc5843"
+#define MSENSOR_DEV_MINOR      		MISC_DYNAMIC_MINOR
+#define MSENSOR_DATA_BUF_LEN		3
+
+#define	MSENSOR_A_REG			0
+#define	MSENSOR_A_MEASURE_MASK		0x03
+#define	MSENSOR_A_RATE_MASK		0x1c
+#define	MSENSOR_A_RATE_SHIFT		2
+#define	MSENSOR_B_REG			1
+#define	MSENSOR_B_GAIN_MASK		0xe0
+#define	MSENSOR_B_GAIN_SHIFT		5
+#define	MSENSOR_MODE_REG		2
+#define	MSENSOR_MODE_MASK		0x03
+#define	MSENSOR_MODE_CONTINU		0
+#define	MSENSOR_MODE_SINGLE		1
+#define	MSENSOR_MODE_IDLE		2
+#define	MSENSOR_MODE_SLEEP		3
+#define	MSENSOR_X_DATA_REG		3
+#define	MSENSOR_Y_DATA_REG		5
+#define	MSENSOR_Z_DATA_REG		7
+#define	MSENSOR_STATUS_REG		9
+#define	MSENSOR_STATUS_REN		0x04
+#define	MSENSOR_STATUS_LOCK		0x02
+#define	MSENSOR_STATUS_RDY		0x01
+#define	MSENSOR_ID_REG_A		10
+#define	MSENSOR_ID_REG_B		11
+#define	MSENSOR_ID_REG_C		12
+
+/*-----------------------------------------------------------------------------
+ * Global variables
+ *---------------------------------------------------------------------------*/
+/* General structure to hold the driver data */
+struct msensor_drv_data {
+	struct i2c_client *client;
+	struct mutex lock;
+	struct miscdevice msensor_dev;
+	s16 msensor_data[3];
+	u8  rate;
+	u8  measure;
+	u8  gain;
+	u8  mode;
+	u8  reg_idx;
+};
+
+static struct msensor_drv_data *g_mdrv_data;
+
+static int __devinit msensor_probe(struct i2c_client *client,
+				   const struct i2c_device_id *id);
+static int __devexit msensor_remove(struct i2c_client *client);
+
+/*-----------------------------------------------------------------------------
+ * Low level functions
+ *---------------------------------------------------------------------------*/
+static int msensor_set_register(struct i2c_client *client,
+				u8 reg, u8 reg_value)
+{
+	struct msensor_drv_data *pdata = i2c_get_clientdata(client);
+	int ret;
+
+	ret = i2c_smbus_write_byte_data(client, reg, reg_value);
+	if (ret == 0) {
+		switch (reg) {
+		case MSENSOR_A_REG:
+			pdata->rate = (reg_value & MSENSOR_A_RATE_MASK) >>
+				       MSENSOR_A_RATE_SHIFT;
+			pdata->measure = reg_value & MSENSOR_A_MEASURE_MASK;
+			break;
+		case MSENSOR_B_REG:
+			pdata->gain = (reg_value & MSENSOR_B_GAIN_MASK) >>
+				       MSENSOR_B_GAIN_SHIFT;
+			break;
+		case MSENSOR_MODE_REG:
+			pdata->mode = reg_value & MSENSOR_MODE_MASK;
+			break;
+		default:
+			return -EINVAL;
+		}
+		pdata->reg_idx = reg + 1;
+	}
+	return ret;
+}
+
+static int msensor_get_adc_value(struct i2c_client *client)
+{
+	struct msensor_drv_data *pdata = i2c_get_clientdata(client);
+	u8 raw_data[6];
+	u8 raw_status;
+	int ret, i;
+
+	if (pdata->reg_idx != MSENSOR_X_DATA_REG) {
+		raw_data[0] = MSENSOR_X_DATA_REG;
+		ret = i2c_master_send(client, raw_data, 1);
+		if (ret != 1) {
+			dev_err(&client->dev,"[M-sensor] Set reg_idx failed\n");
+			return ret;
+		}
+		pdata->reg_idx = MSENSOR_X_DATA_REG;
+	}
+
+	ret = i2c_master_recv(client, raw_data, 6);
+	if (ret != 6) {
+		dev_err(&client->dev,
+			"[M-sensor] Get value failed with ret = %d\n",
+			ret);
+		return ret;
+	}
+
+	ret = i2c_master_recv(client, &raw_status, 1);
+	if (ret != 1) {
+		dev_err(&client->dev,
+			"[M-sensor] Get status failed with ret = %d\n",
+			ret);
+		return ret;
+	}
+
+	for (i = 0; i < MSENSOR_DATA_BUF_LEN ; i++) {
+		pdata->msensor_data[i] = raw_data[2*i+1] |
+					 (s8)raw_data[2*i] << 8;
+	}
+
+	dev_dbg(&client->dev,"qci-msensor: X = %d \n", pdata->msensor_data[0]);
+	dev_dbg(&client->dev,"qci-msensor: Y = %d \n", pdata->msensor_data[1]);
+	dev_dbg(&client->dev,"qci-msensor: Z = %d \n", pdata->msensor_data[2]);
+	return 0;
+}
+
+/*-----------------------------------------------------------------------------
+ * File Operation functions
+ *---------------------------------------------------------------------------*/
+static ssize_t msensor_read(struct file *file, char __user *userbuf,
+				size_t count, loff_t *offset)
+{
+	struct msensor_drv_data *pdata = file->private_data;
+	int ret1 = 0;
+	int ret2 = 0;
+
+	mutex_lock(&pdata->lock);
+	ret1 = msensor_get_adc_value(pdata->client);
+	ret2 = copy_to_user(userbuf, pdata->msensor_data, count);
+	mutex_unlock(&pdata->lock);
+	if (ret1 != 0 || ret2 != 0) {
+		dev_err(&pdata->client->dev,"[M-sensor] read data failed!\n");
+		return -EFAULT;
+	}
+	return count;
+}
+
+static int msensor_ioctl(struct inode *inode, struct file *file,
+			 unsigned int cmd, unsigned long param)
+{
+	struct msensor_drv_data *pdata = file->private_data;
+	void __user *argp = (void __user *)param;
+	int ret = 0;
+	int ret1 = 0;
+	int ret2 = 0;
+	int ret3 = 0;
+	u8 rate, measure, gain, mode;
+	u8 reg_value;
+
+	switch (cmd) {
+	case GET_RATE:
+		mutex_lock(&pdata->lock);
+		ret = copy_to_user(argp, &pdata->rate, sizeof(u8));
+		mutex_unlock(&pdata->lock);
+		if (ret != 0) {
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Get rate copy to user failed!\n");
+			return -EFAULT;
+		}
+		dev_dbg(&pdata->client->dev,
+			"[M-sensor] Get rate with value %d\n",
+			pdata->rate);
+		break;
+	case SET_RATE:
+		if (copy_from_user(&rate, argp, sizeof(rate))) {
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Fetch rate from user error\n");
+			return -EINVAL;
+		}
+		mutex_lock(&pdata->lock);
+		reg_value = pdata->measure | ((rate & MSENSOR_A_RATE_MASK) <<
+					       MSENSOR_A_RATE_SHIFT);
+		ret = msensor_set_register(pdata->client,
+					   MSENSOR_A_REG,
+					   reg_value);
+		mutex_unlock(&pdata->lock);
+		if (ret < 0) {
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Set rate error\n");
+			return -EFAULT;
+		}
+		break;
+	case GET_MEASURE:
+		mutex_lock(&pdata->lock);
+		ret = copy_to_user(argp, &pdata->measure, sizeof(u8));
+		mutex_unlock(&pdata->lock);
+		if (ret != 0) {
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Get measure"
+				"copy to user failed!\n");
+			return -EFAULT;
+		}
+		dev_dbg(&pdata->client->dev,"[M-sensor] Get measure with value %d\n",
+			pdata->measure);
+		break;
+	case SET_MEASURE:
+		if (copy_from_user(&measure, argp, sizeof(measure))) {
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Fetch measure from user error\n");
+			return -EINVAL;
+		}
+		mutex_lock(&pdata->lock);
+		reg_value = (pdata->rate << MSENSOR_A_RATE_MASK) |
+			    (measure & MSENSOR_A_MEASURE_MASK);
+		ret = msensor_set_register(pdata->client,
+					   MSENSOR_A_REG,
+					   reg_value);
+		mutex_unlock(&pdata->lock);
+		if (ret < 0) {
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Set measure error\n");
+			return -EFAULT;
+		}
+		break;
+	case GET_GAIN:
+		mutex_lock(&pdata->lock);
+		ret = copy_to_user(argp, &pdata->gain, sizeof(u8));
+		mutex_unlock(&pdata->lock);
+		if (ret != 0) {
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Get gain copy to user failed!\n");
+			return -EFAULT;
+		}
+		dev_dbg(&pdata->client->dev,
+			"[M-sensor] Get gain with value %d\n", pdata->gain);
+		break;
+	case SET_GAIN:
+		if (copy_from_user(&gain, argp, sizeof(gain))) {
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Fetch mode from user error\n");
+			return -EINVAL;
+		}
+		mutex_lock(&pdata->lock);
+		ret = msensor_set_register(pdata->client,
+					   MSENSOR_B_REG,
+					   ((gain & MSENSOR_B_GAIN_MASK) <<
+						MSENSOR_B_GAIN_SHIFT));
+		mutex_unlock(&pdata->lock);
+		if (ret < 0) {
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Set gain error\n");
+			return -EFAULT;
+		}
+		break;
+	case GET_MODE:
+		mutex_lock(&pdata->lock);
+		ret = copy_to_user(argp, &pdata->mode, sizeof(u8));
+		mutex_unlock(&pdata->lock);
+		if (ret != 0) {
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Get mode copy to user failed!\n");
+			return -EFAULT;
+		}
+		dev_dbg(&pdata->client->dev,
+			"[M-sensor] Get mode with value %d\n", pdata->mode);
+		break;
+	case SET_MODE:
+		if (copy_from_user(&mode, argp, sizeof(mode))) {
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Fetch mode from user error\n");
+			return -EINVAL;
+		}
+		mutex_lock(&pdata->lock);
+		ret = msensor_set_register(pdata->client,
+					   MSENSOR_MODE_REG,
+					   mode & MSENSOR_MODE_MASK);
+		mutex_unlock(&pdata->lock);
+		if (ret < 0) {
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Set mode error\n");
+			return -EFAULT;
+		}
+		break;
+	case SELF_TEST:
+		mutex_lock(&pdata->lock);
+		ret1 = msensor_set_register(pdata->client,
+					    MSENSOR_A_REG,
+					    0x11);
+		msleep(30);
+		ret2 = msensor_set_register(pdata->client,
+					    MSENSOR_B_REG,
+					    0x20);
+		msleep(30);
+		ret3 = msensor_set_register(pdata->client,
+					    MSENSOR_MODE_REG,
+					    0x01);
+		msleep(30);
+		if ((ret1 < 0) || (ret2 < 0) || (ret3 < 0)) {
+			mutex_unlock(&pdata->lock);
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Set mode register error\n");
+			return -EFAULT;
+		}
+		msleep(100);
+
+		ret1 = msensor_get_adc_value(pdata->client);
+		ret2 = copy_to_user(argp,
+				    pdata->msensor_data,
+				    sizeof(signed short)*3);
+		if (ret1 != 0 || ret2 != 0) {
+			mutex_unlock(&pdata->lock);
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Copy to user failed!\n");
+			 return -EFAULT;
+		}
+
+		msleep(200);
+		ret1 = msensor_set_register(pdata->client,
+					    MSENSOR_A_REG,
+					    0x10);
+		msleep(35);
+		ret2 = msensor_set_register(pdata->client,
+					    MSENSOR_B_REG,
+					    0x20);
+		msleep(35);
+		ret3 = msensor_set_register(pdata->client,
+					    MSENSOR_MODE_REG,
+					    0x00);
+		msleep(35);
+		mutex_unlock(&pdata->lock);
+		if ((ret1 < 0) || (ret2 < 0) || (ret3 < 0)) {
+			dev_err(&pdata->client->dev,
+				"[M-sensor] Set mode register error\n");
+			return -EFAULT;
+		}
+		break;
+	default:
+		return -ENOTTY;
+	}
+	return 0;
+}
+
+static int msensor_open(struct inode *inode, struct file  *file)
+{
+	file->private_data = g_mdrv_data;
+	return 0;
+}
+
+static int msensor_close(struct inode *inode, struct file  *file)
+{
+	file->private_data = NULL;
+	return 0;
+}
+
+static const struct file_operations msensor_ops = {
+	.owner = THIS_MODULE,
+	.read = msensor_read,
+	.open = msensor_open,
+	.release = msensor_close,
+	.ioctl = msensor_ioctl,
+};
+
+/*-----------------------------------------------------------------------------
+ * I2C Driver functions
+ *---------------------------------------------------------------------------*/
+static const struct i2c_device_id msensor_idtable[] = {
+	{ MSENSOR_DRV_NAME, 0},
+	{}
+};
+
+MODULE_DEVICE_TABLE(i2c, msensor_idtable);
+#ifdef CONFIG_PM
+static int msensor_suspend(struct device *dev)
+{
+	return 0;
+}
+
+static int msensor_resume(struct device *dev)
+{
+	return 0;
+}
+
+static struct dev_pm_ops msensor_pm_ops = {
+	.suspend  = msensor_suspend,
+	.resume   = msensor_resume,
+};
+
+#endif
+static struct i2c_driver msensor_driver = {
+	.driver = {
+		.owner = THIS_MODULE,
+		.name  = MSENSOR_DRV_NAME,
+#ifdef CONFIG_PM
+		.pm = &msensor_pm_ops,
+#endif
+	},
+	.probe  = msensor_probe,
+	.remove = msensor_remove,
+	.id_table   = msensor_idtable,
+};
+
+static int __devinit msensor_probe(struct i2c_client *client,
+				   const struct i2c_device_id *id)
+{
+	int ret;
+	struct msensor_drv_data *pdata = 0;
+	pdata = kzalloc(sizeof(struct msensor_drv_data), GFP_KERNEL);
+	if (!pdata)
+		return -ENOMEM;
+	g_mdrv_data = pdata;
+	i2c_set_clientdata(client, pdata);
+	pdata->client = client;
+	strlcpy(pdata->client->name, MSENSOR_DRV_NAME, I2C_NAME_SIZE);
+	client->driver = &msensor_driver;
+
+	pdata->msensor_dev.minor = MSENSOR_DEV_MINOR;
+	pdata->msensor_dev.name  = MSENSOR_DEV_NAME;
+	pdata->msensor_dev.fops  = &msensor_ops;
+
+	mutex_init(&pdata->lock);
+
+	msensor_set_register(client, MSENSOR_A_REG, 0x10);
+	msensor_set_register(client, MSENSOR_B_REG, 0x20);
+	msensor_set_register(client, MSENSOR_MODE_REG, 0x00);
+	msleep(100);
+
+	ret = misc_register(&pdata->msensor_dev);
+	if (ret) {
+		dev_err(&client->dev,
+			"[M-sensor] Misc device register failed\n");
+		goto misc_register_fail;
+	}
+
+	dev_dbg(&client->dev,"[M-sensor] Probe successful \n");
+	return 0;
+
+misc_register_fail:
+	i2c_set_clientdata(client, NULL);
+	kfree(pdata);
+	return ret;
+}
+
+static int __devexit msensor_remove(struct i2c_client *client)
+{
+	struct msensor_drv_data *pdata;
+
+	pdata = i2c_get_clientdata(client);
+	misc_deregister(&pdata->msensor_dev);
+	kfree(pdata);
+	return 0;
+}
+
+static int __init msensor_init(void)
+{
+	return i2c_add_driver(&msensor_driver);
+}
+
+static void __exit msensor_exit(void)
+{
+	i2c_del_driver(&msensor_driver);
+}
+
+module_init(msensor_init);
+module_exit(msensor_exit);
+
+MODULE_AUTHOR("Quanta Computer Inc.");
+MODULE_DESCRIPTION("Quanta I2C M-Sensor Driver");
+MODULE_LICENSE("GPL v2");
+
diff --git a/drivers/hwmon/hmc5843.h b/drivers/hwmon/hmc5843.h
new file mode 100755
index 0000000..09587a8
--- /dev/null
+++ b/drivers/hwmon/hmc5843.h
@@ -0,0 +1,37 @@
+/* Quanta I2C Compass sensor Driver Header File
+ *
+ * Copyright (C) 2009 Quanta Computer Inc.
+ * Author: Ivan Chang <Ivan.Chang@quantatw.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#ifndef HMC5843_DRV_H
+#define HMC5843_DRV_H
+
+#include <linux/ioctl.h>
+
+/*===========================================================================
+				IOCTLS
+===========================================================================*/
+#define HMC5843_IOC_MAGIC     0xe5
+
+#define GET_RATE	_IOWR(HMC5843_IOC_MAGIC, 0, unsigned long)
+#define SET_RATE	_IOWR(HMC5843_IOC_MAGIC, 1, unsigned long)
+#define GET_MEASURE	_IOWR(HMC5843_IOC_MAGIC, 2, unsigned long)
+#define SET_MEASURE	_IOWR(HMC5843_IOC_MAGIC, 3, unsigned long)
+#define GET_GAIN	_IOWR(HMC5843_IOC_MAGIC, 4, unsigned long)
+#define SET_GAIN	_IOWR(HMC5843_IOC_MAGIC, 5, unsigned long)
+#define GET_MODE	_IOWR(HMC5843_IOC_MAGIC, 6, unsigned long)
+#define SET_MODE	_IOWR(HMC5843_IOC_MAGIC, 7, unsigned long)
+#define SELF_TEST	_IOWR(HMC5843_IOC_MAGIC, 8, unsigned long)
+
+#endif
+
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 13/36]  [Driver][Qualcomm 1070][EC_C_SENSOR] Enable EC compass sensor driver
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (8 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 12/36] [Driver][Qualcomm 1070][EC_C_SENSOR] EC compass sensor driver porting Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 14/36] [Driver][Qualcomm 1070][CLOCK] Modify the AXI bus speed Wayne Lin
                   ` (21 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/configs/qsd8650a-st1_5_defconfig |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/configs/qsd8650a-st1_5_defconfig b/arch/arm/configs/qsd8650a-st1_5_defconfig
index c8e87c9..9c8742b 100644
--- a/arch/arm/configs/qsd8650a-st1_5_defconfig
+++ b/arch/arm/configs/qsd8650a-st1_5_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.32.9
-# Mon Jun  7 11:33:09 2010
+# Mon Jun  7 11:41:09 2010
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -1059,6 +1059,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_LIS3_SPI is not set
 CONFIG_SENSORS_ISL29011=y
 CONFIG_SENSORS_WPCE775X=y
+CONFIG_SENSORS_HMC5843=y
 CONFIG_SENSORS_BOSCH_BMA150=y
 # CONFIG_THERMAL is not set
 # CONFIG_WATCHDOG is not set
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 14/36]  [Driver][Qualcomm 1070][CLOCK] Modify the AXI bus speed
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (9 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 13/36] [Driver][Qualcomm 1070][EC_C_SENSOR] Enable EC compass sensor driver Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 15/36] [Driver][Qualcomm 1070][VERSION] Adding version definition Wayne Lin
                   ` (20 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/mach-msm/acpuclock-8x50a.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-msm/acpuclock-8x50a.c b/arch/arm/mach-msm/acpuclock-8x50a.c
index fab4c27..beaac14 100644
--- a/arch/arm/mach-msm/acpuclock-8x50a.c
+++ b/arch/arm/mach-msm/acpuclock-8x50a.c
@@ -106,7 +106,7 @@ struct clkctl_acpu_speed acpu_freq_tbl[] = {
 	{ 0,  921600, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x18, 1225 },
 	{ 0,  960000, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x19, 1225 },
 	{ 1,  998400, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x1A, 1225 },
-	{ 1, 1190400, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x1F, 1225 },
+	{ 1, 1190400, ACPU_PLL_3, 0, 0, 0, 0, 192000, 1, 0x1F, 1225 },
 	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
 };
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 15/36]  [Driver][Qualcomm 1070][VERSION] Adding version definition
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (10 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 14/36] [Driver][Qualcomm 1070][CLOCK] Modify the AXI bus speed Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 17/36] [Driver][Qualcomm 1070][WIFI/BT] Enable Athros WIFI driver Wayne Lin
                   ` (19 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/include/asm/img_version.h |   14 +++++++++
 arch/arm/mach-msm/Makefile         |    1 +
 arch/arm/mach-msm/smd_private.h    |    2 +
 arch/arm/mach-msm/version.c        |   56 ++++++++++++++++++++++++++++++++++++
 4 files changed, 73 insertions(+), 0 deletions(-)
 create mode 100755 arch/arm/include/asm/img_version.h
 mode change 100644 => 100755 arch/arm/mach-msm/smd_private.h
 create mode 100755 arch/arm/mach-msm/version.c

diff --git a/arch/arm/include/asm/img_version.h b/arch/arm/include/asm/img_version.h
new file mode 100755
index 0000000..52a019f
--- /dev/null
+++ b/arch/arm/include/asm/img_version.h
@@ -0,0 +1,14 @@
+#ifndef	__IMG_VERSION_H__
+#define __IMG_VERSION_H__
+
+#define MAX_STRING_LEN   32
+
+struct version_info {
+	char project_name[MAX_STRING_LEN];
+	char hw_mode[MAX_STRING_LEN];
+	char hw_revision[MAX_STRING_LEN];
+	char bsp_version[MAX_STRING_LEN];
+	char bsp_revision[MAX_STRING_LEN];
+};
+
+#endif
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index a395627..a8b0153 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -13,6 +13,7 @@ obj-y += cpufreq.o
 obj-y += nohlt.o
 obj-y += pmic.o
 obj-y += internal_power_rail.o
+obj-y += version.o
 
 obj-$(CONFIG_ARCH_MSM_ARM11) += acpuclock.o
 obj-$(CONFIG_MSM_VIC) += irq-vic.o
diff --git a/arch/arm/mach-msm/smd_private.h b/arch/arm/mach-msm/smd_private.h
old mode 100644
new mode 100755
index 9686db9..a53d994
--- a/arch/arm/mach-msm/smd_private.h
+++ b/arch/arm/mach-msm/smd_private.h
@@ -253,6 +253,8 @@ enum {
 	SMEM_SMD_BRIDGE_ALLOC_TABLE,
 	SMEM_SMDLITE_TABLE,
 	SMEM_SD_IMG_UPGRADE_STATUS,
+	SMEM_QCI_RAMTEST_INFO,
+	SMEM_QCI_ST15_VERSION,
 	SMEM_SEFS_INFO,
 	SMEM_NUM_ITEMS,
 };
diff --git a/arch/arm/mach-msm/version.c b/arch/arm/mach-msm/version.c
new file mode 100755
index 0000000..c683fe1
--- /dev/null
+++ b/arch/arm/mach-msm/version.c
@@ -0,0 +1,56 @@
+#include <linux/fs.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+#include <linux/utsname.h>
+#include <linux/utsrelease.h>
+#include <asm/uaccess.h>
+#include <asm/img_version.h>
+
+#include "proc_comm.h"
+#include "smd_private.h"
+
+#define KERNEL_VERSION UTS_RELEASE
+#define IMAGE_VERSION "0.1.0"
+
+static int version_proc_show(struct seq_file *m, void *v)
+{
+	struct version_info *version;
+
+        version = smem_alloc(SMEM_QCI_ST15_VERSION , sizeof(struct version_info));
+	if(version == NULL) {
+                pr_err("failed to get data from smem");
+		return -1;
+	}
+
+	seq_printf(m, "Project Name : %s\n", version->project_name);
+	seq_printf(m, "Hardware Mode : %s\n", version->hw_mode);
+	seq_printf(m, "Hardware Revision : %s\n", version->hw_revision);
+	seq_printf(m, "BSP Version : %s\n", version->bsp_version);
+	seq_printf(m, "BSP Revision : %s\n", version->bsp_revision);
+	seq_printf(m, "Kernel version : %s\n", KERNEL_VERSION);
+	seq_printf(m, "Image version : %s\n", IMAGE_VERSION);
+	return 0;
+}
+
+static int version_proc_open(struct inode *inode, struct file *file)
+{
+        return single_open(file, version_proc_show, NULL);
+}
+
+static const struct file_operations version_proc_fops = {
+        .open           = version_proc_open,
+        .read           = seq_read,
+        .llseek         = seq_lseek,
+        .release        = single_release,
+};
+
+static int __init proc_version_init(void)
+{
+        proc_create("img_version", 0, NULL, &version_proc_fops);
+
+        return 0;
+}
+module_init(proc_version_init);
+
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 17/36]  [Driver][Qualcomm 1070][WIFI/BT] Enable Athros WIFI driver
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (11 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 15/36] [Driver][Qualcomm 1070][VERSION] Adding version definition Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 18/36] [Driver][Qualcomm 1070][WIFI] Turn on the Athros WIFI power Wayne Lin
                   ` (18 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/configs/qsd8650a-st1_5_defconfig |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/qsd8650a-st1_5_defconfig b/arch/arm/configs/qsd8650a-st1_5_defconfig
index 9c8742b..5c9d1e7 100644
--- a/arch/arm/configs/qsd8650a-st1_5_defconfig
+++ b/arch/arm/configs/qsd8650a-st1_5_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.32.9
-# Mon Jun  7 11:41:09 2010
+# Mon Jun  7 13:35:03 2010
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -757,8 +757,14 @@ CONFIG_SMSC911X=y
 # CONFIG_NETDEV_10000 is not set
 CONFIG_WLAN=y
 # CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WLAN_80211 is not set
+CONFIG_WLAN_80211=y
+# CONFIG_LIBERTAS is not set
+# CONFIG_USB_ZD1201 is not set
+# CONFIG_USB_NET_RNDIS_WLAN is not set
 CONFIG_LIBRA_SDIOIF=y
+# CONFIG_ATH_COMMON is not set
+# CONFIG_HOSTAP is not set
+# CONFIG_IWM is not set
 
 #
 # Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -1710,6 +1716,25 @@ CONFIG_STAGING=y
 # CONFIG_IIO is not set
 
 #
+# Chromeos Supplied Third-Party Device Drivers
+#
+CONFIG_ATH6K_LEGACY=m
+CONFIG_AR600x_SD31_XXX=y
+# CONFIG_AR600x_WB31_XXX is not set
+# CONFIG_AR600x_SD32_XXX is not set
+# CONFIG_AR600x_CUSTOM_XXX is not set
+# CONFIG_ATH6KL_ENABLE_COEXISTENCE is not set
+# CONFIG_ATH6KL_HCI_BRIDGE is not set
+# CONFIG_ATH6KL_CFG80211 is not set
+# CONFIG_ATH6KL_HTC_RAW_INTERFACE is not set
+# CONFIG_ATH6KL_VIRTUAL_SCATTER_GATHER is not set
+CONFIG_ATH6KL_DEBUG=y
+# CONFIG_ATH6KL_ENABLE_HOST_DEBUG is not set
+CONFIG_ATH6KL_ENABLE_TARGET_DEBUG_PRINTS=y
+CONFIG_AR600x_DEBUG_UART_TX_PIN=8
+# CONFIG_ATH6KL_DISABLE_TARGET_DBGLOGS is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 18/36]  [Driver][Qualcomm 1070][WIFI] Turn on the Athros WIFI power
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (12 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 17/36] [Driver][Qualcomm 1070][WIFI/BT] Enable Athros WIFI driver Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 19/36] [Driver][Qualcomm 1070][BT] Enable Athros BT driver Wayne Lin
                   ` (17 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/mach-msm/board-qsd8x50.c |  263 +++++++++++++++++++++++++++++++++++++
 1 files changed, 263 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 633514a..0d44c2d 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -1811,6 +1811,262 @@ exit:
 	return;
 }
 
+static void set_st15_voltage(void)
+{
+        struct vreg *vreg_pa;
+        struct vreg *vreg_gp1;
+        struct vreg *vreg_gp2;
+        struct vreg *vreg_ruim;
+        struct vreg *vreg_gp5;
+        struct vreg *vreg_rfrx2;
+        struct vreg *vreg_synth;
+        struct vreg *vreg_gp4;
+	int rc;
+
+        vreg_pa = vreg_get(NULL, "pa");
+        if (IS_ERR(vreg_pa)) {
+                printk(KERN_ERR "%s: vreg pa get failed (%ld)\n",
+                       __func__, PTR_ERR(vreg_pa));
+                return;
+        }
+        rc = vreg_set_level(vreg_pa, 2100);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg pa set level failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        rc = vreg_enable(vreg_pa);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg pa enable failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        msleep(100);
+
+	vreg_gp1 = vreg_get(NULL, "gp1");
+        if (IS_ERR(vreg_gp1)) {
+                printk(KERN_ERR "%s: vreg gp1 get failed (%ld)\n",
+                       __func__, PTR_ERR(vreg_gp1));
+                return;
+        }
+        rc = vreg_set_level(vreg_gp1, 1800);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg gp1 set level failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        rc = vreg_enable(vreg_gp1);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg gp1 enable failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        msleep(100);
+
+	vreg_gp2 = vreg_get(NULL, "gp2");
+        if (IS_ERR(vreg_gp2)) {
+                printk(KERN_ERR "%s: vreg gp2 get failed (%ld)\n",
+                       __func__, PTR_ERR(vreg_gp2));
+                return;
+        }
+        rc = vreg_set_level(vreg_gp2, 2850);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg gp2 set level failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        rc = vreg_enable(vreg_gp2);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg gp2 enable failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        msleep(100);
+
+	vreg_ruim = vreg_get(NULL, "ruim");
+        if (IS_ERR(vreg_ruim)) {
+                printk(KERN_ERR "%s: vreg ruim get failed (%ld)\n",
+                       __func__, PTR_ERR(vreg_ruim));
+                return;
+        }
+        rc = vreg_set_level(vreg_ruim, 2850);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg ruim set level failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        rc = vreg_enable(vreg_ruim);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg ruim enable failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        msleep(100);
+
+	vreg_gp5 = vreg_get(NULL, "gp5");
+        if (IS_ERR(vreg_gp5)) {
+                printk(KERN_ERR "%s: vreg gp5 get failed (%ld)\n",
+                       __func__, PTR_ERR(vreg_gp5));
+                return;
+        }
+        rc = vreg_set_level(vreg_gp5, 1800);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg gp5 set level failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        rc = vreg_enable(vreg_gp5);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg gp5 enable failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        msleep(100);
+
+	vreg_rfrx2 = vreg_get(NULL, "rfrx2");
+        if (IS_ERR(vreg_rfrx2)) {
+                printk(KERN_ERR "%s: vreg rfrx2 get failed (%ld)\n",
+                       __func__, PTR_ERR(vreg_rfrx2));
+                return;
+        }
+        rc = vreg_set_level(vreg_rfrx2, 2100);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg rfrx2 set level failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        rc = vreg_enable(vreg_rfrx2);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg rfrx2 enable failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        msleep(100);
+
+	vreg_synth = vreg_get(NULL, "synt");
+        if (IS_ERR(vreg_synth)) {
+                printk(KERN_ERR "%s: vreg synth get failed (%ld)\n",
+                       __func__, PTR_ERR(vreg_synth));
+                return;
+        }
+        rc = vreg_set_level(vreg_synth, 2850);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg synth set level failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        rc = vreg_enable(vreg_synth);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg synth enable failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        msleep(100);
+
+	vreg_gp4 = vreg_get(NULL, "gp4");
+        if (IS_ERR(vreg_gp4)) {
+                printk(KERN_ERR "%s: vreg gp4 get failed (%ld)\n",
+                       __func__, PTR_ERR(vreg_gp4));
+                return;
+        }
+        rc = vreg_set_level(vreg_gp4, 2850);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg gp4 set level failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        rc = vreg_enable(vreg_gp4);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg gp4 enable failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        msleep(100);
+}
+
+static void enable_wlan_bt(void)
+{
+	struct vreg *vreg_gp6;
+        struct vreg *vreg_wlan;
+        struct vreg *vreg_gp3;
+	int rc;
+
+	vreg_gp3 = vreg_get(NULL, "gp3");
+        if (IS_ERR(vreg_gp3)) {
+                printk(KERN_ERR "%s: vreg gp3 get failed (%ld)\n",
+                       __func__, PTR_ERR(vreg_gp3));
+                return;
+        }
+        rc = vreg_set_level(vreg_gp3, 2600);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg gp3 set level failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        rc = vreg_enable(vreg_gp3);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg gp3 enable failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        msleep(100);
+
+        vreg_wlan = vreg_get(NULL, "wlan");
+        if (IS_ERR(vreg_wlan)) {
+                printk(KERN_ERR "%s: vreg wlan get failed (%ld)\n",
+                       __func__, PTR_ERR(vreg_wlan));
+                return;
+        }
+        rc = vreg_set_level(vreg_wlan, 2850);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg wlan set level failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        rc = vreg_enable(vreg_wlan);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg wlan enable failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+	msleep(100);
+
+	gpio_tlmm_config(GPIO_CFG(26, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), GPIO_ENABLE);
+        gpio_set_value(26, 1);
+        msleep(100);
+
+        vreg_gp6 = vreg_get(NULL, "gp6");
+        if (IS_ERR(vreg_gp6)) {
+                printk(KERN_ERR "%s: vreg get failed (%ld)\n",
+                       __func__, PTR_ERR(vreg_gp6));
+                return;
+        }
+        rc = vreg_disable(vreg_gp6);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg gp6 enable failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        rc = vreg_set_level(vreg_gp6, 1800);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg gp6 set level failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        rc = vreg_enable(vreg_gp6);
+        if (rc) {
+                printk(KERN_ERR "%s: vreg gp6 enable failed (%d)\n",
+                       __func__, rc);
+                return;
+        }
+        msleep(100);
+        gpio_tlmm_config(GPIO_CFG(41, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), GPIO_ENABLE);
+
+	gpio_set_value(41, 0);
+        msleep(100);
+        gpio_set_value(41, 1);
+}
+
 static void __attribute__((unused)) __init bt_power_init_st_1_5(void)
 {
 	int rc;
@@ -3245,7 +3501,11 @@ static void __init qsd8x50_init(void)
 	qsd8x50_init_host();
 	qsd8x50_init_mmc();
 	if (machine_is_qsd8x50a_st1_5())
+	{
 		bt_power_init_st_1_5();
+		/* power on wlan_bt module(AR6000) */
+		enable_wlan_bt();
+	}
 	else
 		bt_power_init();
 	audio_gpio_init();
@@ -3285,6 +3545,9 @@ static void __init qsd8x50_init(void)
 	else
 		platform_device_register(&keypad_device_surf);
 #endif
+	/* set regulator voltage */
+	if (machine_is_qsd8x50a_st1_5())
+               set_st15_voltage();
 }
 
 static void __init qsd8x50_allocate_memory_regions(void)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 19/36]  [Driver][Qualcomm 1070][BT] Enable Athros BT driver
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (13 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 18/36] [Driver][Qualcomm 1070][WIFI] Turn on the Athros WIFI power Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 20/36] [Driver][Qualcomm 1070][WIFI/BT] Enable MMC1 dummy send read and configure Athros WIFI build-in driver Wayne Lin
                   ` (16 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/configs/qsd8650a-st1_5_defconfig |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/arch/arm/configs/qsd8650a-st1_5_defconfig b/arch/arm/configs/qsd8650a-st1_5_defconfig
index 5c9d1e7..a88f1d9 100644
--- a/arch/arm/configs/qsd8650a-st1_5_defconfig
+++ b/arch/arm/configs/qsd8650a-st1_5_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.32.9
-# Mon Jun  7 13:35:03 2010
+# Mon Jun  7 13:56:07 2010
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -1719,12 +1719,19 @@ CONFIG_STAGING=y
 # Chromeos Supplied Third-Party Device Drivers
 #
 CONFIG_ATH6K_LEGACY=m
-CONFIG_AR600x_SD31_XXX=y
-# CONFIG_AR600x_WB31_XXX is not set
+# CONFIG_AR600x_SD31_XXX is not set
+CONFIG_AR600x_WB31_XXX=y
 # CONFIG_AR600x_SD32_XXX is not set
 # CONFIG_AR600x_CUSTOM_XXX is not set
-# CONFIG_ATH6KL_ENABLE_COEXISTENCE is not set
-# CONFIG_ATH6KL_HCI_BRIDGE is not set
+CONFIG_ATH6KL_ENABLE_COEXISTENCE=y
+CONFIG_AR600x_DUAL_ANTENNA=y
+# CONFIG_AR600x_SINGLE_ANTENNA is not set
+# CONFIG_AR600x_BT_QCOM is not set
+# CONFIG_AR600x_BT_CSR is not set
+CONFIG_AR600x_BT_AR3001=y
+CONFIG_ATH6KL_HCI_BRIDGE=y
+CONFIG_ATH6KL_CONFIG_GPIO_BT_RESET=y
+CONFIG_AR600x_BT_RESET_PIN=22
 # CONFIG_ATH6KL_CFG80211 is not set
 # CONFIG_ATH6KL_HTC_RAW_INTERFACE is not set
 # CONFIG_ATH6KL_VIRTUAL_SCATTER_GATHER is not set
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 20/36]  [Driver][Qualcomm 1070][WIFI/BT] Enable MMC1 dummy send read and configure Athros WIFI build-in driver
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (14 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 19/36] [Driver][Qualcomm 1070][BT] Enable Athros BT driver Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 21/36] Revert " [Driver][Qualcomm 1070][CLOCK] Modify the AXI bus speed" Wayne Lin
                   ` (15 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/configs/qsd8650a-st1_5_defconfig |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/arm/configs/qsd8650a-st1_5_defconfig b/arch/arm/configs/qsd8650a-st1_5_defconfig
index a88f1d9..18ab3c2 100644
--- a/arch/arm/configs/qsd8650a-st1_5_defconfig
+++ b/arch/arm/configs/qsd8650a-st1_5_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.32.9
-# Mon Jun  7 13:56:07 2010
+# Mon Jun  7 14:52:04 2010
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -1582,12 +1582,15 @@ CONFIG_MMC_MSM=y
 # CONFIG_MMC_MSM_CARD_HW_DETECTION is not set
 CONFIG_MMC_MSM_SDC1_SUPPORT=y
 # CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT is not set
+# CONFIG_MMC_MSM_SDC1_DUMMY52_REQUIRED is not set
 CONFIG_MMC_MSM_SDC2_SUPPORT=y
 # CONFIG_MMC_MSM_SDC2_8_BIT_SUPPORT is not set
+CONFIG_MMC_MSM_SDC2_DUMMY52_REQUIRED=y
 CONFIG_MMC_MSM_SDC3_SUPPORT=y
 CONFIG_MMC_MSM_SDC3_8_BIT_SUPPORT=y
+# CONFIG_MMC_MSM_SDC3_DUMMY52_REQUIRED is not set
 # CONFIG_MMC_MSM_SDC4_SUPPORT is not set
-CONFIG_MMC_MSM_PROG_DONE_SCAN=y
+# CONFIG_MMC_MSM_PROG_DONE_SCAN is not set
 # CONFIG_MEMSTICK is not set
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
@@ -1718,7 +1721,7 @@ CONFIG_STAGING=y
 #
 # Chromeos Supplied Third-Party Device Drivers
 #
-CONFIG_ATH6K_LEGACY=m
+CONFIG_ATH6K_LEGACY=y
 # CONFIG_AR600x_SD31_XXX is not set
 CONFIG_AR600x_WB31_XXX=y
 # CONFIG_AR600x_SD32_XXX is not set
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 21/36] Revert " [Driver][Qualcomm 1070][CLOCK] Modify the AXI bus speed"
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (15 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 20/36] [Driver][Qualcomm 1070][WIFI/BT] Enable MMC1 dummy send read and configure Athros WIFI build-in driver Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:46   ` Dmitry Torokhov
  2010-07-26  8:30 ` [RFC 22/36] [Driver][Qualcomm 1070][CLOCK] Modify the AXI bus maximum speed Wayne Lin
                   ` (14 subsequent siblings)
  31 siblings, 1 reply; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

This reverts commit 9ab35ce7ead42adf500950c6492fdd8aae173f5e.
---
 arch/arm/mach-msm/acpuclock-8x50a.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-msm/acpuclock-8x50a.c b/arch/arm/mach-msm/acpuclock-8x50a.c
index beaac14..fab4c27 100644
--- a/arch/arm/mach-msm/acpuclock-8x50a.c
+++ b/arch/arm/mach-msm/acpuclock-8x50a.c
@@ -106,7 +106,7 @@ struct clkctl_acpu_speed acpu_freq_tbl[] = {
 	{ 0,  921600, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x18, 1225 },
 	{ 0,  960000, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x19, 1225 },
 	{ 1,  998400, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x1A, 1225 },
-	{ 1, 1190400, ACPU_PLL_3, 0, 0, 0, 0, 192000, 1, 0x1F, 1225 },
+	{ 1, 1190400, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x1F, 1225 },
 	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
 };
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 22/36]  [Driver][Qualcomm 1070][CLOCK] Modify the AXI bus maximum speed
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (16 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 21/36] Revert " [Driver][Qualcomm 1070][CLOCK] Modify the AXI bus speed" Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 23/36] [Driver][Qualcomm 1065][AT_COMMAND]retrieve message Wayne Lin
                   ` (13 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/mach-msm/board-qsd8x50.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 0d44c2d..54ca8e7 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -2129,7 +2129,11 @@ static struct resource kgsl_resources[] = {
 #endif
 };
 static struct kgsl_platform_data kgsl_pdata = {
+#ifdef CONFIG_MSM_SOC_REV_A
+	.max_axi_freq = 192000, /*Max for 8650A*/
+#else
 	.max_axi_freq = 128000, /*Max for 8K*/
+#endif
 };
 
 static struct platform_device msm_device_kgsl = {
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 23/36] [Driver][Qualcomm 1065][AT_COMMAND]retrieve message
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (17 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 22/36] [Driver][Qualcomm 1070][CLOCK] Modify the AXI bus maximum speed Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 24/36] [Driver][Qualcomm 1070][CLOCK] Modify the AXI clock for 1.2Ghz Wayne Lin
                   ` (12 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: morris.chen

From: morris.chen <morris_chen@quantatw.com>

---
 arch/arm/mach-msm/smd_tty.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
 mode change 100644 => 100755 arch/arm/mach-msm/smd_tty.c

diff --git a/arch/arm/mach-msm/smd_tty.c b/arch/arm/mach-msm/smd_tty.c
old mode 100644
new mode 100755
index d4272fa..f43c086
--- a/arch/arm/mach-msm/smd_tty.c
+++ b/arch/arm/mach-msm/smd_tty.c
@@ -80,7 +80,9 @@ static void smd_tty_work_func(struct work_struct *work)
 			printk(KERN_ERR "OOPS - smd_tty_buffer mismatch?!");
 		}
 		mutex_unlock(&smd_tty_lock);
-
+		//QCI, morris chen, 20100608, begin, return ATcmd's message back
+		printk("%s\n",ptr);
+		//QCI, morris chen, end
 		tty_flip_buffer_push(tty);
 	}
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 24/36]  [Driver][Qualcomm 1070][CLOCK] Modify the AXI clock for 1.2Ghz
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (18 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 23/36] [Driver][Qualcomm 1065][AT_COMMAND]retrieve message Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 25/36] [Driver][Qualcomm 1070][EC_BRG] Adding new EC bridge driver Wayne Lin
                   ` (11 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/mach-msm/acpuclock-8x50a.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-msm/acpuclock-8x50a.c b/arch/arm/mach-msm/acpuclock-8x50a.c
index fab4c27..beaac14 100644
--- a/arch/arm/mach-msm/acpuclock-8x50a.c
+++ b/arch/arm/mach-msm/acpuclock-8x50a.c
@@ -106,7 +106,7 @@ struct clkctl_acpu_speed acpu_freq_tbl[] = {
 	{ 0,  921600, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x18, 1225 },
 	{ 0,  960000, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x19, 1225 },
 	{ 1,  998400, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x1A, 1225 },
-	{ 1, 1190400, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x1F, 1225 },
+	{ 1, 1190400, ACPU_PLL_3, 0, 0, 0, 0, 192000, 1, 0x1F, 1225 },
 	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
 };
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 25/36]  [Driver][Qualcomm 1070][EC_BRG] Adding new EC bridge driver
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (19 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 24/36] [Driver][Qualcomm 1070][CLOCK] Modify the AXI clock for 1.2Ghz Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 26/36] [Driver][Qualcomm 1070][EC_BL] New EC backlight driver porting Wayne Lin
                   ` (10 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: lc

From: lc <Liang-Chi.Chen@quantatw.com>

---
 drivers/hwmon/Kconfig    |  208 ++++++++++++++++++++--------------------------
 drivers/hwmon/Makefile   |   18 ++---
 drivers/hwmon/npce781x.c |  159 +++++++++++++++++++++++++++++++++++
 3 files changed, 255 insertions(+), 130 deletions(-)
 create mode 100755 drivers/hwmon/npce781x.c

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 123749d..f0c6d0f 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -28,17 +28,6 @@ config HWMON_VID
 	tristate
 	default n
 
-config HWMON_DEBUG_CHIP
-	bool "Hardware Monitoring Chip debugging messages"
-	default n
-	help
-	  Say Y here if you want the I2C chip drivers to produce a bunch of
-	  debug messages to the system log.  Select this if you are having
-	  a problem with I2C support and want to see more of what is going
-	  on.
-
-comment "Native drivers"
-
 config SENSORS_ABITUGURU
 	tristate "Abit uGuru (rev 1 & 2)"
 	depends on X86 && EXPERIMENTAL
@@ -259,6 +248,18 @@ config SENSORS_ASB100
 	  This driver can also be built as a module.  If so, the module
 	  will be called asb100.
 
+config SENSORS_ATK0110
+	tristate "ASUS ATK0110 ACPI hwmon"
+	depends on X86 && ACPI && EXPERIMENTAL
+	help
+	  If you say yes here you get support for the ACPI hardware
+	  monitoring interface found in many ASUS motherboards. This
+	  driver will provide readings of fans, voltages and temperatures
+	  through the system firmware.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called asus_atk0110.
+
 config SENSORS_ATXP1
 	tristate "Attansic ATXP1 VID controller"
 	depends on I2C && EXPERIMENTAL
@@ -325,6 +326,34 @@ config SENSORS_F75375S
 	  This driver can also be built as a module.  If so, the module
 	  will be called f75375s.
 
+config SENSORS_FSCHER
+	tristate "FSC Hermes (DEPRECATED)"
+	depends on X86 && I2C
+	help
+	  This driver is DEPRECATED please use the new merged fschmd
+	  ("FSC Poseidon, Scylla, Hermes, Heimdall and Heracles") driver
+	  instead.
+
+	  If you say yes here you get support for Fujitsu Siemens
+	  Computers Hermes sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called fscher.
+
+config SENSORS_FSCPOS
+	tristate "FSC Poseidon (DEPRECATED)"
+	depends on X86 && I2C
+	help
+	  This driver is DEPRECATED please use the new merged fschmd
+	  ("FSC Poseidon, Scylla, Hermes, Heimdall and Heracles") driver
+	  instead.
+
+	  If you say yes here you get support for Fujitsu Siemens
+	  Computers Poseidon sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called fscpos.
+
 config SENSORS_FSCHMD
 	tristate "Fujitsu Siemens Computers sensor chips"
 	depends on X86 && I2C
@@ -373,12 +402,12 @@ config SENSORS_GL520SM
 	  will be called gl520sm.
 
 config SENSORS_CORETEMP
-	tristate "Intel Core/Core2/Atom temperature sensor"
-	depends on X86 && PCI && EXPERIMENTAL
+	tristate "Intel Core (2) Duo/Solo temperature sensor"
+	depends on X86 && EXPERIMENTAL
 	help
 	  If you say yes here you get support for the temperature
-	  sensor inside your CPU. Most of the family 6 CPUs
-	  are supported. Check documentation/driver for details.
+	  sensor inside your CPU. Supported all are all known variants
+	  of Intel Core family.
 
 config SENSORS_IBMAEM
 	tristate "IBM Active Energy Manager temperature/power sensors and control"
@@ -673,23 +702,6 @@ config SENSORS_SHT15
 	  This driver can also be built as a module.  If so, the module
 	  will be called sht15.
 
-config SENSORS_S3C
-	tristate "S3C24XX/S3C64XX Inbuilt ADC"
-	depends on ARCH_S3C2410
-	help
-	  If you say yes here you get support for the on-board ADCs of
-	  the Samsung S3C24XX or S3C64XX series of SoC
-
-	  This driver can also be built as a module. If so, the module
-	  will be called s3c-hwmo.
-
-config SENSORS_S3C_RAW
-	bool "Include raw channel attributes in sysfs"
-	depends on SENSORS_S3C
-	help
-	  Say Y here if you want to include raw copies of all the ADC
-	  channels in sysfs.
-
 config SENSORS_SIS5595
 	tristate "Silicon Integrated Systems Corp. SiS5595"
 	depends on PCI
@@ -785,16 +797,6 @@ config SENSORS_TMP401
 	  This driver can also be built as a module.  If so, the module
 	  will be called tmp401.
 
-config SENSORS_TMP421
-	tristate "Texas Instruments TMP421 and compatible"
-	depends on I2C && EXPERIMENTAL
-	help
-	  If you say yes here you get support for Texas Instruments TMP421,
-	  TMP422 and TMP423 temperature sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called tmp421.
-
 config SENSORS_VIA686A
 	tristate "VIA686A"
 	depends on PCI
@@ -918,27 +920,6 @@ config SENSORS_W83627EHF
 	  This driver can also be built as a module.  If so, the module
 	  will be called w83627ehf.
 
-config SENSORS_WM831X
-	tristate "WM831x PMICs"
-	depends on MFD_WM831X
-	help
-	  If you say yes here you get support for the hardware
-	  monitoring functionality of the Wolfson Microelectronics
-	  WM831x series of PMICs.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called wm831x-hwmon.
-
-config SENSORS_WM8350
-	tristate "Wolfson Microelectronics WM835x"
-	depends on MFD_WM8350
-	help
-	  If you say yes here you get support for the hardware
-	  monitoring features of the WM835x series of PMICs.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called wm8350-hwmon.
-
 config SENSORS_ULTRA45
 	tristate "Sun Ultra45 PIC16F747"
 	depends on SPARC64
@@ -966,6 +947,34 @@ config SENSORS_HDAPS
 	  Say Y here if you have an applicable laptop and want to experience
 	  the awesome power of hdaps.
 
+config SENSORS_LIS3LV02D
+	tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer"
+	depends on ACPI && INPUT
+	select INPUT_POLLDEV
+	select NEW_LEDS
+	select LEDS_CLASS
+	default n
+	help
+	  This driver provides support for the LIS3LV02Dx accelerometer. In
+	  particular, it can be found in a number of HP laptops, which have the
+	  "Mobile Data Protection System 3D" or "3D DriveGuard" feature. On such
+	  systems the driver should load automatically (via ACPI). The
+	  accelerometer might also be found in other systems, connected via SPI
+	  or I2C.  The accelerometer data is readable via
+	  /sys/devices/platform/lis3lv02d.
+
+	  This driver also provides an absolute input class device, allowing
+	  the laptop to act as a pinball machine-esque joystick. On HP laptops,
+	  if the led infrastructure is activated, support for a led indicating
+	  disk protection will be provided as hp:red:hddprotection.
+
+	  This driver can also be built as modules.  If so, the core module
+	  will be called lis3lv02d and a specific module for HP laptops will be
+	  called hp_accel.
+
+	  Say Y here if you have an applicable laptop and want to experience
+	  the awesome power of lis3lv02d.
+
 config SENSORS_LIS3_SPI
 	tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer (SPI)"
 	depends on !ACPI && SPI_MASTER && INPUT
@@ -1008,51 +1017,21 @@ config SENSORS_APPLESMC
 	  Say Y here if you have an applicable laptop and want to experience
 	  the awesome power of applesmc.
 
-if ACPI
-
-comment "ACPI drivers"
-
-config SENSORS_ATK0110
-	tristate "ASUS ATK0110"
-	depends on X86 && EXPERIMENTAL
-	help
-	  If you say yes here you get support for the ACPI hardware
-	  monitoring interface found in many ASUS motherboards. This
-	  driver will provide readings of fans, voltages and temperatures
-	  through the system firmware.
-
-	  This driver can also be built as a module. If so, the module
-	  will be called asus_atk0110.
+config SENSORS_HMC5843
+        tristate "HMC5843 Compass Sensor Driver"
+        depends on I2C && ARCH_MSM_SCORPION
+        default n
+        help
+          HMC5843 Compass Sensor Driver implemented by Quanta.
 
-config SENSORS_LIS3LV02D
-	tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer"
-	depends on INPUT
-	select INPUT_POLLDEV
-	select NEW_LEDS
-	select LEDS_CLASS
+config HWMON_DEBUG_CHIP
+	bool "Hardware Monitoring Chip debugging messages"
 	default n
 	help
-	  This driver provides support for the LIS3LV02Dx accelerometer. In
-	  particular, it can be found in a number of HP laptops, which have the
-	  "Mobile Data Protection System 3D" or "3D DriveGuard" feature. On such
-	  systems the driver should load automatically (via ACPI). The
-	  accelerometer might also be found in other systems, connected via SPI
-	  or I2C.  The accelerometer data is readable via
-	  /sys/devices/platform/lis3lv02d.
-
-	  This driver also provides an absolute input class device, allowing
-	  the laptop to act as a pinball machine-esque joystick. On HP laptops,
-	  if the led infrastructure is activated, support for a led indicating
-	  disk protection will be provided as hp:red:hddprotection.
-
-	  This driver can also be built as modules.  If so, the core module
-	  will be called lis3lv02d and a specific module for HP laptops will be
-	  called hp_accel.
-
-	  Say Y here if you have an applicable laptop and want to experience
-	  the awesome power of lis3lv02d.
-
-endif # ACPI
+	  Say Y here if you want the I2C chip drivers to produce a bunch of
+	  debug messages to the system log.  Select this if you are having
+	  a problem with I2C support and want to see more of what is going
+	  on.
 
 config SENSORS_ISL29011
         tristate "ISL29011 Light Sensor Driver"
@@ -1069,19 +1048,12 @@ config SENSORS_WPCE775X
 	  This driver provides support for the Winbond WPCE775XX Embedded
 	  Controller, which provides lcd backlight, LEDs, and Battery control.
 
-config SENSORS_HMC5843
-        tristate "HMC5843 Compass Sensor Driver"
-        depends on I2C && ARCH_MSM_SCORPION
-        default n
-        help
-          HMC5843 Compass Sensor Driver implemented by Quanta.
-
-config SENSORS_BOSCH_BMA150
-        tristate "SMB380/BMA150 acceleration sensor support"
-        depends on I2C
-        default n
+config SENSORS_NPCE781X
+  	tristate "NuvoTon WPCE775X"
+  	depends on I2C
+  	default n
         help
-          If you say yes here you get support for Bosch Sensortec's
-          acceleration sensors SMB380/BMA150.
+	  This driver provides support for the NuvoTon NPCE781X Embedded
+	  Controller, which provides lcd backlight, LEDs, and Battery control.
 
 endif # HWMON
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 5ba2984..9793344 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -5,10 +5,6 @@
 obj-$(CONFIG_HWMON)		+= hwmon.o
 obj-$(CONFIG_HWMON_VID)		+= hwmon-vid.o
 
-# APCI drivers
-obj-$(CONFIG_SENSORS_ATK0110)	+= asus_atk0110.o
-
-# Native drivers
 # asb100, then w83781d go first, as they can override other drivers' addresses.
 obj-$(CONFIG_SENSORS_ASB100)	+= asb100.o
 obj-$(CONFIG_SENSORS_W83627HF)	+= w83627hf.o
@@ -33,8 +29,10 @@ obj-$(CONFIG_SENSORS_ADT7462)	+= adt7462.o
 obj-$(CONFIG_SENSORS_ADT7470)	+= adt7470.o
 obj-$(CONFIG_SENSORS_ADT7473)	+= adt7473.o
 obj-$(CONFIG_SENSORS_ADT7475)	+= adt7475.o
+
 obj-$(CONFIG_SENSORS_APPLESMC)	+= applesmc.o
 obj-$(CONFIG_SENSORS_AMS)	+= ams/
+obj-$(CONFIG_SENSORS_ATK0110)	+= asus_atk0110.o
 obj-$(CONFIG_SENSORS_ATXP1)	+= atxp1.o
 obj-$(CONFIG_SENSORS_CORETEMP)	+= coretemp.o
 obj-$(CONFIG_SENSORS_DME1737)	+= dme1737.o
@@ -42,7 +40,9 @@ obj-$(CONFIG_SENSORS_DS1621)	+= ds1621.o
 obj-$(CONFIG_SENSORS_F71805F)	+= f71805f.o
 obj-$(CONFIG_SENSORS_F71882FG)	+= f71882fg.o
 obj-$(CONFIG_SENSORS_F75375S)	+= f75375s.o
+obj-$(CONFIG_SENSORS_FSCHER)	+= fscher.o
 obj-$(CONFIG_SENSORS_FSCHMD)	+= fschmd.o
+obj-$(CONFIG_SENSORS_FSCPOS)	+= fscpos.o
 obj-$(CONFIG_SENSORS_G760A)	+= g760a.o
 obj-$(CONFIG_SENSORS_GL518SM)	+= gl518sm.o
 obj-$(CONFIG_SENSORS_GL520SM)	+= gl520sm.o
@@ -76,7 +76,6 @@ obj-$(CONFIG_SENSORS_MAX6650)	+= max6650.o
 obj-$(CONFIG_SENSORS_PC87360)	+= pc87360.o
 obj-$(CONFIG_SENSORS_PC87427)	+= pc87427.o
 obj-$(CONFIG_SENSORS_PCF8591)	+= pcf8591.o
-obj-$(CONFIG_SENSORS_S3C)	+= s3c-hwmon.o
 obj-$(CONFIG_SENSORS_SHT15)	+= sht15.o
 obj-$(CONFIG_SENSORS_SIS5595)	+= sis5595.o
 obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
@@ -84,22 +83,17 @@ obj-$(CONFIG_SENSORS_SMSC47M1)	+= smsc47m1.o
 obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o
 obj-$(CONFIG_SENSORS_THMC50)	+= thmc50.o
 obj-$(CONFIG_SENSORS_TMP401)	+= tmp401.o
-obj-$(CONFIG_SENSORS_TMP421)	+= tmp421.o
 obj-$(CONFIG_SENSORS_VIA686A)	+= via686a.o
 obj-$(CONFIG_SENSORS_VT1211)	+= vt1211.o
 obj-$(CONFIG_SENSORS_VT8231)	+= vt8231.o
 obj-$(CONFIG_SENSORS_W83627EHF)	+= w83627ehf.o
 obj-$(CONFIG_SENSORS_W83L785TS)	+= w83l785ts.o
 obj-$(CONFIG_SENSORS_W83L786NG)	+= w83l786ng.o
-obj-$(CONFIG_SENSORS_WM831X)	+= wm831x-hwmon.o
-obj-$(CONFIG_SENSORS_WM8350)	+= wm8350-hwmon.o
 obj-$(CONFIG_SENSORS_ISL29011)  += isl29011.o
-obj-$(CONFIG_SENSORS_WPCE775X)  += wpce775x.o
-obj-$(CONFIG_SENSORS_BOSCH_BMA150)      += bma150.o
 obj-$(CONFIG_SENSORS_HMC5843)   += hmc5843.o
+obj-$(CONFIG_SENSORS_WPCE775X)  += wpce775x.o
+obj-$(CONFIG_SENSORS_NPCE781X)  += npce781x.o
 
 ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
 EXTRA_CFLAGS += -DDEBUG
 endif
-
-bma150-objs :=  bma150_driver.o smb380.o smb380calib.o
diff --git a/drivers/hwmon/npce781x.c b/drivers/hwmon/npce781x.c
new file mode 100755
index 0000000..bc6ff31
--- /dev/null
+++ b/drivers/hwmon/npce781x.c
@@ -0,0 +1,159 @@
+/* Quanta EC driver for the nuvoTon Embedded Controller 781L
+ *
+ * Company 2010 - Quanta Computer Inc @ Taiwan
+ * Author: Austin Lai <austin.lai@quantatw.com>
+ * Author: Hsin Wu <hsin.wu@quantatw.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+ /*
+ *  The Driver with I/O communication via the I2C interface.
+ *  And it is only working on the nuvoTon NPCE781L Embedded Controller.
+ */
+
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+
+#define EC_ID_NAME          "qci-i2cec"
+#define EC_BUFFER_LEN           16
+
+static struct i2c_client *g_i2cec_client;
+
+/* General structure to hold the driver data */
+struct i2cec_drv_data {
+                struct i2c_client *i2cec_client;
+                struct work_struct work;
+                char ec_data[EC_BUFFER_LEN+1];
+};
+
+static int __devinit npce_probe(struct i2c_client *client,
+        const struct i2c_device_id *id);
+static int __devexit npce_remove(struct i2c_client *kbd);
+
+ #ifdef CONFIG_PM
+static int npce_suspend(struct i2c_client *pad, pm_message_t mesg)
+{
+        return 0;
+}
+
+static int npce_resume(struct i2c_client *pad)
+{
+        return 0;
+}
+#else
+#define npce_suspend NULL
+#define npce_resume  NULL
+#endif
+
+static const struct i2c_device_id npce_idtable[] = {
+       { EC_ID_NAME, 0 },
+       { }
+};
+
+static struct i2c_driver npce_driver = {
+        .driver = {
+                .owner = THIS_MODULE,
+                .name  = EC_ID_NAME,
+        },
+        .probe    = npce_probe,
+        .remove   = __devexit_p(npce_remove),
+        .suspend   = npce_suspend,
+        .resume    = npce_resume,
+        .id_table   = npce_idtable,
+};
+
+static int __devinit npce_probe(struct i2c_client *client,
+                                    const struct i2c_device_id *id)
+{
+        int err = -ENOMEM;
+        struct i2cec_drv_data *context = 0;
+        client->driver = &npce_driver;
+        context = kzalloc(sizeof(struct i2cec_drv_data), GFP_KERNEL);
+        if (!context)
+                return err;
+
+        context->i2cec_client = client;
+        g_i2cec_client = client;
+        i2c_set_clientdata(context->i2cec_client, context);
+
+        return 0;
+}
+
+static int __devexit npce_remove(struct i2c_client *dev)
+{
+        struct i2cec_drv_data *context = i2c_get_clientdata(dev);
+        kfree(context);
+
+        return 0;
+}
+
+static int __init npce_init(void)
+{
+        return i2c_add_driver(&npce_driver);
+}
+
+static void __exit npce_exit(void)
+{
+        i2c_del_driver(&npce_driver);
+}
+
+struct i2c_client *npce_get_i2c_client(void)
+{
+        return g_i2cec_client;
+}
+EXPORT_SYMBOL_GPL(npce_get_i2c_client);
+
+int npce_i2c_transfer(struct i2c_msg *msg)
+{
+        msg->addr = g_i2cec_client->addr;
+        return i2c_transfer(g_i2cec_client->adapter, msg, 1);
+}
+EXPORT_SYMBOL_GPL(npce_i2c_transfer);
+
+int npce_set_ecram_index(u8 ecram)
+{
+        return i2c_smbus_write_byte(g_i2cec_client, ecram);
+}
+EXPORT_SYMBOL_GPL(npce_set_ecram_index);
+
+int npce_read_ecram(u8 ecram)
+{
+        i2c_smbus_write_byte(g_i2cec_client, ecram);
+        return i2c_smbus_read_byte(g_i2cec_client);
+}
+EXPORT_SYMBOL_GPL(npce_read_ecram);
+
+int npce_write_ecram_data(u8 ecram, u8 data)
+{
+        return i2c_smbus_write_byte_data(g_i2cec_client, ecram, data);
+}
+EXPORT_SYMBOL_GPL(npce_write_ecram_data);
+
+int npce_smbus_write_word_data(u8 command, u16 value)
+{
+        return i2c_smbus_write_word_data(g_i2cec_client, command, value);
+}
+EXPORT_SYMBOL_GPL(npce_smbus_write_word_data);
+
+int npce_smbus_write_byte_data(u8 command, u8 value)
+{
+        return i2c_smbus_write_byte_data(g_i2cec_client, command, value);
+}
+EXPORT_SYMBOL_GPL(npce_smbus_write_byte_data);
+
+module_init(npce_init);
+module_exit(npce_exit);
+
+MODULE_AUTHOR("Quanta Computer Inc.");
+MODULE_DESCRIPTION("Quanta Embedded Controller I2C Driver");
+MODULE_LICENSE("GPL v2");
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 26/36]  [Driver][Qualcomm 1070][EC_BL] New EC backlight driver porting
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (20 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 25/36] [Driver][Qualcomm 1070][EC_BRG] Adding new EC bridge driver Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 27/36] [Driver][Qualcomm 1070][EC_BRG] Enable NuvoTon WPCE775X driver and disable WinBond WPCE775X driver Wayne Lin
                   ` (9 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 drivers/leds/Kconfig              |   20 +++++-----
 drivers/leds/Makefile             |    1 +
 drivers/leds/leds-qci-backlight.c |   77 +++++++++++++++++++++++++++++++++++++
 drivers/leds/leds-qci-backlight.h |   34 ++++++++++++++++
 4 files changed, 122 insertions(+), 10 deletions(-)
 create mode 100755 drivers/leds/leds-qci-backlight.c
 create mode 100755 drivers/leds/leds-qci-backlight.h

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index e4f599f..7d29ec7 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -150,9 +150,9 @@ config LEDS_LP3944
 	tristate "LED Support for N.S. LP3944 (Fun Light) I2C chip"
 	depends on LEDS_CLASS && I2C
 	help
-	  This option enables support for LEDs connected to the National
-	  Semiconductor LP3944 Lighting Management Unit (LMU) also known as
-	  Fun Light Chip.
+    This option enables support for LEDs connected to the National
+    Semiconductor LP3944 Lighting Management Unit (LMU) also known as
+    Fun Light Chip.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called leds-lp3944.
@@ -195,13 +195,6 @@ config LEDS_PCA955X
 	  LED driver chips accessed via the I2C bus.  Supported
 	  devices include PCA9550, PCA9551, PCA9552, and PCA9553.
 
-config LEDS_WM831X_STATUS
-	tristate "LED support for status LEDs on WM831x PMICs"
-	depends on LEDS_CLASS && MFD_WM831X
-	help
-	  This option enables support for the status LEDs of the WM831x
-          series of PMICs.
-
 config LEDS_WM8350
 	tristate "LED Support for WM8350 AudioPlus PMIC"
 	depends on LEDS_CLASS && MFD_WM8350
@@ -236,6 +229,13 @@ config LEDS_BD2802
 	  This option enables support for BD2802GU RGB LED driver chips
 	  accessed via the I2C bus.
 
+config LEDS_QCIBL
+	tristate "LED Support for Quanta LCD backlight"
+	depends on SENSORS_NPCE781X
+	default n
+	help
+	  Say Y here if you want to use the Quanta backlight driver for ST 1.5 platform.
+
 comment "LED Triggers"
 
 config LEDS_TRIGGERS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 46d7270..a7a8df8 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_LEDS_DA903X)		+= leds-da903x.o
 obj-$(CONFIG_LEDS_WM831X_STATUS)	+= leds-wm831x-status.o
 obj-$(CONFIG_LEDS_WM8350)		+= leds-wm8350.o
 obj-$(CONFIG_LEDS_PWM)			+= leds-pwm.o
+obj-$(CONFIG_LEDS_QCIBL)		+= leds-qci-backlight.o
 
 # LED SPI Drivers
 obj-$(CONFIG_LEDS_DAC124S085)		+= leds-dac124s085.o
diff --git a/drivers/leds/leds-qci-backlight.c b/drivers/leds/leds-qci-backlight.c
new file mode 100755
index 0000000..d4b404d
--- /dev/null
+++ b/drivers/leds/leds-qci-backlight.c
@@ -0,0 +1,77 @@
+/*Quanta I2C Backlight Driver
+ *
+ * Copyright (C) 2009 Quanta Computer Inc.
+ * Author: Austin Lai <austin.lai@quantatw.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+/*
+ *
+ *  The Driver with I/O communications via the I2C Interface for ON2 of AP BU.
+ *  And it is only working on the nuvoTon WPCE775x Embedded Controller.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/leds.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+#include "leds-qci-backlight.h"
+
+static void qci_backlight_store(struct led_classdev *led_cdev,
+	enum led_brightness val);
+static int qci_backlight_show(struct led_classdev *led_cdev);
+
+static struct platform_device *bl_pdev;
+static struct led_classdev lcd_backlight = {
+	.name = "lcd-backlight",
+	.brightness = 147,
+	.brightness_get = qci_backlight_show,
+	.brightness_set = qci_backlight_store,
+};
+
+static int qci_backlight_show(struct led_classdev *led_cdev)
+{
+	return npce_read_ecram(EC_CMD_SET_BACKLIGHT);
+}
+
+static void qci_backlight_store(struct led_classdev *led_cdev,
+	enum led_brightness val)
+{
+	u16 value = val;
+	npce_smbus_write_word_data(EC_CMD_SET_BACKLIGHT, value);
+	mdelay(10);
+
+	pr_info("[backlight_store] : value  = %d\n", value);
+}
+
+static int __init qci_backlight_init(void)
+{
+	int err = 0;
+	bl_pdev = platform_device_register_simple("backlight", 0, NULL, 0);
+	err = led_classdev_register(&bl_pdev->dev, &lcd_backlight);
+	return err;
+}
+
+static void __exit qci_backlight_exit(void)
+{
+	led_classdev_unregister(&lcd_backlight);
+	platform_device_unregister(bl_pdev);
+}
+
+module_init(qci_backlight_init);
+module_exit(qci_backlight_exit);
+
+MODULE_AUTHOR("Quanta Computer Inc.");
+MODULE_DESCRIPTION("Quanta Embedded Controller I2C Touch Pad Driver");
+MODULE_LICENSE("GPL v2");
+
diff --git a/drivers/leds/leds-qci-backlight.h b/drivers/leds/leds-qci-backlight.h
new file mode 100755
index 0000000..b6ccfd5
--- /dev/null
+++ b/drivers/leds/leds-qci-backlight.h
@@ -0,0 +1,34 @@
+/* arm\mach-msm\include\mach\leds-qci-backlight.h
+ * Header file for Quanta lcd backlight Driver
+ *
+ * Copyright (C) 2009 Quanta Computer Inc.
+ * Author: Austin Lai <austin.lai@quantatw.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+  /*
+ *
+ *  The Driver with I/O communications via the I2C Interface for ON2 of AP BU.
+ *  And it is only working on the nuvoTon WPCE775x Embedded Controller.
+ *
+ */
+
+#ifndef __LEDS_QCI_BACKLIGHT_H__
+#define __LEDS_QCI_BACKLIGHT_H__
+
+//#define EC_CMD_SET_BACKLIGHT 0xB1
+#define EC_CMD_SET_BACKLIGHT 0xC4
+
+extern int npce_smbus_write_word_data(u8 command, u16 value);
+extern int npce_read_ecram(u8 ecram);
+
+#endif
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 27/36]  [Driver][Qualcomm 1070][EC_BRG] Enable NuvoTon WPCE775X driver and disable WinBond WPCE775X driver
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (21 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 26/36] [Driver][Qualcomm 1070][EC_BL] New EC backlight driver porting Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 28/36] [Driver][Qualcomm 1070][EC_BL] Enable QCI backlight driver Wayne Lin
                   ` (8 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/configs/qsd8650a-st1_5_defconfig |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/arch/arm/configs/qsd8650a-st1_5_defconfig b/arch/arm/configs/qsd8650a-st1_5_defconfig
index 18ab3c2..4f3006e 100644
--- a/arch/arm/configs/qsd8650a-st1_5_defconfig
+++ b/arch/arm/configs/qsd8650a-st1_5_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.32.9
-# Mon Jun  7 14:52:04 2010
+# Mon Jun 14 18:41:45 2010
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -993,14 +993,8 @@ CONFIG_POWER_SUPPLY=y
 # CONFIG_BATTERY_DS2782 is not set
 # CONFIG_BATTERY_BQ27x00 is not set
 # CONFIG_BATTERY_MAX17040 is not set
-CONFIG_BATTERY_QCIBAT=y
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
-# CONFIG_HWMON_DEBUG_CHIP is not set
-
-#
-# Native drivers
-#
 # CONFIG_SENSORS_AD7414 is not set
 # CONFIG_SENSORS_AD7418 is not set
 # CONFIG_SENSORS_ADCXX is not set
@@ -1052,7 +1046,6 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_ADS7828 is not set
 # CONFIG_SENSORS_THMC50 is not set
 # CONFIG_SENSORS_TMP401 is not set
-# CONFIG_SENSORS_TMP421 is not set
 # CONFIG_SENSORS_VT1211 is not set
 # CONFIG_SENSORS_W83781D is not set
 # CONFIG_SENSORS_W83791D is not set
@@ -1063,10 +1056,11 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_SENSORS_LIS3_SPI is not set
-CONFIG_SENSORS_ISL29011=y
-CONFIG_SENSORS_WPCE775X=y
 CONFIG_SENSORS_HMC5843=y
-CONFIG_SENSORS_BOSCH_BMA150=y
+# CONFIG_HWMON_DEBUG_CHIP is not set
+CONFIG_SENSORS_ISL29011=y
+# CONFIG_SENSORS_WPCE775X is not set
+CONFIG_SENSORS_NPCE781X=y
 # CONFIG_THERMAL is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_SSB_POSSIBLE=y
@@ -1604,6 +1598,7 @@ CONFIG_LEDS_CLASS=y
 # CONFIG_LEDS_PCA955X is not set
 # CONFIG_LEDS_DAC124S085 is not set
 # CONFIG_LEDS_BD2802 is not set
+# CONFIG_LEDS_QCIBL is not set
 
 #
 # LED Triggers
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 28/36]  [Driver][Qualcomm 1070][EC_BL] Enable QCI backlight driver
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (22 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 27/36] [Driver][Qualcomm 1070][EC_BRG] Enable NuvoTon WPCE775X driver and disable WinBond WPCE775X driver Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 29/36] [Driver][Qualcomm 1070][EC_BRG] Correct new EC bridge driver Makefile and Kconfig Wayne Lin
                   ` (7 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/configs/qsd8650a-st1_5_defconfig |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/qsd8650a-st1_5_defconfig b/arch/arm/configs/qsd8650a-st1_5_defconfig
index 4f3006e..df7cc18 100644
--- a/arch/arm/configs/qsd8650a-st1_5_defconfig
+++ b/arch/arm/configs/qsd8650a-st1_5_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.32.9
-# Mon Jun 14 18:41:45 2010
+# Mon Jun 14 18:42:30 2010
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -1598,7 +1598,7 @@ CONFIG_LEDS_CLASS=y
 # CONFIG_LEDS_PCA955X is not set
 # CONFIG_LEDS_DAC124S085 is not set
 # CONFIG_LEDS_BD2802 is not set
-# CONFIG_LEDS_QCIBL is not set
+CONFIG_LEDS_QCIBL=y
 
 #
 # LED Triggers
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 29/36]  [Driver][Qualcomm 1070][EC_BRG] Correct new EC bridge driver Makefile and Kconfig
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (23 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 28/36] [Driver][Qualcomm 1070][EC_BL] Enable QCI backlight driver Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 30/36] [Driver][Qualcomm 1070][EC_G_SENSOR] Enable EC gravitation sensor Wayne Lin
                   ` (6 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 drivers/hwmon/Kconfig  |  214 ++++++++++++++++++++++++++++--------------------
 drivers/hwmon/Makefile |   17 +++-
 2 files changed, 137 insertions(+), 94 deletions(-)

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index f0c6d0f..3c46d75 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -28,6 +28,17 @@ config HWMON_VID
 	tristate
 	default n
 
+config HWMON_DEBUG_CHIP
+	bool "Hardware Monitoring Chip debugging messages"
+	default n
+	help
+	  Say Y here if you want the I2C chip drivers to produce a bunch of
+	  debug messages to the system log.  Select this if you are having
+	  a problem with I2C support and want to see more of what is going
+	  on.
+
+comment "Native drivers"
+
 config SENSORS_ABITUGURU
 	tristate "Abit uGuru (rev 1 & 2)"
 	depends on X86 && EXPERIMENTAL
@@ -248,18 +259,6 @@ config SENSORS_ASB100
 	  This driver can also be built as a module.  If so, the module
 	  will be called asb100.
 
-config SENSORS_ATK0110
-	tristate "ASUS ATK0110 ACPI hwmon"
-	depends on X86 && ACPI && EXPERIMENTAL
-	help
-	  If you say yes here you get support for the ACPI hardware
-	  monitoring interface found in many ASUS motherboards. This
-	  driver will provide readings of fans, voltages and temperatures
-	  through the system firmware.
-
-	  This driver can also be built as a module. If so, the module
-	  will be called asus_atk0110.
-
 config SENSORS_ATXP1
 	tristate "Attansic ATXP1 VID controller"
 	depends on I2C && EXPERIMENTAL
@@ -326,34 +325,6 @@ config SENSORS_F75375S
 	  This driver can also be built as a module.  If so, the module
 	  will be called f75375s.
 
-config SENSORS_FSCHER
-	tristate "FSC Hermes (DEPRECATED)"
-	depends on X86 && I2C
-	help
-	  This driver is DEPRECATED please use the new merged fschmd
-	  ("FSC Poseidon, Scylla, Hermes, Heimdall and Heracles") driver
-	  instead.
-
-	  If you say yes here you get support for Fujitsu Siemens
-	  Computers Hermes sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called fscher.
-
-config SENSORS_FSCPOS
-	tristate "FSC Poseidon (DEPRECATED)"
-	depends on X86 && I2C
-	help
-	  This driver is DEPRECATED please use the new merged fschmd
-	  ("FSC Poseidon, Scylla, Hermes, Heimdall and Heracles") driver
-	  instead.
-
-	  If you say yes here you get support for Fujitsu Siemens
-	  Computers Poseidon sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called fscpos.
-
 config SENSORS_FSCHMD
 	tristate "Fujitsu Siemens Computers sensor chips"
 	depends on X86 && I2C
@@ -402,12 +373,12 @@ config SENSORS_GL520SM
 	  will be called gl520sm.
 
 config SENSORS_CORETEMP
-	tristate "Intel Core (2) Duo/Solo temperature sensor"
-	depends on X86 && EXPERIMENTAL
+	tristate "Intel Core/Core2/Atom temperature sensor"
+	depends on X86 && PCI && EXPERIMENTAL
 	help
 	  If you say yes here you get support for the temperature
-	  sensor inside your CPU. Supported all are all known variants
-	  of Intel Core family.
+	  sensor inside your CPU. Most of the family 6 CPUs
+	  are supported. Check documentation/driver for details.
 
 config SENSORS_IBMAEM
 	tristate "IBM Active Energy Manager temperature/power sensors and control"
@@ -702,6 +673,23 @@ config SENSORS_SHT15
 	  This driver can also be built as a module.  If so, the module
 	  will be called sht15.
 
+config SENSORS_S3C
+	tristate "S3C24XX/S3C64XX Inbuilt ADC"
+	depends on ARCH_S3C2410
+	help
+	  If you say yes here you get support for the on-board ADCs of
+	  the Samsung S3C24XX or S3C64XX series of SoC
+
+	  This driver can also be built as a module. If so, the module
+	  will be called s3c-hwmo.
+
+config SENSORS_S3C_RAW
+	bool "Include raw channel attributes in sysfs"
+	depends on SENSORS_S3C
+	help
+	  Say Y here if you want to include raw copies of all the ADC
+	  channels in sysfs.
+
 config SENSORS_SIS5595
 	tristate "Silicon Integrated Systems Corp. SiS5595"
 	depends on PCI
@@ -797,6 +785,16 @@ config SENSORS_TMP401
 	  This driver can also be built as a module.  If so, the module
 	  will be called tmp401.
 
+config SENSORS_TMP421
+	tristate "Texas Instruments TMP421 and compatible"
+	depends on I2C && EXPERIMENTAL
+	help
+	  If you say yes here you get support for Texas Instruments TMP421,
+	  TMP422 and TMP423 temperature sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called tmp421.
+
 config SENSORS_VIA686A
 	tristate "VIA686A"
 	depends on PCI
@@ -920,6 +918,27 @@ config SENSORS_W83627EHF
 	  This driver can also be built as a module.  If so, the module
 	  will be called w83627ehf.
 
+config SENSORS_WM831X
+	tristate "WM831x PMICs"
+	depends on MFD_WM831X
+	help
+	  If you say yes here you get support for the hardware
+	  monitoring functionality of the Wolfson Microelectronics
+	  WM831x series of PMICs.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called wm831x-hwmon.
+
+config SENSORS_WM8350
+	tristate "Wolfson Microelectronics WM835x"
+	depends on MFD_WM8350
+	help
+	  If you say yes here you get support for the hardware
+	  monitoring features of the WM835x series of PMICs.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called wm8350-hwmon.
+
 config SENSORS_ULTRA45
 	tristate "Sun Ultra45 PIC16F747"
 	depends on SPARC64
@@ -947,34 +966,6 @@ config SENSORS_HDAPS
 	  Say Y here if you have an applicable laptop and want to experience
 	  the awesome power of hdaps.
 
-config SENSORS_LIS3LV02D
-	tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer"
-	depends on ACPI && INPUT
-	select INPUT_POLLDEV
-	select NEW_LEDS
-	select LEDS_CLASS
-	default n
-	help
-	  This driver provides support for the LIS3LV02Dx accelerometer. In
-	  particular, it can be found in a number of HP laptops, which have the
-	  "Mobile Data Protection System 3D" or "3D DriveGuard" feature. On such
-	  systems the driver should load automatically (via ACPI). The
-	  accelerometer might also be found in other systems, connected via SPI
-	  or I2C.  The accelerometer data is readable via
-	  /sys/devices/platform/lis3lv02d.
-
-	  This driver also provides an absolute input class device, allowing
-	  the laptop to act as a pinball machine-esque joystick. On HP laptops,
-	  if the led infrastructure is activated, support for a led indicating
-	  disk protection will be provided as hp:red:hddprotection.
-
-	  This driver can also be built as modules.  If so, the core module
-	  will be called lis3lv02d and a specific module for HP laptops will be
-	  called hp_accel.
-
-	  Say Y here if you have an applicable laptop and want to experience
-	  the awesome power of lis3lv02d.
-
 config SENSORS_LIS3_SPI
 	tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer (SPI)"
 	depends on !ACPI && SPI_MASTER && INPUT
@@ -1017,21 +1008,51 @@ config SENSORS_APPLESMC
 	  Say Y here if you have an applicable laptop and want to experience
 	  the awesome power of applesmc.
 
-config SENSORS_HMC5843
-        tristate "HMC5843 Compass Sensor Driver"
-        depends on I2C && ARCH_MSM_SCORPION
-        default n
-        help
-          HMC5843 Compass Sensor Driver implemented by Quanta.
+if ACPI
 
-config HWMON_DEBUG_CHIP
-	bool "Hardware Monitoring Chip debugging messages"
+comment "ACPI drivers"
+
+config SENSORS_ATK0110
+	tristate "ASUS ATK0110"
+	depends on X86 && EXPERIMENTAL
+	help
+	  If you say yes here you get support for the ACPI hardware
+	  monitoring interface found in many ASUS motherboards. This
+	  driver will provide readings of fans, voltages and temperatures
+	  through the system firmware.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called asus_atk0110.
+
+config SENSORS_LIS3LV02D
+	tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer"
+	depends on INPUT
+	select INPUT_POLLDEV
+	select NEW_LEDS
+	select LEDS_CLASS
 	default n
 	help
-	  Say Y here if you want the I2C chip drivers to produce a bunch of
-	  debug messages to the system log.  Select this if you are having
-	  a problem with I2C support and want to see more of what is going
-	  on.
+	  This driver provides support for the LIS3LV02Dx accelerometer. In
+	  particular, it can be found in a number of HP laptops, which have the
+	  "Mobile Data Protection System 3D" or "3D DriveGuard" feature. On such
+	  systems the driver should load automatically (via ACPI). The
+	  accelerometer might also be found in other systems, connected via SPI
+	  or I2C.  The accelerometer data is readable via
+	  /sys/devices/platform/lis3lv02d.
+
+	  This driver also provides an absolute input class device, allowing
+	  the laptop to act as a pinball machine-esque joystick. On HP laptops,
+	  if the led infrastructure is activated, support for a led indicating
+	  disk protection will be provided as hp:red:hddprotection.
+
+	  This driver can also be built as modules.  If so, the core module
+	  will be called lis3lv02d and a specific module for HP laptops will be
+	  called hp_accel.
+
+	  Say Y here if you have an applicable laptop and want to experience
+	  the awesome power of lis3lv02d.
+
+endif # ACPI
 
 config SENSORS_ISL29011
         tristate "ISL29011 Light Sensor Driver"
@@ -1048,12 +1069,27 @@ config SENSORS_WPCE775X
 	  This driver provides support for the Winbond WPCE775XX Embedded
 	  Controller, which provides lcd backlight, LEDs, and Battery control.
 
+config SENSORS_HMC5843
+        tristate "HMC5843 Compass Sensor Driver"
+        depends on I2C && ARCH_MSM_SCORPION
+        default n
+        help
+          HMC5843 Compass Sensor Driver implemented by Quanta.
+
+config SENSORS_BOSCH_BMA150
+        tristate "SMB380/BMA150 acceleration sensor support"
+        depends on I2C
+        default n
+        help
+          If you say yes here you get support for Bosch Sensortec's
+          acceleration sensors SMB380/BMA150.
+
 config SENSORS_NPCE781X
-  	tristate "NuvoTon WPCE775X"
-  	depends on I2C
-  	default n
+        tristate "NuvoTon WPCE775X"
+        depends on I2C
+        default n
         help
-	  This driver provides support for the NuvoTon NPCE781X Embedded
-	  Controller, which provides lcd backlight, LEDs, and Battery control.
+          This driver provides support for the NuvoTon NPCE781X Embedded
+          Controller, which provides lcd backlight, LEDs, and Battery control.
 
 endif # HWMON
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 9793344..cdcd166 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -5,6 +5,10 @@
 obj-$(CONFIG_HWMON)		+= hwmon.o
 obj-$(CONFIG_HWMON_VID)		+= hwmon-vid.o
 
+# APCI drivers
+obj-$(CONFIG_SENSORS_ATK0110)	+= asus_atk0110.o
+
+# Native drivers
 # asb100, then w83781d go first, as they can override other drivers' addresses.
 obj-$(CONFIG_SENSORS_ASB100)	+= asb100.o
 obj-$(CONFIG_SENSORS_W83627HF)	+= w83627hf.o
@@ -29,10 +33,8 @@ obj-$(CONFIG_SENSORS_ADT7462)	+= adt7462.o
 obj-$(CONFIG_SENSORS_ADT7470)	+= adt7470.o
 obj-$(CONFIG_SENSORS_ADT7473)	+= adt7473.o
 obj-$(CONFIG_SENSORS_ADT7475)	+= adt7475.o
-
 obj-$(CONFIG_SENSORS_APPLESMC)	+= applesmc.o
 obj-$(CONFIG_SENSORS_AMS)	+= ams/
-obj-$(CONFIG_SENSORS_ATK0110)	+= asus_atk0110.o
 obj-$(CONFIG_SENSORS_ATXP1)	+= atxp1.o
 obj-$(CONFIG_SENSORS_CORETEMP)	+= coretemp.o
 obj-$(CONFIG_SENSORS_DME1737)	+= dme1737.o
@@ -40,9 +42,7 @@ obj-$(CONFIG_SENSORS_DS1621)	+= ds1621.o
 obj-$(CONFIG_SENSORS_F71805F)	+= f71805f.o
 obj-$(CONFIG_SENSORS_F71882FG)	+= f71882fg.o
 obj-$(CONFIG_SENSORS_F75375S)	+= f75375s.o
-obj-$(CONFIG_SENSORS_FSCHER)	+= fscher.o
 obj-$(CONFIG_SENSORS_FSCHMD)	+= fschmd.o
-obj-$(CONFIG_SENSORS_FSCPOS)	+= fscpos.o
 obj-$(CONFIG_SENSORS_G760A)	+= g760a.o
 obj-$(CONFIG_SENSORS_GL518SM)	+= gl518sm.o
 obj-$(CONFIG_SENSORS_GL520SM)	+= gl520sm.o
@@ -76,6 +76,7 @@ obj-$(CONFIG_SENSORS_MAX6650)	+= max6650.o
 obj-$(CONFIG_SENSORS_PC87360)	+= pc87360.o
 obj-$(CONFIG_SENSORS_PC87427)	+= pc87427.o
 obj-$(CONFIG_SENSORS_PCF8591)	+= pcf8591.o
+obj-$(CONFIG_SENSORS_S3C)	+= s3c-hwmon.o
 obj-$(CONFIG_SENSORS_SHT15)	+= sht15.o
 obj-$(CONFIG_SENSORS_SIS5595)	+= sis5595.o
 obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
@@ -83,17 +84,23 @@ obj-$(CONFIG_SENSORS_SMSC47M1)	+= smsc47m1.o
 obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o
 obj-$(CONFIG_SENSORS_THMC50)	+= thmc50.o
 obj-$(CONFIG_SENSORS_TMP401)	+= tmp401.o
+obj-$(CONFIG_SENSORS_TMP421)	+= tmp421.o
 obj-$(CONFIG_SENSORS_VIA686A)	+= via686a.o
 obj-$(CONFIG_SENSORS_VT1211)	+= vt1211.o
 obj-$(CONFIG_SENSORS_VT8231)	+= vt8231.o
 obj-$(CONFIG_SENSORS_W83627EHF)	+= w83627ehf.o
 obj-$(CONFIG_SENSORS_W83L785TS)	+= w83l785ts.o
 obj-$(CONFIG_SENSORS_W83L786NG)	+= w83l786ng.o
+obj-$(CONFIG_SENSORS_WM831X)	+= wm831x-hwmon.o
+obj-$(CONFIG_SENSORS_WM8350)	+= wm8350-hwmon.o
 obj-$(CONFIG_SENSORS_ISL29011)  += isl29011.o
-obj-$(CONFIG_SENSORS_HMC5843)   += hmc5843.o
 obj-$(CONFIG_SENSORS_WPCE775X)  += wpce775x.o
 obj-$(CONFIG_SENSORS_NPCE781X)  += npce781x.o
+obj-$(CONFIG_SENSORS_BOSCH_BMA150)      += bma150.o
+obj-$(CONFIG_SENSORS_HMC5843)   += hmc5843.o
 
 ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
 EXTRA_CFLAGS += -DDEBUG
 endif
+
+bma150-objs :=  bma150_driver.o smb380.o smb380calib.o
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 30/36]  [Driver][Qualcomm 1070][EC_G_SENSOR] Enable EC gravitation sensor
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (24 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 29/36] [Driver][Qualcomm 1070][EC_BRG] Correct new EC bridge driver Makefile and Kconfig Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 31/36] [Driver][Qualcomm 1070][VERSION] 0.1.1 Wayne Lin
                   ` (5 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/configs/qsd8650a-st1_5_defconfig |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm/configs/qsd8650a-st1_5_defconfig b/arch/arm/configs/qsd8650a-st1_5_defconfig
index df7cc18..f82653b 100644
--- a/arch/arm/configs/qsd8650a-st1_5_defconfig
+++ b/arch/arm/configs/qsd8650a-st1_5_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.32.9
-# Mon Jun 14 18:42:30 2010
+# Tue Jun 15 17:30:06 2010
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -995,6 +995,11 @@ CONFIG_POWER_SUPPLY=y
 # CONFIG_BATTERY_MAX17040 is not set
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Native drivers
+#
 # CONFIG_SENSORS_AD7414 is not set
 # CONFIG_SENSORS_AD7418 is not set
 # CONFIG_SENSORS_ADCXX is not set
@@ -1046,6 +1051,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_ADS7828 is not set
 # CONFIG_SENSORS_THMC50 is not set
 # CONFIG_SENSORS_TMP401 is not set
+# CONFIG_SENSORS_TMP421 is not set
 # CONFIG_SENSORS_VT1211 is not set
 # CONFIG_SENSORS_W83781D is not set
 # CONFIG_SENSORS_W83791D is not set
@@ -1056,10 +1062,10 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_SENSORS_LIS3_SPI is not set
-CONFIG_SENSORS_HMC5843=y
-# CONFIG_HWMON_DEBUG_CHIP is not set
 CONFIG_SENSORS_ISL29011=y
 # CONFIG_SENSORS_WPCE775X is not set
+CONFIG_SENSORS_HMC5843=y
+CONFIG_SENSORS_BOSCH_BMA150=y
 CONFIG_SENSORS_NPCE781X=y
 # CONFIG_THERMAL is not set
 # CONFIG_WATCHDOG is not set
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 31/36]  [Driver][Qualcomm 1070][VERSION] 0.1.1
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (25 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 30/36] [Driver][Qualcomm 1070][EC_G_SENSOR] Enable EC gravitation sensor Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 32/36] [Driver][Qualcomm 1070][MMC] Enable MMC1 HW detection Wayne Lin
                   ` (4 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/mach-msm/version.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-msm/version.c b/arch/arm/mach-msm/version.c
index c683fe1..a594164 100755
--- a/arch/arm/mach-msm/version.c
+++ b/arch/arm/mach-msm/version.c
@@ -12,7 +12,7 @@
 #include "smd_private.h"
 
 #define KERNEL_VERSION UTS_RELEASE
-#define IMAGE_VERSION "0.1.0"
+#define IMAGE_VERSION "0.1.1"
 
 static int version_proc_show(struct seq_file *m, void *v)
 {
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 32/36]  [Driver][Qualcomm 1070][MMC] Enable MMC1 HW detection
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (26 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 31/36] [Driver][Qualcomm 1070][VERSION] 0.1.1 Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 33/36] [Driver][Qualcomm 1070][VERSION] 0.1.2 Wayne Lin
                   ` (3 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/configs/qsd8650a-st1_5_defconfig |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/qsd8650a-st1_5_defconfig b/arch/arm/configs/qsd8650a-st1_5_defconfig
index f82653b..fccad74 100644
--- a/arch/arm/configs/qsd8650a-st1_5_defconfig
+++ b/arch/arm/configs/qsd8650a-st1_5_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.32.9
-# Tue Jun 15 17:30:06 2010
+# Mon Jun 28 14:46:18 2010
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -1579,7 +1579,7 @@ CONFIG_MMC_BLOCK_PARANOID_RESUME=y
 CONFIG_MMC_MSM=y
 # CONFIG_MMC_MSM7X00A_RESUME_IN_WQ is not set
 # CONFIG_MMC_MSM_SDIO_SUPPORT is not set
-# CONFIG_MMC_MSM_CARD_HW_DETECTION is not set
+CONFIG_MMC_MSM_CARD_HW_DETECTION=y
 CONFIG_MMC_MSM_SDC1_SUPPORT=y
 # CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT is not set
 # CONFIG_MMC_MSM_SDC1_DUMMY52_REQUIRED is not set
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 33/36]  [Driver][Qualcomm 1070][VERSION] 0.1.2
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (27 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 32/36] [Driver][Qualcomm 1070][MMC] Enable MMC1 HW detection Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 34/36] [Driver][Qualcomm 1070][EC_BAT] Adding newer version battery driver Wayne Lin
                   ` (2 subsequent siblings)
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/mach-msm/version.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-msm/version.c b/arch/arm/mach-msm/version.c
index a594164..f665d9f 100755
--- a/arch/arm/mach-msm/version.c
+++ b/arch/arm/mach-msm/version.c
@@ -12,7 +12,7 @@
 #include "smd_private.h"
 
 #define KERNEL_VERSION UTS_RELEASE
-#define IMAGE_VERSION "0.1.1"
+#define IMAGE_VERSION "0.1.2"
 
 static int version_proc_show(struct seq_file *m, void *v)
 {
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 34/36]  [Driver][Qualcomm 1070][EC_BAT] Adding newer version battery driver
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (28 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 33/36] [Driver][Qualcomm 1070][VERSION] 0.1.2 Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 35/36] [Driver][Qualcomm 1070][EC_BAT] Enable EC battery Wayne Lin
  2010-07-26  8:30 ` [RFC 36/36] [Driver][Qualcomm 1070][VERSION] 0.2.0 Wayne Lin
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 drivers/power/Kconfig       |    2 +-
 drivers/power/qci_battery.c |  681 +++++++++++++++++++++----------------------
 drivers/power/qci_battery.h |  128 +++++----
 3 files changed, 393 insertions(+), 418 deletions(-)

diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index c837ba8..c1b21d2 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -112,7 +112,7 @@ config CHARGER_PCF50633
 
 config BATTERY_QCIBAT
 	tristate "Quanta Computer Inc. Battery"
-	depends on SENSORS_WPCE775X && ARCH_MSM_SCORPION
+	depends on SENSORS_NPCE781X && ARCH_MSM_SCORPION
 	default n
 	help
 	 Say Y here if you want to use the Quanta battery driver for ST15
diff --git a/drivers/power/qci_battery.c b/drivers/power/qci_battery.c
index 593d720..2d1f052 100644
--- a/drivers/power/qci_battery.c
+++ b/drivers/power/qci_battery.c
@@ -1,356 +1,325 @@
-/* Quanta I2C Battery Driver
- *
- * Copyright (C) 2009 Quanta Computer Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-/*
- *
- *  The Driver with I/O communications via the I2C Interface for ST15 platform.
- *  And it is only working on the nuvoTon WPCE775x Embedded Controller.
- *
- */
-
-#include <linux/module.h>
-#include <linux/err.h>
-#include <linux/platform_device.h>
-#include <linux/power_supply.h>
-#include <linux/sched.h>
-#include <linux/gpio.h>
-#include <linux/i2c.h>
-#include <linux/wpce775x.h>
-
-#include "qci_battery.h"
-
-struct qci_bat_info {
-	u8 type_id;
-	u8 power_flag;
-	u8 ec_ver_lsb;
-	u8 ec_ver_msb;
-	u8 mbat_rsoc;
-	u8 mbat_volt_lsb;
-	u8 mbat_volt_msb;
-	u8 mbat_status;
-	u8 mbchg_status;
-	u8 mbat_temp_lsb;
-	u8 mbat_temp_msb;
-};
-
-/* General structure to hold the driver data */
-struct i2cbat_drv_data {
-	struct i2c_client *bi2c_client;
-	struct work_struct work;
-	char batt_data[I2C_BAT_BUFFER_LEN+1];
-	unsigned int qcibat_irq;
-	unsigned int qcibat_gpio;
-	struct qci_bat_info bif;
-};
-
-static struct i2cbat_drv_data context;
-/*********************************************************************
- *		Power
- *********************************************************************/
-
-static int qci_ac_get_prop(struct power_supply *psy,
-			    enum power_supply_property psp,
-			    union power_supply_propval *val)
-{
-	int ret = 0;
-	switch (psp) {
-	case POWER_SUPPLY_PROP_ONLINE:
-		if (context.bif.power_flag & EC_FLAG_ADAPTER_IN)
-			val->intval =  EC_ADAPTER_PRESENT;
-		else
-			val->intval =  EC_ADAPTER_NOT_PRESENT;
-	break;
-	default:
-		ret = -EINVAL;
-	break;
-	}
-	return ret;
-}
-
-static enum power_supply_property qci_ac_props[] = {
-	POWER_SUPPLY_PROP_ONLINE,
-};
-
-static enum power_supply_property qci_bat_props[] = {
-	POWER_SUPPLY_PROP_STATUS,
-	POWER_SUPPLY_PROP_PRESENT,
-	POWER_SUPPLY_PROP_HEALTH,
-	POWER_SUPPLY_PROP_TECHNOLOGY,
-	POWER_SUPPLY_PROP_VOLTAGE_AVG,
-	POWER_SUPPLY_PROP_CURRENT_AVG,
-	POWER_SUPPLY_PROP_CAPACITY,
-	POWER_SUPPLY_PROP_TEMP,
-	POWER_SUPPLY_PROP_TEMP_AMBIENT,
-	POWER_SUPPLY_PROP_MANUFACTURER,
-	POWER_SUPPLY_PROP_SERIAL_NUMBER,
-	POWER_SUPPLY_PROP_CHARGE_COUNTER,
-};
-
-static int qbat_get_status(union power_supply_propval *val)
-{
-	if ((context.bif.mbat_status & MAIN_BATTERY_STATUS_BAT_IN) == 0x0)
-		val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
-	else if (context.bif.mbchg_status & CHG_STATUS_BAT_INCHARGE)
-		val->intval = POWER_SUPPLY_STATUS_CHARGING;
-	else if (context.bif.mbat_status & MAIN_BATTERY_STATUS_BAT_FULL)
-		val->intval = POWER_SUPPLY_STATUS_FULL;
-	else
-		val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
-
-	return 0;
-}
-
-static int qbat_get_present(union power_supply_propval *val)
-{
-	if (context.bif.mbat_status & MAIN_BATTERY_STATUS_BAT_IN)
-		val->intval = EC_BAT_PRESENT;
-	else
-		val->intval = EC_BAT_NOT_PRESENT;
-	return 0;
-}
-
-static int qbat_get_health(union power_supply_propval *val)
-{
-	if ((context.bif.mbat_status & MAIN_BATTERY_STATUS_BAT_IN) == 0x0)
-		val->intval = POWER_SUPPLY_HEALTH_UNKNOWN;
-	else
-		val->intval = POWER_SUPPLY_HEALTH_GOOD;
-	return 0;
-}
-
-static int qbat_get_voltage_avg(union power_supply_propval *val)
-{
-	val->intval = (context.bif.mbat_volt_msb << 8 |
-		       context.bif.mbat_volt_lsb);
-	return 0;
-}
-
-static int qbat_get_capacity(union power_supply_propval *val)
-{
-	if ((context.bif.mbat_status & MAIN_BATTERY_STATUS_BAT_IN) == 0x0)
-		val->intval = 0xFF;
-	else
-		val->intval = context.bif.mbat_rsoc;
-	return 0;
-}
-
-static int qbat_get_temp_avg(union power_supply_propval *val)
-{
-	if ((context.bif.mbat_status & MAIN_BATTERY_STATUS_BAT_IN) == 0x0)
-		val->intval = 0xFFFF;
-	else
-		val->intval = ((context.bif.mbat_temp_msb << 8) |
-			       context.bif.mbat_temp_lsb) - 2731;
-	return 0;
-}
-
-static int qbat_get_mfr(union power_supply_propval *val)
-{
-	val->strval = "Unknown";
-	return 0;
-}
-
-static int qbat_get_tech(union power_supply_propval *val)
-{
-	if ((context.bif.mbat_status & MAIN_BATTERY_STATUS_BAT_IN) == 0x0)
-		val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
-	else
-		val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
-	return 0;
-}
-
-/*********************************************************************
- *		Battery properties
- *********************************************************************/
-static int qbat_get_property(struct power_supply *psy,
-			     enum power_supply_property psp,
-			     union power_supply_propval *val)
-{
-	int ret = 0;
-	switch (psp) {
-	case POWER_SUPPLY_PROP_STATUS:
-		ret = qbat_get_status(val);
-		break;
-	case POWER_SUPPLY_PROP_PRESENT:
-		ret = qbat_get_present(val);
-		break;
-	case POWER_SUPPLY_PROP_HEALTH:
-		ret = qbat_get_health(val);
-		break;
-	case POWER_SUPPLY_PROP_MANUFACTURER:
-		ret = qbat_get_mfr(val);
-		break;
-	case POWER_SUPPLY_PROP_TECHNOLOGY:
-		ret = qbat_get_tech(val);
-		break;
-	case POWER_SUPPLY_PROP_VOLTAGE_AVG:
-		ret = qbat_get_voltage_avg(val);
-		break;
-	case POWER_SUPPLY_PROP_CURRENT_AVG:
-		break;
-	case POWER_SUPPLY_PROP_CAPACITY:
-		ret = qbat_get_capacity(val);
-		break;
-	case POWER_SUPPLY_PROP_TEMP:
-		ret = qbat_get_temp_avg(val);
-		break;
-	case POWER_SUPPLY_PROP_TEMP_AMBIENT:
-		ret = qbat_get_temp_avg(val);
-		break;
-	case POWER_SUPPLY_PROP_CHARGE_COUNTER:
-		break;
-	case POWER_SUPPLY_PROP_SERIAL_NUMBER:
-		break;
-	default:
-		ret = -EINVAL;
-		break;
-	}
-
-	return ret;
-}
-
-/*********************************************************************
- *		Initialisation
- *********************************************************************/
-
-static struct power_supply qci_ac = {
-	.name = "ac",
-	.type = POWER_SUPPLY_TYPE_MAINS,
-	.properties = qci_ac_props,
-	.num_properties = ARRAY_SIZE(qci_ac_props),
-	.get_property = qci_ac_get_prop,
-};
-
-static struct power_supply qci_bat = {
-	.name = "battery",
-	.type = POWER_SUPPLY_TYPE_BATTERY,
-	.properties = qci_bat_props,
-	.num_properties = ARRAY_SIZE(qci_bat_props),
-	.get_property = qbat_get_property,
-	.use_for_apm = 1,
-};
-
-static irqreturn_t qbat_interrupt(int irq, void *dev_id)
-{
-	struct i2cbat_drv_data *ibat_drv_data = dev_id;
-	schedule_work(&ibat_drv_data->work);
-	return IRQ_HANDLED;
-}
-
-static int qci_get_bat_info(struct i2c_client *client, char *ec_data)
-{
-	struct i2c_msg bat_msg;
-	bat_msg.addr = client->addr;
-	bat_msg.flags = I2C_M_RD;
-	bat_msg.len = I2C_BAT_BUFFER_LEN;
-	bat_msg.buf = ec_data;
-	return i2c_transfer(client->adapter, &bat_msg, 1);
-}
-
-static void qbat_work(struct work_struct *_work)
-{
-	struct i2cbat_drv_data *ibat_drv_data =
-		container_of(_work, struct i2cbat_drv_data, work);
-	struct i2c_client *ibatclient = ibat_drv_data->bi2c_client;
-
-	qci_get_bat_info(ibatclient, ibat_drv_data->batt_data);
-	memcpy(&context.bif,
-	       ibat_drv_data->batt_data,
-	       sizeof(struct qci_bat_info));
-	power_supply_changed(&qci_ac);
-	power_supply_changed(&qci_bat);
-}
-
-static struct platform_device *bat_pdev;
-
-static int __init qbat_init(void)
-{
-	int err = 0;
-
-	context.bi2c_client = wpce_get_i2c_client();
-	if (context.bi2c_client == NULL)
-		return -1;
-
-	i2c_set_clientdata(context.bi2c_client, &context);
-	context.qcibat_gpio = context.bi2c_client->irq;
-
-	/*battery device register*/
-	bat_pdev = platform_device_register_simple("battery", 0, NULL, 0);
-	if (IS_ERR(bat_pdev))
-		return PTR_ERR(bat_pdev);
-
-	err = power_supply_register(&bat_pdev->dev, &qci_ac);
-	if (err)
-		goto ac_failed;
-
-	qci_bat.name = bat_pdev->name;
-	err = power_supply_register(&bat_pdev->dev, &qci_bat);
-	if (err)
-		goto battery_failed;
-
-	/*battery irq configure*/
-	INIT_WORK(&context.work, qbat_work);
-	err = gpio_request(context.qcibat_gpio, "qci-bat");
-	if (err) {
-		dev_err(&context.bi2c_client->dev,
-			"[BAT] err gpio request\n");
-		goto gpio_request_fail;
-	}
-	context.qcibat_irq = gpio_to_irq(context.qcibat_gpio);
-	err = request_irq(context.qcibat_irq, qbat_interrupt,
-		IRQF_TRIGGER_FALLING, BATTERY_ID_NAME, &context);
-	if (err) {
-		dev_err(&context.bi2c_client->dev,
-			"[BAT] unable to get IRQ\n");
-		goto request_irq_fail;
-	}
-	err = qci_get_bat_info(context.bi2c_client, context.batt_data);
-
-	goto success;
-
-request_irq_fail:
-	gpio_free(context.qcibat_gpio);
-
-gpio_request_fail:
-	power_supply_unregister(&qci_bat);
-
-battery_failed:
-	power_supply_unregister(&qci_ac);
-
-ac_failed:
-	platform_device_unregister(bat_pdev);
-
-	i2c_set_clientdata(context.bi2c_client, NULL);
-success:
-	return err;
-}
-
-static void __exit qbat_exit(void)
-{
-	free_irq(context.qcibat_irq, &context);
-	gpio_free(context.qcibat_gpio);
-	power_supply_unregister(&qci_bat);
-	power_supply_unregister(&qci_ac);
-	platform_device_unregister(bat_pdev);
-	i2c_set_clientdata(context.bi2c_client, NULL);
-}
-
-late_initcall(qbat_init);
-module_exit(qbat_exit);
-
-MODULE_AUTHOR("Quanta Computer Inc.");
-MODULE_DESCRIPTION("Quanta Embedded Controller I2C Battery Driver");
-MODULE_LICENSE("GPL v2");
-
+/* Quanta I2C Battery Driver
+ *
+ * Copyright (C) 2009 Quanta Computer Inc.
+ * Author: Austin Lai <austin.lai@quantatw.com>
+ * Author: Hsin Wu <hsin.wu@quantatw.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+  /*
+ *
+ *  The Driver with I/O communications via the I2C Interface of LCBU.
+ *  And it is only working on the nuvoTon NPCE781L Embedded Controller.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/power_supply.h>
+#include <linux/sched.h>
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include "qci_battery.h"
+
+struct qci_bat_status {
+
+        u8   battery_state;
+        u16  battery_present_rate;
+        u16  battery_remaining_capacity;
+        u16  battery_present_voltage;        
+	u8   battery_rsoc;
+        u16  battery_average_current;
+        u16  battery_temperature;
+} bst;
+
+struct qci_ac_status {
+        u8   power_source;
+} psr;
+
+/* General structure to hold the driver data */
+struct i2cbat_drv_data {
+        struct i2c_client *bi2c_client;
+        struct work_struct work;
+        char batt_data[I2C_BAT_BUFFER_LEN+1];
+        unsigned int qcibat_irq;
+        unsigned int qcibat_gpio;
+};
+
+/*********************************************************************
+ *              Power
+ *********************************************************************/
+
+static int qci_ac_get_prop(struct power_supply *psy,
+                            enum power_supply_property psp,
+                            union power_supply_propval *val)
+{
+    int ret = 0;
+    unsigned char psr;
+        switch (psp) {
+        case POWER_SUPPLY_PROP_ONLINE:
+
+                psr = npce_read_ecram(ECRAM_POWER_SOURCE);
+
+                if (psr & EC_FLAG_ADAPTER_IN)
+                        val->intval =  EC_ADAPTER_PRESENT;
+                    else
+                        val->intval =  EC_ADAPTER_NOT_PRESENT;
+        break;
+
+        default:
+                ret = -EINVAL;
+                break;
+        }
+        return ret;
+}
+
+static enum power_supply_property qci_ac_props[] = {
+        POWER_SUPPLY_PROP_ONLINE,
+};
+
+static enum power_supply_property qci_bat_props[] = {
+        POWER_SUPPLY_PROP_STATUS,
+        POWER_SUPPLY_PROP_PRESENT,
+        POWER_SUPPLY_PROP_VOLTAGE_AVG,
+        POWER_SUPPLY_PROP_CURRENT_AVG,
+        POWER_SUPPLY_PROP_CAPACITY,
+        POWER_SUPPLY_PROP_TEMP,
+};
+
+static int qbat_get_status(union power_supply_propval *val, uint8_t ec_byte)
+{
+        if (!(bst.battery_state & MAIN_BATTERY_STATUS_BAT_IN))
+                val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
+        else if (bst.battery_state & MAIN_BATTERY_STATUS_BAT_CHARGING)
+                val->intval = POWER_SUPPLY_STATUS_CHARGING;
+        else if (bst.battery_state & MAIN_BATTERY_STATUS_BAT_FULL)
+                val->intval = POWER_SUPPLY_STATUS_FULL;
+        else if (bst.battery_state & MAIN_BATTERY_STATUS_BAT_DISCHRG)
+                val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
+        return 0;
+}
+
+static int qbat_get_present(union power_supply_propval *val, uint16_t ec_word)
+{
+        if (bst.battery_state & MAIN_BATTERY_STATUS_BAT_IN)
+                val->intval = EC_BAT_PRESENT;
+        else
+                val->intval = EC_BAT_NOT_PRESENT;
+        return 0;
+}
+
+static int qbat_get_voltage_avg(union power_supply_propval *val, uint16_t ec_word)
+{
+        val->intval = bst.battery_present_voltage;
+        return 0;
+}
+
+static int qbat_get_capacity(union power_supply_propval *val, uint8_t ec_byte)
+{
+        val->intval = bst.battery_rsoc;
+        return 0;
+}
+
+static int qbat_get_current_avg(union power_supply_propval *val, uint16_t ec_word)
+{
+        val->intval = bst.battery_average_current;
+        return 0;
+}
+
+static int qbat_get_temp_avg(union power_supply_propval *val, uint16_t ec_word)
+{
+        val->intval = (bst.battery_temperature - 2730)/10;
+        return 0;
+}
+
+/*********************************************************************
+ *              Battery properties
+ *********************************************************************/
+static int qbat_get_property(struct power_supply *psy,
+                                 enum power_supply_property psp,
+                                 union power_supply_propval *val)
+{
+        int ret = 0;
+        int16_t ec_word = 0;
+        uint8_t ec_byte = 0;
+        switch (psp) {
+        case POWER_SUPPLY_PROP_STATUS:
+                ret = qbat_get_status(val, ec_byte);
+                break;
+        case POWER_SUPPLY_PROP_PRESENT:
+                ret = qbat_get_present(val, ec_word);
+                break;
+        case POWER_SUPPLY_PROP_VOLTAGE_AVG:
+                ret = qbat_get_voltage_avg(val, ec_word);
+                break;
+        case POWER_SUPPLY_PROP_CAPACITY:
+                ret = qbat_get_capacity(val, ec_byte);
+                break;
+        case POWER_SUPPLY_PROP_CURRENT_AVG:
+                ret = qbat_get_current_avg(val, ec_word);
+                break;
+        case POWER_SUPPLY_PROP_TEMP:
+                ret = qbat_get_temp_avg(val, ec_word);
+                break;
+        default:
+                ret = -EINVAL;
+                break;
+        }
+
+        return ret;
+}
+
+/*********************************************************************
+ *              Initialisation
+ *********************************************************************/
+
+static struct power_supply qci_ac = {
+        .name = "ac",
+        .type = POWER_SUPPLY_TYPE_MAINS,
+        .properties = qci_ac_props,
+        .num_properties = ARRAY_SIZE(qci_ac_props),
+        .get_property = qci_ac_get_prop,
+};
+
+static struct power_supply qci_bat = {
+        .properties = qci_bat_props,
+        .num_properties = ARRAY_SIZE(qci_bat_props),
+        .get_property = qbat_get_property,
+        .use_for_apm = 1,
+};
+
+static irqreturn_t qbat_interrupt(int irq, void *dev_id)
+{
+        struct i2cbat_drv_data *ibat_drv_data = dev_id;
+        schedule_work(&ibat_drv_data->work);
+        return IRQ_HANDLED;
+}
+
+static int qci_bat_status(struct i2c_client *client, char *ec_data)
+{
+        struct i2c_msg bat_msg;
+
+        npce_set_ecram_index(ECRAM_BATTERY_STATUS);
+
+        bat_msg.addr = client->addr;
+        bat_msg.flags = I2C_M_RD;
+        bat_msg.len = I2C_BAT_BUFFER_LEN;
+        bat_msg.buf = ec_data;
+        return i2c_transfer(client->adapter, &bat_msg, 1);
+}
+
+static void qbat_work(struct work_struct *_work)
+{
+        struct i2cbat_drv_data *ibat_drv_data =
+                container_of(_work, struct i2cbat_drv_data, work);
+        struct i2c_client *ibatclient = ibat_drv_data->bi2c_client;
+
+	qci_bat_status(ibatclient, ibat_drv_data->batt_data);
+	bst.battery_state = ibat_drv_data->batt_data[0];
+	bst.battery_present_rate = (ibat_drv_data->batt_data[2]<<8) |
+				   (ibat_drv_data->batt_data[1]);
+	bst.battery_remaining_capacity = (ibat_drv_data->batt_data[4]<<8) |
+					 (ibat_drv_data->batt_data[3]);
+	bst.battery_present_voltage = (ibat_drv_data->batt_data[6]<<8) |
+				      (ibat_drv_data->batt_data[5]);
+	bst.battery_rsoc = ibat_drv_data->batt_data[7];
+	bst.battery_average_current = (ibat_drv_data->batt_data[9]<<8) |
+				      (ibat_drv_data->batt_data[8]);
+	bst.battery_temperature = (ibat_drv_data->batt_data[11]<<8) |
+				  (ibat_drv_data->batt_data[10]);
+        power_supply_changed(&qci_ac);
+        power_supply_changed(&qci_bat);
+        return ;
+}
+
+static struct platform_device *bat_pdev;
+
+static int __init qbat_init(void)
+{
+        int err = 0;
+        struct i2cbat_drv_data *context = 0;
+        context = kzalloc(sizeof(struct i2cbat_drv_data), GFP_KERNEL);
+        if (!context)
+                return err;
+        context->bi2c_client = npce_get_i2c_client();
+
+        i2c_set_clientdata(context->bi2c_client, context);
+        context->qcibat_gpio = BATTERY_INT_GPIO;
+
+        /*battery device register*/
+        bat_pdev = platform_device_register_simple("battery", 0, NULL, 0);
+        if (IS_ERR(bat_pdev))
+        {
+                kfree(context);
+                return PTR_ERR(bat_pdev);
+        }
+
+        err = power_supply_register(&bat_pdev->dev, &qci_ac);
+        if (err)
+                goto ac_failed;
+
+        qci_bat.name = bat_pdev->name;
+        err = power_supply_register(&bat_pdev->dev, &qci_bat);
+        if (err)
+                goto battery_failed;
+
+        /*battery irq configure*/
+        INIT_WORK(&context->work, qbat_work);
+        err = gpio_request(context->qcibat_gpio, "qci-bat");
+        if (err) {
+                pr_err("[BAT] err gpio request\n");
+                goto gpio_request_fail;
+        }
+        context->qcibat_irq = gpio_to_irq(context->qcibat_gpio);
+        err = request_irq(context->qcibat_irq, qbat_interrupt,
+                IRQF_TRIGGER_FALLING, BATTERY_ID_NAME, context);
+        if (err) {
+                pr_err("[BAT] unable to get IRQ\n");
+                goto request_irq_fail;
+        }
+        err = qci_bat_status(context->bi2c_client, context->batt_data);
+
+        goto success;
+
+request_irq_fail:
+        gpio_free(context->qcibat_gpio);
+        
+gpio_request_fail:
+        power_supply_unregister(&qci_bat);
+        
+battery_failed:
+        power_supply_unregister(&qci_ac);
+        
+ac_failed:      
+        platform_device_unregister(bat_pdev);
+        
+        i2c_set_clientdata(context->bi2c_client, NULL);
+        kfree(context);
+success:
+        return err;
+}
+
+static void __exit qbat_exit(void)
+{
+        power_supply_unregister(&qci_bat);
+        power_supply_unregister(&qci_ac);
+        platform_device_unregister(bat_pdev);
+}
+
+late_initcall(qbat_init);
+module_exit(qbat_exit);
+
+MODULE_AUTHOR("Quanta Computer Inc.");
+MODULE_DESCRIPTION("Quanta Embedded Controller I2C Battery Driver");
+MODULE_LICENSE("GPL v2");
+
diff --git a/drivers/power/qci_battery.h b/drivers/power/qci_battery.h
index abf55fb..5b0efe3 100644
--- a/drivers/power/qci_battery.h
+++ b/drivers/power/qci_battery.h
@@ -1,61 +1,67 @@
-/* Header file for Quanta I2C Battery Driver
- *
- * Copyright (C) 2009 Quanta Computer Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
- /*
- *
- *  The Driver with I/O communications via the I2C Interface for ON2 of AP BU.
- *  And it is only working on the nuvoTon WPCE775x Embedded Controller.
- *
- */
-
-#ifndef __QCI_BATTERY_H__
-#define __QCI_BATTERY_H__
-
-#define BAT_I2C_ADDRESS 0x1A
-#define BATTERY_ID_NAME          "qci-i2cbat"
-#define EC_FLAG_ADAPTER_IN		0x01
-#define EC_FLAG_POWER_ON		0x02
-#define EC_FLAG_ENTER_S3		0x04
-#define EC_FLAG_ENTER_S4		0x08
-#define EC_FLAG_IN_STANDBY		0x10
-#define EC_FLAG_SYSTEM_ON		0x20
-#define EC_FLAG_WAIT_HWPG		0x40
-#define EC_FLAG_S5_POWER_ON	0x80
-
-#define MAIN_BATTERY_STATUS_BAT_IN			0x01
-#define MAIN_BATTERY_STATUS_BAT_FULL			0x02
-#define MAIN_BATTERY_STATUS_BAT_ABNORMAL	0x04
-#define MAIN_BATTERY_STATUS_BAT_CHARGING	0x08
-#define MAIN_BATTERY_STATUS_BAT_CRITICAL		0x10
-#define MAIN_BATTERY_STATUS_BAT_LOW			0x20
-#define MAIN_BATTERY_STATUS_BAT_DISCHRG		0x40
-#define MAIN_BATTERY_STATUS_BAT_SMB_VALID	0x80
-
-#define CHG_STATUS_BAT_CHARGE			0x01
-#define CHG_STATUS_BAT_PRECHG				0x02
-#define CHG_STATUS_BAT_OVERTEMP			0x04
-#define CHG_STATUS_BAT_TYPE				0x08
-#define CHG_STATUS_BAT_GWROK				0x10
-#define CHG_STATUS_BAT_INCHARGE			0x20
-#define CHG_STATUS_BAT_WAKECHRG			0x40
-#define CHG_STATUS_BAT_CHGTIMEOUT		0x80
-
-#define EC_ADAPTER_PRESENT		0x1
-#define EC_BAT_PRESENT		0x1
-#define EC_ADAPTER_NOT_PRESENT		0x0
-#define EC_BAT_NOT_PRESENT		0x0
-#define I2C_BAT_BUFFER_LEN		12
-
-#endif
+/* arm\mach-msm\include\mach\qci-battery.h
+ * Header file for Quanta I2C Battery Driver
+ *
+ * Copyright (C) 2009 Quanta Computer Inc.
+ * Author: Austin Lai <austin.lai@quantatw.com>
+ * Author: Hsin Wu <hsin.wu@quantatw.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+  /*
+ *
+ *  The Driver with I/O communications via the I2C Interface for ON2 of AP BU.
+ *  And it is only working on the nuvoTon NPCE781x Embedded Controller.
+ *
+ */
+
+#ifndef __QCI_BATTERY_H__
+#define __QCI_BATTERY_H__
+
+#define DEBUGMSG    0       /* debugging message */
+
+#if DEBUGMSG
+#define PRINTK(x...) printk(x)
+#else
+#define PRINTK(x...)
+#endif
+
+#define ECRAM_POWER_SOURCE              0x40
+#define ECRAM_BATTERY_STATUS            0x82
+
+#define EC_EVENT_BATTERY                0x01
+#define EC_EVENT_CHARGER                0x02
+#define EC_EVENT_SMBus                  0x04
+#define EC_EVENT_AC                     0x10
+#define EC_EVENT_TIMER                  0x40
+#define EC_EVENT_LIDSW                  0x80
+
+#define BATTERY_ID_NAME          "qci-i2cbat"
+#define EC_FLAG_ADAPTER_IN              0x01
+
+#define MAIN_BATTERY_STATUS_BAT_IN                      0x08
+#define MAIN_BATTERY_STATUS_BAT_FULL                    0x10
+#define MAIN_BATTERY_STATUS_BAT_CHARGING                0x02
+#define MAIN_BATTERY_STATUS_BAT_DISCHRG                 0x01
+
+#define EC_BAT_PRESENT     0x01
+#define EC_BAT_NOT_PRESENT 0x00
+#define EC_ADAPTER_PRESENT 0x01
+#define EC_ADAPTER_NOT_PRESENT 0x00
+
+#define BATTERY_INT_GPIO                        42
+#define I2C_BAT_BUFFER_LEN              12  /* max */
+
+extern struct i2c_client *npce_get_i2c_client(void);
+int npce_read_ecram(u8 ecram);
+int npce_set_ecram_index(u8 ecram);
+
+#endif
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 35/36]  [Driver][Qualcomm 1070][EC_BAT] Enable EC battery
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (29 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 34/36] [Driver][Qualcomm 1070][EC_BAT] Adding newer version battery driver Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:30 ` [RFC 36/36] [Driver][Qualcomm 1070][VERSION] 0.2.0 Wayne Lin
  31 siblings, 0 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/configs/qsd8650a-st1_5_defconfig |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm/configs/qsd8650a-st1_5_defconfig b/arch/arm/configs/qsd8650a-st1_5_defconfig
index fccad74..30caca8 100644
--- a/arch/arm/configs/qsd8650a-st1_5_defconfig
+++ b/arch/arm/configs/qsd8650a-st1_5_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.32.9
-# Mon Jun 28 14:46:18 2010
+# Wed Jul 21 15:20:49 2010
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -993,6 +993,7 @@ CONFIG_POWER_SUPPLY=y
 # CONFIG_BATTERY_DS2782 is not set
 # CONFIG_BATTERY_BQ27x00 is not set
 # CONFIG_BATTERY_MAX17040 is not set
+CONFIG_BATTERY_QCIBAT=y
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
 # CONFIG_HWMON_DEBUG_CHIP is not set
@@ -1572,13 +1573,14 @@ CONFIG_MMC_BLOCK_PARANOID_RESUME=y
 #
 # MMC/SD/SDIO Host Controller Drivers
 #
-# CONFIG_MMC_SDHCI is not set
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_PLTFM=y
 # CONFIG_MMC_AT91 is not set
 # CONFIG_MMC_ATMELMCI is not set
 # CONFIG_MMC_SPI is not set
 CONFIG_MMC_MSM=y
-# CONFIG_MMC_MSM7X00A_RESUME_IN_WQ is not set
-# CONFIG_MMC_MSM_SDIO_SUPPORT is not set
+CONFIG_MMC_MSM7X00A_RESUME_IN_WQ=y
+CONFIG_MMC_MSM_SDIO_SUPPORT=y
 CONFIG_MMC_MSM_CARD_HW_DETECTION=y
 CONFIG_MMC_MSM_SDC1_SUPPORT=y
 # CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT is not set
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* [RFC 36/36]  [Driver][Qualcomm 1070][VERSION] 0.2.0
  2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
                   ` (30 preceding siblings ...)
  2010-07-26  8:30 ` [RFC 35/36] [Driver][Qualcomm 1070][EC_BAT] Enable EC battery Wayne Lin
@ 2010-07-26  8:30 ` Wayne Lin
  2010-07-26  8:40   ` Premi, Sanjeev
  2010-07-26  8:47   ` Premi, Sanjeev
  31 siblings, 2 replies; 39+ messages in thread
From: Wayne Lin @ 2010-07-26  8:30 UTC (permalink / raw)
  To: linux-input; +Cc: wayne

From: wayne <wayne.lin@quantatw.com>

---
 arch/arm/mach-msm/version.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-msm/version.c b/arch/arm/mach-msm/version.c
index f665d9f..be21aae 100755
--- a/arch/arm/mach-msm/version.c
+++ b/arch/arm/mach-msm/version.c
@@ -12,7 +12,7 @@
 #include "smd_private.h"
 
 #define KERNEL_VERSION UTS_RELEASE
-#define IMAGE_VERSION "0.1.2"
+#define IMAGE_VERSION "0.2.0"
 
 static int version_proc_show(struct seq_file *m, void *v)
 {
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 39+ messages in thread

* RE: [RFC 36/36]  [Driver][Qualcomm 1070][VERSION] 0.2.0
  2010-07-26  8:30 ` [RFC 36/36] [Driver][Qualcomm 1070][VERSION] 0.2.0 Wayne Lin
@ 2010-07-26  8:40   ` Premi, Sanjeev
  2010-07-26  8:47   ` Premi, Sanjeev
  1 sibling, 0 replies; 39+ messages in thread
From: Premi, Sanjeev @ 2010-07-26  8:40 UTC (permalink / raw)
  To: Wayne Lin, linux-input@vger.kernel.org; +Cc: wayne

> -----Original Message-----
> From: linux-input-owner@vger.kernel.org 
> [mailto:linux-input-owner@vger.kernel.org] On Behalf Of Wayne Lin
> Sent: Monday, July 26, 2010 2:01 PM
> To: linux-input@vger.kernel.org
> Cc: wayne
> Subject: [RFC 36/36] [Driver][Qualcomm 1070][VERSION] 0.2.0
> 
> From: wayne <wayne.lin@quantatw.com>
> 

I haven't looked at all the patches, but I see may patches that are
changing only 1 or 2 lines. Do these really need to separated as such?

If you collate patches functionally, having description would also help.

Also, I noticed many changes to the defconfigs. You may want to take
a look at this discussion:
http://amailbox.org/mailarchive/linux-kernel/2010/6/6/4579948

~sanjeev

> ---
>  arch/arm/mach-msm/version.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-msm/version.c b/arch/arm/mach-msm/version.c
> index f665d9f..be21aae 100755
> --- a/arch/arm/mach-msm/version.c
> +++ b/arch/arm/mach-msm/version.c
> @@ -12,7 +12,7 @@
>  #include "smd_private.h"
>  
>  #define KERNEL_VERSION UTS_RELEASE
> -#define IMAGE_VERSION "0.1.2"
> +#define IMAGE_VERSION "0.2.0"
>  
>  static int version_proc_show(struct seq_file *m, void *v)
>  {
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe 
> linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [RFC 21/36] Revert " [Driver][Qualcomm 1070][CLOCK] Modify the AXI bus speed"
  2010-07-26  8:30 ` [RFC 21/36] Revert " [Driver][Qualcomm 1070][CLOCK] Modify the AXI bus speed" Wayne Lin
@ 2010-07-26  8:46   ` Dmitry Torokhov
  0 siblings, 0 replies; 39+ messages in thread
From: Dmitry Torokhov @ 2010-07-26  8:46 UTC (permalink / raw)
  To: Wayne Lin; +Cc: linux-input, wayne

On Mon, Jul 26, 2010 at 04:30:30PM +0800, Wayne Lin wrote:
> From: wayne <wayne.lin@quantatw.com>
> 
> This reverts commit 9ab35ce7ead42adf500950c6492fdd8aae173f5e.

You really need to sanitize your patch series before posting and not
simply dump your internal tree with all its history.

> ---
>  arch/arm/mach-msm/acpuclock-8x50a.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-msm/acpuclock-8x50a.c b/arch/arm/mach-msm/acpuclock-8x50a.c
> index beaac14..fab4c27 100644
> --- a/arch/arm/mach-msm/acpuclock-8x50a.c
> +++ b/arch/arm/mach-msm/acpuclock-8x50a.c
> @@ -106,7 +106,7 @@ struct clkctl_acpu_speed acpu_freq_tbl[] = {
>  	{ 0,  921600, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x18, 1225 },
>  	{ 0,  960000, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x19, 1225 },
>  	{ 1,  998400, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x1A, 1225 },
> -	{ 1, 1190400, ACPU_PLL_3, 0, 0, 0, 0, 192000, 1, 0x1F, 1225 },
> +	{ 1, 1190400, ACPU_PLL_3, 0, 0, 0, 0, 128000, 1, 0x1F, 1225 },
>  	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
>  };
>  
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Dmitry

^ permalink raw reply	[flat|nested] 39+ messages in thread

* RE: [RFC 36/36]  [Driver][Qualcomm 1070][VERSION] 0.2.0
  2010-07-26  8:30 ` [RFC 36/36] [Driver][Qualcomm 1070][VERSION] 0.2.0 Wayne Lin
  2010-07-26  8:40   ` Premi, Sanjeev
@ 2010-07-26  8:47   ` Premi, Sanjeev
  1 sibling, 0 replies; 39+ messages in thread
From: Premi, Sanjeev @ 2010-07-26  8:47 UTC (permalink / raw)
  To: Wayne Lin, linux-input@vger.kernel.org; +Cc: wayne

 

> -----Original Message-----
> From: linux-input-owner@vger.kernel.org 
> [mailto:linux-input-owner@vger.kernel.org] On Behalf Of Wayne Lin
> Sent: Monday, July 26, 2010 2:01 PM
> To: linux-input@vger.kernel.org
> Cc: wayne
> Subject: [RFC 36/36] [Driver][Qualcomm 1070][VERSION] 0.2.0
> 
> From: wayne <wayne.lin@quantatw.com>
> 
> ---
>  arch/arm/mach-msm/version.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-msm/version.c b/arch/arm/mach-msm/version.c
> index f665d9f..be21aae 100755
> --- a/arch/arm/mach-msm/version.c
> +++ b/arch/arm/mach-msm/version.c
> @@ -12,7 +12,7 @@
>  #include "smd_private.h"
>  
>  #define KERNEL_VERSION UTS_RELEASE
> -#define IMAGE_VERSION "0.1.2"
> +#define IMAGE_VERSION "0.2.0"
>  

[sp] I see 3 patches that are successively changing the same version number.


>  static int version_proc_show(struct seq_file *m, void *v)
>  {
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe 
> linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [RFC 04/36]  [Driver][Qualcomm 1070][EC_KB] Adding new qci keyboard driver
  2010-07-26  8:30 ` [RFC 04/36] [Driver][Qualcomm 1070][EC_KB] Adding new qci keyboard driver Wayne Lin
@ 2010-07-26  8:55   ` Dmitry Torokhov
  2010-07-26 11:16     ` Trilok Soni
  2010-07-26  8:59   ` Datta, Shubhrajyoti
  1 sibling, 1 reply; 39+ messages in thread
From: Dmitry Torokhov @ 2010-07-26  8:55 UTC (permalink / raw)
  To: Wayne Lin; +Cc: linux-input, wayne

On Mon, Jul 26, 2010 at 04:30:13PM +0800, Wayne Lin wrote:
> From: wayne <wayne.lin@quantatw.com>
> 

- Change log?
- run through checkpatch.pl
- Get rid of debug printks (or convert to dev_dbg)?
- use dev_XXX instrad of pr_xxx when you have device? Get rig
- I have seen lots of time people trying to call input_free_device
  after calling input_unregister_device (which is forbidden,
  input_unregister_device is sufficient alone) but you are the first to
  call free _before_ unregister.
- No need to initialize keymap with zeroes (NOKEYS)
- threaded IRQ
- copy keymap into device and set keycode, keycodemax, keycodesize so
  that keymap can be adjusted from userspace
- why do you export input device?

I dont think you tried applying this patch... At least I do not have
qci_kbd.c in my tree so it would not apply.



> ---
>  drivers/input/keyboard/qci_kbd.c | 1101 +++++++++++++++++++-------------------
>  1 files changed, 551 insertions(+), 550 deletions(-)
> 
> diff --git a/drivers/input/keyboard/qci_kbd.c b/drivers/input/keyboard/qci_kbd.c
> index aa7a64a..0cf2f7e 100755
> --- a/drivers/input/keyboard/qci_kbd.c
> +++ b/drivers/input/keyboard/qci_kbd.c
> @@ -1,550 +1,551 @@
> -/* Quanta I2C Keyboard Driver
> - *
> - * Copyright (C) 2009 Quanta Computer Inc.
> - * Author: Hsin Wu <hsin.wu@quantatw.com>
> - * Author: Austin Lai <austin.lai@quantatw.com>
> - *
> - * This software is licensed under the terms of the GNU General Public
> - * License version 2, as published by the Free Software Foundation, and
> - * may be copied, distributed, and modified under those terms.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - */
> -
> - /*
> - *
> - *  The Driver with I/O communications via the I2C Interface for ON2 of AP BU.
> - *  And it is only working on the nuvoTon WPCE775x Embedded Controller.
> - *
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/init.h>
> -#include <linux/module.h>
> -#include <linux/slab.h>
> -#include <linux/jiffies.h>
> -#include <linux/i2c.h>
> -#include <linux/mutex.h>
> -#include <linux/interrupt.h>
> -#include <linux/input.h>
> -#include <linux/keyboard.h>
> -#include <linux/gpio.h>
> -#include <linux/delay.h>
> -
> -/* Keyboard special scancode */
> -#define RC_KEY_FN          0x70
> -#define RC_KEY_BREAK       0x80
> -#define KEY_ACK_FA      0xFA
> -
> -/* Keyboard keycodes */
> -#define NOKEY           KEY_RESERVED
> -#define KEY_LEFTWIN     KEY_LEFTMETA
> -#define KEY_RIGHTWIN    KEY_RIGHTMETA
> -#define KEY_APPS        KEY_COMPOSE
> -#define KEY_PRINTSCR    KEY_SYSRQ
> -
> -#define KEYBOARD_ID_NAME          "qci-i2ckbd"
> -#define KEYBOARD_NAME                "Quanta Keyboard"
> -#define KEYBOARD_DEVICE             "/i2c/input0"
> -#define KEYBOARD_CMD_ENABLE             0xF4
> -
> -/*-----------------------------------------------------------------------------
> - * Keyboard scancode to linux keycode translation table
> - *---------------------------------------------------------------------------*/
> -
> -static const unsigned char on2_keycode[256] = {
> -	[0]   = NOKEY,
> -	[1]   = NOKEY,
> -	[2]   = NOKEY,
> -	[3]   = KEY_5,
> -	[4]   = KEY_7,
> -	[5]   = KEY_9,
> -	[6]   = KEY_MINUS,
> -	[7]   = NOKEY,
> -	[8]   = NOKEY,
> -	[9]   = NOKEY,
> -	[10]  = NOKEY,
> -	[11]  = KEY_LEFTBRACE,
> -	[12]  = KEY_F10,
> -	[13]  = KEY_INSERT,
> -	[14]  = KEY_F11,
> -	[15]  = KEY_ESC,
> -	[16]  = NOKEY,
> -	[17]  = NOKEY,
> -	[18]  = NOKEY,
> -	[19]  = KEY_4,
> -	[20]  = KEY_6,
> -	[21]  = KEY_8,
> -	[22]  = KEY_0,
> -	[23]  = KEY_EQUAL,
> -	[24]  = NOKEY,
> -	[25]  = NOKEY,
> -	[26]  = NOKEY,
> -	[27]  = KEY_P,
> -	[28]  = KEY_F9,
> -	[29]  = KEY_DELETE,
> -	[30]  = KEY_F12,
> -	[31]  = KEY_GRAVE,
> -	[32]  = KEY_W,
> -	[33]  = NOKEY,
> -	[34]  = NOKEY,
> -	[35]  = KEY_R,
> -	[36]  = KEY_T,
> -	[37]  = KEY_U,
> -	[38]  = KEY_O,
> -	[39]  = KEY_RIGHTBRACE,
> -	[40]  = NOKEY,
> -	[41]  = NOKEY,
> -	[42]  = NOKEY,
> -	[43]  = KEY_APOSTROPHE,
> -	[44]  = KEY_BACKSPACE,
> -	[45]  = NOKEY,
> -	[46]  = KEY_F8,
> -	[47]  = KEY_F5,
> -	[48]  = KEY_S,
> -	[49]  = NOKEY,
> -	[50]  = NOKEY,
> -	[51]  = KEY_E,
> -	[52]  = KEY_H,
> -	[53]  = KEY_Y,
> -	[54]  = KEY_I,
> -	[55]  = KEY_ENTER,
> -	[56]  = NOKEY,
> -	[57]  = NOKEY,
> -	[58]  = NOKEY,
> -	[59]  = KEY_SEMICOLON,
> -	[60]  = KEY_3,
> -	[61]  = KEY_PAGEUP,
> -	[62]  = KEY_Q,
> -	[63]  = KEY_TAB,
> -	[64]  = KEY_A,
> -	[65]  = NOKEY,
> -	[66]  = NOKEY,
> -	[67]  = KEY_F,
> -	[68]  = KEY_G,
> -	[69]  = KEY_J,
> -	[70]  = KEY_L,
> -	[71]  = NOKEY,
> -	[72]  = KEY_RIGHTSHIFT,
> -	[73]  = NOKEY,
> -	[74]  = NOKEY,
> -	[75]  = KEY_SLASH,
> -	[76]  = KEY_2,
> -	[77]  = KEY_PAGEDOWN,
> -	[78]  = KEY_F4,
> -	[79]  = KEY_F1,
> -	[80]  = KEY_Z,
> -	[81]  = NOKEY,
> -	[82]  = NOKEY,
> -	[83]  = KEY_D,
> -	[84]  = KEY_V,
> -	[85]  = KEY_N,
> -	[86]  = KEY_K,
> -	[87]  = NOKEY,
> -	[88]  = KEY_LEFTSHIFT,
> -	[89]  = KEY_RIGHTCTRL,
> -	[90]  = NOKEY,
> -	[91]  = KEY_DOT,
> -	[92]  = KEY_UP,
> -	[93]  = KEY_RIGHT,
> -	[94]  = KEY_F3,
> -	[95]  = KEY_F2,
> -	[96]  = NOKEY,
> -	[97]  = NOKEY,
> -	[98]  = KEY_RIGHTALT,
> -	[99]  = KEY_X,
> -	[100] = KEY_C,
> -	[101] = KEY_B,
> -	[102] = KEY_COMMA,
> -	[103] = NOKEY,
> -	[104] = NOKEY,
> -	[105] = NOKEY,
> -	[106] = NOKEY,
> -	[107] = NOKEY,
> -	[108] = KEY_PRINTSCR,
> -	[109] = KEY_DOWN,
> -	[110] = KEY_1,
> -	[111] = KEY_CAPSLOCK,
> -	[112] = KEY_F24,
> -	[113] = KEY_HOME,
> -	[114] = KEY_LEFTALT,
> -	[115] = NOKEY,
> -	[116] = KEY_SPACE,
> -	[117] = KEY_BACKSLASH,
> -	[118] = KEY_M,
> -	[119] = KEY_COMPOSE,
> -	[120] = NOKEY,
> -	[121] = KEY_LEFTCTRL,
> -	[122] = NOKEY,
> -	[123] = NOKEY,
> -	[124] = KEY_PAUSE,
> -	[125] = KEY_LEFT,
> -	[126] = KEY_F7,
> -	[127] = KEY_F6,
> -	[128] = NOKEY,
> -	[129] = NOKEY,
> -	[130] = NOKEY,
> -	[131] = NOKEY,
> -	[132] = NOKEY,
> -	[133] = NOKEY,
> -	[134] = NOKEY,
> -	[135] = NOKEY,
> -	[136] = NOKEY,
> -	[137] = NOKEY,
> -	[138] = NOKEY,
> -	[139] = NOKEY,
> -	[140] = NOKEY,
> -	[141] = NOKEY,
> -	[142] = NOKEY,
> -	[143] = NOKEY,
> -	[144] = NOKEY,
> -	[145] = NOKEY,
> -	[146] = NOKEY,
> -	[147] = NOKEY,
> -	[148] = NOKEY,
> -	[149] = NOKEY,
> -	[150] = NOKEY,
> -	[151] = NOKEY,
> -	[152] = NOKEY,
> -	[153] = NOKEY,
> -	[154] = NOKEY,
> -	[155] = NOKEY,
> -	[156] = NOKEY,
> -	[157] = NOKEY,
> -	[158] = NOKEY,
> -	[159] = NOKEY,
> -	[160] = NOKEY,
> -	[161] = NOKEY,
> -	[162] = NOKEY,
> -	[163] = NOKEY,
> -	[164] = NOKEY,
> -	[165] = NOKEY,
> -	[166] = NOKEY,
> -	[167] = NOKEY,
> -	[168] = NOKEY,
> -	[169] = NOKEY,
> -	[170] = NOKEY,
> -	[171] = NOKEY,
> -	[172] = NOKEY,
> -	[173] = NOKEY,
> -	[174] = NOKEY,
> -	[175] = NOKEY,
> -	[176] = NOKEY,
> -	[177] = NOKEY,
> -	[178] = NOKEY,
> -	[179] = NOKEY,
> -	[180] = NOKEY,
> -	[181] = NOKEY,
> -	[182] = NOKEY,
> -	[183] = NOKEY,
> -	[184] = NOKEY,
> -	[185] = NOKEY,
> -	[186] = NOKEY,
> -	[187] = NOKEY,
> -	[188] = NOKEY,
> -	[189] = KEY_HOME,
> -	[190] = NOKEY,
> -	[191] = NOKEY,
> -	[192] = NOKEY,
> -	[193] = NOKEY,
> -	[194] = NOKEY,
> -	[195] = NOKEY,
> -	[196] = NOKEY,
> -	[197] = NOKEY,
> -	[198] = NOKEY,
> -	[199] = NOKEY,
> -	[200] = NOKEY,
> -	[201] = NOKEY,
> -	[202] = NOKEY,
> -	[203] = NOKEY,
> -	[204] = NOKEY,
> -	[205] = KEY_END,
> -	[206] = NOKEY,
> -	[207] = NOKEY,
> -	[208] = NOKEY,
> -	[209] = NOKEY,
> -	[210] = NOKEY,
> -	[211] = NOKEY,
> -	[212] = NOKEY,
> -	[213] = NOKEY,
> -	[214] = NOKEY,
> -	[215] = NOKEY,
> -	[216] = NOKEY,
> -	[217] = NOKEY,
> -	[218] = NOKEY,
> -	[219] = NOKEY,
> -	[220] = KEY_VOLUMEUP,
> -	[221] = KEY_BRIGHTNESSUP,
> -	[222] = NOKEY,
> -	[223] = NOKEY,
> -	[224] = NOKEY,
> -	[225] = NOKEY,
> -	[226] = NOKEY,
> -	[227] = NOKEY,
> -	[228] = NOKEY,
> -	[229] = NOKEY,
> -	[230] = NOKEY,
> -	[231] = NOKEY,
> -	[232] = NOKEY,
> -	[233] = NOKEY,
> -	[234] = NOKEY,
> -	[235] = NOKEY,
> -	[236] = NOKEY,
> -	[237] = KEY_VOLUMEDOWN,
> -	[238] = NOKEY,
> -	[239] = NOKEY,
> -	[240] = NOKEY,
> -	[241] = NOKEY,
> -	[242] = NOKEY,
> -	[243] = NOKEY,
> -	[244] = NOKEY,
> -	[245] = NOKEY,
> -	[246] = NOKEY,
> -	[247] = NOKEY,
> -	[248] = NOKEY,
> -	[249] = NOKEY,
> -	[250] = NOKEY,
> -	[251] = NOKEY,
> -	[252] = NOKEY,
> -	[253] = KEY_BRIGHTNESSDOWN,
> -	[254] = NOKEY,
> -	[255] = NOKEY,
> -};
> -/*-----------------------------------------------------------------------------
> - * Global variables
> - *---------------------------------------------------------------------------*/
> -
> -struct input_dev *g_qci_keyboard_dev;
> -
> -/* General structure to hold the driver data */
> -struct i2ckbd_drv_data {
> -	struct i2c_client *ki2c_client;
> -	struct work_struct work;
> -	struct input_dev *qcikbd_dev;
> -	unsigned int qcikbd_gpio; /* GPIO used for interrupt */
> -	unsigned int qcikbd_irq;
> -	unsigned int key_down;
> -	unsigned int escape;
> -	unsigned int pause_seq;
> -	unsigned int fn;
> -};
> -#ifdef CONFIG_PM
> -static int qcikbd_suspend(struct device *dev)
> -{
> -	return 0;
> -}
> -
> -static int qcikbd_resume(struct device *dev)
> -{
> -	return 0;
> -}
> -#endif
> -static int __devinit qcikbd_probe(struct i2c_client *client,
> -	const struct i2c_device_id *id);
> -static int __devexit qcikbd_remove(struct i2c_client *kbd);
> -
> -static const struct i2c_device_id qcikbd_idtable[] = {
> -	{ KEYBOARD_ID_NAME, 0 },
> -	{ }
> -};
> -
> -MODULE_DEVICE_TABLE(i2c, qcikbd_idtable);
> -
> -#ifdef CONFIG_PM
> -static struct dev_pm_ops qcikbd_pm_ops = {
> -	.suspend  = qcikbd_suspend,
> -	.resume   = qcikbd_resume,
> -};
> -#endif
> -static struct i2c_driver i2ckbd_driver = {
> -	.driver = {
> -		.owner = THIS_MODULE,
> -		.name  = KEYBOARD_ID_NAME,
> -#ifdef CONFIG_PM
> -		.pm = &qcikbd_pm_ops,
> -#endif
> -	},
> -	.probe	  = qcikbd_probe,
> -	.remove = __devexit_p(qcikbd_remove),
> -	.id_table = qcikbd_idtable,
> -};
> -
> -/*-----------------------------------------------------------------------------
> - * Driver functions
> - *---------------------------------------------------------------------------*/
> -
> -static irqreturn_t qcikbd_interrupt(int irq, void *dev_id)
> -{
> -	struct i2ckbd_drv_data *ikbd_drv_data = dev_id;
> -	schedule_work(&ikbd_drv_data->work);
> -	return IRQ_HANDLED;
> -}
> -
> -static void qcikbd_work_handler(struct work_struct *_work)
> -{
> -	unsigned char scancode;
> -	unsigned int  keycode;
> -
> -	struct i2ckbd_drv_data *ikbd_drv_data =
> -		container_of(_work, struct i2ckbd_drv_data, work);
> -
> -	struct i2c_client *ikbdclient = ikbd_drv_data->ki2c_client;
> -	struct input_dev *ikbdev = ikbd_drv_data->qcikbd_dev;
> -
> -	scancode = i2c_smbus_read_byte(ikbdclient);
> -
> -	if (scancode == KEY_ACK_FA) {
> -		return;
> -	} else if (scancode == RC_KEY_FN) {
> -		ikbd_drv_data->fn = 0x80;     /* select keycode table  > 0x7F */
> -	} else {
> -		ikbd_drv_data->key_down = 1;
> -		if (scancode & RC_KEY_BREAK) {
> -			ikbd_drv_data->key_down = 0;
> -			if ((scancode & 0x7F) == RC_KEY_FN)
> -				ikbd_drv_data->fn = 0;
> -		}
> -		keycode = on2_keycode[(scancode & 0x7F) | ikbd_drv_data->fn];
> -		if (keycode != NOKEY) {
> -			input_report_key(ikbdev,
> -					 keycode,
> -					 ikbd_drv_data->key_down);
> -			input_sync(ikbdev);
> -		}
> -	}
> -}
> -
> -
> -static int qcikbd_open(struct input_dev *dev)
> -{
> -	struct i2ckbd_drv_data *ikbd_drv_data = input_get_drvdata(dev);
> -	struct i2c_client *ikbdclient = ikbd_drv_data->ki2c_client;
> -
> -	/* Send F4h - enable keyboard */
> -	i2c_smbus_write_byte(ikbdclient, KEYBOARD_CMD_ENABLE);
> -	return 0;
> -}
> -
> -static int __devinit qcikbd_probe(struct i2c_client *client,
> -				    const struct i2c_device_id *id)
> -{
> -	int err;
> -	int i;
> -	struct i2ckbd_drv_data *context;
> -	context = kzalloc(sizeof(struct i2ckbd_drv_data), GFP_KERNEL);
> -	if (!context)
> -		return -ENOMEM;
> -	i2c_set_clientdata(client, context);
> -	context->ki2c_client = client;
> -	context->qcikbd_gpio = client->irq;
> -	client->driver = &i2ckbd_driver;
> -
> -	INIT_WORK(&context->work, qcikbd_work_handler);
> -
> -	err = gpio_request(context->qcikbd_gpio, "qci-kbd");
> -	if (err) {
> -		pr_err("[KBD] err gpio request\n");
> -		goto gpio_request_fail;
> -	}
> -
> -	context->qcikbd_irq = gpio_to_irq(context->qcikbd_gpio);
> -	err = request_irq(context->qcikbd_irq,
> -			  qcikbd_interrupt,
> -			  IRQF_TRIGGER_FALLING,
> -			  KEYBOARD_ID_NAME,
> -			  context);
> -	if (err) {
> -		pr_err("[KBD] err unable to get IRQ\n");
> -		goto request_irq_fail;
> -	}
> -
> -	context->qcikbd_dev = input_allocate_device();
> -	if (!context->qcikbd_dev) {
> -		pr_err("[KBD]allocting memory err\n");
> -		err = -ENOMEM;
> -		goto allocate_fail;
> -	}
> -
> -	context->qcikbd_dev->name       = KEYBOARD_NAME;
> -	context->qcikbd_dev->phys       = KEYBOARD_DEVICE;
> -	context->qcikbd_dev->id.bustype = BUS_I2C;
> -	context->qcikbd_dev->id.vendor  = 0x1050;
> -	context->qcikbd_dev->id.product = 0x0006;
> -	context->qcikbd_dev->id.version = 0x0004;
> -	context->qcikbd_dev->open       = qcikbd_open;
> -	set_bit(EV_KEY, context->qcikbd_dev->evbit);
> -	set_bit(EV_REP, context->qcikbd_dev->evbit);
> -
> -	/* Enable all supported keys */
> -	for (i = 1; i < ARRAY_SIZE(on2_keycode) ; i++)
> -		set_bit(on2_keycode[i], context->qcikbd_dev->keybit);
> -
> -	set_bit(KEY_POWER, context->qcikbd_dev->keybit);
> -	set_bit(KEY_END, context->qcikbd_dev->keybit);
> -	set_bit(KEY_VOLUMEUP, context->qcikbd_dev->keybit);
> -	set_bit(KEY_VOLUMEDOWN, context->qcikbd_dev->keybit);
> -	set_bit(KEY_ZOOMIN, context->qcikbd_dev->keybit);
> -	set_bit(KEY_ZOOMOUT, context->qcikbd_dev->keybit);
> -
> -	input_set_drvdata(context->qcikbd_dev, context);
> -	err = input_register_device(context->qcikbd_dev);
> -	if (err) {
> -		pr_err("[KBD] err input register device\n");
> -		goto register_fail;
> -	}
> -	g_qci_keyboard_dev = context->qcikbd_dev;
> -	return 0;
> -register_fail:
> -	input_free_device(context->qcikbd_dev);
> -
> -allocate_fail:
> -	free_irq(context->qcikbd_irq, context);
> -
> -request_irq_fail:
> -	gpio_free(context->qcikbd_gpio);
> -
> -gpio_request_fail:
> -	i2c_set_clientdata(client, NULL);
> -	kfree(context);
> -	return err;
> -}
> -
> -static int __devexit qcikbd_remove(struct i2c_client *dev)
> -{
> -	struct i2ckbd_drv_data *context = i2c_get_clientdata(dev);
> -
> -	free_irq(context->qcikbd_irq, context);
> -	gpio_free(context->qcikbd_gpio);
> -	input_free_device(context->qcikbd_dev);
> -	input_unregister_device(context->qcikbd_dev);
> -	kfree(context);
> -
> -	return 0;
> -}
> -
> -static int __init qcikbd_init(void)
> -{
> -	return i2c_add_driver(&i2ckbd_driver);
> -}
> -
> -static void __exit qcikbd_exit(void)
> -{
> -	i2c_del_driver(&i2ckbd_driver);
> -}
> -
> -struct input_dev *nkbc_keypad_get_input_dev(void)
> -{
> -	return g_qci_keyboard_dev;
> -}
> -EXPORT_SYMBOL(nkbc_keypad_get_input_dev);
> -module_init(qcikbd_init);
> -module_exit(qcikbd_exit);
> -
> -MODULE_AUTHOR("Quanta Computer Inc.");
> -MODULE_DESCRIPTION("Quanta Embedded Controller I2C Keyboard Driver");
> -MODULE_LICENSE("GPL v2");
> -
> +/* Quanta I2C Keyboard Driver
> + *
> + * Copyright (C) 2009 Quanta Computer Inc.
> + * Author: Hsin Wu <hsin.wu@quantatw.com>
> + * Author: Austin Lai <austin.lai@quantatw.com>
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + */
> +
> + /*
> + *
> + *  The Driver with I/O communications via the I2C Interface for ON2 of AP BU.
> + *  And it is only working on the nuvoTon WPCE775x Embedded Controller.
> + *
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/slab.h>
> +#include <linux/jiffies.h>
> +#include <linux/i2c.h>
> +#include <linux/mutex.h>
> +#include <linux/interrupt.h>
> +#include <linux/input.h>
> +#include <linux/keyboard.h>
> +#include <linux/gpio.h>
> +#include <linux/delay.h>
> +
> +/* Keyboard special scancode */
> +#define RC_KEY_FN          0x70
> +#define RC_KEY_BREAK       0x80
> +#define KEY_ACK_FA      0xFA
> +
> +/* Keyboard keycodes */
> +#define NOKEY           KEY_RESERVED
> +#define KEY_LEFTWIN     KEY_LEFTMETA
> +#define KEY_RIGHTWIN    KEY_RIGHTMETA
> +#define KEY_APPS        KEY_COMPOSE
> +#define KEY_PRINTSCR    KEY_SYSRQ
> +
> +#define KEYBOARD_ID_NAME          "qci-i2ckbd"
> +#define KEYBOARD_NAME                "Quanta Keyboard"
> +#define KEYBOARD_DEVICE             "/i2c/input0"
> +#define KEYBOARD_CMD_ENABLE             0xF4
> +
> +/*-----------------------------------------------------------------------------
> + * Keyboard scancode to linux keycode translation table
> + *---------------------------------------------------------------------------*/
> +
> +static const unsigned char on2_keycode[256] = {
> +        [0]   = KEY_RESERVED,
> +        [1]   = KEY_ESC,
> +        [2]   = KEY_1,
> +        [3]   = KEY_2,
> +        [4]   = KEY_3,
> +        [5]   = KEY_4,
> +        [6]   = KEY_5,
> +        [7]   = KEY_6,
> +        [8]   = KEY_7,
> +        [9]   = KEY_8,
> +        [10]  = KEY_9,
> +        [11]  = KEY_0,
> +        [12]  = KEY_MINUS,
> +        [13]  = KEY_EQUAL,
> +        [14]  = KEY_BACKSPACE,
> +        [15]  = KEY_TAB,
> +        [16]  = KEY_Q,
> +        [17]  = KEY_W,
> +        [18]  = KEY_E,
> +        [19]  = KEY_R,
> +        [20]  = KEY_T,
> +        [21]  = KEY_Y,
> +        [22]  = KEY_U,
> +        [23]  = KEY_I,
> +        [24]  = KEY_O,
> +        [25]  = KEY_P,
> +        [26]  = KEY_LEFTBRACE,
> +        [27]  = KEY_RIGHTBRACE,
> +        [28]  = KEY_ENTER,
> +        [29]  = KEY_LEFTCTRL,
> +        [30]  = KEY_A,
> +        [31]  = KEY_S,
> +        [32]  = KEY_D,
> +        [33]  = KEY_F,
> +        [34]  = KEY_G,
> +        [35]  = KEY_H,
> +        [36]  = KEY_J,
> +        [37]  = KEY_K,
> +        [38]  = KEY_L,
> +        [39]  = KEY_SEMICOLON,
> +        [40]  = KEY_APOSTROPHE,
> +        [41]  = KEY_GRAVE,
> +        [42]  = KEY_LEFTSHIFT,
> +        [43]  = KEY_BACKSLASH,
> +        [44]  = KEY_Z,
> +        [45]  = KEY_X,
> +        [46]  = KEY_C,
> +        [47]  = KEY_V,
> +        [48]  = KEY_B,
> +        [49]  = KEY_N,
> +        [50]  = KEY_M,
> +        [51]  = KEY_COMMA,
> +        [52]  = KEY_DOT,
> +        [53]  = KEY_SLASH,
> +        [54]  = KEY_RIGHTSHIFT,
> +        [55]  = KEY_KPASTERISK,
> +        [56]  = KEY_LEFTALT,
> +        [57]  = KEY_SPACE,
> +        [58]  = KEY_CAPSLOCK,
> +        [59]  = KEY_F1,
> +        [60]  = KEY_F2,
> +        [61]  = KEY_F3,
> +        [62]  = KEY_F4,
> +        [63]  = KEY_F5,
> +        [64]  = KEY_F6,
> +        [65]  = KEY_F7,
> +        [66]  = KEY_F8,
> +        [67]  = KEY_F9,
> +        [68]  = KEY_F10,
> +        [69]  = KEY_NUMLOCK,
> +        [70]  = KEY_SCROLLLOCK,
> +        [71]  = KEY_KP7,
> +        [72]  = KEY_KP8,
> +        [73]  = KEY_KP9,
> +        [74]  = KEY_KPMINUS,
> +        [75]  = KEY_KP4,
> +        [76]  = KEY_KP5,
> +        [77]  = KEY_KP6,
> +        [78]  = KEY_KPPLUS,
> +        [79]  = KEY_KP1,
> +        [80]  = KEY_KP2,
> +        [81]  = KEY_KP3,
> +        [82]  = KEY_KP0,
> +        [83]  = KEY_KPDOT,
> +        [84]  = KEY_RESERVED,
> +        [85]  = KEY_ZENKAKUHANKAKU,
> +        [86]  = KEY_102ND,
> +        [87]  = KEY_F11,
> +        [88]  = KEY_F12,
> +        [89]  = KEY_RO,
> +        [90]  = KEY_KATAKANA,
> +        [91]  = KEY_HIRAGANA,
> +        [92]  = KEY_HENKAN,
> +        [93]  = KEY_KATAKANAHIRAGANA,
> +        [94]  = KEY_MUHENKAN,
> +        [95]  = KEY_KPJPCOMMA,
> +        [96]  = KEY_KPENTER,
> +        [97]  = KEY_RIGHTCTRL,
> +        [98]  = KEY_KPSLASH,
> +        [99]  = KEY_SYSRQ,
> +        [100] = KEY_RIGHTALT,
> +        [101] = KEY_LINEFEED,
> +        [102] = KEY_HOME,
> +        [103] = KEY_UP,
> +        [104] = KEY_PAGEUP,
> +        [105] = KEY_LEFT,
> +        [106] = KEY_RIGHT,
> +        [107] = KEY_END,
> +        [108] = KEY_DOWN,
> +        [109] = KEY_PAGEDOWN,
> +        [110] = KEY_INSERT,
> +        [111] = KEY_DELETE,
> +        [112] = KEY_MACRO,
> +        [113] = KEY_MUTE,
> +        [114] = KEY_VOLUMEDOWN,
> +        [115] = KEY_VOLUMEUP,
> +        [116] = KEY_POWER,
> +        [117] = KEY_KPEQUAL,
> +        [118] = KEY_KPPLUSMINUS,
> +        [119] = KEY_PAUSE,
> +        [120] = KEY_SCALE,
> +        [121] = KEY_KPCOMMA,
> +        [122] = KEY_HANGEUL,
> +        [123] = KEY_HANGUEL,
> +        [124] = KEY_HANJA,
> +        [125] = KEY_YEN,
> +        [126] = KEY_LEFTMETA,
> +        [127] = KEY_RIGHTMETA,
> +        [128] = KEY_COMPOSE,
> +        [129] = NOKEY,
> +        [130] = NOKEY,
> +        [131] = NOKEY,
> +        [132] = NOKEY,
> +        [133] = NOKEY,
> +        [134] = NOKEY,
> +        [135] = NOKEY,
> +        [136] = NOKEY,
> +        [137] = NOKEY,
> +        [138] = NOKEY,
> +        [139] = NOKEY,
> +        [140] = NOKEY,
> +        [141] = NOKEY,
> +        [142] = NOKEY,
> +        [143] = NOKEY,
> +        [144] = NOKEY,
> +        [145] = NOKEY,
> +        [146] = NOKEY,
> +        [147] = NOKEY,
> +        [148] = NOKEY,
> +        [149] = NOKEY,
> +        [150] = NOKEY,
> +        [151] = NOKEY,
> +        [152] = NOKEY,
> +        [153] = NOKEY,
> +        [154] = NOKEY,
> +        [155] = NOKEY,
> +        [156] = NOKEY,
> +        [157] = NOKEY,
> +        [158] = NOKEY,
> +        [159] = NOKEY,
> +        [160] = NOKEY,
> +        [161] = NOKEY,
> +        [162] = NOKEY,
> +        [163] = NOKEY,
> +        [164] = NOKEY,
> +        [165] = NOKEY,
> +        [166] = NOKEY,
> +        [167] = NOKEY,
> +        [168] = NOKEY,
> +        [169] = NOKEY,
> +        [170] = NOKEY,
> +        [171] = NOKEY,
> +        [172] = NOKEY,
> +        [173] = NOKEY,
> +        [174] = NOKEY,
> +        [175] = NOKEY,
> +        [176] = NOKEY,
> +        [177] = NOKEY,
> +        [178] = NOKEY,
> +        [179] = NOKEY,
> +        [180] = NOKEY,
> +        [181] = NOKEY,
> +        [182] = NOKEY,
> +        [183] = NOKEY,
> +        [184] = NOKEY,
> +        [185] = NOKEY,
> +        [186] = NOKEY,
> +        [187] = NOKEY,
> +        [188] = NOKEY,
> +        [189] = KEY_HOME,
> +        [190] = NOKEY,
> +        [191] = NOKEY,
> +        [192] = NOKEY,
> +        [193] = NOKEY,
> +        [194] = NOKEY,
> +        [195] = NOKEY,
> +        [196] = NOKEY,
> +        [197] = NOKEY,
> +        [198] = NOKEY,
> +        [199] = NOKEY,
> +        [200] = NOKEY,
> +        [201] = NOKEY,
> +        [202] = NOKEY,
> +        [203] = NOKEY,
> +        [204] = NOKEY,
> +        [205] = KEY_END,
> +        [206] = NOKEY,
> +        [207] = NOKEY,
> +        [208] = NOKEY,
> +        [209] = NOKEY,
> +        [210] = NOKEY,
> +        [211] = NOKEY,
> +        [212] = NOKEY,
> +        [213] = NOKEY,
> +        [214] = NOKEY,
> +        [215] = NOKEY,
> +        [216] = NOKEY,
> +        [217] = NOKEY,
> +        [218] = NOKEY,
> +        [219] = NOKEY,
> +        [220] = KEY_VOLUMEUP,
> +        [221] = KEY_BRIGHTNESSUP,
> +        [222] = NOKEY,
> +        [223] = NOKEY,
> +        [224] = NOKEY,
> +        [225] = NOKEY,
> +        [226] = NOKEY,
> +        [227] = NOKEY,
> +        [228] = NOKEY,
> +        [229] = NOKEY,
> +        [230] = NOKEY,
> +        [231] = NOKEY,
> +        [232] = NOKEY,
> +        [233] = NOKEY,
> +        [234] = NOKEY,
> +        [235] = NOKEY,
> +        [236] = NOKEY,
> +        [237] = KEY_VOLUMEDOWN,
> +        [238] = NOKEY,
> +        [239] = NOKEY,
> +        [240] = NOKEY,
> +        [241] = NOKEY,
> +        [242] = NOKEY,
> +        [243] = NOKEY,
> +        [244] = NOKEY,
> +        [245] = NOKEY,
> +        [246] = NOKEY,
> +        [247] = NOKEY,
> +        [248] = NOKEY,
> +        [249] = NOKEY,
> +        [250] = NOKEY,
> +        [251] = NOKEY,
> +        [252] = NOKEY,
> +        [253] = KEY_BRIGHTNESSDOWN,
> +        [254] = NOKEY,
> +        [255] = NOKEY,
> +};
> +/*-----------------------------------------------------------------------------
> + * Global variables
> + *---------------------------------------------------------------------------*/
> +
> +struct input_dev *g_qci_keyboard_dev;
> +
> +/* General structure to hold the driver data */
> +struct i2ckbd_drv_data {
> +        struct i2c_client *ki2c_client;
> +        struct work_struct work;
> +        struct input_dev *qcikbd_dev;
> +        unsigned int qcikbd_gpio; /* GPIO used for interrupt */
> +        unsigned int qcikbd_irq;
> +        unsigned int key_down;
> +        unsigned int escape;
> +        unsigned int pause_seq;
> +        unsigned int fn;
> +};
> +#ifdef CONFIG_PM
> +static int qcikbd_suspend(struct device *dev)
> +{
> +        return 0;
> +}
> +
> +static int qcikbd_resume(struct device *dev)
> +{
> +        return 0;
> +}
> +#endif
> +static int __devinit qcikbd_probe(struct i2c_client *client,
> +        const struct i2c_device_id *id);
> +static int __devexit qcikbd_remove(struct i2c_client *kbd);
> +
> +static const struct i2c_device_id qcikbd_idtable[] = {
> +        { KEYBOARD_ID_NAME, 0 },
> +        { }
> +};
> +
> +MODULE_DEVICE_TABLE(i2c, qcikbd_idtable);
> +
> +#ifdef CONFIG_PM
> +static struct dev_pm_ops qcikbd_pm_ops = {
> +        .suspend  = qcikbd_suspend,
> +        .resume   = qcikbd_resume,
> +};
> +#endif
> +static struct i2c_driver i2ckbd_driver = {
> +        .driver = {
> +                .owner = THIS_MODULE,
> +                .name  = KEYBOARD_ID_NAME,
> +#ifdef CONFIG_PM
> +                .pm = &qcikbd_pm_ops,
> +#endif
> +        },
> +        .probe    = qcikbd_probe,
> +        .remove = __devexit_p(qcikbd_remove),
> +        .id_table = qcikbd_idtable,
> +};
> +
> +/*-----------------------------------------------------------------------------
> + * Driver functions
> + *---------------------------------------------------------------------------*/
> +
> +static irqreturn_t qcikbd_interrupt(int irq, void *dev_id)
> +{
> +        struct i2ckbd_drv_data *ikbd_drv_data = dev_id;
> +        schedule_work(&ikbd_drv_data->work);
> +        return IRQ_HANDLED;
> +}
> +
> +static void qcikbd_work_handler(struct work_struct *_work)
> +{
> +        unsigned char scancode;
> +        unsigned int  keycode;
> +
> +        struct i2ckbd_drv_data *ikbd_drv_data =
> +                container_of(_work, struct i2ckbd_drv_data, work);
> +
> +        struct i2c_client *ikbdclient = ikbd_drv_data->ki2c_client;
> +        struct input_dev *ikbdev = ikbd_drv_data->qcikbd_dev;
> +
> +        scancode = i2c_smbus_read_byte(ikbdclient);
> +      printk("   scancode = %x\n", scancode);
> +
> +        if (scancode == 0xFA)
> +        {
> +                return;
> +        } else {
> +                ikbd_drv_data->key_down = 1;
> +                if (scancode & 0x80) {
> +                        ikbd_drv_data->key_down = 0;
> +                }
> +                keycode = on2_keycode[(scancode & 0x7F)];
> +                if (keycode != NOKEY) {
> +
> +                        input_event(ikbdev, EV_MSC, MSC_SCAN, scancode);
> +
> +                        input_report_key(ikbdev,
> +                                         keycode,
> +                                         ikbd_drv_data->key_down);
> +                        input_sync(ikbdev);
> +                }
> +        }
> +}
> +
> +
> +static int qcikbd_open(struct input_dev *dev)
> +{
> +        struct i2ckbd_drv_data *ikbd_drv_data = input_get_drvdata(dev);
> +        struct i2c_client *ikbdclient = ikbd_drv_data->ki2c_client;
> +
> +        /* Send F4h - enable keyboard */
> +        i2c_smbus_write_byte(ikbdclient, KEYBOARD_CMD_ENABLE);
> +        return 0;
> +}
> +
> +static int __devinit qcikbd_probe(struct i2c_client *client,
> +                                    const struct i2c_device_id *id)
> +{
> +        int err;
> +        int i;
> +        struct i2ckbd_drv_data *context;
> +        context = kzalloc(sizeof(struct i2ckbd_drv_data), GFP_KERNEL);
> +        if (!context)
> +                return -ENOMEM;
> +        i2c_set_clientdata(client, context);
> +        context->ki2c_client = client;
> +        context->qcikbd_gpio = client->irq;
> +        client->driver = &i2ckbd_driver;
> +
> +        INIT_WORK(&context->work, qcikbd_work_handler);
> +
> +        err = gpio_request(context->qcikbd_gpio, "qci-kbd");
> +        if (err) {
> +                pr_err("[KBD] err gpio request\n");
> +                goto gpio_request_fail;
> +        }
> +
> +        context->qcikbd_irq = gpio_to_irq(context->qcikbd_gpio);
> +        err = request_irq(context->qcikbd_irq,
> +                          qcikbd_interrupt,
> +                          IRQF_TRIGGER_FALLING,
> +                          KEYBOARD_ID_NAME,
> +                          context);
> +        if (err) {
> +                pr_err("[KBD] err unable to get IRQ\n");
> +                goto request_irq_fail;
> +        }
> +
> +        context->qcikbd_dev = input_allocate_device();
> +        if (!context->qcikbd_dev) {
> +                pr_err("[KBD]allocting memory err\n");
> +                err = -ENOMEM;
> +                goto allocate_fail;
> +        }
> +
> +        context->qcikbd_dev->name       = KEYBOARD_NAME;
> +        context->qcikbd_dev->phys       = KEYBOARD_DEVICE;
> +        context->qcikbd_dev->id.bustype = BUS_I2C;
> +        context->qcikbd_dev->id.vendor  = 0x1050;
> +        context->qcikbd_dev->id.product = 0x0006;
> +        context->qcikbd_dev->id.version = 0x0004;
> +        context->qcikbd_dev->open       = qcikbd_open;
> +        context->qcikbd_dev->evbit[0]   = BIT_MASK(EV_KEY);
> +
> +        /* Enable all supported keys */
> +        for (i = 1; i < ARRAY_SIZE(on2_keycode) ; i++)
> +                set_bit(on2_keycode[i], context->qcikbd_dev->keybit);
> +
> +        set_bit(KEY_POWER, context->qcikbd_dev->keybit);
> +        set_bit(KEY_END, context->qcikbd_dev->keybit);
> +        set_bit(KEY_VOLUMEUP, context->qcikbd_dev->keybit);
> +        set_bit(KEY_VOLUMEDOWN, context->qcikbd_dev->keybit);
> +        set_bit(KEY_ZOOMIN, context->qcikbd_dev->keybit);
> +        set_bit(KEY_ZOOMOUT, context->qcikbd_dev->keybit);
> +
> +        input_set_drvdata(context->qcikbd_dev, context);
> +        err = input_register_device(context->qcikbd_dev);
> +        if (err) {
> +                pr_err("[KBD] err input register device\n");
> +                goto register_fail;
> +        }
> +        g_qci_keyboard_dev = context->qcikbd_dev;
> +	printk("QCI_KBD PROBE\n");
> +        return 0;
> +register_fail:
> +        input_free_device(context->qcikbd_dev);
> +
> +allocate_fail:
> +        free_irq(context->qcikbd_irq, context);
> +
> +request_irq_fail:
> +        gpio_free(context->qcikbd_gpio);
> +
> +gpio_request_fail:
> +        i2c_set_clientdata(client, NULL);
> +        kfree(context);
> +        return err;
> +}
> +
> +static int __devexit qcikbd_remove(struct i2c_client *dev)
> +{
> +        struct i2ckbd_drv_data *context = i2c_get_clientdata(dev);
> +
> +        free_irq(context->qcikbd_irq, context);
> +        gpio_free(context->qcikbd_gpio);
> +        input_free_device(context->qcikbd_dev);
> +        input_unregister_device(context->qcikbd_dev);
> +        kfree(context);
> +
> +        return 0;
> +}
> +
> +static int __init qcikbd_init(void)
> +{
> +        return i2c_add_driver(&i2ckbd_driver);
> +}
> +
> +static void __exit qcikbd_exit(void)
> +{
> +        i2c_del_driver(&i2ckbd_driver);
> +}
> +
> +struct input_dev *nkbc_keypad_get_input_dev(void)
> +{
> +        return g_qci_keyboard_dev;
> +}
> +EXPORT_SYMBOL(nkbc_keypad_get_input_dev);
> +module_init(qcikbd_init);
> +module_exit(qcikbd_exit);
> +
> +MODULE_AUTHOR("Quanta Computer Inc.");
> +MODULE_DESCRIPTION("Quanta Embedded Controller I2C Keyboard Driver");
> +MODULE_LICENSE("GPL v2");
> +
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Dmitry

^ permalink raw reply	[flat|nested] 39+ messages in thread

* RE: [RFC 04/36]  [Driver][Qualcomm 1070][EC_KB] Adding new qci keyboard driver
  2010-07-26  8:30 ` [RFC 04/36] [Driver][Qualcomm 1070][EC_KB] Adding new qci keyboard driver Wayne Lin
  2010-07-26  8:55   ` Dmitry Torokhov
@ 2010-07-26  8:59   ` Datta, Shubhrajyoti
  1 sibling, 0 replies; 39+ messages in thread
From: Datta, Shubhrajyoti @ 2010-07-26  8:59 UTC (permalink / raw)
  To: Wayne Lin, linux-input@vger.kernel.org; +Cc: wayne



> -----Original Message-----
> From: linux-input-owner@vger.kernel.org [mailto:linux-input-
> owner@vger.kernel.org] On Behalf Of Wayne Lin
> Sent: Monday, July 26, 2010 2:00 PM
> To: linux-input@vger.kernel.org
> Cc: wayne
> Subject: [RFC 04/36] [Driver][Qualcomm 1070][EC_KB] Adding new qci
> keyboard driver
>
> From: wayne <wayne.lin@quantatw.com>
>
> ---
>  drivers/input/keyboard/qci_kbd.c | 1101 +++++++++++++++++++--------------
> -----
>  1 files changed, 551 insertions(+), 550 deletions(-)
>
> diff --git a/drivers/input/keyboard/qci_kbd.c
> b/drivers/input/keyboard/qci_kbd.c
> index aa7a64a..0cf2f7e 100755
> --- a/drivers/input/keyboard/qci_kbd.c
> +++ b/drivers/input/keyboard/qci_kbd.c
> @@ -1,550 +1,551 @@
> -/* Quanta I2C Keyboard Driver
> - *
> - * Copyright (C) 2009 Quanta Computer Inc.
> - * Author: Hsin Wu <hsin.wu@quantatw.com>
> - * Author: Austin Lai <austin.lai@quantatw.com>
> - *
> - * This software is licensed under the terms of the GNU General Public
> - * License version 2, as published by the Free Software Foundation, and
> - * may be copied, distributed, and modified under those terms.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - */
> -
> - /*
> - *
> - *  The Driver with I/O communications via the I2C Interface for ON2 of
> AP BU.
> - *  And it is only working on the nuvoTon WPCE775x Embedded Controller.
> - *
> - */
> -
> -#include <linux/kernel.h>
> -#include <linux/init.h>
> -#include <linux/module.h>
> -#include <linux/slab.h>
> -#include <linux/jiffies.h>
> -#include <linux/i2c.h>
> -#include <linux/mutex.h>
> -#include <linux/interrupt.h>
> -#include <linux/input.h>
> -#include <linux/keyboard.h>
> -#include <linux/gpio.h>
> -#include <linux/delay.h>
> -
> -/* Keyboard special scancode */
> -#define RC_KEY_FN          0x70
> -#define RC_KEY_BREAK       0x80
> -#define KEY_ACK_FA      0xFA
> -
> -/* Keyboard keycodes */
> -#define NOKEY           KEY_RESERVED
> -#define KEY_LEFTWIN     KEY_LEFTMETA
> -#define KEY_RIGHTWIN    KEY_RIGHTMETA
> -#define KEY_APPS        KEY_COMPOSE
> -#define KEY_PRINTSCR    KEY_SYSRQ
> -
> -#define KEYBOARD_ID_NAME          "qci-i2ckbd"
> -#define KEYBOARD_NAME                "Quanta Keyboard"
> -#define KEYBOARD_DEVICE             "/i2c/input0"
> -#define KEYBOARD_CMD_ENABLE             0xF4
> -
> -/*-----------------------------------------------------------------------
> ------
> - * Keyboard scancode to linux keycode translation table
> - *-----------------------------------------------------------------------
> ----*/
> -
> -static const unsigned char on2_keycode[256] = {
> -     [0]   = NOKEY,
> -     [1]   = NOKEY,
> -     [2]   = NOKEY,
> -     [3]   = KEY_5,
> -     [4]   = KEY_7,
> -     [5]   = KEY_9,
> -     [6]   = KEY_MINUS,
> -     [7]   = NOKEY,
> -     [8]   = NOKEY,
> -     [9]   = NOKEY,
> -     [10]  = NOKEY,
> -     [11]  = KEY_LEFTBRACE,
> -     [12]  = KEY_F10,
> -     [13]  = KEY_INSERT,
> -     [14]  = KEY_F11,
> -     [15]  = KEY_ESC,
> -     [16]  = NOKEY,
> -     [17]  = NOKEY,
> -     [18]  = NOKEY,
> -     [19]  = KEY_4,
> -     [20]  = KEY_6,
> -     [21]  = KEY_8,
> -     [22]  = KEY_0,
> -     [23]  = KEY_EQUAL,
> -     [24]  = NOKEY,
> -     [25]  = NOKEY,
> -     [26]  = NOKEY,
> -     [27]  = KEY_P,
> -     [28]  = KEY_F9,
> -     [29]  = KEY_DELETE,
> -     [30]  = KEY_F12,
> -     [31]  = KEY_GRAVE,
> -     [32]  = KEY_W,
> -     [33]  = NOKEY,
> -     [34]  = NOKEY,
> -     [35]  = KEY_R,
> -     [36]  = KEY_T,
> -     [37]  = KEY_U,
> -     [38]  = KEY_O,
> -     [39]  = KEY_RIGHTBRACE,
> -     [40]  = NOKEY,
> -     [41]  = NOKEY,
> -     [42]  = NOKEY,
> -     [43]  = KEY_APOSTROPHE,
> -     [44]  = KEY_BACKSPACE,
> -     [45]  = NOKEY,
> -     [46]  = KEY_F8,
> -     [47]  = KEY_F5,
> -     [48]  = KEY_S,
> -     [49]  = NOKEY,
> -     [50]  = NOKEY,
> -     [51]  = KEY_E,
> -     [52]  = KEY_H,
> -     [53]  = KEY_Y,
> -     [54]  = KEY_I,
> -     [55]  = KEY_ENTER,
> -     [56]  = NOKEY,
> -     [57]  = NOKEY,
> -     [58]  = NOKEY,
> -     [59]  = KEY_SEMICOLON,
> -     [60]  = KEY_3,
> -     [61]  = KEY_PAGEUP,
> -     [62]  = KEY_Q,
> -     [63]  = KEY_TAB,
> -     [64]  = KEY_A,
> -     [65]  = NOKEY,
> -     [66]  = NOKEY,
> -     [67]  = KEY_F,
> -     [68]  = KEY_G,
> -     [69]  = KEY_J,
> -     [70]  = KEY_L,
> -     [71]  = NOKEY,
> -     [72]  = KEY_RIGHTSHIFT,
> -     [73]  = NOKEY,
> -     [74]  = NOKEY,
> -     [75]  = KEY_SLASH,
> -     [76]  = KEY_2,
> -     [77]  = KEY_PAGEDOWN,
> -     [78]  = KEY_F4,
> -     [79]  = KEY_F1,
> -     [80]  = KEY_Z,
> -     [81]  = NOKEY,
> -     [82]  = NOKEY,
> -     [83]  = KEY_D,
> -     [84]  = KEY_V,
> -     [85]  = KEY_N,
> -     [86]  = KEY_K,
> -     [87]  = NOKEY,
> -     [88]  = KEY_LEFTSHIFT,
> -     [89]  = KEY_RIGHTCTRL,
> -     [90]  = NOKEY,
> -     [91]  = KEY_DOT,
> -     [92]  = KEY_UP,
> -     [93]  = KEY_RIGHT,
> -     [94]  = KEY_F3,
> -     [95]  = KEY_F2,
> -     [96]  = NOKEY,
> -     [97]  = NOKEY,
> -     [98]  = KEY_RIGHTALT,
> -     [99]  = KEY_X,
> -     [100] = KEY_C,
> -     [101] = KEY_B,
> -     [102] = KEY_COMMA,
> -     [103] = NOKEY,
> -     [104] = NOKEY,
> -     [105] = NOKEY,
> -     [106] = NOKEY,
> -     [107] = NOKEY,
> -     [108] = KEY_PRINTSCR,
> -     [109] = KEY_DOWN,
> -     [110] = KEY_1,
> -     [111] = KEY_CAPSLOCK,
> -     [112] = KEY_F24,
> -     [113] = KEY_HOME,
> -     [114] = KEY_LEFTALT,
> -     [115] = NOKEY,
> -     [116] = KEY_SPACE,
> -     [117] = KEY_BACKSLASH,
> -     [118] = KEY_M,
> -     [119] = KEY_COMPOSE,
> -     [120] = NOKEY,
> -     [121] = KEY_LEFTCTRL,
> -     [122] = NOKEY,
> -     [123] = NOKEY,
> -     [124] = KEY_PAUSE,
> -     [125] = KEY_LEFT,
> -     [126] = KEY_F7,
> -     [127] = KEY_F6,
> -     [128] = NOKEY,
> -     [129] = NOKEY,
> -     [130] = NOKEY,
> -     [131] = NOKEY,
> -     [132] = NOKEY,
> -     [133] = NOKEY,
> -     [134] = NOKEY,
> -     [135] = NOKEY,
> -     [136] = NOKEY,
> -     [137] = NOKEY,
> -     [138] = NOKEY,
> -     [139] = NOKEY,
> -     [140] = NOKEY,
> -     [141] = NOKEY,
> -     [142] = NOKEY,
> -     [143] = NOKEY,
> -     [144] = NOKEY,
> -     [145] = NOKEY,
> -     [146] = NOKEY,
> -     [147] = NOKEY,
> -     [148] = NOKEY,
> -     [149] = NOKEY,
> -     [150] = NOKEY,
> -     [151] = NOKEY,
> -     [152] = NOKEY,
> -     [153] = NOKEY,
> -     [154] = NOKEY,
> -     [155] = NOKEY,
> -     [156] = NOKEY,
> -     [157] = NOKEY,
> -     [158] = NOKEY,
> -     [159] = NOKEY,
> -     [160] = NOKEY,
> -     [161] = NOKEY,
> -     [162] = NOKEY,
> -     [163] = NOKEY,
> -     [164] = NOKEY,
> -     [165] = NOKEY,
> -     [166] = NOKEY,
> -     [167] = NOKEY,
> -     [168] = NOKEY,
> -     [169] = NOKEY,
> -     [170] = NOKEY,
> -     [171] = NOKEY,
> -     [172] = NOKEY,
> -     [173] = NOKEY,
> -     [174] = NOKEY,
> -     [175] = NOKEY,
> -     [176] = NOKEY,
> -     [177] = NOKEY,
> -     [178] = NOKEY,
> -     [179] = NOKEY,
> -     [180] = NOKEY,
> -     [181] = NOKEY,
> -     [182] = NOKEY,
> -     [183] = NOKEY,
> -     [184] = NOKEY,
> -     [185] = NOKEY,
> -     [186] = NOKEY,
> -     [187] = NOKEY,
> -     [188] = NOKEY,
> -     [189] = KEY_HOME,
> -     [190] = NOKEY,
> -     [191] = NOKEY,
> -     [192] = NOKEY,
> -     [193] = NOKEY,
> -     [194] = NOKEY,
> -     [195] = NOKEY,
> -     [196] = NOKEY,
> -     [197] = NOKEY,
> -     [198] = NOKEY,
> -     [199] = NOKEY,
> -     [200] = NOKEY,
> -     [201] = NOKEY,
> -     [202] = NOKEY,
> -     [203] = NOKEY,
> -     [204] = NOKEY,
> -     [205] = KEY_END,
> -     [206] = NOKEY,
> -     [207] = NOKEY,
> -     [208] = NOKEY,
> -     [209] = NOKEY,
> -     [210] = NOKEY,
> -     [211] = NOKEY,
> -     [212] = NOKEY,
> -     [213] = NOKEY,
> -     [214] = NOKEY,
> -     [215] = NOKEY,
> -     [216] = NOKEY,
> -     [217] = NOKEY,
> -     [218] = NOKEY,
> -     [219] = NOKEY,
> -     [220] = KEY_VOLUMEUP,
> -     [221] = KEY_BRIGHTNESSUP,
> -     [222] = NOKEY,
> -     [223] = NOKEY,
> -     [224] = NOKEY,
> -     [225] = NOKEY,
> -     [226] = NOKEY,
> -     [227] = NOKEY,
> -     [228] = NOKEY,
> -     [229] = NOKEY,
> -     [230] = NOKEY,
> -     [231] = NOKEY,
> -     [232] = NOKEY,
> -     [233] = NOKEY,
> -     [234] = NOKEY,
> -     [235] = NOKEY,
> -     [236] = NOKEY,
> -     [237] = KEY_VOLUMEDOWN,
> -     [238] = NOKEY,
> -     [239] = NOKEY,
> -     [240] = NOKEY,
> -     [241] = NOKEY,
> -     [242] = NOKEY,
> -     [243] = NOKEY,
> -     [244] = NOKEY,
> -     [245] = NOKEY,
> -     [246] = NOKEY,
> -     [247] = NOKEY,
> -     [248] = NOKEY,
> -     [249] = NOKEY,
> -     [250] = NOKEY,
> -     [251] = NOKEY,
> -     [252] = NOKEY,
> -     [253] = KEY_BRIGHTNESSDOWN,
> -     [254] = NOKEY,
> -     [255] = NOKEY,
> -};
> -/*-----------------------------------------------------------------------
> ------
> - * Global variables
> - *-----------------------------------------------------------------------
> ----*/
> -
> -struct input_dev *g_qci_keyboard_dev;
> -
> -/* General structure to hold the driver data */
> -struct i2ckbd_drv_data {
> -     struct i2c_client *ki2c_client;
> -     struct work_struct work;
> -     struct input_dev *qcikbd_dev;
> -     unsigned int qcikbd_gpio; /* GPIO used for interrupt */
> -     unsigned int qcikbd_irq;
> -     unsigned int key_down;
> -     unsigned int escape;
> -     unsigned int pause_seq;
> -     unsigned int fn;
> -};
> -#ifdef CONFIG_PM
> -static int qcikbd_suspend(struct device *dev)
> -{
> -     return 0;
> -}
> -
> -static int qcikbd_resume(struct device *dev)
> -{
> -     return 0;
> -}
> -#endif
> -static int __devinit qcikbd_probe(struct i2c_client *client,
> -     const struct i2c_device_id *id);
> -static int __devexit qcikbd_remove(struct i2c_client *kbd);
> -
> -static const struct i2c_device_id qcikbd_idtable[] = {
> -     { KEYBOARD_ID_NAME, 0 },
> -     { }
> -};
> -
> -MODULE_DEVICE_TABLE(i2c, qcikbd_idtable);
> -
> -#ifdef CONFIG_PM
> -static struct dev_pm_ops qcikbd_pm_ops = {
> -     .suspend  = qcikbd_suspend,
> -     .resume   = qcikbd_resume,
> -};
> -#endif
> -static struct i2c_driver i2ckbd_driver = {
> -     .driver = {
> -             .owner = THIS_MODULE,
> -             .name  = KEYBOARD_ID_NAME,
> -#ifdef CONFIG_PM
> -             .pm = &qcikbd_pm_ops,
> -#endif
> -     },
> -     .probe    = qcikbd_probe,
> -     .remove = __devexit_p(qcikbd_remove),
> -     .id_table = qcikbd_idtable,
> -};
> -
> -/*-----------------------------------------------------------------------
> ------
> - * Driver functions
> - *-----------------------------------------------------------------------
> ----*/
> -
> -static irqreturn_t qcikbd_interrupt(int irq, void *dev_id)
> -{
> -     struct i2ckbd_drv_data *ikbd_drv_data = dev_id;
> -     schedule_work(&ikbd_drv_data->work);
> -     return IRQ_HANDLED;
> -}
> -
> -static void qcikbd_work_handler(struct work_struct *_work)
> -{
> -     unsigned char scancode;
> -     unsigned int  keycode;
> -
> -     struct i2ckbd_drv_data *ikbd_drv_data =
> -             container_of(_work, struct i2ckbd_drv_data, work);
> -
> -     struct i2c_client *ikbdclient = ikbd_drv_data->ki2c_client;
> -     struct input_dev *ikbdev = ikbd_drv_data->qcikbd_dev;
> -
> -     scancode = i2c_smbus_read_byte(ikbdclient);
> -
> -     if (scancode == KEY_ACK_FA) {
> -             return;
> -     } else if (scancode == RC_KEY_FN) {
> -             ikbd_drv_data->fn = 0x80;     /* select keycode table  > 0x7F
> */
> -     } else {
> -             ikbd_drv_data->key_down = 1;
> -             if (scancode & RC_KEY_BREAK) {
> -                     ikbd_drv_data->key_down = 0;
> -                     if ((scancode & 0x7F) == RC_KEY_FN)
> -                             ikbd_drv_data->fn = 0;
> -             }
> -             keycode = on2_keycode[(scancode & 0x7F) | ikbd_drv_data->fn];
> -             if (keycode != NOKEY) {
> -                     input_report_key(ikbdev,
> -                                      keycode,
> -                                      ikbd_drv_data->key_down);
> -                     input_sync(ikbdev);
> -             }
> -     }
> -}
> -
> -
> -static int qcikbd_open(struct input_dev *dev)
> -{
> -     struct i2ckbd_drv_data *ikbd_drv_data = input_get_drvdata(dev);
> -     struct i2c_client *ikbdclient = ikbd_drv_data->ki2c_client;
> -
> -     /* Send F4h - enable keyboard */
> -     i2c_smbus_write_byte(ikbdclient, KEYBOARD_CMD_ENABLE);
> -     return 0;
> -}
> -
> -static int __devinit qcikbd_probe(struct i2c_client *client,
> -                                 const struct i2c_device_id *id)
> -{
> -     int err;
> -     int i;
> -     struct i2ckbd_drv_data *context;
> -     context = kzalloc(sizeof(struct i2ckbd_drv_data), GFP_KERNEL);
> -     if (!context)
> -             return -ENOMEM;
> -     i2c_set_clientdata(client, context);
> -     context->ki2c_client = client;
> -     context->qcikbd_gpio = client->irq;
> -     client->driver = &i2ckbd_driver;
> -
> -     INIT_WORK(&context->work, qcikbd_work_handler);
> -
> -     err = gpio_request(context->qcikbd_gpio, "qci-kbd");
> -     if (err) {
> -             pr_err("[KBD] err gpio request\n");
> -             goto gpio_request_fail;
> -     }
> -
> -     context->qcikbd_irq = gpio_to_irq(context->qcikbd_gpio);
> -     err = request_irq(context->qcikbd_irq,
> -                       qcikbd_interrupt,
> -                       IRQF_TRIGGER_FALLING,
> -                       KEYBOARD_ID_NAME,
> -                       context);
> -     if (err) {
> -             pr_err("[KBD] err unable to get IRQ\n");
> -             goto request_irq_fail;
> -     }
> -
> -     context->qcikbd_dev = input_allocate_device();
> -     if (!context->qcikbd_dev) {
> -             pr_err("[KBD]allocting memory err\n");
> -             err = -ENOMEM;
> -             goto allocate_fail;
> -     }
> -
> -     context->qcikbd_dev->name       = KEYBOARD_NAME;
> -     context->qcikbd_dev->phys       = KEYBOARD_DEVICE;
> -     context->qcikbd_dev->id.bustype = BUS_I2C;
> -     context->qcikbd_dev->id.vendor  = 0x1050;
> -     context->qcikbd_dev->id.product = 0x0006;
> -     context->qcikbd_dev->id.version = 0x0004;
> -     context->qcikbd_dev->open       = qcikbd_open;
> -     set_bit(EV_KEY, context->qcikbd_dev->evbit);
> -     set_bit(EV_REP, context->qcikbd_dev->evbit);
> -
> -     /* Enable all supported keys */
> -     for (i = 1; i < ARRAY_SIZE(on2_keycode) ; i++)
> -             set_bit(on2_keycode[i], context->qcikbd_dev->keybit);
> -
> -     set_bit(KEY_POWER, context->qcikbd_dev->keybit);
> -     set_bit(KEY_END, context->qcikbd_dev->keybit);
> -     set_bit(KEY_VOLUMEUP, context->qcikbd_dev->keybit);
> -     set_bit(KEY_VOLUMEDOWN, context->qcikbd_dev->keybit);
> -     set_bit(KEY_ZOOMIN, context->qcikbd_dev->keybit);
> -     set_bit(KEY_ZOOMOUT, context->qcikbd_dev->keybit);
> -
> -     input_set_drvdata(context->qcikbd_dev, context);
> -     err = input_register_device(context->qcikbd_dev);
> -     if (err) {
> -             pr_err("[KBD] err input register device\n");
> -             goto register_fail;
> -     }
> -     g_qci_keyboard_dev = context->qcikbd_dev;
> -     return 0;
> -register_fail:
> -     input_free_device(context->qcikbd_dev);
> -
> -allocate_fail:
> -     free_irq(context->qcikbd_irq, context);
> -
> -request_irq_fail:
> -     gpio_free(context->qcikbd_gpio);
> -
> -gpio_request_fail:
> -     i2c_set_clientdata(client, NULL);
> -     kfree(context);
> -     return err;
> -}
> -
> -static int __devexit qcikbd_remove(struct i2c_client *dev)
> -{
> -     struct i2ckbd_drv_data *context = i2c_get_clientdata(dev);
> -
> -     free_irq(context->qcikbd_irq, context);
> -     gpio_free(context->qcikbd_gpio);
> -     input_free_device(context->qcikbd_dev);
> -     input_unregister_device(context->qcikbd_dev);
> -     kfree(context);
> -
> -     return 0;
> -}
> -
> -static int __init qcikbd_init(void)
> -{
> -     return i2c_add_driver(&i2ckbd_driver);
> -}
> -
> -static void __exit qcikbd_exit(void)
> -{
> -     i2c_del_driver(&i2ckbd_driver);
> -}
> -
> -struct input_dev *nkbc_keypad_get_input_dev(void)
> -{
> -     return g_qci_keyboard_dev;
> -}
> -EXPORT_SYMBOL(nkbc_keypad_get_input_dev);
> -module_init(qcikbd_init);
> -module_exit(qcikbd_exit);
> -
> -MODULE_AUTHOR("Quanta Computer Inc.");
> -MODULE_DESCRIPTION("Quanta Embedded Controller I2C Keyboard Driver");
> -MODULE_LICENSE("GPL v2");
> -
> +/* Quanta I2C Keyboard Driver
> + *
> + * Copyright (C) 2009 Quanta Computer Inc.
> + * Author: Hsin Wu <hsin.wu@quantatw.com>
> + * Author: Austin Lai <austin.lai@quantatw.com>
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + */
> +
> + /*
> + *
> + *  The Driver with I/O communications via the I2C Interface for ON2 of
> AP BU.
> + *  And it is only working on the nuvoTon WPCE775x Embedded Controller.
> + *
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/slab.h>
> +#include <linux/jiffies.h>
> +#include <linux/i2c.h>
> +#include <linux/mutex.h>
> +#include <linux/interrupt.h>
> +#include <linux/input.h>
> +#include <linux/keyboard.h>
> +#include <linux/gpio.h>
> +#include <linux/delay.h>
> +
> +/* Keyboard special scancode */
> +#define RC_KEY_FN          0x70
> +#define RC_KEY_BREAK       0x80
> +#define KEY_ACK_FA      0xFA
> +
> +/* Keyboard keycodes */
> +#define NOKEY           KEY_RESERVED
> +#define KEY_LEFTWIN     KEY_LEFTMETA
> +#define KEY_RIGHTWIN    KEY_RIGHTMETA
> +#define KEY_APPS        KEY_COMPOSE
> +#define KEY_PRINTSCR    KEY_SYSRQ
> +
> +#define KEYBOARD_ID_NAME          "qci-i2ckbd"
> +#define KEYBOARD_NAME                "Quanta Keyboard"
> +#define KEYBOARD_DEVICE             "/i2c/input0"
> +#define KEYBOARD_CMD_ENABLE             0xF4
> +
> +/*-----------------------------------------------------------------------
> ------
> + * Keyboard scancode to linux keycode translation table
> + *-----------------------------------------------------------------------
> ----*/
> +
> +static const unsigned char on2_keycode[256] = {
> +        [0]   = KEY_RESERVED,
> +        [1]   = KEY_ESC,
> +        [2]   = KEY_1,
> +        [3]   = KEY_2,
> +        [4]   = KEY_3,
> +        [5]   = KEY_4,
> +        [6]   = KEY_5,
> +        [7]   = KEY_6,
> +        [8]   = KEY_7,
> +        [9]   = KEY_8,
> +        [10]  = KEY_9,
> +        [11]  = KEY_0,
> +        [12]  = KEY_MINUS,
> +        [13]  = KEY_EQUAL,
> +        [14]  = KEY_BACKSPACE,
> +        [15]  = KEY_TAB,
> +        [16]  = KEY_Q,
> +        [17]  = KEY_W,
> +        [18]  = KEY_E,
> +        [19]  = KEY_R,
> +        [20]  = KEY_T,
> +        [21]  = KEY_Y,
> +        [22]  = KEY_U,
> +        [23]  = KEY_I,
> +        [24]  = KEY_O,
> +        [25]  = KEY_P,
> +        [26]  = KEY_LEFTBRACE,
> +        [27]  = KEY_RIGHTBRACE,
> +        [28]  = KEY_ENTER,
> +        [29]  = KEY_LEFTCTRL,
> +        [30]  = KEY_A,
> +        [31]  = KEY_S,
> +        [32]  = KEY_D,
> +        [33]  = KEY_F,
> +        [34]  = KEY_G,
> +        [35]  = KEY_H,
> +        [36]  = KEY_J,
> +        [37]  = KEY_K,
> +        [38]  = KEY_L,
> +        [39]  = KEY_SEMICOLON,
> +        [40]  = KEY_APOSTROPHE,
> +        [41]  = KEY_GRAVE,
> +        [42]  = KEY_LEFTSHIFT,
> +        [43]  = KEY_BACKSLASH,
> +        [44]  = KEY_Z,
> +        [45]  = KEY_X,
> +        [46]  = KEY_C,
> +        [47]  = KEY_V,
> +        [48]  = KEY_B,
> +        [49]  = KEY_N,
> +        [50]  = KEY_M,
> +        [51]  = KEY_COMMA,
> +        [52]  = KEY_DOT,
> +        [53]  = KEY_SLASH,
> +        [54]  = KEY_RIGHTSHIFT,
> +        [55]  = KEY_KPASTERISK,
> +        [56]  = KEY_LEFTALT,
> +        [57]  = KEY_SPACE,
> +        [58]  = KEY_CAPSLOCK,
> +        [59]  = KEY_F1,
> +        [60]  = KEY_F2,
> +        [61]  = KEY_F3,
> +        [62]  = KEY_F4,
> +        [63]  = KEY_F5,
> +        [64]  = KEY_F6,
> +        [65]  = KEY_F7,
> +        [66]  = KEY_F8,
> +        [67]  = KEY_F9,
> +        [68]  = KEY_F10,
> +        [69]  = KEY_NUMLOCK,
> +        [70]  = KEY_SCROLLLOCK,
> +        [71]  = KEY_KP7,
> +        [72]  = KEY_KP8,
> +        [73]  = KEY_KP9,
> +        [74]  = KEY_KPMINUS,
> +        [75]  = KEY_KP4,
> +        [76]  = KEY_KP5,
> +        [77]  = KEY_KP6,
> +        [78]  = KEY_KPPLUS,
> +        [79]  = KEY_KP1,
> +        [80]  = KEY_KP2,
> +        [81]  = KEY_KP3,
> +        [82]  = KEY_KP0,
> +        [83]  = KEY_KPDOT,
> +        [84]  = KEY_RESERVED,
> +        [85]  = KEY_ZENKAKUHANKAKU,
> +        [86]  = KEY_102ND,
> +        [87]  = KEY_F11,
> +        [88]  = KEY_F12,
> +        [89]  = KEY_RO,
> +        [90]  = KEY_KATAKANA,
> +        [91]  = KEY_HIRAGANA,
> +        [92]  = KEY_HENKAN,
> +        [93]  = KEY_KATAKANAHIRAGANA,
> +        [94]  = KEY_MUHENKAN,
> +        [95]  = KEY_KPJPCOMMA,
> +        [96]  = KEY_KPENTER,
> +        [97]  = KEY_RIGHTCTRL,
> +        [98]  = KEY_KPSLASH,
> +        [99]  = KEY_SYSRQ,
> +        [100] = KEY_RIGHTALT,
> +        [101] = KEY_LINEFEED,
> +        [102] = KEY_HOME,
> +        [103] = KEY_UP,
> +        [104] = KEY_PAGEUP,
> +        [105] = KEY_LEFT,
> +        [106] = KEY_RIGHT,
> +        [107] = KEY_END,
> +        [108] = KEY_DOWN,
> +        [109] = KEY_PAGEDOWN,
> +        [110] = KEY_INSERT,
> +        [111] = KEY_DELETE,
> +        [112] = KEY_MACRO,
> +        [113] = KEY_MUTE,
> +        [114] = KEY_VOLUMEDOWN,
> +        [115] = KEY_VOLUMEUP,
> +        [116] = KEY_POWER,
> +        [117] = KEY_KPEQUAL,
> +        [118] = KEY_KPPLUSMINUS,
> +        [119] = KEY_PAUSE,
> +        [120] = KEY_SCALE,
> +        [121] = KEY_KPCOMMA,
> +        [122] = KEY_HANGEUL,
> +        [123] = KEY_HANGUEL,
> +        [124] = KEY_HANJA,
> +        [125] = KEY_YEN,
> +        [126] = KEY_LEFTMETA,
> +        [127] = KEY_RIGHTMETA,
> +        [128] = KEY_COMPOSE,
> +        [129] = NOKEY,
> +        [130] = NOKEY,
> +        [131] = NOKEY,
> +        [132] = NOKEY,
> +        [133] = NOKEY,
> +        [134] = NOKEY,
> +        [135] = NOKEY,
> +        [136] = NOKEY,
> +        [137] = NOKEY,
> +        [138] = NOKEY,
> +        [139] = NOKEY,
> +        [140] = NOKEY,
> +        [141] = NOKEY,
> +        [142] = NOKEY,
> +        [143] = NOKEY,
> +        [144] = NOKEY,
> +        [145] = NOKEY,
> +        [146] = NOKEY,
> +        [147] = NOKEY,
> +        [148] = NOKEY,
> +        [149] = NOKEY,
> +        [150] = NOKEY,
> +        [151] = NOKEY,
> +        [152] = NOKEY,
> +        [153] = NOKEY,
> +        [154] = NOKEY,
> +        [155] = NOKEY,
> +        [156] = NOKEY,
> +        [157] = NOKEY,
> +        [158] = NOKEY,
> +        [159] = NOKEY,
> +        [160] = NOKEY,
> +        [161] = NOKEY,
> +        [162] = NOKEY,
> +        [163] = NOKEY,
> +        [164] = NOKEY,
> +        [165] = NOKEY,
> +        [166] = NOKEY,
> +        [167] = NOKEY,
> +        [168] = NOKEY,
> +        [169] = NOKEY,
> +        [170] = NOKEY,
> +        [171] = NOKEY,
> +        [172] = NOKEY,
> +        [173] = NOKEY,
> +        [174] = NOKEY,
> +        [175] = NOKEY,
> +        [176] = NOKEY,
> +        [177] = NOKEY,
> +        [178] = NOKEY,
> +        [179] = NOKEY,
> +        [180] = NOKEY,
> +        [181] = NOKEY,
> +        [182] = NOKEY,
> +        [183] = NOKEY,
> +        [184] = NOKEY,
> +        [185] = NOKEY,
> +        [186] = NOKEY,
> +        [187] = NOKEY,
> +        [188] = NOKEY,
> +        [189] = KEY_HOME,
> +        [190] = NOKEY,
> +        [191] = NOKEY,
> +        [192] = NOKEY,
> +        [193] = NOKEY,
> +        [194] = NOKEY,
> +        [195] = NOKEY,
> +        [196] = NOKEY,
> +        [197] = NOKEY,
> +        [198] = NOKEY,
> +        [199] = NOKEY,
> +        [200] = NOKEY,
> +        [201] = NOKEY,
> +        [202] = NOKEY,
> +        [203] = NOKEY,
> +        [204] = NOKEY,
> +        [205] = KEY_END,
> +        [206] = NOKEY,
> +        [207] = NOKEY,
> +        [208] = NOKEY,
> +        [209] = NOKEY,
> +        [210] = NOKEY,
> +        [211] = NOKEY,
> +        [212] = NOKEY,
> +        [213] = NOKEY,
> +        [214] = NOKEY,
> +        [215] = NOKEY,
> +        [216] = NOKEY,
> +        [217] = NOKEY,
> +        [218] = NOKEY,
> +        [219] = NOKEY,
> +        [220] = KEY_VOLUMEUP,
> +        [221] = KEY_BRIGHTNESSUP,
> +        [222] = NOKEY,
> +        [223] = NOKEY,
> +        [224] = NOKEY,
> +        [225] = NOKEY,
> +        [226] = NOKEY,
> +        [227] = NOKEY,
> +        [228] = NOKEY,
> +        [229] = NOKEY,
> +        [230] = NOKEY,
> +        [231] = NOKEY,
> +        [232] = NOKEY,
> +        [233] = NOKEY,
> +        [234] = NOKEY,
> +        [235] = NOKEY,
> +        [236] = NOKEY,
> +        [237] = KEY_VOLUMEDOWN,
> +        [238] = NOKEY,
> +        [239] = NOKEY,
> +        [240] = NOKEY,
> +        [241] = NOKEY,
> +        [242] = NOKEY,
> +        [243] = NOKEY,
> +        [244] = NOKEY,
> +        [245] = NOKEY,
> +        [246] = NOKEY,
> +        [247] = NOKEY,
> +        [248] = NOKEY,
> +        [249] = NOKEY,
> +        [250] = NOKEY,
> +        [251] = NOKEY,
> +        [252] = NOKEY,
> +        [253] = KEY_BRIGHTNESSDOWN,
> +        [254] = NOKEY,
> +        [255] = NOKEY,
> +};
> +/*-----------------------------------------------------------------------
> ------
> + * Global variables
> + *-----------------------------------------------------------------------
> ----*/
> +
> +struct input_dev *g_qci_keyboard_dev;
> +
> +/* General structure to hold the driver data */
> +struct i2ckbd_drv_data {
> +        struct i2c_client *ki2c_client;
> +        struct work_struct work;
> +        struct input_dev *qcikbd_dev;
> +        unsigned int qcikbd_gpio; /* GPIO used for interrupt */
> +        unsigned int qcikbd_irq;
> +        unsigned int key_down;
> +        unsigned int escape;
> +        unsigned int pause_seq;
> +        unsigned int fn;
> +};
> +#ifdef CONFIG_PM
> +static int qcikbd_suspend(struct device *dev)
> +{
> +        return 0;
> +}
> +
> +static int qcikbd_resume(struct device *dev)
> +{
> +        return 0;
> +}
If the functions are empty you may consider adding later

> +#endif
> +static int __devinit qcikbd_probe(struct i2c_client *client,
> +        const struct i2c_device_id *id);
> +static int __devexit qcikbd_remove(struct i2c_client *kbd);
> +
> +static const struct i2c_device_id qcikbd_idtable[] = {
> +        { KEYBOARD_ID_NAME, 0 },
> +        { }
> +};
> +
> +MODULE_DEVICE_TABLE(i2c, qcikbd_idtable);
> +
> +#ifdef CONFIG_PM
> +static struct dev_pm_ops qcikbd_pm_ops = {
> +        .suspend  = qcikbd_suspend,
> +        .resume   = qcikbd_resume,
> +};
> +#endif
> +static struct i2c_driver i2ckbd_driver = {
> +        .driver = {
> +                .owner = THIS_MODULE,
> +                .name  = KEYBOARD_ID_NAME,
> +#ifdef CONFIG_PM
> +                .pm = &qcikbd_pm_ops,
> +#endif
> +        },
> +        .probe    = qcikbd_probe,
> +        .remove = __devexit_p(qcikbd_remove),
> +        .id_table = qcikbd_idtable,
> +};
> +
> +/*-----------------------------------------------------------------------
> ------
> + * Driver functions
> + *-----------------------------------------------------------------------
> ----*/
> +
> +static irqreturn_t qcikbd_interrupt(int irq, void *dev_id)
> +{
> +        struct i2ckbd_drv_data *ikbd_drv_data = dev_id;
> +        schedule_work(&ikbd_drv_data->work);
> +        return IRQ_HANDLED;
> +}
> +
> +static void qcikbd_work_handler(struct work_struct *_work)
> +{
> +        unsigned char scancode;
> +        unsigned int  keycode;
> +
> +        struct i2ckbd_drv_data *ikbd_drv_data =
> +                container_of(_work, struct i2ckbd_drv_data, work);
> +
> +        struct i2c_client *ikbdclient = ikbd_drv_data->ki2c_client;
> +        struct input_dev *ikbdev = ikbd_drv_data->qcikbd_dev;
> +
> +        scancode = i2c_smbus_read_byte(ikbdclient);
> +      printk("   scancode = %x\n", scancode);


May consider use and KERN_XXX ? or may be pr_xx func

> +
> +        if (scancode == 0xFA)
> +        {
> +                return;
> +        } else {
> +                ikbd_drv_data->key_down = 1;
> +                if (scancode & 0x80) {
> +                        ikbd_drv_data->key_down = 0;
> +                }
> +                keycode = on2_keycode[(scancode & 0x7F)];
> +                if (keycode != NOKEY) {
> +
> +                        input_event(ikbdev, EV_MSC, MSC_SCAN, scancode);
> +
> +                        input_report_key(ikbdev,
> +                                         keycode,
> +                                         ikbd_drv_data->key_down);
> +                        input_sync(ikbdev);
> +                }
> +        }
> +}
> +
> +
> +static int qcikbd_open(struct input_dev *dev)
> +{
> +        struct i2ckbd_drv_data *ikbd_drv_data = input_get_drvdata(dev);
> +        struct i2c_client *ikbdclient = ikbd_drv_data->ki2c_client;
> +
> +        /* Send F4h - enable keyboard */
> +        i2c_smbus_write_byte(ikbdclient, KEYBOARD_CMD_ENABLE);
You may want to see the return val of the write? Else the return 0 may be misleading.

> +        return 0;
> +}
> +
> +static int __devinit qcikbd_probe(struct i2c_client *client,
> +                                    const struct i2c_device_id *id)
> +{
> +        int err;
> +        int i;
> +        struct i2ckbd_drv_data *context;
> +        context = kzalloc(sizeof(struct i2ckbd_drv_data), GFP_KERNEL);
> +        if (!context)
> +                return -ENOMEM;
> +        i2c_set_clientdata(client, context);
> +        context->ki2c_client = client;
> +        context->qcikbd_gpio = client->irq;
> +        client->driver = &i2ckbd_driver;
> +
> +        INIT_WORK(&context->work, qcikbd_work_handler);
> +
> +        err = gpio_request(context->qcikbd_gpio, "qci-kbd");
> +        if (err) {
> +                pr_err("[KBD] err gpio request\n");
> +                goto gpio_request_fail;
> +        }
> +
> +        context->qcikbd_irq = gpio_to_irq(context->qcikbd_gpio);
> +        err = request_irq(context->qcikbd_irq,
> +                          qcikbd_interrupt,
> +                          IRQF_TRIGGER_FALLING,
> +                          KEYBOARD_ID_NAME,
> +                          context);
> +        if (err) {
> +                pr_err("[KBD] err unable to get IRQ\n");
> +                goto request_irq_fail;
> +        }
> +
> +        context->qcikbd_dev = input_allocate_device();
> +        if (!context->qcikbd_dev) {
> +                pr_err("[KBD]allocting memory err\n");
> +                err = -ENOMEM;
> +                goto allocate_fail;
> +        }
> +
> +        context->qcikbd_dev->name       = KEYBOARD_NAME;
> +        context->qcikbd_dev->phys       = KEYBOARD_DEVICE;
> +        context->qcikbd_dev->id.bustype = BUS_I2C;
> +        context->qcikbd_dev->id.vendor  = 0x1050;
> +        context->qcikbd_dev->id.product = 0x0006;
> +        context->qcikbd_dev->id.version = 0x0004;
> +        context->qcikbd_dev->open       = qcikbd_open;
> +        context->qcikbd_dev->evbit[0]   = BIT_MASK(EV_KEY);
> +
> +        /* Enable all supported keys */
> +        for (i = 1; i < ARRAY_SIZE(on2_keycode) ; i++)
> +                set_bit(on2_keycode[i], context->qcikbd_dev->keybit);
> +
> +        set_bit(KEY_POWER, context->qcikbd_dev->keybit);
> +        set_bit(KEY_END, context->qcikbd_dev->keybit);
> +        set_bit(KEY_VOLUMEUP, context->qcikbd_dev->keybit);
> +        set_bit(KEY_VOLUMEDOWN, context->qcikbd_dev->keybit);
> +        set_bit(KEY_ZOOMIN, context->qcikbd_dev->keybit);
> +        set_bit(KEY_ZOOMOUT, context->qcikbd_dev->keybit);
> +
> +        input_set_drvdata(context->qcikbd_dev, context);
> +        err = input_register_device(context->qcikbd_dev);
> +        if (err) {
> +                pr_err("[KBD] err input register device\n");
> +                goto register_fail;
> +        }
> +        g_qci_keyboard_dev = context->qcikbd_dev;
> +     printk("QCI_KBD PROBE\n");
> +        return 0;
> +register_fail:
> +        input_free_device(context->qcikbd_dev);
> +
> +allocate_fail:
> +        free_irq(context->qcikbd_irq, context);
> +
> +request_irq_fail:
> +        gpio_free(context->qcikbd_gpio);
> +
> +gpio_request_fail:
> +        i2c_set_clientdata(client, NULL);
> +        kfree(context);
> +        return err;
> +}
> +
> +static int __devexit qcikbd_remove(struct i2c_client *dev)
> +{
> +        struct i2ckbd_drv_data *context = i2c_get_clientdata(dev);
> +
> +        free_irq(context->qcikbd_irq, context);
> +        gpio_free(context->qcikbd_gpio);
> +        input_free_device(context->qcikbd_dev);
> +        input_unregister_device(context->qcikbd_dev);
Free and then unregister ? Is it safe?


> +        kfree(context);
> +
> +        return 0;
> +}
> +
> +static int __init qcikbd_init(void)
> +{
> +        return i2c_add_driver(&i2ckbd_driver);
> +}
> +
> +static void __exit qcikbd_exit(void)
> +{
> +        i2c_del_driver(&i2ckbd_driver);
> +}
> +
> +struct input_dev *nkbc_keypad_get_input_dev(void)
> +{
> +        return g_qci_keyboard_dev;
> +}
> +EXPORT_SYMBOL(nkbc_keypad_get_input_dev);
> +module_init(qcikbd_init);
> +module_exit(qcikbd_exit);
> +
> +MODULE_AUTHOR("Quanta Computer Inc.");
> +MODULE_DESCRIPTION("Quanta Embedded Controller I2C Keyboard Driver");
> +MODULE_LICENSE("GPL v2");
> +
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 39+ messages in thread

* Re: [RFC 04/36]  [Driver][Qualcomm 1070][EC_KB] Adding new qci keyboard driver
  2010-07-26  8:55   ` Dmitry Torokhov
@ 2010-07-26 11:16     ` Trilok Soni
  0 siblings, 0 replies; 39+ messages in thread
From: Trilok Soni @ 2010-07-26 11:16 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Wayne Lin, linux-input, wayne

Hi Dmitry,

On 7/26/2010 2:25 PM, Dmitry Torokhov wrote:
> On Mon, Jul 26, 2010 at 04:30:13PM +0800, Wayne Lin wrote:
>> From: wayne <wayne.lin@quantatw.com>
>>
> 
> - Change log?
> - run through checkpatch.pl
> - Get rid of debug printks (or convert to dev_dbg)?
> - use dev_XXX instrad of pr_xxx when you have device? Get rig
> - I have seen lots of time people trying to call input_free_device
>   after calling input_unregister_device (which is forbidden,
>   input_unregister_device is sufficient alone) but you are the first to
>   call free _before_ unregister.
> - No need to initialize keymap with zeroes (NOKEYS)
> - threaded IRQ
> - copy keymap into device and set keycode, keycodemax, keycodesize so
>   that keymap can be adjusted from userspace
> - why do you export input device?
> 
> I dont think you tried applying this patch... At least I do not have
> qci_kbd.c in my tree so it would not apply.
> 

I think whole series needs a refresh as you had mentioned in the another email. No
point in reviewing this series, because Wayne needs to post only driver part here,
if he has some mach-msm bits, then they should go through Daniel Walker.

---Trilok Soni

-- 
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2010-07-26 11:16 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-26  8:30 [RFC 01/36] [Driver][Qualcomm 1070][LCD] Resolve the booting to Chromium issue Wayne Lin
2010-07-26  8:30 ` [RFC 02/36] [Driver][Qualcomm 1070][USB] Register GPIO#109 for USB analog switch configuration Wayne Lin
2010-07-26  8:30 ` [RFC 04/36] [Driver][Qualcomm 1070][EC_KB] Adding new qci keyboard driver Wayne Lin
2010-07-26  8:55   ` Dmitry Torokhov
2010-07-26 11:16     ` Trilok Soni
2010-07-26  8:59   ` Datta, Shubhrajyoti
2010-07-26  8:30 ` [RFC 05/36] [Driver][Qualcomm 1070][TPM] Enable TPM module Wayne Lin
2010-07-26  8:30 ` [RFC 06/36] [Driver][Qualcomm 1070][EC_BRG] EC Bridge driver porting Wayne Lin
2010-07-26  8:30 ` [RFC 07/36] [Driver][Qualcomm 1070][EC_BRG] Enable EC Bridge Wayne Lin
2010-07-26  8:30 ` [RFC 08/36] [Driver][Qualcomm 1070][EC_BAT] EC battery driver porting Wayne Lin
2010-07-26  8:30 ` [RFC 09/36] [Driver][Qualcomm 1070][EC_BAT] Enable EC battery Wayne Lin
2010-07-26  8:30 ` [RFC 11/36] [Driver][Qualcomm 1070][EC_G_SENSOR] Enable EC gravitation sensor Wayne Lin
2010-07-26  8:30 ` [RFC 12/36] [Driver][Qualcomm 1070][EC_C_SENSOR] EC compass sensor driver porting Wayne Lin
2010-07-26  8:30 ` [RFC 13/36] [Driver][Qualcomm 1070][EC_C_SENSOR] Enable EC compass sensor driver Wayne Lin
2010-07-26  8:30 ` [RFC 14/36] [Driver][Qualcomm 1070][CLOCK] Modify the AXI bus speed Wayne Lin
2010-07-26  8:30 ` [RFC 15/36] [Driver][Qualcomm 1070][VERSION] Adding version definition Wayne Lin
2010-07-26  8:30 ` [RFC 17/36] [Driver][Qualcomm 1070][WIFI/BT] Enable Athros WIFI driver Wayne Lin
2010-07-26  8:30 ` [RFC 18/36] [Driver][Qualcomm 1070][WIFI] Turn on the Athros WIFI power Wayne Lin
2010-07-26  8:30 ` [RFC 19/36] [Driver][Qualcomm 1070][BT] Enable Athros BT driver Wayne Lin
2010-07-26  8:30 ` [RFC 20/36] [Driver][Qualcomm 1070][WIFI/BT] Enable MMC1 dummy send read and configure Athros WIFI build-in driver Wayne Lin
2010-07-26  8:30 ` [RFC 21/36] Revert " [Driver][Qualcomm 1070][CLOCK] Modify the AXI bus speed" Wayne Lin
2010-07-26  8:46   ` Dmitry Torokhov
2010-07-26  8:30 ` [RFC 22/36] [Driver][Qualcomm 1070][CLOCK] Modify the AXI bus maximum speed Wayne Lin
2010-07-26  8:30 ` [RFC 23/36] [Driver][Qualcomm 1065][AT_COMMAND]retrieve message Wayne Lin
2010-07-26  8:30 ` [RFC 24/36] [Driver][Qualcomm 1070][CLOCK] Modify the AXI clock for 1.2Ghz Wayne Lin
2010-07-26  8:30 ` [RFC 25/36] [Driver][Qualcomm 1070][EC_BRG] Adding new EC bridge driver Wayne Lin
2010-07-26  8:30 ` [RFC 26/36] [Driver][Qualcomm 1070][EC_BL] New EC backlight driver porting Wayne Lin
2010-07-26  8:30 ` [RFC 27/36] [Driver][Qualcomm 1070][EC_BRG] Enable NuvoTon WPCE775X driver and disable WinBond WPCE775X driver Wayne Lin
2010-07-26  8:30 ` [RFC 28/36] [Driver][Qualcomm 1070][EC_BL] Enable QCI backlight driver Wayne Lin
2010-07-26  8:30 ` [RFC 29/36] [Driver][Qualcomm 1070][EC_BRG] Correct new EC bridge driver Makefile and Kconfig Wayne Lin
2010-07-26  8:30 ` [RFC 30/36] [Driver][Qualcomm 1070][EC_G_SENSOR] Enable EC gravitation sensor Wayne Lin
2010-07-26  8:30 ` [RFC 31/36] [Driver][Qualcomm 1070][VERSION] 0.1.1 Wayne Lin
2010-07-26  8:30 ` [RFC 32/36] [Driver][Qualcomm 1070][MMC] Enable MMC1 HW detection Wayne Lin
2010-07-26  8:30 ` [RFC 33/36] [Driver][Qualcomm 1070][VERSION] 0.1.2 Wayne Lin
2010-07-26  8:30 ` [RFC 34/36] [Driver][Qualcomm 1070][EC_BAT] Adding newer version battery driver Wayne Lin
2010-07-26  8:30 ` [RFC 35/36] [Driver][Qualcomm 1070][EC_BAT] Enable EC battery Wayne Lin
2010-07-26  8:30 ` [RFC 36/36] [Driver][Qualcomm 1070][VERSION] 0.2.0 Wayne Lin
2010-07-26  8:40   ` Premi, Sanjeev
2010-07-26  8:47   ` Premi, Sanjeev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).