From patchwork Fri Sep 15 13:47:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 723383 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EC6CEE645D for ; Fri, 15 Sep 2023 13:47:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235475AbjIONrs (ORCPT ); Fri, 15 Sep 2023 09:47:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235461AbjIONrr (ORCPT ); Fri, 15 Sep 2023 09:47:47 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2070.outbound.protection.outlook.com [40.107.105.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A8691BEB; Fri, 15 Sep 2023 06:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W3whhnAF5mLhTdfVesRNd/GgYr15BuI3u/lQ2joCYM5rnbIVy2rJD00a6Tdjm7jB0DGV2sdqR+T0P6Ju5Q2IucYqbQyjcmP4vy38i9X5XqymDiOK3WLzLKgf3LCarmUsGnO92lF254E6r48Ak7O+LgkksLpX/VBsa5+begXyt8su8tlTj77Mkuuma59GoHbnjEEJTl6q2C7yHK756CkiZbgiAC6UTKTva5qyA972hh4ItjOeBbxfoVqS9/3eY1lKxlPpiIcpHjjz43gIzfuq75zKWQ+vHx6u8HTbWq0BD0fKJ89rjG6XI3/5Y/mvTloQIVMIEMMJmLxWyq6nOdd7DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LALxW/oAIyxG7vh7eSxOonN+J0b9RaumMYhm7Wjenvw=; b=n7z0w36Woih7aeIg8hWd1jvhxw59Lo4BC0nrXMHwRei2wRu+EB7qmo7PqCYtpVY5Odt42Al6LLOpeQx9pMyFs0PSNHo9mOS3HJ2af11SpOQI4xDpz58GsX1SQs0NwHI7qNvjW0ZmxdQQiwwH0/vNSNXFnI3+yOSspzxJdTO06ZcHvwhZ8RJxtk9hT3RF5YhL8hUx67LlJRG81c4ocCkl+DGQ3fRC1H/YQZeojGyChnW6/96qXipRmLC5X43SGnFiqBfo8pPC748j6CES72fTiWLn7dZN9uc1EEP0cMYNiO9WBBvhbEc/8lDBIDiKJSfHG3lPP/L78nHsyDoyGsNz+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LALxW/oAIyxG7vh7eSxOonN+J0b9RaumMYhm7Wjenvw=; b=uajlXT9m/K3l5b951EYzODudZ1jDMFJSl3WmZaTGdY9bsZlqRuU23BQzZXV+irFt/yYGTfUjduB3whIIyzklWJJbuVkkDAoTN/wkbvbyuep/GRCJYX0AWp5MS5QiiNLDeDzecDjR0Ygjxm/AhVJGpc/2KYlIyZeC28ejitUCoGE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by PAWPR08MB9783.eurprd08.prod.outlook.com (2603:10a6:102:2ee::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.31; Fri, 15 Sep 2023 13:47:37 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::bc92:216b:11ed:db63]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::bc92:216b:11ed:db63%6]) with mapi id 15.20.6792.020; Fri, 15 Sep 2023 13:47:37 +0000 From: Javier Carrasco Date: Fri, 15 Sep 2023 15:47:25 +0200 Subject: [PATCH v2 2/2] Input: st1232 - add wake up event counting Message-Id: <20230826-feature-st1232_freeze_wakeup-v2-2-29ae9f747137@wolfvision.net> References: <20230826-feature-st1232_freeze_wakeup-v2-0-29ae9f747137@wolfvision.net> In-Reply-To: <20230826-feature-st1232_freeze_wakeup-v2-0-29ae9f747137@wolfvision.net> To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694785656; l=1867; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=o408kdN/AxMKMa4Y2r3gFHy5WAht80gNXp9pdeuz7ak=; b=2pGM2GOIs9OZ9STHxUNzvClhwzeOp6P8fd/aDww2jHScsECTYrCwWU9Xa3ycrpIau3poIe8Dr L+Lsl8WrQNPDHCpR+XeG6CSw2+AjlsGzC3f6M0anIH+0HYZK7nd2qy5 X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1PR08CA0233.eurprd08.prod.outlook.com (2603:10a6:802:15::42) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|PAWPR08MB9783:EE_ X-MS-Office365-Filtering-Correlation-Id: f0234497-bb9d-4b86-1b56-08dbb5f2523a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gT2lOEChJfZ4MwsA3hEutE64NaCkYO1giojBSmKw/KP8mIUHj0/f+b1B3u2x5lYf5jCEa10lDghPDZiRu4IvQxjsxmfpkpAyBC7PTQ9JNA8zQYkWaKbIYPk7atU2B4aOcLU3AZYMFq4Xa+8/7n0cSD0UAhCM757t1JGAQKEc/BS+oY2wySfy02nLLX0h74dVe77xfws4ga0yQ6C5b7OkCgvK2W/CsCgjK/BTd9GS2UnMxsyMytGKHnLf331VDr+09PNqO2kMJUQ8JgV1dOXdbZfm7mgY/cayVmcj+yBDeCgWHPVj9gss59T5mbPNaqCZhMQIbIYKfW8pdBSCyp2gte5Aad+g7BXqs5WhN1Mgohi38xtxBmbIQgoqaeGBrQwdPDR8ICiCRi9q3L5xXCxegCYGcnRF6C6nphvcq2tH64L9cqp/5bMPweIPHNz47AAjWCGiGLM9Uia+A8YC5g6OgRgjznTMoKavn8zHGAv04mjiFZNkuS0sKjnLMyQWwL+0iT5NBHAdfqn/mM1kEKLRJ7alKlm5KbYBvfci0QbnVCjrPY2Y0cAzVvrUvOik2tWdL+fTwj/2XMLJNEAqKISFPtWEsHwI3+nUCJM6Kc7pU4P3AzgmVpcE3R0/a7NqcsXe X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB4974.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(39850400004)(136003)(396003)(346002)(186009)(451199024)(1800799009)(41300700001)(6506007)(52116002)(6486002)(6666004)(38100700002)(26005)(36756003)(6512007)(86362001)(38350700002)(2906002)(2616005)(83380400001)(6916009)(8936002)(8676002)(478600001)(5660300002)(66556008)(4326008)(44832011)(107886003)(66946007)(316002)(66476007); DIR:OUT; SFP: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F+u1hsa01a8QVcaF/76pHaXlMbtk?= =?utf-8?q?Hq4ryPya6xCzAOCbfyBHhoQjLD4jPckC86sGmA70sggsIkm6mg3YBR0YG4qPUzOcl?= =?utf-8?q?TewdSlyTY4OMnRRhv4COsoQkMApQHJfMHt3XQLcJOGOXbV8Xeeqmbq1zuhc4HJgZy?= =?utf-8?q?NTGnhfamBwY1ufYvNadtQ2bhCkmicyTTbdTBPOjkVMCf2/FxB9iLiM1aEQJEgMTtJ?= =?utf-8?q?zIVlqAI3hTsJ1cQZgkUiDMrZI7+LUm30qBQmZ4JUo8eamAhq1dnOW9JeNUg4mi85T?= =?utf-8?q?GDta1CiEtCWp7U/Gn3Pwi6qRn+BJGjXzUKpQRT71bY/YsMquSkw0IgORaWd9v5vWs?= =?utf-8?q?iB7zFQmO4YPlz1B3dNaNGCXIUH7NvirZjnHN5iYiQJIa4ffXXPwOy/8aHRfQT3VwC?= =?utf-8?q?n/VecwSOFSb5E59TN9hwtMfKOc4FSBee+IvXDZdtooDAb+RJQD93WguOUPLlGYKvl?= =?utf-8?q?7k2n0EPoRw5kTbGnLI62adZune9SSiQjRtLX58vSxNDJ9fWDGI8T6s3Mm6G32kWo9?= =?utf-8?q?yvFFWaEr7tRi8G10mcWkeL/04TQrp99HK8NLhD+RLqK7+SKMc2jfYvZo5U/wDZ+sx?= =?utf-8?q?on1VDntYrvjYxCroPqHH1YHH7PW2eNkQveq/0zLRwEceY5t/aMT7+BCrpoYmlVwGR?= =?utf-8?q?oX4lfK3lmZd09k7Jktb1YojBzIqA9LGS+n6qFEZpLLyq9xGPpcNaIMorj90gHSkbk?= =?utf-8?q?llwo15UuAH5V2NFHk6gnhNftHrN8ogr51X3JX4W8UwtQlnX3Lg1flJY=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: f0234497-bb9d-4b86-1b56-08dbb5f2523a X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 13:47:37.0666 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: r+haayAeTfl7g0aUZjZSJaVWTTy3UN0LVfEtw90NE4sNbMUFdJKTqYhcVDL6d9i0MtA0Z0QL7mJmTWP9cChomPzVMyrMfDcVOmPyUIfqHo4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9783 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This device driver provides wakeup capabilities but the wakeup events are not reflected in sysfs. Add pm_wakeup_event to the interrupt handler in order to do so. Signed-off-by: Javier Carrasco --- drivers/input/touchscreen/st1232.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c index d0ee90abc293..ad18d3944bf2 100644 --- a/drivers/input/touchscreen/st1232.c +++ b/drivers/input/touchscreen/st1232.c @@ -59,6 +59,7 @@ struct st1232_ts_data { const struct st_chip_info *chip_info; int read_buf_len; u8 *read_buf; + bool suspended; }; static int st1232_ts_read_data(struct st1232_ts_data *ts, u8 reg, @@ -173,9 +174,13 @@ static int st1232_ts_parse_and_report(struct st1232_ts_data *ts) static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id) { struct st1232_ts_data *ts = dev_id; + struct i2c_client *client = ts->client; int count; int error; + if (ts->suspended && device_may_wakeup(&client->dev)) + pm_wakeup_event(&client->dev, 0); + error = st1232_ts_read_data(ts, REG_XY_COORDINATES, ts->read_buf_len); if (error) goto out; @@ -345,6 +350,8 @@ static int st1232_ts_suspend(struct device *dev) struct i2c_client *client = to_i2c_client(dev); struct st1232_ts_data *ts = i2c_get_clientdata(client); + ts->suspended = true; + if (!device_may_wakeup(&client->dev)) { disable_irq(client->irq); st1232_ts_power(ts, false); @@ -358,6 +365,8 @@ static int st1232_ts_resume(struct device *dev) struct i2c_client *client = to_i2c_client(dev); struct st1232_ts_data *ts = i2c_get_clientdata(client); + ts->suspended = false; + if (!device_may_wakeup(&client->dev)) { enable_irq(client->irq); st1232_ts_power(ts, true);