/* 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 #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) { 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