From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83E79363C7E for ; Fri, 6 Mar 2026 10:41:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772793680; cv=none; b=c7lLreoKQCYkPwEY3GB87bf3mxMiYi/js95BRkbmDDoe8Zha0V6cGakc2xtU004QDDxZmIbZjpSuoJUdemmQxHbKy8n1KWV9ttVJwS9TgUNb78UvbIIKsqABASUPQV5rO2L2yy7zVMPmcjx4dH/xtQICuGhRdYzmMWgTkvJ+A48= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772793680; c=relaxed/simple; bh=j89JCgy6of4V0fq9wi2FeaIYUxjh/hwtijKH+XS9D/0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lxNxTfipEEUe4Rxd+MNIEt6Isoquzsr+CfF/EIyozSPDz4EBOEUXllkWjMVWztK6wyDuB0r6A1/XaVKrnx7PMgf3Z4NnHA/oFAOowQShvLZeJ/1vzkx4GfQ0WiLO7Ra3GBu+7lx67Xd9IT0m8rEbE5PLPMvFyuq8DtbSg0jxnaY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BLgPePDX; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BLgPePDX" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-2ad9a9be502so60086235ad.0 for ; Fri, 06 Mar 2026 02:41:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772793678; x=1773398478; 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=ofKRD1G9zZU7DDlNqf7frnTT5WNqLPVC7ZVN1jMSp0g=; b=BLgPePDXuKu37KhR8u6XOcnIyL1ATgnpl2Ws//xghr0k3x9qSn0JB2C8TBnkTa+7D3 Lncf6uG3nqjDut5TrynrpB/dP0zdot6EBW6a+bbnSXI204ocWfDa/bI9PRnPsdorZ7ER /tilVGqhd4Q34fR18eunXjhY7AIUvSFSE+XB6WDobED0jA6HkDE72Up+ok068kD3DZoB yZeC0g5ZtjNS1boTpD/t1FgqTTVRG69Es6ET7FJaw0aSKp6O6Nf6pStbTGRUDrFMTM2y Gk3yxD2arhGhTqOqjvNTxu4P7W7tPcH9LtdXJgYMtqIcta4OXB86lm21F/Fn2duVIVKV ZtYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772793678; x=1773398478; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ofKRD1G9zZU7DDlNqf7frnTT5WNqLPVC7ZVN1jMSp0g=; b=Mz7FHjURavWkKBTnAcDnxSxskyQMIfWacAyK71PKzJXj2z6MezRtDLblBylqLc9QFx DpITUsFogju2Y1TEs/klsgJVuaA8aa5868uggRYww/CInlXs1oxMyIrst6RzZOtc8e+0 ujMeMKrouy4WBoVnVIwPxuHLN8VrguAtdZzcc7s+VleuNsgl+8JkPfurMLx1V9c8io1F xHCIDPXXCV1JzjuCWogynXozDpKUryJybrEwiEI6KhF4SaukCCg6+UBxEQF9IYJ8Wabt YKfwJLviFwa72S/rR6rawjbQUyPx5IXrtRDuWc2Dd3Qy0r/UTJTn5/EfmRx9kY7khI// nNOQ== X-Forwarded-Encrypted: i=1; AJvYcCXEgRkIGTl8K3VKlpqC0hV0CY9XFPUl2dhxb+XpO6rVAKmgrmaejvwxyxuGUjBJpZM3HftE/6jIO1tC7LM=@vger.kernel.org X-Gm-Message-State: AOJu0YyJd03FsPL2DHW18a+/xUyvhDog2TuDopvL+5un4JPVMf1OKqMA 8fwr3najUNC7lHXoXBaNPQcaNgkKRl/YAHtyIDDRyUPUmVXmIAuv67+G X-Gm-Gg: ATEYQzylOmUFEuS2SaYxGKdzUCct5X+L9uGOAoOchh8ngmWWDBbNSw2iUBcSZterWF4 1gxbYQyBwUyyQKxgydbdoDEy2T2t7t2I22mZbgjXGNx+A/NCR8Ul+UxpsUm81b/4v5AgALltmE9 HYX+4FarK98dYtwbaTMrt+cRi+0k5hFJkDT6XdW78t3oas1yzVn58997qSHzBU/gPscjjH7mddl 0R2STqKR/VX+HvoA5dk20/VuN9bITe7NsATh5xaqvIlRPg+wCY6VYXQx+TsIquCbln0iCtSY/pq zGl7IejVSCywJjXzNmAoJeR04SjUrzrGLZPP5CFRhTZ2+cPd4r/1d7g5Fm3NnKAImsa7/98dUG2 Wa/vJN+EImE0/bcuiW10kOMT31dmrrKps3xy/GM8XuCruabauedrgtKOcCBPBGxHYvbXHS5Y7Kw v53tPVRsT/99issbUKz48B9D1itpY6huwFC5Nsm94O7wihrGexy7/EC2lK7w== X-Received: by 2002:a17:902:c401:b0:2ae:4f15:1aba with SMTP id d9443c01a7336-2ae82443f7cmr19874155ad.30.1772793677800; Fri, 06 Mar 2026 02:41:17 -0800 (PST) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ae83fa2fa5sm16107775ad.70.2026.03.06.02.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 02:41:17 -0800 (PST) From: phucduc.bui@gmail.com To: Dmitry Torokhov Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Wolfram Sang , Jeff LaBundy , Bastian Hecht , Javier Carrasco , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, bui duc phuc Subject: [PATCH v2 3/3] input: touchscreen: st1232: add system wakeup support Date: Fri, 6 Mar 2026 17:40:25 +0700 Message-ID: <20260306104025.43970-4-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260306104025.43970-1-phucduc.bui@gmail.com> References: <20260305113512.227269-1-phucduc.bui@gmail.com> <20260306104025.43970-1-phucduc.bui@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: bui duc phuc The ST1232 touchscreen controller can generate an interrupt when the panel is touched, which may be used as a wakeup source for the system. Add support for system wakeup by initializing the device wakeup capability in probe() based on the "wakeup-source" device property. When wakeup is enabled, the driver enables IRQ wake during suspend so that touch events can wake the system. Additionally, report wakeup events from the interrupt handler when the device is allowed to wake the system. This allows the PM core to track touch-generated wakeup events and helps avoid potential races with system suspend. If wakeup is not enabled, the driver retains the existing behavior of disabling the IRQ and powering down the controller during suspend. Signed-off-by: bui duc phuc --- drivers/input/touchscreen/st1232.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c index 9b3901eec0a5..2bab06cf099b 100644 --- a/drivers/input/touchscreen/st1232.c +++ b/drivers/input/touchscreen/st1232.c @@ -183,6 +183,9 @@ static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id) int count; int error; + if (device_may_wakeup(&ts->client->dev)) + pm_wakeup_event(&ts->client->dev, 0); + error = st1232_ts_read_data(ts, REG_XY_COORDINATES, ts->read_buf_len); if (error) goto out; @@ -356,6 +359,9 @@ static int st1232_ts_probe(struct i2c_client *client) i2c_set_clientdata(client, ts); + device_init_wakeup(&client->dev, + device_property_read_bool(&client->dev, "wakeup-source")); + return 0; } @@ -363,11 +369,20 @@ 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); + int ret; - disable_irq(client->irq); + dev_info(dev, "st1232: suspend called\n"); + dev_info(dev, "st1232: irq=%d wakeup=%d\n", client->irq, device_may_wakeup(dev)); - if (!device_may_wakeup(&client->dev)) + if (device_may_wakeup(dev)) { + ret = enable_irq_wake(client->irq); + dev_info(dev, "st1232: Supend use wakeup\n"); + dev_info(dev, "enable_irq_wake ret=%d\n", ret); + } else { + dev_info(dev, "st1232: Suspend Don't use wakeup\n"); + disable_irq(client->irq); st1232_ts_power(ts, false); + } return 0; } @@ -377,10 +392,12 @@ 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); - if (!device_may_wakeup(&client->dev)) + if (device_may_wakeup(dev)) { + disable_irq_wake(client->irq); + } else { st1232_ts_power(ts, true); - - enable_irq(client->irq); + enable_irq(client->irq); + } return 0; } -- 2.43.0