Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp770917imp; Wed, 20 Feb 2019 08:42:52 -0800 (PST) X-Google-Smtp-Source: AHgI3IaLvTrAtT+km6k1ywjK9VBHZgfn7NRW6lOk+fcaiw7HG2fKJaYUBHI2iAqJP4pdT58C/tQq X-Received: by 2002:a17:902:b60c:: with SMTP id b12mr15714864pls.261.1550680972675; Wed, 20 Feb 2019 08:42:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550680972; cv=none; d=google.com; s=arc-20160816; b=J/HmFUqZdgyHkxW7kB4QZ60arfsytcMnkPzYhjEbotdjuYFtVLhQUctEYTYAdjoRdA azWZa9NgBHY6vscDBbSv1DGgG/pPOy7J4ZccpYjteH28/kB5ToYwTi5ApKD+6h0p1tuF VfhuPTVMTUOxpbx/JYDnSjeJXXkIHSyPFhue9TJIcvUS6iRgw5KGvzetuJ/RFGT/UsNt HCu8e5jjySlvKYDSv13SFrNgwNo+jwzcSLnI4kyQYyrE7Mwh0CMWZHQ80PV4YRb6djyx jfsUy5Rk10gO5iVaHzYDUmzjyq1g5p1GCFx604+SEP+YV1omxwZJ/mHZFdGOI276ibCj vdGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from; bh=ijAqQdhHWbNhVez2lZNQZCBSpvbEt6lFIAkA65Vt/i0=; b=jUmU2GT1vfParfDzv6UCSvsGULbCcSUkSWto3n5zgPgza993I66jBxKJy6EDXaVAyq MCZbQgZ56+ybmeUxmvxkb6jQo7WvSvAJgYIIu7NaY4L5mwwr8pLI7eZewi/Ql/nvXhjm gpBox0QzFfwTXBHmmNu+qUT8WQVFAMyjjcYvKhm66Y/Cux72QlIeAb5OgNago2Ep9946 jKKuVVPRvojlc3enVsR9hXOOvN9UDOuLx6BjfN8rGbhTxPf3pX+uZR8Kvn/Lo+oZx/B2 M7Uqpg91lIWRiupivyzgeF1Cmz1XKgkx4LM4p53d01kKtMlG3o2tGqRnfRsiHwCbmrOq SbLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u5si6007448plm.225.2019.02.20.08.42.37; Wed, 20 Feb 2019 08:42:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727195AbfBTQmJ (ORCPT + 99 others); Wed, 20 Feb 2019 11:42:09 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:59229 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726902AbfBTQmG (ORCPT ); Wed, 20 Feb 2019 11:42:06 -0500 Received: from [194.204.107.10] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1gwUwf-0002E2-0f; Wed, 20 Feb 2019 16:42:05 +0000 From: Aaron Ma To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Cheiny@synaptics.com, aduggan@synaptics.com, benjamin.tissoires@redhat.com, aaron.ma@canonical.com Subject: [PATCH 2/2] Input: synaptics-rmi4 - export nosleep of f01 via sysfs Date: Wed, 20 Feb 2019 17:42:00 +0100 Message-Id: <20190220164200.31044-2-aaron.ma@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190220164200.31044-1-aaron.ma@canonical.com> References: <20190220164200.31044-1-aaron.ma@canonical.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some of ThinkPad X1C6 touchpads didn't wakeup after resume. Forcing enable nosleep make touchpad back. Add nosleep via sysfs, so user can control it to workaround issue. /sys/devices/rmi4-00/nosleep can be written non-zero will enable nosleep mode. BugLink: https://bugs.launchpad.net/bugs/1791427 Cc: Signed-off-by: Aaron Ma --- drivers/input/rmi4/rmi_f01.c | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c index 4edaa14fe878..e41d1ec625d9 100644 --- a/drivers/input/rmi4/rmi_f01.c +++ b/drivers/input/rmi4/rmi_f01.c @@ -325,12 +325,57 @@ static ssize_t rmi_driver_package_id_show(struct device *dev, static DEVICE_ATTR(package_id, 0444, rmi_driver_package_id_show, NULL); +static ssize_t rmi_driver_nosleep_show(struct device *dev, + struct device_attribute *dattr, + char *buf) +{ + struct rmi_driver_data *data = dev_get_drvdata(dev); + struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); + int f01_nosleep; + + f01_nosleep = ((f01->device_control.ctrl0 & RMI_F01_CTRL0_NOSLEEP_BIT) + ? 1 : 0); + + return scnprintf(buf, PAGE_SIZE, "%d\n", f01_nosleep); +} + +static ssize_t rmi_driver_nosleep_store(struct device *dev, + struct device_attribute *dattr, + const char *buf, size_t count) +{ + struct rmi_driver_data *data = dev_get_drvdata(dev); + struct f01_data *f01 = dev_get_drvdata(&data->f01_container->dev); + int error; + + if (count <= 0) + return count; + + if ('0' == *buf) { + f01->device_control.ctrl0 &= ~RMI_F01_CTRL0_NOSLEEP_BIT; + } else { + f01->device_control.ctrl0 |= RMI_F01_CTRL0_NOSLEEP_BIT; + } + + error = rmi_write(data->rmi_dev, + data->f01_container->fd.control_base_addr, + f01->device_control.ctrl0); + if (error) { + dev_err(dev, "Failed to write nosleep mode: %d.\n", error); + } + + return count; +} + +static DEVICE_ATTR(nosleep, 0644, + rmi_driver_nosleep_show, rmi_driver_nosleep_store); + static struct attribute *rmi_f01_attrs[] = { &dev_attr_manufacturer_id.attr, &dev_attr_date_of_manufacture.attr, &dev_attr_product_id.attr, &dev_attr_firmware_id.attr, &dev_attr_package_id.attr, + &dev_attr_nosleep.attr, NULL }; -- 2.17.1