Re: [PATCH] Input: axp20x-pek - support the AXP313A power key

From: Jernej Škrabec

Date: Mon Nov 16 2026 - 10:43:21 EST


Dne ponedeljek, 16. november 2026 ob 08:39:21 Srednjeevropski standardni čas je Dmitry Torokhov napisal(a):
> Hi Jernej,
>
> On Sun, Nov 15, 2026 at 04:09:03PM +0100, Jernej Skrabec 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.
> ...
> > +/* 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;
> > +}
>
> axp20x_pek->info is only used by the startup and shutdown sysfs
> attributes, and we do not have variants that support only one of them.
> Can we drop the empty axp313a_info structure (leaving driver_data as 0
> for "axp313a-pek") and simplify this to:
>
> return axp20x_pek->info ? attr->mode : 0;
>
> ?
>
> Thanks.
>
>

Makes sense, will do.

Best regards,
Jernej