Skip to content

aw882xx: support building against Linux 4.19 through 7.x kernels - #16

Merged
dianjixz merged 1 commit into
mainfrom
fix/aw882xx-kernel-compat
Nov 5, 2026
Merged

dianjixz merged 1 commit into
mainfrom
fix/aw882xx-kernel-compat

Conversation

@dianjixz

@dianjixz dianjixz commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

The vendored driver only built on the kernel it shipped with. Make the sources compile and load across 4.19 up to the current 7.x Raspberry Pi kernels by guarding each API change with version checks.

  • aw882xx.c: wrap snd_soc_kcontrol_component() and snd_soc_(un)register_component() in helpers, since they are macros or removed on newer kernels and cannot be used as function pointers
  • aw882xx.c: accept SND_SOC_DAIFMT_CBC_CFC in place of the removed SND_SOC_DAIFMT_CBS_CFS, and GPIOF_IN in place of GPIOF_DIR_IN
  • aw882xx.c: open code of_get_named_gpio() with the gpio_device API for 7.1+, and drop the <linux/of_gpio.h> includes that no longer exist
  • aw882xx.c: use the single-argument i2c probe/remove signatures from 6.3 on and skip the devm_gpio_free() calls that are gone since 6.0
  • aw882xx.h: use the string literal form of MODULE_IMPORT_NS() needed by 6.13+
  • aw882xx*.c: replace the removed strlcpy() with strscpy()
  • Makefile: drop the duplicated aw882xx.o entry, apply the commented out aw882xx_calib.o filter, and make KDIR overridable so cross builds work
  • README.md: document native and cross compilation

The vendored driver only built on the kernel it shipped with. Make the
sources compile and load across 4.19 up to the current 7.x Raspberry Pi
kernels by guarding each API change with version checks.

- aw882xx.c: wrap snd_soc_kcontrol_component() and
  snd_soc_(un)register_component() in helpers, since they are macros or
  removed on newer kernels and cannot be used as function pointers
- aw882xx.c: accept SND_SOC_DAIFMT_CBC_CFC in place of the removed
  SND_SOC_DAIFMT_CBS_CFS, and GPIOF_IN in place of GPIOF_DIR_IN
- aw882xx.c: open code of_get_named_gpio() with the gpio_device API for
  7.1+, and drop the <linux/of_gpio.h> includes that no longer exist
- aw882xx.c: use the single-argument i2c probe/remove signatures from
  6.3 on and skip the devm_gpio_free() calls that are gone since 6.0
- aw882xx.h: use the string literal form of MODULE_IMPORT_NS() needed
  by 6.13+
- aw882xx*.c: replace the removed strlcpy() with strscpy()
- Makefile: drop the duplicated aw882xx.o entry, apply the commented out
  aw882xx_calib.o filter, and make KDIR overridable so cross builds work
- README.md: document native and cross compilation
@dianjixz
dianjixz merged commit 4f7aeee into main Nov 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant