Linux Input/HID development
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: steven <steven@joint-cloud.com>
Cc: wens@kernel.org, linux-input@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: axp20x-pek - add support for AXP313A variant
Date: Tue, 2 Jun 2026 19:25:26 -0700	[thread overview]
Message-ID: <ah-QII3kV5WK4haF@google.com> (raw)
In-Reply-To: <tencent_48A497E0CA81323CFB6C7CB84428019A8707@qq.com>

On Wed, Jun 03, 2026 at 09:38:54AM +0800, steven wrote:
> Add power button support for the AXP313A PMIC. The AXP313A does not
> have the PEK_KEY register (0x36) used to configure startup and shutdown
> timings, unlike AXP20X and AXP221. Create a dedicated axp313a_info
> configuration with NULL time tables to prevent regmap out-of-bounds
> access.
> 
> The sysfs attributes (startup/shutdown) will return -EOPNOTSUPP when
> accessed on AXP313A devices.
> 
> Signed-off-by: steven <steven@joint-cloud.com>
> ---
> Changes in v2:
> - Fixed regmap out-of-bounds access issue reported by Sashiko AI
> - Created dedicated axp313a_info with NULL time tables
> - Added NULL pointer checks to prevent crashes
> - AXP313A lacks PEK_KEY (0x36) per datasheet verification
> - Power button still functional using hardware default timings
> 
> v1: https://lore.kernel.org/all/tencent_5F1FF80489E702360F352F889570656BF608@qq.com/
> ---
>  drivers/input/misc/axp20x-pek.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
> index d4e2fc9a937f..de43eef0c0ea 100644
> --- a/drivers/input/misc/axp20x-pek.c
> +++ b/drivers/input/misc/axp20x-pek.c
> @@ -85,6 +85,13 @@ static const struct axp20x_info axp221_info = {
>  	.shutdown_mask = AXP20X_PEK_SHUTDOWN_MASK,
>  };
>  
> +static const struct axp20x_info axp313a_info = {
> +	.startup_time = NULL,
> +	.startup_mask = 0,
> +	.shutdown_time = NULL,
> +	.shutdown_mask = 0,
> +};
> +
>  static ssize_t axp20x_show_attr(struct device *dev,
>  				const struct axp20x_time *time,
>  				unsigned int mask, char *buf)
> @@ -93,6 +100,9 @@ static ssize_t axp20x_show_attr(struct device *dev,
>  	unsigned int val;
>  	int ret, i;
>  
> +	if (!time)
> +		return -EOPNOTSUPP;


Use is_visible to control whether attributes are accessible.

Thanks.

-- 
Dmitry

  reply	other threads:[~2026-06-03  2:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03  1:38 [PATCH] Input: axp20x-pek - add support for AXP313A variant steven
2026-06-03  2:25 ` Dmitry Torokhov [this message]
     [not found] <ZoMD9s0Xs_VBzIKC@google.com>
2026-06-03  2:59 ` Steven Feng
2026-06-03  7:23   ` Chen-Yu Tsai
  -- strict thread matches above, loose matches on Subject: below --
2026-06-02  9:55 steven
2026-06-02 10:10 ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ah-QII3kV5WK4haF@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steven@joint-cloud.com \
    --cc=wens@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox