コード例 #1
0
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
static void __exit si_8348_exit(void)
{
	int	idx;

	mhl_tx_remove(device_addresses[0].client);
	MHL_TX_DBG_INFO(NULL, "client removed\n");
	i2c_del_driver(&si_8348_mhl_tx_i2c_driver);
	MHL_TX_DBG_INFO(NULL, "i2c driver deleted from context\n");

	for (idx = 0; idx < ARRAY_SIZE(device_addresses); idx++) {
		MHL_TX_DBG_INFO(NULL, "\n");
		if (device_addresses[idx].client != NULL){
			MHL_TX_DBG_INFO(NULL, "unregistering device:%p\n",device_addresses[idx].client);
			i2c_unregister_device(device_addresses[idx].client);
		}
	}
}
コード例 #3
0
ファイル: platform.c プロジェクト: Swapnil133609/Zeus_exp
int si_8348_init(void)
{
	struct i2c_client *client;
	int idx;
	int ret = -EFAULT;

	pr_info("%s driver starting!!\n", MHL_DRIVER_NAME);

#if 0
	/* "Hotplug" the MHL transmitter device onto the 2nd I2C bus */
	i2c_bus_adapter = i2c_get_adapter(HDMI_I2C_CHANNEL);
	if (i2c_bus_adapter == NULL) {
		pr_err("%s() failed to get i2c adapter\n", __func__);
		goto done;
	}

	for (idx = 0; idx < ARRAY_SIZE(device_addresses); idx++) {
		if (idx == 0) {
			client = i2c_new_device(i2c_bus_adapter, &si_8348_i2c_boardinfo[idx]);
			device_addresses[idx].client = client;
		} else {
			device_addresses[idx].client = i2c_new_dummy(i2c_bus_adapter,
								     device_addresses[idx].
								     dev_addr);
		}
		/* TODO: FD, TBC, device_addresses should be initialized with care... */
		if (device_addresses[idx].client == NULL) {
			pr_err("[ERROR] %s():%d failed !\n", __func__, __LINE__);
			goto err_exit;
		}
	}

	ret = i2c_add_driver(&si_8348_mhl_tx_i2c_driver);
	if (ret < 0) {
		pr_info("[ERROR] %s():%d failed !\n", __func__, __LINE__);
		goto err_exit;
	}

	goto done;

 err_exit:
/*
	for (idx = 0; idx < ARRAY_SIZE(device_addresses); idx++) {
		if (device_addresses[idx].client != NULL)
			i2c_unregister_device(device_addresses[idx].client);
	}
*/
 done:
	MHL_TX_DBG_INFO(dev_context, "returning %d\n", ret);
#endif
	return ret;
}