samsung-xcover3lte: new device (MR 3139)

[ci:skip-build] already built successfully in CI
This commit is contained in:
blacksilver 2022-06-01 17:20:06 +02:00 committed by Clayton Craft
parent f8e60aa5b3
commit 757e0aeb83
No known key found for this signature in database
GPG key ID: 4A4CED6D7EDF950A
18 changed files with 5187 additions and 0 deletions

View file

@ -0,0 +1,43 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-samsung-xcover3lte
pkgdesc="Samsung Galaxy Xcover 3"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base linux-samsung-xcover3lte mesa-dri-gallium mkbootimg u-boot-tools pxa-mkbootimg alsa-ucm-conf"
makedepends="devicepkg-dev"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
source="
deviceinfo
initfs-hook.sh
ucm/HiFi.conf
ucm/map_asoc.conf
"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
install -Dm644 -t "$pkgdir"/usr/share/alsa/ucm2/conf.d/map_asoc \
"$srcdir"/HiFi.conf \
"$srcdir"/map_asoc.conf
}
nonfree_firmware() {
pkgdesc="Non-free firmware for Wi-Fi on the Samsung Galaxy Xcover 3"
depends="firmware-samsung-xcover3lte"
mkdir "$subpkgdir"
}
sha512sums="
afa796fb638fc049a2fe849d9f32434853ef15c763c9043890cab05f9a492637238e47bc4f5d36c8c0949e1f91baea63d01deb462555c92885ba4f712d98072f deviceinfo
0961c07638cf86c3e03c82c7b885cccd74700f0e3670508232b7aea09aa02e65bfa150a5ae95d4917ccf207c4cb5df021d1172452cdd1f82fafc59de0eac7355 initfs-hook.sh
f8863a569454bdefb2e3813add3ee394b0684f34ac85f629d334e391988937f2b92277cb51abcfb43f36c53837103b63f65ef6ea158962bdde02ff285153991c HiFi.conf
2b5927d455dc84eaf2b2b3da27b87a71cc1e3f31cb03c3114f53578d5fcec05cd26a3340801e67b57a7276c5d07a555a38d266d965a273673ec413f5e6f93a0c map_asoc.conf
"

View file

@ -0,0 +1,36 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell
# scripts.
deviceinfo_format_version="0"
deviceinfo_name="Samsung Galaxy Xcover 3"
deviceinfo_manufacturer="Samsung"
deviceinfo_codename="samsung-xcover3lte"
deviceinfo_year="2015"
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="handset"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="480"
deviceinfo_screen_height="800"
# Bootloader related
deviceinfo_flash_method="heimdall-bootimg"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="true"
deviceinfo_bootimg_mtk_mkimage="false"
deviceinfo_bootimg_dtb_second="false"
deviceinfo_bootimg_pxa="true"
deviceinfo_bootimg_override_payload="uImage"
deviceinfo_bootimg_append_seandroidenforce="true"
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"
deviceinfo_flash_sparse="true"
deviceinfo_generate_legacy_uboot_initfs="true"
deviceinfo_legacy_uboot_load_address="01000000"

View file

@ -0,0 +1,2 @@
# Avoid automatic reboot
echo 0 > /proc/sys/kernel/hung_task_timeout_secs

View file

@ -0,0 +1,641 @@
SectionVerb {
EnableSequence [
# default values
cset "name='d1ain2_mix_enable Switch' off"
cset "name='DAC2 txrx mux' inmix"
cset "name='DAC2 in mux' 'in mix'"
cset "name='d2in4_mix_enable Switch' off"
cset "name='d2in3_mix_enable Switch' off"
cset "name='d2in2_mix_enable Switch' off"
cset "name='d2in1_mix_enable Switch' off"
cset "name='dsp2_enable Switch' off"
cset "name='DAC1 txrx mux' inmix"
cset "name='DAC1 in mux' 'in mix'"
cset "name='d1in1_mix_enable Switch' off"
cset "name='ADC output ain4' D1AOUT"
cset "name='ADC output ain3' D1AOUT"
cset "name='ADC output ain2' D1AOUT"
cset "name='ADC output ain1' D1AOUT"
cset "name='ADC input d1ain2' MIC2"
cset "name='ADC input d1ain1' MIC1"
cset "name='DAC input d2in4' AOUT4"
cset "name='DAC input d2in3' AOUT3"
cset "name='DAC input d2in2' AOUT2"
cset "name='DAC input d2in1' AOUT1"
cset "name='DAC input d1in4' AOUT4"
cset "name='DAC input d1in3' AOUT3"
cset "name='DAC input d1in2' AOUT2"
cset "name='DAC input d1in1' AOUT1"
cset "name='i2s3_bt_vc Switch' off"
cset "name='i2s3_func_sel' i2s3_fm"
cset "name='MAP_REVISION' 0x10,0x00,0x00,0x00"
cset "name='MAP_I2S1_CTRL_REG' 0x00,0x00,0x20,0x00"
cset "name='MAP_DEI2S_CTRL_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_STATUS_REG_1' 0x00,0x00,0x00,0x00"
cset "name='MAP_STATUS_REG_2' 0x00,0x00,0x00,0x00"
cset "name='MAP_DATAPATH_FLOW_CTRL_REG_2' 0x00,0x00,0x00,0x00"
cset "name='MAP_ASRC_CTRL_REG' 0xfc,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_3' 0x00,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_4' 0x00,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_10' 0x00,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_11' 0x00,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_12' 0x00,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_13' 0x00,0x00,0x00,0x00"
cset "name='MAP_I2S1_BCLK_DIV' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_ANC_PARAM_U_REG' 0x00,0x04,0x00,0x00"
cset "name='MAP_DSP1_ANC_PARAM_LAMBA_REG' 0x80,0x00,0x00,0x00"
cset "name='MAP_DSP1_ANC_PARAM_BETA_REG' 0x00,0x3f,0x00,0x00"
cset "name='MAP_DSP1_ANC_PARAM_ERRTH_REG' 0x21,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND1_GAIN' 0x0c,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND1_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND2_GAIN' 0x0c,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND2_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND2_BANDWIDTH' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND3_GAIN' 0x0c,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND3_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND3_BANDWIDTH' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND4_GAIN' 0x0c,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND4_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND4_BANDWIDTH' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND5_GAIN' 0x0c,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND5_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND5_BANDWIDTH' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND6_GAIN' 0x0c,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND6_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND6_BANDWIDTH' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND7_GAIN' 0x0c,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND7_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND7_BANDWIDTH' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND8_GAIN' 0x0c,0x00,0x00,0x00"
cset "name='MAP_DSP1_EQ_BAND8_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_DAC_DRC_THRESHOLD' 0x07,0xf8,0x00,0x00"
cset "name='MAP_DSP1_DAC_DRC_OFFSET' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_DAC_DRC_COMPRESSION_RATIO' 0x10,0x00,0x00,0x00"
cset "name='MAP_DSP1_DAC_DRC_ENERGY_ALPHA_REG' 0x54,0x01,0x00,0x00"
cset "name='MAP_DSP1_DAC_DRC_ATTACK_ALPHA_REG' 0xa4,0x02,0x00,0x00"
cset "name='MAP_DSP1_DAC_DRC_DECAY_ALPHA_REG' 0x88,0x00,0x00,0x00"
cset "name='MAP_DSP1_DAC_OUTPUT_MIX' 0x40,0x40,0x40,0x40"
cset "name='MAP_DSP1_TXRX_MIX_COEF_REG' 0x40,0x40,0x00,0x00"
cset "name='MAP_DSP1_3D_REG1' 0x00,0x0a,0x00,0x00"
cset "name='MAP_DSP1_3D_REG2' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_DUMMY_1' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_DUMMY_2' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_DUMMY_3' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_DUMMY_4' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_DUMMY_5' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_DSM_SCALING_REG' 0x80,0x00,0x00,0x00"
cset "name='MAP_DSP2_DAC_PROCESSING_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DAC_CTRL_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DAC_VOLUME' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_ANC_PARAM_U_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_ANC_PARAM_LAMBA_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_ANC_PARAM_BETA_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_ANC_PARAM_ERRTH_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND1_GAIN' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND1_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND2_GAIN' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND2_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND2_BANDWIDTH' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND3_GAIN' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND3_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND3_BANDWIDTH' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND4_GAIN' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND4_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND4_BANDWIDTH' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND5_GAIN' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND5_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND5_BANDWIDTH' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND6_GAIN' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND6_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND6_BANDWIDTH' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND7_GAIN' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND7_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND7_BANDWIDTH' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND8_GAIN' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_EQ_BAND8_CENTER_FREQ' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DAC_DRC_THRESHOLD' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DAC_DRC_OFFSET' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DAC_DRC_COMPRESSION_RATIO' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DAC_DRC_ENERGY_ALPHA_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DAC_DRC_ATTACK_ALPHA_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DAC_DRC_DECAY_ALPHA_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DAC_OUTPUT_MIX' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_TXRX_MIX_COEF_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_INMIX_COEF_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DUMMY_1' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DUMMY_2' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DUMMY_3' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DUMMY_4' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DUMMY_5' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_DSM_SCALING_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_ADC_ALC_UPPER_THRESHOLD' 0x07,0xf8,0x00,0x00"
cset "name='MAP_ADC_ALC_LOWER_THRESHOLD' 0x0b,0xf4,0x00,0x00"
cset "name='MAP_ADC_ALC_OFFSET' 0x00,0x00,0x00,0x00"
cset "name='MAP_ADC_ALC_COMPRESSION_RATIO' 0x10,0x00,0x00,0x00"
cset "name='MAP_ADC_ALC_ENERGY_ALPHA_REG' 0x54,0x01,0x00,0x00"
cset "name='MAP_ADC_ALC_ATTACK_ALPHA_REG' 0xa4,0x02,0x00,0x00"
cset "name='MAP_ADC_ALC_DECAY_ALPHA_REG' 0x88,0x00,0x00,0x00"
cset "name='MAP_ADC_NOISE_GATE_THRESHOD' 0x46,0xb0,0x00,0x00"
cset "name='MAP_ADC_OUTPUT_MIX' 0x40,0x40,0x40,0x40"
cset "name='MAP_AEC_PARAM_U_REG' 0x00,0x04,0x00,0x00"
cset "name='MAP_AEC_PARAM_LAMBA_REG' 0x80,0x00,0x00,0x00"
cset "name='MAP_AEC_PARAM_BETA_REG' 0x00,0x3f,0x00,0x00"
cset "name='MAP_AEC_PARAM_ERR_TH_REG' 0x21,0x00,0x00,0x00"
cset "name='MAP_SSL_PARAM_MU' 0x7f,0x04,0x00,0x00"
cset "name='MAP_BF_PARAM_REG1' 0x00,0x08,0x2a,0x00"
cset "name='MAP_BF_PARAM_REG2' 0x00,0x14,0x7e,0x20"
cset "name='MAP_DSP1A_DUMMY_1' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1A_DUMMY_2' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1A_DUMMY_3' 0x00,0x00,0x00,0x00"
cset "name='MAP_DIG_TEST_MUX_CTRL_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_LOOPBACK_MODES' 0x00,0x00,0x00,0x00"
cset "name='MAP_DELAY_BUF_CTRL' 0x00,0x00,0x00,0x00"
cset "name='MAP_DAC_ANA_MISC' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_FW_REG' 0x03,0x01,0x11,0x01"
cset "name='MAP_DSP2_FW_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1A_FW_REG' 0x05,0x01,0x13,0x01"
cset "name='MAP_BT_WORK_MODE' 0x00,0x00,0x00,0x00"
cset "name='PM860_REVISION_CTRL' 16"
cset "name='PM860_LOAD_GROUND_DET1' 64"
cset "name='PM860_PDM_CONTROL1' 51"
cset "name='PM860_TDM_SETTING6' 160"
cset "name='PM860_TDM_SETTING15' 16"
cset "name='PM860_TDM_FIFO_SIZE' 180"
cset "name='PM860_TDM_PLL_DIV' 35"
cset "name='PM860_VOLUME_CHANNEL' 82"
cset "name='PM860_AUTOMUTE_PARAM' 80"
cset "name='PM860_DRE_REG4' 30"
cset "name='PM860_ANALOG_BLOCK_SETTING' 22"
cset "name='PM860_CHARGE_PUMP_REG2' 19"
cset "name='PM860_CHARGE_PUMP_REG3' 13"
cset "name='PM860_SPECTRUM_SETTINGS2' 113"
cset "name='PM860_SPECTRUM_SETTINGS3' 18"
cset "name='PM860_AUTO_SEQUENCER_1' 84"
cset "name='PM860_DWA_SETTINGS' 17"
cset "name='PM860_AUTOMUTE_SETTING' 34"
cset "name='PM860_ADC_SETTING1' 10"
cset "name='PM860_SPARE_BITS' 57"
cset "name='PM860_HP_GAIN' 255"
# Left
cset "name='PM860_VOL_SEL_1' 0"
# Right
cset "name='PM860_VOL_SEL_2' 0"
# Back
cset "name='PM860_VOL_SEL_3' 128"
# Front
cset "name='PM860_VOL_SEL_4' 0"
]
DisableSequence [
]
Value {
PlaybackPCM "hw:${CardId},0"
CapturePCM "hw:${CardId},0"
}
}
SectionDevice."Speaker" {
ConflictingDevice [
"Headphones"
]
EnableSequence [
cset "name='ADC in mux' 'adc in mix'"
cset "name='DAC1 output out1' 'D1OUT'"
cset "name='DAC2 output out2' 'Reserved'"
cset "name='MAP_ADC_CTRL_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_ADC_PROCESSING_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_ADC_VOLUME' 0x01,0x00,0x00,0x00"
cset "name='MAP_DATAPATH_FLOW_CTRL_REG_1' 0x00,0x00,0x07,0x00"
cset "name='MAP_DATAPATH_FLOW_CTRL_REG_3' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_DAC_CTRL_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_DAC_PROCESSING_REG' 0x10,0x11,0x00,0x00"
cset "name='MAP_DSP1_DAC_VOLUME' 0x01,0xff,0xff,0x00"
cset "name='MAP_DSP1_INMIX_COEF_REG' 0x00,0x00,0x00,0x80"
cset "name='MAP_I2S2_BCLK_DIV' 0x00,0x00,0x00,0x00"
cset "name='MAP_I2S2_CTRL_REG' 0x00,0x21,0x00,0x00"
cset "name='MAP_I2S3_BCLK_DIV' 0x00,0x00,0x00,0x00"
cset "name='MAP_I2S3_CTRL_REG' 0x00,0x21,0x00,0x00"
cset "name='MAP_I2S4_BCLK_DIV' 0x30,0x00,0x01,0x10"
cset "name='MAP_I2S4_CTRL_REG' 0x01,0x01,0x00,0x00"
cset "name='MAP_I2S_OUT_BCLK_DIV' 0x30,0x00,0x01,0x10"
cset "name='MAP_INPUT_MIX_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_INTERRUPT_CTRL_REG' 0x00,0x00,0x01,0x00"
cset "name='MAP_LRCLK_RATE_REG' 0x88,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_1' 0x20,0x01,0x1a,0x00"
cset "name='MAP_TDM_CTRL_REG_2' 0x21,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_5' 0x00,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_6' 0x50,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_7' 0x00,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_8' 0xfc,0x0b,0x50,0x00"
cset "name='MAP_TDM_CTRL_REG_9' 0x48,0x00,0x00,0x00"
cset "name='MAP_TOP_CTRL_REG_1' 0x03,0x00,0x00,0x00"
cset "name='MAP_TOP_CTRL_REG_2' 0x4d,0x00,0x00,0x00"
cset "name='MAP_WNR_FILTER_COEF' 0x70,0x00,0x00,0x00"
cset "name='PM822_CLASS_D_1' 6"
cset "name='PM822_MIS_CLASS_D_1' 202"
cset "name='PM822_MIS_CLASS_D_2' 112"
cset "name='PM860_ADC_BLOCK_EN' 0"
cset "name='PM860_ADC_SETTING2' 56"
cset "name='PM860_ADC_SETTING3' 85"
cset "name='PM860_ADC_SETTING4' 0"
cset "name='PM860_ADC_SETTING5' 8"
cset "name='PM860_ADC_SETTINGS' 0"
cset "name='PM860_ANALOG_BLOCK_EN' 122"
cset "name='PM860_ANALOG_BLOCK_STATUS' 15"
cset "name='PM860_ANALOG_MIC_GAIN1' 13"
cset "name='PM860_ANALOG_MIC_GAIN2' 13"
cset "name='PM860_AUTO_SEQUENCER_2' 4"
cset "name='PM860_CHARGE_PUMP_REG1' 69"
cset "name='PM860_CLIP_BITS_REG1' 0"
cset "name='PM860_CLIP_BITS_REG2' 0"
cset "name='PM860_CLOCK_SETTINGS' 0"
cset "name='PM860_DIG_BLOCK_EN_REG1' 4"
cset "name='PM860_DIG_BLOCK_EN_REG2' 1"
cset "name='PM860_DMIC_SETTINGS' 0"
cset "name='PM860_DRE_REG1' 28"
cset "name='PM860_DRE_REG2' 0"
cset "name='PM860_DRE_REG3' 8"
cset "name='PM860_DWS_SETTINGS1' 0"
cset "name='PM860_DWS_SETTINGS2' 0"
cset "name='PM860_FIFO_NUM_SAMPLE' 180"
cset "name='PM860_FIFO_STATUS' 0"
cset "name='PM860_FLL_STATUS' 0"
cset "name='PM860_HP_EP_SETTING' 128"
cset "name='PM860_HP_SHRT_STATE' 0"
cset "name='PM860_INT_MANAGEMENT' 5"
cset "name='PM860_INT_MASK_REG1' 0"
cset "name='PM860_INT_MASK_REG2' 0"
cset "name='PM860_INT_REG1' 0"
cset "name='PM860_INT_REG2' 1"
cset "name='PM860_LOAD_GROUND_DET2' 0"
cset "name='PM860_LOAD_GROUND_DET3' 0"
cset "name='PM860_LOAD_GROUND_DET4' 0"
cset "name='PM860_LOAD_GROUND_DET5' 0"
cset "name='PM860_LOAD_GROUND_DET6' 0"
cset "name='PM860_LOAD_GROUND_DET7' 0"
cset "name='PM860_MAIN_POWER_REG' 1"
cset "name='PM860_PAD_SETTING1' 12"
cset "name='PM860_PAD_SETTING2' 12"
cset "name='PM860_PDM_CONTROL2' 0"
cset "name='PM860_PDM_CONTROL3' 0"
cset "name='PM860_PDM_SETTINGS1' 209"
cset "name='PM860_PDM_SETTINGS2' 2"
cset "name='PM860_PDM_SETTINGS3' 49"
cset "name='PM860_POWER_AMPLIFIER' 0"
cset "name='PM860_POWER_APMLIFIER' 176"
cset "name='PM860_RECONSTRUCTION_FILTER' 5"
cset "name='PM860_REFGEN_SETTING' 5"
cset "name='PM860_SDM_BLOCK_EN1' 0"
cset "name='PM860_SDM_BLOCK_EN2' 0"
cset "name='PM860_SEQ_STATUS_REG1' 169"
cset "name='PM860_SEQ_STATUS_REG2' 169"
cset "name='PM860_SEQ_STATUS_REG3' 0"
cset "name='PM860_SHORT_PROTECT' 2"
cset "name='PM860_SPECTRUM_SETTINGS1' 68"
cset "name='PM860_TDM_APPLY_CONF' 0"
cset "name='PM860_TDM_CHO_TEST1' 0"
cset "name='PM860_TDM_CHO_TEST2' 0"
cset "name='PM860_TDM_INTERRUPT' 0"
cset "name='PM860_TDM_SETTING1' 0"
cset "name='PM860_TDM_SETTING10' 0"
cset "name='PM860_TDM_SETTING11' 0"
cset "name='PM860_TDM_SETTING12' 0"
cset "name='PM860_TDM_SETTING13' 33"
cset "name='PM860_TDM_SETTING14' 0"
cset "name='PM860_TDM_SETTING16' 5"
cset "name='PM860_TDM_SETTING17' 0"
cset "name='PM860_TDM_SETTING17_1' 0"
cset "name='PM860_TDM_SETTING2' 0"
cset "name='PM860_TDM_SETTING3' 0"
cset "name='PM860_TDM_SETTING5' 2"
cset "name='PM860_TDM_SETTING7' 0"
cset "name='PM860_TDM_SETTING8' 0"
cset "name='PM860_TDM_SETTING9' 0"
cset "name='PM860_TDM_TEST' 0"
cset "name='PM860_VOLUME_OUT_SETTING' 0"
cset "name='d1ain1_mix_enable Switch' off"
cset "name='d1in2_mix_enable Switch' off"
cset "name='d1in3_mix_enable Switch' off"
cset "name='d1in4_mix_enable Switch' on"
cset "name='dsp1_enable Switch' on"
cset "name='dsp1a_enable Switch' off"
cset "name='out1_hs_en Switch' off"
cset "name='out1_spkr_en Switch' on"
cset "name='PM860_VOL_SEL_1' 0"
cset "name='PM860_VOL_SEL_2' 0"
cset "name='PM860_VOL_SEL_3' 128"
cset "name='PM860_VOL_SEL_4' 0"
]
Value {
PlaybackChannels "2"
}
}
SectionDevice."SpeakerReplay" {
ConflictingDevice [
"Headphones"
]
EnableSequence [
# Must be set before each consecutive play for now
cset "name='PM860_MAIN_POWER_REG' 1"
cset "name='PM860_PDM_SETTINGS1' 209"
cset "name='PM860_DIG_BLOCK_EN_REG1' 4"
cset "name='MAP_DSP1_DAC_PROCESSING_REG' 0x10,0x11,0x00,0x00"
cset "name='PM860_PDM_SETTINGS1' 209"
]
}
SectionDevice."HeadphonesReplay" {
ConflictingDevice [
"Speaker"
]
EnableSequence [
# Must be set before each consecutive play for now
cset "name='PM860_MAIN_POWER_REG' 1"
cset "name='PM860_HP_EP_SETTING' 108"
cset "name='PM860_DIG_BLOCK_EN_REG1' 3"
cset "name='PM860_HP_EP_SETTING' 108"
]
}
SectionDevice."Headphones" {
ConflictingDevice [
"Speaker"
]
EnableSequence [
cset "name='ADC in mux' 'adc in mix'"
cset "name='DAC1 output out1' D1OUT"
cset "name='DAC2 output out2' Reserved"
cset "name='MAP_ADC_CTRL_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_ADC_PROCESSING_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_ADC_VOLUME' 0x01,0x00,0x00,0x00"
cset "name='MAP_DAC_ANA_MISC' 0x00,0x00,0x00,0x00"
cset "name='MAP_DATAPATH_FLOW_CTRL_REG_1' 0x00,0x00,0x07,0x00"
cset "name='MAP_DATAPATH_FLOW_CTRL_REG_3' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_DAC_CTRL_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_DAC_PROCESSING_REG' 0x10,0x10,0x00,0x00"
cset "name='MAP_DSP1_DAC_VOLUME' 0x01,0xf4,0xf4,0x00"
cset "name='MAP_DSP1_INMIX_COEF_REG' 0x00,0x00,0x00,0x80"
cset "name='MAP_DSP2_3D_REG1' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_3D_REG2' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_INMIX_COEF_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_TXRX_MIX_COEF_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_I2S2_BCLK_DIV' 0x00,0x00,0x00,0x00"
cset "name='MAP_I2S2_CTRL_REG' 0x00,0x21,0x00,0x00"
cset "name='MAP_I2S3_BCLK_DIV' 0x00,0x00,0x00,0x00"
cset "name='MAP_I2S3_CTRL_REG' 0x00,0x21,0x00,0x00"
cset "name='MAP_I2S4_BCLK_DIV' 0x30,0x00,0x01,0x10"
cset "name='MAP_I2S4_CTRL_REG' 0x01,0x01,0x00,0x00"
cset "name='MAP_I2S_OUT_BCLK_DIV' 0x30,0x00,0x01,0x10"
cset "name='MAP_INPUT_MIX_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_INTERRUPT_CTRL_REG' 0x00,0x00,0x01,0x00"
cset "name='MAP_LRCLK_RATE_REG' 0x88,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_1' 0x20,0x01,0x1a,0x00"
cset "name='MAP_TDM_CTRL_REG_2' 0x21,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_5' 0x00,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_6' 0x05,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_7' 0x00,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_8' 0xfc,0x0b,0x50,0x00"
cset "name='MAP_TDM_CTRL_REG_9' 0x48,0x00,0x00,0x00"
cset "name='MAP_TOP_CTRL_REG_1' 0x03,0x00,0x00,0x00"
cset "name='MAP_TOP_CTRL_REG_2' 0x4d,0x00,0x00,0x00"
cset "name='MAP_WNR_FILTER_COEF' 0x70,0x00,0x00,0x00"
cset "name='PM822_CLASS_D_1' 0"
cset "name='PM822_MIS_CLASS_D_1' 206"
cset "name='PM822_MIS_CLASS_D_2' 48"
cset "name='PM860_ADC_BLOCK_EN' 0"
cset "name='PM860_ADC_SETTING2' 56"
cset "name='PM860_ADC_SETTING3' 85"
cset "name='PM860_ADC_SETTING4' 0"
cset "name='PM860_ADC_SETTING5' 8"
cset "name='PM860_ADC_SETTINGS' 0"
cset "name='PM860_ANALOG_BLOCK_EN' 122"
cset "name='PM860_ANALOG_BLOCK_STATUS' 15"
cset "name='PM860_ANALOG_MIC_GAIN1' 13"
cset "name='PM860_ANALOG_MIC_GAIN2' 13"
cset "name='PM860_AUTO_SEQUENCER_2' 20"
cset "name='PM860_CHARGE_PUMP_REG1' 73"
cset "name='PM860_CLIP_BITS_REG1' 0"
cset "name='PM860_CLIP_BITS_REG2' 0"
cset "name='PM860_CLOCK_SETTINGS' 0"
cset "name='PM860_DIG_BLOCK_EN_REG1' 3"
cset "name='PM860_DIG_BLOCK_EN_REG2' 1"
cset "name='PM860_DMIC_SETTINGS' 0"
cset "name='PM860_DRE_REG1' 28"
cset "name='PM860_DRE_REG2' 0"
cset "name='PM860_DRE_REG3' 8"
cset "name='PM860_DWS_SETTINGS1' 0"
cset "name='PM860_DWS_SETTINGS2' 0"
cset "name='PM860_FIFO_NUM_SAMPLE' 180"
cset "name='PM860_FIFO_STATUS' 0"
cset "name='PM860_FLL_STATUS' 3"
cset "name='PM860_HP_EP_SETTING' 108"
cset "name='PM860_HP_SHRT_STATE' 0"
cset "name='PM860_INT_MANAGEMENT' 5"
cset "name='PM860_INT_MASK_REG1' 0"
cset "name='PM860_INT_MASK_REG2' 0"
cset "name='PM860_INT_REG1' 136"
cset "name='PM860_INT_REG2' 1"
cset "name='PM860_LOAD_GROUND_DET2' 0"
cset "name='PM860_LOAD_GROUND_DET3' 0"
cset "name='PM860_LOAD_GROUND_DET4' 0"
cset "name='PM860_LOAD_GROUND_DET5' 0"
cset "name='PM860_LOAD_GROUND_DET6' 0"
cset "name='PM860_LOAD_GROUND_DET7' 0"
cset "name='PM860_MAIN_POWER_REG' 1"
cset "name='PM860_PAD_SETTING1' 12"
cset "name='PM860_PAD_SETTING2' 12"
cset "name='PM860_PDM_CONTROL2' 0"
cset "name='PM860_PDM_CONTROL3' 0"
cset "name='PM860_PDM_SETTINGS1' 18"
cset "name='PM860_PDM_SETTINGS2' 112"
cset "name='PM860_PDM_SETTINGS3' 0"
cset "name='PM860_POWER_AMPLIFIER' 0"
cset "name='PM860_POWER_APMLIFIER' 207"
cset "name='PM860_RECONSTRUCTION_FILTER' 5"
cset "name='PM860_REFGEN_SETTING' 5"
cset "name='PM860_SDM_BLOCK_EN1' 0"
cset "name='PM860_SDM_BLOCK_EN2' 243"
cset "name='PM860_SEQ_STATUS_REG1' 85"
cset "name='PM860_SEQ_STATUS_REG2' 107"
cset "name='PM860_SEQ_STATUS_REG3' 3"
cset "name='PM860_SHORT_PROTECT' 2"
cset "name='PM860_SPECTRUM_SETTINGS1' 71"
cset "name='PM860_TDM_APPLY_CONF' 0"
cset "name='PM860_TDM_CHO_TEST1' 0"
cset "name='PM860_TDM_CHO_TEST2' 0"
cset "name='PM860_TDM_INTERRUPT' 0"
cset "name='PM860_TDM_SETTING1' 0"
cset "name='PM860_TDM_SETTING10' 0"
cset "name='PM860_TDM_SETTING11' 0"
cset "name='PM860_TDM_SETTING12' 0"
cset "name='PM860_TDM_SETTING13' 33"
cset "name='PM860_TDM_SETTING14' 33"
cset "name='PM860_TDM_SETTING16' 5"
cset "name='PM860_TDM_SETTING17' 0"
cset "name='PM860_TDM_SETTING17_1' 0"
cset "name='PM860_TDM_SETTING2' 0"
cset "name='PM860_TDM_SETTING3' 0"
cset "name='PM860_TDM_SETTING5' 2"
cset "name='PM860_TDM_SETTING7' 0"
cset "name='PM860_TDM_SETTING8' 0"
cset "name='PM860_TDM_SETTING9' 0"
cset "name='PM860_TDM_TEST' 0"
cset "name='PM860_VOLUME_OUT_SETTING' 0"
cset "name='d1ain1_mix_enable Switch' off"
cset "name='d1in3_mix_enable Switch' off"
cset "name='d1in4_mix_enable Switch' on"
cset "name='dsp1_enable Switch' on"
cset "name='dsp1a_enable Switch' off"
cset "name='out1_hs_en Switch' on"
cset "name='out1_spkr_en Switch' off"
cset "name='PM860_VOL_SEL_1' 128"
cset "name='PM860_VOL_SEL_2' 128"
cset "name='PM860_VOL_SEL_3' 0"
cset "name='PM860_VOL_SEL_4' 0"
]
Value {
PlaybackChannels "2"
}
}
SectionDevice."FMSpeaker" {
ConflictingDevice [
"Headphones"
]
EnableSequence [
cset "name='d1ain1_mix_enable Switch' off"
cset "name='d1in4_mix_enable Switch' off"
cset "name='d1in3_mix_enable Switch' on"
cset "name='d1in2_mix_enable Switch' off"
cset "name='dsp1_enable Switch' on"
cset "name='ADC in mux' 'adc in mix'"
cset "name='dsp1a_enable Switch' off"
cset "name='DAC2 output out2' Reserved"
cset "name='DAC1 output out1' D1OUT"
cset "name='out1_spkr_en Switch' on"
cset "name='out1_hs_en Switch' off"
cset "name='MAP_LRCLK_RATE_REG' 0x88,0x08,0x00,0x00"
cset "name='MAP_I2S2_CTRL_REG' 0x00,0x21,0x00,0x00"
cset "name='MAP_I2S3_CTRL_REG' 0x01,0x01,0x00,0x00"
cset "name='MAP_I2S4_CTRL_REG' 0x00,0x01,0x00,0x00"
cset "name='MAP_TOP_CTRL_REG_1' 0x03,0x00,0x00,0x00"
cset "name='MAP_TOP_CTRL_REG_2' 0x4d,0x00,0x00,0x00"
cset "name='MAP_DATAPATH_FLOW_CTRL_REG_1' 0x00,0x00,0x07,0x00"
cset "name='MAP_DATAPATH_FLOW_CTRL_REG_3' 0x00,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_1' 0x20,0x01,0x1a,0x00"
cset "name='MAP_TDM_CTRL_REG_2' 0x21,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_5' 0x00,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_6' 0x50,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_7' 0x00,0x00,0x00,0x00"
cset "name='MAP_TDM_CTRL_REG_8' 0xfc,0x0b,0x50,0x00"
cset "name='MAP_TDM_CTRL_REG_9' 0x48,0x00,0x00,0x00"
cset "name='MAP_INTERRUPT_CTRL_REG' 0x00,0x00,0x01,0x00"
cset "name='MAP_I2S2_BCLK_DIV' 0x00,0x00,0x00,0x00"
cset "name='MAP_I2S3_BCLK_DIV' 0x30,0x00,0x01,0x10"
cset "name='MAP_I2S4_BCLK_DIV' 0x30,0x00,0x01,0x10"
cset "name='MAP_I2S_OUT_BCLK_DIV' 0x30,0x00,0x01,0x10"
cset "name='MAP_DSP1_DAC_PROCESSING_REG' 0x30,0x09,0x00,0x00"
cset "name='MAP_DSP1_DAC_CTRL_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP1_DAC_VOLUME' 0x01,0xff,0xff,0x00"
cset "name='MAP_DSP1_INMIX_COEF_REG' 0x00,0x00,0x32,0x00"
cset "name='MAP_DSP2_3D_REG1' 0x00,0x00,0x00,0x00"
cset "name='MAP_DSP2_3D_REG2' 0x00,0x00,0x00,0x00"
cset "name='MAP_ADC_PROCESSING_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_ADC_CTRL_REG' 0x00,0x00,0x00,0x00"
cset "name='MAP_ADC_VOLUME' 0x01,0x00,0x00,0x00"
cset "name='MAP_WNR_FILTER_COEF' 0x70,0x00,0x00,0x00"
cset "name='MAP_INPUT_MIX_REG' 0x00,0x00,0x00,0x00"
cset "name='PM860_MAIN_POWER_REG' 1"
cset "name='PM860_INT_MANAGEMENT' 5"
cset "name='PM860_INT_REG1' 216"
cset "name='PM860_INT_REG2' 0"
cset "name='PM860_INT_MASK_REG1' 0"
cset "name='PM860_INT_MASK_REG2' 0"
cset "name='PM860_SEQ_STATUS_REG1' 169"
cset "name='PM860_SEQ_STATUS_REG2' 169"
cset "name='PM860_SEQ_STATUS_REG3' 0"
cset "name='PM860_SHORT_PROTECT' 2"
cset "name='PM860_LOAD_GROUND_DET2' 0"
cset "name='PM860_LOAD_GROUND_DET3' 0"
cset "name='PM860_LOAD_GROUND_DET4' 0"
cset "name='PM860_LOAD_GROUND_DET5' 0"
cset "name='PM860_LOAD_GROUND_DET6' 0"
cset "name='PM860_LOAD_GROUND_DET7' 0"
cset "name='PM860_ADC_SETTINGS' 0"
cset "name='PM860_ANALOG_MIC_GAIN1' 0"
cset "name='PM860_ANALOG_MIC_GAIN2' 0"
cset "name='PM860_DMIC_SETTINGS' 0"
cset "name='PM860_DWS_SETTINGS1' 0"
cset "name='PM860_DWS_SETTINGS2' 0"
cset "name='PM860_PDM_SETTINGS1' 209"
cset "name='PM860_PDM_SETTINGS2' 2"
cset "name='PM860_PDM_SETTINGS3' 49"
cset "name='PM860_PDM_CONTROL2' 0"
cset "name='PM860_PDM_CONTROL3' 0"
cset "name='PM860_HP_EP_SETTING' 0"
cset "name='PM860_HP_SHRT_STATE' 0"
cset "name='PM860_TDM_SETTING1' 0"
cset "name='PM860_TDM_SETTING2' 0"
cset "name='PM860_TDM_SETTING3' 0"
cset "name='PM860_TDM_SETTING5' 2"
cset "name='PM860_TDM_SETTING7' 0"
cset "name='PM860_TDM_SETTING8' 0"
cset "name='PM860_TDM_SETTING9' 0"
cset "name='PM860_TDM_SETTING10' 0"
cset "name='PM860_TDM_SETTING11' 0"
cset "name='PM860_TDM_SETTING12' 0"
cset "name='PM860_TDM_SETTING13' 33"
cset "name='PM860_TDM_SETTING14' 33"
cset "name='PM860_TDM_SETTING17' 0"
cset "name='PM860_TDM_SETTING16' 5"
cset "name='PM860_TDM_SETTING17_1' 5"
cset "name='PM860_TDM_INTERRUPT' 0"
cset "name='PM860_FIFO_NUM_SAMPLE' 180"
cset "name='PM860_FIFO_STATUS' 0"
cset "name='PM860_TDM_APPLY_CONF' 0"
cset "name='PM860_TDM_TEST' 0"
cset "name='PM860_TDM_CHO_TEST1' 0"
cset "name='PM860_TDM_CHO_TEST2' 0"
cset "name='PM860_DIG_BLOCK_EN_REG1' 4"
cset "name='PM860_DIG_BLOCK_EN_REG2' 1"
cset "name='PM860_CLIP_BITS_REG1' 0"
cset "name='PM860_CLIP_BITS_REG2' 0"
cset "name='PM860_DRE_REG1' 28"
cset "name='PM860_DRE_REG2' 0"
cset "name='PM860_DRE_REG3' 8"
cset "name='PM860_ANALOG_BLOCK_EN' 122"
cset "name='PM860_ANALOG_BLOCK_STATUS' 15"
cset "name='PM860_SDM_BLOCK_EN1' 0"
cset "name='PM860_SDM_BLOCK_EN2' 0"
cset "name='PM860_POWER_APMLIFIER' 176"
cset "name='PM860_ADC_BLOCK_EN' 0"
cset "name='PM860_CLOCK_SETTINGS' 0"
cset "name='PM860_REFGEN_SETTING' 5"
cset "name='PM860_CHARGE_PUMP_REG1' 69"
cset "name='PM860_SPECTRUM_SETTINGS1' 68"
cset "name='PM860_FLL_STATUS' 0"
cset "name='PM860_AUTO_SEQUENCER_2' 4"
cset "name='PM860_RECONSTRUCTION_FILTER' 5"
cset "name='PM860_VOLUME_OUT_SETTING' 0"
cset "name='PM860_POWER_AMPLIFIER' 0"
cset "name='PM860_ADC_SETTING2' 57"
cset "name='PM860_ADC_SETTING3' 16"
cset "name='PM860_ADC_SETTING4' 0"
cset "name='PM860_ADC_SETTING5' 5"
cset "name='PM822_CLASS_D_1' 6"
cset "name='PM822_MIS_CLASS_D_1' 206"
cset "name='PM822_MIS_CLASS_D_2' 112"
cset "name='PM860_VOL_SEL_1' 0"
cset "name='PM860_VOL_SEL_2' 0"
cset "name='PM860_VOL_SEL_3' 128"
cset "name='PM860_VOL_SEL_4' 128"
]
}

View file

@ -0,0 +1,8 @@
Syntax 3
SectionUseCase."HiFi" {
File "HiFi.conf"
}
SectionDefaults [
]

View file

@ -0,0 +1,33 @@
pkgname=firmware-samsung-xcover3lte
pkgver=1
pkgrel=0
pkgdesc="Firmware for Samsung Galaxy Xcover 3"
url="https://postmarketos.org"
arch="aarch64"
license="proprietary"
options="!strip !check !archcheck !spdx pmb:cross-native !tracedeps"
install="$pkgname.post-install"
_repo="android_vendor_samsung_xcover3lte"
_commit="6e324b43b32dc607327d89148dd5d83a14429ee6"
source="
$pkgname-$_commit.tar.gz::https://github.com/xcover3/$_repo/archive/$_commit.tar.gz
sd8x-wlan.initd
"
_files="sd8777_uapsta.bin WlanCalData_ext.conf txpwrlimit_cfg.bin bt_cal_data.conf"
builddir="$srcdir/$_repo-$_commit"
package() {
cd proprietary/etc/firmware/mrvl/
for _i in $_files; do
install -Dm644 "$_i" \
-t "$pkgdir/lib/firmware/postmarketos/mrvl"
done
install -Dm755 "$srcdir"/sd8x-wlan.initd "$pkgdir"/etc/init.d/sd8x-wlan
}
sha512sums="
c396170f11e13498bff588336761852d67571862b45e6d2795066c41a2ea992aec108990269eeaad727fb43bbcd8613a3dd44e92212d9f4a18e058389814e974 firmware-samsung-xcover3lte-6e324b43b32dc607327d89148dd5d83a14429ee6.tar.gz
043de79f6040ab093950e848f773ec60697abff83bc6bfb68fb6a3001bc06b393a83ea99b63dba0f660b3004ac05faa5eb87d43fd12c2d45d7ecdcc44a91d8fc sd8x-wlan.initd
"

View file

@ -0,0 +1,4 @@
#!/bin/sh
# Enable sd8x-wlan init script
rc-update add sd8x-wlan default

View file

@ -0,0 +1,15 @@
#!/sbin/openrc-run
description="Initialize sd8x wlan driver"
depend()
{
need udev
before wpa_supplicant
}
start()
{
ebegin "Enabling wlan driver"
echo 1 > /sys/devices/platform/sd8x-rfkill/pwr_ctrl
}

View file

@ -0,0 +1,82 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm64/configs/pxa1908_xcover3lte_eur_defconfig
pkgname=linux-samsung-xcover3lte
pkgver=3.14.27
pkgrel=0
pkgdesc="Samsung Galaxy Xcover 3 kernel fork"
arch="aarch64"
_carch="arm64"
_flavor="samsung-xcover3lte"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="bash bc bison devicepkg-dev flex openssl-dev perl pxa-mkbootimg dtc gcc4"
# Compiler: GCC 4 (doesn't boot when compiled with newer versions)
if [ "${CC:0:5}" != "gcc4-" ]; then
CC="gcc4-$CC"
HOSTCC="gcc4-gcc"
CROSS_COMPILE="gcc4-$CROSS_COMPILE"
fi
# Source
_repository="android_kernel_samsung_xcover3lte"
_commit="95e23fde08b29e88b8ba48082e51f5834680a179"
_config="config-$_flavor.$arch"
source="
$pkgname-$_commit.tar.gz::https://github.com/xcover3/$_repository/archive/$_commit.tar.gz
$_config
kernel-use-the-gnu89-standard-explicitly.patch
gcc7-give-up-on-ilog2-const-optimizations.patch
gcc8-fix-put-user.patch
gcc10-extern_YYLOC_global_declaration.patch
module-build-fix.patch
uinput-1-breaks.patch
uinput-2-ui_get_sysname.patch
uinput-3-dev-setup.patch
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"
prepare() {
default_prepare
. downstreamkernel_prepare
}
build() {
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" CFLAGS_MODULE="-fno-pic" \
KBUILD_BUILD_VERSION="$((pkgrel + 1))-postmarketOS" modules
}
package() {
KERNEL_IMAGE_NAME="Image.gz" downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir"
# Master DTB (deviceinfo_bootimg_qcdt)
pxa1908-dtbTool -p "$_outdir"/scripts/dtc/ -o "$_outdir/arch/$_carch/boot"/dt.img "$_outdir/arch/$_carch/boot/dts/"
install -Dm644 "$_outdir/arch/$_carch/boot"/dt.img "$pkgdir"/boot/dt.img
# Modules
unset LDFLAGS
make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1))-postmarketOS" \
INSTALL_MOD_PATH="$pkgdir" INSTALL_MOD_STRIP=1 \
modules_install
}
sha512sums="
3c09cca096d7dbc2c2aad4fc1a6d6c603e1179d59322cbf8d34837c96fba5fe6721ea5d76b5a1e331f98735f5cb92606ddb3629d2f62d1559a8abfa0a04564c9 linux-samsung-xcover3lte-95e23fde08b29e88b8ba48082e51f5834680a179.tar.gz
a1e2afef1ac9293a4ef83a04e4056bb13682993f1f1dc74e94872bdaeb6432e6386dc223e0056f49e223f5e9b44b14225459d3839957109981fbb9eb8b06bd4e config-samsung-xcover3lte.aarch64
ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c kernel-use-the-gnu89-standard-explicitly.patch
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb gcc10-extern_YYLOC_global_declaration.patch
c45d985ad4ea3c216199ae92eb3d228308abc35e7d06dd9f35abc0bdb13f3dbeab3f882dee4f96b7c19f575764ab1da5b3d5ff28ba7714e976a7c75617d1ac26 module-build-fix.patch
47ec0cb51db35f95c870cd295d022c68cec837e3bb2f1c72f3faa49a9caf62eca9e9f64c67bb5183440d0ffd71ade45fa3daafc39b88665d2bce178c5189e74e uinput-1-breaks.patch
97874d0bd27b67187d0dbc54d59b21c2e841d490d9bd16ac0672d86b462747a47cd27e5e66675ff3b1ebe80cc1c955e8a481bf9b28347d0042fdd9422293b860 uinput-2-ui_get_sysname.patch
3c32141290a8c57abf2bdb7b904503d5cca035e58beed65877d3086afeeae518a392231b8e717ece0980c4f0b60349ac46598789c1eda1826bd6321b547d8137 uinput-3-dev-setup.patch
"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc10-extern_YYLOC_global_declaration.patch

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc7-give-up-on-ilog2-const-optimizations.patch

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc8-fix-put-user.patch

View file

@ -0,0 +1 @@
../../.shared-patches/linux/kernel-use-the-gnu89-standard-explicitly.patch

View file

@ -0,0 +1,80 @@
diff --git a/Makefile b/Makefile
index 792d22b4..a7ebcec6 100755
--- a/Makefile
+++ b/Makefile
@@ -748,8 +748,7 @@ export INSTALL_PATH ?= /boot
# makefile but the argument can be passed to make if needed.
#
-#MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
-MODLIB = $(INSTALL_MOD_PATH)/lib/modules
+MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
export MODLIB
#
@@ -1030,16 +1029,16 @@ modules_install: _modinst_ _modinst_post
PHONY += _modinst_
_modinst_:
-# @rm -rf $(MODLIB)/kernel
-# @rm -f $(MODLIB)/source
-# @mkdir -p $(MODLIB)/kernel
-# @ln -s $(srctree) $(MODLIB)/source
-# @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
-# rm -f $(MODLIB)/build ; \
-# ln -s $(objtree) $(MODLIB)/build ; \
-# fi
-# @cp -f $(objtree)/modules.order $(MODLIB)/
-# @cp -f $(objtree)/modules.builtin $(MODLIB)/
+ @rm -rf $(MODLIB)/kernel
+ @rm -f $(MODLIB)/source
+ @mkdir -p $(MODLIB)/kernel
+ @ln -s $(srctree) $(MODLIB)/source
+ @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
+ rm -f $(MODLIB)/build ; \
+ ln -s $(objtree) $(MODLIB)/build ; \
+ fi
+ @cp -f $(objtree)/modules.order $(MODLIB)/
+ @cp -f $(objtree)/modules.builtin $(MODLIB)/
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
# This depmod is only for convenience to give the initial
@@ -1048,7 +1047,7 @@ _modinst_:
PHONY += _modinst_post
_modinst_post: _modinst_
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modinst
-# $(call cmd,depmod)
+ $(call cmd,depmod)
ifeq ($(CONFIG_MODULE_SIG), y)
PHONY += modules_sign
@@ -1468,12 +1467,9 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))
cmd_rmfiles = rm -f $(rm-files)
# Run depmod only if we have System.map and depmod is executable
-#quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
-# cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
-# $(KERNELRELEASE) "$(patsubst y,_,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX))"
-quiet_cmd_depmod = DEPMOD $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))
- cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
- $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))
+quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
+ cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
+ $(KERNELRELEASE) "$(patsubst y,_,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX))"
# Create temporary dir for module support files
# clean it up only when building all modules
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index 45ad64da..bf9092bf 100755
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -27,8 +27,7 @@ ext-mod-dir = $(INSTALL_MOD_DIR)$(subst $(patsubst %/,%,$(KBUILD_EXTMOD)),,$(@D)
modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
$(modules):
-# $(call cmd,modules_install,$(MODLIB)/$(modinst_dir))
- $(call cmd,modules_install,$(MODLIB))
+ $(call cmd,modules_install,$(MODLIB)/$(modinst_dir))
# Declare the contents of the .PHONY variable as phony. We keep that
# information in a variable se we can use it in if_changed and friends.

View file

@ -0,0 +1,190 @@
From 9d51e801dba0c79ae979ef2f6928e402eb41009b Mon Sep 17 00:00:00 2001
From: Benjamin Tisssoires <benjamin.tissoires@redhat.com>
Date: Thu, 30 Jan 2014 17:16:36 -0800
Subject: Input: uinput - breaks by goto out in uinput_ioctl_handler
The current implementation prevents us to add variable-length ioctl.
Use a bunch of gotos instead of break to allow us to do so.
No functional changes.
Signed-off-by: Benjamin Tisssoires <benjamin.tissoires@redhat.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/misc/uinput.c | 56 ++++++++++++++++++++++-----------------------
1 file changed, 27 insertions(+), 29 deletions(-)
(limited to 'drivers/input/misc/uinput.c')
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 772835938a526..d8ae08d12abff 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -693,51 +693,51 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
switch (cmd) {
case UI_DEV_CREATE:
retval = uinput_create_device(udev);
- break;
+ goto out;
case UI_DEV_DESTROY:
uinput_destroy_device(udev);
- break;
+ goto out;
case UI_SET_EVBIT:
retval = uinput_set_bit(arg, evbit, EV_MAX);
- break;
+ goto out;
case UI_SET_KEYBIT:
retval = uinput_set_bit(arg, keybit, KEY_MAX);
- break;
+ goto out;
case UI_SET_RELBIT:
retval = uinput_set_bit(arg, relbit, REL_MAX);
- break;
+ goto out;
case UI_SET_ABSBIT:
retval = uinput_set_bit(arg, absbit, ABS_MAX);
- break;
+ goto out;
case UI_SET_MSCBIT:
retval = uinput_set_bit(arg, mscbit, MSC_MAX);
- break;
+ goto out;
case UI_SET_LEDBIT:
retval = uinput_set_bit(arg, ledbit, LED_MAX);
- break;
+ goto out;
case UI_SET_SNDBIT:
retval = uinput_set_bit(arg, sndbit, SND_MAX);
- break;
+ goto out;
case UI_SET_FFBIT:
retval = uinput_set_bit(arg, ffbit, FF_MAX);
- break;
+ goto out;
case UI_SET_SWBIT:
retval = uinput_set_bit(arg, swbit, SW_MAX);
- break;
+ goto out;
case UI_SET_PROPBIT:
retval = uinput_set_bit(arg, propbit, INPUT_PROP_MAX);
- break;
+ goto out;
case UI_SET_PHYS:
if (udev->state == UIST_CREATED) {
@@ -753,18 +753,18 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
kfree(udev->dev->phys);
udev->dev->phys = phys;
- break;
+ goto out;
case UI_BEGIN_FF_UPLOAD:
retval = uinput_ff_upload_from_user(p, &ff_up);
if (retval)
- break;
+ goto out;
req = uinput_request_find(udev, ff_up.request_id);
if (!req || req->code != UI_FF_UPLOAD ||
!req->u.upload.effect) {
retval = -EINVAL;
- break;
+ goto out;
}
ff_up.retval = 0;
@@ -775,65 +775,63 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
memset(&ff_up.old, 0, sizeof(struct ff_effect));
retval = uinput_ff_upload_to_user(p, &ff_up);
- break;
+ goto out;
case UI_BEGIN_FF_ERASE:
if (copy_from_user(&ff_erase, p, sizeof(ff_erase))) {
retval = -EFAULT;
- break;
+ goto out;
}
req = uinput_request_find(udev, ff_erase.request_id);
if (!req || req->code != UI_FF_ERASE) {
retval = -EINVAL;
- break;
+ goto out;
}
ff_erase.retval = 0;
ff_erase.effect_id = req->u.effect_id;
if (copy_to_user(p, &ff_erase, sizeof(ff_erase))) {
retval = -EFAULT;
- break;
+ goto out;
}
- break;
+ goto out;
case UI_END_FF_UPLOAD:
retval = uinput_ff_upload_from_user(p, &ff_up);
if (retval)
- break;
+ goto out;
req = uinput_request_find(udev, ff_up.request_id);
if (!req || req->code != UI_FF_UPLOAD ||
!req->u.upload.effect) {
retval = -EINVAL;
- break;
+ goto out;
}
req->retval = ff_up.retval;
uinput_request_done(udev, req);
- break;
+ goto out;
case UI_END_FF_ERASE:
if (copy_from_user(&ff_erase, p, sizeof(ff_erase))) {
retval = -EFAULT;
- break;
+ goto out;
}
req = uinput_request_find(udev, ff_erase.request_id);
if (!req || req->code != UI_FF_ERASE) {
retval = -EINVAL;
- break;
+ goto out;
}
req->retval = ff_erase.retval;
uinput_request_done(udev, req);
- break;
-
- default:
- retval = -EINVAL;
+ goto out;
}
+ retval = -EINVAL;
out:
mutex_unlock(&udev->mutex);
return retval;
--
cgit

View file

@ -0,0 +1,153 @@
From e3480a61fca72d40d6dc4baaf37e94fcbfa95e19 Mon Sep 17 00:00:00 2001
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Date: Thu, 30 Jan 2014 17:20:24 -0800
Subject: Input: uinput - add UI_GET_SYSNAME ioctl to retrieve the sysfs path
uinput is used in the xorg-integration-tests suite and in the wayland
test suite. These automated tests suites create many virtual input
devices and then hook something to read these newly created devices.
Currently, uinput does not provide the created input device, which means
that we rely on an heuristic to guess which input node was created.
The problem is that is heuristic is subjected to races between different
uinput devices or even with physical devices. Having a way to retrieve
the sysfs path allows us to find without any doubts the event node.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/misc/uinput.c | 43 +++++++++++++++++++++++++++++++++++++++++++
include/linux/uinput.h | 2 ++
include/uapi/linux/uinput.h | 13 ++++++++++++-
3 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index d8ae08d12abff..8569362475004 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -20,6 +20,8 @@
* Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
*
* Changes/Revisions:
+ * 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>)
+ * - add UI_GET_SYSNAME ioctl
* 0.3 09/04/2006 (Anssi Hannula <anssi.hannula@gmail.com>)
* - updated ff support for the changes in kernel interface
* - added MODULE_VERSION
@@ -670,6 +672,31 @@ static int uinput_ff_upload_from_user(const char __user *buffer,
__ret; \
})
+static int uinput_str_to_user(void __user *dest, const char *str,
+ unsigned int maxlen)
+{
+ char __user *p = dest;
+ int len, ret;
+
+ if (!str)
+ return -ENOENT;
+
+ if (maxlen == 0)
+ return -EINVAL;
+
+ len = strlen(str) + 1;
+ if (len > maxlen)
+ len = maxlen;
+
+ ret = copy_to_user(p, str, len);
+ if (ret)
+ return -EFAULT;
+
+ /* force terminating '\0' */
+ ret = put_user(0, p + len - 1);
+ return ret ? -EFAULT : len;
+}
+
static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
unsigned long arg, void __user *p)
{
@@ -679,6 +706,8 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
struct uinput_ff_erase ff_erase;
struct uinput_request *req;
char *phys;
+ const char *name;
+ unsigned int size;
retval = mutex_lock_interruptible(&udev->mutex);
if (retval)
@@ -831,6 +860,20 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
goto out;
}
+ size = _IOC_SIZE(cmd);
+
+ /* Now check variable-length commands */
+ switch (cmd & ~IOCSIZE_MASK) {
+ case UI_GET_SYSNAME(0):
+ if (udev->state != UIST_CREATED) {
+ retval = -ENOENT;
+ goto out;
+ }
+ name = dev_name(&udev->dev->dev);
+ retval = uinput_str_to_user(p, name, size);
+ goto out;
+ }
+
retval = -EINVAL;
out:
mutex_unlock(&udev->mutex);
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 0a4487d3fb1ee..0994c0d01a092 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -20,6 +20,8 @@
* Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
*
* Changes/Revisions:
+ * 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>)
+ * - add UI_GET_SYSNAME ioctl
* 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
* - update ff support for the changes in kernel interface
* - add UINPUT_VERSION
diff --git a/include/uapi/linux/uinput.h b/include/uapi/linux/uinput.h
index fe46431593f9a..0389b489bbba0 100644
--- a/include/uapi/linux/uinput.h
+++ b/include/uapi/linux/uinput.h
@@ -20,6 +20,8 @@
* Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
*
* Changes/Revisions:
+ * 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>)
+ * - add UI_GET_SYSNAME ioctl
* 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
* - update ff support for the changes in kernel interface
* - add UINPUT_VERSION
@@ -35,7 +37,7 @@
#include <linux/types.h>
#include <linux/input.h>
-#define UINPUT_VERSION 3
+#define UINPUT_VERSION 4
struct uinput_ff_upload {
@@ -73,6 +75,15 @@ struct uinput_ff_erase {
#define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase)
#define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase)
+/**
+ * UI_GET_SYSNAME - get the sysfs name of the created uinput device
+ *
+ * @return the sysfs name of the created virtual input device.
+ * The complete sysfs path is then /sys/devices/virtual/input/--NAME--
+ * Usually, it is in the form "inputN"
+ */
+#define UI_GET_SYSNAME(len) _IOC(_IOC_READ, UINPUT_IOCTL_BASE, 300, len)
+
/*
* To write a force-feedback-capable driver, the upload_effect
* and erase_effect callbacks in input_dev must be implemented.
--
cgit

View file

@ -0,0 +1,282 @@
From 052876f8e5aec887d22c4d06e54aa5531ffcec75 Mon Sep 17 00:00:00 2001
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Date: Fri, 18 Dec 2015 17:20:09 -0800
Subject: Input: uinput - add new UINPUT_DEV_SETUP and UI_ABS_SETUP ioctl
This adds two new ioctls, UINPUT_DEV_SETUP and UI_ABS_SETUP, that replaces
the old device setup method (by write()'ing "struct uinput_user_dev" to the
node). The old method is not easily extendable and requires huge payloads.
Furthermore, overloading write() without properly versioned objects is
error-prone.
Therefore, we introduce two new ioctls to replace the old method. These
ioctls support all features of the old method, plus a "resolution" field
for absinfo. Furthermore, it's properly forward-compatible to new ABS codes
and a growing "struct input_absinfo" structure.
UI_ABS_SETUP also allows user-space to skip unknown axes if not set. There
is no need to copy the whole array temporarily into the kernel, but instead
the caller issues several ioctl where we copy each value manually.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/misc/uinput.c | 86 +++++++++++++++++++++++++++++++++++++++++++--
include/linux/uinput.h | 5 +++
include/uapi/linux/uinput.h | 83 +++++++++++++++++++++++++++++++++++++++++--
3 files changed, 168 insertions(+), 6 deletions(-)
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 5adbcedcb81cf..a16fc4a4bb1f1 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -370,8 +370,78 @@ static int uinput_allocate_device(struct uinput_device *udev)
return 0;
}
-static int uinput_setup_device(struct uinput_device *udev,
- const char __user *buffer, size_t count)
+static int uinput_dev_setup(struct uinput_device *udev,
+ struct uinput_setup __user *arg)
+{
+ struct uinput_setup setup;
+ struct input_dev *dev;
+ int retval;
+
+ if (udev->state == UIST_CREATED)
+ return -EINVAL;
+
+ if (copy_from_user(&setup, arg, sizeof(setup)))
+ return -EFAULT;
+
+ if (!setup.name[0])
+ return -EINVAL;
+
+ dev = udev->dev;
+ dev->id = setup.id;
+ udev->ff_effects_max = setup.ff_effects_max;
+
+ kfree(dev->name);
+ dev->name = kstrndup(setup.name, UINPUT_MAX_NAME_SIZE, GFP_KERNEL);
+ if (!dev->name)
+ return -ENOMEM;
+
+ retval = uinput_validate_absbits(dev);
+ if (retval < 0)
+ return retval;
+
+ udev->state = UIST_SETUP_COMPLETE;
+ return 0;
+}
+
+static int uinput_abs_setup(struct uinput_device *udev,
+ struct uinput_setup __user *arg, size_t size)
+{
+ struct uinput_abs_setup setup = {};
+ struct input_dev *dev;
+
+ if (size > sizeof(setup))
+ return -E2BIG;
+
+ if (udev->state == UIST_CREATED)
+ return -EINVAL;
+
+ if (copy_from_user(&setup, arg, size))
+ return -EFAULT;
+
+ if (setup.code > ABS_MAX)
+ return -ERANGE;
+
+ dev = udev->dev;
+
+ input_alloc_absinfo(dev);
+ if (!dev->absinfo)
+ return -ENOMEM;
+
+ set_bit(setup.code, dev->absbit);
+ dev->absinfo[setup.code] = setup.absinfo;
+
+ /*
+ * We restore the state to UIST_NEW_DEVICE because the user has to call
+ * UI_DEV_SETUP in the last place before UI_DEV_CREATE to check the
+ * validity of the absbits.
+ */
+ udev->state = UIST_NEW_DEVICE;
+ return 0;
+}
+
+/* legacy setup via write() */
+static int uinput_setup_device_legacy(struct uinput_device *udev,
+ const char __user *buffer, size_t count)
{
struct uinput_user_dev *user_dev;
struct input_dev *dev;
@@ -474,7 +544,7 @@ static ssize_t uinput_write(struct file *file, const char __user *buffer,
retval = udev->state == UIST_CREATED ?
uinput_inject_events(udev, buffer, count) :
- uinput_setup_device(udev, buffer, count);
+ uinput_setup_device_legacy(udev, buffer, count);
mutex_unlock(&udev->mutex);
@@ -735,6 +805,12 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
uinput_destroy_device(udev);
goto out;
+ case UI_DEV_SETUP:
+ retval = uinput_dev_setup(udev, p);
+ goto out;
+
+ /* UI_ABS_SETUP is handled in the variable size ioctls */
+
case UI_SET_EVBIT:
retval = uinput_set_bit(arg, evbit, EV_MAX);
goto out;
@@ -879,6 +955,10 @@ static long uinput_ioctl_handler(struct file *file, unsigned int cmd,
name = dev_name(&udev->dev->dev);
retval = uinput_str_to_user(p, name, size);
goto out;
+
+ case UI_ABS_SETUP & ~IOCSIZE_MASK:
+ retval = uinput_abs_setup(udev, p, size);
+ goto out;
}
retval = -EINVAL;
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 0994c0d01a092..75de43da23015 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -20,6 +20,11 @@
* Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
*
* Changes/Revisions:
+ * 0.5 08/13/2015 (David Herrmann <dh.herrmann@gmail.com> &
+ * Benjamin Tissoires <benjamin.tissoires@redhat.com>)
+ * - add UI_DEV_SETUP ioctl
+ * - add UI_ABS_SETUP ioctl
+ * - add UI_GET_VERSION ioctl
* 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>)
* - add UI_GET_SYSNAME ioctl
* 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
diff --git a/include/uapi/linux/uinput.h b/include/uapi/linux/uinput.h
index 013c9d8db3720..77b8cf73a178d 100644
--- a/include/uapi/linux/uinput.h
+++ b/include/uapi/linux/uinput.h
@@ -20,6 +20,11 @@
* Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
*
* Changes/Revisions:
+ * 0.5 08/13/2015 (David Herrmann <dh.herrmann@gmail.com> &
+ * Benjamin Tissoires <benjamin.tissoires@redhat.com>)
+ * - add UI_DEV_SETUP ioctl
+ * - add UI_ABS_SETUP ioctl
+ * - add UI_GET_VERSION ioctl
* 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>)
* - add UI_GET_SYSNAME ioctl
* 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
@@ -37,8 +42,8 @@
#include <linux/types.h>
#include <linux/input.h>
-#define UINPUT_VERSION 4
-
+#define UINPUT_VERSION 5
+#define UINPUT_MAX_NAME_SIZE 80
struct uinput_ff_upload {
__u32 request_id;
@@ -58,6 +63,79 @@ struct uinput_ff_erase {
#define UI_DEV_CREATE _IO(UINPUT_IOCTL_BASE, 1)
#define UI_DEV_DESTROY _IO(UINPUT_IOCTL_BASE, 2)
+struct uinput_setup {
+ struct input_id id;
+ char name[UINPUT_MAX_NAME_SIZE];
+ __u32 ff_effects_max;
+};
+
+/**
+ * UI_DEV_SETUP - Set device parameters for setup
+ *
+ * This ioctl sets parameters for the input device to be created. It must be
+ * issued *before* calling UI_DEV_CREATE or it will fail. This ioctl supersedes
+ * the old "struct uinput_user_dev" method, which wrote this data via write().
+ * To actually set the absolute axes, you also need to call the ioctl
+ * UI_ABS_SETUP *before* calling this ioctl.
+ *
+ * This ioctl takes a "struct uinput_setup" object as argument. The fields of
+ * this object are as follows:
+ * id: See the description of "struct input_id". This field is
+ * copied unchanged into the new device.
+ * name: This is used unchanged as name for the new device.
+ * ff_effects_max: This limits the maximum numbers of force-feedback effects.
+ * See below for a description of FF with uinput.
+ *
+ * This ioctl can be called multiple times and will overwrite previous values.
+ * If this ioctl fails with -EINVAL, you're recommended to use the old
+ * "uinput_user_dev" method via write() as fallback, in case you run on an old
+ * kernel that does not support this ioctl.
+ *
+ * This ioctl may fail with -EINVAL if it is not supported or if you passed
+ * incorrect values, -ENOMEM if the kernel runs out of memory or -EFAULT if the
+ * passed uinput_setup object cannot be read/written.
+ * If this call fails, partial data may have already been applied to the
+ * internal device.
+ */
+#define UI_DEV_SETUP _IOW(UINPUT_IOCTL_BASE, 3, struct uinput_setup)
+
+struct uinput_abs_setup {
+ __u16 code; /* axis code */
+ /* __u16 filler; */
+ struct input_absinfo absinfo;
+};
+
+/**
+ * UI_ABS_SETUP - Set absolute axis information for the device to setup
+ *
+ * This ioctl sets one absolute axis information for the input device to be
+ * created. It must be issued *before* calling UI_DEV_SETUP and UI_DEV_CREATE
+ * for every absolute axis the device exports.
+ * This ioctl supersedes the old "struct uinput_user_dev" method, which wrote
+ * part of this data and the content of UI_DEV_SETUP via write().
+ *
+ * This ioctl takes a "struct uinput_abs_setup" object as argument. The fields
+ * of this object are as follows:
+ * code: The corresponding input code associated with this axis
+ * (ABS_X, ABS_Y, etc...)
+ * absinfo: See "struct input_absinfo" for a description of this field.
+ * This field is copied unchanged into the kernel for the
+ * specified axis. If the axis is not enabled via
+ * UI_SET_ABSBIT, this ioctl will enable it.
+ *
+ * This ioctl can be called multiple times and will overwrite previous values.
+ * If this ioctl fails with -EINVAL, you're recommended to use the old
+ * "uinput_user_dev" method via write() as fallback, in case you run on an old
+ * kernel that does not support this ioctl.
+ *
+ * This ioctl may fail with -EINVAL if it is not supported or if you passed
+ * incorrect values, -ENOMEM if the kernel runs out of memory or -EFAULT if the
+ * passed uinput_setup object cannot be read/written.
+ * If this call fails, partial data may have already been applied to the
+ * internal device.
+ */
+#define UI_ABS_SETUP _IOW(UINPUT_IOCTL_BASE, 4, struct uinput_abs_setup)
+
#define UI_SET_EVBIT _IOW(UINPUT_IOCTL_BASE, 100, int)
#define UI_SET_KEYBIT _IOW(UINPUT_IOCTL_BASE, 101, int)
#define UI_SET_RELBIT _IOW(UINPUT_IOCTL_BASE, 102, int)
@@ -144,7 +222,6 @@ struct uinput_ff_erase {
#define UI_FF_UPLOAD 1
#define UI_FF_ERASE 2
-#define UINPUT_MAX_NAME_SIZE 80
struct uinput_user_dev {
char name[UINPUT_MAX_NAME_SIZE];
struct input_id id;
--
cgit