kitakami-common: Bring back FM-Radio!

Change-Id: Ib5e6848034516afa6dad343afbb2bff5bab4281f
This commit is contained in:
Bernhard Thoben 2020-12-11 18:29:35 +01:00 committed by Joel16
parent 96b176c3ba
commit 089d1ecb52
8 changed files with 59 additions and 6 deletions

View File

@ -132,7 +132,7 @@ TARGET_EXFAT_DRIVER := sdfat
TARGET_FS_CONFIG_GEN := $(COMMON_PATH)/config.fs
# FM radio
BOARD_HAVE_BCM_FM := false #UIM not compatible with Oreo, yet;
BOARD_HAVE_BCM_FM := true
# BT/FM (Broadcom): Adjust the sysfs patch for 3.10 kernel
BOARD_HAVE_BCM_FM_SYSFS := "/sys/bus/platform/drivers/bcm_ldisc/bcm_ldisc/"

View File

@ -55,6 +55,7 @@
<item>Built-In Mic</item>
<item>Built-In Back Mic</item>
<item>Telephony Rx</item>
<item>FM Tuner</item>
</attachedDevices>
<defaultOutputDevice>Speaker</defaultOutputDevice>
<mixPorts>
@ -203,7 +204,10 @@
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,128000,176400,192000" channelMasks="dynamic"/>
</devicePort>
<devicePort tagName="FM" type="AUDIO_DEVICE_OUT_FM" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</devicePort>
<devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
@ -227,6 +231,10 @@
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000,48000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
</devicePort>
<devicePort tagName="FM Tuner" type="AUDIO_DEVICE_IN_FM_TUNER" role="source">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/>
</devicePort>
</devicePorts>
<!-- route declaration, i.e. list all available sources for a given sink -->
<routes>
@ -242,6 +250,8 @@
sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload"/>
<route type="mix" sink="Proxy"
sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload"/>
<route type="mix" sink="FM"
sources="primary output"/>
<route type="mix" sink="BT SCO"
sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
<route type="mix" sink="BT SCO Headset"
@ -251,7 +261,7 @@
<route type="mix" sink="Telephony Tx"
sources="voice_tx"/>
<route type="mix" sink="primary input"
sources="Wired Headset Mic,BT SCO Headset Mic,Telephony Rx"/>
sources="Built-In Back Mic,Built-In Mic,Wired Headset Mic,BT SCO Headset Mic,Telephony Rx,FM Tuner"/>
<route type="mix" sink="surround_sound"
sources="Built-In Mic,Built-In Back Mic,Telephony Rx"/>
<route type="mix" sink="Telephony Tx"

View File

@ -3,10 +3,10 @@
#######################################################################################
# UART device port where Bluetooth controller is attached (default ttyS1)
UartPort = /dev/ttyHS0
#UartPort = /dev/ttyHS0
#UartPort = /dev/brcm_bt_drv
#UimUartPort = /dev/ttyHS0
UartPort = /dev/brcm_bt_drv
UimUartPort = /dev/ttyHS0
# Target Baudrate to change to if different from 3000000
# This entry is mandatory if using V4L2

View File

@ -151,6 +151,16 @@ PRODUCT_PACKAGES += \
libtinyxml \
memtrack.msm8994
# DumpState
PRODUCT_PACKAGES += \
android.hardware.dumpstate@1.1-service-kitakami
# FM
PRODUCT_PACKAGES += \
FMRadio \
brcm-uim-sysfs \
libfmradio.v4l2-fm
# Gatekeeper
PRODUCT_PACKAGES += \
android.hardware.gatekeeper@1.0-impl

17
sepolicy/vendor/brcm_uim.te vendored Normal file
View File

@ -0,0 +1,17 @@
type brcm_uim, domain;
type brcm_uim_exec, exec_type, file_type;
# Started by init
init_daemon_domain(brcm_uim)
r_dir_file(brcm_uim, ta_data_file)
rw_dir_file(brcm_uim, bluetooth_data_file)
rw_dir_file(brcm_uim, brcm_ldisc_sysfs)
rw_dir_file(brcm_uim, sysfs)
rw_dir_file(brcm_uim, sysfs_bluetooth_writable)
allow brcm_uim bluetooth_prop:file r_file_perms;
allow brcm_uim exported_bluetooth_prop:file r_file_perms;
allow brcm_uim hci_attach_dev:chr_file rw_file_perms;
allow brcm_uim property_socket:sock_file write;
allow brcm_uim self:capability net_admin;

View File

@ -1,3 +1,6 @@
# FM
type brcm_ldisc_sysfs, sysfs_type, fs_type;
# TAD
type tad_socket, file_type;
type ta_data_file, file_type;

View File

@ -22,6 +22,12 @@
# Camera
/sys/devices(/soc\.0)?/pmi8994-flash-27(/.*)? u:object_r:sysfs_camera_torch:s0
# Dumpstate HAL
/(vendor|system/vendor)/bin/hw/android\.hardware\.dumpstate@1\.1-service-kitakami u:object_r:hal_dumpstate_impl_exec:s0
# FM
/(vendor|system/vendor)/bin/brcm-uim-sysfs u:object_r:brcm_uim_exec:s0
# HCI
/dev/ttyHS0 u:object_r:hci_attach_dev:s0
/dev/brcm_bt_drv u:object_r:hci_attach_dev:s0

7
sepolicy/vendor/te_macros vendored Normal file
View File

@ -0,0 +1,7 @@
# rw_dir_file(domain, type)
# Allow the specified domain to read and write directories, files
# and symbolic links of the specified type.
define(`rw_dir_file', `
allow $1 $2:dir rw_dir_perms;
allow $1 $2:{ file lnk_file } rw_file_perms;
')