Lines Matching +full:glove +full:- +full:enable

1 // SPDX-License-Identifier: GPL-2.0
93 dev_err_ratelimited(&tsdata->client->dev, in hycon_hy46xx_check_checksum()
103 struct device *dev = &tsdata->client->dev; in hycon_hy46xx_isr()
110 error = regmap_bulk_read(tsdata->regmap, 0, rdbuf, sizeof(rdbuf)); in hycon_hy46xx_isr()
132 input_mt_slot(tsdata->input, id); in hycon_hy46xx_isr()
133 if (input_mt_report_slot_state(tsdata->input, MT_TOOL_FINGER, in hycon_hy46xx_isr()
135 touchscreen_report_pos(tsdata->input, &tsdata->prop, in hycon_hy46xx_isr()
139 input_mt_report_pointer_emulation(tsdata->input, false); in hycon_hy46xx_isr()
140 input_sync(tsdata->input); in hycon_hy46xx_isr()
183 u8 *field = (u8 *)tsdata + attr->field_offset; in hycon_hy46xx_setting_show()
188 mutex_lock(&tsdata->mutex); in hycon_hy46xx_setting_show()
190 error = regmap_read(tsdata->regmap, attr->address, &val); in hycon_hy46xx_setting_show()
192 dev_err(&tsdata->client->dev, in hycon_hy46xx_setting_show()
194 dattr->attr.name, error); in hycon_hy46xx_setting_show()
199 dev_warn(&tsdata->client->dev, in hycon_hy46xx_setting_show()
201 dattr->attr.name, val, *field); in hycon_hy46xx_setting_show()
208 mutex_unlock(&tsdata->mutex); in hycon_hy46xx_setting_show()
220 u8 *field = (u8 *)tsdata + attr->field_offset; in hycon_hy46xx_setting_store()
224 mutex_lock(&tsdata->mutex); in hycon_hy46xx_setting_store()
230 if (val < attr->limit_low || val > attr->limit_high) { in hycon_hy46xx_setting_store()
231 error = -ERANGE; in hycon_hy46xx_setting_store()
235 error = regmap_write(tsdata->regmap, attr->address, val); in hycon_hy46xx_setting_store()
237 dev_err(&tsdata->client->dev, in hycon_hy46xx_setting_store()
239 dattr->attr.name, error); in hycon_hy46xx_setting_store()
245 mutex_unlock(&tsdata->mutex); in hycon_hy46xx_setting_store()
290 error = regmap_write(tsdata->regmap, HY46XX_THRESHOLD, val); in hycon_hy46xx_get_defaults()
294 tsdata->threshold = val; in hycon_hy46xx_get_defaults()
297 val_bool = device_property_read_bool(dev, "hycon,glove-enable"); in hycon_hy46xx_get_defaults()
298 error = regmap_write(tsdata->regmap, HY46XX_GLOVE_EN, val_bool); in hycon_hy46xx_get_defaults()
301 tsdata->glove_enable = val_bool; in hycon_hy46xx_get_defaults()
303 error = device_property_read_u32(dev, "hycon,report-speed-hz", &val); in hycon_hy46xx_get_defaults()
305 error = regmap_write(tsdata->regmap, HY46XX_REPORT_SPEED, val); in hycon_hy46xx_get_defaults()
309 tsdata->report_speed = val; in hycon_hy46xx_get_defaults()
312 val_bool = device_property_read_bool(dev, "hycon,noise-filter-enable"); in hycon_hy46xx_get_defaults()
313 error = regmap_write(tsdata->regmap, HY46XX_PWR_NOISE_EN, val_bool); in hycon_hy46xx_get_defaults()
316 tsdata->noise_filter_enable = val_bool; in hycon_hy46xx_get_defaults()
318 error = device_property_read_u32(dev, "hycon,filter-data", &val); in hycon_hy46xx_get_defaults()
320 error = regmap_write(tsdata->regmap, HY46XX_FILTER_DATA, val); in hycon_hy46xx_get_defaults()
324 tsdata->filter_data = val; in hycon_hy46xx_get_defaults()
329 error = regmap_write(tsdata->regmap, HY46XX_GAIN, val); in hycon_hy46xx_get_defaults()
333 tsdata->gain = val; in hycon_hy46xx_get_defaults()
336 error = device_property_read_u32(dev, "hycon,edge-offset", &val); in hycon_hy46xx_get_defaults()
338 error = regmap_write(tsdata->regmap, HY46XX_EDGE_OFFSET, val); in hycon_hy46xx_get_defaults()
342 tsdata->edge_offset = val; in hycon_hy46xx_get_defaults()
347 dev_err(&tsdata->client->dev, "Failed to set default settings"); in hycon_hy46xx_get_defaults()
355 error = regmap_read(tsdata->regmap, HY46XX_THRESHOLD, &val); in hycon_hy46xx_get_parameters()
358 tsdata->threshold = val; in hycon_hy46xx_get_parameters()
360 error = regmap_read(tsdata->regmap, HY46XX_GLOVE_EN, &val); in hycon_hy46xx_get_parameters()
363 tsdata->glove_enable = val; in hycon_hy46xx_get_parameters()
365 error = regmap_read(tsdata->regmap, HY46XX_REPORT_SPEED, &val); in hycon_hy46xx_get_parameters()
368 tsdata->report_speed = val; in hycon_hy46xx_get_parameters()
370 error = regmap_read(tsdata->regmap, HY46XX_PWR_NOISE_EN, &val); in hycon_hy46xx_get_parameters()
373 tsdata->noise_filter_enable = val; in hycon_hy46xx_get_parameters()
375 error = regmap_read(tsdata->regmap, HY46XX_FILTER_DATA, &val); in hycon_hy46xx_get_parameters()
378 tsdata->filter_data = val; in hycon_hy46xx_get_parameters()
380 error = regmap_read(tsdata->regmap, HY46XX_GAIN, &val); in hycon_hy46xx_get_parameters()
383 tsdata->gain = val; in hycon_hy46xx_get_parameters()
385 error = regmap_read(tsdata->regmap, HY46XX_EDGE_OFFSET, &val); in hycon_hy46xx_get_parameters()
388 tsdata->edge_offset = val; in hycon_hy46xx_get_parameters()
390 error = regmap_read(tsdata->regmap, HY46XX_RX_NR_USED, &val); in hycon_hy46xx_get_parameters()
393 tsdata->rx_number_used = val; in hycon_hy46xx_get_parameters()
395 error = regmap_read(tsdata->regmap, HY46XX_TX_NR_USED, &val); in hycon_hy46xx_get_parameters()
398 tsdata->tx_number_used = val; in hycon_hy46xx_get_parameters()
400 error = regmap_read(tsdata->regmap, HY46XX_PWR_MODE, &val); in hycon_hy46xx_get_parameters()
403 tsdata->power_mode = val; in hycon_hy46xx_get_parameters()
405 error = regmap_read(tsdata->regmap, HY46XX_FW_VERSION, &val); in hycon_hy46xx_get_parameters()
408 tsdata->fw_version = val; in hycon_hy46xx_get_parameters()
410 error = regmap_read(tsdata->regmap, HY46XX_LIB_VERSION, &val); in hycon_hy46xx_get_parameters()
413 tsdata->lib_version = val; in hycon_hy46xx_get_parameters()
415 error = regmap_read(tsdata->regmap, HY46XX_TP_INFO, &val); in hycon_hy46xx_get_parameters()
418 tsdata->tp_information = val; in hycon_hy46xx_get_parameters()
420 error = regmap_read(tsdata->regmap, HY46XX_TP_CHIP_ID, &val); in hycon_hy46xx_get_parameters()
423 tsdata->tp_chip_id = val; in hycon_hy46xx_get_parameters()
425 error = regmap_read(tsdata->regmap, HY46XX_BOOT_VER, &val); in hycon_hy46xx_get_parameters()
428 tsdata->bootloader_version = val; in hycon_hy46xx_get_parameters()
432 dev_err(&tsdata->client->dev, "Failed to read default settings"); in hycon_hy46xx_get_parameters()
439 regulator_disable(data->vcc); in hycon_hy46xx_disable_regulator()
449 dev_dbg(&client->dev, "probing for HYCON HY46XX I2C\n"); in hycon_hy46xx_probe()
451 tsdata = devm_kzalloc(&client->dev, sizeof(*tsdata), GFP_KERNEL); in hycon_hy46xx_probe()
453 return -ENOMEM; in hycon_hy46xx_probe()
455 tsdata->vcc = devm_regulator_get(&client->dev, "vcc"); in hycon_hy46xx_probe()
456 if (IS_ERR(tsdata->vcc)) { in hycon_hy46xx_probe()
457 error = PTR_ERR(tsdata->vcc); in hycon_hy46xx_probe()
458 if (error != -EPROBE_DEFER) in hycon_hy46xx_probe()
459 dev_err(&client->dev, in hycon_hy46xx_probe()
464 error = regulator_enable(tsdata->vcc); in hycon_hy46xx_probe()
466 dev_err(&client->dev, "failed to enable vcc: %d\n", error); in hycon_hy46xx_probe()
470 error = devm_add_action_or_reset(&client->dev, in hycon_hy46xx_probe()
476 tsdata->reset_gpio = devm_gpiod_get_optional(&client->dev, in hycon_hy46xx_probe()
478 if (IS_ERR(tsdata->reset_gpio)) { in hycon_hy46xx_probe()
479 error = PTR_ERR(tsdata->reset_gpio); in hycon_hy46xx_probe()
480 dev_err(&client->dev, in hycon_hy46xx_probe()
485 if (tsdata->reset_gpio) { in hycon_hy46xx_probe()
487 gpiod_set_value_cansleep(tsdata->reset_gpio, 1); in hycon_hy46xx_probe()
489 gpiod_set_value_cansleep(tsdata->reset_gpio, 0); in hycon_hy46xx_probe()
493 input = devm_input_allocate_device(&client->dev); in hycon_hy46xx_probe()
495 dev_err(&client->dev, "failed to allocate input device.\n"); in hycon_hy46xx_probe()
496 return -ENOMEM; in hycon_hy46xx_probe()
499 mutex_init(&tsdata->mutex); in hycon_hy46xx_probe()
500 tsdata->client = client; in hycon_hy46xx_probe()
501 tsdata->input = input; in hycon_hy46xx_probe()
503 tsdata->regmap = devm_regmap_init_i2c(client, in hycon_hy46xx_probe()
505 if (IS_ERR(tsdata->regmap)) { in hycon_hy46xx_probe()
506 dev_err(&client->dev, "regmap allocation failed\n"); in hycon_hy46xx_probe()
507 return PTR_ERR(tsdata->regmap); in hycon_hy46xx_probe()
510 hycon_hy46xx_get_defaults(&client->dev, tsdata); in hycon_hy46xx_probe()
513 input->name = "Hycon Capacitive Touch"; in hycon_hy46xx_probe()
514 input->id.bustype = BUS_I2C; in hycon_hy46xx_probe()
515 input->dev.parent = &client->dev; in hycon_hy46xx_probe()
517 input_set_abs_params(input, ABS_MT_POSITION_X, 0, -1, 0, 0); in hycon_hy46xx_probe()
518 input_set_abs_params(input, ABS_MT_POSITION_Y, 0, -1, 0, 0); in hycon_hy46xx_probe()
520 touchscreen_parse_properties(input, true, &tsdata->prop); in hycon_hy46xx_probe()
525 dev_err(&client->dev, "Unable to init MT slots.\n"); in hycon_hy46xx_probe()
531 error = devm_request_threaded_irq(&client->dev, client->irq, in hycon_hy46xx_probe()
533 client->name, tsdata); in hycon_hy46xx_probe()
535 dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); in hycon_hy46xx_probe()
539 error = devm_device_add_group(&client->dev, &hycon_hy46xx_attr_group); in hycon_hy46xx_probe()
547 dev_dbg(&client->dev, in hycon_hy46xx_probe()
549 client->irq, in hycon_hy46xx_probe()
550 tsdata->reset_gpio ? desc_to_gpio(tsdata->reset_gpio) : -1); in hycon_hy46xx_probe()