diff --git a/BoardConfig-common.mk b/BoardConfig-common.mk index 15f6fcc..099c238 100644 --- a/BoardConfig-common.mk +++ b/BoardConfig-common.mk @@ -37,7 +37,7 @@ BOARD_KERNEL_CMDLINE += earlycon=exynos4210,0x10870000 console=ttySAC0,115200 an BOARD_KERNEL_CMDLINE += cma_sysfs.experimental=Y BOARD_KERNEL_CMDLINE += cgroup_disable=memory BOARD_KERNEL_CMDLINE += cgroup.memory=nokmem -BOARD_KERNEL_CMDLINE += rcupdate.rcu_expedited=1 rcu_nocbs=all +BOARD_KERNEL_CMDLINE += rcupdate.rcu_expedited=1 rcu_nocbs=all rcutree.enable_rcu_lazy BOARD_KERNEL_CMDLINE += swiotlb=noforce BOARD_KERNEL_CMDLINE += disable_dma32=on BOARD_KERNEL_CMDLINE += sysctl.kernel.sched_pelt_multiplier=4 @@ -150,8 +150,6 @@ endif #display_unit_test ifeq ($(USES_DEVICE_GOOGLE_ZUMAPRO),true) -# TODO(b/272725898): Needs to check with owner later -$(warning display_unit_test set to zuma on zumapro target) $(call soong_config_set,display_unit_test,soc,zuma) endif @@ -245,6 +243,7 @@ ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) $(call soong_config_set,aoc_audio_func,dump_usecase_data,true) $(call soong_config_set,aoc_audio_func,hal_socket_control,true) $(call soong_config_set,aoc_audio_func,record_tuning_keys,true) +$(call soong_config_set,aoc_audio_func,aidl_command_interface,true) endif ifneq (,$(filter aosp_%,$(TARGET_PRODUCT))) @@ -279,8 +278,6 @@ HWC_SUPPORT_COLOR_TRANSFORM := true BOARD_USES_EXYNOS_AFBC_FEATURE := true #BOARD_USES_HDRUI_GLES_CONVERSION := true -# TODO(b/272725898): Needs to check with owner later -$(warning BOARD_LIBACRYL_DEFAULT_COMPOSITOR set to zuma on zumapro target) BOARD_LIBACRYL_DEFAULT_COMPOSITOR := fimg2d_zuma BOARD_LIBACRYL_G2D_HDR_PLUGIN := libacryl_hdr_plugin @@ -396,11 +393,19 @@ KERNEL_MODULES := $(wildcard $(KERNEL_MODULE_DIR)/*.ko) BOARD_SYSTEM_KERNEL_MODULES_BLOCKLIST_FILE := $(KERNEL_MODULE_DIR)/system_dlkm.modules.blocklist BOARD_VENDOR_KERNEL_MODULES_BLOCKLIST_FILE := $(KERNEL_MODULE_DIR)/vendor_dlkm.modules.blocklist -BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES_LOAD := $(strip $(shell cat $(KERNEL_MODULE_DIR)/vendor_kernel_boot.modules.load)) -ifndef BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES_LOAD +# Prebuilt kernel modules that are *not* listed in vendor_kernel_boot.modules.load +BOARD_PREBUILT_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES = fips140.ko +BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES_LOAD_EXTRA = $(foreach k,$(BOARD_PREBUILT_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES),$(if $(wildcard $(KERNEL_MODULE_DIR)/$(k)), $(k))) + +# Kernel modules that are listed in vendor_kernel_boot.modules.load +BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES_LOAD_FILE := $(strip $(shell cat $(KERNEL_MODULE_DIR)/vendor_kernel_boot.modules.load)) +ifndef BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES_LOAD_FILE $(error vendor_kernel_boot.modules.load not found or empty) endif -BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES := $(addprefix $(KERNEL_MODULE_DIR)/, $(notdir $(BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES_LOAD))) +BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES_LOAD := $(BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES_LOAD_EXTRA) +BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES_LOAD += $(BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES_LOAD_FILE) +BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES := $(addprefix $(KERNEL_MODULE_DIR)/, $(BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES_LOAD_EXTRA)) +BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES += $(addprefix $(KERNEL_MODULE_DIR)/, $(notdir $(BOARD_VENDOR_KERNEL_RAMDISK_KERNEL_MODULES_LOAD_FILE))) BOARD_VENDOR_KERNEL_MODULES_LOAD := $(strip $(shell cat $(KERNEL_MODULE_DIR)/vendor_dlkm.modules.load)) ifndef BOARD_VENDOR_KERNEL_MODULES_LOAD diff --git a/OWNERS b/OWNERS index 4bdbb97..e6ce5d0 100644 --- a/OWNERS +++ b/OWNERS @@ -1,2 +1,2 @@ # per-file for Pixel device makefiles, see go/pixel-device-mk-owner-checklist for details. -per-file *.mk=file:device/google/gs-common:main:/OWNERS +per-file *.mk=file:device/google/gs-common:main:/MK_OWNERS diff --git a/conf/fstab.zumapro.in b/conf/fstab.zumapro.in index b2a5f14..779b259 100644 --- a/conf/fstab.zumapro.in +++ b/conf/fstab.zumapro.in @@ -20,6 +20,6 @@ vendor_dlkm /vendor_dlkm /dev/block/platform/13200000.ufs/by-name/misc /misc emmc defaults wait /dev/block/platform/13200000.ufs/by-name/metadata /metadata f2fs noatime,nosuid,nodev,sync wait,check,formattable,first_stage_mount #/dev/block/platform/13200000.ufs/by-name/pvmfw /pvmfw emmc defaults wait,slotselect,avb=pvmfw,first_stage_mount -/dev/block/platform/13200000.ufs/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,reserve_root=32768,resgid=1065,fsync_mode=nobarrier,compress_extension=apk,compress_extension=apex,compress_extension=so,compress_extension=vdex,compress_extension=odex,@inlinecrypt@,atgc,checkpoint_merge,compress_cache latemount,wait,check,quota,formattable,sysfs_path=/dev/sys/block/bootdevice,checkpoint=fs,reservedsize=128M,fscompress,readahead_size_kb=128,@fileencryption@,@metadata_encryption@,keydirectory=/metadata/vold/metadata_encryption,zoned_device +/dev/block/platform/13200000.ufs/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,reserve_root=32768,resgid=1065,fsync_mode=nobarrier,compress_extension=apk,compress_extension=so,compress_extension=vdex,compress_extension=odex,@inlinecrypt@,atgc,checkpoint_merge,compress_cache latemount,wait,check,quota,formattable,sysfs_path=/dev/sys/block/bootdevice,checkpoint=fs,reservedsize=128M,fscompress,readahead_size_kb=128,@fileencryption@,@metadata_encryption@,keydirectory=/metadata/vold/metadata_encryption,device=zoned:/dev/block/by-name/zoned_device /dev/block/platform/13200000.ufs/by-name/vbmeta /vbmeta emmc defaults slotselect,first_stage_mount /devices/platform/11210000.usb* auto vfat defaults voldmanaged=usb:auto diff --git a/conf/init.factory.rc b/conf/init.factory.rc index ed294fd..4741028 100644 --- a/conf/init.factory.rc +++ b/conf/init.factory.rc @@ -15,5 +15,5 @@ on boot on property:sys.boot_completed=1 # Bump nnapi min clamp & add adbd to it for factory (b/222226268) - write /proc/vendor_sched/nnapi_uclamp_min 512 + write /proc/vendor_sched/groups/nnapi/uclamp_min 512 exec - root root -- /vendor/bin/factory/factory_post_boot diff --git a/conf/init.zumapro.board.rc b/conf/init.zumapro.board.rc index 5887039..a0daa4f 100644 --- a/conf/init.zumapro.board.rc +++ b/conf/init.zumapro.board.rc @@ -294,26 +294,6 @@ on post-fs-data # Video data mkdir /data/vendor/media 0700 mediacodec mediacodec -on post-fs-data - # GPS - mkdir /data/vendor/gps 0771 system system - chown system system /data/vendor/gps - rm /data/vendor/gps/gps_started - rm /data/vendor/gps/glonass_started - rm /data/vendor/gps/beidou_started - rm /data/vendor/gps/smd_started - rm /data/vendor/gps/sv_cno.info - - chown gps system /sys/devices/platform/111e0000.spi/spi_master/spi21/spi21.0/nstandby - chmod 0664 /dev/ttyBCM - chown gps system /dev/ttyBCM - chmod 0664 /dev/bbd_control - chown gps system /dev/bbd_control - chmod 0664 /dev/bbd_patch - chown gps system /dev/bbd_patch - chmod 0664 /dev/bbd_sensor - chown gps system /dev/bbd_sensor - on early-boot # Wait for insmod_sh to finish all common modules wait_for_prop vendor.common.modules.ready 1 @@ -425,6 +405,10 @@ on fs chown system system /sys/devices/platform/exynos-drm/primary-panel/panel_need_handle_idle_exit chown system system /sys/devices/platform/exynos-drm/primary-panel/op_hz chown system system /sys/devices/platform/exynos-drm/primary-panel/refresh_ctrl + chown system system /sys/devices/platform/exynos-drm/primary-panel/te2_rate_hz + chown system system /sys/devices/platform/exynos-drm/primary-panel/te2_option + chown system system /sys/devices/platform/exynos-drm/primary-panel/power_state + chown system system /sys/devices/platform/exynos-drm/primary-panel/frame_rate chown system system /sys/module/drm/parameters/vblankoffdelay chown system system /sys/module/drm/parameters/debug chown system system /sys/class/dqe0/atc/ambient_light @@ -520,6 +504,12 @@ on property:sys.boot_completed=1 # Cancel boot devfreq write /sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/exynos_data/cancel_boot_freq 1 + # Setup scheduler parameters + write /proc/vendor_sched/min_granularity_ns 1000000 + write /proc/vendor_sched/latency_ns 8000000 + write /proc/vendor_sched/max_load_balance_interval 4 + write /proc/vendor_sched/enable_hrtick 1 + # Setup final cpu.uclamp write /proc/vendor_sched/groups/ta/uclamp_min 1 write /proc/vendor_sched/groups/fg/uclamp_min 0 @@ -649,16 +639,20 @@ on post-fs-data symlink /mnt/vendor/persist/ss /data/vendor/ss/persist chown root system /data/vendor/ss/persist chmod 0770 /data/vendor/ss/persist - symlink /dev/block/platform/13200000\.ufs/by-name/trusty_persist /data/vendor/ss/persist/0 - symlink /dev/block/platform/13200000\.ufs/by-name/trusty_userdata /data/vendor/ss/0 chown system system /data/vendor/ss/0 chown system system /data/vendor/ss/persist/0 chown system system /data/vendor/ss/persist/nsp restart storageproxyd -service storageproxyd /vendor/bin/storageproxyd -d /dev/trusty-ipc-dev0 \ - -r /dev/sg1 -p /data/vendor/ss -t ufs +service storageproxyd /vendor/bin/storageproxyd \ + -d /dev/trusty-ipc-dev0 \ + -r /dev/sg1 \ + -p /data/vendor/ss \ + -t ufs \ + -f 0:/dev/block/platform/13200000\.ufs/by-name/trusty_userdata \ + -f persist/0:/dev/block/platform/13200000\.ufs/by-name/trusty_persist \ + -m /dev/block/platform/13200000\.ufs/by-name/trusty_userdata class early_hal user system group system @@ -692,29 +686,6 @@ on post-fs-data chown system system /sys/kernel/metrics/thermal/tr_by_group/tmu/stats_reset chown system system /sys/kernel/metrics/thermal/tr_by_group/spmic/stats_reset -on property:vendor.all.modules.ready=1 - # BCL - write /sys/devices/platform/cpupm/cpupm/cpd_cl1 0 #Disable power down - write /sys/devices/platform/cpupm/cpupm/cpd_cl2 0 #Disable power down - write /sys/devices/virtual/pmic/mitigation/clock_ratio/tpu_light_clk_ratio 0xfff041c1 #OCP - write /sys/devices/virtual/pmic/mitigation/clock_ratio/cpu1_heavy_clk_ratio 0xfff041c0 #DFS - write /sys/devices/virtual/pmic/mitigation/clock_ratio/cpu2_heavy_clk_ratio 0xfff041c0 #DFS - write /sys/devices/virtual/pmic/mitigation/clock_ratio/gpu_light_clk_ratio 0xfff041c1 #OCP - write /sys/devices/virtual/pmic/mitigation/clock_ratio/cpu2_light_clk_ratio 0xfff041c3 #OCP - write /sys/devices/virtual/pmic/mitigation/clock_ratio/gpu_heavy_clk_ratio 0xfff04381 #DFS - write /sys/devices/virtual/pmic/mitigation/clock_ratio/tpu_heavy_clk_ratio 0xfff041c1 #DFS - write /sys/devices/virtual/pmic/mitigation/triggered_lvl/smpl_lvl 3000 - write /sys/devices/virtual/pmic/mitigation/triggered_lvl/soft_ocp_cpu2_lvl 12000 - write /sys/devices/virtual/pmic/mitigation/triggered_lvl/soft_ocp_gpu_lvl 9000 - write /sys/devices/virtual/pmic/mitigation/triggered_lvl/soft_ocp_tpu_lvl 8500 - write /sys/devices/virtual/pmic/mitigation/triggered_lvl/ocp_tpu_lvl 13500 - write /sys/devices/virtual/pmic/mitigation/triggered_lvl/ocp_gpu_lvl 9000 - write /sys/devices/virtual/pmic/mitigation/clock_div/tpu_clk_div 0x1 - write /sys/devices/virtual/pmic/mitigation/clock_div/gpu_clk_div 0x1 - write /sys/devices/virtual/pmic/mitigation/clock_div/cpu2_clk_div 0x1 - write /sys/devices/platform/cpupm/cpupm/cpd_cl1 1 #Enable power down - write /sys/devices/platform/cpupm/cpupm/cpd_cl2 1 #Enable power down - on property:vendor.thermal.link_ready=1 chown system system /dev/thermal/tz-by-name/soc/mode chown system system /dev/thermal/tz-by-name/vdroop2/trip_point_0_temp @@ -779,6 +750,9 @@ on property:vendor.thermal.link_ready=1 chown system system /dev/thermal/cdev-by-name/wlc_fcc/cur_state chown system system /dev/thermal/cdev-by-name/chg_mdis/cur_state chown system system /dev/thermal/cdev-by-name/usbc-port/cur_state + chown system system /dev/thermal/cdev-by-name/thermal-uclamp-0/cur_state + chown system system /dev/thermal/cdev-by-name/thermal-uclamp-4/cur_state + chown system system /dev/thermal/cdev-by-name/thermal-uclamp-7/cur_state on charger # Use charger thermal config diff --git a/conf/init.zumapro.soc.rc b/conf/init.zumapro.soc.rc index 52205a8..ac9c316 100644 --- a/conf/init.zumapro.soc.rc +++ b/conf/init.zumapro.soc.rc @@ -1,13 +1,10 @@ on init - chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/lcpi_threshold chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/spc_threshold chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/limit_frequency chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/pmu_limit_enable - chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/lcpi_threshold chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/spc_threshold chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/limit_frequency chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/pmu_limit_enable - chown system system /sys/devices/system/cpu/cpufreq/policy7/sched_pixel/lcpi_threshold chown system system /sys/devices/system/cpu/cpufreq/policy7/sched_pixel/spc_threshold chown system system /sys/devices/system/cpu/cpufreq/policy7/sched_pixel/limit_frequency chown system system /sys/devices/system/cpu/cpufreq/policy7/sched_pixel/pmu_limit_enable @@ -31,17 +28,30 @@ on init write /proc/vendor_sched/groups/sys/uclamp_min 190 write /proc/vendor_sched/groups/sys/prefer_idle 1 + write /proc/vendor_sched/groups/bg/rampup_multiplier 0 + write /proc/vendor_sched/groups/cam/rampup_multiplier 1 + write /proc/vendor_sched/groups/cam_power/rampup_multiplier 1 + write /proc/vendor_sched/groups/dex2oat/rampup_multiplier 0 + write /proc/vendor_sched/groups/fg/rampup_multiplier 0 + write /proc/vendor_sched/groups/nnapi/rampup_multiplier 0 + write /proc/vendor_sched/groups/ota/rampup_multiplier 0 + write /proc/vendor_sched/groups/rt/rampup_multiplier 0 + write /proc/vendor_sched/groups/sf/rampup_multiplier 1 + write /proc/vendor_sched/groups/sys/rampup_multiplier 0 + write /proc/vendor_sched/groups/sys_bg/rampup_multiplier 0 + write /proc/vendor_sched/groups/ta/rampup_multiplier 1 + write /proc/vendor_sched/adpf_rampup_multiplier 2 + # governor setting write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor sched_pixel write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/up_rate_limit_us 500 - write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/down_rate_limit_us 5000 - write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/down_rate_limit_scale_pow 2 + write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/down_rate_limit_us 500 write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor sched_pixel write /sys/devices/system/cpu/cpu4/cpufreq/sched_pixel/up_rate_limit_us 500 - write /sys/devices/system/cpu/cpu4/cpufreq/sched_pixel/down_rate_limit_us 20000 + write /sys/devices/system/cpu/cpu4/cpufreq/sched_pixel/down_rate_limit_us 500 write /sys/devices/system/cpu/cpu7/cpufreq/scaling_governor sched_pixel write /sys/devices/system/cpu/cpu7/cpufreq/sched_pixel/up_rate_limit_us 500 - write /sys/devices/system/cpu/cpu7/cpufreq/sched_pixel/down_rate_limit_us 20000 + write /sys/devices/system/cpu/cpu7/cpufreq/sched_pixel/down_rate_limit_us 500 # memlat cpuidle awareness setting # FIXME(b/301212469) these nodes missing on zuma pro @@ -152,6 +162,7 @@ on property:init.svc.vendor.charger=running on property:sys.boot_completed=1 # Set kswapd affinity write /sys/kernel/vendor_mm/kswapd_cpu_affinity 7f + write /sys/kernel/vendor_mm/pa_kill/cpu_affinity 7f # Restore prefer idle write /proc/vendor_sched/groups/ta/preferred_idle_mask_low 0xff @@ -174,14 +185,11 @@ on property:sys.boot_completed=1 setprop vendor.powerhal.init 1 # Set PMU freq limit parameters - write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/lcpi_threshold 0 write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/spc_threshold 76 write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/limit_frequency 1328000 - write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/lcpi_threshold 0 - write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/spc_threshold 73 - write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/limit_frequency 1836000 - write /sys/devices/system/cpu/cpufreq/policy7/sched_pixel/lcpi_threshold 0 - write /sys/devices/system/cpu/cpufreq/policy7/sched_pixel/spc_threshold 68 + write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/spc_threshold 59 + write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/limit_frequency 1795000 + write /sys/devices/system/cpu/cpufreq/policy7/sched_pixel/spc_threshold 62 write /sys/devices/system/cpu/cpufreq/policy7/sched_pixel/limit_frequency 2363000 write /proc/vendor_sched/pmu_poll_time 10 diff --git a/conf/init.zumapro.usb.rc b/conf/init.zumapro.usb.rc index 8f33d1e..ae67506 100644 --- a/conf/init.zumapro.usb.rc +++ b/conf/init.zumapro.usb.rc @@ -306,3 +306,12 @@ on property:persist.vendor.usb.displayport.enabled=1 on property:persist.vendor.usb.displayport.enabled=0 write /sys/module/exynos_drm/parameters/dp_enabled 0 write /sys/class/typec/port0/port0.0/mode1/active "no" + +on property:persist.sys.hdcp_checking=always + write /sys/module/exynos_hdcp2/parameters/max_ver 2 + +on property:persist.sys.hdcp_checking="drm-only" + write /sys/module/exynos_hdcp2/parameters/max_ver 2 + +on property:persist.sys.hdcp_checking=never + write /sys/module/exynos_hdcp2/parameters/max_ver 0 diff --git a/conf/ueventd.zumapro.rc b/conf/ueventd.zumapro.rc index ca08579..15ca216 100644 --- a/conf/ueventd.zumapro.rc +++ b/conf/ueventd.zumapro.rc @@ -157,6 +157,11 @@ /dev/acd-com.google.bt 0660 system system /dev/acd-com.google.bt.non_wake_up 0660 system system +# AoC Bluetooth Offload +/dev/acd-chre_bt_offload_ctl 0660 bluetooth bluetooth +/dev/acd-chre_bt_offload_data_tx 0220 bluetooth bluetooth +/dev/acd-chre_bt_offload_data_rx 0440 bluetooth bluetooth + # LWIS /dev/lwis* 0660 system system diff --git a/default-permissions.xml b/default-permissions.xml index 384d66b..2d04542 100644 --- a/default-permissions.xml +++ b/default-permissions.xml @@ -51,16 +51,23 @@ + + + + - + + + + @@ -73,6 +80,10 @@ + + + + + + @@ -143,6 +156,11 @@ + + + + diff --git a/device-common.mk b/device-common.mk index b419ba2..b67982a 100644 --- a/device-common.mk +++ b/device-common.mk @@ -53,4 +53,8 @@ PRODUCT_VENDOR_PROPERTIES += \ # force enable MTE. ifeq (,$(filter %_fullmte,$(TARGET_PRODUCT))) PRODUCT_PRODUCT_PROPERTIES += ro.arm64.memtag.bootctl_supported=1 +PRODUCT_PRODUCT_PROPERTIES += persist.arm64.memtag.app.com.android.se=off +PRODUCT_PRODUCT_PROPERTIES += persist.arm64.memtag.app.com.google.android.bluetooth=off +PRODUCT_PRODUCT_PROPERTIES += persist.arm64.memtag.app.com.android.nfc=off +PRODUCT_PRODUCT_PROPERTIES += persist.arm64.memtag.system_server=off endif diff --git a/device.mk b/device.mk index 90d0470..04981c5 100644 --- a/device.mk +++ b/device.mk @@ -16,7 +16,7 @@ include device/google/gs-common/device.mk include device/google/gs-common/gs_watchdogd/watchdog.mk -include device/google/gs-common/ramdump/ramdump.mk +include device/google/gs-common/ramdump_and_coredump/ramdump_and_coredump.mk include device/google/gs-common/soc/soc.mk include device/google/gs-common/modem/modem.mk include device/google/gs-common/aoc/aoc.mk @@ -26,6 +26,7 @@ include device/google/gs-common/storage/storage.mk include device/google/gs-common/thermal/dump/thermal.mk include device/google/gs-common/thermal/thermal_hal/device.mk include device/google/gs-common/performance/perf.mk +include device/google/gs-common/power/power.mk include device/google/gs-common/pixel_metrics/pixel_metrics.mk include device/google/gs-common/soc/freq.mk include device/google/gs-common/gps/dump/log.mk @@ -41,6 +42,9 @@ include device/google/gs-common/sota_app/factoryota.mk include device/google/gs-common/misc_writer/misc_writer.mk include device/google/gs-common/gyotaku_app/gyotaku.mk include device/google/gs-common/bootctrl/bootctrl_aidl.mk +include device/google/gs-common/betterbug/betterbug.mk +include device/google/gs-common/recorder/recorder.mk +include device/google/gs-common/fingerprint/fingerprint.mk include device/google/zumapro/dumpstate/item.mk @@ -65,8 +69,6 @@ ifeq ($(USE_PIXEL_GRALLOC),true) PRODUCT_SOONG_NAMESPACES += hardware/google/gchips/GrallocHAL endif -# TODO(b/272725898): Needs to check with owner later -$(warning hardware/google/graphics/zuma set to zuma on zumapro target) PRODUCT_SOONG_NAMESPACES += \ hardware/google/av \ hardware/google/gchips \ @@ -179,7 +181,6 @@ PRODUCT_PRODUCT_PROPERTIES += \ bluetooth.profile.asha.central.enabled=true \ bluetooth.profile.a2dp.source.enabled=true \ bluetooth.profile.avrcp.target.enabled=true \ - bluetooth.profile.bap.broadcast.assist.enabled=true \ bluetooth.profile.bap.unicast.server.enabled=true \ bluetooth.profile.bas.client.enabled=true \ bluetooth.profile.csip.set_coordinator.enabled=true \ @@ -213,7 +214,79 @@ PRODUCT_PROPERTY_OVERRIDES += \ persist.vendor.usb.displayport.enabled=1 endif +PRODUCT_PROPERTY_OVERRIDES += \ + persist.sys.hdcp_checking=always + USE_LASSEN_OEMHOOK := true +ifneq ($(BOARD_WITHOUT_RADIO),true) +# The "power-anomaly-sitril" is added into PRODUCT_SOONG_NAMESPACES when +# $(USE_LASSEN_OEMHOOK) is true and $(BOARD_WITHOUT_RADIO) is not true. +PRODUCT_SOONG_NAMESPACES += vendor/google/tools/power-anomaly-sitril + +$(call inherit-product-if-exists, vendor/samsung_slsi/telephony/$(BOARD_USES_SHARED_VENDOR_TELEPHONY)/common/device-vendor.mk) + +# modem_ml_svc_sit daemon +PRODUCT_PACKAGES += modem_ml_svc_sit + +# TODO: b/350624523 - Add back modem ML TFLite service after it is ready. +# ifeq (,$(filter aosp_%,$(TARGET_PRODUCT))) +# # Modem ML TFLite service. +# PRODUCT_PACKAGES += modemml-tflite-service \ +# libtensorflowlite_jni + +# # Allow TFLite service modules to be installed to the system partition +# PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST += \ +# system/lib64/libtensorflowlite_jni.so + +# PRODUCT_SYSTEM_SERVER_JARS += system_ext:modemml-tflite-service +# endif + +# modem ML models configs +ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) +PRODUCT_COPY_FILES += \ + device/google/zumapro/modem_ml/modem_ml_nnapi_models_userdebug.conf:$(TARGET_COPY_OUT_VENDOR)/etc/modem_ml_models.conf \ + device/google/zumapro/modem_ml/modem_ml_tflite_models_userdebug.conf:$(TARGET_COPY_OUT_VENDOR)/etc/modem_ml_tflite_models.conf +else +PRODUCT_COPY_FILES += \ + device/google/zumapro/modem_ml/modem_ml_nnapi_models_user.conf:$(TARGET_COPY_OUT_VENDOR)/etc/modem_ml_models.conf \ + device/google/zumapro/modem_ml/modem_ml_tflite_models_user.conf:$(TARGET_COPY_OUT_VENDOR)/etc/modem_ml_tflite_models.conf +endif + +# modem logging binary/configs +PRODUCT_PACKAGES += modem_logging_control + +# libeomservice_proxy binary/configs +PRODUCT_PACKAGES += liboemservice_proxy_default + +# modem logging configs +PRODUCT_PACKAGES += \ + logging.conf \ + default.cfg \ + default.nprf \ + default_metrics.xml \ + Pixel_stability.cfg \ + Pixel_stability.nprf \ + extensive_logging.conf + +# Vendor modem extensive logging default property +PRODUCT_PROPERTY_OVERRIDES += \ + persist.vendor.modem.extensive_logging_enabled=false + +# Pixel Logger +include hardware/google/pixel/PixelLogger/PixelLogger.mk + +# Use Lassen specifc Shared Modem Platform +SHARED_MODEM_PLATFORM_VENDOR := lassen + +else # ifneq ($(BOARD_WITHOUT_RADIO),true) + +# Pixel Logger +BOARD_SEPOLICY_DIRS += hardware/google/pixel-sepolicy/logger_app + +endif # ifneq ($(BOARD_WITHOUT_RADIO),true) + +# Shared Modem Platform +include device/google/gs-common/modem/shared_modem_platform/shared_modem_platform.mk # Use for GRIL USES_LASSEN_MODEM := true @@ -222,6 +295,12 @@ USE_WHI_GRIL_RECOVERY := true ifeq ($(USES_GOOGLE_DIALER_CARRIER_SETTINGS),true) USE_GOOGLE_DIALER := true USE_GOOGLE_CARRIER_SETTINGS := true +PRODUCT_PROPERTY_OVERRIDES += \ + ro.vendor.uses_google_dialer_carrier_settings=1 +endif + +ifeq ($(USES_GOOGLE_PREBUILT_MODEM_SVC),true) +USE_GOOGLE_PREBUILT_MODEM_SVC := true endif # Audio client implementation for RIL @@ -292,9 +371,8 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.vulkan.version-1_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \ frameworks/native/data/etc/android.hardware.vulkan.level-1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \ frameworks/native/data/etc/android.hardware.vulkan.compute-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.compute.xml \ - frameworks/native/data/etc/android.software.contextualsearch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.contextualsearch.xml \ - frameworks/native/data/etc/android.software.vulkan.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \ - frameworks/native/data/etc/android.software.opengles.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml + frameworks/native/data/etc/android.software.vulkan.deqp.level-2024-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \ + frameworks/native/data/etc/android.software.opengles.deqp.level-2024-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml #endif @@ -448,7 +526,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ persist.vendor.sys.silentlog.tcp = "On" \ ro.vendor.cbd.modem_removable = "1" \ ro.vendor.cbd.modem_type = "s5100sit" \ - persist.vendor.sys.modem.logging.br_num=5 \ + persist.vendor.sys.modem.logging.br_num=10 \ persist.vendor.sys.modem.logging.enable=true # Enable silent CP crash handling @@ -568,10 +646,6 @@ PRODUCT_PROPERTY_OVERRIDES += aaudio.hw_burst_min_usec=2000 PRODUCT_PACKAGES += \ com.android.future.usb.accessory -PRODUCT_PACKAGES += \ - android.hardware.graphics.mapper@4.0-impl \ - android.hardware.graphics.allocator-V1-service - PRODUCT_PACKAGES += \ android.hardware.memtrack-service.pixel \ libion_exynos \ @@ -803,6 +877,8 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_PROPERTY_OVERRIDES += \ debug.stagefright.c2inputsurface=-1 \ +PRODUCT_PROPERTY_OVERRIDES += media.c2.hal.selection=aidl + # 2. OpenMAX IL PRODUCT_COPY_FILES += \ device/google/zumapro/media_codecs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs.xml \ @@ -851,8 +927,6 @@ PRODUCT_SOONG_NAMESPACES += \ PRODUCT_PACKAGES += \ trusty_metricsd -# TODO(b/272725898): Needs to check with owner later -$(warning displaycolor_platform set to zuma on zumapro target) $(call soong_config_set,google_displaycolor,displaycolor_platform,zuma) PRODUCT_PACKAGES += \ android.hardware.composer.hwc3-service.pixel \ @@ -945,10 +1019,6 @@ USE_EARLY_SEND_DEVICE_INFO := true #$(call inherit-product, vendor/google_devices/telephony/common/device-vendor.mk) #$(call inherit-product, vendor/google_devices/zumapro/proprietary/device-vendor.mk) -ifneq ($(BOARD_WITHOUT_RADIO),true) -$(call inherit-product-if-exists, vendor/samsung_slsi/telephony/$(BOARD_USES_SHARED_VENDOR_TELEPHONY)/common/device-vendor.mk) -endif - $(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit_only.mk) #$(call inherit-product, hardware/google_devices/exynos5/exynos5.mk) #$(call inherit-product-if-exists, hardware/google_devices/zumapro/zumapro.mk) @@ -963,42 +1033,6 @@ PRODUCT_COPY_FILES += \ device/google/zumapro/component-overrides.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sysconfig/component-overrides.xml \ frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml \ -ifneq ($(BOARD_WITHOUT_RADIO),true) -# modem_svc_sit daemon -PRODUCT_PACKAGES += modem_svc_sit - -# modem_ml_svc_sit daemon -PRODUCT_PACKAGES += modem_ml_svc_sit - -# modem ML models configs -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) -PRODUCT_COPY_FILES += \ - device/google/zumapro/modem_ml/modem_ml_models_userdebug.conf:$(TARGET_COPY_OUT_VENDOR)/etc/modem_ml_models.conf -else -PRODUCT_COPY_FILES += \ - device/google/zumapro/modem_ml/modem_ml_models_user.conf:$(TARGET_COPY_OUT_VENDOR)/etc/modem_ml_models.conf -endif - -# modem logging binary/configs -PRODUCT_PACKAGES += modem_logging_control - -# libeomservice_proxy binary/configs -PRODUCT_PACKAGES += liboemservice_proxy_default - -# modem logging configs -PRODUCT_COPY_FILES += \ - device/google/zumapro/radio/config/logging.conf:$(TARGET_COPY_OUT_VENDOR)/etc/modem/logging.conf \ - device/google/zumapro/radio/config/default.cfg:$(TARGET_COPY_OUT_VENDOR)/etc/modem/default.cfg \ - device/google/zumapro/radio/config/default.nprf:$(TARGET_COPY_OUT_VENDOR)/etc/modem/default.nprf \ - device/google/zumapro/radio/config/default_metrics.xml:$(TARGET_COPY_OUT_VENDOR)/etc/modem/default_metrics.xml -# modem extensive logging config -PRODUCT_PACKAGES += \ - extensive_logging.conf -# Vendor modem extensive logging default property -PRODUCT_PROPERTY_OVERRIDES += \ - persist.vendor.modem.extensive_logging_enabled=false -endif - # Vibrator Diag PRODUCT_PACKAGES_DEBUG += \ diag-vibrator \ @@ -1027,12 +1061,22 @@ $(call soong_config_set,aoc,target_product,$(TARGET_PRODUCT)) # ## Audio properties +PRODUCT_PROPERTY_OVERRIDES += \ + persist.vendor.audio.cca.unsupported=false + PRODUCT_PROPERTY_OVERRIDES += \ ro.config.vc_call_vol_steps=7 \ - ro.config.media_vol_steps=25 \ ro.audio.monitorRotation = true \ ro.audio.offload_wakelock=false +ifneq (,$(OVERRIDE_MEDIA_VOLUME_STEPS)) +PRODUCT_PROPERTY_OVERRIDES += \ + ro.config.media_vol_steps=$(OVERRIDE_MEDIA_VOLUME_STEPS) +else +PRODUCT_PROPERTY_OVERRIDES += \ + ro.config.media_vol_steps=25 +endif + # vndservicemanager and vndservice no longer included in API 30+, however needed by vendor code. # See b/148807371 for reference PRODUCT_PACKAGES += vndservicemanager @@ -1081,7 +1125,9 @@ PRODUCT_SOONG_NAMESPACES += \ vendor/google_devices/zumapro/proprietary/gchips/tpu/darwinn_logging_service \ vendor/google_devices/zumapro/proprietary/gchips/tpu/nnapi_stable_aidl \ vendor/google_devices/zumapro/proprietary/gchips/tpu/aidl \ - vendor/google_devices/zumapro/proprietary/gchips/tpu/hal + vendor/google_devices/zumapro/proprietary/gchips/tpu/hal \ + vendor/google_devices/zumapro/proprietary/gchips/tpu/tachyon/api \ + vendor/google_devices/zumapro/proprietary/gchips/tpu/tachyon/service # TPU firmware PRODUCT_PACKAGES += edgetpu-rio.fw @@ -1124,16 +1170,6 @@ PRODUCT_PROPERTY_OVERRIDES += \ # Project include hardware/google/pixel/common/pixel-common-device.mk -# Pixel Logger -ifneq ($(BOARD_WITHOUT_RADIO),true) -include hardware/google/pixel/PixelLogger/PixelLogger.mk -else -BOARD_SEPOLICY_DIRS += hardware/google/pixel-sepolicy/logger_app -endif - -# sscoredump -include hardware/google/pixel/sscoredump/device.mk - # RadioExt Version USES_RADIOEXT_V1_7 = true @@ -1180,8 +1216,8 @@ PRODUCT_COPY_FILES += \ device/google/zumapro/telephony/sats2.dat:$(TARGET_COPY_OUT_VENDOR)/etc/telephony/sats2.dat # Touch service -include hardware/google/pixel/input/twoshay.mk include device/google/gs-common/touch/twoshay/aidl_zuma.mk +include device/google/gs-common/touch/twoshay/twoshay.mk PRODUCT_CHECK_VENDOR_SEAPP_VIOLATIONS := true @@ -1191,3 +1227,9 @@ PRODUCT_CHECK_DEV_TYPE_VIOLATIONS := true # TODO(b/322518837): Remove the property override once the flag is launched. PRODUCT_PROPERTY_OVERRIDES += \ debug.bugle.enable_emergency_satellite_messaging=true + +# Allow longer timeout for incident report generation in bugreport +# Overriding in /product partition instead of /vendor intentionally, +# since it can't be overridden from /vendor. +PRODUCT_PRODUCT_PROPERTIES += \ + dumpstate.strict_run=false diff --git a/device_framework_matrix_product.xml b/device_framework_matrix_product.xml index eb39013..59d5bf9 100644 --- a/device_framework_matrix_product.xml +++ b/device_framework_matrix_product.xml @@ -114,7 +114,7 @@ com.google.hardware.pixel.display - 10 + 12 IDisplay default diff --git a/dumpstate/dump_power.cpp b/dumpstate/dump_power.cpp index b44aa16..a5b4253 100644 --- a/dumpstate/dump_power.cpp +++ b/dumpstate/dump_power.cpp @@ -299,7 +299,8 @@ void dumpTcpc() { void dumpPdEngine() { const char* pdEngine [][2] { - {"PD Engine logbuffer", "/dev/logbuffer_usbpd"}, + {"TCPC logbuffer", "/dev/logbuffer_usbpd"}, + {"pogo_transport logbuffer", "/dev/logbuffer_pogo_transport"}, {"PPS-google_cpm logbuffer", "/dev/logbuffer_cpm"}, }; const char* ppsDcMsg = "PPS-dc logbuffer"; @@ -326,6 +327,7 @@ void dumpBatteryHealth() { {"TTF stats", "/sys/class/power_supply/battery/ttf_stats"}, {"aacr_state", "/sys/class/power_supply/battery/aacr_state"}, {"pairing_state", "/sys/class/power_supply/battery/pairing_state"}, + {"fwupdate", "/dev/logbuffer_max77779_fwupdate"} }; const char* maxqName = "maxq logbuffer"; @@ -475,6 +477,11 @@ void dumpChgUserDebug() { const std::string debugfs = "/d/"; const char *maxFgDir = "/d/maxfg"; const char *maxFgStrMatch = "maxfg"; + const char *maxBaseFgDir = "/d/maxfg_base"; + const char *maxBaseFgStrMatch = "maxfg_base"; + const char *maxSecFgDir = "/d/maxfg_secondary"; + const char *maxSecFgStrMatch = "maxfg_secondary"; + const char *max77779FgDir = "/d/max77779fg"; const char *maxFg77779StrMatch = "max77779fg"; const char *chgTblName = "Charging table dump"; const char *chgTblDir = "/d/google_battery/chg_raw_profile"; @@ -495,6 +502,11 @@ void dumpChgUserDebug() { "debug_registers", }; + const char *max1720xFgInfo [] { + "registers", + "nv_registers", + }; + if (isUserBuild()) return; @@ -504,10 +516,19 @@ void dumpChgUserDebug() { for (auto & directory : maxFgInfo) { printValuesOfDirectory(directory, debugfs, maxFgStrMatch); } - } else { + } else if (isValidDir(max77779FgDir)) { for (auto & directory : max77779FgInfo) { printValuesOfDirectory(directory, debugfs, maxFg77779StrMatch); } + } else if (isValidDir(maxBaseFgDir)) { + for (auto & directory : max77779FgInfo) { + printValuesOfDirectory(directory, debugfs, maxBaseFgStrMatch); + } + if (isValidDir(maxSecFgDir)) { + for (auto & directory : max1720xFgInfo) { + printValuesOfDirectory(directory, debugfs, maxSecFgStrMatch); + } + } } } @@ -755,6 +776,11 @@ void dumpMitigationDirs() { }; const int eraseCnt[] = {6, 6, 4, 0}; const bool useTitleRow[] = {true, true, true, false}; + const char *vimon_name = "vimon_buff"; + const char delimiter = '\n'; + const int vimon_len = strlen(vimon_name); + const double VIMON_VMULT = 7.8122e-5; + const double VIMON_IMULT = 7.8125e-4; std::vector files; std::string content; @@ -762,6 +788,9 @@ void dumpMitigationDirs() { std::string source; std::string subModuleName; std::string readout; + char *endptr; + + bool vimon_found = false; for (int i = 0; i < paramCount; i++) { printTitle(titles[i]); @@ -779,11 +808,40 @@ void dumpMitigationDirs() { readout = android::base::Trim(content); + if (strncmp(file.c_str(), vimon_name, vimon_len) == 0) + vimon_found = true; + subModuleName = std::string(file); subModuleName.erase(subModuleName.find(paramSuffix[i]), eraseCnt[i]); if (useTitleRow[i]) { printf("%s \t%s\n", subModuleName.c_str(), readout.c_str()); + } else if (vimon_found) { + + std::vector tokens; + std::istringstream tokenStream(readout); + std::string token; + + while (std::getline(tokenStream, token, delimiter)) { + tokens.push_back(token); + } + + bool oddEntry = true; + for (auto &hexval : tokens) { + int val = strtol(hexval.c_str(), &endptr, 16); + if (*endptr != '\0') { + printf("invalid vimon readout\n"); + break; + } + if (oddEntry) { + int vbatt = int(1000 * (val * VIMON_VMULT)); + printf("vimon vbatt: %d ", vbatt); + } else { + int ibatt = int(1000 * (val * VIMON_IMULT)); + printf("ibatt: %d\n", ibatt); + } + oddEntry = !oddEntry; + } } else { printf("%s=%s\n", subModuleName.c_str(), readout.c_str()); } @@ -827,6 +885,13 @@ void dumpIrqDurationCounts() { "s2mpg15-odpm/iio:device0/lpf_current", }; + const char *lpfCurrentDirsAlt[] = { + "/sys/devices/platform/acpm_mfd_bus@15500000/i2c-7/7-001f/s2mpg14-meter/" + "s2mpg14-odpm/iio:device0/lpf_current", + "/sys/devices/platform/acpm_mfd_bus@15510000/i2c-8/8-002f/s2mpg15-meter/" + "s2mpg15-odpm/iio:device1/lpf_current", + }; + bool titlesInitialized = false; std::vector channelNames; @@ -889,7 +954,9 @@ void dumpIrqDurationCounts() { } for (int i = 0; i < PWRWARN_MAX; i++) { - if (!android::base::ReadFileToString(lpfCurrentDirs[i], &content)) { + if (!android::base::ReadFileToString(lpfCurrentDirs[i], &content) && + !android::base::ReadFileToString(lpfCurrentDirsAlt[i], &content)) { + printf("Cannot find %s\n", lpfCurrentDirs[i]); continue; } @@ -927,8 +994,27 @@ void dumpIrqDurationCounts() { } channelNameSuffix = ""; + if (pmicSel >= PWRWARN_MAX) { + printf("invalid index: pmicSel >= pwrwarnCode size\n"); + return; + } + + if (i - offset >= pwrwarnCode[pmicSel].size()) { + printf("invalid index: i - offset >= pwrwarnCode size\n"); + return; + } code = pwrwarnCode[pmicSel][i - offset]; + + if (i - offset >= pwrwarnThreshold[pmicSel].size()) { + printf("invalid index: i - offset >= pwrwarnThreshold size\n"); + return; + } threshold = pwrwarnThreshold[pmicSel][i - offset]; + + if (i - offset >= lpfCurrentVals[pmicSel].size()) { + printf("invalid index: i - offset >= lpfCurrentVals size\n"); + return; + } current = lpfCurrentVals[pmicSel][i - offset]; } diff --git a/dumpstate/dump_power.rc b/dumpstate/dump_power.rc index 125ee4f..3ccc2f3 100644 --- a/dumpstate/dump_power.rc +++ b/dumpstate/dump_power.rc @@ -11,6 +11,9 @@ on init chown system system /dev/battery_history chmod 0644 /dev/battery_history + chown system system /dev/maxfg_history + chmod 0644 /dev/maxfg_history + # Charge stats (write 0) chown system system /sys/class/power_supply/battery/charge_stats @@ -100,11 +103,13 @@ on early-boot chown system system /dev/logbuffer_ttf chown system system /dev/logbuffer_tcpm chown system system /dev/logbuffer_usbpd + chown system system /dev/logbuffer_pogo_transport chown system system /dev/logbuffer_wireless chown system system /dev/logbuffer_pca9468 chown system system /dev/logbuffer_ln8411 chown system system /dev/logbuffer_cpm chown system system /dev/logbuffer_wc68 + chown system system /dev/logbuffer_max77779_fwupdate on property:sys.boot_completed=1 # gvotables for dumpstate diff --git a/factory/factory_post_boot/factory_post_boot.sh b/factory/factory_post_boot/factory_post_boot.sh index 82dfcfb..35b562b 100644 --- a/factory/factory_post_boot/factory_post_boot.sh +++ b/factory/factory_post_boot/factory_post_boot.sh @@ -1,4 +1,4 @@ #!/vendor/bin/sh # Add adbd to nnapi vendor cgroup. (b/222226268) -echo `pidof adbd` > /proc/vendor_sched/set_task_group_nnapi +echo `pidof adbd` > /proc/vendor_sched/groups/nnapi/set_task_group diff --git a/health/android.hardware.health-service.zumapro.xml b/health/android.hardware.health-service.zumapro.xml index 1fe9b8d..2acaaba 100644 --- a/health/android.hardware.health-service.zumapro.xml +++ b/health/android.hardware.health-service.zumapro.xml @@ -1,7 +1,7 @@ android.hardware.health - 2 + 3 IHealth/default diff --git a/manifest_media.xml b/manifest_media.xml index 195d587..18588a6 100644 --- a/manifest_media.xml +++ b/manifest_media.xml @@ -1,12 +1,13 @@ - - android.hardware.media.c2 - hwbinder - 1.2 - - IComponentStore - default - default1 - + + + android.hardware.media.c2 + 1 + IComponentStore/default1 + + + android.hardware.media.c2 + 1 + IComponentStore/default diff --git a/manifest_media_aosp.xml b/manifest_media_aosp.xml index 9a1a3db..2d1888b 100644 --- a/manifest_media_aosp.xml +++ b/manifest_media_aosp.xml @@ -1,4 +1,5 @@ + android.hardware.media.c2 hwbinder @@ -8,4 +9,10 @@ default + + + android.hardware.media.c2 + 1 + IComponentStore/default + diff --git a/media_codecs_aosp_c2.xml b/media_codecs_aosp_c2.xml index c1d4a89..ab61ca9 100644 --- a/media_codecs_aosp_c2.xml +++ b/media_codecs_aosp_c2.xml @@ -108,7 +108,7 @@ - + @@ -122,7 +122,7 @@ - + @@ -137,7 +137,7 @@ - + @@ -222,7 +222,7 @@ - + @@ -238,7 +238,7 @@ - + diff --git a/media_codecs_bo_c2.xml b/media_codecs_bo_c2.xml index 443c27e..f862dc3 100644 --- a/media_codecs_bo_c2.xml +++ b/media_codecs_bo_c2.xml @@ -19,7 +19,7 @@ - + @@ -34,7 +34,7 @@ - + @@ -52,15 +52,15 @@ - + - + - + diff --git a/media_codecs_performance_c2.xml b/media_codecs_performance_c2.xml index 118db0f..d72a962 100644 --- a/media_codecs_performance_c2.xml +++ b/media_codecs_performance_c2.xml @@ -115,29 +115,29 @@ - + - + - + - + - + - + - + - + - + - - - + + + @@ -169,7 +169,7 @@ - + diff --git a/modem_ml/modem_ml_models_user.conf b/modem_ml/modem_ml_nnapi_models_user.conf similarity index 100% rename from modem_ml/modem_ml_models_user.conf rename to modem_ml/modem_ml_nnapi_models_user.conf diff --git a/modem_ml/modem_ml_models_userdebug.conf b/modem_ml/modem_ml_nnapi_models_userdebug.conf similarity index 100% rename from modem_ml/modem_ml_models_userdebug.conf rename to modem_ml/modem_ml_nnapi_models_userdebug.conf diff --git a/modem_ml/modem_ml_tflite_models_user.conf b/modem_ml/modem_ml_tflite_models_user.conf new file mode 100644 index 0000000..9122b5e --- /dev/null +++ b/modem_ml/modem_ml_tflite_models_user.conf @@ -0,0 +1 @@ +#name,version,ml_type,compute_enable,compute_timer,train_enable,train_timer,monitor_enable_monitor_timer,use_nnapi,execution_preference,accelerator_name,allow_fp16_precision diff --git a/modem_ml/modem_ml_tflite_models_userdebug.conf b/modem_ml/modem_ml_tflite_models_userdebug.conf new file mode 100644 index 0000000..9122b5e --- /dev/null +++ b/modem_ml/modem_ml_tflite_models_userdebug.conf @@ -0,0 +1 @@ +#name,version,ml_type,compute_enable,compute_timer,train_enable,train_timer,monitor_enable_monitor_timer,use_nnapi,execution_preference,accelerator_name,allow_fp16_precision diff --git a/overlay/frameworks/base/core/res/res/values-mcc310/config.xml b/overlay/frameworks/base/core/res/res/values-mcc310/config.xml new file mode 100644 index 0000000..6a8c43b --- /dev/null +++ b/overlay/frameworks/base/core/res/res/values-mcc310/config.xml @@ -0,0 +1,25 @@ + + + + + + + true + + diff --git a/overlay/frameworks/base/core/res/res/values-mcc311/config.xml b/overlay/frameworks/base/core/res/res/values-mcc311/config.xml new file mode 100644 index 0000000..6a8c43b --- /dev/null +++ b/overlay/frameworks/base/core/res/res/values-mcc311/config.xml @@ -0,0 +1,25 @@ + + + + + + + true + + diff --git a/overlay/frameworks/base/core/res/res/values-mcc312/config.xml b/overlay/frameworks/base/core/res/res/values-mcc312/config.xml new file mode 100644 index 0000000..6a8c43b --- /dev/null +++ b/overlay/frameworks/base/core/res/res/values-mcc312/config.xml @@ -0,0 +1,25 @@ + + + + + + + true + + diff --git a/overlay/frameworks/base/core/res/res/values-mcc313/config.xml b/overlay/frameworks/base/core/res/res/values-mcc313/config.xml new file mode 100644 index 0000000..6a8c43b --- /dev/null +++ b/overlay/frameworks/base/core/res/res/values-mcc313/config.xml @@ -0,0 +1,25 @@ + + + + + + + true + + diff --git a/overlay/frameworks/base/core/res/res/values-mcc314/config.xml b/overlay/frameworks/base/core/res/res/values-mcc314/config.xml new file mode 100644 index 0000000..6a8c43b --- /dev/null +++ b/overlay/frameworks/base/core/res/res/values-mcc314/config.xml @@ -0,0 +1,25 @@ + + + + + + + true + + diff --git a/overlay/frameworks/base/core/res/res/values-mcc315/config.xml b/overlay/frameworks/base/core/res/res/values-mcc315/config.xml new file mode 100644 index 0000000..6a8c43b --- /dev/null +++ b/overlay/frameworks/base/core/res/res/values-mcc315/config.xml @@ -0,0 +1,25 @@ + + + + + + + true + + diff --git a/overlay/frameworks/base/core/res/res/values-mcc316/config.xml b/overlay/frameworks/base/core/res/res/values-mcc316/config.xml new file mode 100644 index 0000000..6a8c43b --- /dev/null +++ b/overlay/frameworks/base/core/res/res/values-mcc316/config.xml @@ -0,0 +1,25 @@ + + + + + + + true + + diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index ffbbf72..f6b7439 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -227,12 +227,12 @@ - "gsm,8" + "gsm,9" "utran,9" - "eutran,15" - "nrepc,15" - "nr5gc,15" - "eutran5gc,15" + "eutran,16" + "nrepc,16" + "nr5gc,16" + "eutran5gc,16" @@ -251,8 +251,8 @@ true - - true + + 6291456 + + 100% @@ -416,6 +423,55 @@ 2050 + + + 0.5 + 0.6 + 0.9 + + + + + 100 + 100 + 40 + 10 + + + + + 200 + 200 + 200 + 200 + + 90198 @@ -441,7 +497,13 @@ will move to IDLE state. This timeout duration is used for satellite with NB IOT radio technologies. --> - 900000 + 2147483647 + + + 2147483647 - 900000 + 180000 + + + com.google.android.apps.stargate;com.google.android.apps.stargate.questionnaire.QuestionnaireHomeActivity + + + com.google.android.apps.stargate.ACTION_ESOS_QUESTIONNAIRE diff --git a/overlay/packages/apps/Settings/res/values/arrays.xml b/overlay/packages/apps/Settings/res/values/arrays.xml new file mode 100644 index 0000000..de6fd5c --- /dev/null +++ b/overlay/packages/apps/Settings/res/values/arrays.xml @@ -0,0 +1,22 @@ + + + + + + + com.google.android.apps.scone + + \ No newline at end of file diff --git a/pixelstats/pixelstats-vendor.zumapro.rc b/pixelstats/pixelstats-vendor.zumapro.rc index 5993978..aca60f7 100644 --- a/pixelstats/pixelstats-vendor.zumapro.rc +++ b/pixelstats/pixelstats-vendor.zumapro.rc @@ -1,7 +1,8 @@ on property:sys.boot_completed=1 chown system system /sys/class/power_supply/max77779fg/fg_learning_events + chown system system /sys/class/power_supply/max77779fg/fg_abnormal_events chown system system /sys/class/power_supply/maxfg_base/fg_learning_events - chown system system /sys/devices/platform/maxim,max77779fwu/update_stats + chown system system /sys/devices/platform/maxim,max77779fwu/update_stats start vendor.pixelstats_vendor on post-fs-data chown system system /sys/kernel/metrics/irq/stats_reset @@ -9,4 +10,4 @@ service vendor.pixelstats_vendor /vendor/bin/pixelstats-vendor class hal user system group system context_hub readproc - disabled \ No newline at end of file + disabled diff --git a/pixelstats/service.cpp b/pixelstats/service.cpp index 690ac75..e76a4d6 100644 --- a/pixelstats/service.cpp +++ b/pixelstats/service.cpp @@ -64,6 +64,14 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = { .LongIRQMetricsPath = "/sys/kernel/metrics/irq/long_irq_metrics", .StormIRQMetricsPath = "/sys/kernel/metrics/irq/storm_irq_metrics", .IRQStatsResetPath = "/sys/kernel/metrics/irq/stats_reset", + .ThermalStatsPaths = { + "/sys/devices/platform/100a0000.BIG/trip_counter", + "/sys/devices/platform/100a0000.MID/trip_counter", + "/sys/devices/platform/100a0000.LITTLE/trip_counter", + "/sys/devices/platform/100b0000.G3D/trip_counter", + "/sys/devices/platform/100b0000.TPU/trip_counter", + "/sys/devices/platform/100b0000.AUR/trip_counter", + }, .TempResidencyAndResetPaths = { { "/sys/kernel/metrics/thermal/tr_by_group/tmu/stats", @@ -80,6 +88,16 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = { "/sys/class/power_supply/max77779fg/gmsr", "/sys/class/power_supply/maxfg_base/gmsr", }, + .FGModelLoadingPath = { + "/sys/class/power_supply/max77779fg/model_state", + "/sys/class/power_supply/maxfg_base/model_state" + }, + .FGLogBufferPath = { + "/dev/logbuffer_maxfg_monitor", + "/dev/logbuffer_max77779fg_monitor", + "/dev/logbuffer_maxfg_base_monitor", + "/dev/logbuffer_maxfg_secondary_monitor" + }, .PDMStatePath = "/sys/devices/platform/audiometrics/pdm_state", .WavesPath = "/sys/devices/platform/audiometrics/waves", .AdaptedInfoCountPath = "/sys/devices/platform/audiometrics/adapted_info_active_count", @@ -90,20 +108,39 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = { .TotalCallCountPath = "/sys/devices/platform/audiometrics/call_count", .OffloadEffectsIdPath = "/sys/devices/platform/audiometrics/offload_effects_id", .OffloadEffectsDurationPath = "/sys/devices/platform/audiometrics/offload_effects_duration", - .BluetoothAudioUsagePath = "/sys/devices/platform/audiometrics/bt_usage" + .BluetoothAudioUsagePath = "/sys/devices/platform/audiometrics/bt_usage", + .DisplayPortStatsPaths = { + "/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/link_negotiation_failures", + "/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/edid_read_failures", + "/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/dpcd_read_failures", + "/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/edid_invalid_failures", + "/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/sink_count_invalid_failures", + "/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/link_unstable_failures", + }, + .HDCPStatsPaths = { + "/sys/devices/platform/hdcp/hdcp2_success_count", + "/sys/devices/platform/hdcp/hdcp2_fallback_count", + "/sys/devices/platform/hdcp/hdcp2_fail_count", + "/sys/devices/platform/hdcp/hdcp1_success_count", + "/sys/devices/platform/hdcp/hdcp1_fail_count", + "/sys/devices/platform/hdcp/hdcp0_count", + }, + .DisplayStatsPaths = { + "/sys/devices/platform/exynos-drm/primary-panel/error_count_te", + "/sys/devices/platform/exynos-drm/primary-panel/error_count_unknown", + "/sys/devices/platform/exynos-drm/secondary-panel/error_count_te", + "/sys/devices/platform/exynos-drm/secondary-panel/error_count_unknown", + }, + .SpeakerVersionPath = "/sys/devices/platform/audiometrics/speaker_version" }; const struct UeventListener::UeventPaths ueventPaths = { .AudioUevent = "/devices/virtual/amcs/amcs", .TypeCPartnerUevent = "PRODUCT_TYPE=", - .FGLearningPath = { - "/sys/class/power_supply/max77779fg/fg_learning_events", - "/sys/class/power_supply/maxfg_base/fg_learning_events" - }, .FwUpdatePath = "/sys/devices/platform/maxim,max77779fwu/update_stats", - .FGModelLoadingPath = { - "/sys/class/power_supply/max77779fg/model_state", - "/sys/class/power_supply/maxfg_base/model_state" + .FGAbnlPath = { + "/dev/logbuffer_max77779fg_monitor", + "/dev/logbuffer_maxfg_base_monitor", } }; diff --git a/powerstats/ZumaProCommonDataProviders.cpp b/powerstats/ZumaProCommonDataProviders.cpp index 31c3b37..4bd3559 100644 --- a/powerstats/ZumaProCommonDataProviders.cpp +++ b/powerstats/ZumaProCommonDataProviders.cpp @@ -365,7 +365,7 @@ void addGPU(std::shared_ptr p) { {"890000", 4333}}; p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterAndAttrConsumer(p, - EnergyConsumerType::OTHER, "GPU", {"S2S_VDD_G3D", "S8S_VDD_G3D_L2"}, + EnergyConsumerType::OTHER, "GPU", {"S2S_VDD_G3D"}, {{UID_TIME_IN_STATE, path + "/uid_time_in_state"}}, stateCoeffs)); @@ -475,6 +475,24 @@ void addPCIe(std::shared_ptr p) { p->addStateResidencyDataProvider(std::make_unique( "/sys/devices/platform/13120000.pcie/power_stats", pcieWifiCfgs)); + + // Add PCIe Modem GEN + const GenericStateResidencyDataProvider::StateResidencyConfig modemGenStateConfig = { + .entryCountSupported = true, + .entryCountPrefix = "count:", + .totalTimeSupported = true, + .totalTimePrefix = "duration msec:", + }; + const std::vector> modemGenStateHeaders = { + std::make_pair("GEN1", "Gen1:"), + std::make_pair("GEN3", "Gen3:"), + }; + const std::vector modemGenCfgs = { + {generateGenericStateResidencyConfigs(modemGenStateConfig, modemGenStateHeaders), + "PCIe-Modem-GEN", "link_speed:"} + }; + p->addStateResidencyDataProvider(std::make_unique( + "/sys/devices/platform/12100000.pcie/link_duration", modemGenCfgs)); } void addWifi(std::shared_ptr p) { @@ -620,12 +638,15 @@ void addTPU(std::shared_ptr p) { stateCoeffs = { // TODO (b/197721618): Measuring the TPU power numbers {"226000", 10}, - {"627000", 20}, - {"845000", 30}, - {"1066000", 40}}; + {"455000", 20}, + {"627000", 30}, + {"712000", 40}, + {"845000", 50}, + {"967000", 60}, // Do not change to 1066000 + {"1119000", 70}}; p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterAndAttrConsumer(p, - EnergyConsumerType::OTHER, "TPU", {"S10M_VDD_TPU"}, + EnergyConsumerType::OTHER, "TPU", {"S7M_VDD_TPU"}, {{UID_TIME_IN_STATE, "/sys/class/edgetpu/edgetpu-soc/device/tpu_usage"}}, stateCoeffs)); } @@ -636,12 +657,19 @@ void addTPU(std::shared_ptr p) { * that live in user space. Entities are defined here and user space clients of this provider's * vendor service register callbacks to provide state residency data for their given pwoer entity. */ -void addPixelStateResidencyDataProvider(std::shared_ptr p) { +void addPixelStateResidencyDataProvider(std::shared_ptr p, std::string displayName) { auto pixelSdp = std::make_unique(); + // Bluetooth power stats are provided by BT HAL callback pixelSdp->addEntity("Bluetooth", {{0, "Idle"}, {1, "Active"}, {2, "Tx"}, {3, "Rx"}}); + // Display VRR power stats are provided by HWC callback. If display entity + // name is empty, the device doesn't support VRR power stats. + if (!displayName.empty()) { + pixelSdp->addEntity(displayName, {}); + } + pixelSdp->start(); p->addStateResidencyDataProvider(std::move(pixelSdp)); @@ -660,7 +688,6 @@ void addZumaProCommonDataProviders(std::shared_ptr p) { setEnergyMeter(p); addAoC(p); - addPixelStateResidencyDataProvider(p); addCPUclusters(p); addSoC(p); addGNSS(p); diff --git a/powerstats/include/ZumaProCommonDataProviders.h b/powerstats/include/ZumaProCommonDataProviders.h index 6e94533..4f1696f 100644 --- a/powerstats/include/ZumaProCommonDataProviders.h +++ b/powerstats/include/ZumaProCommonDataProviders.h @@ -31,7 +31,7 @@ void addGPU(std::shared_ptr p); void addMobileRadio(std::shared_ptr p); void addNFC(std::shared_ptr p); void addPCIe(std::shared_ptr p); -void addPixelStateResidencyDataProvider(std::shared_ptr p); +void addPixelStateResidencyDataProvider(std::shared_ptr p, std::string displayName); void addPowerDomains(std::shared_ptr p); void addSoC(std::shared_ptr p); void addTPU(std::shared_ptr p); diff --git a/radio/Android.bp b/radio/Android.bp new file mode 100644 index 0000000..0657c3a --- /dev/null +++ b/radio/Android.bp @@ -0,0 +1,72 @@ +// +// Copyright (C) 2023 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "//device/google/zuma:device_google_zuma_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: [ + "//device/google/zumapro:device_google_zumapro_license", + ], +} +prebuilt_etc { + name: "logging.conf", + vendor: true, + proprietary: true, + src: "config/logging.conf", + relative_install_path: "modem" +} + +prebuilt_etc { + name: "default.cfg", + vendor: true, + proprietary: true, + src: "config/default.cfg", + relative_install_path: "modem" +} + +prebuilt_etc { + name: "default.nprf", + vendor: true, + proprietary: true, + src: "config/default.nprf", + relative_install_path: "modem" +} + +prebuilt_etc { + name: "default_metrics.xml", + vendor: true, + proprietary: true, + src: "config/default_metrics.xml", + relative_install_path: "modem" +} + +prebuilt_etc { + name: "Pixel_stability.cfg", + vendor: true, + proprietary: true, + src: "config/Pixel_stability.cfg", + relative_install_path: "modem" +} + +prebuilt_etc { + name: "Pixel_stability.nprf", + vendor: true, + proprietary: true, + src: "config/Pixel_stability.nprf", + relative_install_path: "modem" +} diff --git a/radio/config/Pixel_stability.cfg b/radio/config/Pixel_stability.cfg new file mode 100644 index 0000000..dcc0a63 --- /dev/null +++ b/radio/config/Pixel_stability.cfg @@ -0,0 +1 @@ +Pixel_stability.nprf,default_metrics.xml \ No newline at end of file diff --git a/radio/config/Pixel_stability.nprf b/radio/config/Pixel_stability.nprf new file mode 100644 index 0000000..abbcba0 Binary files /dev/null and b/radio/config/Pixel_stability.nprf differ diff --git a/radio/config/default.nprf b/radio/config/default.nprf index 34afa50..c0715c7 100644 Binary files a/radio/config/default.nprf and b/radio/config/default.nprf differ diff --git a/telephony/sats2.dat b/telephony/sats2.dat index 0e8ecec..577b7af 100644 Binary files a/telephony/sats2.dat and b/telephony/sats2.dat differ diff --git a/usb/gadget/UsbGadget.h b/usb/gadget/UsbGadget.h index eac32a4..28a9a67 100644 --- a/usb/gadget/UsbGadget.h +++ b/usb/gadget/UsbGadget.h @@ -80,7 +80,7 @@ static MonitorFfs monitorFfs(kGadgetName); #define SPEED_PATH UDC_PATH "current_speed" -#define BIG_CORE "8" +#define BIG_CORE "7" #define MEDIUM_CORE "4" #define POWER_SUPPLY_PATH "/sys/class/power_supply/usb/" diff --git a/usb/usb/Android.bp b/usb/usb/Android.bp index 3be3369..20ba592 100644 --- a/usb/usb/Android.bp +++ b/usb/usb/Android.bp @@ -40,6 +40,7 @@ cc_binary { "libbinder", "libhidlbase", "liblog", + "libusbhost", "libutils", "libhardware", "android.hardware.thermal@1.0", @@ -54,6 +55,7 @@ cc_binary { "libbinder_ndk", "libprotobuf-cpp-lite", "server_configurable_flags", + "libaconfig_storage_read_api_cc", ], static_libs: [ "libpixelusb-aidl", diff --git a/usb/usb/Usb.cpp b/usb/usb/Usb.cpp index 74686e5..d8afb80 100644 --- a/usb/usb/Usb.cpp +++ b/usb/usb/Usb.cpp @@ -23,10 +23,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -37,6 +39,7 @@ #include #include #include +#include #include "Usb.h" @@ -58,6 +61,8 @@ using android::hardware::google::pixel::getStatsService; using android::hardware::google::pixel::PixelAtoms::VendorUsbPortOverheat; using android::hardware::google::pixel::reportUsbPortOverheat; using android::hardware::google::pixel::usb::getI2cClientPath; +using android::String8; +using android::Vector; namespace aidl { namespace android { @@ -116,6 +121,15 @@ void queryVersionHelper(android::hardware::usb::Usb *usb, AltModeData::DisplayPortAltModeData constructAltModeData(string hpd, string pin_assignment, string link_status, string vdo); +#define CTRL_TRANSFER_TIMEOUT_MSEC 1000 +#define GL852G_VENDOR_ID 0x05e3 +#define GL852G_PRODUCT_ID1 0x0608 +#define GL852G_PRODUCT_ID2 0x0610 +#define GL852G_VENDOR_CMD_REQ 0xe3 +// GL852G port 1 and port 2 JK level default settings +#define GL852G_VENDOR_CMD_VALUE_DEFAULT 0x0008 +#define GL852G_VENDOR_CMD_INDEX_DEFAULT 0x0407 + ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable, int64_t in_transactionId) { bool result = true; @@ -510,6 +524,61 @@ void updatePortStatus(android::hardware::usb::Usb *usb) { queryVersionHelper(usb, ¤tPortStatus); } +static int usbDeviceRemoved(const char *devname, void* client_data) { + return 0; +} + +static int usbDeviceAdded(const char *devname, void* client_data) { + uint16_t vendorId, productId; + struct usb_device *device; + ::aidl::android::hardware::usb::Usb *usb; + int value, index; + + device = usb_device_open(devname); + if (!device) { + ALOGE("usb_device_open failed\n"); + return 0; + } + + usb = (::aidl::android::hardware::usb::Usb *)client_data; + value = usb->mUsbHubVendorCmdValue; + index = usb->mUsbHubVendorCmdIndex; + + // The vendor cmd only applies to USB Hubs of Genesys Logic, Inc. + // The request field of vendor cmd is fixed to 0xe3. + vendorId = usb_device_get_vendor_id(device); + productId = usb_device_get_product_id(device); + if (vendorId == GL852G_VENDOR_ID && + (productId == GL852G_PRODUCT_ID1 || productId == GL852G_PRODUCT_ID2)) { + int ret = usb_device_control_transfer(device, + USB_DIR_OUT | USB_TYPE_VENDOR, GL852G_VENDOR_CMD_REQ, value, index, + NULL, 0, CTRL_TRANSFER_TIMEOUT_MSEC); + ALOGI("USB hub vendor cmd %s (wValue 0x%x, wIndex 0x%x, return %d)\n", + ret? "failed" : "succeeded", value, index, ret); + } + + usb_device_close(device); + + return 0; +} + +void *usbHostWork(void *param) { + struct usb_host_context *ctx; + + ALOGI("creating USB host thread\n"); + + ctx = usb_host_init(); + if (!ctx) { + ALOGE("usb_host_init failed\n"); + return NULL; + } + + // This will never return, it will keep monitoring USB sysfs inotify events + usb_host_run(ctx, usbDeviceAdded, usbDeviceRemoved, NULL, param); + + return NULL; +} + Usb::Usb() : mLock(PTHREAD_MUTEX_INITIALIZER), mRoleSwitchLock(PTHREAD_MUTEX_INITIALIZER), @@ -531,7 +600,9 @@ Usb::Usb() mDisplayPortPollRunning(false), mDisplayPortPollStarting(false), mDisplayPortCVLock(PTHREAD_MUTEX_INITIALIZER), - mDisplayPortLock(PTHREAD_MUTEX_INITIALIZER) { + mDisplayPortLock(PTHREAD_MUTEX_INITIALIZER), + mUsbHubVendorCmdValue(GL852G_VENDOR_CMD_VALUE_DEFAULT), + mUsbHubVendorCmdIndex(GL852G_VENDOR_CMD_INDEX_DEFAULT) { pthread_condattr_t attr; if (pthread_condattr_init(&attr)) { ALOGE("pthread_condattr_init failed: %s", strerror(errno)); @@ -568,6 +639,10 @@ Usb::Usb() ALOGE("mDisplayPortActivateTimer timerfd failed: %s", strerror(errno)); abort(); } + if (pthread_create(&mUsbHost, NULL, usbHostWork, this)) { + ALOGE("pthread creation failed %d\n", errno); + abort(); + } ALOGI("feature flag enable_usb_data_compliance_warning: %d", usb_flags::enable_usb_data_compliance_warning()); @@ -597,6 +672,11 @@ ScopedAStatus Usb::switchRole(const string& in_portName, const PortRole& in_role fp = fopen(filename.c_str(), "w"); if (fp != NULL) { int ret = fputs(convertRoletoString(in_role).c_str(), fp); + if (ret == EAGAIN) { + ALOGI("role switch busy, retry in %d ms", ROLE_SWAP_RETRY_MS); + std::this_thread::sleep_for(std::chrono::milliseconds(ROLE_SWAP_RETRY_MS)); + ret = fputs(convertRoletoString(in_role).c_str(), fp); + } fclose(fp); if ((ret != EOF) && ReadFileToString(filename, &written)) { written = Trim(written); @@ -853,7 +933,7 @@ Status getPortStatusHelper(android::hardware::usb::Usb *usb, PortRole currentRole; currentRole.set(PortPowerRole::NONE); - if (getCurrentRoleHelper(port.first, port.second, ¤tRole) == Status::SUCCESS){ + if (getCurrentRoleHelper(port.first, port.second, ¤tRole) == Status::SUCCESS) { (*currentPortStatus)[i].currentPowerRole = currentRole.get(); } else { ALOGE("Error while retrieving portNames"); @@ -1749,8 +1829,10 @@ void *displayPortPollWork(void *param) { std::vector currentPortStatus; ret = read(usb->mDisplayPortDebounceTimer, &res, sizeof(res)); ALOGI("usbdp: dp debounce triggered, val:%lu ret:%d", res, ret); - if (ret < 0) - ALOGE("usbdp: debounce read errno:%d", errno); + if (ret < 0) { + ALOGW("usbdp: debounce read error:%d", errno); + continue; + } queryVersionHelper(usb, ¤tPortStatus); } else if (events[n].data.fd == usb->mDisplayPortActivateTimer) { string activePartner, activePort; @@ -1801,6 +1883,7 @@ void *displayPortPollWork(void *param) { error: /* Need to disarm so new threads don't get old event */ + armTimerFdHelper(usb->mDisplayPortDebounceTimer, 0); armTimerFdHelper(usb->mDisplayPortActivateTimer, 0); close(link_training_status_fd); link_training_status_fd_error: @@ -1936,6 +2019,47 @@ void Usb::shutdownDisplayPortPoll(bool force) { } } +status_t Usb::handleShellCommand(int in, int out, int err, const char** argv, + uint32_t argc) { + uid_t uid = AIBinder_getCallingUid(); + if (uid != AID_ROOT && uid != AID_SHELL) { + return ::android::PERMISSION_DENIED; + } + + Vector utf8Args; + utf8Args.setCapacity(argc); + for (uint32_t i = 0; i < argc; i++) { + utf8Args.push(String8(argv[i])); + } + + if (argc >= 1) { + if (!utf8Args[0].compare(String8("hub-vendor-cmd"))) { + if (utf8Args.size() < 3) { + dprintf(out, "Incorrect number of argument supplied\n"); + return ::android::UNKNOWN_ERROR; + } + int value, index; + if (!::android::base::ParseInt(utf8Args[1].c_str(), &value) || + !::android::base::ParseInt(utf8Args[2].c_str(), &index)) { + dprintf(out, "Fail to parse arguments\n"); + return ::android::UNKNOWN_ERROR; + } + mUsbHubVendorCmdValue = value; + mUsbHubVendorCmdIndex = index; + ALOGI("USB hub vendor cmd update (wValue 0x%x, wIndex 0x%x)\n", + mUsbHubVendorCmdValue, mUsbHubVendorCmdIndex); + return ::android::NO_ERROR; + } + } + + dprintf(out, "usage: adb shell cmd hub-vendor-cmd VALUE INDEX\n" + " VALUE wValue field in hex format, e.g. 0xf321\n" + " INDEX wIndex field in hex format, e.g. 0xf321\n" + " The settings take effect next time the hub is enabled\n"); + + return ::android::NO_ERROR; +} + } // namespace usb } // namespace hardware } // namespace android diff --git a/usb/usb/Usb.h b/usb/usb/Usb.h index 4ac6a44..8f0c3a0 100644 --- a/usb/usb/Usb.h +++ b/usb/usb/Usb.h @@ -55,6 +55,7 @@ using ::android::hardware::google::pixel::usb::ZoneInfo; using ::android::hardware::thermal::V2_0::TemperatureType; using ::android::hardware::thermal::V2_0::ThrottlingSeverity; using ::android::sp; +using ::android::status_t; using ::ndk::ScopedAStatus; using ::std::shared_ptr; using ::std::string; @@ -79,6 +80,7 @@ constexpr char kGadgetName[] = "11210000.dwc3"; #define DISPLAYPORT_IRQ_HPD_COUNT_CHECK 3 #define DISPLAYPORT_POLL_WAIT_MS 100 +#define ROLE_SWAP_RETRY_MS 700 #define SVID_DISPLAYPORT "ff01" #define SVID_THUNDERBOLT "8087" @@ -97,7 +99,7 @@ struct Usb : public BnUsb { ScopedAStatus enableUsbDataWhileDocked(const string& in_portName, int64_t in_transactionId) override; ScopedAStatus limitPowerTransfer(const string& in_portName, bool in_limit, - int64_t in_transactionId) override; + int64_t in_transactionId) override; ScopedAStatus resetUsbPort(const string& in_portName, int64_t in_transactionId) override; Status getDisplayPortUsbPathHelper(string *path); @@ -108,6 +110,8 @@ struct Usb : public BnUsb { void setupDisplayPortPoll(); void shutdownDisplayPortPollHelper(); void shutdownDisplayPortPoll(bool force); + status_t handleShellCommand(int in, int out, int err, const char** argv, + uint32_t argc) override; std::shared_ptr<::aidl::android::hardware::usb::IUsbCallback> mCallback; // Protects mCallback variable @@ -164,10 +168,15 @@ struct Usb : public BnUsb { */ bool mPartnerSupportsDisplayPort; + // Usb hub vendor command settings for JK level tuning + int mUsbHubVendorCmdValue; + int mUsbHubVendorCmdIndex; + private: pthread_t mPoll; pthread_t mDisplayPortPoll; pthread_t mDisplayPortShutdownHelper; + pthread_t mUsbHost; }; } // namespace usb diff --git a/usb/usb/android.hardware.usb-service-i2c11.rc b/usb/usb/android.hardware.usb-service-i2c11.rc index 76e3e60..ba3e657 100644 --- a/usb/usb/android.hardware.usb-service-i2c11.rc +++ b/usb/usb/android.hardware.usb-service-i2c11.rc @@ -1,7 +1,7 @@ service vendor.usb /vendor/bin/hw/android.hardware.usb-service class hal user system - group system shell wakelock + group system shell wakelock usb capabilities WAKE_ALARM BLOCK_SUSPEND on post-fs diff --git a/usb/usb/android.hardware.usb-service-i2c6.rc b/usb/usb/android.hardware.usb-service-i2c6.rc index 18869e2..5caed19 100644 --- a/usb/usb/android.hardware.usb-service-i2c6.rc +++ b/usb/usb/android.hardware.usb-service-i2c6.rc @@ -1,7 +1,7 @@ service vendor.usb /vendor/bin/hw/android.hardware.usb-service class hal user system - group system shell wakelock + group system shell wakelock usb capabilities WAKE_ALARM BLOCK_SUSPEND on post-fs