pkgname=firmware-xiaomi-elish
pkgver=20230307
pkgrel=0
pkgdesc="Firmware for Xiaomi Mi Pad 5 Pro"
subpackages="
	$pkgname-adreno
	$pkgname-adsp
	$pkgname-cdsp
	$pkgname-slpi
	$pkgname-touchscreen
	$pkgname-venus
	"
url="https://github.com/lujianhua/xiaomi-elish-firmware"
arch="aarch64"
license="proprietary"
options="!check !strip !archcheck !tracedeps pmb:cross-native"
_commit="fb9e4c29873223a08beed5ca0b9a8f82f5c5c0a7"
source="https://github.com/lujianhua/xiaomi-elish-firmware/archive/$_commit/xiaomi-elish-firmware-$_commit.tar.gz"
builddir="$srcdir/xiaomi-elish-firmware-$_commit"

package() {
	# parent package is empty
	mkdir -p "$pkgdir"
}

# Xiaomi elish boots with secure boot, it can only load signed firmwares.
adreno() {
	pkgdesc="Xiaomi elish adreno firmware"
	depends="firmware-qcom-adreno-a650"

	install -Dm644 "$builddir"/sm8250/a650_zap.mbn -t \
		"$subpkgdir/lib/firmware/qcom/sm8250/xiaomi/elish/"
}

adsp() {
	pkgdesc="Xiaomi elish adsp firmware"

	install -Dm644 "$builddir"/sm8250/adsp* -t \
		"$subpkgdir/lib/firmware/qcom/sm8250/xiaomi/elish/"
}

cdsp() {
	pkgdesc="Xiaomi elish cdsp firmware"

	install -Dm644 "$builddir"/sm8250/cdsp* -t \
		"$subpkgdir/lib/firmware/qcom/sm8250/xiaomi/elish/"
}

slpi() {
	pkgdesc="Xiaomi elish slpi firmware"

	install -Dm644 "$builddir"/sm8250/slpi* -t \
		"$subpkgdir/lib/firmware/qcom/sm8250/xiaomi/elish/"
}

touchscreen() {
	pkgdesc="Xiaomi elish touchscreen firmware"

	install -Dm644 "$builddir"/novatek/nt36523.bin -t \
		"$subpkgdir/lib/firmware/novatek/"
}

venus() {
	pkgdesc="Xiaomi elish venus firmware"

	install -Dm644 "$builddir"/sm8250/venus.mbn -t \
		"$subpkgdir/lib/firmware/qcom/sm8250/xiaomi/elish/"
}

sha512sums="
25bd59ebb9a301ca8972d28918d6d08b95eb6cea5782461e32f17dffe0b97e61e9ff09c3b2d43f9af840703df88fb102404c32028e7bf896e9cf75cf13c8e854  xiaomi-elish-firmware-fb9e4c29873223a08beed5ca0b9a8f82f5c5c0a7.tar.gz
"
