htcleo: add basic microp functions
This commit is contained in:
parent
defa35ec61
commit
610bdb2cc0
@ -108,7 +108,7 @@ obj-$(CONFIG_MACH_BRAVOC) += board-bravoc-microp.o clock.o
|
||||
obj-$(CONFIG_MACH_HTCLEO) += board-htcleo.o board-htcleo-spi.o board-htcleo-panel.o board-htcleo-keypad.o
|
||||
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-acoustic.o board-htcleo-audio.o
|
||||
obj-$(CONFIG_MACH_HTCLEO) += board-htcleo-bt.o
|
||||
obj-$(CONFIG_MACH_HTCLEO) += board-htcleo-bt.o board-htcleo-microp.o
|
||||
obj-$(CONFIG_MACH_HTCLEO) += clock-wince.o
|
||||
|
||||
# MSM7x30 boards
|
||||
|
79
arch/arm/mach-msm/board-htcleo-microp.c
Normal file
79
arch/arm/mach-msm/board-htcleo-microp.c
Normal file
@ -0,0 +1,79 @@
|
||||
/* 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
|
@ -27,6 +27,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/android_pmem.h>
|
||||
#include <linux/regulator/machine.h>
|
||||
#include <linux/bma150.h>
|
||||
#include <linux/akm8973.h>
|
||||
#include <../../../drivers/staging/android/timed_gpio.h>
|
||||
|
||||
@ -51,6 +52,10 @@
|
||||
#include "devices.h"
|
||||
#include "proc_comm.h"
|
||||
#include "dex_comm.h"
|
||||
#ifdef CONFIG_MICROP_COMMON
|
||||
#include <mach/atmega_microp.h>
|
||||
void __init htcleo_microp_init(void);
|
||||
#endif
|
||||
|
||||
extern int __init htcleo_init_mmc(unsigned debug_uart);
|
||||
extern void __init htcleo_audio_init(void);
|
||||
@ -129,6 +134,38 @@ static struct akm8973_platform_data compass_platform_data =
|
||||
.intr = HTCLEO_GPIO_COMPASS_INT_N,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_MICROP_COMMON
|
||||
// Microp
|
||||
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,
|
||||
};
|
||||
|
||||
static struct platform_device microp_devices[] = {
|
||||
{
|
||||
.name = BMA150_G_SENSOR_NAME,
|
||||
.dev = {
|
||||
.platform_data = &htcleo_g_sensor_pdata,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
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[] =
|
||||
{
|
||||
{
|
||||
@ -141,6 +178,13 @@ 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,
|
||||
@ -538,6 +582,9 @@ static void __init htcleo_init(void)
|
||||
mdelay(100);
|
||||
htcleo_kgsl_power(true);
|
||||
|
||||
#ifdef CONFIG_MICROP_COMMON
|
||||
htcleo_microp_init();
|
||||
#endif
|
||||
msm_device_i2c_init();
|
||||
|
||||
platform_add_devices(devices, ARRAY_SIZE(devices));
|
||||
|
Loading…
x
Reference in New Issue
Block a user