Input: axp20x-pek - add AXP313a support
Subsystems (4)
PATCH 1/1 Input: axp20x-pek - add AXP313a support
The AXP313a MFD driver registers its power button cell as "axp313a-pek", but the axp20x-pek platform id table only matches "axp20x-pek" and "axp221-pek". The power button therefore never probes on boards using the AXP313a PMIC (e.g. the OrangePi Zero 2W).
Add the missing id table entry. The register layout used by the driver matches the AXP313a, so the generic axp20x_info is reused.
Tested on: OrangePi Zero 2W (Allwinner H618 + AXP313a), kernel 7.1.13.
--- drivers/input/misc/axp20x-pek.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/input/misc/axp20x-pek.c +4 -0
@@ -393,6 +393,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)&axp20x_info, + }, {/* sentinel */ } };MODULE_DEVICE_TABLE (platform, axp_pek_id_match);
Signature · 1 line
2.53.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] input: broken AXP313a sysfs attributes due to out-of-bounds regmap access --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] input: broken AXP313a sysfs attributes due to out-of-bounds regmap access --
commit fbaeccab4996537ab99d0c8423e2cf36610e4b34
Author: Vladimir <[email protected]>
Input: axp20x-pek - add AXP313a support
This commit adds the AXP313a PMIC platform ID to the axp20x-pek driver to enable the power button. It uses the axp20x_info generic register layout.
drivers/input/misc/axp20x-pek.c static const struct platform_device_id axp_pek_id_match[] = { · line 398
Quoted 11 lines
drivers/input/misc/axp20x-pek.c +3
-0@@ -393,6 +393,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)&axp20x_info,
[Severity: Medium]
Will reusing axp20x_info break the sysfs attributes startup and shutdown for the AXP313a?
When these sysfs attributes are accessed, the driver calls:
axp20x_show_attr()
regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, &val);
axp20x_store_attr()
regmap_update_bits(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, mask, idx);
Since AXP20X_PEK_KEY is 0x36, but the AXP313a regmap defines max_register as 0x21, won't the regmap core block this out-of-bounds access and return an error?
drivers/input/misc/axp20x-pek.c static const struct platform_device_id axp_pek_id_match[] = { · line 401
Quoted 3 lines
drivers/input/misc/axp20x-pek.c +1
-0+ }, {/* sentinel */ } };
MODULE_DEVICE_TABLE(platform, axp_pek_id_match);
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
This is already addressed in v2 [1]: the AXP313a no longer reuses axp20x_info. It has its own axp313a_info without start-up/shutdown times, and the startup/shutdown attributes are hidden through is_visible(), so they are not created and no out-of-range access to AXP20X_PEK_KEY happens.
ср, 23 сент. 2026 г. в 16:07, <[email protected]>:
Quoted 47 lines
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] input: broken AXP313a sysfs attributes due to out-of-bounds regmap access --commit
fbaeccab4996537ab99d0c8423e2cf36610e4b34
Author: Vladimir <[email protected]>Input: axp20x-pek - add AXP313a support
This commit adds the AXP313a PMIC platform ID to the axp20x-pek driver to enable the power button. It uses the
axp20x_infogeneric register layout.drivers/input/misc/axp20x-pek.c static const struct platform_device_id axp_pek_id_match[] = { · line 398
Quoted 11 lines
drivers/input/misc/axp20x-pek.c +3
-0@@ -393,6 +393,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)&axp20x_info,[Severity: Medium]
Will reusingaxp20x_infobreak the sysfs attributes startup and shutdown for the AXP313a?When these sysfs attributes are accessed, the driver calls:
axp20x_show_attr()
regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, &val);
axp20x_store_attr()
regmap_update_bits(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, mask, idx);Since
AXP20X_PEK_KEYis0x36, but the AXP313a regmap definesmax_registeras0x21, won't the regmap core block this out-of-bounds access and return an error?drivers/input/misc/axp20x-pek.c static const struct platform_device_id axp_pek_id_match[] = { · line 401
Quoted 3 lines
drivers/input/misc/axp20x-pek.c +1
-0+ }, {/* sentinel */ } };
MODULE_DEVICE_TABLE(platform, axp_pek_id_match);--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
This is already addressed in v2 [1]: the AXP313a no longer reuses axp20x_info. It has its own axp313a_info without start-up/shutdown times, and the startup/shutdown attributes are hidden through is_visible(), so they are not created and no out-of-range access to AXP20X_PEK_KEY happens.