# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-xiaomi-elish
pkgdesc="Xiaomi Mi Pad 5 Pro"
pkgver=0.7
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
	alsa-ucm-conf-xiaomi-elish
	make-dynpart-mappings
	mesa-vulkan-freedreno
	mkbootimg
	postmarketos-base
	postmarketos-update-kernel
	qbootctl
	swclock-offset
"
makedepends="devicepkg-dev"
install="$pkgname.post-install $pkgname.post-upgrade"
source="deviceinfo"

subpackages="
	$pkgname-kernel-boe:kernel_boe
	$pkgname-kernel-csot:kernel_csot
	$pkgname-nonfree-firmware:nonfree_firmware
"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
}

kernel_boe() {
	pkgdesc="BOE Panel. To know which panel your device use and the status of the port, Visit the Mi Pad 5 Pro wiki page: https://wiki.postmarketos.org/wiki/Xiaomi_Mi_Pad_5_Pro_(xiaomi-elish)"
	depends="linux-postmarketos-qcom-sm8250"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_csot() {
	pkgdesc="CSOT Panel. To know which panel your device use and the status of the port, Visit the Mi Pad 5 Pro wiki page: https://wiki.postmarketos.org/wiki/Xiaomi_Mi_Pad_5_Pro_(xiaomi-elish)"
	depends="linux-postmarketos-qcom-sm8250"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

nonfree_firmware() {
	pkgdesc="Firmware for GPU, WiFi, etc."
	depends="
		firmware-xiaomi-elish-adreno
		firmware-xiaomi-elish-adsp
		firmware-xiaomi-elish-cdsp
		firmware-xiaomi-elish-cirrus
		firmware-xiaomi-elish-slpi
		firmware-xiaomi-elish-touchscreen
		firmware-xiaomi-elish-venus
		linux-firmware-ath11k
		linux-firmware-qca
		pd-mapper
		tqftpserv
		"
	install="$subpkgname.post-install $subpkgname.post-upgrade"
	mkdir "$subpkgdir"
}

sha512sums="
7ea1943a4c4e0c6c2f06679481fab5a5a386293deaaf7ae5d6cd1d376110fd27211257596dbba12c7a9b57bc5bacd61849204ac4f527810b6098730b7bd98d09  deviceinfo
"
