android_kernel_cmhtcleo/arch/arm/mach-msm/board-htcleo-microp.c
2010-08-29 16:31:32 +02:00

80 lines
2.0 KiB
C

/* arch/arm/mach-msm/board-supersonic-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.
*/
#ifdef CONFIG_MICROP_COMMON
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <asm/mach-types.h>
#include <mach/atmega_microp.h>
#include <linux/input.h>
#include <linux/uaccess.h>
#include <linux/miscdevice.h>
#include <mach/vreg.h>
#include <linux/wakelock.h>
#include <linux/workqueue.h>
#include "board-htcleo.h"
static int htcleo_microp_function_init(struct i2c_client *client)
{
struct microp_i2c_platform_data *pdata;
struct microp_i2c_client_data *cdata;
uint8_t data[20];
int i, j;
int ret;
pdata = client->dev.platform_data;
cdata = i2c_get_clientdata(client);
/* Headset remote key */
ret = microp_function_check(client, MICROP_FUNCTION_REMOTEKEY);
if (ret >= 0) {
i = ret;
pdata->function_node[MICROP_FUNCTION_REMOTEKEY] = i;
cdata->int_pin.int_remotekey =
pdata->microp_function[i].int_pin;
for (j = 0; j < 6; j++) {
data[j] = (uint8_t)(pdata->microp_function[i].levels[j] >> 8);
data[j + 6] = (uint8_t)(pdata->microp_function[i].levels[j]);
}
ret = microp_i2c_write(MICROP_I2C_WCMD_REMOTEKEY_TABLE,
data, 12);
if (ret)
goto exit;
}
/* Reset button interrupt */
ret = microp_write_interrupt(client, (1<<8), 1);
if (ret)
goto exit;
return 0;
exit:
return ret;
}
static struct microp_ops ops = {
.init_microp_func = htcleo_microp_function_init,
};
void __init htcleo_microp_init(void)
{
microp_register_ops(&ops);
}
#endif