Ejemplo n.º 1
0
static int alsa_to_h2w_connect(struct input_handler *handler,
		struct input_dev *dev, const struct input_device_id *id)
{
	int ret;
	struct input_handle *handle;

	handle = kzalloc(sizeof(*handle), GFP_KERNEL);
	if (!handle)
		return -ENOMEM;
	handle->dev = dev;
	handle->handler = handler;
	handle->name = "alsa_to_h2w";

	ret = input_register_handle(handle);
	if (ret)
		goto err_input_register_handle;

	ret = input_open_device(handle);
	if (ret)
		goto err_input_open_device;

	alsa_to_h2w_headset_report(switch_to_h2w(dev->sw[0]));

	return 0;

err_input_open_device:
	input_unregister_handle(handle);
err_input_register_handle:
	kfree(handle);
	return ret;
}
Ejemplo n.º 2
0
static int apmpower_connect(struct input_handler *handler,
					  struct input_dev *dev,
					  const struct input_device_id *id)
{
	struct input_handle *handle;
	int error;

	handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
	if (!handle)
		return -ENOMEM;

	handle->dev = dev;
	handle->handler = handler;
	handle->name = "apm-power";

	error = input_register_handle(handle);
	if (error) {
		pr_err("Failed to register input power handler, error %d\n",
		       error);
		kfree(handle);
		return error;
	}

	error = input_open_device(handle);
	if (error) {
		pr_err("Failed to open input power device, error %d\n", error);
		input_unregister_handle(handle);
		kfree(handle);
		return error;
	}

	return 0;
}
static int cpu_iboost_input_connect(struct input_handler *handler,
		struct input_dev *dev, const struct input_device_id *id)
{
	struct input_handle *handle;
	int error;

	handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
	if (!handle)
		return -ENOMEM;

	handle->dev = dev;
	handle->handler = handler;
	handle->name = "cpu_iboost";

	error = input_register_handle(handle);
	if (error)
		goto err2;

	error = input_open_device(handle);
	if (error)
		goto err1;

	return 0;
err1:
	input_unregister_handle(handle);
err2:
	kfree(handle);
	return error;
}
Ejemplo n.º 4
0
static int mcs6000_sld_input_connect(struct input_handler *handler,
		struct input_dev *dev, const struct input_device_id *id)
{
	struct input_handle *handle;
	int error;

	DMSG(KERN_INFO"[sub]%s: start! \n", __FUNCTION__);

	handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
	if (!handle)
		return -ENOMEM;

	handle->dev = dev;
	handle->handler = handler;
	handle->name = "slider-subtouch";

	error = input_register_handle(handle);
	if (error)
		goto err2;

	error = input_open_device(handle);
	if (error)
		goto err1;

	return 0;
err1:
	DMSG(KERN_INFO"[sub] error 1 \n");

	input_unregister_handle(handle);
err2:
	DMSG(KERN_INFO"[sub] error 2 \n");
	kfree(handle);
	return error;
}
Ejemplo n.º 5
0
static int evbug_connect(struct input_handler *handler, struct input_dev *dev,
			 const struct input_device_id *id)
{
	struct input_handle *handle;
	int error;

	handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
	if (!handle)
		return -ENOMEM;

	handle->dev = dev;
	handle->handler = handler;
	handle->name = "evbug";

	error = input_register_handle(handle);
	if (error)
		goto err_free_handle;

	error = input_open_device(handle);
	if (error)
		goto err_unregister_handle;

	printk(KERN_DEBUG pr_fmt("Connected device: %s (%s at %s)\n"),
	       dev_name(&dev->dev),
	       dev->name ?: "unknown",
	       dev->phys ?: "unknown");

	return 0;

 err_unregister_handle:
	input_unregister_handle(handle);
 err_free_handle:
	kfree(handle);
	return error;
}
Ejemplo n.º 6
0
static int intelli_plug_input_connect(struct input_handler *handler,
                struct input_dev *dev, const struct input_device_id *id)
{
        struct input_handle *handle;
        int error;

        if (input_dev_filter(dev->name))
                return -ENODEV;

        handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
        if (!handle)
                return -ENOMEM;

        handle->dev = dev;
        handle->handler = handler;
        handle->name = "intelliplug";

        error = input_register_handle(handle);
        if (error)
                goto err2;

        error = input_open_device(handle);
        if (error)
                goto err1;
        pr_info("%s found and connected!\n", dev->name);
        return 0;
err1:
        input_unregister_handle(handle);
err2:
        kfree(handle);
        return error;
}
Ejemplo n.º 7
0
static int touchboost_connect(struct input_handler *handler,
				  struct input_dev *dev,
				  const struct input_device_id *id)
{
	struct input_handle *handle;
	int error;

	pr_info("%s: connect to %s\n", __func__, dev->name);
	handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
	if (!handle)
		return -ENOMEM;

	handle->dev = dev;
	handle->handler = handler;
	handle->name = "touch_boost";

	error = input_register_handle(handle);
	if (error) {
		pr_err("Failed to register touch boost handler, error %d\n",
		       error);
		goto err;
	}

	error = input_open_device(handle);
	if (error) {
		pr_err("Failed to open touch boost device, error %d\n", error);
		input_unregister_handle(handle);
		goto err;
	}

	return 0;
err:
	kfree(handle);
	return error;
}
Ejemplo n.º 8
0
static int rfkill_connect(struct input_handler *handler, struct input_dev *dev,
			  const struct input_device_id *id)
{
	struct input_handle *handle;
	int error;

	handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
	if (!handle)
		return -ENOMEM;

	handle->dev = dev;
	handle->handler = handler;
	handle->name = "rfkill_backport";

	/* causes rfkill_start() to be called */
	error = input_register_handle(handle);
	if (error)
		goto err_free_handle;

	error = input_open_device(handle);
	if (error)
		goto err_unregister_handle;

	return 0;

 err_unregister_handle:
	input_unregister_handle(handle);
 err_free_handle:
	kfree(handle);
	return error;
}
static int boost_input_connect(struct input_handler *handler,
                struct input_dev *dev, const struct input_device_id *id)
{
	struct input_handle *handle;
	int error;

	handle = kzalloc(sizeof(*handle), GFP_KERNEL);
	if (handle == NULL)
		return -ENOMEM;

	handle->dev = dev;
	handle->handler = handler;
	handle->name = handler->name;

	error = input_register_handle(handle);
	if (error)
		goto err;

	error = input_open_device(handle);
        if (error) {
                input_unregister_handle(handle);
		goto err;
	}

	return 0;

err:
	kfree(handle);
	return error;
}
Ejemplo n.º 10
0
static int touch_dvfs_connect(struct input_handler *handler,
		struct input_dev *dev, const struct input_device_id *id)
{
	struct input_handle *handle;
	int error;

	handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
	if (!handle)
		return -ENOMEM;

	handle->dev = dev;
	handle->handler = handler;
	handle->name = "touch_dvfs";

	error = input_register_handle(handle);
	if (error)
		goto err_free_handle;

	error = input_open_device(handle);
	if (error)
		goto err_unregister_handle;

	return 0;

err_unregister_handle:
	input_unregister_handle(handle);
err_free_handle:
	kfree(handle);
	return error;
}
Ejemplo n.º 11
0
static void lid_switch_disconnect(struct input_handle *handle)
{
    printk(KERN_DEBUG "%s(%s): Disconnected device: %s\n", __FILE__, __FUNCTION__,handle->dev->phys);

    input_close_device(handle);
    input_unregister_handle(handle);
    kfree(handle);
}
Ejemplo n.º 12
0
static void mcs6000_sld_input_disconnect(struct input_handle *handle)
{
	DMSG(KERN_INFO"[sub]%s: start! \n", __FUNCTION__);

	input_close_device(handle);
	input_unregister_handle(handle);
	kfree(handle);
}
Ejemplo n.º 13
0
static void evbug_disconnect(struct input_handle *handle)
{
	printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n",
		dev_name(&handle->dev->dev));

	input_close_device(handle);
	input_unregister_handle(handle);
	kfree(handle);
}
static void ddrfreq_input_open(struct work_struct *w)
{
	struct ddrfreq_inputopen *io =
		container_of(w, struct ddrfreq_inputopen,
			     inputopen_work);
	int error;

	error = input_open_device(io->handle);
	if (error)
		input_unregister_handle(io->handle);
}
Ejemplo n.º 15
0
static int mac_hid_emumouse_connect(struct input_handler *handler,
				    struct input_dev *dev,
				    const struct input_device_id *id)
{
	struct input_handle *handle;
	int error;

	/* Don't bind to ourselves */
	if (dev == mac_hid_emumouse_dev)
		return -ENODEV;

	handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
	if (!handle)
		return -ENOMEM;

	handle->dev = dev;
	handle->handler = handler;
	handle->name = "mac-button-emul";

	error = input_register_handle(handle);
	if (error) {
		printk(KERN_ERR
			"mac_hid: Failed to register button emulation handle, "
			"error %d\n", error);
		goto err_free;
	}

	error = input_open_device(handle);
	if (error) {
		printk(KERN_ERR
			"mac_hid: Failed to open input device, error %d\n",
			error);
		goto err_unregister;
	}

	return 0;

 err_unregister:
	input_unregister_handle(handle);
 err_free:
	kfree(handle);
	return error;
}
Ejemplo n.º 16
0
static int lid_switch_connect(struct input_handler *handler, struct input_dev *dev,
                              const struct input_device_id *id)
{
    struct input_handle *handle;
    int error ,sw_value;

    if(!test_bit(SW_TABLET_MODE , dev->swbit) )   return -ENODEV;

    if( adp5588_data.input_dev == dev )   return -ENODEV;

    handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
    if (!handle)
        return -ENOMEM;

    handle->dev = dev;
    handle->handler = handler;
    handle->name = "keypad_lock_switch";
    adp5588_data.sw_dev = dev;
    error = input_register_handle(handle);
    if (error)
        goto err_free_handle;

    error = input_open_device(handle);
    if (error)
        goto err_unregister_handle;
    sw_value = !!test_bit(SW_TABLET_MODE, dev->sw);

    lid_set_state( !!test_bit(SW_LID, dev->sw),sw_value);
    printk(KERN_DEBUG "%s(%s): Connected device: \"%s\", %s\n  sw state  %d ",__FILE__, __FUNCTION__, dev->name, dev->phys,sw_value);

    adp5588_data.update_config = sw_value+1;
    schedule_work(&adp5588_data.lock_work);


    return 0;

err_unregister_handle:
    input_unregister_handle(handle);
err_free_handle:
    kfree(handle);
    return error;
}
Ejemplo n.º 17
0
static int ate_connect(struct input_handler *handler, struct input_dev *dev,
			 const struct input_device_id *id)
{
	struct input_handle *handle;
	int error;

	handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
	if (!handle)
		return -ENOMEM;

	handle->dev = dev;
	handle->handler = handler;
	handle->name = "ate_evhub";

	error = input_register_handle(handle);
	if (error)
		goto err_free_handle;

	error = input_open_device(handle);
	if (error)
		goto err_unregister_handle;

	if (MAX_INPUT_DEV > ate_dt->ate_dev.input_dev_sum) {
		ate_dt->ate_dev.valid[ate_dt->ate_dev.input_dev_sum] = false;
		ate_dt->ate_dev.input_event_type[ate_dt->ate_dev.input_dev_sum] = NULL_EVENT_TYPE;
		ate_dt->ate_dev.input_dev_table[ate_dt->ate_dev.input_dev_sum++] = dev;


	}

	printk(KERN_DEBUG pr_fmt("Connected device: %s (%s at %s)\n"),
	       dev_name(&dev->dev),
	       dev->name ?: "unknown",
	       dev->phys ?: "unknown");
	return 0;

 err_unregister_handle:
	input_unregister_handle(handle);
 err_free_handle:
	kfree(handle);
	return error;
}
Ejemplo n.º 18
0
static int alsa_to_h2w_connect(struct input_handler *handler,
		struct input_dev *dev, const struct input_device_id *id)
{
	int ret;
	struct input_handle *handle;

	/*
	 * If a sensor hub is present, any other jack input device is a dummy
	 * that should be ignored.
	 */
	if (sensor_hub_present) return -ENODEV;

	handle = kzalloc(sizeof(*handle), GFP_KERNEL);
	if (!handle)
		return -ENOMEM;
	handle->dev = dev;
	handle->handler = handler;
	handle->name = "alsa_to_h2w";

	ret = input_register_handle(handle);
	if (ret)
		goto err_input_register_handle;

	ret = input_open_device(handle);
	if (ret)
		goto err_input_open_device;

	if (dev->name && (strcmp(dev->name, "sensorprocessor") == 0))
		sensor_hub_present = true;

	alsa_to_h2w_headset_report(switch_to_h2w(dev->sw[0]));

	return 0;

err_input_open_device:
	input_unregister_handle(handle);
err_input_register_handle:
	kfree(handle);
	return ret;
}
Ejemplo n.º 19
0
static int sysrq_connect(struct input_handler *handler,
			 struct input_dev *dev,
			 const struct input_device_id *id)
{
	struct input_handle *handle;
	int error;

	sysrq_down = false;
	sysrq_alt = 0;

	handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
	if (!handle)
		return -ENOMEM;

	handle->dev = dev;
	handle->handler = handler;
	handle->name = "sysrq";

	error = input_register_handle(handle);
	if (error) {
		pr_err("Failed to register input sysrq handler, error %d\n",
			error);
		goto err_free;
	}

	error = input_open_device(handle);
	if (error) {
		pr_err("Failed to open input device, error %d\n", error);
		goto err_unregister;
	}

	return 0;

 err_unregister:
	input_unregister_handle(handle);
 err_free:
	kfree(handle);
	return error;
}
Ejemplo n.º 20
0
static void ate_disconnect(struct input_handle *handle)
{
    int i, j;
	printk(KERN_DEBUG pr_fmt("Disconnected device: %s\n"),
	       dev_name(&handle->dev->dev));
    for (i = 0; i < ate_dt->ate_dev.input_dev_sum; i++) {
        if (0 == strcmp(handle->dev->name, ate_dt->ate_dev.input_dev_table[i]->name)) {
            for (j = i; j < ate_dt->ate_dev.input_dev_sum - 1; j++) {
				ate_dt->ate_dev.input_dev_table[j] = ate_dt->ate_dev.input_dev_table[j + 1];
				ate_dt->ate_dev.valid[j] = ate_dt->ate_dev.valid[j + 1];
				ate_dt->ate_dev.input_event_type[j] = ate_dt->ate_dev.input_event_type[j+1];
			}
			ate_dt->ate_dev.input_dev_table[j] = NULL;
			ate_dt->ate_dev.valid[j] = false;
			ate_dt->ate_dev.input_event_type[j] = NULL_EVENT_TYPE;
			ate_dt->ate_dev.input_dev_sum--;
			break;
	   	}
	}

	input_close_device(handle);
	input_unregister_handle(handle);
	kfree(handle);
}
Ejemplo n.º 21
0
static void cpuboost_input_disconnect(struct input_handle *handle)
{
	input_close_device(handle);
	input_unregister_handle(handle);
	kfree(handle);
}
Ejemplo n.º 22
0
static void apmpower_disconnect(struct input_handle *handle)
{
	input_close_device(handle);
	input_unregister_handle(handle);
	kfree(handle);
}
Ejemplo n.º 23
0
static void intelli_plug_input_disconnect(struct input_handle *handle)
{
	input_close_device(handle);
	input_unregister_handle(handle);
	kfree(handle);
}
Ejemplo n.º 24
0
static void touch_dvfs_disconnect(struct input_handle *handle)
{
	input_close_device(handle);
	input_unregister_handle(handle);
	kfree(handle);
}
Ejemplo n.º 25
0
static void mac_hid_emumouse_disconnect(struct input_handle *handle)
{
	input_close_device(handle);
	input_unregister_handle(handle);
	kfree(handle);
}
static void force_crash_disconnect(struct input_handle *handle)
{
	input_close_device(handle);
	input_unregister_handle(handle);
	kfree(handle);
}