From b37ce13469d1034734eda12c3cde36598655c7db Mon Sep 17 00:00:00 2001 From: knuxify Date: Sat, 30 Sep 2023 20:43:58 +0200 Subject: [PATCH] samsung-lt01: mainlined device package for Samsung Galaxy Tab 3 8.0 (MR 4435) This new package covers all three variants of the tablet: the WiFi version (SM-T310), the 3G version (SM-T311) and the LTE version (SM-T315). It uses the linux-postmarketos-exynos4 kernel, like other mainlined Exynos 4 devices. --- device/testing/device-samsung-lt01/APKBUILD | 78 ++++++ device/testing/device-samsung-lt01/deviceinfo | 41 +++ .../testing/device-samsung-lt01/ucm/HiFi.conf | 258 ++++++++++++++++++ .../testing/device-samsung-lt01/ucm/TAB3.conf | 6 + 4 files changed, 383 insertions(+) create mode 100644 device/testing/device-samsung-lt01/APKBUILD create mode 100644 device/testing/device-samsung-lt01/deviceinfo create mode 100644 device/testing/device-samsung-lt01/ucm/HiFi.conf create mode 100644 device/testing/device-samsung-lt01/ucm/TAB3.conf diff --git a/device/testing/device-samsung-lt01/APKBUILD b/device/testing/device-samsung-lt01/APKBUILD new file mode 100644 index 000000000..a24050696 --- /dev/null +++ b/device/testing/device-samsung-lt01/APKBUILD @@ -0,0 +1,78 @@ +# Reference: +# Maintainer: knuxify +pkgname=device-samsung-lt01 +pkgdesc="Samsung Galaxy Tab 3 8.0" +pkgver=1 +pkgrel=0 +url="https://postmarketos.org" +license="MIT" +arch="armv7" +options="!check !archcheck" +depends=" + alsa-ucm-conf + mkbootimg + postmarketos-base + postmarketos-update-kernel + " +makedepends="devicepkg-dev" +subpackages=" + $pkgname-nonfree-firmware:nonfree_firmware + $pkgname-kernel-wifi:kernel_wifi + $pkgname-kernel-3g:kernel_3g + $pkgname-kernel-lte:kernel_lte +" +source=" + deviceinfo + ucm/TAB3.conf + ucm/HiFi.conf + " + +build() { + devicepkg_build $startdir $pkgname +} + +package() { + devicepkg_package $startdir $pkgname + + _tab3_audio_dir="$pkgdir/usr/share/alsa/ucm2/conf.d/TAB3" + + # Alsa UCM configs + install -Dm644 "$srcdir"/TAB3.conf \ + -t "$_tab3_audio_dir" + install -Dm644 "$srcdir"/HiFi.conf \ + -t "$_tab3_audio_dir" +} + +nonfree_firmware() { + pkgdesc="WiFi, Bluetooth, MFC firmware" + depends=" + firmware-samsung-midas-bluetooth + firmware-samsung-midas-wifi + linux-firmware-s5p-mfc + " + mkdir "$subpkgdir" +} + +kernel_wifi() { + pkgdesc="WiFi variant (SM-T310)" + depends="linux-postmarketos-exynos4" + devicepkg_subpackage_kernel "$startdir" "$pkgname" "$subpkgname" +} + +kernel_3g() { + pkgdesc="3G variant (SM-T311)" + depends="linux-postmarketos-exynos4" + devicepkg_subpackage_kernel "$startdir" "$pkgname" "$subpkgname" +} + +kernel_lte() { + pkgdesc="LTE variant (SM-T315)" + depends="linux-postmarketos-exynos4" + devicepkg_subpackage_kernel "$startdir" "$pkgname" "$subpkgname" +} + +sha512sums=" +0a1ff386ed7288858e10bb42ac5b63bccbe8e82503bfabfdfb42dbc39e2b80529e1f85ba92b0dd7dd5ff0f550792521d9aad2f5dc2309a711759be5fe94b2d98 deviceinfo +caa81e8ab6753c0ca24c22fb6742288765dfbf2469b8b8c35c5789edfcee546ef1c3b14ad6e540c417f434258399300f17d312b58157635eafab134587ef94cc TAB3.conf +d08c35377c66681ac3b562888301cff8516024581180aa7d7cf6cfe89ed2d2d6b715f2a1164445678041d160775e945f99bf0605ffc12b6ee8d84c50ef57df9b HiFi.conf +" diff --git a/device/testing/device-samsung-lt01/deviceinfo b/device/testing/device-samsung-lt01/deviceinfo new file mode 100644 index 000000000..4d7856ddd --- /dev/null +++ b/device/testing/device-samsung-lt01/deviceinfo @@ -0,0 +1,41 @@ +# Reference: +# Please use double quotes only. You can source this file in shell scripts. + +deviceinfo_format_version="0" +deviceinfo_name="Samsung Galaxy Tab 3 8.0" +deviceinfo_manufacturer="Samsung" +deviceinfo_codename="samsung-lt01" +deviceinfo_year="2013" +deviceinfo_append_dtb="true" +deviceinfo_dtb_3g="exynos4212-tab3-3g8" +deviceinfo_dtb_lte="exynos4212-tab3-lte8" +deviceinfo_dtb_wifi="exynos4212-tab3-wifi8" +deviceinfo_getty="ttySAC2;115200" +deviceinfo_arch="armv7" +deviceinfo_flash_kernel_on_update="true" + +# Bootloader related +deviceinfo_gpu_accelerated="true" +deviceinfo_chassis="tablet" +deviceinfo_keyboard="false" +deviceinfo_external_storage="true" +deviceinfo_screen_width="800" +deviceinfo_screen_height="1280" + +# Bootloader related +deviceinfo_flash_method="heimdall-bootimg" +deviceinfo_generate_bootimg="true" +deviceinfo_bootimg_qcdt="false" +deviceinfo_bootimg_mtk_mkimage="false" +deviceinfo_bootimg_dtb_second="false" +deviceinfo_flash_offset_base="0x10000000" +deviceinfo_flash_offset_kernel="0x00008000" +deviceinfo_flash_offset_ramdisk="0x01000000" +deviceinfo_flash_offset_second="0x00f00000" +deviceinfo_flash_offset_tags="0x00000100" +deviceinfo_flash_pagesize="2048" + +# Heimdall related +deviceinfo_flash_heimdall_partition_kernel="BOOT" +deviceinfo_flash_heimdall_partition_system="SYSTEM" +deviceinfo_flash_sparse="true" diff --git a/device/testing/device-samsung-lt01/ucm/HiFi.conf b/device/testing/device-samsung-lt01/ucm/HiFi.conf new file mode 100644 index 000000000..72079a2f7 --- /dev/null +++ b/device/testing/device-samsung-lt01/ucm/HiFi.conf @@ -0,0 +1,258 @@ +SectionVerb { + + EnableSequence [ + + cdev "hw:TAB3" + + # do not change the adc & dac source of AIF2 + cset "name='AIF2DACL Source' 0" + cset "name='AIF2DACR Source' 0" + cset "name='AIF2ADCL Source' 0" + cset "name='AIF2ADCR Source' 1" + + # AIF1->DAC1 + cset "name='DAC1 Switch' 1" + + # general + cset "name='IN1L ZC Switch' 0" + cset "name='IN1R ZC Switch' 0" + cset "name='IN2L ZC Switch' 0" + cset "name='IN2R ZC Switch' 0" + cset "name='Output ZC Switch' 0" + cset "name='Speaker ZC Switch' 0" + cset "name='Headphone ZC Switch' 0" + + # AIF1->DAC1 + cset "name='DAC1L Mixer AIF1.1 Switch' 1" + cset "name='DAC1R Mixer AIF1.1 Switch' 1" + cset "name='DAC1 Switch' 1" + + # ADC->AIF2 + cset "name='AIF2DAC2L Mixer Left Sidetone Switch' 1" + cset "name='AIF2DAC2L Mixer Right Sidetone Switch' 0" + cset "name='AIF2DAC2R Mixer Left Sidetone Switch' 0" + cset "name='AIF2DAC2R Mixer Right Sidetone Switch' 1" + cset "name='DAC2 Left Sidetone Volume' 12" + cset "name='DAC2 Right Sidetone Volume' 12" + cset "name='DAC2 Switch' 1" + + # DAC1->HP + cset "name='Left Headphone Mux' DAC" + cset "name='Right Headphone Mux' DAC" + + # DAC1->SPKL/R->SPKL/R Boost->SPK + cset "name='SPKL DAC1 Switch' 1" + cset "name='SPKR DAC1 Switch' 1" + cset "name='SPKL Boost SPKL Switch' 1" + cset "name='SPKL Boost SPKR Switch' 0" + cset "name='SPKR Boost SPKL Switch' 0" + cset "name='SPKR Boost SPKR Switch' 1" + cset "name='Speaker Mixer Volume' 3" + + # DAC->Output mixer->Earpiece + cset "name='Left Output Mixer DAC Switch' 1" + cset "name='Right Output Mixer DAC Switch' 1" + cset "name='Earpiece Mixer Left Output Switch' 1" + cset "name='Earpiece Mixer Right Output Switch' 1" + cset "name='Earpiece Switch' 0" + + # LINEOUT + cset "name='LINEOUT2N Mixer Left Output Switch' 1" + cset "name='LINEOUT2P Mixer Right Output Switch' 1" + cset "name='LINEOUT1N Mixer Right Output Switch' 1" + cset "name='LINEOUT1P Mixer Left Output Switch' 1" + + # Input mixer->ADC->AIF1.1 + cset "name='AIF1ADC1L Mixer ADC/DMIC Switch' 1" + cset "name='AIF1ADC1R Mixer ADC/DMIC Switch' 1" + + # Main Mic->IN2LP/N->Input Mixer with +30dB at mixer + cset "name='IN2L PGA IN2LP Switch' 1" + cset "name='IN2L PGA IN2LN Switch' 1" + cset "name='MIXINL IN2L Volume' 1" + cset "name='IN2L Switch' 1" + + # Sub Mic->IN1RP/N->Input Mixer with +30dB at mixer + cset "name='IN1R PGA IN1RP Switch' 1" + cset "name='IN1R PGA IN1RN Switch' 1" + cset "name='MIXINR IN1R Volume' 1" + cset "name='IN1R Switch' 1" + + # Headset Mic->IN1LP/N->Input Mixer with +30dB at mixer + cset "name='IN1L PGA IN1LP Switch' 1" + cset "name='IN1L PGA IN1LN Switch' 1" + cset "name='MIXINL IN1L Volume' 1" + cset "name='IN1L Switch' 1" + + # Unused->IN2RP/N->Input Mixer with +30dB at mixer + cset "name='IN2R PGA IN2RP Switch' 0" + cset "name='IN2R PGA IN2RN Switch' 0" + cset "name='MIXINR IN2R Volume' 1" + cset "name='IN2R Switch' 1" + + # Input mixer->ADC->AIF1 + cset "name='AIF1ADC1L Mixer ADC/DMIC Switch' 1" + cset "name='AIF1ADC1R Mixer ADC/DMIC Switch' 1" + cset "name='ADCL Mux' ADC" + + # HPF on to take out some bounce + cset "name='Sidetone HPF Switch' 0" + + # Work around core issue + cset "name='ADCL Mux' DMIC" + cset "name='ADCL Mux' ADC" + cset "name='ADCR Mux' DMIC" + cset "name='ADCR Mux' ADC" + + # AIF2DACDAT to AIF3ADC mux + cset "name='AIF3ADC Mux' 2" + + # Default all outputs off + cset "name='HP Switch' 0" + cset "name='SPK Switch' 0" + cset "name='RCV Switch' 0" + cset "name='LINE Switch' 0" + cset "name='HDMI Switch' 0" + + # Default all inputs off + cset "name='Main Mic Switch' 0" + cset "name='Sub Mic Switch' 0" + cset "name='Headset Mic Switch' 0" + cset "name='FM In Switch' 0" + + # EQ Switches + cset "name='AIF1DAC1 EQ Switch' 1" + cset "name='AIF1DAC1 EQ1 Volume' 9" + cset "name='AIF1DAC1 EQ2 Volume' 7" + cset "name='AIF1DAC1 EQ3 Volume' 10" + cset "name='AIF1DAC1 EQ4 Volume' 13" + cset "name='AIF1DAC1 EQ5 Volume' 12" + + cset "name='Headphone Volume' 50" + cset "name='AIF1DAC1 Volume' 96" + cset "name='AIF1 Boost Volume' 0" + cset "name='DAC1 Volume' 96" + cset "name='Left Output Mixer DAC Volume' 7" + cset "name='Right Output Mixer DAC Volume' 7" + ] + + DisableSequence [ + ] +} + +SectionDevice."Speaker" { + + Comment "Built-in speaker" + + EnableSequence [ + cset "name='HP Switch' 0" + cset "name='SPK Switch' 1" + cset "name='AIF1DAC1 Volume' 96" + cset "name='AIF1 Boost Volume' 0" + cset "name='DAC1 Volume' 96" + cset "name='Left Output Mixer DAC Volume' 7" + cset "name='Right Output Mixer DAC Volume' 7" + cset "name='SPKL DAC1 Volume' 1" + cset "name='SPKR DAC1 Volume' 1" + cset "name='Speaker Mixer Volume' 3" + cset "name='Speaker Boost Volume' 5" + cset "name='Speaker Volume' 57" + ] + + DisableSequence [ + cset "name='SPK Switch' 0" + cset "name='Speaker Mixer Volume' 1" + cset "name='Speaker Volume' 0" + ] + + Value { + PlaybackVolume "Speaker Volume" + PlaybackSwitch "SPK Switch" + PlaybackChannels 2 + PlaybackPCM "hw:${CardId}" + } +} + +SectionDevice."Headphones" { + Comment "Headphone jack" + + EnableSequence [ + cset "name='HP Switch' 1" + cset "name='SPK Switch' 0" + cset "name='Speaker Mixer Volume' 0" + cset "name='Headphone Volume' 57" + cset "name='Headphone Switch' 1" + ] + + DisableSequence [ + cset "name='HP Switch' 0" + cset "name='Headphone Volume' 0" + cset "name='Headphone Switch' 0" + ] + + Value { + PlaybackVolume "Headphone Volume" + PlaybackSwitch "HP Switch" + PlaybackChannels 2 + PlaybackPCM "hw:${CardId}" + } +} + +SectionDevice."Mic1" { + Comment "Internal Microphone" + + EnableSequence [ + cset "name='Sub Mic Switch' 1" + cset "name='IN1R Volume' 22" + cset "name='MIXINR IN1R Switch' 1" + cset "name='MIXINR IN1R Volume' 1" + cset "name='AIF1ADC1 HPF Mode' 1" + cset "name='AIF1ADC1 HPF Switch' 1" + cset "name='AIF1ADC1 Volume' 96" + cset "name='AIF1ADCR Source' 1" + ] + + DisableSequence [ + cset "name='Sub Mic Switch' 0" + cset "name='MIXINR IN1R Switch' 0" + cset "name='IN1R Volume' 10" + ] + + Value { + CapturePCM "hw:${CardId}" + CaptureChannels 2 + CaptureVolume "IN1R Volume" + } +} + +SectionDevice."Headset" { + Comment "Headset Input" + + EnableSequence [ + cset "name='Headset Mic Switch' 1" + cset "name='IN1L Volume' 22" + cset "name='MIXINL IN1L Switch' 1" + cset "name='MIXINL IN1L Volume' 1" + cset "name='AIF1ADC1 HPF Mode' 1" + cset "name='AIF1ADC1 HPF Switch' 1" + cset "name='AIF1ADC1 Volume' 96" + cset "name='AIF1ADCR Source' 0" + ] + + DisableSequence [ + cset "name='Headset Mic Switch' 0" + cset "name='IN1L Volume' 10" + cset "name='MIXINL IN1L Switch' 0" + cset "name='MIXINL IN1L Volume' 0" + cset "name='AIF1ADC1 HPF Mode' 0" + cset "name='AIF1ADC1 HPF Switch' 0" + cset "name='AIF1ADC1 Volume' 96" + cset "name='AIF1DAC1 3D Stereo Switch' 0" + ] + + Value { + CapturePCM "hw:${CardId}" + CaptureChannels 2 + CaptureVolume "IN1L Volume" + } +} diff --git a/device/testing/device-samsung-lt01/ucm/TAB3.conf b/device/testing/device-samsung-lt01/ucm/TAB3.conf new file mode 100644 index 000000000..54e0106f8 --- /dev/null +++ b/device/testing/device-samsung-lt01/ucm/TAB3.conf @@ -0,0 +1,6 @@ +Syntax 2 + +SectionUseCase."HiFi" { + File "HiFi.conf" + Comment "Play high quality music" +}