// SPDX-License-Identifier: GPL-2.0-only /* * Driver for Goodix Touchscreens * * Copyright (c) 2014 Red Hat Inc. * Copyright (c) 2015 K. Merker <merker@debian.org> * * This code is based on gt9xx.c authored by andrew@goodix.com: * * 2010 - 2012 Goodix Technology.
*/
/* Our special handling for GPIO accesses through ACPI is x86 specific */ #ifdefined CONFIG_X86 && defined CONFIG_ACPI #define ACPI_GPIO_SUPPORT #endif
staticconststruct dmi_system_id nine_bytes_report[] = { #ifdefined(CONFIG_DMI) && defined(CONFIG_X86)
{ /* Lenovo Yoga Book X90F / X90L */
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "YETI-11"),
}
},
{ /* Lenovo Yoga Book X91F / X91L */
.matches = { /* Non exact match to match F + L versions */
DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X91"),
}
}, #endif
{}
};
/* * Those tablets have their x coordinate inverted
*/ staticconststruct dmi_system_id inverted_x_screen[] = { #ifdefined(CONFIG_DMI) && defined(CONFIG_X86)
{
.ident = "Cube I15-TC",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Cube"),
DMI_MATCH(DMI_PRODUCT_NAME, "I15-TC")
},
}, #endif
{}
};
/** * goodix_i2c_read - read data from a register of the i2c slave device. * * @client: i2c device. * @reg: the register to read from. * @buf: raw write data buffer. * @len: length of the buffer to write
*/ int goodix_i2c_read(struct i2c_client *client, u16 reg, u8 *buf, int len)
{ struct i2c_msg msgs[2];
__be16 wbuf = cpu_to_be16(reg); int ret;
ret = i2c_transfer(client->adapter, msgs, 2); if (ret >= 0)
ret = (ret == ARRAY_SIZE(msgs) ? 0 : -EIO);
if (ret)
dev_err(&client->dev, "Error reading %d bytes from 0x%04x: %d\n",
len, reg, ret); return ret;
}
/** * goodix_i2c_write - write data to a register of the i2c slave device. * * @client: i2c device. * @reg: the register to write to. * @buf: raw data buffer to write. * @len: length of the buffer to write
*/ int goodix_i2c_write(struct i2c_client *client, u16 reg, const u8 *buf, int len)
{
u8 *addr_buf; struct i2c_msg msg; int ret;
addr_buf = kmalloc(len + 2, GFP_KERNEL); if (!addr_buf) return -ENOMEM;
for (i = 0; goodix_chip_ids[i].id; i++) { if (!strcmp(goodix_chip_ids[i].id, id)) return goodix_chip_ids[i].data;
}
return >9x_chip_data;
}
staticint goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data)
{ unsignedlong max_timeout; int touch_num; int error;
u16 addr = GOODIX_READ_COOR_ADDR; /* * We are going to read 1-byte header, * ts->contact_size * max(1, touch_num) bytes of coordinates * and 1-byte footer which contains the touch-key code.
*/ constint header_contact_keycode_size = 1 + ts->contact_size + 1;
/* * The 'buffer status' bit, which indicates that the data is valid, is * not set as soon as the interrupt is raised, but slightly after. * This takes around 10 ms to happen, so we poll for 20 ms.
*/
max_timeout = jiffies + msecs_to_jiffies(GOODIX_BUFFER_STATUS_TIMEOUT); do {
error = goodix_i2c_read(ts->client, addr, data,
header_contact_keycode_size); if (error) return error;
if (data[0] & GOODIX_BUFFER_STATUS_READY) {
touch_num = data[0] & 0x0f; if (touch_num > ts->max_touch_num) return -EPROTO;
if (touch_num > 1) {
addr += header_contact_keycode_size;
data += header_contact_keycode_size;
error = goodix_i2c_read(ts->client,
addr, data,
ts->contact_size *
(touch_num - 1)); if (error) return error;
}
return touch_num;
}
if (data[0] == 0 && ts->firmware_name) { if (goodix_handle_fw_request(ts)) return 0;
}
usleep_range(1000, 2000); /* Poll every 1 - 2 ms */
} while (time_before(jiffies, max_timeout));
/* * The Goodix panel will send spurious interrupts after a * 'finger up' event, which will always cause a timeout.
*/ return -ENOMSG;
}
input = devm_input_allocate_device(dev); if (!input) return -ENOMEM;
input_copy_abs(input, ABS_X, ts->input_dev, ABS_MT_POSITION_X);
input_copy_abs(input, ABS_Y, ts->input_dev, ABS_MT_POSITION_Y); /* * The resolution of these touchscreens is about 10 units/mm, the actual * resolution does not matter much since we set INPUT_PROP_DIRECT. * Userspace wants something here though, so just set it to 10 units/mm.
*/
input_abs_set_res(input, ABS_X, 10);
input_abs_set_res(input, ABS_Y, 10);
input_set_abs_params(input, ABS_PRESSURE, 0, 255, 0, 0);
staticvoid goodix_ts_report_touch_8b(struct goodix_ts_data *ts, u8 *coor_data)
{ int id = coor_data[0] & 0x0F; int input_x = get_unaligned_le16(&coor_data[1]); int input_y = get_unaligned_le16(&coor_data[3]); int input_w = get_unaligned_le16(&coor_data[5]);
staticvoid goodix_ts_report_touch_9b(struct goodix_ts_data *ts, u8 *coor_data)
{ int id = coor_data[1] & 0x0F; int input_x = get_unaligned_le16(&coor_data[3]); int input_y = get_unaligned_le16(&coor_data[5]); int input_w = get_unaligned_le16(&coor_data[7]);
staticvoid goodix_ts_release_keys(struct goodix_ts_data *ts)
{ int i;
for (i = 0; i < GOODIX_MAX_KEYS; i++)
input_report_key(ts->input_dev, ts->keymap[i], 0);
}
staticvoid goodix_ts_report_key(struct goodix_ts_data *ts, u8 *data)
{ int touch_num;
u8 key_value; int i;
if (data[0] & GOODIX_HAVE_KEY) {
touch_num = data[0] & 0x0f;
key_value = data[1 + ts->contact_size * touch_num]; for (i = 0; i < GOODIX_MAX_KEYS; i++) if (key_value & BIT(i))
input_report_key(ts->input_dev,
ts->keymap[i], 1);
} else {
goodix_ts_release_keys(ts);
}
}
/** * goodix_process_events - Process incoming events * * @ts: our goodix_ts_data pointer * * Called when the IRQ is triggered. Read the current device state, and push * the input events to the user space.
*/ staticvoid goodix_process_events(struct goodix_ts_data *ts)
{
u8 point_data[2 + GOODIX_MAX_CONTACT_SIZE * GOODIX_MAX_CONTACTS]; int touch_num; int i;
touch_num = goodix_ts_read_input_report(ts, point_data); if (touch_num < 0) return;
/* The pen being down is always reported as a single touch */ if (touch_num == 1 && (point_data[1] & 0x80)) {
goodix_ts_report_pen_down(ts, point_data);
goodix_ts_release_keys(ts); goto sync; /* Release any previously registered touches */
} else {
goodix_ts_report_pen_up(ts);
}
goodix_ts_report_key(ts, point_data);
for (i = 0; i < touch_num; i++) if (ts->contact_size == 9)
goodix_ts_report_touch_9b(ts,
&point_data[1 + ts->contact_size * i]); else
goodix_ts_report_touch_8b(ts,
&point_data[1 + ts->contact_size * i]);
staticint goodix_check_cfg_8(struct goodix_ts_data *ts, const u8 *cfg, int len)
{ int i, raw_cfg_len = len - 2;
u8 check_sum = 0;
for (i = 0; i < raw_cfg_len; i++)
check_sum += cfg[i];
check_sum = (~check_sum) + 1; if (check_sum != cfg[raw_cfg_len]) {
dev_err(&ts->client->dev, "The checksum of the config fw is not correct"); return -EINVAL;
}
if (cfg[raw_cfg_len + 1] != 1) {
dev_err(&ts->client->dev, "Config fw must have Config_Fresh register set"); return -EINVAL;
}
return 0;
}
staticvoid goodix_calc_cfg_checksum_8(struct goodix_ts_data *ts)
{ int i, raw_cfg_len = ts->chip->config_len - 2;
u8 check_sum = 0;
for (i = 0; i < raw_cfg_len; i++)
check_sum += ts->config[i];
check_sum = (~check_sum) + 1;
ts->config[raw_cfg_len] = check_sum;
ts->config[raw_cfg_len + 1] = 1; /* Set "config_fresh" bit */
}
staticint goodix_check_cfg_16(struct goodix_ts_data *ts, const u8 *cfg, int len)
{ int i, raw_cfg_len = len - 3;
u16 check_sum = 0;
for (i = 0; i < raw_cfg_len; i += 2)
check_sum += get_unaligned_be16(&cfg[i]);
check_sum = (~check_sum) + 1; if (check_sum != get_unaligned_be16(&cfg[raw_cfg_len])) {
dev_err(&ts->client->dev, "The checksum of the config fw is not correct"); return -EINVAL;
}
if (cfg[raw_cfg_len + 2] != 1) {
dev_err(&ts->client->dev, "Config fw must have Config_Fresh register set"); return -EINVAL;
}
return 0;
}
staticvoid goodix_calc_cfg_checksum_16(struct goodix_ts_data *ts)
{ int i, raw_cfg_len = ts->chip->config_len - 3;
u16 check_sum = 0;
for (i = 0; i < raw_cfg_len; i += 2)
check_sum += get_unaligned_be16(&ts->config[i]);
check_sum = (~check_sum) + 1;
put_unaligned_be16(check_sum, &ts->config[raw_cfg_len]);
ts->config[raw_cfg_len + 2] = 1; /* Set "config_fresh" bit */
}
/** * goodix_check_cfg - Checks if config fw is valid * * @ts: goodix_ts_data pointer * @cfg: firmware config data * @len: config data length
*/ staticint goodix_check_cfg(struct goodix_ts_data *ts, const u8 *cfg, int len)
{ if (len < GOODIX_CONFIG_MIN_LENGTH ||
len > GOODIX_CONFIG_MAX_LENGTH) {
dev_err(&ts->client->dev, "The length of the config fw is not correct"); return -EINVAL;
}
return ts->chip->check_config(ts, cfg, len);
}
/** * goodix_send_cfg - Write fw config to device * * @ts: goodix_ts_data pointer * @cfg: config firmware to write to device * @len: config data length
*/ int goodix_send_cfg(struct goodix_ts_data *ts, const u8 *cfg, int len)
{ int error;
error = goodix_check_cfg(ts, cfg, len); if (error) return error;
error = goodix_i2c_write(ts->client, ts->chip->config_addr, cfg, len); if (error) return error;
dev_dbg(&ts->client->dev, "Config sent successfully.");
/* Let the firmware reconfigure itself, so sleep for 10ms */
usleep_range(10000, 11000);
status = acpi_execute_simple_method(handle, "INTO", value); return ACPI_SUCCESS(status) ? 0 : -EIO;
} #else staticint goodix_pin_acpi_direction_input(struct goodix_ts_data *ts)
{
dev_err(&ts->client->dev, "%s called on device without ACPI support\n", __func__); return -EINVAL;
}
staticint goodix_pin_acpi_output_method(struct goodix_ts_data *ts, int value)
{
dev_err(&ts->client->dev, "%s called on device without ACPI support\n", __func__); return -EINVAL;
} #endif
staticint goodix_irq_direction_output(struct goodix_ts_data *ts, int value)
{ switch (ts->irq_pin_access_method) { case IRQ_PIN_ACCESS_NONE:
dev_err(&ts->client->dev, "%s called without an irq_pin_access_method set\n",
__func__); return -EINVAL; case IRQ_PIN_ACCESS_GPIO: return gpiod_direction_output(ts->gpiod_int, value); case IRQ_PIN_ACCESS_ACPI_GPIO: /* * The IRQ pin triggers on a falling edge, so its gets marked * as active-low, use output_raw to avoid the value inversion.
*/ return gpiod_direction_output_raw(ts->gpiod_int, value); case IRQ_PIN_ACCESS_ACPI_METHOD: return goodix_pin_acpi_output_method(ts, value);
}
return -EINVAL; /* Never reached */
}
staticint goodix_irq_direction_input(struct goodix_ts_data *ts)
{ switch (ts->irq_pin_access_method) { case IRQ_PIN_ACCESS_NONE:
dev_err(&ts->client->dev, "%s called without an irq_pin_access_method set\n",
__func__); return -EINVAL; case IRQ_PIN_ACCESS_GPIO: return gpiod_direction_input(ts->gpiod_int); case IRQ_PIN_ACCESS_ACPI_GPIO: return gpiod_direction_input(ts->gpiod_int); case IRQ_PIN_ACCESS_ACPI_METHOD: return goodix_pin_acpi_direction_input(ts);
}
return -EINVAL; /* Never reached */
}
int goodix_int_sync(struct goodix_ts_data *ts)
{ int error;
error = goodix_irq_direction_output(ts, 0); if (error) goto error;
msleep(50); /* T5: 50ms */
error = goodix_irq_direction_input(ts); if (error) goto error;
error = gpiod_direction_output(ts->gpiod_rst, 1); if (error) goto error;
usleep_range(6000, 10000); /* T4: > 5ms */
/* * Put the reset pin back in to input / high-impedance mode to save * power. Only do this in the non ACPI case since some ACPI boards * don't have a pull-up, so there the reset pin must stay active-high.
*/ if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_GPIO) {
error = gpiod_direction_input(ts->gpiod_rst); if (error) goto error;
}
if (acpi_gpio_get_irq_resource(ares, &gpio)) { if (ts->gpio_int_idx == -1) {
ts->gpio_int_idx = ts->gpio_count;
} else {
dev_err(dev, "More then one GpioInt resource, ignoring ACPI GPIO resources\n");
ts->gpio_int_idx = -2;
}
ts->gpio_count++;
} elseif (acpi_gpio_get_io_resource(ares, &gpio))
ts->gpio_count++;
return 0;
}
/* * This function gets called in case we fail to get the irq GPIO directly * because the ACPI tables lack GPIO-name to APCI _CRS index mappings * (no _DSD UUID daffd814-6eba-4d8c-8a91-bc9bbf4aa301 data). * In that case we add our own mapping and then goodix_get_gpio_config() * retries to get the GPIOs based on the added mapping.
*/ staticint goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts)
{ conststruct acpi_gpio_mapping *gpio_mapping = NULL; struct device *dev = &ts->client->dev;
LIST_HEAD(resources); int irq, ret;
/* * CHT devices should have a GpioInt + a regular GPIO ACPI resource. * Some CHT devices have a bug (where the also is bogus Interrupt * resource copied from a previous BYT based generation). i2c-core-acpi * will use the non-working Interrupt resource, fix this up.
*/ if (soc_intel_is_cht() && ts->gpio_count == 2 && ts->gpio_int_idx != -1) {
irq = acpi_dev_gpio_irq_get(ACPI_COMPANION(dev), 0); if (irq > 0 && irq != ts->client->irq) {
dev_warn(dev, "Overriding IRQ %d -> %d\n", ts->client->irq, irq);
ts->client->irq = irq;
}
}
/* Some devices with gpio_int_idx 0 list a third unused GPIO */ if ((ts->gpio_count == 2 || ts->gpio_count == 3) && ts->gpio_int_idx == 0) {
ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_GPIO;
gpio_mapping = acpi_goodix_int_first_gpios;
} elseif (ts->gpio_count == 2 && ts->gpio_int_idx == 1) {
ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_GPIO;
gpio_mapping = acpi_goodix_int_last_gpios;
} elseif (ts->gpio_count == 1 && ts->gpio_int_idx == -1 &&
acpi_has_method(ACPI_HANDLE(dev), "INTI") &&
acpi_has_method(ACPI_HANDLE(dev), "INTO")) {
dev_info(dev, "Using ACPI INTI and INTO methods for IRQ pin access\n");
ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_METHOD;
gpio_mapping = acpi_goodix_reset_only_gpios;
} elseif (soc_intel_is_byt() && ts->gpio_count == 2 && ts->gpio_int_idx == -1) {
dev_info(dev, "No ACPI GpioInt resource, assuming that the GPIO order is reset, int\n");
ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_GPIO;
gpio_mapping = acpi_goodix_int_last_gpios;
} elseif (ts->gpio_count == 1 && ts->gpio_int_idx == 0) { /* * On newer devices there is only 1 GpioInt resource and _PS0 * does the whole reset sequence for us.
*/
acpi_device_fix_up_power(ACPI_COMPANION(dev));
/* * Before the _PS0 call the int GPIO may have been in output * mode and the call should have put the int GPIO in input mode, * but the GPIO subsys cached state may still think it is * in output mode, causing gpiochip_lock_as_irq() failure. * * Add a mapping for the int GPIO to make the * gpiod_int = gpiod_get(..., GPIOD_IN) call succeed, * which will explicitly set the direction to input.
*/
ts->irq_pin_access_method = IRQ_PIN_ACCESS_NONE;
gpio_mapping = acpi_goodix_int_first_gpios;
} else {
dev_warn(dev, "Unexpected ACPI resources: gpio_count %d, gpio_int_idx %d\n",
ts->gpio_count, ts->gpio_int_idx); /* * On some devices _PS0 does a reset for us and * sometimes this is necessary for things to work.
*/
acpi_device_fix_up_power(ACPI_COMPANION(dev)); return -EINVAL;
}
/* * Normally we put the reset pin in input / high-impedance mode to save * power. But some x86/ACPI boards don't have a pull-up, so for the ACPI * case, leave the pin as is. This results in the pin not being touched * at all on x86/ACPI boards, except when needed for error-recover.
*/
ts->gpiod_rst_flags = GPIOD_ASIS;
if (!ts->client) return -EINVAL;
dev = &ts->client->dev;
/* * By default we request the reset pin as input, leaving it in * high-impedance when not resetting the controller to save power.
*/
ts->gpiod_rst_flags = GPIOD_IN;
ts->avdd28 = devm_regulator_get(dev, "AVDD28"); if (IS_ERR(ts->avdd28)) return dev_err_probe(dev, PTR_ERR(ts->avdd28), "Failed to get AVDD28 regulator\n");
ts->vddio = devm_regulator_get(dev, "VDDIO"); if (IS_ERR(ts->vddio)) return dev_err_probe(dev, PTR_ERR(ts->vddio), "Failed to get VDDIO regulator\n");
retry_get_irq_gpio: /* Get the interrupt GPIO pin number */
gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_INT_NAME, GPIOD_IN); if (IS_ERR(gpiod)) return dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get %s GPIO\n",
GOODIX_GPIO_INT_NAME);
if (!gpiod && has_acpi_companion(dev) && !added_acpi_mappings) {
added_acpi_mappings = true; if (goodix_add_acpi_gpio_mappings(ts) == 0) goto retry_get_irq_gpio;
}
ts->gpiod_int = gpiod;
/* Get the reset line GPIO pin number */
gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_RST_NAME, ts->gpiod_rst_flags); if (IS_ERR(gpiod)) return dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get %s GPIO\n",
GOODIX_GPIO_RST_NAME);
ts->gpiod_rst = gpiod;
switch (ts->irq_pin_access_method) { case IRQ_PIN_ACCESS_ACPI_GPIO: /* * We end up here if goodix_add_acpi_gpio_mappings() has * called devm_acpi_dev_add_driver_gpios() because the ACPI * tables did not contain name to index mappings. * Check that we successfully got both GPIOs after we've * added our own acpi_gpio_mapping and if we did not get both * GPIOs reset irq_pin_access_method to IRQ_PIN_ACCESS_NONE.
*/ if (!ts->gpiod_int || !ts->gpiod_rst)
ts->irq_pin_access_method = IRQ_PIN_ACCESS_NONE; break; case IRQ_PIN_ACCESS_ACPI_METHOD: if (!ts->gpiod_rst)
ts->irq_pin_access_method = IRQ_PIN_ACCESS_NONE; break; default: if (ts->gpiod_int && ts->gpiod_rst) {
ts->reset_controller_at_probe = true;
ts->load_cfg_from_disk = true;
ts->irq_pin_access_method = IRQ_PIN_ACCESS_GPIO;
}
}
return 0;
}
/** * goodix_read_config - Read the embedded configuration of the panel * * @ts: our goodix_ts_data pointer * * Must be called during probe
*/ staticvoid goodix_read_config(struct goodix_ts_data *ts)
{ int x_max, y_max; int error;
/* * On controllers where we need to upload the firmware * (controllers without flash) ts->config already has the config * at this point and the controller itself does not have it yet!
*/ if (!ts->firmware_name) {
error = goodix_i2c_read(ts->client, ts->chip->config_addr,
ts->config, ts->chip->config_len); if (error) {
ts->int_trigger_type = GOODIX_INT_TRIGGER;
ts->max_touch_num = GOODIX_MAX_CONTACTS; return;
}
}
/** * goodix_i2c_test - I2C test function to check if the device answers. * * @client: the i2c client
*/ staticint goodix_i2c_test(struct i2c_client *client)
{ int retry = 0; int error;
u8 test;
while (retry++ < 2) {
error = goodix_i2c_read(client, GOODIX_REG_ID, &test, 1); if (!error) return 0;
msleep(20);
}
return error;
}
/** * goodix_configure_dev - Finish device initialization * * @ts: our goodix_ts_data pointer * * Must be called from probe to finish initialization of the device. * Contains the common initialization code for both devices that * declare gpio pins and devices that do not. It is either called * directly from probe or from request_firmware_wait callback.
*/ staticint goodix_configure_dev(struct goodix_ts_data *ts)
{ int error; int i;
/* Capacitive Windows/Home button on some devices */ for (i = 0; i < GOODIX_MAX_KEYS; ++i) { if (i == 0)
ts->keymap[i] = KEY_LEFTMETA; else
ts->keymap[i] = KEY_F1 + (i - 1);
if (!ts->client->irq) {
error = input_setup_polling(ts->input_dev, goodix_ts_work_i2c_poll); if (error) {
dev_err(&ts->client->dev, "could not set up polling mode, %d\n", error); return error;
}
input_set_poll_interval(ts->input_dev, GOODIX_POLL_INTERVAL_MS);
}
error = input_register_device(ts->input_dev); if (error) {
dev_err(&ts->client->dev, "Failed to register input device: %d", error); return error;
}
/* * Create the input_pen device before goodix_request_irq() calls * devm_request_threaded_irq() so that the devm framework frees * it after disabling the irq. * Unfortunately there is no way to detect if the touchscreen has pen * support, so registering the dev is delayed till the first pen event.
*/
error = goodix_create_pen_input(ts); if (error) return error;
error = goodix_get_gpio_config(ts); if (error) return error;
/* power up the controller */
error = regulator_enable(ts->avdd28); if (error) {
dev_err(&client->dev, "Failed to enable AVDD28 regulator: %d\n",
error); return error;
}
error = regulator_enable(ts->vddio); if (error) {
dev_err(&client->dev, "Failed to enable VDDIO regulator: %d\n",
error);
regulator_disable(ts->avdd28); return error;
}
error = devm_add_action_or_reset(&client->dev,
goodix_disable_regulators, ts); if (error) return error;
reset: if (ts->reset_controller_at_probe) { /* reset the controller */
error = goodix_reset(ts); if (error) return error;
}
error = goodix_i2c_test(client); if (error) { if (!ts->reset_controller_at_probe &&
ts->irq_pin_access_method != IRQ_PIN_ACCESS_NONE) { /* Retry after a controller reset */
ts->reset_controller_at_probe = true; goto reset;
}
dev_err(&client->dev, "I2C communication failure: %d\n", error); return error;
}
error = goodix_firmware_check(ts); if (error) return error;
error = goodix_read_version(ts); if (error) return error;
/* * The datasheet specifies that the interval between sending screen-off * command and wake-up should be longer than 58 ms. To avoid waking up * sooner, delay 58ms here.
*/
msleep(58); return 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.