uint8_t init_rcp_input_dev(struct mhl_dev_context *dev_context)
{
	int i;
	uint8_t error;
	struct input_dev	*rcp_input_dev;

	if (dev_context->rcp_input_dev != NULL) {
		MHL_TX_DBG_INFO(dev_context, "RCP input device already exists!\n");
		return 0;
	}

	rcp_input_dev = input_allocate_device();
	if (!rcp_input_dev) {
		MHL_TX_DBG_ERR(dev_context, "Failed to allocate RCP input device\n");
		return -ENOMEM;
	}

	set_bit(EV_KEY, rcp_input_dev->evbit);

//	rcp_input_dev->phys			= "mdt_kbd/input0";
	rcp_input_dev->name			= "MHL Remote Control";
	rcp_input_dev->keycode		= rcp_def_keymap;
	rcp_input_dev->keycodesize	= sizeof(u16);
	rcp_input_dev->keycodemax	= ARRAY_SIZE(rcp_def_keymap);

	for (i = 1; i < ARRAY_SIZE(rcp_def_keymap); i++) {
		u16	keycode = rcp_def_keymap[i];
		if (keycode != KEY_UNKNOWN && keycode != KEY_RESERVED)
			set_bit(keycode, rcp_input_dev->keybit);
	}

	rcp_input_dev->id.bustype = BUS_VIRTUAL;
//	rcp_input_dev->id.vendor  = 0x1095;
//	rcp_input_dev->id.product = 0x8348;

	error = input_register_device(rcp_input_dev);
	if (error) {
		MHL_TX_DBG_ERR(dev_context, "Failed to register device\n");
		input_free_device(rcp_input_dev);
		return error;
	}

	MHL_TX_DBG_INFO(dev_context, "device created\n");

	dev_context->rcp_input_dev = rcp_input_dev;

	return 0;
}
示例#2
0
int mhl_tx_read_reg_block(void *drv_context, u8 page, u8 offset, u8 count, u8 *values)
{
	int ret;
	ret = platform_read_i2c_block(i2c_bus_adapter, page, offset, count, values);
	if (ret != 2) {
		MHL_TX_DBG_ERR(drv_context, "I2c read failed, 0x%02x:0x%02x\n", page, offset);
		ret = -EIO;
	} else {
		ret = 0;
		DUMP_I2C_TRANSFER(drv_context, page, offset, count, values, false);
	}

	return ret;
}