Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4274941rdb; Mon, 11 Dec 2023 14:18:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVTyqucgvQMZZUqVetNcBJrehNuwt/bfZy5WdDB+5eWgJ/2NygWkyevBQQ5RC9sHCm3R5z X-Received: by 2002:a17:902:e885:b0:1ca:7f91:aa5d with SMTP id w5-20020a170902e88500b001ca7f91aa5dmr5544338plg.16.1702333121719; Mon, 11 Dec 2023 14:18:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702333121; cv=none; d=google.com; s=arc-20160816; b=OlDvI8fo8LSnRYVU5asNVp4WWneAxITxRUs1oRRcat//zJVAtpYSqiTdwxZ7gf2tt0 kiOZfScSrrrqHAj4zVvrViYPvI2zfLLoloeK3fqr7/0cZQnCeWZdlqtyLmSeJ8UKS3er vLrkJs9mlhD3vKVrGdZ8DlThy1tCII0egajYFAc8cn+8x/J80UKZw7+63cFgzE5CF17+ 8YXMxmHbmgNKiJpvS4Lz5HGpSG8d+2iwSbxx5+Po79UIGc3lghRDaw6D1H0IjMzMZwxH Cpo7S2/9WN9s9v7ifVk2MK5r2W+JziK/kJBGfdVuvcKu8kd+OZIg42mWlIlyuw0Ed/r8 cXlg== 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 :message-id:date:subject:to:from:dkim-signature; bh=HjDLC1z/gNHWR5w81Ioq77XF+4q9WzaYs3i6lQVG3cQ=; fh=cdnbcZA03rbzr3OzIjTmaRyDZTLMSYrBN8qI2rN88ec=; b=bHTaH3Dnl+TYX69tEvb+cKiWMsPNLCY+k2eByMbvyEZg6EtmtGnl1F9qc+9sA5f88e ZPmux37l8H1a0VFiRcv4uxOgRSYFHKjnBNWId8d7Muof4Wt++5rs9CKhP7FFqeuBNlx0 /rHPp5pmmvHflBVeIQ5VIuF79MogIDhCJZWWnliKAdobWwCMiWv2UOK/MLPEEPu0KVl4 RF9nvmHyfHjntm2nLMyrS4jMqAHYd5TRNfFWAUhLTiK14emRze6n8vH2Io7Ejk0fihEg H3mSwB9ztziUq66U87ohPj/x2us4GADcdvmBQMxxtttES7XnYFGDNbSzj992hY51Svwj OKhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20220719 header.b=IWIO0bSU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id b8-20020a170903228800b001d09c539cd5si6925198plh.133.2023.12.11.14.18.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 14:18:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=fail header.i=@kemnade.info header.s=20220719 header.b=IWIO0bSU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 547148058470; Mon, 11 Dec 2023 14:18:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229638AbjLKWSX (ORCPT + 99 others); Mon, 11 Dec 2023 17:18:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjLKWSW (ORCPT ); Mon, 11 Dec 2023 17:18:22 -0500 Received: from mail.andi.de1.cc (mail.andi.de1.cc [IPv6:2a02:c205:3004:2154::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D3018F; Mon, 11 Dec 2023 14:18:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20220719; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=HjDLC1z/gNHWR5w81Ioq77XF+4q9WzaYs3i6lQVG3cQ=; b=IWIO0bSUZzgriJGDiKMLmpLc8I XDjDR7b2POpTimvirnRiyos7/JR6nogTB3VwVHGr0fgoXQ/WCG4sBAVNsgiMkZyvVmmQnAHvY1FCZ qKC4LjGAjyHPvx2YgjKt+c3Tv5JHfq5652EtUZwPcbZByGLkap7hfac+mZrIyV+vAu/7o29taFi1b ejLNgzzCzhqbkiz4RnNhA15SIyNhM14B8eJlmhEN+ACyVl0yJVDNiIK2pK91oGz9vKRgTEg4p6Ewc Eb0A+MtZFPYSNxtPlGNRM9tApcLJi/Dew0nxyueP5IMG+R1taD8RxOP+Cbl+Edt1aq3bd9ToR0rld 0uO0uoqg==; Received: from p200301077700c3001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:107:7700:c300:1a3d:a2ff:febf:d33a] helo=aktux) by mail.andi.de1.cc with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rCobF-007I1S-Ky; Mon, 11 Dec 2023 23:18:05 +0100 Received: from andi by aktux with local (Exim 4.96) (envelope-from ) id 1rCobE-002Abo-2J; Mon, 11 Dec 2023 23:18:04 +0100 From: Andreas Kemnade To: dmitry.torokhov@gmail.com, Jonathan.Cameron@huawei.com, tony@atomide.com, robh@kernel.org, andreas@kemnade.info, frank.li@vivo.com, u.kleine-koenig@pengutronix.de, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] Input: omap4-keypad: react on keypresses if device is runtime-suspended Date: Mon, 11 Dec 2023 23:17:57 +0100 Message-Id: <20231211221757.517427-1-andreas@kemnade.info> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 agentk.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 (agentk.vger.email [0.0.0.0]); Mon, 11 Dec 2023 14:18:39 -0800 (PST) According to SWPU235AB, table 26-6, fclk is required to generate events at least on OMAP4460, so keep fclk enabled all the time the device is opened. Suggested-by: Tony Lindgren Signed-off-by: Andreas Kemnade Reviewed-by: Tony Lindgren --- Changes in v2: - error check for clk_prepare_enable() although it should never be reached without that clock being enabled, but lets be careful. Changes since RFC: - add R-by: drivers/input/keyboard/omap4-keypad.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index d3f8688fdd9c3..040b340995d89 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -83,6 +84,7 @@ struct omap4_keypad { bool no_autorepeat; u64 keys; unsigned short *keymap; + struct clk *fck; }; static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset) @@ -209,6 +211,10 @@ static int omap4_keypad_open(struct input_dev *input) if (error) return error; + error = clk_prepare_enable(keypad_data->fck); + if (error) + goto out; + disable_irq(keypad_data->irq); kbd_writel(keypad_data, OMAP4_KBD_CTRL, @@ -226,10 +232,11 @@ static int omap4_keypad_open(struct input_dev *input) enable_irq(keypad_data->irq); +out: pm_runtime_mark_last_busy(dev); pm_runtime_put_autosuspend(dev); - return 0; + return error; } static void omap4_keypad_stop(struct omap4_keypad *keypad_data) @@ -258,6 +265,7 @@ static void omap4_keypad_close(struct input_dev *input) disable_irq(keypad_data->irq); omap4_keypad_stop(keypad_data); enable_irq(keypad_data->irq); + clk_disable_unprepare(keypad_data->fck); pm_runtime_mark_last_busy(dev); pm_runtime_put_autosuspend(dev); @@ -356,6 +364,11 @@ static int omap4_keypad_probe(struct platform_device *pdev) } keypad_data->irq = irq; + keypad_data->fck = devm_clk_get(&pdev->dev, "fck"); + if (IS_ERR(keypad_data->fck)) + return dev_err_probe(&pdev->dev, PTR_ERR(keypad_data->fck), + "unable to get fck"); + mutex_init(&keypad_data->lock); platform_set_drvdata(pdev, keypad_data); -- 2.39.2