static int mcs5000_ts_resume(struct i2c_client *client) { struct mcs5000_ts_data *data = i2c_get_clientdata(client); mcs5000_ts_phys_init(data); return 0; }
static int __maybe_unused mcs5000_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct mcs5000_ts_data *data = i2c_get_clientdata(client); const struct mcs_platform_data *pdata = dev_get_platdata(dev); mcs5000_ts_phys_init(data, pdata); return 0; }
static int __devinit mcs5000_ts_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct mcs5000_ts_data *data; struct input_dev *input_dev; int ret; if (!client->dev.platform_data) return -EINVAL; data = kzalloc(sizeof(struct mcs5000_ts_data), GFP_KERNEL); input_dev = input_allocate_device(); if (!data || !input_dev) { dev_err(&client->dev, "Failed to allocate memory\n"); ret = -ENOMEM; goto err_free_mem; } data->client = client; data->input_dev = input_dev; data->platform_data = client->dev.platform_data; input_dev->name = "MELPAS MCS-5000 Touchscreen"; input_dev->id.bustype = BUS_I2C; input_dev->dev.parent = &client->dev; __set_bit(EV_ABS, input_dev->evbit); __set_bit(EV_KEY, input_dev->evbit); __set_bit(BTN_TOUCH, input_dev->keybit); input_set_abs_params(input_dev, ABS_X, 0, MCS5000_MAX_XC, 0, 0); input_set_abs_params(input_dev, ABS_Y, 0, MCS5000_MAX_YC, 0, 0); input_set_drvdata(input_dev, data); if (data->platform_data->cfg_pin) data->platform_data->cfg_pin(); ret = request_threaded_irq(client->irq, NULL, mcs5000_ts_interrupt, IRQF_TRIGGER_LOW | IRQF_ONESHOT, "mcs5000_ts", data); if (ret < 0) { dev_err(&client->dev, "Failed to register interrupt\n"); goto err_free_mem; } ret = input_register_device(data->input_dev); if (ret < 0) goto err_free_irq; mcs5000_ts_phys_init(data); i2c_set_clientdata(client, data); return 0; err_free_irq: free_irq(client->irq, data); err_free_mem: input_free_device(input_dev); kfree(data); return ret; }
static int mcs5000_ts_probe(struct i2c_client *client, const struct i2c_device_id *id) { const struct mcs_platform_data *pdata; struct mcs5000_ts_data *data; struct input_dev *input_dev; int error; pdata = dev_get_platdata(&client->dev); if (!pdata) return -EINVAL; data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); if (!data) { dev_err(&client->dev, "Failed to allocate memory\n"); return -ENOMEM; } data->client = client; input_dev = devm_input_allocate_device(&client->dev); if (!input_dev) { dev_err(&client->dev, "Failed to allocate input device\n"); return -ENOMEM; } input_dev->name = "MELFAS MCS-5000 Touchscreen"; input_dev->id.bustype = BUS_I2C; input_dev->dev.parent = &client->dev; __set_bit(EV_ABS, input_dev->evbit); __set_bit(EV_KEY, input_dev->evbit); __set_bit(BTN_TOUCH, input_dev->keybit); input_set_abs_params(input_dev, ABS_X, 0, MCS5000_MAX_XC, 0, 0); input_set_abs_params(input_dev, ABS_Y, 0, MCS5000_MAX_YC, 0, 0); data->input_dev = input_dev; if (pdata->cfg_pin) pdata->cfg_pin(); error = devm_request_threaded_irq(&client->dev, client->irq, NULL, mcs5000_ts_interrupt, IRQF_TRIGGER_LOW | IRQF_ONESHOT, "mcs5000_ts", data); if (error) { dev_err(&client->dev, "Failed to register interrupt\n"); return error; } error = input_register_device(data->input_dev); if (error) { dev_err(&client->dev, "Failed to register input device\n"); return error; } mcs5000_ts_phys_init(data, pdata); i2c_set_clientdata(client, data); return 0; }