From a559c7e33f54d3a503563f27d8548048541fc53f Mon Sep 17 00:00:00 2001 From: opendata26 Date: Fri, 18 Aug 2017 22:13:38 +0100 Subject: [PATCH] Add firmware-adreno package (#393) * Add support for wifi and touchscreen on castor * Various fixes * Add firmware-adreno package * Download firmware files --- .../device/device-sony-castor-windy/APKBUILD | 24 ++-- .../brcmfmac4339-sdio.txt | 119 ++++++++++++++++++ .../device-sony-castor_windy.post-install | 17 +++ .../device-sony-castor-windy/deviceinfo | 3 +- .../modules-load.conf | 5 + aports/device/firmware-adreno/APKBUILD | 30 +++++ .../device/linux-sony-castor-windy/APKBUILD | 24 ++-- .../config-sony-castor-windy.armhf | 2 +- .../mmc-wifi-fix.patch | 50 ++++++++ 9 files changed, 256 insertions(+), 18 deletions(-) create mode 100644 aports/device/device-sony-castor-windy/brcmfmac4339-sdio.txt create mode 100644 aports/device/device-sony-castor-windy/device-sony-castor_windy.post-install create mode 100644 aports/device/device-sony-castor-windy/modules-load.conf create mode 100644 aports/device/firmware-adreno/APKBUILD create mode 100644 aports/device/linux-sony-castor-windy/mmc-wifi-fix.patch diff --git a/aports/device/device-sony-castor-windy/APKBUILD b/aports/device/device-sony-castor-windy/APKBUILD index 78c20b21..04ae2217 100644 --- a/aports/device/device-sony-castor-windy/APKBUILD +++ b/aports/device/device-sony-castor-windy/APKBUILD @@ -1,15 +1,15 @@ pkgname=device-sony-castor-windy pkgver=1 -pkgrel=5 +pkgrel=6 pkgdesc="Sony Xperia Z2 Tablet WIFI" url="https://github.com/postmarketOS" arch="noarch" license="MIT" -depends="mkbootimg linux-sony-castor-windy" +depends="mkbootimg linux-sony-castor-windy linux-firmware firmware-adreno" makedepends="" install="" subpackages="" -source="deviceinfo 90-android.rules" +source="modules-load.conf deviceinfo 90-android.rules brcmfmac4339-sdio.txt" options="!check" build() { @@ -17,10 +17,16 @@ build() { } package() { - install -D -m644 "$srcdir/deviceinfo" \ - "$pkgdir/etc/deviceinfo" - + install -D -m644 "$srcdir/deviceinfo" \ + "$pkgdir/etc/deviceinfo" + install -D -m644 "$srcdir/brcmfmac4339-sdio.txt" \ + "$pkgdir/lib/firmware/brcm/brcmfmac4339-sdio.txt" + install -D -m644 "$srcdir/90-android.rules" \ + "$pkgdir/etc/udev/rules.d/90-android.rules" + install -D -m644 "$srcdir"/modules-load.conf \ + "$pkgdir"/etc/modules-load.d/00-${pkgname}.conf } - -sha512sums="89b2be5bdad90a7485a5d50d3e4f862c472f86a997c4f071426d0134e76397064ffc6879bbcf6783c7a462a173d518de3486390de94a7ae4702fa99f0247e756 deviceinfo -d309bc3ef26a30ea24be87bd3120eef9cd9fe1d09812ce35f1a9e8d291d5c5ca5651b7fa5a61fb155d8fb98b7df7104ab35c087b96b66ba0b0a54d7e7c5985ff 90-android.rules" +sha512sums="d8ce60ea7acaabf627ddca2f0887a4cda46f313b7aaf7934bef2fef8a6e0798ccefab849e4571e4e3fcd06ae34c1a6efe3b58b401e2e443416f6200e6d4ea769 modules-load.conf +050c5ec58629a0af80b43d5e1724875f7085fa41e61cb264ba56cf9f19526cc1dc47a8838120e5cc8a84265f9de63061b17f8e213c8a1ac8475bf928ab67a0bf deviceinfo +d309bc3ef26a30ea24be87bd3120eef9cd9fe1d09812ce35f1a9e8d291d5c5ca5651b7fa5a61fb155d8fb98b7df7104ab35c087b96b66ba0b0a54d7e7c5985ff 90-android.rules +b99a1bc0d430a261b6ab0b5ea12f2e996ab24ece6fe40ff57357697f4db976394c655a7c7a63e7c985f6356126a6b1d920eb0077817cb65ae18250f404282a68 brcmfmac4339-sdio.txt" diff --git a/aports/device/device-sony-castor-windy/brcmfmac4339-sdio.txt b/aports/device/device-sony-castor-windy/brcmfmac4339-sdio.txt new file mode 100644 index 00000000..0d61f222 --- /dev/null +++ b/aports/device/device-sony-castor-windy/brcmfmac4339-sdio.txt @@ -0,0 +1,119 @@ +ppr_flags=1 +NVRAMRev=$Rev: 410316 $ +sromrev=11 +boardrev=0x1203 +boardtype=0x06c5 +boardflags=0x00000c01 +boardflags2=0x00002000 +boardflags3=0x8101188 +macaddr=00:90:4c:c5:12:38 +ccode=XT +regrev=212 +antswitch=0 +pdgain2g=7 +pdgain5g=7 +tworangetssi2g=0 +tworangetssi5g=0 +femctrl=7 +pcieingress_war=15 +vendid=0x14e4 +devid=0x43ae +manfid=0x2d0 +nocrc=1 +otpimagesize=502 +xtalfreq=37400 +extpagain2g=2 +pdetrange2g=2 +extpagain5g=2 +pdetrange5g=2 +rxgains2gelnagaina0=0 +rxgains2gtrisoa0=7 +rxgains2gtrelnabypa0=0 +rxgains5gelnagaina0=0 +rxgains5gtrisoa0=11 +rxgains5gtrelnabypa0=0 +rxchain=1 +txchain=1 +aa2g=1 +aa5g=1 +tssipos5g=0 +tssipos2g=0 +pa2ga0=0xff7e,0x1980,0xfd1d +pa2gccka0=0xff90,0x1d52,0xfcab +pa5ga0=0xff40,0x15b9,0xfd55,0xff45,0x161c,0xfd4c,0xff73,0x17c1,0xfd4b,0xff70,0x175e,0xfd4d +pa5gbw40a0=0xff55,0x179b,0xfd2f,0xff56,0x17b8,0xfd2b,0xff61,0x17fc,0xfd2f,0xff5b,0x178f,0xfd31 +pa5gbw80a0=0xff3f,0x15e4,0xfd50,0xff54,0x1736,0xfd39,0xff60,0x177a,0xfd3d,0xff63,0x174b,0xfd42 +pdoffset40ma0=0 +pdoffset80ma0=0 +pdoffsetcckma0=0 +maxp2ga0=78 +maxp5ga0=68,68,68,68 +cckbw202gpo=0x4444 +cckbw20ul2gpo=0x0 +mcsbw202gpo=0xbbbbbbbb +mcsbw402gpo=0x00000000 +dot11agofdmhrbw202gpo=0x9999 +ofdmlrbw202gpo=0x0099 +tssifloor2g=400 +mcsbw205glpo=0x33333333 +mcsbw405glpo=0x44444444 +mcsbw805glpo=0xcccccccc +mcsbw1605glpo=0x00000000 +mcsbw205gmpo=0x33333333 +mcsbw405gmpo=0x44444444 +mcsbw805gmpo=0xcccccccc +mcsbw1605gmpo=0x00000000 +mcsbw205ghpo=0x33333333 +mcsbw405ghpo=0x44444444 +mcsbw805ghpo=0xcccccccc +mcsbw1605ghpo=0x00000000 +mcslr5glpo=0x0000 +mcslr5gmpo=0x0000 +mcslr5ghpo=0x0000 +sb20in40hrrpo=0x0 +sb20in80and160hr5glpo=0x0 +sb40and80hr5glpo=0x0 +sb20in80and160hr5gmpo=0x0 +sb40and80hr5gmpo=0x0 +sb20in80and160hr5ghpo=0x0 +sb40and80hr5ghpo=0x0 +sb20in40lrpo=0x0 +sb20in80and160lr5glpo=0x0 +sb40and80lr5glpo=0x0 +sb20in80and160lr5gmpo=0x0 +sb40and80lr5gmpo=0x0 +sb20in80and160lr5ghpo=0x0 +sb40and80lr5ghpo=0x0 +dot11agduphrpo=0x0 +dot11agduplrpo=0x0 +phycal_tempdelta=25 +cckdigfilttype=2 +swctrlmap_5g=0x00000008,0x00000010,0x00000008,0x000000,0x038 +swctrlmap_2g=0x00000001,0x00000002,0x00000001,0x040002,0x0ff +swctrlmapext_5g=0x00000000,0x00000000,0x00000000,0x000000,0x000 +swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x000 +rssi_delta_2g_c0=7,11,0,0 +rssi_delta_5gl_c0=3,5,4,5,4,5 +rssi_delta_5gml_c0=3,4,3,5,4,5 +rssi_delta_5gmu_c0=3,2,3,3,4,3 +rssi_delta_5gh_c0=3,0,3,0,4,1 +rssicorrnorm_c0=-5,-5 +rssicorrnorm5g_c0=-4,-4,-4,-4,-4,-4,-5,-5,-5,-5,-5,-5 +agbg0=0x01 +aga0=0x82 +muxenab=0x10 +r12t=0x00420002 + +#Band_Edge_Offset_param +rpcal2g=0x0000 +rpcal5gb0=0x0000 +rpcal5gb1=0x0000 +rpcal5gb2=0x0000 +powoffs5g20mtna0=0,0,0,0,0,0,0 +powoffs5g40mtna0=0,0,0,0,0 +powoffs5g80mtna0=0,0,0,0,0 +#Factory_Cal_Offset_param +powoffs2gtna0=0,0,0,0,0,0,0,0,0,0,0,0,0,0 +sbpowoffs5g20mtna0=0,0,0,0 +sbpowoffs5g40mtna0=0,0,0,0 +sbpowoffs5g80mtna0=0,0,0,0 diff --git a/aports/device/device-sony-castor-windy/device-sony-castor_windy.post-install b/aports/device/device-sony-castor-windy/device-sony-castor_windy.post-install new file mode 100644 index 00000000..90d99a66 --- /dev/null +++ b/aports/device/device-sony-castor-windy/device-sony-castor_windy.post-install @@ -0,0 +1,17 @@ +#!/bin/sh + +# Enable networking service (requires /etc/interfaces, which is configured below) +rc-update add networking default + +# Create /etc/network/interfaces if this doesn't exist +if [ ! -f /etc/network/interfaces ]; then + cat << EOF >> /etc/network/interfaces +auto lo +iface lo inet loopback +auto wlan0 +iface wlan0 inet dhcp +EOF + +fi + +exit 0 diff --git a/aports/device/device-sony-castor-windy/deviceinfo b/aports/device/device-sony-castor-windy/deviceinfo index f07f85df..2e6474b3 100644 --- a/aports/device/device-sony-castor-windy/deviceinfo +++ b/aports/device/device-sony-castor-windy/deviceinfo @@ -21,4 +21,5 @@ deviceinfo_flash_offset_ramdisk="0x02000000" deviceinfo_flash_offset_second="0x00f00000" deviceinfo_flash_offset_tags="0x01e00000" deviceinfo_flash_pagesize="2048" -deviceinfo_kernel_cmdline="clk_ignore_unused console=ttyMSM0,115200,n8" +deviceinfo_kernel_cmdline="clk_ignore_unused console=ttyMSM0,115200,n8 cma=1024m msm.vram=896m" +deviceinfo_weston_core_modules="xwayland.so" diff --git a/aports/device/device-sony-castor-windy/modules-load.conf b/aports/device/device-sony-castor-windy/modules-load.conf new file mode 100644 index 00000000..a52c413a --- /dev/null +++ b/aports/device/device-sony-castor-windy/modules-load.conf @@ -0,0 +1,5 @@ +# This file contains the names of kernel modules that should be loaded +# at boot time, one per line. Lines beginning with "#" are ignored. + +# wifi module +brcmfmac diff --git a/aports/device/firmware-adreno/APKBUILD b/aports/device/firmware-adreno/APKBUILD new file mode 100644 index 00000000..bca231a4 --- /dev/null +++ b/aports/device/firmware-adreno/APKBUILD @@ -0,0 +1,30 @@ +_files="a225_pm4.fw a225_pfp.fw a225p5_pm4.fw a300_pfp.fw a300_pm4.fw a330_pfp.fw a330_pm4.fw" + +pkgname=firmware-adreno +pkgver=1 +pkgrel=0 +pkgdesc="Firmware for adreno gpus" +url="https://github.com/TheMuppets/proprietary_vendor_sony" +arch="armhf" +license="proprietary" +depends="" +makedepends="" +install="" +subpackages="" +for _i in $_files; do source="$source https://github.com/TheMuppets/proprietary_vendor_sony/raw/cm-14.1/shinano-common/proprietary/etc/firmware/$_i"; done +options="!check" + +build() { + return 0 +} + +package() { + for _i in $_files; do install -D -m644 "$srcdir/$_i" "$pkgdir/lib/firmware/postmarketos"; done +} +sha512sums="b278ea24a84036f24f3fa583e63b2c1236312d8b163398d874367ffc91b4652ceb0b3ce5dd2097748dd2083ea1222c0f9413efcc5b72553da3ef753f5910f24a a225_pm4.fw +d127fdca476233fca6e6e59e62bced8563663bac65de30a81eb1912f182cd27fdf8726085e65820c4c26c389daa1ffef9792a598c7b7568f277e781b5e775d5f a225_pfp.fw +339a632a554a8c6e7fd1ff1465c3c985417f9e199e6934a5b149862245566f0c7171c924fc0a7a0d96bc6c5c5efd3c86dd0252d7064f7fee8ac502be8fc977f0 a225p5_pm4.fw +0622ce695b8021fd2bc1d94498b475dc2aac582b637dd4695968912b69ee61e190ce3848d233a514b37ece5a63d47878254ef220d573035b47b888e92e91d684 a300_pfp.fw +c330767a1bfd200745c7dd8d80e293bbffe906d07f4c5f595af69c46bb6d6bb390f3e386ccf999f2a77ced8e969abb0743d723bd94f7cb8c96320ba72129d1d2 a300_pm4.fw +a642584990333d62ba6a985eeaddc6898c37a8e80aabb61121f93a90d5076861eb698422101e7b00706b7d3dfc00f9f358ea5e44a70fda7369931eb58b455931 a330_pfp.fw +999e3e0777b8dffc0e0d20b214c8217dab577a31753b6a29af2fae57293693196e992a905265e35a586a7978c04547aa8c88496dbe6f836b74ed39026eaa5f05 a330_pm4.fw" diff --git a/aports/device/linux-sony-castor-windy/APKBUILD b/aports/device/linux-sony-castor-windy/APKBUILD index e33b6f38..19eb48b3 100644 --- a/aports/device/linux-sony-castor-windy/APKBUILD +++ b/aports/device/linux-sony-castor-windy/APKBUILD @@ -13,7 +13,7 @@ _vendor=sony _flavor=sony-castor-windy -_branch=wifi-fixes +_branch=next _config="config-${_flavor}.armhf" pkgname=linux-${_flavor} @@ -25,14 +25,15 @@ esac pkgrel=1 arch="armhf" pkgdesc="Sony Xperia Z2 Tablet kernel" -url="https://github.com/opendata26" +url="https://github.com/andersson" depends="postmarketos-mkinitfs" makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev" options="!strip !check !tracedeps" install= source=" - $pkgname-$_branch.tar.gz::https://github.com/opendata26/kernel/archive/${_branch}.tar.gz + $pkgname-$_branch.tar.gz::https://github.com/andersson/kernel/archive/${_branch}.tar.gz $_config + mmc-wifi-fix.patch compiler-gcc6.h " subpackages="" @@ -91,8 +92,9 @@ build() { unset LDFLAGS make ARCH="$_carch" CC="${CC:-gcc}" \ - KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" \ - || return 1 + KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" \ + CFLAGS_MODULE=-fno-pic \ + || return 1 } package() { @@ -105,7 +107,15 @@ package() { install -D "$srcdir/build/include/config/kernel.release" \ "$pkgdir/usr/share/kernel/$_flavor/kernel.release" + + cd "$srcdir/build" + make -j1 modules_install \ + ARCH="$_carch" \ + INSTALL_MOD_PATH="$pkgdir" \ + || return 1 } -sha512sums="d27a8850e6412c2edb2752433600c9b46e3a83a319b3d175dfeaff447ddc2213c4bbfcdb3688eed76743dc89ac1679a40ec95e8b334f30b4e463ae42facdfcc5 linux-sony-castor-windy-wifi-fixes.tar.gz -6505f6371153bc741d48bd9f9e15001c8ccd7feb96ce6bb3a6ab7cb3b2012e7b61439edbbac5b1377e11b3af1cb4e2b3878b54b4fdc00729f0a6b2272f64591f config-sony-castor-windy.armhf + +sha512sums="42e3d7ea75a2e69a7589e74409fe43f2abdee0f4cc1fcea1b138622e3845524145e4c41343abc57d71236b1e2f59715f719845fcf5e628a6c343e9b10d06942a linux-sony-castor-windy-next.tar.gz +7a39cb11eba808c1c8450925b2a865192f02572bc2c64de362ba9d26098852f8f7ce602ba2a3c418a1b12d2359d6e5fd6d3463bb338ba3071b0c72ba7f43aad4 config-sony-castor-windy.armhf +a13b17a151f732c2842df963019079cab07118fcdcdb2f2dfdfbd18571c7e2bd95a94734dc3a4eef1dae970e698f46047973efba6f355b26bf553fa6c2ac895d mmc-wifi-fix.patch d80980e9474c82ba0ef1a6903b434d8bd1b092c40367ba543e72d2c119301c8b2d05265740e4104ca1ac5d15f6c4aa49e8776cb44264a9a28dc551e0d1850dcc compiler-gcc6.h" diff --git a/aports/device/linux-sony-castor-windy/config-sony-castor-windy.armhf b/aports/device/linux-sony-castor-windy/config-sony-castor-windy.armhf index af1149fb..beb7fbdf 100644 --- a/aports/device/linux-sony-castor-windy/config-sony-castor-windy.armhf +++ b/aports/device/linux-sony-castor-windy/config-sony-castor-windy.armhf @@ -1439,7 +1439,7 @@ CONFIG_WCN36XX_DEBUGFS=y # CONFIG_B43LEGACY is not set CONFIG_BRCMUTIL=y # CONFIG_BRCMSMAC is not set -CONFIG_BRCMFMAC=y +CONFIG_BRCMFMAC=m CONFIG_BRCMFMAC_PROTO_BCDC=y CONFIG_BRCMFMAC_SDIO=y # CONFIG_BRCMFMAC_USB is not set diff --git a/aports/device/linux-sony-castor-windy/mmc-wifi-fix.patch b/aports/device/linux-sony-castor-windy/mmc-wifi-fix.patch new file mode 100644 index 00000000..127d24bd --- /dev/null +++ b/aports/device/linux-sony-castor-windy/mmc-wifi-fix.patch @@ -0,0 +1,50 @@ +diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c +index fb266745f824..e56987522182 100644 +--- a/drivers/mmc/host/mmci.c ++++ b/drivers/mmc/host/mmci.c +@@ -103,6 +103,7 @@ struct variant_data { + bool explicit_mclk_control; + bool qcom_fifo; + bool qcom_dml; ++ bool any_blksize; + bool reversed_irq_handling; + }; + +@@ -200,6 +201,7 @@ static struct variant_data variant_ux500v2 = { + .pwrreg_clkgate = true, + .busy_detect = true, + .pwrreg_nopower = true, ++ .any_blksize = true, + }; + + static struct variant_data variant_qcom = { +@@ -218,6 +220,7 @@ static struct variant_data variant_qcom = { + .explicit_mclk_control = true, + .qcom_fifo = true, + .qcom_dml = true, ++ .any_blksize = true, + }; + + static int mmci_card_busy(struct mmc_host *mmc) +@@ -245,10 +248,11 @@ static int mmci_card_busy(struct mmc_host *mmc) + static int mmci_validate_data(struct mmci_host *host, + struct mmc_data *data) + { ++ struct variant_data *variant = host->variant; ++ + if (!data) + return 0; +- +- if (!is_power_of_2(data->blksz)) { ++ if (!is_power_of_2(data->blksz) && !variant->any_blksize) { + dev_err(mmc_dev(host->mmc), + "unsupported block size (%d bytes)\n", data->blksz); + return -EINVAL; +@@ -804,7 +808,6 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) + writel(host->size, base + MMCIDATALENGTH); + + blksz_bits = ffs(data->blksz) - 1; +- BUG_ON(1 << blksz_bits != data->blksz); + + if (variant->blksz_datactrl16) + datactrl = MCI_DPSM_ENABLE | (data->blksz << 16);