From 8f4c018e5641ecd6a4c68819567c2cd19beaf162 Mon Sep 17 00:00:00 2001 From: Markinus Date: Sat, 4 Sep 2010 21:14:51 +0200 Subject: [PATCH] htcleo: add microp files Add missing files from last microp commit and drivers for leds --- arch/arm/configs/htcleo_defconfig | 3 +- arch/arm/mach-msm/Makefile | 3 +- arch/arm/mach-msm/board-htcleo-bkl.c | 133 +++- arch/arm/mach-msm/board-htcleo-leds.c | 369 +++++++++ arch/arm/mach-msm/board-htcleo-microp.c | 750 +++++++++++++++++- arch/arm/mach-msm/board-htcleo-proximity.c | 8 +- arch/arm/mach-msm/board-htcleo.c | 54 +- arch/arm/mach-msm/htc_headset_gpio.c | 42 +- .../arm/mach-msm/include/mach/atmega_microp.h | 2 + .../include/mach/board-htcleo-microp.h | 26 - drivers/misc/Kconfig | 1 - 11 files changed, 1262 insertions(+), 129 deletions(-) create mode 100644 arch/arm/mach-msm/board-htcleo-leds.c diff --git a/arch/arm/configs/htcleo_defconfig b/arch/arm/configs/htcleo_defconfig index 1cf84c47..65a215b7 100644 --- a/arch/arm/configs/htcleo_defconfig +++ b/arch/arm/configs/htcleo_defconfig @@ -222,7 +222,7 @@ CONFIG_HTC_HEADSET_GPIO=y # MSM Board Type # CONFIG_AAT1271_FLASHLIGHT=y -CONFIG_MICROP_COMMON=y +# CONFIG_MICROP_COMMON is not set CONFIG_MACH_HTCLEO=y # CONFIG_MACH_SWORDFISH is not set # CONFIG_MACH_MAHIMAHI is not set @@ -861,6 +861,7 @@ CONFIG_UID_STAT=y CONFIG_APANIC=y CONFIG_APANIC_PLABEL="kpanic" # CONFIG_C2PORT is not set +CONFIG_SENSORS_BMA150_SPI=y # # EEPROM support diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile index 4e82190f..442f0726 100644 --- a/arch/arm/mach-msm/Makefile +++ b/arch/arm/mach-msm/Makefile @@ -118,7 +118,8 @@ obj-$(CONFIG_MACH_HTCLEO) += board-htcleo.o board-htcleo-spi.o board-htcleo-pane obj-$(CONFIG_MACH_HTCLEO) += board-htcleo-ts.o board-htcleo-mmc.o ieee754-df.o board-htcleo-power.o obj-$(CONFIG_MACH_HTCLEO) += board-htcleo-battery.o board-htcleo-log.o board-htcleo-audio.o board-htcleo-acoustic.o -obj-$(CONFIG_MACH_HTCLEO) += board-htcleo-bt.o board-htcleo-microp.o board-htcleo-wifi.o +obj-$(CONFIG_MACH_HTCLEO) += board-htcleo-bt.o board-htcleo-wifi.o board-htcleo-microp.o board-htcleo-bkl.o +obj-$(CONFIG_MACH_HTCLEO) += board-htcleo-proximity.o board-htcleo-leds.o obj-$(CONFIG_MACH_HTCLEO) += clock-wince.o # MSM7x30 boards diff --git a/arch/arm/mach-msm/board-htcleo-bkl.c b/arch/arm/mach-msm/board-htcleo-bkl.c index ed9552fa..6000e346 100644 --- a/arch/arm/mach-msm/board-htcleo-bkl.c +++ b/arch/arm/mach-msm/board-htcleo-bkl.c @@ -1,6 +1,7 @@ /* linux/arch/arm/mach-msm/board-htcleo-bkl.c * * Copyright (c) 2010 Cotulla + * Edited to Common Structure by Markinus * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -26,6 +27,7 @@ #include #include #include +#include //#define DEBUG_LCM @@ -35,70 +37,117 @@ #define LCMDBG(fmt, arg...) {} #endif - - -extern int microp_set_bkl(uint8_t value); -extern int micorp_onoff_bkl(int enable); - static struct led_trigger *htcleo_lcd_backlight; +int htcleo_brightness_onoff_bkl(int enable) +{ + int ret; + uint8_t data[1]; + + data[0] = enable ? 1 : 0; + ret = microp_i2c_write(MICROP_I2C_WCMD_BL_EN, data, 1); + if (ret != 0) + pr_err("%s: set failed\n", __func__); + return 0; +} + +int htcleo_brightness_set_bkl(uint8_t value) +{ + int ret; + uint8_t cmd[2], data[2]; + + printk("microp_set_bkl(%d)\n", value); + + if (value > 9) + { + value = 9; + } + // disable autobrigtness + data[0] = 0; + data[1] = 0; + ret = microp_i2c_write(MICROP_I2C_WCMD_AUTO_BL_CTL, data, 2); // 23 + if (ret != 0) + pr_err("%s: set auto light sensor fail\n", __func__); + + // setvalue + cmd[0] = value << 4; +// printk("22LEVEL %02X\n", cmd[0]); + ret = microp_i2c_write(MICROP_I2C_WCMD_LCM_BL_MANU_CTL, cmd, 1); // 22 + if (ret < 0) + { + pr_err("%s: request adc fail\n", __func__); + return -EIO; + } + + return 0; +} void htcleo_brightness_set(struct led_classdev *led_cdev, enum led_brightness val) { - led_cdev->brightness = val; + led_cdev->brightness = val; - // set brigtness level via MicroP - LCMDBG("htcleo_brightness_set: %d\n", val); - if (val > 255) val = 255; - if (val < 30) - { - micorp_onoff_bkl(0); - } - else - { - micorp_onoff_bkl(1); - microp_set_bkl((val - 30) / 23); - } + // set brigtness level via MicroP + LCMDBG("htcleo_brightness_set: %d\n", val); + if (val > 255) val = 255; + if (val < 30) + { + htcleo_brightness_onoff_bkl(0); + } + else + { + htcleo_brightness_onoff_bkl(1); + htcleo_brightness_set_bkl((val - 30) / 23); + } } static struct led_classdev htcleo_backlight_led = { - .name = "lcd-backlight", - .brightness = LED_FULL, - .brightness_set = htcleo_brightness_set, + .name = "lcd-backlight", + .brightness = LED_FULL, + .brightness_set = htcleo_brightness_set, }; - - - -static int htcleo_backlight_probe(struct platform_device *pdev) +static int htcleo_backlight_probe(struct platform_device *pdev) { - int rc; + int rc; + printk(KERN_INFO "%s: HTCLeo Backlight connect with microP: " + "Probe\n", __func__); + + led_trigger_register_simple("lcd-backlight-gate", &htcleo_lcd_backlight); + rc = led_classdev_register(&pdev->dev, &htcleo_backlight_led); + if (rc) + LCMDBG("HTCLeo Backlight: failure on register led_classdev\n"); + return 0; - led_trigger_register_simple("lcd-backlight-gate", &htcleo_lcd_backlight); - rc = led_classdev_register(&pdev->dev, &htcleo_backlight_led); - if (rc) - LCMDBG("backlight: failure on register led_classdev\n"); - return 0; } - -static struct platform_driver htcleo_backlight_driver = +static int htcleo_backlight_remove(struct platform_device *pdev) { - .probe = htcleo_backlight_probe, - .driver = - { - .name = "htcleo-backlight", - .owner = THIS_MODULE, - }, -}; + return 0; +} +static struct platform_driver htcleo_backlight_driver = { + .probe = htcleo_backlight_probe, + .remove = htcleo_backlight_remove, + .driver = { + .name = "htcleo-backlight", + .owner = THIS_MODULE, + }, +}; static int __init htcleo_backlight_init(void) { - return platform_driver_register(&htcleo_backlight_driver); + return platform_driver_register(&htcleo_backlight_driver); + +} + +static void __exit htcleo_backlight_exit(void) +{ + platform_driver_unregister(&htcleo_backlight_driver); } module_init(htcleo_backlight_init); +module_exit(htcleo_backlight_exit); -// END OF FILE +MODULE_DESCRIPTION("BMA150 G-sensor driver"); +MODULE_LICENSE("GPL"); diff --git a/arch/arm/mach-msm/board-htcleo-leds.c b/arch/arm/mach-msm/board-htcleo-leds.c new file mode 100644 index 00000000..2941b013 --- /dev/null +++ b/arch/arm/mach-msm/board-htcleo-leds.c @@ -0,0 +1,369 @@ +/* arch/arm/mach-msm/board-htcleo-microp.c + * Copyright (C) 2009 HTC Corporation. + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "board-htcleo.h" + +static void htcleo_leds_led_brightness_set_work(struct work_struct *work); + +enum led_type { + GREEN_LED, + AMBER_LED, + NUM_LEDS, +}; + +struct htcleo_leds_led_data { + int type; + struct led_classdev ldev; + struct mutex led_data_mutex; + struct work_struct brightness_work; + spinlock_t brightness_lock; + enum led_brightness brightness; + uint8_t mode; + uint8_t blink; +}; + +static struct htcleo_leds_data { + struct htcleo_leds_led_data leds[NUM_LEDS]; +} the_data; + + +int htcleo_leds_disable_lights(void) +{ + int ret; + uint8_t data[4]; + + data[0] = 0; + data[1] = 0; + data[2] = 0; + data[3] = 0; + ret = microp_i2c_write(MICROP_I2C_WCMD_LED_CTRL, data, 1); + if (ret != 0) + { + pr_err("%s: set failed\n", __func__); + } + return 0; +} + + +static int htcleo_leds_write_led_mode(struct led_classdev *led_cdev, + uint8_t mode) +{ +/* There are 5 different Led Modi; +* 0x0, 0x0: Disabled +* 0x0, 0x1: LED Green +* 0x0, 0x2: LED Amber +* 0x0, 0x3: LED Green flashing slow ( ca. 6 sek ) +* 0x0, 0x4: LED Green flashing fast ( ca. 2 sek ) +* 0x0, 0x5: LED Amber flashing fast ( ca. 2 sek ) +* 0x10,0xX: LED Amber and Green flashing alternately +*/ + struct htcleo_leds_led_data *ldata; + uint8_t data[2] = { 0, 0 }; + int ret; + static uint8_t oldvalgr=0, oldvalam=0, alternately=0; + + ldata = container_of(led_cdev, struct htcleo_leds_led_data, ldev); + + data[0] = 0x00; + if (ldata->type == GREEN_LED) { + switch(mode) { + case 0x0: + if(alternately) { + data[1]=oldvalam; + alternately=0; + } else + data[1] = 0x0; // Disable Light + break; + case 0x1: + data[1] = 0x1; // Enable Light + break; + case 0x2: + if(oldvalam==0x5) { // alternately blinking + data[0] = 0x10; + alternately=1; + } else + alternately=0; + data[1] = 0x3; // Slow blinking + break; + case 0x3: + if(oldvalam==0x5) { // alternately blinking + data[0] = 0x10; + alternately=1; + } else + alternately=0; + data[1] = 0x4; // Fast blinking + break; + } + oldvalgr=data[1]; + } else if (ldata->type == AMBER_LED) { + switch(mode) { + case 0x0: + if(alternately) { + data[1]=oldvalgr; + alternately=0; + } else + data[1] = 0x0; // Disable Light + break; + case 0x1: + data[1] = 0x2; // Enable Light + break; + case 0x2: + case 0x3: + if(oldvalgr==0x3 || oldvalgr==0x4) { // alternately blinking + data[0] = 0x10; + alternately=1; + } else + alternately=0; + data[1] = 0x5; // Fast blinking + break; + } + oldvalam=data[1]; + } + + ret = microp_i2c_write(MICROP_I2C_WCMD_LED_CTRL, data, 2); + if (ret == 0) { + mutex_lock(&ldata->led_data_mutex); + if (mode > 1) + ldata->blink = mode; + else + ldata->mode = mode; + mutex_unlock(&ldata->led_data_mutex); + } + return ret; +} + +static ssize_t htcleo_leds_led_blink_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct led_classdev *led_cdev; + struct htcleo_leds_led_data *ldata; + int ret; + + led_cdev = (struct led_classdev *)dev_get_drvdata(dev); + ldata = container_of(led_cdev, struct htcleo_leds_led_data, ldev); + + mutex_lock(&ldata->led_data_mutex); + ret = sprintf(buf, "%d\n", ldata->blink ? ldata->blink - 1 : 0); + mutex_unlock(&ldata->led_data_mutex); + + return ret; +} + +static ssize_t htcleo_leds_led_blink_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct led_classdev *led_cdev; + struct htcleo_leds_led_data *ldata; + int val, ret; + uint8_t mode; + + val = -1; + sscanf(buf, "%u", &val); + + led_cdev = (struct led_classdev *)dev_get_drvdata(dev); + ldata = container_of(led_cdev, struct htcleo_leds_led_data, ldev); + + mutex_lock(&ldata->led_data_mutex); + switch (val) { + case 0: /* stop flashing */ + mode = ldata->mode; + ldata->blink = 0; + break; + case 1: + case 2: + mode = val + 1; + break; + + default: + mutex_unlock(&ldata->led_data_mutex); + return -EINVAL; + } + mutex_unlock(&ldata->led_data_mutex); + + ret = htcleo_leds_write_led_mode(led_cdev, mode); + if (ret) + pr_err("%s set blink failed\n", led_cdev->name); + + return count; +} + +static DEVICE_ATTR(blink, 0644, htcleo_leds_led_blink_show, + htcleo_leds_led_blink_store); + + +static void htcleo_leds_brightness_set(struct led_classdev *led_cdev, + enum led_brightness brightness) +{ + unsigned long flags; + struct i2c_client *client = to_i2c_client(led_cdev->dev->parent); + struct htcleo_leds_led_data *ldata = + container_of(led_cdev, struct htcleo_leds_led_data, ldev); + + dev_dbg(&client->dev, "Setting %s brightness current %d new %d\n", + led_cdev->name, led_cdev->brightness, brightness); + + if (brightness > 255) + brightness = 255; + led_cdev->brightness = brightness; + + spin_lock_irqsave(&ldata->brightness_lock, flags); + ldata->brightness = brightness; + spin_unlock_irqrestore(&ldata->brightness_lock, flags); + + schedule_work(&ldata->brightness_work); +} + +static void htcleo_leds_led_brightness_set_work(struct work_struct *work) +{ + unsigned long flags; + struct htcleo_leds_led_data *ldata = + container_of(work, struct htcleo_leds_led_data, brightness_work); + struct led_classdev *led_cdev = &ldata->ldev; + + struct i2c_client *client = to_i2c_client(led_cdev->dev->parent); + + enum led_brightness brightness; + int ret; + uint8_t mode; + + spin_lock_irqsave(&ldata->brightness_lock, flags); + brightness = ldata->brightness; + spin_unlock_irqrestore(&ldata->brightness_lock, flags); + + if (brightness) + mode = 1; + else + mode = 0; + + ret = htcleo_leds_write_led_mode(led_cdev, mode); + if (ret) { + dev_err(&client->dev, + "led_brightness_set failed to set mode\n"); + } +} + +struct device_attribute *green_amber_attrs[] = { + &dev_attr_blink, +}; + +static struct { + const char *name; + void (*led_set_work)(struct work_struct *); + struct device_attribute **attrs; + int attr_cnt; +} htcleo_leds_leds[] = { + [GREEN_LED] = { + .name = "green", + .led_set_work = htcleo_leds_led_brightness_set_work, + .attrs = green_amber_attrs, + .attr_cnt = ARRAY_SIZE(green_amber_attrs) + }, + [AMBER_LED] = { + .name = "amber", + .led_set_work = htcleo_leds_led_brightness_set_work, + .attrs = green_amber_attrs, + .attr_cnt = ARRAY_SIZE(green_amber_attrs) + }, +}; + + +static int htcleo_leds_probe(struct platform_device *pdev) +{ + int rc, i, j; + struct htcleo_leds_data *cdata; + + rc= 0; + + pr_info("%s\n", __func__); + + cdata = &the_data; + platform_set_drvdata(pdev, cdata); + + htcleo_leds_disable_lights(); + + for (i = 0; i < ARRAY_SIZE(htcleo_leds_leds) && !rc; ++i) { + struct htcleo_leds_led_data *ldata = &cdata->leds[i]; + + ldata->type = i; + ldata->ldev.name = htcleo_leds_leds[i].name; + ldata->ldev.brightness_set = htcleo_leds_brightness_set; + mutex_init(&ldata->led_data_mutex); + INIT_WORK(&ldata->brightness_work, htcleo_leds_leds[i].led_set_work); + spin_lock_init(&ldata->brightness_lock); + rc = led_classdev_register(&pdev->dev, &ldata->ldev); + if (rc) { + ldata->ldev.name = NULL; + break; + } + + for (j = 0; j < htcleo_leds_leds[i].attr_cnt && !rc; ++j) + rc = device_create_file(ldata->ldev.dev, + htcleo_leds_leds[i].attrs[j]); + } + if (rc) { + dev_err(&pdev->dev, "failed to add leds\n"); + goto err_add_leds; + } + + + goto done; + + +err_add_leds: + for (i = 0; i < ARRAY_SIZE(htcleo_leds_leds); ++i) { + if (!cdata->leds[i].ldev.name) + continue; + led_classdev_unregister(&cdata->leds[i].ldev); + for (j = 0; j < htcleo_leds_leds[i].attr_cnt; ++j) + device_remove_file(cdata->leds[i].ldev.dev, + htcleo_leds_leds[i].attrs[j]); + } + +done: + return rc; +} + +static struct platform_driver htcleo_leds_driver = { + .probe = htcleo_leds_probe, + .driver = { + .name = "htcleo-leds", + .owner = THIS_MODULE + }, +}; + +static int __init htcleo_leds_init(void) +{ + return platform_driver_register(&htcleo_leds_driver); +} + +device_initcall(htcleo_leds_init); + +MODULE_DESCRIPTION("HTC LEO LED Support"); +MODULE_LICENSE("GPL"); diff --git a/arch/arm/mach-msm/board-htcleo-microp.c b/arch/arm/mach-msm/board-htcleo-microp.c index 25bbb29c..f06f4a55 100644 --- a/arch/arm/mach-msm/board-htcleo-microp.c +++ b/arch/arm/mach-msm/board-htcleo-microp.c @@ -1,6 +1,13 @@ -/* arch/arm/mach-msm/board-supersonic-microp.c +/* board-htcleo-microp.c + * Copyright (C) 2009 Google. * Copyright (C) 2009 HTC Corporation. * + * The Microp on htcleo is an i2c device that supports + * the following functions + * - G-sensor + * - Proximity (capella cm3602) + * - Interrupts + * * 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. @@ -10,52 +17,739 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ -#ifdef CONFIG_MICROP_COMMON + #include +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include #include -#include +#include +#include +#include +#include +#include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "board-htcleo.h" -static int htcleo_microp_function_init(struct i2c_client *client) +static uint32_t microp_als_kadc; + +extern void p_sensor_irq_handler(void); + +static char *hex2string(uint8_t *data, int len) { - struct microp_i2c_platform_data *pdata; + static char buf[101]; + int i; + + i = (sizeof(buf) - 1) / 4; + if (len > i) + len = i; + + for (i = 0; i < len; i++) + sprintf(buf + i * 4, "[%02X]", data[i]); + + return buf; +} + +#define I2C_READ_RETRY_TIMES 10/* + * SD slot card-detect support + */ +#define I2C_WRITE_RETRY_TIMES 10 + +static int i2c_read_block(struct i2c_client *client, uint8_t addr, + uint8_t *data, int length) +{ + int retry; struct microp_i2c_client_data *cdata; - uint8_t data[20]; - int i, j; - int ret; + struct i2c_msg msgs[] = { + { + .addr = client->addr, + .flags = 0, + .len = 1, + .buf = &addr, + }, + { + .addr = client->addr, + .flags = I2C_M_RD, + .len = length, + .buf = data, + } + }; - pdata = client->dev.platform_data; cdata = i2c_get_clientdata(client); + mutex_lock(&cdata->microp_i2c_rw_mutex); + hr_msleep(1); + for (retry = 0; retry <= I2C_READ_RETRY_TIMES; retry++) { + if (i2c_transfer(client->adapter, msgs, 2) == 2) + break; + msleep(5); + } + mutex_unlock(&cdata->microp_i2c_rw_mutex); + dev_dbg(&client->dev, "R [%02X] = %s\n", + addr, hex2string(data, length)); - /* Reset button interrupt */ - ret = microp_write_interrupt(client, (1<<8), 1); - if (ret) - goto exit; - + if (retry > I2C_READ_RETRY_TIMES) { + dev_err(&client->dev, "i2c_read_block retry over %d\n", + I2C_READ_RETRY_TIMES); + return -EIO; + } return 0; +} -exit: +#define MICROP_I2C_WRITE_BLOCK_SIZE 21 +static int i2c_write_block(struct i2c_client *client, uint8_t addr, + uint8_t *data, int length) +{ + int retry; + uint8_t buf[MICROP_I2C_WRITE_BLOCK_SIZE]; + struct microp_i2c_client_data *cdata; + + struct i2c_msg msg[] = { + { + .addr = client->addr, + .flags = 0, + .len = length + 1, + .buf = buf, + } + }; + + cdata = i2c_get_clientdata(client); + dev_dbg(&client->dev, "W [%02X] = %s\n", addr, + hex2string(data, length)); + + if (length + 1 > MICROP_I2C_WRITE_BLOCK_SIZE) { + dev_err(&client->dev, "i2c_write_block length too long\n"); + return -E2BIG; + } + + buf[0] = addr; + memcpy((void *)&buf[1], (void *)data, length); + +// mdelay(1); +// Cotulla: extra delay +// msleep(10); + mutex_lock(&cdata->microp_i2c_rw_mutex); + hr_msleep(1); + for (retry = 0; retry <= I2C_WRITE_RETRY_TIMES; retry++) { + if (i2c_transfer(client->adapter, msg, 1) == 1) + break; + msleep(5); + } + if (retry > I2C_WRITE_RETRY_TIMES) { + dev_err(&client->dev, "i2c_write_block retry over %d\n", + I2C_WRITE_RETRY_TIMES); + mutex_unlock(&cdata->microp_i2c_rw_mutex); + return -EIO; + } + mutex_unlock(&cdata->microp_i2c_rw_mutex); + return 0; +} + +int microp_i2c_read(uint8_t addr, uint8_t *data, int length) +{ + struct i2c_client *client = private_microp_client; + + if (!client) { + printk(KERN_ERR "%s: dataset: client is empty\n", __func__); + return -EIO; + } + + if (i2c_read_block(client, addr, data, length) < 0) { + dev_err(&client->dev, "%s: write microp i2c fail\n", __func__); + return -EIO; + } + + return 0; +} +EXPORT_SYMBOL(microp_i2c_read); + +int microp_i2c_write(uint8_t addr, uint8_t *data, int length) +{ + struct i2c_client *client = private_microp_client; + + if (!client) { + printk(KERN_ERR "%s: dataset: client is empty\n", __func__); + return -EIO; + } + + if (i2c_write_block(client, addr, data, length) < 0) { + dev_err(&client->dev, "%s: write microp i2c fail\n", __func__); + return -EIO; + } + + return 0; +} +EXPORT_SYMBOL(microp_i2c_write); + +static int microp_spi_enable(uint8_t on) +{ + struct i2c_client *client; + int ret; + + client = private_microp_client; + ret = i2c_write_block(client, MICROP_I2C_WCMD_SPI_EN, &on, 1); + if (ret < 0) { + dev_err(&client->dev,"%s: i2c_write_block fail\n", __func__); + return ret; + } + msleep(10); return ret; } -static struct microp_ops ops = { - .init_microp_func = htcleo_microp_function_init, -}; - -void __init htcleo_microp_init(void) +int microp_spi_vote_enable(int spi_device, uint8_t enable) { - microp_register_ops(&ops); + // Only a dummy for the bma_150 driver, enable only the SPI + int ret; + ret=0; + + ret = microp_spi_enable(enable); + return ret; + +} + +static int microp_read_adc(uint8_t channel, uint16_t *value) +{ + struct i2c_client *client; + int ret; + uint8_t cmd[2], data[2]; + + client = private_microp_client; + cmd[0] = 0; + cmd[1] = 1; //channel; +// ret = i2c_write_block(client, MICROP_I2C_WCMD_READ_ADC_REQ, cmd, 2); + ret = i2c_write_block(client, MICROP_I2C_WCMD_READ_ADC_VALUE_REQ, cmd, 2); + if (ret < 0) { + dev_err(&client->dev, "%s: request adc fail\n", __func__); + return -EIO; + } + + ret = i2c_read_block(client, MICROP_I2C_RCMD_ADC_VALUE, data, 2); + if (ret < 0) { + dev_err(&client->dev, "%s: read adc fail\n", __func__); + return -EIO; + } + *value = data[0] << 8 | data[1]; + return 0; +} + +/** + * GPI functions + **/ + +static int microp_read_gpi_status(struct i2c_client *client, uint16_t *status) +{ + uint8_t data[2]; + int ret; + + ret = i2c_read_block(client, MICROP_I2C_RCMD_GPIO_STATUS, data, 2); + if (ret < 0) { + dev_err(&client->dev, "%s: read failed\n", __func__); + return -EIO; + } + *status = (data[0] << 8) | data[1]; + return 0; +} + +static int microp_interrupt_enable(struct i2c_client *client, uint16_t interrupt_mask) +{ + uint8_t data[2]; + int ret = -1; + + data[0] = interrupt_mask >> 8; + data[1] = interrupt_mask & 0xFF; + ret = i2c_write_block(client, MICROP_I2C_WCMD_GPI_INT_CTL_EN, data, 2); + + if (ret < 0) + dev_err(&client->dev, "%s: enable 0x%x interrupt failed\n", + __func__, interrupt_mask); + return ret; +} + +static int microp_interrupt_disable(struct i2c_client *client, uint16_t interrupt_mask) +{ + uint8_t data[2]; + int ret = -1; + + data[0] = interrupt_mask >> 8; + data[1] = interrupt_mask & 0xFF; + ret = i2c_write_block(client, MICROP_I2C_WCMD_GPI_INT_CTL_DIS, data, 2); + + if (ret < 0) + dev_err(&client->dev, "%s: disable 0x%x interrupt failed\n", + __func__, interrupt_mask); + return ret; +} + +/** + * GPO functions TODO + **/ + +int microp_read_gpo_status(uint16_t *status) +{ + uint8_t data[2]; + int ret; + struct i2c_client *client; + + client = private_microp_client; + + ret = i2c_read_block(client, MICROP_I2C_RCMD_GPIO_STATUS, data, 2); + if (ret < 0) + { + dev_err(&client->dev, "%s: read failed\n", __func__); + return -EIO; + } + *status = (data[0] << 8) | data[1]; + return 0; +} +EXPORT_SYMBOL(microp_read_gpo_status); + +int microp_gpo_enable(uint16_t interrupt_mask) +{ + uint8_t data[2]; + int ret = -1; + struct i2c_client *client; + + client = private_microp_client; + + data[0] = interrupt_mask >> 8; + data[1] = interrupt_mask & 0xFF; + ret = i2c_write_block(client, MICROP_I2C_WCMD_GPO_LED_STATUS_EN, data, 2); + + if (ret < 0) + dev_err(&client->dev, "%s: enable 0x%x interrupt failed\n", __func__, interrupt_mask); + return ret; +} +EXPORT_SYMBOL(microp_gpo_enable); + +int microp_gpo_disable(uint16_t interrupt_mask) +{ + uint8_t data[2]; + int ret = -1; + struct i2c_client *client; + + client = private_microp_client; + + data[0] = interrupt_mask >> 8; + data[1] = interrupt_mask & 0xFF; + ret = i2c_write_block(client, MICROP_I2C_WCMD_GPO_LED_STATUS_DIS, data, 2); + + if (ret < 0) + dev_err(&client->dev, "%s: disable 0x%x interrupt failed\n", __func__, interrupt_mask); + return ret; +} +EXPORT_SYMBOL(microp_gpo_disable); + + +/* + * SD slot card-detect support + */ +static unsigned int sdslot_cd = 0; +static void (*sdslot_status_cb)(int card_present, void *dev_id); +static void *sdslot_mmc_dev; + +int htcleo_microp_sdslot_status_register( + void (*cb)(int card_present, void *dev_id), + void *dev_id) +{ + if (sdslot_status_cb) + return -EBUSY; + sdslot_status_cb = cb; + sdslot_mmc_dev = dev_id; + return 0; +} + +unsigned int htcleo_microp_sdslot_status(struct device *dev) +{ + return sdslot_cd; +} + +static void htcleo_microp_sdslot_update_status(int status) +{ + sdslot_cd = !(status & READ_GPI_STATE_SDCARD); + if (sdslot_status_cb) + sdslot_status_cb(sdslot_cd, sdslot_mmc_dev); +} + +/* + * Interrupt + */ +static irqreturn_t microp_i2c_intr_irq_handler(int irq, void *dev_id) +{ + struct i2c_client *client; + struct microp_i2c_client_data *cdata; + + client = to_i2c_client(dev_id); + cdata = i2c_get_clientdata(client); + + dev_dbg(&client->dev, "intr_irq_handler\n"); + + disable_irq_nosync(client->irq); + schedule_work(&cdata->work.work); + return IRQ_HANDLED; +} + +static void microp_i2c_intr_work_func(struct work_struct *work) +{ + struct microp_i2c_work *up_work; + struct i2c_client *client; + struct microp_i2c_client_data *cdata; + uint8_t data[3]; + uint16_t intr_status = 0, gpi_status = 0; + int ret = 0; + + up_work = container_of(work, struct microp_i2c_work, work); + client = up_work->client; + cdata = i2c_get_clientdata(client); + + ret = i2c_read_block(client, MICROP_I2C_RCMD_GPI_INT_STATUS, data, 2); + if (ret < 0) { + dev_err(&client->dev, "%s: read interrupt status fail\n", + __func__); + } + + intr_status = data[0]<<8 | data[1]; + ret = i2c_write_block(client, MICROP_I2C_WCMD_GPI_INT_STATUS_CLR, data, 2); + if (ret < 0) { + dev_err(&client->dev, "%s: clear interrupt status fail\n", + __func__); + } + pr_debug("intr_status=0x%02x\n", intr_status); + + if (intr_status & IRQ_SDCARD) { + microp_read_gpi_status(client, &gpi_status); + htcleo_microp_sdslot_update_status(gpi_status); + } + if (intr_status & IRQ_PROXIMITY) { + p_sensor_irq_handler(); + } + + enable_irq(client->irq); +} + + +static int microp_function_initialize(struct i2c_client *client) +{ + struct microp_i2c_client_data *cdata; + uint16_t stat, interrupts = 0; + int ret; + + cdata = i2c_get_clientdata(client); + + /* SD Card */ + interrupts |= IRQ_SDCARD; + interrupts |= IRQ_PROXIMITY; + + /* enable the interrupts */ + ret = microp_interrupt_enable(client, interrupts); + if (ret < 0) { + dev_err(&client->dev, "%s: failed to enable gpi irqs\n", + __func__); + goto err_irq_en; + } + + microp_read_gpi_status(client, &stat); + htcleo_microp_sdslot_update_status(stat); + + return 0; + +err_irq_en: + return ret; +} + +#ifdef CONFIG_HAS_EARLYSUSPEND +void microp_early_suspend(struct early_suspend *h) +{ + struct microp_i2c_client_data *cdata; + struct i2c_client *client = private_microp_client; + int ret; + + if (!client) { + pr_err("%s: dataset: client is empty\n", __func__); + return; + } + cdata = i2c_get_clientdata(client); + + cdata->microp_is_suspend = 1; + + disable_irq(client->irq); + ret = cancel_work_sync(&cdata->work.work); + if (ret != 0) { + enable_irq(client->irq); + } + +} + +void microp_early_resume(struct early_suspend *h) +{ + struct i2c_client *client = private_microp_client; + struct microp_i2c_client_data *cdata; + + if (!client) { + pr_err("%s: dataset: client is empty\n", __func__); + return; + } + cdata = i2c_get_clientdata(client); + + cdata->microp_is_suspend = 0; + enable_irq(client->irq); } #endif + +static int microp_i2c_suspend(struct i2c_client *client, + pm_message_t mesg) +{ + return 0; +} + +static int microp_i2c_resume(struct i2c_client *client) +{ + return 0; +} + +static void register_microp_devices(struct platform_device *devices, int num) +{ + int i; + for (i = 0; i < num; i++) { + platform_device_register(devices + i); + dev_set_drvdata(&(devices + i)->dev, private_microp_client); + } +} + +static int microp_i2c_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct microp_i2c_platform_data *pdata; + struct microp_i2c_client_data *cdata; + uint8_t data[6]; + int ret; + + cdata = kzalloc(sizeof(struct microp_i2c_client_data), GFP_KERNEL); + if (!cdata) { + ret = -ENOMEM; + dev_err(&client->dev, "failed on allocat cdata\n"); + goto err_cdata; + } + i2c_set_clientdata(client, cdata); + + private_microp_client = client; + pdata = client->dev.platform_data; + if (!pdata) { + ret = -EBUSY; + dev_err(&client->dev, "failed on get pdata\n"); + goto err_exit; + } + pdata->dev_id = (void *)&client->dev; + cdata->gpio_reset=pdata->gpio_reset; + + mutex_init(&cdata->microp_i2c_rw_mutex); + + ret = i2c_read_block(client, MICROP_I2C_RCMD_VERSION, data, 2); + if (ret || !(data[0] && data[1])) { + ret = -ENODEV; + dev_err(&client->dev, "failed on get microp version\n"); + goto err_exit; + } + dev_info(&client->dev, "microp version [%02X][%02X]\n", + data[0], data[1]); + + ret = gpio_request(pdata->gpio_reset, "microp_i2c_wm"); + if (ret < 0) { + dev_err(&client->dev, "failed on request gpio reset\n"); + goto err_exit; + } + ret = gpio_direction_output(pdata->gpio_reset, 1); + if (ret < 0) { + dev_err(&client->dev, + "failed on gpio_direction_output reset\n"); + goto err_gpio_reset; + } + + cdata->version = data[0] << 8 | data[1]; + cdata->microp_is_suspend = 0; + + wake_lock_init(µp_i2c_wakelock, WAKE_LOCK_SUSPEND, + "microp_i2c_present"); + + register_microp_devices(pdata->microp_devices, pdata->num_devices); + + /* Setup IRQ handler */ + INIT_WORK(&cdata->work.work, microp_i2c_intr_work_func); + cdata->work.client = client; + + ret = request_irq(client->irq, + microp_i2c_intr_irq_handler, + IRQF_TRIGGER_LOW, + "microp_interrupt", + &client->dev); + if (ret) { + dev_err(&client->dev, "request_irq failed\n"); + goto err_intr; + } + ret = set_irq_wake(client->irq, 1); + if (ret) { + dev_err(&client->dev, "set_irq_wake failed\n"); + goto err_intr; + } + +#ifdef CONFIG_HAS_EARLYSUSPEND + if (cdata->enable_early_suspend) { + cdata->early_suspend.level = + EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1; + cdata->early_suspend.suspend = microp_early_suspend; + cdata->early_suspend.resume = microp_early_resume; + register_early_suspend(&cdata->early_suspend); + } +#endif + + ret = microp_function_initialize(client); + if (ret) { + dev_err(&client->dev, "failed on microp function initialize\n"); + goto err_fun_init; + } + + dev_info(&client->dev, "Init Done\n"); + return 0; + +err_fun_init: +err_intr: + wake_lock_destroy(µp_i2c_wakelock); + kfree(cdata); + i2c_set_clientdata(client, NULL); + +err_cdata: +err_gpio_reset: + gpio_free(pdata->gpio_reset); +err_exit: + dev_info(&client->dev, "Init Error\n"); + return ret; +} + +static int __devexit microp_i2c_remove(struct i2c_client *client) +{ + struct microp_i2c_client_data *cdata; + + cdata = i2c_get_clientdata(client); + +#ifdef CONFIG_HAS_EARLYSUSPEND + if (cdata->enable_early_suspend) { + unregister_early_suspend(&cdata->early_suspend); + } +#endif + + free_irq(client->irq, &client->dev); + + gpio_free(cdata->gpio_reset); + + kfree(cdata); + + return 0; +} + +#define ATAG_ALS 0x5441001b +static int __init parse_tag_microp_als_kadc(const struct tag *tags) +{ + int found = 0; + struct tag *t = (struct tag *)tags; + + for (; t->hdr.size; t = tag_next(t)) { + if (t->hdr.tag == ATAG_ALS) { + found = 1; + break; + } + } + + if (found) + microp_als_kadc = t->u.revision.rev; + pr_debug("%s: microp_als_kadc = 0x%x\n", __func__, microp_als_kadc); + return 0; +} +__tagtable(ATAG_ALS, parse_tag_microp_als_kadc); + +static const struct i2c_device_id microp_i2c_id[] = +{ + { MICROP_I2C_NAME, 0 }, + { } +}; + +static struct i2c_driver microp_i2c_driver = +{ + .driver = { + .name = MICROP_I2C_NAME, + }, + .id_table = microp_i2c_id, + .probe = microp_i2c_probe, + .suspend = microp_i2c_suspend, + .resume = microp_i2c_resume, + .remove = __devexit_p(microp_i2c_remove), +}; + +static int __init microp_i2c_init(void) +{ + return i2c_add_driver(µp_i2c_driver); +} + +static void __exit microp_i2c_exit(void) +{ + i2c_del_driver(µp_i2c_driver); +} + +module_init(microp_i2c_init); +module_exit(microp_i2c_exit); + +MODULE_AUTHOR("Eric Olsen "); +MODULE_DESCRIPTION("MicroP I2C driver"); +MODULE_LICENSE("GPL"); + +static int micropklt_dbg_leds_set(void *dat, u64 val) +{ + struct i2c_client *client; + char buffer[3] = { 0, 0, 0 }; + int r; + + client = private_microp_client; + + buffer[0] = 0xff & (val >> 8); + buffer[1] = 0xff & (val >> 16); + buffer[2] = 0xff & (val >> 24); + r =i2c_write_block(client, 0xff & val, buffer, 3); + return r; +} + +static int micropklt_dbg_leds_get(void *data, u64 *val) { + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(micropklt_dbg_leds_fops, + micropklt_dbg_leds_get, + micropklt_dbg_leds_set, "%llu\n"); + + +static int __init micropklt_dbg_init(void) +{ + struct dentry *dent; + + dent = debugfs_create_dir("micropklt", 0); + if (IS_ERR(dent)) + return PTR_ERR(dent); + + debugfs_create_file("raw", 0444, dent, NULL, + µpklt_dbg_leds_fops); + return 0; +} + +device_initcall(micropklt_dbg_init); + diff --git a/arch/arm/mach-msm/board-htcleo-proximity.c b/arch/arm/mach-msm/board-htcleo-proximity.c index 07bf2988..7a940da2 100644 --- a/arch/arm/mach-msm/board-htcleo-proximity.c +++ b/arch/arm/mach-msm/board-htcleo-proximity.c @@ -72,7 +72,6 @@ static int report_psensor_data(void) static int capella_cm3602_enable(struct capella_cm3602_data *data) { int rc; - pr_info("%s\n", __func__); if (data->enabled) { pr_info("%s: already enabled\n", __func__); return 0; @@ -95,7 +94,6 @@ static int capella_cm3602_enable(struct capella_cm3602_data *data) static int capella_cm3602_disable(struct capella_cm3602_data *data) { int rc = -EIO; - pr_info("%s\n", __func__); if (!data->enabled) { pr_info("%s: already disabled\n", __func__); return 0; @@ -147,7 +145,6 @@ static DEVICE_ATTR(proximity, 0644, capella_cm3602_show, capella_cm3602_store); static int capella_cm3602_open(struct inode *inode, struct file *file) { - pr_info("%s\n", __func__); if (misc_opened) return -EBUSY; misc_opened = 1; @@ -156,7 +153,6 @@ static int capella_cm3602_open(struct inode *inode, struct file *file) static int capella_cm3602_release(struct inode *inode, struct file *file) { - pr_info("%s\n", __func__); misc_opened = 0; return capella_cm3602_disable(&the_data); } @@ -191,7 +187,6 @@ static void p_sensor_do_work(struct work_struct *w) void p_sensor_irq_handler(void) { - pr_info("%s\n", __func__); queue_work(the_data.p_sensor_wq, &p_sensor_work); } @@ -317,3 +312,6 @@ static int __init htcleo_capella_cm3602_init(void) } device_initcall(htcleo_capella_cm3602_init); + +MODULE_DESCRIPTION("HTC LEO Touchscreen Support Driver"); +MODULE_LICENSE("GPL"); diff --git a/arch/arm/mach-msm/board-htcleo.c b/arch/arm/mach-msm/board-htcleo.c index e8277e94..39898fe5 100644 --- a/arch/arm/mach-msm/board-htcleo.c +++ b/arch/arm/mach-msm/board-htcleo.c @@ -27,7 +27,10 @@ #include #include #include +#include +#ifdef CONFIG_SENSORS_BMA150_SPI #include +#endif #include #include <../../../drivers/staging/android/timed_gpio.h> @@ -49,11 +52,7 @@ #include #include -#ifdef CONFIG_MICROP_COMMON -#include -void __init htcleo_microp_init(void); -#endif - +#include #include "board-htcleo.h" #include "board-htcleo-ts.h" @@ -175,17 +174,9 @@ static struct akm8973_platform_data compass_platform_data = /////////////////////////////////////////////////////////////////////// // Microp /////////////////////////////////////////////////////////////////////// -#ifdef CONFIG_MICROP_COMMON -static struct microp_function_config microp_functions[] = { - { - .name = "reset-int", - .category = MICROP_FUNCTION_RESET_INT, - .int_pin = 1 << 8, - }, -}; static struct bma150_platform_data htcleo_g_sensor_pdata = { - .microp_new_cmd = 1, + .microp_new_cmd = 0, }; static struct platform_device microp_devices[] = { @@ -195,17 +186,25 @@ static struct platform_device microp_devices[] = { .platform_data = &htcleo_g_sensor_pdata, }, }, + { + .name = "htcleo-backlight", + }, + { + .name = "htcleo-proximity", + .id = -1, + }, + { + .name = "htcleo-leds", + .id = -1, + }, }; static struct microp_i2c_platform_data microp_data = { - .num_functions = ARRAY_SIZE(microp_functions), - .microp_function = microp_functions, .num_devices = ARRAY_SIZE(microp_devices), .microp_devices = microp_devices, .gpio_reset = HTCLEO_GPIO_UP_RESET_N, - .spi_devices = SPI_GSENSOR, }; -#endif + static struct i2c_board_info base_i2c_devices[] = { { @@ -218,13 +217,11 @@ static struct i2c_board_info base_i2c_devices[] = I2C_BOARD_INFO("tps65023", 0x48), .platform_data = tps65023_data, }, -#ifdef CONFIG_MICROP_COMMON { I2C_BOARD_INFO(MICROP_I2C_NAME, 0xCC >> 1), .platform_data = µp_data, .irq = MSM_GPIO_TO_INT(HTCLEO_GPIO_UP_INT_N) }, -#endif { I2C_BOARD_INFO(AKM8973_I2C_NAME, 0x1C), .platform_data = &compass_platform_data, @@ -621,6 +618,18 @@ static struct platform_device htcleo_power = .name = "htcleo_power", .id = -1, }; +/////////////////////////////////////////////////////////////////////// +// Real Time Clock +/////////////////////////////////////////////////////////////////////// + +struct platform_device msm_device_rtc = { + .name = "msm_rtc", + .id = -1, +}; +/////////////////////////////////////////////////////////////////////// +// Platform Devices +/////////////////////////////////////////////////////////////////////// + static struct platform_device *devices[] __initdata = { @@ -633,15 +642,12 @@ static struct platform_device *devices[] __initdata = #endif &msm_device_smd, &htcleo_rfkill, -// &msm_audio_device, + &msm_device_rtc, &android_pmem_device, &android_pmem_adsp_device, &android_pmem_camera_device, &msm_device_i2c, -// &htcleo_backlight, -// &htcleo_headset, &msm_kgsl_device, -// &capella_cm3602, &msm_camera_sensor_s5k3e2fx, &htcleo_flashlight_device, &htcleo_power, diff --git a/arch/arm/mach-msm/htc_headset_gpio.c b/arch/arm/mach-msm/htc_headset_gpio.c index ea324535..debf035d 100644 --- a/arch/arm/mach-msm/htc_headset_gpio.c +++ b/arch/arm/mach-msm/htc_headset_gpio.c @@ -32,8 +32,8 @@ #include #include #include - #include + #include #include @@ -48,6 +48,9 @@ #define AJ_DBG(fmt, arg...) do {} while (0) #endif +int microp_get_remote_adc(uint32_t *val); +int microp_set_adc_req(uint8_t channel); + struct audio_jack_info { unsigned int irq_jack; unsigned int irq_mic; @@ -71,6 +74,43 @@ struct audio_jack_info { static struct audio_jack_info *pjack_info; +int microp_set_adc_req(uint8_t value) +{ + int ret; + uint8_t cmd[1]; + + cmd[0] = value; //value; TODO finish code... now only keys ADC + ret = microp_i2c_write(MICROP_I2C_WCMD_ADC_REQ, cmd, 1); + if (ret < 0) + { + pr_err("%s: request adc fail\n", __func__); + return -EIO; + } + + return 0; +} + +int microp_get_remote_adc(uint32_t *val) +{ + int ret; + uint8_t data[4]; + + if (!val) + return -EIO; + + ret = microp_i2c_write(MICROP_I2C_RCMD_ADC_VALUE, data, 2); + if (ret < 0) + { + pr_err("%s: request adc fail\n", __func__); + return -EIO; + } + +// printk("%x %x\n", data[0], data[1]); + *val = data[1] | (data[0] << 8); + printk("remote adc %d\n", *val); + return 0; +} + static int hs_gpio_get_mic(void) { int value; diff --git a/arch/arm/mach-msm/include/mach/atmega_microp.h b/arch/arm/mach-msm/include/mach/atmega_microp.h index 46ff647b..c5d35666 100644 --- a/arch/arm/mach-msm/include/mach/atmega_microp.h +++ b/arch/arm/mach-msm/include/mach/atmega_microp.h @@ -80,6 +80,7 @@ #define MICROP_I2C_WCMD_BL_EN 0x26 #define MICROP_I2C_RCMD_VERSION 0x30 #define MICROP_I2C_WCMD_ADC_TABLE 0x42 +#define MICROP_I2C_WCMD_LED_CTRL 0x51 #define MICROP_I2C_WCMD_LED_MODE 0x53 #define MICROP_I2C_RCMD_GREEN_LED_REMAIN_TIME 0x54 #define MICROP_I2C_RCMD_AMBER_LED_REMAIN_TIME 0x55 @@ -120,6 +121,7 @@ #define MICROP_I2C_WCMD_SIMCARD_DEBN_TIME 0x8A #define MICROP_I2C_WCMD_GPO_LED_STATUS_EN 0x90 #define MICROP_I2C_WCMD_GPO_LED_STATUS_DIS 0x91 +#define MICROP_I2C_RCMD_GPO_LED_STATUS 0x92 #define MICROP_I2C_WCMD_OJ_INT_STATUS 0xA8 #define MICROP_I2C_RCMD_MOBEAM_STATUS 0xB1 #define MICROP_I2C_WCMD_MOBEAM_DL 0xB2 diff --git a/arch/arm/mach-msm/include/mach/board-htcleo-microp.h b/arch/arm/mach-msm/include/mach/board-htcleo-microp.h index 5e0b074b..560ef4a1 100644 --- a/arch/arm/mach-msm/include/mach/board-htcleo-microp.h +++ b/arch/arm/mach-msm/include/mach/board-htcleo-microp.h @@ -29,17 +29,6 @@ struct microp_int_pin { uint16_t int_remotekey; }; -struct microp_led_data { - int type; - struct led_classdev ldev; - struct mutex led_data_mutex; - struct work_struct brightness_work; - spinlock_t brightness_lock; - enum led_brightness brightness; - uint8_t mode; - uint8_t blink; -}; - struct microp_i2c_work { struct work_struct work; struct i2c_client *client; @@ -47,16 +36,8 @@ struct microp_i2c_work { void (*intr_function)(uint8_t *pin_status); }; -enum led_type { - GREEN_LED, - AMBER_LED, - NUM_LEDS, -}; - struct microp_i2c_client_data { struct mutex microp_i2c_rw_mutex; - struct mutex proximity_api_lock; - struct microp_led_data leds[NUM_LEDS]; uint8_t gpio_reset; uint16_t version; struct microp_i2c_work work; @@ -65,13 +46,6 @@ struct microp_i2c_client_data { uint8_t enable_early_suspend; uint8_t enable_reset_button; int microp_is_suspend; - int auto_backlight_enabled; - uint8_t proximity_sensor_enabled; - uint8_t button_led_value; - int headset_is_in; - int is_hpin_pin_stable; - struct input_dev *pr_input_dev; - struct input_dev *ls_input_dev; uint32_t microp_als_kadc; }; diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 6a75d0f4..11623b22 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -296,7 +296,6 @@ config PMIC8058_PWM config SENSORS_BMA150_SPI tristate "BMA150 G-sensor Driver" - depends on MICROP_COMMON default y help BMA150 G-sensor Driver implemented by HTC.