nCDK platform configuration for APDS990X ALS and proximity sensors
Signed-off-by: Eric Lighthart <[email protected]>
---
Version 2 of patch; address checkpatch errors.
arch/x86/kernel/mrst.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
Index: linux-2.6.35/arch/x86/kernel/mrst.c
===================================================================
--- linux-2.6.35.orig/arch/x86/kernel/mrst.c
+++ linux-2.6.35/arch/x86/kernel/mrst.c
@@ -32,6 +32,7 @@
#include <linux/i2c/pca953x.h>
#include <linux/lis3lv02d.h>
#include <linux/i2c/tc35894xbg.h>
+#include <linux/i2c/apds990x.h>
#include <linux/bh1770glc.h>
#include <linux/leds-lp5523.h>
@@ -846,6 +847,59 @@ void *lp5523_platform_data_init(void *in
return &pdata;
}
+#define QPDST900_GPIO_INT "bh1770glc_int"
+static int qpds900_intr_pin;
+
+static int qpdst900_setup_resources(void)
+{
+ __u16 addr = 0x00D7; /* MSIC VPROG2 Control Register */
+ __u8 data = 0xFF; /* On always; 2.8V */
+ int ret;
+
+ ret = gpio_request(qpds900_intr_pin, "QPDS-T900 IRQ");
+ if (ret < 0) {
+ printk(KERN_ERR "Request for GPIO%d (QPDS-T900 IRQ), err=%d\n",
+ qpds900_intr_pin, ret);
+ return ret;
+ }
+
+ /* Turn on power (VPROG2) to the ALS/Prox sensor chip */
+ ret = intel_scu_ipc_iowrite8(addr, data);
+ if (ret != 0) {
+ printk(KERN_ERR "Could not turn on VAUX2, erro = %d\n", ret);
+ return ret;
+ }
+ /* Driver implements a suitable power-on delay; no need to wait here */
+ return 0;
+}
+
+static int qpdst900_release_resources(void)
+{
+ gpio_free(qpds900_intr_pin);
+ /* Do not turn off power; VPROG2 shared by multiple devices */
+ return 0;
+}
+
+static void *qpdst900_platform_data_init(void *info)
+{
+ static struct apds990x_platform_data prox_pdata = {
+ .cf = {},
+ .pdrive = APDS_IRLED_CURR_50mA,
+ .setup_resources = qpdst900_setup_resources,
+ .release_resources = qpdst900_release_resources,
+ };
+ struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
+
+ printk(KERN_DEBUG "Intialize QPDST900 platform data\n");
+ qpds900_intr_pin = get_gpio_by_name(QPDST900_GPIO_INT);
+ if (qpds900_intr_pin < 0) {
+ printk(KERN_ERR "ERROR: No IRQ pin for QPDST900 given in
SFI\n");
+ return NULL;
+ }
+ i2c_info->irq = qpds900_intr_pin + MRST_IRQ_OFFSET;
+ return &prox_pdata;
+}
+
static void tc35894xbg_reset_ctrl(struct i2c_client *client, int value)
{
struct tc35894xbg_platform_data *pdata = client->dev.platform_data;
@@ -1056,6 +1110,7 @@ static const struct devs_id device_ids[]
{"i2c_TC35894-nEB1", SFI_DEV_TYPE_I2C, 0, &tc35894xbg_n_platform_data},
{"i2c_TC35894-i", SFI_DEV_TYPE_I2C, 0, &tc35894xbg_i_platform_data},
{"bh1770glc", SFI_DEV_TYPE_I2C, 0, &bh1770glc_platform_data_init},
+ {"qpdst900", SFI_DEV_TYPE_I2C, 1, &qpdst900_platform_data_init},
{"lp5523", SFI_DEV_TYPE_I2C, 0, &lp5523_platform_data_init},
{},
};
_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel