maintainer=""
pkgname=firmware-xiaomi-clover
pkgver=2
pkgrel=0
pkgdesc="Firmware files for Xiaomi Mi Pad 4 / 4 Plus"
url="https://github.com/setotau/$pkgname"
arch="aarch64"
license="proprietary"
options="!strip !check !archcheck !spdx !tracedeps pmb:cross-native"
makedepends="qca-swiss-army-knife"

_commit="c850ad5d11315e690df8244670241e3d5a8436dc"

source="
	$pkgname-$_commit.tar.gz::$url/archive/$_commit/$pkgname-$_commit.tar.gz
	30-touchscreen-config.files
"

builddir="src"
_fwdir="/lib/firmware"

package() {
	ath10k-fwencoder --create \
		--features=wowlan,no-nwifi-decap-4addr-padding,allows-mesh-bcast,mgmt-tx-by-ref,non-bmi,single-chan-info-per-channel  \
		--set-wmi-op-version=tlv --set-htt-op-version=tlv \
		--set-fw-api=5
	install -Dm644 firmware-5.bin -t "$pkgdir/$_fwdir/ath10k/WCN3990/hw1.0/"
	install -Dm644 $pkgname-$_commit/board-2.bin -t "$pkgdir/$_fwdir/ath10k/WCN3990/hw1.0/"
	install -Dm644 $pkgname-$_commit/goodix_9110_cfg.bin -t "$pkgdir/$_fwdir/postmarketos/"
	install -Dm644 30-touchscreen-config.files -t "$pkgdir/usr/share/mkinitfs/files/"
}

sha512sums="
2b11770127704f31f31ac40401e7f336475491e1c5c315638b489a48d0da5e963e9a971ffd053696083306f7b778f78f6f273d9f2594b51f72cd996a407e792b  firmware-xiaomi-clover-c850ad5d11315e690df8244670241e3d5a8436dc.tar.gz
8bfefcf41d7c6476db6911c031c706c66b1d472c342fb23ebf50c313d85154456a04d65d984d247b65c9771a48d2b4f819835b5cda73f4de6dd7071aff86a14a  30-touchscreen-config.files
"
