##################################################################################
# Helper script: /load_kernel_modules.scr/platform/aarch64/allwinner
# Purpose......: Set the Kernel modules for Hardware Models that use the Allwinner
#                SoC within the Slackware initial RAM disk ('OS initrd')
#                and the Slackware Installer.
#                Currently supported Hardware Models:
#                * PINE64(+)
#                * PINE64 LTS
#                This script is sourced from '/load_kernel_modules'
##################################################################################

##################################################################################
# Author.......: William Burlamachi <william.armbit@outlook.com>
# Upstream repo: https://gitlab.com/w.slk-hw/pine64-slk-aarch64
# Date.........: 11-Feb-2026
# Maintainer...: William Burlamachi <william.armbit@outlook.com>
##################################################################################

case $HWM in
   "Pine64 PINE A64"*|PLATWALK)
      platform_detected=1
      SOC_NAME=allwinner

      # Load the parent platform drivers for the SoC:
      kmod_load_subsyst_soc=1

      MOD_GPIO+="   pwm-gpio gpio-regulator"
      # Drivers for PCI and other core sub systems:
      MOD_PHY+="    pwm-sun4i"
      # Video/display drivers:
      MOD_VIDEO+="  pwm_bl backlight drm drm_dp_aux_bus drm_dma_helper panel_edp mali_dp sun4i-drm sun8i_dw_hdmi sun8i-drm_hdmi dw-hdmi lima panel-edp sun8i-mixer sun6i_mipi_dsi sun6i_drc sun4i-tcon sun8i-drm-hdmi sun8i_tcon_top sun4i_tv sun4i-drm simpledrm simple-bridge dw-hdmi-cec display-connector"

      # MFD (Multi Functional Devices) drivers:
      MOD_MFD+="    spi-sun4i sun4i-gpadc sun4i-tcon"

      # For SDHC/MMC storage:
      MOD_CARDS+="  sunxi-mmc ahci-sunxi"
      # Drivers for USB hardware for this particular Hardware Model:
      MOD_USB+="    sunxi phy-sun4i-usb"
      # Ethernet network driver:
      MOD_NET+="    mdio mdio-sun4i sun4i-emac dwmac-sun8i realtek"
      # Any modules related to compression/decompression and cryptography
      #MOD_CMP+="    "
      MOD_CRYPTO+=" sun8i-ce crc16"

      # Real Time Clock:
      MOD_RTC+="    "
      # Modules for the peripherals on the Hardware Model's main board
      # (outside of the SoC itself)
      MOD_HWM+="    axp20x_battery axp20x_usb_power axp20x_ac_power axp20x-regulator axp20x_adc axp20x-pek axp20x axp20x-i2c axp20x-rsb"
      # Modules for the IP blocks/peripherals embedded within the SoC:
      MOD_SOC+="    sun50i-h6-prcm-ppu"
      ;;
esac

case $hwm in
   "Pine64 PINE A64 LTS"*)
      HWM_SHORTNAME=pine64_sbc_lts ;;
   "Pine64 PINE A64+"*)
      HWM_SHORTNAME=pine64_sbc_plus ;;
   "Pine64 PINE A64"*)
      HWM_SHORTNAME=pine64_sbc ;;
esac

# The '/load_kernel_modules' script will load the modules
# set above.
