• Home
  • Raw
  • Download

Lines Matching +full:max +full:- +full:fingers

1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* -------------------------------------------------------------------------
3 * Copyright (C) 2014-2015, Intel Corporation
7 * Copyright (C) 2010-2015, Shanghai Sileadinc Co.Ltd
9 * -------------------------------------------------------------------------
87 struct device *dev = &data->client->dev; in silead_ts_request_input_dev()
90 data->input = devm_input_allocate_device(dev); in silead_ts_request_input_dev()
91 if (!data->input) { in silead_ts_request_input_dev()
94 return -ENOMEM; in silead_ts_request_input_dev()
97 input_set_abs_params(data->input, ABS_MT_POSITION_X, 0, 4095, 0, 0); in silead_ts_request_input_dev()
98 input_set_abs_params(data->input, ABS_MT_POSITION_Y, 0, 4095, 0, 0); in silead_ts_request_input_dev()
99 touchscreen_parse_properties(data->input, true, &data->prop); in silead_ts_request_input_dev()
101 input_mt_init_slots(data->input, data->max_fingers, in silead_ts_request_input_dev()
105 if (device_property_read_bool(dev, "silead,home-button")) in silead_ts_request_input_dev()
106 input_set_capability(data->input, EV_KEY, KEY_LEFTMETA); in silead_ts_request_input_dev()
108 data->input->name = SILEAD_TS_NAME; in silead_ts_request_input_dev()
109 data->input->phys = "input/ts"; in silead_ts_request_input_dev()
110 data->input->id.bustype = BUS_I2C; in silead_ts_request_input_dev()
112 error = input_register_device(data->input); in silead_ts_request_input_dev()
126 if (data->gpio_power) { in silead_ts_set_power()
127 gpiod_set_value_cansleep(data->gpio_power, state); in silead_ts_set_power()
135 struct input_dev *input = data->input; in silead_ts_read_data()
136 struct device *dev = &client->dev; in silead_ts_read_data()
148 if (buf[0] > data->max_fingers) { in silead_ts_read_data()
150 buf[0], data->max_fingers); in silead_ts_read_data()
151 buf[0] = data->max_fingers; in silead_ts_read_data()
173 * Bits 4-7 are the touch id, note not all models have in silead_ts_read_data()
176 data->id[touch_nr] = (bufp[SILEAD_POINT_X_MSB_OFF] & in silead_ts_read_data()
178 touchscreen_set_mt_pos(&data->pos[touch_nr], &data->prop, in silead_ts_read_data()
184 input_mt_assign_slots(input, data->slots, data->pos, touch_nr, 0); in silead_ts_read_data()
187 input_mt_slot(input, data->slots[i]); in silead_ts_read_data()
189 input_report_abs(input, ABS_MT_POSITION_X, data->pos[i].x); in silead_ts_read_data()
190 input_report_abs(input, ABS_MT_POSITION_Y, data->pos[i].y); in silead_ts_read_data()
192 dev_dbg(dev, "x=%d y=%d hw_id=%d sw_id=%d\n", data->pos[i].x, in silead_ts_read_data()
193 data->pos[i].y, data->id[i], data->slots[i]); in silead_ts_read_data()
213 data->max_fingers); in silead_ts_init()
233 dev_err(&client->dev, "Registers clear error %d\n", error); in silead_ts_init()
262 dev_err(&client->dev, "Chip reset error %d\n", error); in silead_ts_reset()
272 dev_err(&client->dev, "Startup error %d\n", error); in silead_ts_startup()
283 struct device *dev = &client->dev; in silead_ts_load_fw()
290 dev_dbg(dev, "Firmware file name: %s", data->fw_name); in silead_ts_load_fw()
292 error = firmware_request_platform(&fw, data->fw_name, dev); in silead_ts_load_fw()
298 fw_size = fw->size / sizeof(*fw_data); in silead_ts_load_fw()
299 fw_data = (struct silead_fw_data *)fw->data; in silead_ts_load_fw()
324 dev_err(&client->dev, "Status read error %d\n", error); in silead_ts_get_status()
342 data->chip_id = le32_to_cpu(chip_id); in silead_ts_get_id()
343 dev_info(&client->dev, "Silead chip ID: 0x%8X", data->chip_id); in silead_ts_get_id()
354 * Some buggy BIOS-es bring up the chip in a stuck state where it in silead_ts_setup()
359 * response to which the I2C-bus-driver will call: in silead_ts_setup()
360 * i2c_recover_bus() which will unstuck the I2C-bus. Note the in silead_ts_setup()
361 * unstuck-ing of the I2C bus only works if we first drop the in silead_ts_setup()
367 * Resources. The workaround below runtime-suspends the chip to in silead_ts_setup()
372 if (device_property_read_bool(&client->dev, in silead_ts_setup()
373 "silead,stuck-controller-bug")) { in silead_ts_setup()
374 pm_runtime_set_active(&client->dev); in silead_ts_setup()
375 pm_runtime_enable(&client->dev); in silead_ts_setup()
376 pm_runtime_allow(&client->dev); in silead_ts_setup()
378 pm_runtime_suspend(&client->dev); in silead_ts_setup()
380 …dev_warn(&client->dev, FW_BUG "Stuck I2C bus: please ignore the next 'controller timed out' error\… in silead_ts_setup()
384 pm_runtime_forbid(&client->dev); in silead_ts_setup()
385 pm_runtime_disable(&client->dev); in silead_ts_setup()
393 dev_err(&client->dev, "Chip ID read error %d\n", error); in silead_ts_setup()
415 dev_err(&client->dev, in silead_ts_setup()
417 return -ENODEV; in silead_ts_setup()
426 struct i2c_client *client = data->client; in silead_ts_threaded_irq_handler()
436 struct device *dev = &client->dev; in silead_ts_read_props()
440 error = device_property_read_u32(dev, "silead,max-fingers", in silead_ts_read_props()
441 &data->max_fingers); in silead_ts_read_props()
443 dev_dbg(dev, "Max fingers read error %d\n", error); in silead_ts_read_props()
444 data->max_fingers = 5; /* Most devices handle up-to 5 fingers */ in silead_ts_read_props()
447 error = device_property_read_string(dev, "firmware-name", &str); in silead_ts_read_props()
449 snprintf(data->fw_name, sizeof(data->fw_name), in silead_ts_read_props()
460 struct device *dev = &data->client->dev; in silead_ts_set_default_fw_name()
464 acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev); in silead_ts_set_default_fw_name()
466 return -ENODEV; in silead_ts_set_default_fw_name()
468 snprintf(data->fw_name, sizeof(data->fw_name), in silead_ts_set_default_fw_name()
469 "silead/%s.fw", acpi_id->id); in silead_ts_set_default_fw_name()
471 for (i = 0; i < strlen(data->fw_name); i++) in silead_ts_set_default_fw_name()
472 data->fw_name[i] = tolower(data->fw_name[i]); in silead_ts_set_default_fw_name()
474 snprintf(data->fw_name, sizeof(data->fw_name), in silead_ts_set_default_fw_name()
475 "silead/%s.fw", id->name); in silead_ts_set_default_fw_name()
484 snprintf(data->fw_name, sizeof(data->fw_name), in silead_ts_set_default_fw_name()
485 "silead/%s.fw", id->name); in silead_ts_set_default_fw_name()
494 regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators); in silead_disable_regulator()
501 struct device *dev = &client->dev; in silead_ts_probe()
504 if (!i2c_check_functionality(client->adapter, in silead_ts_probe()
509 return -ENXIO; in silead_ts_probe()
514 return -ENOMEM; in silead_ts_probe()
517 data->client = client; in silead_ts_probe()
526 if (client->irq <= 0) in silead_ts_probe()
527 return -ENODEV; in silead_ts_probe()
529 data->regulators[0].supply = "vddio"; in silead_ts_probe()
530 data->regulators[1].supply = "avdd"; in silead_ts_probe()
531 error = devm_regulator_bulk_get(dev, ARRAY_SIZE(data->regulators), in silead_ts_probe()
532 data->regulators); in silead_ts_probe()
540 error = regulator_bulk_enable(ARRAY_SIZE(data->regulators), in silead_ts_probe()
541 data->regulators); in silead_ts_probe()
550 data->gpio_power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW); in silead_ts_probe()
551 if (IS_ERR(data->gpio_power)) { in silead_ts_probe()
552 if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER) in silead_ts_probe()
554 return PTR_ERR(data->gpio_power); in silead_ts_probe()
565 error = devm_request_threaded_irq(dev, client->irq, in silead_ts_probe()
567 IRQF_ONESHOT, client->name, data); in silead_ts_probe()
569 if (error != -EPROBE_DEFER) in silead_ts_probe()
581 disable_irq(client->irq); in silead_ts_suspend()
617 return -ENODEV; in silead_ts_resume()
620 enable_irq(client->irq); in silead_ts_resume()