Merge 24Q4 (ab/12406339) into aosp-main-future

Bug: 370570306
Merged-In: I57bbf91eb9ce9c35a103cfc54f9a6f2002eba54a
Change-Id: If6fbe780861ff224296983e789285ab19679b83e
This commit is contained in:
Xin Li 2024-11-06 10:31:18 -08:00
commit 1226602095
22 changed files with 513 additions and 420 deletions

View file

@ -221,12 +221,30 @@ ifdef RELEASE_SVN_FELIX
TARGET_SVN ?= $(RELEASE_SVN_FELIX) TARGET_SVN ?= $(RELEASE_SVN_FELIX)
else else
# Set this for older releases that don't use build flag # Set this for older releases that don't use build flag
TARGET_SVN ?= 54 TARGET_SVN ?= 55
endif endif
PRODUCT_VENDOR_PROPERTIES += \ PRODUCT_VENDOR_PROPERTIES += \
ro.vendor.build.svn=$(TARGET_SVN) ro.vendor.build.svn=$(TARGET_SVN)
# Set device family property for SMR
PRODUCT_PROPERTY_OVERRIDES += \
ro.build.device_family=F10
# Set build properties for SMR builds
ifeq ($(RELEASE_IS_SMR), true)
ifneq (,$(RELEASE_BASE_OS_FELIX))
PRODUCT_BASE_OS := $(RELEASE_BASE_OS_FELIX)
endif
endif
# Set build properties for EMR builds
ifeq ($(RELEASE_IS_EMR), true)
ifneq (,$(RELEASE_BASE_OS_FELIX))
PRODUCT_PROPERTY_OVERRIDES += \
ro.build.version.emergency_base_os=$(RELEASE_BASE_OS_FELIX)
endif
endif
# Vibrator HAL # Vibrator HAL
$(call soong_config_set,haptics,kernel_ver,v$(subst .,_,$(TARGET_LINUX_KERNEL_VERSION))) $(call soong_config_set,haptics,kernel_ver,v$(subst .,_,$(TARGET_LINUX_KERNEL_VERSION)))
PRODUCT_VENDOR_PROPERTIES +=\ PRODUCT_VENDOR_PROPERTIES +=\
@ -236,6 +254,10 @@ PRODUCT_VENDOR_PROPERTIES +=\
persist.vendor.vibrator.hal.chirp.enabled=0 persist.vendor.vibrator.hal.chirp.enabled=0
ACTUATOR_MODEL := luxshare_ict_lt_xlra1906d ACTUATOR_MODEL := luxshare_ict_lt_xlra1906d
# Override Output Distortion Gain
PRODUCT_VENDOR_PROPERTIES += \
vendor.audio.hapticgenerator.distortion.output.gain=0.52
# Fingerprint # Fingerprint
include device/google/gs101/fingerprint/fpc1540/sw42/fpc1540.mk include device/google/gs101/fingerprint/fpc1540/sw42/fpc1540.mk
FPC_MODULE_TYPE=1542_C FPC_MODULE_TYPE=1542_C
@ -286,14 +308,26 @@ PRODUCT_COPY_FILES += \
# Location # Location
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
device/google/felix/location/gps.xml.f10:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/gps.xml \
device/google/felix/location/lhd.conf.f10:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/lhd.conf \ device/google/felix/location/lhd.conf.f10:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/lhd.conf \
device/google/felix/location/scd.conf.f10:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/scd.conf device/google/felix/location/scd.conf.f10:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/scd.conf
ifneq (,$(filter 6.1, $(TARGET_LINUX_KERNEL_VERSION)))
PRODUCT_COPY_FILES += \
device/google/felix/location/gps.6.1.xml.f10:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/gps.xml
else
PRODUCT_COPY_FILES += \
device/google/felix/location/gps.xml.f10:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/gps.xml
endif
else else
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
device/google/felix/location/gps_user.xml.f10:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/gps.xml \
device/google/felix/location/lhd_user.conf.f10:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/lhd.conf \ device/google/felix/location/lhd_user.conf.f10:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/lhd.conf \
device/google/felix/location/scd_user.conf.f10:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/scd.conf device/google/felix/location/scd_user.conf.f10:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/scd.conf
ifneq (,$(filter 6.1, $(TARGET_LINUX_KERNEL_VERSION)))
PRODUCT_COPY_FILES += \
device/google/felix/location/gps_user.6.1.xml.f10:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/gps.xml
else
PRODUCT_COPY_FILES += \
device/google/felix/location/gps_user.xml.f10:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/gps.xml
endif
endif endif
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
@ -389,7 +423,7 @@ PRODUCT_COPY_FILES += \
# LE Audio Unicast Allowlist # LE Audio Unicast Allowlist
PRODUCT_PRODUCT_PROPERTIES += \ PRODUCT_PRODUCT_PROPERTIES += \
persist.bluetooth.leaudio.allow_list=SM-R510 persist.bluetooth.leaudio.allow_list=SM-R510,WF-1000XM5
# Bluetooth EWP test tool # Bluetooth EWP test tool
PRODUCT_PACKAGES_DEBUG += \ PRODUCT_PACKAGES_DEBUG += \
@ -412,3 +446,7 @@ PRODUCT_PACKAGES += \
NoCutoutOverlay \ NoCutoutOverlay \
AvoidAppsInCutoutOverlay AvoidAppsInCutoutOverlay
# Bluetooth device id
# Felix: 0x410C
PRODUCT_PRODUCT_PROPERTIES += \
bluetooth.device_id.product_id=16652

View file

@ -1,7 +1,7 @@
<compatibility-matrix version="1.0" type="framework" level="7"> <compatibility-matrix version="1.0" type="framework" level="7">
<hal format="aidl" optional="true"> <hal format="aidl" optional="true">
<name>com.google.hardware.pixel.display</name> <name>com.google.hardware.pixel.display</name>
<version>12</version> <version>13</version>
<interface> <interface>
<name>IDisplay</name> <name>IDisplay</name>
<instance>secondary</instance> <instance>secondary</instance>

View file

@ -39,6 +39,7 @@ USES_IDISPLAY_INTF_SEC := true
include device/google/gs201/BoardConfig-common.mk include device/google/gs201/BoardConfig-common.mk
-include vendor/google_devices/gs201/prebuilts/BoardConfigVendor.mk -include vendor/google_devices/gs201/prebuilts/BoardConfigVendor.mk
include device/google/gs-common/check_current_prebuilt/check_current_prebuilt.mk
-include vendor/google_devices/felix/proprietary/BoardConfigVendor.mk -include vendor/google_devices/felix/proprietary/BoardConfigVendor.mk
include device/google/felix-sepolicy/felix-sepolicy.mk include device/google/felix-sepolicy/felix-sepolicy.mk
include device/google/felix/wifi/BoardConfig-wifi.mk include device/google/felix/wifi/BoardConfig-wifi.mk

107
location/gps.6.1.xml.f10 Normal file
View file

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<glgps xmlns="http://www.glpals.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.glpals.com/ glconfig.xsd" >
<hal
PortName="/dev/ttyBCM"
BaudRate="921600"
GpioNStdbyPath="/sys/devices/platform/10940000.spi/spi_master/spi5/spi5.0/nstandby"
CustGpioDelayMs="250"
LogEnabled="true"
Log="JAVA"
SecondaryConfigPath="/data/vendor/gps/overlay/gps_overlay.xml"
LogDirectory="/sdcard/gps/broadcom/storage/"
CtrlPipe="/data/vendor/gps/glgpsctrl"
NmeaOutName="/data/vendor/gps/nmea_out"
acSuplServer="supl.google.com"
SuplPort="7275"
SuplLogEnable="true"
SuplLogFullName="/data/vendor/gps/suplflow.txt"
tlsEnable="true"
SuplSslMethod="SSLv23_NO_TLSv1_2"
SuplEnable="true"
SuplUseApn="false"
SuplUseApnNI="true"
SuplUseFwCellInfo="false"
SuplDummyCellInfo ="true"
SuplTlsCertDirPath="/etc/security/cacerts"
SuplTlsCertPath="/vendor/etc/gnss/gps.cer"
SuplUT1Seconds="20"
SuplUT2Seconds="20"
SuplUT3Seconds="20"
TcpConnectionTimeout="20"
SuplLppCapable="true"
SuplEcidCapable="true"
SuplVersion="2"
SuplMinorVersion="0"
SuplOtdoaCapable="true"
SuplOtdoaCapable2="true"
SuplGlonassCapable = "true"
SuplGalileoCapable = "true"
SuplBdsCapable = "true"
SuplMgpsCapable = "true"
RtoEnable="true"
RtiEnable="true"
HttpSyncLto="true"
LtoFileName="lto2.dat"
LtoDir="/data/vendor/gps/"
LtoSyncThresholdDays="1"
GnssYearOfHardware="2020"
CpEarlyFixGuardTimeSec="1"
CpGuardTimeSec="1"
CpLppGuardTimeSec="1"
IgnoreInjectedSystemTime="true"
AttributionAppPkgName="com.google.android.carrierlocation"
AssertEnabled="true"
CpLppeCancelDbhOnAgnssProvideLoc="true"
CpLppeUseAgnssLocForEmptyDbh="true"
CpLppHighAccuracyShapeMode="1"
ReAidingOnHotStart="false"
ReAidingIntervalSec="3600"
RuntimeSwLteFilterEnable="true"
PpsDevice="/sys/devices/platform/bbd_pps/pps_assert"
SensorsMask="0x244"
MaxThreadNum="13"
/>
<gll
PpsEnable="true"
LogPriMask="LOG_INFO"
LogFacMask="LOG_NMEA | LOG_GLLIOS | LOG_GLLAPI"
FrqPlan="FRQ_PLAN_26MHZ_2PPM_49_152MHZ_300PPB"
MultiCarrRFMode="GL_MULTI_CARR_RF_MODE_L1_L5"
MultiCarrLnaMask="L1_EXT_ON|L5_EXT_ON"
RfType="GL_RF_4776_BRCM"
ExtL5Bias="13.0"
WarmStandbyTimeout1Seconds="10"
WarmStandbyTimeout2Seconds="15"
EnableGnssPropagateInStandby="true"
RfPathLossDb_Ap="2.9"
RfPathLossDb_Cp="2.9"
RfPathLossDb_Ap_L5="3.7"
RfPathLossDb_Cp_L5="3.7"
OnChipGpsCarrierType="3,2,3,3,2,3,2,3,3,3,1,2,1,3,2,1,2,3,1,1,1,1,3,3,3,3,3,1,2,3,2,3"
EnableOnChipStopNotification="2"
PowerMode="3"
MinGpsWeekNumber="2216"
OnChipAccMask="50"
EnableB1C="false"
RTICacheTimeoutSec="3600"
/>
<gll_features
EnableNicAutoSwitch="true"
EnableNavic="true"
/>
</glgps>

View file

@ -49,6 +49,7 @@
LtoSyncThresholdDays="1" LtoSyncThresholdDays="1"
GnssYearOfHardware="2020" GnssYearOfHardware="2020"
CpEarlyFixGuardTimeSec="1"
CpGuardTimeSec="1" CpGuardTimeSec="1"
CpLppGuardTimeSec="1" CpLppGuardTimeSec="1"
IgnoreInjectedSystemTime="true" IgnoreInjectedSystemTime="true"
@ -100,6 +101,7 @@
<gll_features <gll_features
EnableNicAutoSwitch="true" EnableNicAutoSwitch="true"
EnableNavic="true" EnableNavic="true"
ConstellationAutoSwitchOffNavOnly="true"
/> />
</glgps> </glgps>

View file

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<glgps xmlns="http://www.glpals.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.glpals.com/ glconfig.xsd" >
<hal
PortName="/dev/ttyBCM"
BaudRate="921600"
GpioNStdbyPath="/sys/devices/platform/10940000.spi/spi_master/spi5/spi5.0/nstandby"
CustGpioDelayMs="250"
LogEnabled="false"
Log="JAVA"
LogDirectory="/sdcard/gps/broadcom/storage/"
CtrlPipe="/data/vendor/gps/glgpsctrl"
NmeaOutName="/data/vendor/gps/nmea_out"
acSuplServer="supl.google.com"
SuplPort="7275"
SuplLogEnable="false"
SuplLogFullName="/data/vendor/gps/suplflow.txt"
tlsEnable="true"
SuplSslMethod="SSLv23_NO_TLSv1_2"
SuplEnable="true"
SuplUseApn="false"
SuplUseApnNI="true"
SuplUseFwCellInfo="false"
SuplDummyCellInfo ="true"
SuplTlsCertDirPath="/etc/security/cacerts"
SuplTlsCertPath="/vendor/etc/gnss/gps.cer"
SuplUT1Seconds="20"
SuplUT2Seconds="20"
SuplUT3Seconds="20"
TcpConnectionTimeout="20"
SuplLppCapable="true"
SuplEcidCapable="true"
SuplVersion="2"
SuplMinorVersion="0"
SuplOtdoaCapable="true"
SuplOtdoaCapable2="true"
SuplGlonassCapable = "true"
SuplGalileoCapable = "true"
SuplBdsCapable = "true"
SuplMgpsCapable = "true"
RtoEnable="true"
RtiEnable="true"
HttpSyncLto="true"
LtoFileName="lto2.dat"
LtoDir="/data/vendor/gps/"
LtoSyncThresholdDays="1"
GnssYearOfHardware="2020"
CpEarlyFixGuardTimeSec="1"
CpGuardTimeSec="1"
CpLppGuardTimeSec="1"
IgnoreInjectedSystemTime="true"
AttributionAppPkgName="com.google.android.carrierlocation"
AssertEnabled="false"
CpLppeCancelDbhOnAgnssProvideLoc="true"
CpLppeUseAgnssLocForEmptyDbh="true"
CpLppHighAccuracyShapeMode="1"
ReAidingOnHotStart="false"
ReAidingIntervalSec="3600"
RuntimeSwLteFilterEnable="true"
PpsDevice="/sys/devices/platform/bbd_pps/pps_assert"
SensorsMask="0x244"
MaxThreadNum="13"
/>
<gll
PpsEnable="true"
LogPriMask="LOG_INFO"
LogFacMask="LOG_NMEA | LOG_GLLIOS | LOG_GLLAPI"
FrqPlan="FRQ_PLAN_26MHZ_2PPM_49_152MHZ_300PPB"
MultiCarrRFMode="GL_MULTI_CARR_RF_MODE_L1_L5"
MultiCarrLnaMask="L1_EXT_ON|L5_EXT_ON"
RfType="GL_RF_4776_BRCM"
ExtL5Bias="13.0"
WarmStandbyTimeout1Seconds="10"
WarmStandbyTimeout2Seconds="15"
EnableGnssPropagateInStandby="true"
RfPathLossDb_Ap="2.9"
RfPathLossDb_Cp="2.9"
RfPathLossDb_Ap_L5="3.7"
RfPathLossDb_Cp_L5="3.7"
OnChipGpsCarrierType="3,2,3,3,2,3,2,3,3,3,1,2,1,3,2,1,2,3,1,1,1,1,3,3,3,3,3,1,2,3,2,3"
EnableOnChipStopNotification="0"
PowerMode="3"
MinGpsWeekNumber="2216"
OnChipAccMask="50"
EnableB1C="false"
RTICacheTimeoutSec="3600"
/>
<gll_features
EnableNicAutoSwitch="true"
EnableNavic="true"
/>
</glgps>

View file

@ -48,6 +48,7 @@
LtoSyncThresholdDays="1" LtoSyncThresholdDays="1"
GnssYearOfHardware="2020" GnssYearOfHardware="2020"
CpEarlyFixGuardTimeSec="1"
CpGuardTimeSec="1" CpGuardTimeSec="1"
CpLppGuardTimeSec="1" CpLppGuardTimeSec="1"
IgnoreInjectedSystemTime="true" IgnoreInjectedSystemTime="true"
@ -99,6 +100,7 @@
<gll_features <gll_features
EnableNicAutoSwitch="true" EnableNicAutoSwitch="true"
EnableNavic="true" EnableNavic="true"
ConstellationAutoSwitchOffNavOnly="true"
/> />
</glgps> </glgps>

View file

@ -48,15 +48,6 @@
<instance>default</instance> <instance>default</instance>
</interface> </interface>
</hal> </hal>
<hal format="hidl">
<name>android.hardware.graphics.mapper</name>
<transport arch="32+64">passthrough</transport>
<version>4.0</version>
<interface>
<name>IMapper</name>
<instance>default</instance>
</interface>
</hal>
<hal format="hidl"> <hal format="hidl">
<name>android.hardware.graphics.composer</name> <name>android.hardware.graphics.composer</name>
<transport>hwbinder</transport> <transport>hwbinder</transport>

View file

@ -21,7 +21,8 @@
"1539000", "1539000",
"1352000", "1352000",
"1014000", "1014000",
"421000" "421000",
"546000"
], ],
"ResetOnInit": true "ResetOnInit": true
}, },
@ -884,6 +885,12 @@
"Duration": 50, "Duration": 50,
"Value": "302000" "Value": "302000"
}, },
{
"PowerHint": "DISPLAY_INACTIVE",
"Node": "MemFreq",
"Duration": 0,
"Value": "421000"
},
{ {
"PowerHint": "CPU_LOAD_RESET", "PowerHint": "CPU_LOAD_RESET",
"Node": "MemFreq", "Node": "MemFreq",
@ -1959,18 +1966,6 @@
"Duration": 50, "Duration": 50,
"Value": "1" "Value": "1"
}, },
{
"PowerHint": "THERMAL_FLASH_LED_REDUCE_CRITICAL",
"Node": "LimitFlashCurrent",
"Duration": 0,
"Value": "100"
},
{
"PowerHint": "THERMAL_FLASH_LED_REDUCE_NONE",
"Node": "LimitFlashCurrent",
"Duration": 0,
"Value": "1500"
},
{ {
"PowerHint": "EXPENSIVE_RENDERING", "PowerHint": "EXPENSIVE_RENDERING",
"Node": "PowerHALRenderingState", "Node": "PowerHALRenderingState",
@ -2209,11 +2204,12 @@
"TargetTimeFactor": 1.0, "TargetTimeFactor": 1.0,
"StaleTimeFactor": 15.0, "StaleTimeFactor": 15.0,
"HeuristicBoost_On": true, "HeuristicBoost_On": true,
"HBoostOnMissedCycles": 8, "HBoostModerateJankThreshold": 2,
"HBoostOffMaxAvgRatio": 4.0, "HBoostOffMaxAvgDurRatio": 4.0,
"HBoostOffMissedCycles": 5, "HBoostSevereJankPidPu": 0.5,
"HBoostPidPuFactor": 0.5, "HBoostSevereJankThreshold": 8,
"HBoostUclampMin": 722, "HBoostUclampMinCeilingRange": [480, 722],
"HBoostUclampMinFloorRange": [230, 410],
"JankCheckTimeFactor": 1.2, "JankCheckTimeFactor": 1.2,
"LowFrameRateThreshold": 25, "LowFrameRateThreshold": 25,
"MaxRecordsNum": 300 "MaxRecordsNum": 300
@ -2244,11 +2240,12 @@
"TargetTimeFactor": 1.0, "TargetTimeFactor": 1.0,
"StaleTimeFactor": 15.0, "StaleTimeFactor": 15.0,
"HeuristicBoost_On": true, "HeuristicBoost_On": true,
"HBoostOnMissedCycles": 8, "HBoostModerateJankThreshold": 2,
"HBoostOffMaxAvgRatio": 4.0, "HBoostOffMaxAvgDurRatio": 4.0,
"HBoostOffMissedCycles": 5, "HBoostSevereJankPidPu": 0.5,
"HBoostPidPuFactor": 0.5, "HBoostSevereJankThreshold": 8,
"HBoostUclampMin": 722, "HBoostUclampMinCeilingRange": [480, 722],
"HBoostUclampMinFloorRange": [230, 410],
"JankCheckTimeFactor": 1.2, "JankCheckTimeFactor": 1.2,
"LowFrameRateThreshold": 25, "LowFrameRateThreshold": 25,
"MaxRecordsNum": 300 "MaxRecordsNum": 300
@ -2279,11 +2276,12 @@
"TargetTimeFactor": 1.0, "TargetTimeFactor": 1.0,
"StaleTimeFactor": 15.0, "StaleTimeFactor": 15.0,
"HeuristicBoost_On": true, "HeuristicBoost_On": true,
"HBoostOnMissedCycles": 8, "HBoostModerateJankThreshold": 2,
"HBoostOffMaxAvgRatio": 4.0, "HBoostOffMaxAvgDurRatio": 4.0,
"HBoostOffMissedCycles": 5, "HBoostSevereJankPidPu": 0.5,
"HBoostPidPuFactor": 0.5, "HBoostSevereJankThreshold": 8,
"HBoostUclampMin": 722, "HBoostUclampMinCeilingRange": [480, 722],
"HBoostUclampMinFloorRange": [230, 410],
"JankCheckTimeFactor": 1.2, "JankCheckTimeFactor": 1.2,
"LowFrameRateThreshold": 25, "LowFrameRateThreshold": 25,
"MaxRecordsNum": 300 "MaxRecordsNum": 300

View file

@ -29,8 +29,8 @@
<item>30</item> <item>30</item>
</integer-array> </integer-array>
<integer-array name="antenna_y"> <integer-array name="antenna_y">
<item>103</item> <item>44</item>
<item>103</item> <item>44</item>
</integer-array> </integer-array>
<bool name="nfc_observe_mode_supported">true</bool> <bool name="nfc_observe_mode_supported">true</bool>
</resources> </resources>

View file

@ -3,20 +3,17 @@
{ {
"Name":"neutral_therm", "Name":"neutral_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/neutral_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"quiet_therm", "Name":"quiet_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/quiet_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"skin_therm", "Name":"skin_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"HotThreshold":["NAN", 32.0, "NAN", "NAN", "NAN", "NAN", "NAN"], "HotThreshold":["NAN", 32.0, "NAN", "NAN", "NAN", "NAN", "NAN"],
"TempPath":"/dev/thermal/tz-by-name/skin_therm/tz_temp",
"Multiplier":0.001, "Multiplier":0.001,
"PollingDelay":300000, "PollingDelay":300000,
"PassiveDelay":7000 "PassiveDelay":7000
@ -24,14 +21,12 @@
{ {
"Name":"usb_pwr_therm", "Name":"usb_pwr_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/usb_pwr_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"usb_pwr_therm2", "Name":"usb_pwr_therm2",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"HotThreshold":["NAN", 40.0, "NAN", "NAN", "NAN", "NAN", "NAN"], "HotThreshold":["NAN", 40.0, "NAN", "NAN", "NAN", "NAN", "NAN"],
"TempPath":"/dev/thermal/tz-by-name/usb_pwr_therm2/tz_temp",
"Multiplier":0.001, "Multiplier":0.001,
"PollingDelay":300000, "PollingDelay":300000,
"PassiveDelay":7000 "PassiveDelay":7000
@ -39,19 +34,16 @@
{ {
"Name":"inner_disp_therm", "Name":"inner_disp_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/inner_disp_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"outer_disp_therm", "Name":"outer_disp_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/outer_disp_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"gnss_tcxo_therm", "Name":"gnss_tcxo_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/gnss_tcxo_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {

View file

@ -9,20 +9,17 @@
{ {
"Name":"neutral_therm", "Name":"neutral_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/neutral_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"quiet_therm", "Name":"quiet_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/quiet_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"skin_therm", "Name":"skin_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"HotThreshold":["NAN", 32.0, "NAN", "NAN", "NAN", "NAN", "NAN"], "HotThreshold":["NAN", 32.0, "NAN", "NAN", "NAN", "NAN", "NAN"],
"TempPath":"/dev/thermal/tz-by-name/skin_therm/tz_temp",
"Multiplier":0.001, "Multiplier":0.001,
"PollingDelay":300000, "PollingDelay":300000,
"PassiveDelay":7000 "PassiveDelay":7000
@ -30,14 +27,12 @@
{ {
"Name":"usb_pwr_therm", "Name":"usb_pwr_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/usb_pwr_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"usb_pwr_therm2", "Name":"usb_pwr_therm2",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"HotThreshold":["NAN", 40.0, "NAN", "NAN", "NAN", "NAN", "NAN"], "HotThreshold":["NAN", 40.0, "NAN", "NAN", "NAN", "NAN", "NAN"],
"TempPath":"/dev/thermal/tz-by-name/usb_pwr_therm2/tz_temp",
"Multiplier":0.001, "Multiplier":0.001,
"PollingDelay":300000, "PollingDelay":300000,
"PassiveDelay":7000 "PassiveDelay":7000
@ -45,19 +40,16 @@
{ {
"Name":"inner_disp_therm", "Name":"inner_disp_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/inner_disp_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"outer_disp_therm", "Name":"outer_disp_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/outer_disp_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"gnss_tcxo_therm", "Name":"gnss_tcxo_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/gnss_tcxo_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
@ -550,318 +542,28 @@
"Type":"NPU", "Type":"NPU",
"HotThreshold":["NAN", "NAN", "NAN", "NAN", "NAN", "NAN", "NAN"], "HotThreshold":["NAN", "NAN", "NAN", "NAN", "NAN", "NAN", "NAN"],
"Multiplier":0.001 "Multiplier":0.001
},
{
"Name":"battery_cycle",
"Type":"BCL_VOLTAGE",
"Multiplier":1,
"SendCallback":false
},
{
"Name":"critical-battery-cell",
"Type":"BCL_VOLTAGE",
"VirtualSensor":true,
"Formula":"COUNT_THRESHOLD",
"TriggerSensor": "vdroop1",
"Combination":["battery", "battery_cycle", "vdroop1"],
"Coefficient":[-10000, 400, 1000],
"HotThreshold":["NAN", "NAN", "NAN", "NAN", "NAN", 3.00, "NAN"],
"Multiplier":1,
"SendCallback":true
},
{
"Name":"FLASH_LED_REDUCE",
"Type":"UNKNOWN",
"VirtualSensor":true,
"Formula":"COUNT_THRESHOLD",
"TriggerSensor": "vdroop1",
"Combination":["battery", "battery_cycle", "vdroop1"],
"Coefficient":[-10000, 400, 1000],
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 3.00, "NAN", "NAN"],
"Multiplier":1,
"SendCallback":true,
"SendPowerHint":true
},
{
"Name":"soc",
"Type":"BCL_PERCENTAGE",
"HotThreshold":["NAN", "NAN", 80, "NAN", "NAN", "NAN", "NAN"],
"Multiplier":1
},
{
"Name":"BCL_TPU_LOW_TEMP",
"Type":"BCL_CURRENT",
"VirtualSensor":true,
"Formula":"WEIGHTED_AVG",
"TriggerSensor": "ocp_tpu",
"Combination":["ocp_tpu", "battery"],
"Coefficient":[1, -10],
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 13000, "NAN", "NAN"],
"Multiplier":1,
"SendCallback":true,
"BindedCdevInfo": [
{
"CdevRequest": "tpu_cooling",
"LimitInfo": [0, 0, 0, 0, 7, 7, 7]
}
]
},
{
"Name":"BCL_GPU_LOW_TEMP",
"Type":"BCL_CURRENT",
"VirtualSensor":true,
"Formula":"WEIGHTED_AVG",
"TriggerSensor": "ocp_gpu",
"Combination":["ocp_gpu", "battery"],
"Coefficient":[1, -10],
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 13000, "NAN", "NAN"],
"Multiplier":1,
"SendCallback":true,
"BindedCdevInfo": [
{
"CdevRequest": "thermal-gpufreq-0",
"LimitInfo": [0, 0, 0, 0, 9, 9, 9]
}
]
},
{
"Name":"BCL_BATOILO_GPU_LOW_TEMP",
"Type":"BCL_CURRENT",
"VirtualSensor":true,
"Formula":"COUNT_THRESHOLD",
"TriggerSensor": "batoilo",
"Combination":["batoilo", "ocp_gpu", "battery"],
"Coefficient":[5000, 12000, -1000 ],
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 3.0, "NAN", "NAN"],
"Multiplier":1,
"SendCallback":true,
"BindedCdevInfo": [
{
"CdevRequest": "thermal-gpufreq-0",
"LimitInfo": [0, 0, 0, 0, 9, 9, 9]
}
]
},
{
"Name":"BCL_BATOILO_TPU_LOW_TEMP",
"Type":"BCL_CURRENT",
"VirtualSensor":true,
"Formula":"COUNT_THRESHOLD",
"TriggerSensor": "batoilo",
"Combination":["batoilo", "ocp_tpu", "battery"],
"Coefficient":[5000, 12000, -1000],
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 3.0, "NAN", "NAN"],
"Multiplier":1,
"SendCallback":true,
"BindedCdevInfo": [
{
"CdevRequest": "tpu_cooling",
"LimitInfo": [0, 0, 0, 0, 7, 7, 7]
}
]
},
{
"Name":"BCL_BATOILO_GPU",
"Type":"BCL_CURRENT",
"VirtualSensor":true,
"Formula":"COUNT_THRESHOLD",
"TriggerSensor": "batoilo",
"Combination":["batoilo", "ocp_gpu"],
"Coefficient":[5000, 12000],
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 2.0, "NAN", "NAN"],
"Multiplier":1,
"SendCallback":true,
"BindedCdevInfo": [
{
"CdevRequest": "thermal-gpufreq-0",
"LimitInfo": [0, 0, 0, 0, 4, 4, 4]
}
]
},
{
"Name":"BCL_BATOILO_TPU",
"Type":"BCL_CURRENT",
"VirtualSensor":true,
"Formula":"COUNT_THRESHOLD",
"TriggerSensor": "batoilo",
"Combination":[
"batoilo",
"ocp_tpu"
],
"Coefficient":[5000, 12000],
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 2.0, "NAN", "NAN"],
"Multiplier":1,
"SendCallback":true,
"BindedCdevInfo": [
{
"CdevRequest": "tpu_cooling",
"LimitInfo": [0, 0, 0, 0, 6, 6, 6]
}
]
},
{
"Name":"batoilo",
"Type":"BCL_CURRENT",
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 5000, "NAN", "NAN"],
"HotHysteresis":[0.0, 0.0, 0.0, 0.0, 100, 0.0, 0.0],
"Multiplier":1,
"SendCallback":true,
"PollingDelay":0,
"PassiveDelay":60000,
"BindedCdevInfo": [
{
"CdevRequest": "thermal-cpufreq-2",
"LimitInfo": [0, 0, 0, 0, 7, 7, 7]
},
{
"CdevRequest": "thermal-gpufreq-0",
"LimitInfo": [0, 0, 0, 0, 3, 3, 3]
},
{
"CdevRequest": "tpu_cooling",
"LimitInfo": [0, 0, 0, 0, 5, 5, 5]
}
]
},
{
"Name":"BCL_AUDIO_BAACL",
"Type":"BCL_VOLTAGE",
"VirtualSensor":true,
"Formula":"COUNT_THRESHOLD",
"TriggerSensor": "soc",
"Combination":["battery", "soc"],
"Coefficient":[-10000, 80],
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 2.0, "NAN", "NAN"],
"Multiplier":1,
"SendCallback":true
},
{
"Name":"vdroop1",
"Type":"BCL_VOLTAGE",
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 1000, "NAN", "NAN"],
"HotHysteresis":[0.0, 0.0, 0.0, 0.0, 100, 0.0, 0.0],
"Multiplier":1,
"SendCallback":true,
"PollingDelay":0,
"PassiveDelay":60000,
"BindedCdevInfo": [
{
"CdevRequest": "thermal-cpufreq-2",
"LimitInfo": [0, 0, 0, 0, 7, 7, 7]
},
{
"CdevRequest": "thermal-gpufreq-0",
"LimitInfo": [0, 0, 0, 0, 2, 2, 2]
},
{
"CdevRequest": "tpu_cooling",
"LimitInfo": [0, 0, 0, 0, 3, 3, 3]
}
]
},
{
"Name":"vdroop2",
"Type":"BCL_VOLTAGE",
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 1200, "NAN", "NAN"],
"HotHysteresis":[0.0, 0.0, 0.0, 0.0, 100, 0.0, 0.0],
"Multiplier":1,
"SendCallback":true,
"PollingDelay":0,
"PassiveDelay":60000,
"BindedCdevInfo": [
{
"CdevRequest": "thermal-cpufreq-2",
"LimitInfo": [0, 0, 0, 0, 7, 7, 7]
},
{
"CdevRequest": "thermal-gpufreq-0",
"LimitInfo": [0, 0, 0, 0, 4, 4, 4]
},
{
"CdevRequest": "tpu_cooling",
"LimitInfo": [0, 0, 0, 0, 3, 3, 3]
}
]
},
{
"Name":"smpl_gm",
"Type":"BCL_VOLTAGE",
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 1100, "NAN", "NAN"],
"HotHysteresis":[0.0, 0.0, 0.0, 0.0, 100, 0.0, 0.0],
"Multiplier":1,
"SendCallback":true,
"PollingDelay":0,
"PassiveDelay":60000,
"BindedCdevInfo": [
{
"CdevRequest": "thermal-cpufreq-2",
"LimitInfo": [0, 0, 0, 0, 7, 7, 7]
},
{
"CdevRequest": "thermal-gpufreq-0",
"LimitInfo": [0, 0, 0, 0, 3, 3, 3]
},
{
"CdevRequest": "tpu_cooling",
"LimitInfo": [0, 0, 0, 0, 3, 3, 3]
}
]
},
{
"Name":"ocp_cpu1",
"Type":"BCL_CURRENT",
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 8000, "NAN", "NAN"],
"HotHysteresis":[0.0, 0.0, 0.0, 0.0, 100, 0.0, 0.0],
"Multiplier":1,
"Hidden":true
},
{
"Name":"ocp_cpu2",
"Type":"BCL_CURRENT",
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 12000, "NAN", "NAN"],
"HotHysteresis":[0.0, 0.0, 0.0, 0.0, 100, 0.0, 0.0],
"Multiplier":1,
"Hidden":true
},
{
"Name":"ocp_tpu",
"Type":"BCL_CURRENT",
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 12000, "NAN", "NAN"],
"HotHysteresis":[0.0, 0.0, 0.0, 0.0, 100, 0.0, 0.0],
"Multiplier":1
},
{
"Name":"ocp_gpu",
"Type":"BCL_CURRENT",
"HotThreshold":["NAN", "NAN", "NAN", "NAN", 12000, "NAN", "NAN"],
"HotHysteresis":[0.0, 0.0, 0.0, 0.0, 100, 0.0, 0.0],
"Multiplier":1
} }
], ],
"CoolingDevices":[ "CoolingDevices":[
{ {
"Name":"thermal-cpufreq-0", "Name":"thermal-cpufreq-0",
"Type":"CPU", "Type":"CPU",
"WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-0/user_vote", "WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-0/user_vote"
"State2Power":[516, 456, 392, 296, 264, 216, 184, 140, 100, 68, 28]
}, },
{ {
"Name":"thermal-cpufreq-1", "Name":"thermal-cpufreq-1",
"Type":"CPU", "Type":"CPU",
"WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-1/user_vote", "WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-1/user_vote"
"State2Power":[2466, 2166, 1840, 1544, 1260, 1024, 816, 642, 538, 410, 342, 276, 224, 162, 104]
}, },
{ {
"Name":"thermal-cpufreq-2", "Name":"thermal-cpufreq-2",
"Type":"CPU", "Type":"CPU",
"WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-2/user_vote", "WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-2/user_vote"
"State2Power":[4920, 4614, 4092, 3684, 3198, 2820, 2354, 2184, 1862, 1476, 1338, 1110, 928, 738, 552, 450, 362, 188]
}, },
{ {
"Name":"thermal-gpufreq-0", "Name":"thermal-gpufreq-0",
"Type":"GPU", "Type":"GPU",
"WritePath":"/dev/thermal/cdev-by-name/thermal-gpufreq-0/user_vote", "WritePath":"/dev/thermal/cdev-by-name/thermal-gpufreq-0/user_vote"
"State2Power":[1925, 1528, 1258, 928, 795, 703, 573, 481, 396, 314, 236]
}, },
{ {
"Name":"chg_mdis", "Name":"chg_mdis",

View file

@ -9,20 +9,17 @@
{ {
"Name":"neutral_therm", "Name":"neutral_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/neutral_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"quiet_therm", "Name":"quiet_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/quiet_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"skin_therm", "Name":"skin_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"HotThreshold":["NAN", 32.0, "NAN", "NAN", "NAN", "NAN", "NAN"], "HotThreshold":["NAN", 32.0, "NAN", "NAN", "NAN", "NAN", "NAN"],
"TempPath":"/dev/thermal/tz-by-name/skin_therm/tz_temp",
"Multiplier":0.001, "Multiplier":0.001,
"PollingDelay":300000, "PollingDelay":300000,
"PassiveDelay":7000 "PassiveDelay":7000
@ -30,14 +27,12 @@
{ {
"Name":"usb_pwr_therm", "Name":"usb_pwr_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/usb_pwr_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"usb_pwr_therm2", "Name":"usb_pwr_therm2",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"HotThreshold":["NAN", 40.0, "NAN", "NAN", "NAN", "NAN", "NAN"], "HotThreshold":["NAN", 40.0, "NAN", "NAN", "NAN", "NAN", "NAN"],
"TempPath":"/dev/thermal/tz-by-name/usb_pwr_therm2/tz_temp",
"Multiplier":0.001, "Multiplier":0.001,
"PollingDelay":300000, "PollingDelay":300000,
"PassiveDelay":7000 "PassiveDelay":7000
@ -45,19 +40,16 @@
{ {
"Name":"inner_disp_therm", "Name":"inner_disp_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/inner_disp_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"outer_disp_therm", "Name":"outer_disp_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/outer_disp_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
"Name":"gnss_tcxo_therm", "Name":"gnss_tcxo_therm",
"Type":"UNKNOWN", "Type":"UNKNOWN",
"TempPath":"/dev/thermal/tz-by-name/gnss_tcxo_therm/tz_temp",
"Multiplier":0.001 "Multiplier":0.001
}, },
{ {
@ -872,26 +864,22 @@
{ {
"Name":"thermal-cpufreq-0", "Name":"thermal-cpufreq-0",
"Type":"CPU", "Type":"CPU",
"WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-0/user_vote", "WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-0/user_vote"
"State2Power":[516, 456, 392, 296, 264, 216, 184, 140, 100, 68, 28]
}, },
{ {
"Name":"thermal-cpufreq-1", "Name":"thermal-cpufreq-1",
"Type":"CPU", "Type":"CPU",
"WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-1/user_vote", "WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-1/user_vote"
"State2Power":[2466, 2166, 1840, 1544, 1260, 1024, 816, 642, 538, 410, 342, 276, 224, 162, 104]
}, },
{ {
"Name":"thermal-cpufreq-2", "Name":"thermal-cpufreq-2",
"Type":"CPU", "Type":"CPU",
"WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-2/user_vote", "WritePath":"/dev/thermal/cdev-by-name/thermal-cpufreq-2/user_vote"
"State2Power":[4920, 4614, 4092, 3684, 3198, 2820, 2354, 2184, 1862, 1476, 1338, 1110, 928, 738, 552, 450, 362, 188]
}, },
{ {
"Name":"thermal-gpufreq-0", "Name":"thermal-gpufreq-0",
"Type":"GPU", "Type":"GPU",
"WritePath":"/dev/thermal/cdev-by-name/thermal-gpufreq-0/user_vote", "WritePath":"/dev/thermal/cdev-by-name/thermal-gpufreq-0/user_vote"
"State2Power":[1925, 1528, 1258, 928, 795, 703, 573, 481, 396, 314, 236]
}, },
{ {
"Name":"chg_mdis", "Name":"chg_mdis",

View file

@ -40,10 +40,6 @@ void HwApiBase::saveName(const std::string &name, const std::ios *stream) {
mNames[stream] = name; mNames[stream] = name;
} }
bool HwApiBase::has(const std::ios &stream) {
return !!stream;
}
void HwApiBase::debug(int fd) { void HwApiBase::debug(int fd) {
dprintf(fd, "Kernel:\n"); dprintf(fd, "Kernel:\n");

View file

@ -20,10 +20,12 @@
#include <sys/epoll.h> #include <sys/epoll.h>
#include <utils/Trace.h> #include <utils/Trace.h>
#include <chrono>
#include <list> #include <list>
#include <map> #include <map>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <type_traits>
#include "utils.h" #include "utils.h"
@ -47,17 +49,19 @@ class HwApiBase {
class Record : public RecordInterface { class Record : public RecordInterface {
public: public:
Record(const char *func, const T &value, const std::ios *stream) Record(const char *func, const T &value, const std::ios *stream)
: mFunc(func), mValue(value), mStream(stream) {} : mFunc(func), mValue(value), mStream(stream),
mTp(std::chrono::system_clock::system_clock::now()) {}
std::string toString(const NamesMap &names) override; std::string toString(const NamesMap &names) override;
private: private:
const char *mFunc; const char *mFunc;
const T mValue; const T mValue;
const std::ios *mStream; const std::ios *mStream;
const std::chrono::system_clock::time_point mTp;
}; };
using Records = std::list<std::unique_ptr<RecordInterface>>; using Records = std::list<std::unique_ptr<RecordInterface>>;
static constexpr uint32_t RECORDS_SIZE = 32; static constexpr uint32_t RECORDS_SIZE = 2048;
public: public:
HwApiBase(); HwApiBase();
@ -67,7 +71,8 @@ class HwApiBase {
void saveName(const std::string &name, const std::ios *stream); void saveName(const std::string &name, const std::ios *stream);
template <typename T> template <typename T>
void open(const std::string &name, T *stream); void open(const std::string &name, T *stream);
bool has(const std::ios &stream); template <typename T>
bool has(const T &stream);
template <typename T> template <typename T>
bool get(T *value, std::istream *stream); bool get(T *value, std::istream *stream);
template <typename T> template <typename T>
@ -93,6 +98,16 @@ void HwApiBase::open(const std::string &name, T *stream) {
utils::openNoCreate(mPathPrefix + name, stream); utils::openNoCreate(mPathPrefix + name, stream);
} }
template <typename T>
bool HwApiBase::has(const T &stream) {
if constexpr (std::is_same<T, std::fstream>::value || std::is_same<T, std::ofstream>::value ||
std::is_same<T, std::ifstream>::value)
return stream.is_open() && !stream.fail();
ALOGE("File stream is not of the correct type");
return false;
}
template <typename T> template <typename T>
bool HwApiBase::get(T *value, std::istream *stream) { bool HwApiBase::get(T *value, std::istream *stream) {
ATRACE_NAME("HwApi::get"); ATRACE_NAME("HwApi::get");
@ -169,9 +184,14 @@ template <typename T>
std::string HwApiBase::Record<T>::toString(const NamesMap &names) { std::string HwApiBase::Record<T>::toString(const NamesMap &names) {
using utils::operator<<; using utils::operator<<;
std::stringstream ret; std::stringstream ret;
auto lTp = std::chrono::system_clock::to_time_t(mTp);
struct tm buf;
auto lTime = localtime_r(&lTp, &buf);
ret << mFunc << " '" << names.at(mStream) << "' = '" << mValue << "'"; ret << std::put_time(lTime, "%Y-%m-%d %H:%M:%S.") << std::setfill('0') << std::setw(3)
<< (std::chrono::duration_cast<std::chrono::milliseconds>(mTp.time_since_epoch()) % 1000)
.count()
<< " " << mFunc << " '" << names.at(mStream) << "' = '" << mValue << "'";
return ret.str(); return ret.str();
} }

View file

@ -110,10 +110,12 @@ inline bool getProperty<bool>(const std::string &key, const bool def) {
template <typename T> template <typename T>
static void openNoCreate(const std::string &file, T *outStream) { static void openNoCreate(const std::string &file, T *outStream) {
auto mode = std::is_base_of_v<std::ostream, T> ? std::ios_base::out : std::ios_base::in; if (!std::filesystem::exists(file)) {
ALOGE("File does not exist: %s", file.c_str());
return;
}
// Force 'in' mode to prevent file creation outStream->open(file);
outStream->open(file, mode | std::ios_base::in);
if (!*outStream) { if (!*outStream) {
ALOGE("Failed to open %s (%d): %s", file.c_str(), errno, strerror(errno)); ALOGE("Failed to open %s (%d): %s", file.c_str(), errno, strerror(errno));
} }

View file

@ -78,6 +78,9 @@ class HwApi : public Vibrator::HwApi, private HwApiBase {
open("calibration/q_stored", &mQ); open("calibration/q_stored", &mQ);
open("default/vibe_state", &mVibeState); open("default/vibe_state", &mVibeState);
open("default/num_waves", &mEffectCount); open("default/num_waves", &mEffectCount);
open("default/braking_time_bank", &mEffectBrakingTimeBank);
open("default/braking_time_index", &mEffectBrakingTimeIndex);
open("default/braking_time_ms", &mEffectBrakingTimeMs);
open("default/owt_free_space", &mOwtFreeSpace); open("default/owt_free_space", &mOwtFreeSpace);
open("default/f0_comp_enable", &mF0CompEnable); open("default/f0_comp_enable", &mF0CompEnable);
open("default/redc_comp_enable", &mRedcCompEnable); open("default/redc_comp_enable", &mRedcCompEnable);
@ -89,6 +92,16 @@ class HwApi : public Vibrator::HwApi, private HwApiBase {
bool setRedc(std::string value) override { return set(value, &mRedc); } bool setRedc(std::string value) override { return set(value, &mRedc); }
bool setQ(std::string value) override { return set(value, &mQ); } bool setQ(std::string value) override { return set(value, &mQ); }
bool getEffectCount(uint32_t *value) override { return get(value, &mEffectCount); } bool getEffectCount(uint32_t *value) override { return get(value, &mEffectCount); }
bool hasEffectBrakingTimeBank() override { return has(mEffectBrakingTimeBank); }
bool setEffectBrakingTimeBank(uint32_t value) override {
return set(value, &mEffectBrakingTimeBank);
}
bool setEffectBrakingTimeIndex(uint32_t value) override {
return set(value, &mEffectBrakingTimeIndex);
}
bool getEffectBrakingTimeMs(uint32_t *value) override {
return get(value, &mEffectBrakingTimeMs);
}
bool pollVibeState(uint32_t value, int32_t timeoutMs) override { bool pollVibeState(uint32_t value, int32_t timeoutMs) override {
return poll(value, &mVibeState, timeoutMs); return poll(value, &mVibeState, timeoutMs);
} }
@ -282,6 +295,9 @@ class HwApi : public Vibrator::HwApi, private HwApiBase {
std::ofstream mRedc; std::ofstream mRedc;
std::ofstream mQ; std::ofstream mQ;
std::ifstream mEffectCount; std::ifstream mEffectCount;
std::ofstream mEffectBrakingTimeBank;
std::ofstream mEffectBrakingTimeIndex;
std::ifstream mEffectBrakingTimeMs;
std::ifstream mVibeState; std::ifstream mVibeState;
std::ifstream mOwtFreeSpace; std::ifstream mOwtFreeSpace;
std::ofstream mF0CompEnable; std::ofstream mF0CompEnable;

View file

@ -58,7 +58,7 @@ static constexpr int8_t MAX_PAUSE_TIMING_ERROR_MS = 1; // ALERT Irq Handling
static constexpr uint32_t MAX_TIME_MS = UINT16_MAX; static constexpr uint32_t MAX_TIME_MS = UINT16_MAX;
static constexpr auto ASYNC_COMPLETION_TIMEOUT = std::chrono::milliseconds(100); static constexpr auto ASYNC_COMPLETION_TIMEOUT = std::chrono::milliseconds(100);
static constexpr auto POLLING_TIMEOUT = 20; static constexpr auto POLLING_TIMEOUT = 50;
static constexpr int32_t COMPOSE_DELAY_MAX_MS = 10000; static constexpr int32_t COMPOSE_DELAY_MAX_MS = 10000;
/* nsections is 8 bits. Need to preserve 1 section for the first delay before the first effect. */ /* nsections is 8 bits. Need to preserve 1 section for the first delay before the first effect. */
@ -71,6 +71,14 @@ static constexpr int32_t COMPOSE_PWLE_SIZE_MAX_DEFAULT = 127;
// See the LRA Calibration Support documentation for more details. // See the LRA Calibration Support documentation for more details.
static constexpr int32_t Q14_BIT_SHIFT = 14; static constexpr int32_t Q14_BIT_SHIFT = 14;
// Measured ReDC. The LRA series resistance (ReDC), expressed as follows
// redc(ohms) = redc_measured / 2^Q15_BIT_SHIFT.
// This value represents the unit-specific ReDC input to the click compensation
// algorithm. It can be overwritten at a later time by writing to the redc_stored
// sysfs control.
// See the LRA Calibration Support documentation for more details.
static constexpr int32_t Q15_BIT_SHIFT = 15;
// Measured Q factor, q_measured, is represented by Q8.16 fixed // Measured Q factor, q_measured, is represented by Q8.16 fixed
// point format on cs40l26 devices. The expression to calculate q is: // point format on cs40l26 devices. The expression to calculate q is:
// q = q_measured / 2^Q16_BIT_SHIFT // q = q_measured / 2^Q16_BIT_SHIFT
@ -115,6 +123,10 @@ static uint16_t amplitudeToScale(float amplitude, float maximum) {
return std::round(ratio); return std::round(ratio);
} }
static float redcToFloat(std::string *caldata) {
return static_cast<float>(std::stoul(*caldata, nullptr, 16)) / (1 << Q15_BIT_SHIFT);
}
enum WaveformBankID : uint8_t { enum WaveformBankID : uint8_t {
RAM_WVFRM_BANK, RAM_WVFRM_BANK,
ROM_WVFRM_BANK, ROM_WVFRM_BANK,
@ -485,8 +497,9 @@ Vibrator::Vibrator(std::unique_ptr<HwApi> hwApiDefault, std::unique_ptr<HwCal> h
mFfEffects.resize(WAVEFORM_MAX_INDEX); mFfEffects.resize(WAVEFORM_MAX_INDEX);
mEffectDurations.resize(WAVEFORM_MAX_INDEX); mEffectDurations.resize(WAVEFORM_MAX_INDEX);
mEffectDurations = { mEffectDurations = {
1000, 100, 12, 1000, 300, 130, 150, 500, 100, 5, 12, 1000, 1000, 1000, 1000, 100, 9, 1000, 300, 130, 150, 500, 100, 5, 12, 1000, 1000, 1000,
}; /* 11+3 waveforms. The duration must < UINT16_MAX */ }; /* 11+3 waveforms. The duration must < UINT16_MAX */
mEffectBrakingDurations.resize(WAVEFORM_MAX_INDEX);
mEffectCustomData.reserve(WAVEFORM_MAX_INDEX); mEffectCustomData.reserve(WAVEFORM_MAX_INDEX);
uint8_t effectIndex; uint8_t effectIndex;
@ -519,6 +532,11 @@ Vibrator::Vibrator(std::unique_ptr<HwApi> hwApiDefault, std::unique_ptr<HwCal> h
if (mFfEffects[effectIndex].id != effectIndex) { if (mFfEffects[effectIndex].id != effectIndex) {
ALOGW("Unexpected effect index: %d -> %d", effectIndex, mFfEffects[effectIndex].id); ALOGW("Unexpected effect index: %d -> %d", effectIndex, mFfEffects[effectIndex].id);
} }
if (mHwApiDef->hasEffectBrakingTimeBank()) {
mHwApiDef->setEffectBrakingTimeIndex(effectIndex);
mHwApiDef->getEffectBrakingTimeMs(&mEffectBrakingDurations[effectIndex]);
}
} else { } else {
/* Initiate placeholders for OWT effects. */ /* Initiate placeholders for OWT effects. */
numBytes = effectIndex == WAVEFORM_COMPOSE ? FF_CUSTOM_DATA_LEN_MAX_COMP numBytes = effectIndex == WAVEFORM_COMPOSE ? FF_CUSTOM_DATA_LEN_MAX_COMP
@ -592,9 +610,12 @@ Vibrator::Vibrator(std::unique_ptr<HwApi> hwApiDefault, std::unique_ptr<HwCal> h
if (mHwCalDef->getF0(&caldata)) { if (mHwCalDef->getF0(&caldata)) {
mHwApiDef->setF0(caldata); mHwApiDef->setF0(caldata);
mResonantFrequency =
static_cast<float>(std::stoul(caldata, nullptr, 16)) / (1 << Q14_BIT_SHIFT);
} }
if (mHwCalDef->getRedc(&caldata)) { if (mHwCalDef->getRedc(&caldata)) {
mHwApiDef->setRedc(caldata); mHwApiDef->setRedc(caldata);
mRedc = redcToFloat(&caldata);
} }
if (mHwCalDef->getQ(&caldata)) { if (mHwCalDef->getQ(&caldata)) {
mHwApiDef->setQ(caldata); mHwApiDef->setQ(caldata);
@ -677,8 +698,21 @@ Vibrator::Vibrator(std::unique_ptr<HwApi> hwApiDefault, std::unique_ptr<HwCal> h
mSupportedPrimitives = defaultSupportedPrimitives; mSupportedPrimitives = defaultSupportedPrimitives;
} }
mPrimitiveMaxScale = {1.0f, 0.95f, 0.75f, 0.9f, 1.0f, 1.0f, 1.0f, 0.75f, 0.75f}; mPrimitiveMaxScale.resize(WAVEFORM_MAX_INDEX, 100);
mPrimitiveMinScale = {0.0f, 0.01f, 0.11f, 0.23f, 0.0f, 0.25f, 0.02f, 0.03f, 0.16f}; mPrimitiveMaxScale[WAVEFORM_CLICK_INDEX] = 95;
mPrimitiveMaxScale[WAVEFORM_THUD_INDEX] = 75;
mPrimitiveMaxScale[WAVEFORM_SPIN_INDEX] = 90;
mPrimitiveMaxScale[WAVEFORM_LIGHT_TICK_INDEX] = 75;
mPrimitiveMaxScale[WAVEFORM_LOW_TICK_INDEX] = 75;
mPrimitiveMinScale.resize(WAVEFORM_MAX_INDEX, 0);
mPrimitiveMinScale[WAVEFORM_CLICK_INDEX] = 1;
mPrimitiveMinScale[WAVEFORM_THUD_INDEX] = 11;
mPrimitiveMinScale[WAVEFORM_SPIN_INDEX] = 23;
mPrimitiveMinScale[WAVEFORM_SLOW_RISE_INDEX] = 25;
mPrimitiveMinScale[WAVEFORM_QUICK_FALL_INDEX] = 2;
mPrimitiveMinScale[WAVEFORM_LIGHT_TICK_INDEX] = 3;
mPrimitiveMinScale[WAVEFORM_LOW_TICK_INDEX] = 16;
// ====== Get GPIO status and init it ================ // ====== Get GPIO status and init it ================
mGPIOStatus = mHwGPIO->getGPIO(); mGPIOStatus = mHwGPIO->getGPIO();
@ -850,7 +884,7 @@ ndk::ScopedAStatus Vibrator::getPrimitiveDuration(CompositePrimitive primitive,
return status; return status;
} }
*durationMs = mEffectDurations[effectIndex]; *durationMs = mEffectDurations[effectIndex] + mEffectBrakingDurations[effectIndex];
} else { } else {
*durationMs = 0; *durationMs = 0;
} }
@ -863,7 +897,6 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect> &composi
ALOGD("Vibrator::compose"); ALOGD("Vibrator::compose");
uint16_t size; uint16_t size;
uint16_t nextEffectDelay; uint16_t nextEffectDelay;
uint16_t totalDuration = 0;
if (composite.size() > COMPOSE_SIZE_MAX || composite.empty()) { if (composite.size() > COMPOSE_SIZE_MAX || composite.empty()) {
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
@ -871,7 +904,6 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect> &composi
/* Check if there is a wait before the first effect. */ /* Check if there is a wait before the first effect. */
nextEffectDelay = composite.front().delayMs; nextEffectDelay = composite.front().delayMs;
totalDuration += nextEffectDelay;
if (nextEffectDelay > COMPOSE_DELAY_MAX_MS || nextEffectDelay < 0) { if (nextEffectDelay > COMPOSE_DELAY_MAX_MS || nextEffectDelay < 0) {
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
} else if (nextEffectDelay > 0) { } else if (nextEffectDelay > 0) {
@ -904,16 +936,7 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect> &composi
if (!status.isOk()) { if (!status.isOk()) {
return status; return status;
} }
// Add a max and min threshold to prevent the device crash(overcurrent) or no
// feeling
if (effectScale > mPrimitiveMaxScale[static_cast<uint32_t>(e_curr.primitive)]) {
effectScale = mPrimitiveMaxScale[static_cast<uint32_t>(e_curr.primitive)];
}
if (effectScale < mPrimitiveMinScale[static_cast<uint32_t>(e_curr.primitive)]) {
effectScale = mPrimitiveMinScale[static_cast<uint32_t>(e_curr.primitive)];
}
effectVolLevel = intensityToVolLevel(effectScale, effectIndex); effectVolLevel = intensityToVolLevel(effectScale, effectIndex);
totalDuration += mEffectDurations[effectIndex];
} }
/* Fetch the next composite effect delay and fill into the current section */ /* Fetch the next composite effect delay and fill into the current section */
@ -926,13 +949,14 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect> &composi
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
} }
nextEffectDelay = delay; nextEffectDelay = delay;
totalDuration += delay;
} }
if (effectIndex == 0 && nextEffectDelay == 0) { if (effectIndex == 0 && nextEffectDelay == 0) {
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
} }
nextEffectDelay += mEffectBrakingDurations[effectIndex];
ch.constructComposeSegment(effectVolLevel, effectIndex, 0 /*repeat*/, 0 /*flags*/, ch.constructComposeSegment(effectVolLevel, effectIndex, 0 /*repeat*/, 0 /*flags*/,
nextEffectDelay /*delay*/); nextEffectDelay /*delay*/);
} }
@ -1129,12 +1153,7 @@ ndk::ScopedAStatus Vibrator::alwaysOnDisable(int32_t /*id*/) {
} }
ndk::ScopedAStatus Vibrator::getResonantFrequency(float *resonantFreqHz) { ndk::ScopedAStatus Vibrator::getResonantFrequency(float *resonantFreqHz) {
std::string caldata{8, '0'}; *resonantFreqHz = mResonantFrequency;
if (!mHwCalDef->getF0(&caldata)) {
ALOGE("Failed to get resonant frequency (%d): %s", errno, strerror(errno));
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
}
*resonantFreqHz = static_cast<float>(std::stoul(caldata, nullptr, 16)) / (1 << Q14_BIT_SHIFT);
return ndk::ScopedAStatus::ok(); return ndk::ScopedAStatus::ok();
} }
@ -1383,7 +1402,10 @@ binder_status_t Vibrator::dump(int fd, const char **args, uint32_t numArgs) {
dprintf(fd, "AIDL:\n"); dprintf(fd, "AIDL:\n");
dprintf(fd, " Active Effect ID: %" PRId32 "\n", mActiveId);
dprintf(fd, " F0: %.02f\n", mResonantFrequency);
dprintf(fd, " F0 Offset: base: %" PRIu32 " flip: %" PRIu32 "\n", mF0Offset, mF0OffsetDual); dprintf(fd, " F0 Offset: base: %" PRIu32 " flip: %" PRIu32 "\n", mF0Offset, mF0OffsetDual);
dprintf(fd, " Redc: %.02f\n", mRedc);
dprintf(fd, " Voltage Levels:\n"); dprintf(fd, " Voltage Levels:\n");
dprintf(fd, " Tick Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mTickEffectVol[0], dprintf(fd, " Tick Effect Min: %" PRIu32 " Max: %" PRIu32 "\n", mTickEffectVol[0],
@ -1395,24 +1417,31 @@ binder_status_t Vibrator::dump(int fd, const char **args, uint32_t numArgs) {
dprintf(fd, " FF effect:\n"); dprintf(fd, " FF effect:\n");
dprintf(fd, " Physical waveform:\n"); dprintf(fd, " Physical waveform:\n");
dprintf(fd, "==== Base ====\n\tId\tIndex\tt ->\tt'\ttrigger button\n"); dprintf(fd, "==== Base ====\n\tId\tIndex\tt ->\tt'\tBrake\ttrigger button\n");
uint8_t effectId; uint8_t effectId;
for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) { for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) {
dprintf(fd, "\t%d\t%d\t%d\t%d\t%X\n", mFfEffects[effectId].id, dprintf(fd, "\t%d\t%d\t%d\t%d\t%d\t%X\n", mFfEffects[effectId].id,
mFfEffects[effectId].u.periodic.custom_data[1], mEffectDurations[effectId], mFfEffects[effectId].u.periodic.custom_data[1], mEffectDurations[effectId],
mFfEffects[effectId].replay.length, mFfEffects[effectId].trigger.button); mFfEffects[effectId].replay.length, mEffectBrakingDurations[effectId],
mFfEffects[effectId].trigger.button);
} }
if (mIsDual) { if (mIsDual) {
dprintf(fd, "==== Flip ====\n\tId\tIndex\tt ->\tt'\ttrigger button\n"); dprintf(fd, "==== Flip ====\n\tId\tIndex\tt ->\tt'\tBrake\ttrigger button\n");
for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) { for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) {
dprintf(fd, "\t%d\t%d\t%d\t%d\t%X\n", mFfEffectsDual[effectId].id, dprintf(fd, "\t%d\t%d\t%d\t%d\t%d\t%X\n", mFfEffectsDual[effectId].id,
mFfEffectsDual[effectId].u.periodic.custom_data[1], mEffectDurations[effectId], mFfEffectsDual[effectId].u.periodic.custom_data[1], mEffectDurations[effectId],
mFfEffectsDual[effectId].replay.length, mFfEffectsDual[effectId].replay.length, mEffectBrakingDurations[effectId],
mFfEffectsDual[effectId].trigger.button); mFfEffectsDual[effectId].trigger.button);
} }
} }
dprintf(fd, "Base: OWT waveform:\n"); dprintf(fd, "==== Scales ====\n\tId\tMinScale\tMaxScale\n");
for (effectId = 0; effectId < WAVEFORM_MAX_PHYSICAL_INDEX; effectId++) {
dprintf(fd, "\t%d\t%d\t\t%d\n", effectId, mPrimitiveMinScale[effectId],
mPrimitiveMaxScale[effectId]);
}
dprintf(fd, "\nBase: OWT waveform:\n");
dprintf(fd, "\tId\tBytes\tData\tt\ttrigger button\n"); dprintf(fd, "\tId\tBytes\tData\tt\ttrigger button\n");
for (effectId = WAVEFORM_MAX_PHYSICAL_INDEX; effectId < WAVEFORM_MAX_INDEX; effectId++) { for (effectId = WAVEFORM_MAX_PHYSICAL_INDEX; effectId < WAVEFORM_MAX_INDEX; effectId++) {
uint32_t numBytes = mFfEffects[effectId].u.periodic.custom_len * 2; uint32_t numBytes = mFfEffects[effectId].u.periodic.custom_len * 2;
@ -1448,7 +1477,73 @@ binder_status_t Vibrator::dump(int fd, const char **args, uint32_t numArgs) {
} }
} }
dprintf(fd, "\n"); dprintf(fd, "\n");
dprintf(fd, "\n");
dprintf(fd, "Versions:\n");
std::ifstream verFile;
const auto verBinFileMode = std::ifstream::in | std::ifstream::binary;
std::string ver;
verFile.open("/sys/module/cs40l26_core/version");
if (verFile.is_open()) {
getline(verFile, ver);
dprintf(fd, " Haptics Driver: %s\n", ver.c_str());
verFile.close();
}
verFile.open("/sys/module/cl_dsp_core/version");
if (verFile.is_open()) {
getline(verFile, ver);
dprintf(fd, " DSP Driver: %s\n", ver.c_str());
verFile.close();
}
verFile.open("/vendor/firmware/cs40l26.wmfw", verBinFileMode);
if (verFile.is_open()) {
verFile.seekg(113);
dprintf(fd, " cs40l26.wmfw: %d.%d.%d\n", verFile.get(), verFile.get(), verFile.get());
verFile.close();
}
verFile.open("/vendor/firmware/cs40l26-calib.wmfw", verBinFileMode);
if (verFile.is_open()) {
verFile.seekg(113);
dprintf(fd, " cs40l26-calib.wmfw: %d.%d.%d\n", verFile.get(), verFile.get(),
verFile.get());
verFile.close();
}
verFile.open("/vendor/firmware/cs40l26.bin", verBinFileMode);
if (verFile.is_open()) {
while (getline(verFile, ver)) {
auto pos = ver.find("Date: ");
if (pos != std::string::npos) {
ver = ver.substr(pos + 6, pos + 15);
dprintf(fd, " cs40l26.bin: %s\n", ver.c_str());
break;
}
}
verFile.close();
}
verFile.open("/vendor/firmware/cs40l26-svc.bin", verBinFileMode);
if (verFile.is_open()) {
verFile.seekg(36);
getline(verFile, ver);
ver = ver.substr(ver.rfind('\\') + 1);
dprintf(fd, " cs40l26-svc.bin: %s\n", ver.c_str());
verFile.close();
}
verFile.open("/vendor/firmware/cs40l26-calib.bin", verBinFileMode);
if (verFile.is_open()) {
verFile.seekg(36);
getline(verFile, ver);
ver = ver.substr(ver.rfind('\\') + 1);
dprintf(fd, " cs40l26-calib.bin: %s\n", ver.c_str());
verFile.close();
}
verFile.open("/vendor/firmware/cs40l26-dvl.bin", verBinFileMode);
if (verFile.is_open()) {
verFile.seekg(36);
getline(verFile, ver);
ver = ver.substr(0, ver.find('\0') + 1);
ver = ver.substr(ver.rfind('\\') + 1);
dprintf(fd, " cs40l26-dvl.bin: %s\n", ver.c_str());
verFile.close();
}
mHwApiDef->debug(fd); mHwApiDef->debug(fd);
@ -1520,10 +1615,6 @@ ndk::ScopedAStatus Vibrator::getSimpleDetails(Effect effect, EffectStrength stre
case Effect::HEAVY_CLICK: case Effect::HEAVY_CLICK:
effectIndex = WAVEFORM_CLICK_INDEX; effectIndex = WAVEFORM_CLICK_INDEX;
intensity *= 1.0f; intensity *= 1.0f;
// WAVEFORM_CLICK_INDEX is 2, but the primitive CLICK index is 1.
if (intensity > mPrimitiveMaxScale[WAVEFORM_CLICK_INDEX - 1]) {
intensity = mPrimitiveMaxScale[WAVEFORM_CLICK_INDEX - 1];
}
break; break;
default: default:
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
@ -1765,6 +1856,17 @@ uint32_t Vibrator::intensityToVolLevel(float intensity, uint32_t effectIndex) {
volLevel = calc(intensity, mClickEffectVol); volLevel = calc(intensity, mClickEffectVol);
break; break;
} }
// The waveform being played must fall within the allowable scale range
if (effectIndex < WAVEFORM_MAX_INDEX) {
if (volLevel > mPrimitiveMaxScale[effectIndex]) {
volLevel = mPrimitiveMaxScale[effectIndex];
}
if (volLevel < mPrimitiveMinScale[effectIndex]) {
volLevel = mPrimitiveMinScale[effectIndex];
}
}
return volLevel; return volLevel;
} }

View file

@ -62,6 +62,15 @@ class Vibrator : public BnVibrator {
virtual bool setQ(std::string value) = 0; virtual bool setQ(std::string value) = 0;
// Reports the number of effect waveforms loaded in firmware. // Reports the number of effect waveforms loaded in firmware.
virtual bool getEffectCount(uint32_t *value) = 0; virtual bool getEffectCount(uint32_t *value) = 0;
// Checks whether braking time bank is supported.
virtual bool hasEffectBrakingTimeBank() = 0;
// Specifies the bank of the effect for querying braking time.
// 0: RAM bank, 2: OWT bank
virtual bool setEffectBrakingTimeBank(uint32_t value) = 0;
// Specifies the index of an effect whose braking time is to be read.
virtual bool setEffectBrakingTimeIndex(uint32_t value) = 0;
// Gets the braking time duration of SVC effects (returns 0 if not SVC).
virtual bool getEffectBrakingTimeMs(uint32_t *value) = 0;
// Blocks until timeout or vibrator reaches desired state // Blocks until timeout or vibrator reaches desired state
// (2 = ASP enabled, 1 = haptic enabled, 0 = disabled). // (2 = ASP enabled, 1 = haptic enabled, 0 = disabled).
virtual bool pollVibeState(uint32_t value, int32_t timeoutMs = -1) = 0; virtual bool pollVibeState(uint32_t value, int32_t timeoutMs = -1) = 0;
@ -218,6 +227,7 @@ class Vibrator : public BnVibrator {
std::vector<ff_effect> mFfEffects; std::vector<ff_effect> mFfEffects;
std::vector<ff_effect> mFfEffectsDual; std::vector<ff_effect> mFfEffectsDual;
std::vector<uint32_t> mEffectDurations; std::vector<uint32_t> mEffectDurations;
std::vector<uint32_t> mEffectBrakingDurations;
std::vector<std::vector<int16_t>> mEffectCustomData; std::vector<std::vector<int16_t>> mEffectCustomData;
std::vector<std::vector<int16_t>> mEffectCustomDataDual; std::vector<std::vector<int16_t>> mEffectCustomDataDual;
std::future<void> mAsyncHandle; std::future<void> mAsyncHandle;
@ -232,9 +242,11 @@ class Vibrator : public BnVibrator {
float mLongEffectScale{1.0}; float mLongEffectScale{1.0};
bool mIsChirpEnabled; bool mIsChirpEnabled;
uint32_t mSupportedPrimitivesBits = 0x0; uint32_t mSupportedPrimitivesBits = 0x0;
float mRedc{0.0f};
float mResonantFrequency{0.0f};
std::vector<CompositePrimitive> mSupportedPrimitives; std::vector<CompositePrimitive> mSupportedPrimitives;
std::vector<float> mPrimitiveMaxScale; std::vector<uint32_t> mPrimitiveMaxScale;
std::vector<float> mPrimitiveMinScale; std::vector<uint32_t> mPrimitiveMinScale;
bool mConfigHapticAlsaDeviceDone{false}; bool mConfigHapticAlsaDeviceDone{false};
bool mGPIOStatus; bool mGPIOStatus;
bool mIsDual{false}; bool mIsDual{false};

View file

@ -14,6 +14,9 @@ on property:vendor.all.modules.ready=1
chown system system /sys/bus/i2c/devices/15-0043/calibration/redc_stored chown system system /sys/bus/i2c/devices/15-0043/calibration/redc_stored
chown system system /sys/bus/i2c/devices/15-0043/default/vibe_state chown system system /sys/bus/i2c/devices/15-0043/default/vibe_state
chown system system /sys/bus/i2c/devices/15-0043/default/num_waves chown system system /sys/bus/i2c/devices/15-0043/default/num_waves
chown system system /sys/bus/i2c/devices/15-0043/default/braking_time_bank
chown system system /sys/bus/i2c/devices/15-0043/default/braking_time_index
chown system system /sys/bus/i2c/devices/15-0043/default/braking_time_ms
chown system system /sys/bus/i2c/devices/15-0043/default/f0_offset chown system system /sys/bus/i2c/devices/15-0043/default/f0_offset
chown system system /sys/bus/i2c/devices/15-0043/default/owt_free_space chown system system /sys/bus/i2c/devices/15-0043/default/owt_free_space
chown system system /sys/bus/i2c/devices/15-0043/default/f0_comp_enable chown system system /sys/bus/i2c/devices/15-0043/default/f0_comp_enable
@ -25,6 +28,9 @@ on property:vendor.all.modules.ready=1
chown system system /sys/bus/i2c/devices/15-0042/calibration/redc_stored chown system system /sys/bus/i2c/devices/15-0042/calibration/redc_stored
chown system system /sys/bus/i2c/devices/15-0042/default/vibe_state chown system system /sys/bus/i2c/devices/15-0042/default/vibe_state
chown system system /sys/bus/i2c/devices/15-0042/default/num_waves chown system system /sys/bus/i2c/devices/15-0042/default/num_waves
chown system system /sys/bus/i2c/devices/15-0042/default/braking_time_bank
chown system system /sys/bus/i2c/devices/15-0042/default/braking_time_index
chown system system /sys/bus/i2c/devices/15-0042/default/braking_time_ms
chown system system /sys/bus/i2c/devices/15-0042/default/f0_offset chown system system /sys/bus/i2c/devices/15-0042/default/f0_offset
chown system system /sys/bus/i2c/devices/15-0042/default/owt_free_space chown system system /sys/bus/i2c/devices/15-0042/default/owt_free_space
chown system system /sys/bus/i2c/devices/15-0042/default/f0_comp_enable chown system system /sys/bus/i2c/devices/15-0042/default/f0_comp_enable
@ -56,6 +62,9 @@ service vendor.vibrator.cs40l26 /vendor/bin/hw/android.hardware.vibrator-service
calibration/q_stored calibration/q_stored
default/vibe_state default/vibe_state
default/num_waves default/num_waves
default/braking_time_bank
default/braking_time_index
default/braking_time_ms
default/f0_offset default/f0_offset
default/owt_free_space default/owt_free_space
default/f0_comp_enable default/f0_comp_enable

View file

@ -39,6 +39,10 @@ class MockApi : public ::aidl::android::hardware::vibrator::Vibrator::HwApi {
MOCK_METHOD1(setRedc, bool(std::string value)); MOCK_METHOD1(setRedc, bool(std::string value));
MOCK_METHOD1(setQ, bool(std::string value)); MOCK_METHOD1(setQ, bool(std::string value));
MOCK_METHOD1(getEffectCount, bool(uint32_t *value)); MOCK_METHOD1(getEffectCount, bool(uint32_t *value));
MOCK_METHOD0(hasEffectBrakingTimeBank, bool());
MOCK_METHOD1(setEffectBrakingTimeBank, bool(uint32_t value));
MOCK_METHOD1(setEffectBrakingTimeIndex, bool(uint32_t value));
MOCK_METHOD1(getEffectBrakingTimeMs, bool(uint32_t *value));
MOCK_METHOD2(pollVibeState, bool(uint32_t value, int32_t timeoutMs)); MOCK_METHOD2(pollVibeState, bool(uint32_t value, int32_t timeoutMs));
MOCK_METHOD0(hasOwtFreeSpace, bool()); MOCK_METHOD0(hasOwtFreeSpace, bool());
MOCK_METHOD1(getOwtFreeSpace, bool(uint32_t *value)); MOCK_METHOD1(getOwtFreeSpace, bool(uint32_t *value));

View file

@ -74,7 +74,7 @@ static constexpr std::array<EffectLevel, 2> V_TICK_DEFAULT = {1, 100};
static constexpr std::array<EffectLevel, 2> V_CLICK_DEFAULT{1, 100}; static constexpr std::array<EffectLevel, 2> V_CLICK_DEFAULT{1, 100};
static constexpr std::array<EffectLevel, 2> V_LONG_DEFAULT{1, 100}; static constexpr std::array<EffectLevel, 2> V_LONG_DEFAULT{1, 100};
static constexpr std::array<EffectDuration, 14> EFFECT_DURATIONS{ static constexpr std::array<EffectDuration, 14> EFFECT_DURATIONS{
0, 100, 30, 1000, 300, 130, 150, 500, 100, 15, 20, 1000, 1000, 1000}; 1000, 100, 9, 1000, 300, 130, 150, 500, 100, 5, 12, 1000, 1000, 1000};
// Constants With Prescribed Values // Constants With Prescribed Values
@ -375,6 +375,11 @@ TEST_F(VibratorTest, Constructor) {
.WillOnce(DoAll(SetArgPointee<0>(supportedPrimitivesBits), Return(true))); .WillOnce(DoAll(SetArgPointee<0>(supportedPrimitivesBits), Return(true)));
EXPECT_CALL(*mMockApi, setMinOnOffInterval(MIN_ON_OFF_INTERVAL_US)).WillOnce(Return(true)); EXPECT_CALL(*mMockApi, setMinOnOffInterval(MIN_ON_OFF_INTERVAL_US)).WillOnce(Return(true));
EXPECT_CALL(*mMockApi, setEffectBrakingTimeBank(0)).WillRepeatedly(Return(true));
for (uint32_t i = 0; i < WAVEFORM_MAX_PHYSICAL_INDEX; i++) {
EXPECT_CALL(*mMockApi, setEffectBrakingTimeIndex(i)).WillRepeatedly(Return(true));
EXPECT_CALL(*mMockApi, getEffectBrakingTimeMs(_)).WillRepeatedly(Return(true));
}
createVibrator(std::move(mockapi), std::move(mockcal), std::move(mockgpio), false); createVibrator(std::move(mockapi), std::move(mockcal), std::move(mockgpio), false);
} }