mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Input: axp20x-pek - support the AXP313A power key
@ 2026-11-15 15:09 Jernej Skrabec
  2026-11-15 15:12 ` Chen-Yu Tsai
  0 siblings, 1 reply; 2+ messages in thread
From: Jernej Skrabec @ 2026-11-15 15:09 UTC (permalink / raw)
  To: Dmitry Torokhov, Chen-Yu Tsai; +Cc: linux-input, linux-kernel, Jernej Skrabec

The AXP313A MFD cell is registered as "axp313a-pek", which this driver
doesn't match, so the power key doesn't work on boards with this PMIC.

Match it as well. The AXP313A has no AXP20X_PEK_KEY register, so hide
the startup and shutdown attributes on PMICs without timing tables.

Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
 drivers/input/misc/axp20x-pek.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
index c34e002258ee..d7e696dd7c09 100644
--- a/drivers/input/misc/axp20x-pek.c
+++ b/drivers/input/misc/axp20x-pek.c
@@ -85,6 +85,9 @@ static const struct axp20x_info axp221_info = {
 	.shutdown_mask = AXP20X_PEK_SHUTDOWN_MASK,
 };
 
+/* The AXP313A has no AXP20X_PEK_KEY register, so no timing controls. */
+static const struct axp20x_info axp313a_info = { };
+
 static ssize_t axp20x_show_attr(struct device *dev,
 				const struct axp20x_time *time,
 				unsigned int mask, char *buf)
@@ -193,7 +196,26 @@ static struct attribute *axp20x_attrs[] = {
 	&dev_attr_shutdown.attr,
 	NULL,
 };
-ATTRIBUTE_GROUPS(axp20x);
+
+static umode_t axp20x_attr_is_visible(struct kobject *kobj,
+				      struct attribute *attr, int n)
+{
+	struct axp20x_pek *axp20x_pek = dev_get_drvdata(kobj_to_dev(kobj));
+
+	if (attr == &dev_attr_startup.attr && !axp20x_pek->info->startup_time)
+		return 0;
+
+	if (attr == &dev_attr_shutdown.attr && !axp20x_pek->info->shutdown_time)
+		return 0;
+
+	return attr->mode;
+}
+
+static const struct attribute_group axp20x_group = {
+	.attrs = axp20x_attrs,
+	.is_visible = axp20x_attr_is_visible,
+};
+__ATTRIBUTE_GROUPS(axp20x);
 
 static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
 {
@@ -392,6 +414,10 @@ static const struct platform_device_id axp_pek_id_match[] = {
 		.name = "axp221-pek",
 		.driver_data = (kernel_ulong_t)&axp221_info,
 	},
+	{
+		.name = "axp313a-pek",
+		.driver_data = (kernel_ulong_t)&axp313a_info,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(platform, axp_pek_id_match);

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: axp20x-pek - support the AXP313A power key
  2026-11-15 15:09 [PATCH] Input: axp20x-pek - support the AXP313A power key Jernej Skrabec
@ 2026-11-15 15:12 ` Chen-Yu Tsai
  0 siblings, 0 replies; 2+ messages in thread
From: Chen-Yu Tsai @ 2026-11-15 15:12 UTC (permalink / raw)
  To: Jernej Skrabec; +Cc: Dmitry Torokhov, linux-input, linux-kernel

On Sun, Nov 15, 2026 at 11:09 PM Jernej Skrabec
<jernej.skrabec@gmail.com> wrote:
>
> The AXP313A MFD cell is registered as "axp313a-pek", which this driver
> doesn't match, so the power key doesn't work on boards with this PMIC.
>
> Match it as well. The AXP313A has no AXP20X_PEK_KEY register, so hide
> the startup and shutdown attributes on PMICs without timing tables.
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Acked-by: Chen-Yu Tsai <wens@kernel.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-15 15:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-15 15:09 [PATCH] Input: axp20x-pek - support the AXP313A power key Jernej Skrabec
2026-11-15 15:12 ` Chen-Yu Tsai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®