From patchwork Thu Dec 7 11:12:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Eichenberger X-Patchwork-Id: 175084 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4704961vqy; Thu, 7 Dec 2023 03:13:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHChW33+WubVTCRFlR57vEz2Uad7itdmLSrMQ3kT9A8VhGp+QHhpariluFFLUxTylBQrnGe X-Received: by 2002:a05:6a20:b7a4:b0:18f:97c:8271 with SMTP id fh36-20020a056a20b7a400b0018f097c8271mr1631295pzb.123.1701947627460; Thu, 07 Dec 2023 03:13:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701947627; cv=none; d=google.com; s=arc-20160816; b=yPdCqIZb+BIy4HdfhUWvUdBJ/xnvd9y6US3xtkLjiY8q0M1CxQfC62kivszZsd1jSU KeEANtgVvlKH8kDkAcX62YhPpvI7EloyR92D+PjYnYFv0CJxKHBZexczRVVGDCRqjyJF N3jBnLO3LDc36M/Kax1aGthx27V8YNK329tSxXGhPhETTJ9dgeka/l7noLPPD+njbhmX hI24zq2ZfWOx3ci9Iutbp9Ivy7AcUnT81kdbBHgYkrUAIQYxPi8cUOJGHdfUgKfJiNWk lQcsl70chj76/YEvCx121ZmEnd/2ESpFfBKwKnMPB5qoKmcogfIU/Oq7maE2wFEtTiH8 86uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cd1jhV+Kh/V8UGgnPN8H8ix4gV6UKpJNpQeBveVjzsY=; fh=K6dCBpvs/efb3OgQrs3E7dAoE6b1q+I64nkQ4/o2Nh4=; b=C/p+gL56RcGBYSNNRZGMlAKg+cbEkPJLUCccdzylXjKeAY1c8pmkdHdxbWd6T1JTCS 2c3y52m4LyfuXm5Clm3Ir37DFLCVkbJFKaO5nZpJTb/KYa4EKZaXN/tp+D+Bcr47tbs/ ZgxtxSK9znMQM6rNTkb+7zY19rzpEcVgHO+1KQJ0zViVH9WCJNyXKUaRa6XMOdFhyuD9 Q11wgDBJsGGXdp7OOAZBEAQdQhJx3JebR6M+3XjrS4l+SPC/ZTY1K/gKoA/bJIgVi0no r5K7gUH+JnmYkDiQ3q2pTw2voNWsy6igjDHuaT9HUcQmB0BMnVwVPi/MdTevxc7YWlkB 6ZMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="aIG/xV2A"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id b18-20020a056a000a9200b006cdefbf53besi1090784pfl.104.2023.12.07.03.13.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 03:13:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="aIG/xV2A"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 2188C8043EC4; Thu, 7 Dec 2023 03:13:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378893AbjLGLNb (ORCPT + 99 others); Thu, 7 Dec 2023 06:13:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232388AbjLGLNZ (ORCPT ); Thu, 7 Dec 2023 06:13:25 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D158F10D0; Thu, 7 Dec 2023 03:13:30 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3332fc9b9b2so720452f8f.1; Thu, 07 Dec 2023 03:13:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701947609; x=1702552409; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cd1jhV+Kh/V8UGgnPN8H8ix4gV6UKpJNpQeBveVjzsY=; b=aIG/xV2AYhp7Od0dE99nZ9C9ooHTr6NN5Eo0hPCi5tbzTxei6XY/KI0QxNzYiIm3XD kllIo/067+HRjx5tUGy6l3od1wXrUuIBKraiNJi8dFb/f9vXnPzY2SffbWy/gi4T9WPV XilP+LQukW5SR+p1TBHUnOtrL+mwNTYFmbMG8YhJWhIh0rpJ5qIeK5n2WCwhgXLbAgv/ MMZXkrR7iWWkm+XG3B4NrKFtL06PR6uzPacoCQfbGNFtMrvUXHIa8/omAXtBqqT5+4+C lqa62LunzrJgz97CU+OFdZF0KhqBNdJzvU+/Iz0bzBIPogDqmrqlBKv1qII0Y4jNApVZ +ICw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701947609; x=1702552409; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cd1jhV+Kh/V8UGgnPN8H8ix4gV6UKpJNpQeBveVjzsY=; b=dZ47I9ub2+te8GHqgfx4Tz9BRljT36bZYnkluc2vI60AzGXKA9sykyPj2TWVHFaJHS 5NqVOCp6xMT2Z9xgCbm0nSXwIekbhqkxCvkUs/bmmcHLg2Y4y0GL+z/9lNHw/RX0/uN9 k5LPXJx4/3A07ot1W5l5VlSwGc5cq66FjV8dZjiXRT0jS12P9BW3vDfpHT3V3mitsyjO 5xuxGC0+LUeYyD0Dg+vjbolKcdtfN9GJ23ZN8bA9s0V84x+jNHzVuwep7fyJI3nTRXeF Vr90HR48pxcpt8xftRZbR0lOKYvcuE44RZzy3P6U5hc0RHiATpo5I+fCIRulLXOdfut5 LGRg== X-Gm-Message-State: AOJu0YzaswXCbQ5n8BHDDR+g43r/YXRX7hDAaM6jjKDgpmr9urerl5CR coyN6guHHhWnQTOtTggDyKk= X-Received: by 2002:a5d:49d0:0:b0:333:4fd1:1c6b with SMTP id t16-20020a5d49d0000000b003334fd11c6bmr713944wrs.84.1701947609065; Thu, 07 Dec 2023 03:13:29 -0800 (PST) Received: from eichest-laptop.toradex.int ([2a02:168:af72:0:5036:93fe:290b:56de]) by smtp.gmail.com with ESMTPSA id b10-20020a5d550a000000b003333541a5bdsm1166096wrv.80.2023.12.07.03.13.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 03:13:28 -0800 (PST) From: Stefan Eichenberger To: nick@shmanahar.org, dmitry.torokhov@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, linus.walleij@linaro.org Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stefan Eichenberger Subject: [PATCH v1 1/2] dt-bindings: input: atmel,maxtouch: add poweroff-in-suspend property Date: Thu, 7 Dec 2023 12:12:59 +0100 Message-Id: <20231207111300.80581-2-eichest@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231207111300.80581-1-eichest@gmail.com> References: <20231207111300.80581-1-eichest@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 07 Dec 2023 03:13:44 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784621435469886865 X-GMAIL-MSGID: 1784621435469886865 From: Stefan Eichenberger Add a new property to indicate that the device should be powered off in suspend mode. Signed-off-by: Stefan Eichenberger --- Documentation/devicetree/bindings/input/atmel,maxtouch.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml b/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml index c40799355ed7..047a5101341c 100644 --- a/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml +++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.yaml @@ -87,6 +87,12 @@ properties: - 2 # ATMEL_MXT_WAKEUP_GPIO default: 0 + atmel,poweroff-in-suspend: + description: | + When this property is set, all supplies are turned off when the system is + going to suspend. + type: boolean + wakeup-source: type: boolean From patchwork Thu Dec 7 11:13:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Eichenberger X-Patchwork-Id: 175085 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4704968vqy; Thu, 7 Dec 2023 03:13:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZUjC8gbzBzt5jkmJbQ+pSBDM80gRJ6m/gXMeMQ8BkqJU09EpQvathJtQgrOvT/sL33G4z X-Received: by 2002:a17:90a:7405:b0:286:6cc1:3f19 with SMTP id a5-20020a17090a740500b002866cc13f19mr2480136pjg.80.1701947628392; Thu, 07 Dec 2023 03:13:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701947628; cv=none; d=google.com; s=arc-20160816; b=p7EXDLFv1tdBsk32ZKx/dkXRrnzqd7UkAjlkciPQ+PVrYrwCSEMdOF0MX95VUuL+b9 lVBemeltCwp3PGhCt/CRTSy/hBU6+KgZspDn62pfEOv21MN4wrUha6Wwi1fZHlPGbBGw hC4EtYSb3POVO5cJ3hFn0AClQEe9WNUXLqkXptPM9iOX1QcvrbzEwUjySfoYaXkAipnf Y/AK+FUgM6cSyAcoXQSssxk0GrNCghzmSOxVsYzrrt14XwUzcQAGpNgE+gzeYAJZsHx0 dTtDzz27oj/SQ0AnICfzuNIekZx/WJgSthQmpMXgkLbDVdo2neqwn8/Y4cy1yB9O9Kuk 0YgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Q04tsDqW57p+9vja5pX6TrNQSbK8g1Bln9Plrgyuq6U=; fh=K6dCBpvs/efb3OgQrs3E7dAoE6b1q+I64nkQ4/o2Nh4=; b=V7k4c0cmB3dUyZGLPUBX66PNrQrtdyiKBQBMsgNSFlBjZsrRWSgCklOHOjlusx2UfL AQ5P6XEn3Q4y3f4GGLhOOL/IkHnwl6sqv48ldMw16temjDj2zYcDxth1XKL4AtiIwp0/ BaGsE0zoewX8CnYipeMeq96UaZfNdtF34+ZG2XSi6TwPQBQXZDppz/E3uz9hiHNOTgSW yZ9wJKjGbgx5PWgPdLZs52LX9lSQhwiZ9+VHiXyWoPMQ0sjyQB4LK6g1VUfW6Tm4g+UP jL92Q5a6xii1xhJuQXIyutJmfjopuB/nPBgs8Vru+iHe40x5/xafvpci2vtL5/tjSOIB Maeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kM4dzzm1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id ci22-20020a17090afc9600b00286d452783esi913498pjb.5.2023.12.07.03.13.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 03:13:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kM4dzzm1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 48A77801D4A6; Thu, 7 Dec 2023 03:13:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378977AbjLGLNe (ORCPT + 99 others); Thu, 7 Dec 2023 06:13:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232435AbjLGLN1 (ORCPT ); Thu, 7 Dec 2023 06:13:27 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3682310C7; Thu, 7 Dec 2023 03:13:33 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-33349b3f99aso793160f8f.0; Thu, 07 Dec 2023 03:13:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701947611; x=1702552411; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Q04tsDqW57p+9vja5pX6TrNQSbK8g1Bln9Plrgyuq6U=; b=kM4dzzm1Q96yJPfi5/n3CtcsgGRfqZae3BPdExx52Qs7Jy8wEgJeV9F7Efk17iHEIq ba+bz10FfUmU30qJciqp/czI1Ycq3gbGsqZIGgcXB7PB2wILPJzdLgk4kBp/Nu8PYaKT d+xI36+MCvDUZerHvRU8FtNVabrcys5ZHPrK3tx0OWgW1Cs0qGNx4fm6afm8qaAYZgfO kn8i7HNS+7CKoZT/OtNrvUnGL/XKTBdimkYPmHpYjyZnSHlah2T6VtYwzzKBY53PFJ/I g7objuiZENH11jUa2q/S2lSlBQaB5igRP/K4CqxofzNkX5IR0aI45jP3PxJxsgKQ4BTR HTrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701947611; x=1702552411; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q04tsDqW57p+9vja5pX6TrNQSbK8g1Bln9Plrgyuq6U=; b=L5FWGl+vgdQCMnLphqBdvoo0gzCwWIjvvG3kP3eZ30qPjOExNZEpM5/dzZEp8+USYj uhrl0luCrjhjXxXpbZJw4DihrIzK+pDPRHlcIudcIAoAoogRbLYFP+4x6crU5Ya5KVnY zEll7psa7tCJADla5JTa3HVUXQWSbQp5L4jCEsXmi0unVrxb6qGJnB1TckTWasqpN81v jiDd/br2pw2XysxJFvQ75uMktMfe2MjYErRxMxz9nmKvXbMazQMET7jmx8c8TbPcbQFV LrlbkQANoHhbibbrnauQB2LhtsczPJJ9DbFASoanyPM5QAItvQJvjhPMf4P/R1MTtlgx RF+A== X-Gm-Message-State: AOJu0YxWMcT1veqyYk6aOf9/qCk5GT/97hL9WOSaOR8Sx8UzS4ckK1gG 25L465Ael18/jZvMAPK0bLk= X-Received: by 2002:a05:6000:1946:b0:332:d504:c131 with SMTP id e6-20020a056000194600b00332d504c131mr1266173wry.44.1701947611659; Thu, 07 Dec 2023 03:13:31 -0800 (PST) Received: from eichest-laptop.toradex.int ([2a02:168:af72:0:5036:93fe:290b:56de]) by smtp.gmail.com with ESMTPSA id b10-20020a5d550a000000b003333541a5bdsm1166096wrv.80.2023.12.07.03.13.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 03:13:29 -0800 (PST) From: Stefan Eichenberger To: nick@shmanahar.org, dmitry.torokhov@gmail.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, linus.walleij@linaro.org Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stefan Eichenberger Subject: [PATCH v1 2/2] Input: atmel_mxt_ts - support poweroff in suspend Date: Thu, 7 Dec 2023 12:13:00 +0100 Message-Id: <20231207111300.80581-3-eichest@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231207111300.80581-1-eichest@gmail.com> References: <20231207111300.80581-1-eichest@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 07 Dec 2023 03:13:45 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784621436435232934 X-GMAIL-MSGID: 1784621436435232934 From: Stefan Eichenberger Add a new device tree property to indicate that the device should be powered off in suspend mode. We have a shared regulator that powers the display, a USB hub and some other peripherals. The maxtouch doesn't normally disable the regulator in suspend mode, so our extra peripherals stay powered on. This is not desirable as it consumes more power. With this patch we add the option to disable the regulator in suspend mode for the maxtouch and accept the longer initialisation time. Signed-off-by: Stefan Eichenberger --- drivers/input/touchscreen/atmel_mxt_ts.c | 72 ++++++++++++++++++------ 1 file changed, 55 insertions(+), 17 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 20094b9899f0..7caa0d317d30 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -317,6 +317,7 @@ struct mxt_data { struct gpio_desc *reset_gpio; struct gpio_desc *wake_gpio; bool use_retrigen_workaround; + bool poweroff_in_suspend; /* Cached parameters from object table */ u16 T5_address; @@ -2799,15 +2800,18 @@ static int mxt_configure_objects(struct mxt_data *data, dev_warn(dev, "Error %d updating config\n", error); } - if (data->multitouch) { - error = mxt_initialize_input_device(data); - if (error) - return error; - } else { - dev_warn(dev, "No touch object detected\n"); - } + /* If input device is not already registered */ + if (!data->input_dev) { + if (data->multitouch) { + error = mxt_initialize_input_device(data); + if (error) + return error; + } else { + dev_warn(dev, "No touch object detected\n"); + } - mxt_debug_init(data); + mxt_debug_init(data); + } return 0; } @@ -3328,6 +3332,8 @@ static int mxt_probe(struct i2c_client *client) msleep(MXT_RESET_INVALID_CHG); } + data->poweroff_in_suspend = device_property_read_bool(&client->dev, + "atmel,poweroff-in-suspend"); /* * Controllers like mXT1386 have a dedicated WAKE line that could be * connected to a GPIO or to I2C SCL pin, or permanently asserted low. @@ -3390,12 +3396,21 @@ static int mxt_suspend(struct device *dev) if (!input_dev) return 0; - mutex_lock(&input_dev->mutex); + if (!device_may_wakeup(dev) && data->poweroff_in_suspend) { + if (data->reset_gpio) + gpiod_set_value(data->reset_gpio, 1); - if (input_device_enabled(input_dev)) - mxt_stop(data); + regulator_bulk_disable(ARRAY_SIZE(data->regulators), + data->regulators); + data->T44_address = 0; + } else { + mutex_lock(&input_dev->mutex); + + if (input_device_enabled(input_dev)) + mxt_stop(data); - mutex_unlock(&input_dev->mutex); + mutex_unlock(&input_dev->mutex); + } disable_irq(data->irq); @@ -3411,14 +3426,37 @@ static int mxt_resume(struct device *dev) if (!input_dev) return 0; - enable_irq(data->irq); + if (!device_may_wakeup(dev) && data->poweroff_in_suspend) { + int ret; - mutex_lock(&input_dev->mutex); + ret = regulator_bulk_enable(ARRAY_SIZE(data->regulators), + data->regulators); + if (ret) { + dev_err(dev, "failed to enable regulators: %d\n", + ret); + return ret; + } + msleep(MXT_BACKUP_TIME); - if (input_device_enabled(input_dev)) - mxt_start(data); + if (data->reset_gpio) { + /* Wait a while and then de-assert the RESET GPIO line */ + msleep(MXT_RESET_GPIO_TIME); + gpiod_set_value(data->reset_gpio, 0); + msleep(MXT_RESET_INVALID_CHG); + } - mutex_unlock(&input_dev->mutex); + /* This also enables the irq again */ + mxt_initialize(data); + } else { + enable_irq(data->irq); + + mutex_lock(&input_dev->mutex); + + if (input_device_enabled(input_dev)) + mxt_start(data); + + mutex_unlock(&input_dev->mutex); + } return 0; }