Snap for 10017868 from 61c27d5d74 to udc-qpr1-release

Change-Id: I268b3b71b8e5bf6e65c129fce27e11fe8d93319d
This commit is contained in:
Android Build Coastguard Worker 2023-04-28 01:08:00 +00:00
commit 916be97d39
22 changed files with 491 additions and 44 deletions

View file

@ -32,7 +32,6 @@ TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_VARIANT := cortex-a55
TARGET_CPU_VARIANT_RUNTIME := cortex-a55
BOARD_KERNEL_CMDLINE += dyndbg=\"func alloc_contig_dump_pages +p\"
BOARD_KERNEL_CMDLINE += earlycon=exynos4210,0x10870000 console=ttySAC0,115200 androidboot.console=ttySAC0 printk.devkmsg=on
BOARD_KERNEL_CMDLINE += cma_sysfs.experimental=Y
BOARD_KERNEL_CMDLINE += cgroup_disable=memory
@ -152,6 +151,10 @@ BOARD_AVB_VBMETA_SYSTEM_ALGORITHM := SHA256_RSA2048
BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION := 1
ifneq ($(PRODUCT_BUILD_PVMFW_IMAGE),false)
BOARD_AVB_VBMETA_SYSTEM += pvmfw
endif
# Enable chained vbmeta for boot images
BOARD_AVB_BOOT_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
BOARD_AVB_BOOT_ALGORITHM := SHA256_RSA2048

2
OWNERS Normal file
View file

@ -0,0 +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:master:/OWNERS

View file

@ -105,6 +105,9 @@ on init
write /sys/block/zram0/comp_algorithm lz77eh
write /proc/sys/vm/page-cluster 0
# Adjust watermark level
write /proc/sys/vm/watermark_scale_factor 200
# Some user code relies on ro.boot.hardware.revision
setprop ro.boot.hardware.revision ${ro.revision}
@ -119,7 +122,7 @@ on init
symlink /data/app /factory
# Apply network parameters for high data performance.
write /proc/sys/net/core/rmem_default 327680
write /proc/sys/net/core/rmem_default 1310720
write /proc/sys/net/core/rmem_max 8388608
write /proc/sys/net/core/wmem_default 327680
write /proc/sys/net/core/wmem_max 8388608
@ -375,6 +378,9 @@ on post-fs-data
# Modem SIM log folder
mkdir /data/vendor/radio/sim 0771 radio system
# Modem OTA UECap folder
mkdir /data/vendor/radio/ota_uecap 0773 radio system
# Unzipped modem images folder
mkdir /data/vendor/radio/image 0771 radio system
@ -719,6 +725,9 @@ on property:sys.boot_completed=1
# Enable UFS powersaving
write /dev/sys/block/bootdevice/clkgate_enable 1
# Cancel boot devfreq
write /sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/exynos_data/cancel_boot_freq 1
# Setup final cpuset
write /dev/cpuset/top-app/cpus 0-8
write /dev/cpuset/foreground/cpus 0-7
@ -814,9 +823,12 @@ on property:sys.boot_completed=1
# Disable GPU firmware logging
write /sys/devices/platform/1f000000.mali/firmware_config/Log\ verbosity/cur 0
#Enable SICD
# Enable SICD
write /sys/devices/system/cpu/cpupm/cpupm/sicd 1
on property:sys.boot_completed=1 && property:persist.sys.device_provisioned=1 && property:ro.boot.flash.locked=1
write /sys/class/power_supply/battery/first_usage_date 0
# IMS WiFi Calling
service charonservice /system/vendor/bin/charon
class main

View file

@ -192,3 +192,9 @@ on property:sys.usb.config=charger && property:sys.usb.configfs=1
on property:ro.bootmode=usbuwb
setprop persist.vendor.usb.usbradio.config uwb_acm
on property:persist.vendor.usb.displayport.enabled=1
write /sys/class/typec/port0/port0.0/mode1/active "yes"
on property:persist.vendor.usb.displayport.enabled=0
write /sys/class/typec/port0/port0.0/mode1/active "no"

View file

@ -212,6 +212,7 @@
/dev/dma_heap/farawimg-secure 0444 system graphics
/dev/dma_heap/tui-secure 0444 system graphics
/dev/dma_heap/vframe-secure 0444 system drmrpc
/dev/dma_heap/framebuffer-secure 0444 system drmrpc
/dev/dma_heap/vscaler-secure 0444 system graphics
/dev/dma_heap/vstream-secure 0444 system drmrpc
/dev/dma_heap/sensor_direct_heap 0444 system graphics

View file

@ -47,6 +47,8 @@
<!-- Location -->
<permission name="android.permission.ACCESS_FINE_LOCATION" fixed="false"/>
<permission name="android.permission.ACCESS_BACKGROUND_LOCATION" fixed="false"/>
<!-- Battery Widget -->
<permission name="android.permission.BLUETOOTH_CONNECT" fixed="false"/>
</exception>
<exception package="com.google.android.apps.cbrsnetworkmonitor">

View file

@ -30,7 +30,7 @@ PRODUCT_COPY_FILES += \
# Set system properties identifying the chipset
PRODUCT_VENDOR_PROPERTIES += ro.soc.manufacturer=Google
PRODUCT_VENDOR_PROPERTIES += ro.soc.model=ZUMA
TARGET_VENDOR_PROP += device/google/zuma/vendor.prop
PRODUCT_PRODUCT_PROPERTIES += \
persist.vendor.testing_battery_profile=2

View file

@ -196,6 +196,14 @@ PRODUCT_PROPERTY_OVERRIDES += \
PRODUCT_PROPERTY_OVERRIDES += \
telephony.active_modems.max_count=2
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_PROPERTY_OVERRIDES += \
persist.vendor.usb.displayport.enabled=1
else
PRODUCT_PROPERTY_OVERRIDES += \
persist.vendor.usb.displayport.enabled=0
endif
USE_LASSEN_OEMHOOK := true
# Use for GRIL
@ -260,8 +268,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.vulkan.deqp.level-2021-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \
frameworks/native/data/etc/android.software.opengles.deqp.level-2021-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.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
#endif
@ -515,7 +523,7 @@ PRODUCT_PACKAGES += \
android.hardware.graphics.allocator-V1-service
PRODUCT_PACKAGES += \
memtrack.$(TARGET_BOARD_PLATFORM) \
android.hardware.memtrack-service.pixel \
libion_exynos \
libion

View file

@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.health</name>
<version>1</version>
<version>2</version>
<fqname>IHealth/default</fqname>
</hal>
</manifest>

View file

@ -15,6 +15,7 @@
-->
<MediaCodecs>
<Include href="media_codecs_aosp_c2.xml" />
<Include href="media_codecs_dolby_c2.xml" />
<Decoders>
<MediaCodec name="c2.google.av1.decoder" type="video/av01">
<Limit name="size" min="96x96" max="3840x2160" />

View file

@ -112,8 +112,8 @@
</MediaCodec>
<MediaCodec name="c2.android.h263.decoder" type="video/3gpp" update="true">
<!-- measured 90%:261-267 med:261 N=2 -->
<Limit name="measured-frame-rate-176x144" range="261-264" /> <!-- v90%=1.0 -->
<Limit name="measured-frame-rate-176x144" range="993-1037" />
<Limit name="measured-frame-rate-352x288" range="847-906" />
</MediaCodec>
<MediaCodec name="c2.android.avc.decoder" type="video/avc" update="true">
<!-- measured 90%:342-360 med:343 N=2 -->
@ -138,8 +138,9 @@
<Limit name="measured-frame-rate-1920x1080" range="45-46" /> <!-- v90%=1.0 -->
</MediaCodec>
<MediaCodec name="c2.android.mpeg4.decoder" type="video/mp4v-es" update="true">
<!-- measured 90%:234-241 med:234 N=2 -->
<Limit name="measured-frame-rate-176x144" range="234-237" /> <!-- v90%=1.0 -->
<Limit name="measured-frame-rate-176x144" range="1111-1176" />
<Limit name="measured-frame-rate-480x360" range="964-1042" />
<Limit name="measured-frame-rate-1280x720" range="294-300" />
</MediaCodec>
<MediaCodec name="c2.android.vp8.decoder" type="video/x-vnd.on2.vp8" update="true">
<!-- measured 90%:445-623 med:445 SLOW N=2 -->
@ -183,6 +184,12 @@
<!-- measured 90%:45-47 med:46 N=2 -->
<Limit name="measured-frame-rate-1920x1080" range="45-46" /> <!-- v90%=1.0 -->
</MediaCodec>
<MediaCodec name="c2.android.av1.decoder" type="video/av01" update="true">
<Limit name="measured-frame-rate-352x288" range="233-315" />
<Limit name="measured-frame-rate-640x360" range="114-247" />
<Limit name="measured-frame-rate-720x480" range="47-189" />
<Limit name="measured-frame-rate-1280x720" range="44-54" />
</MediaCodec>
</Decoders>
<Encoders>
@ -242,38 +249,65 @@
<!-- measured 90%:84-86 med:85 N=2 -->
<Limit name="measured-frame-rate-1920x1080" range="84-85" /> <!-- v90%=1.0 -->
</MediaCodec>
<MediaCodec name="c2.google.av1.encoder" type="video/av01" update="true">
<!-- measured 90%:292-307 med:292 N=2 -->
<Limit name="measured-frame-rate-320x240" range="292-299" /> <!-- v90%=1.0 -->
<!-- measured 90%:162-164 med:162 N=2 -->
<Limit name="measured-frame-rate-720x480" range="162-163" /> <!-- v90%=1.0 -->
<!-- measured 90%:79-80 med:79 N=2 -->
<Limit name="measured-frame-rate-1280x720" range="79-79" /> <!-- v90%=1.0 -->
<!-- measured 90%:40-41 med:41 N=2 -->
<Limit name="measured-frame-rate-1920x1080" range="40-41" /> <!-- v90%=1.0 -->
</MediaCodec>
<MediaCodec name="c2.android.h263.encoder" type="video/3gpp" update="true">
<!-- measured 90%:440-443 med:440 N=2 -->
<Limit name="measured-frame-rate-176x144" range="440-441" /> <!-- v90%=1.0 -->
<!-- measured 90%:868-1433 med:869 SLOW N=2 -->
<Limit name="measured-frame-rate-176x144" range="868-1116" /> <!-- v90%=1.3 -->
</MediaCodec>
<MediaCodec name="c2.android.avc.encoder" type="video/avc" update="true">
<!-- measured 90%:345-350 med:345 N=2 -->
<Limit name="measured-frame-rate-320x240" range="345-347" /> <!-- v90%=1.0 -->
<!-- measured 90%:101-103 med:101 N=2 -->
<Limit name="measured-frame-rate-720x480" range="101-102" /> <!-- v90%=1.0 -->
<!-- measured 90%:54-55 med:54 N=2 -->
<Limit name="measured-frame-rate-1280x720" range="54-54" /> <!-- v90%=1.0 -->
<!-- measured 90%:28-30 med:29 N=2 -->
<Limit name="measured-frame-rate-1920x1080" range="28-29" /> <!-- v90%=1.0 -->
<!-- measured 90%:357-443 med:427 N=4 -->
<Limit name="measured-frame-rate-320x240" range="398-398" /> <!-- v90%=1.1 -->
<!-- measured 90%:110-150 med:133 N=4 -->
<Limit name="measured-frame-rate-720x480" range="128-128" /> <!-- v90%=1.2 -->
<!-- measured 90%:57-87 med:78 N=4 -->
<Limit name="measured-frame-rate-1280x720" range="70-70" /> <!-- v90%=1.2 -->
<!-- measured 90%:43-47 med:46 N=4 -->
<Limit name="measured-frame-rate-1920x1080" range="45-45" /> <!-- v90%=1.0 -->
</MediaCodec>
<MediaCodec name="c2.android.hevc.encoder" type="video/hevc" update="true">
<!-- measured 90%:61-65 med:62 N=8 -->
<Limit name="measured-frame-rate-320x240" range="18-22" /> <!-- v90%=1.0 -->
<!-- measured 90%:43-46 med:44 N=4 -->
<Limit name="measured-frame-rate-320x240" range="43-44" /> <!-- v90%=1.0 -->
</MediaCodec>
<MediaCodec name="c2.android.mpeg4.encoder" type="video/mp4v-es" update="true">
<!-- measured 90%:461-471 med:462 N=2 -->
<Limit name="measured-frame-rate-176x144" range="461-466" /> <!-- v90%=1.0 -->
<!-- measured 90%:1426-1471 med:1427 N=2 -->
<Limit name="measured-frame-rate-176x144" range="1426-1448" /> <!-- v90%=1.0 -->
</MediaCodec>
<MediaCodec name="c2.android.vp8.encoder" type="video/x-vnd.on2.vp8" update="true">
<!-- measured 90%:49-87 med:50 SLOW N=2 -->
<Limit name="measured-frame-rate-320x180" range="394-395" /> <!-- v90%=1.3 -->
<!-- measured 90%:55-57 med:56 N=2 -->
<Limit name="measured-frame-rate-640x360" range="196-197" /> <!-- v90%=1.0 -->
<!-- measured 90%:34-35 med:34 N=2 -->
<Limit name="measured-frame-rate-1280x720" range="34-34" /> <!-- v90%=1.0 -->
<!-- measured 90%:29-31 med:30 N=2 -->
<Limit name="measured-frame-rate-1920x1080" range="29-30" /> <!-- v90%=1.0 -->
<!-- measured 90%:392-448 med:392 N=2 -->
<Limit name="measured-frame-rate-320x180" range="392-419" /> <!-- v90%=1.1 -->
<!-- measured 90%:213-226 med:214 N=2 -->
<Limit name="measured-frame-rate-640x360" range="213-219" /> <!-- v90%=1.0 -->
<!-- measured 90%:48-54 med:49 N=2 -->
<Limit name="measured-frame-rate-1280x720" range="48-51" /> <!-- v90%=1.1 -->
<!-- measured 90%:35-37 med:36 N=2 -->
<Limit name="measured-frame-rate-1920x1080" range="35-36" /> <!-- v90%=1.0 -->
</MediaCodec>
<MediaCodec name="c2.android.vp9.encoder" type="video/x-vnd.on2.vp9" update="true">
<!-- measured 90%:304-378 med:304 SLOW N=2 -->
<Limit name="measured-frame-rate-320x180" range="304-339" /> <!-- v90%=1.1 -->
<!-- measured 90%:103-106 med:104 N=2 -->
<Limit name="measured-frame-rate-640x360" range="103-104" /> <!-- v90%=1.0 -->
<!-- measured 90%:20-24 med:21 N=2 -->
<Limit name="measured-frame-rate-1280x720" range="20-22" /> <!-- v90%=1.1 -->
</MediaCodec>
<MediaCodec name="c2.android.av1.encoder" type="video/av01" update="true">
<!-- measured 90%:367-372 med:367 N=2 -->
<Limit name="measured-frame-rate-320x240" range="367-369" /> <!-- v90%=1.0 -->
<!-- measured 90%:66-78 med:67 N=2 -->
<Limit name="measured-frame-rate-720x480" range="66-72" /> <!-- v90%=1.1 -->
<!-- measured 90%:23-28 med:23 N=2 -->
<Limit name="measured-frame-rate-1280x720" range="23-25" /> <!-- v90%=1.1 -->
</MediaCodec>
</Encoders>
</MediaCodecs>

View file

@ -1,3 +1,3 @@
#name,version,ml_type,compute_enable,compute_timer,train_enable,train_timer,monitor_enable_monitor_timer,execution_type,execution_timer
sample_linear_reg,0,LEGACY,true,5000,false,0,false,0,SYNCHRONOUS_REGULAR,5000
sample_fully_conn,0,LEGACY,true,5000,false,0,false,0,SYNCHRONOUS_REGULAR,5000
sample_linear_reg,0,LEGACY,false,0,false,0,false,0,SYNCHRONOUS_REGULAR,5000
sample_fully_conn,0,LEGACY,false,0,false,0,false,0,SYNCHRONOUS_REGULAR,5000

View file

@ -1,3 +1,3 @@
#name,version,ml_type,compute_enable,compute_timer,train_enable,train_timer,monitor_enable_monitor_timer,execution_type,execution_timer
sample_linear_reg,0,LEGACY,true,5000,true,5000,true,5000,SYNCHRONOUS_REGULAR,5000
sample_fully_conn,0,LEGACY,true,5000,true,5000,true,5000,SYNCHRONOUS_REGULAR,5000
sample_linear_reg,0,LEGACY,false,0,false,0,false,0,SYNCHRONOUS_REGULAR,5000
sample_fully_conn,0,LEGACY,false,0,false,0,false,0,SYNCHRONOUS_REGULAR,5000

View file

@ -59,6 +59,14 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = {
UFS_ERR_PATH(auto_hibern8_err_count)
},
.AmsRatePath = "/sys/devices/platform/audiometrics/ams_rate_read_once",
.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",
},
.ResumeLatencyMetricsPath = "/sys/kernel/metrics/resume_latency/resume_latency_metrics",
.LongIRQMetricsPath = "/sys/kernel/metrics/irq/long_irq_metrics",
.TempResidencyPaths = {

Binary file not shown.

View file

@ -46,7 +46,7 @@ cc_binary {
"android.hardware.thermal@2.0",
"android.hardware.thermal-V1-ndk",
"android.hardware.usb.gadget@1.0",
"android.hardware.usb-V1-ndk",
"android.hardware.usb-V2-ndk",
"android.hardware.usb.gadget-V1-ndk",
"libcutils",
"android.frameworks.stats-V1-ndk",

View file

@ -33,6 +33,7 @@
#include <cutils/uevent.h>
#include <sys/epoll.h>
#include <sys/eventfd.h>
#include <utils/Errors.h>
#include <utils/StrongPointer.h>
@ -44,6 +45,8 @@
using aidl::android::frameworks::stats::IStats;
using android::base::GetProperty;
using android::base::Join;
using android::base::Tokenize;
using android::base::Trim;
using android::hardware::google::pixel::getStatsService;
using android::hardware::google::pixel::PixelAtoms::VendorUsbPortOverheat;
@ -55,11 +58,14 @@ namespace hardware {
namespace usb {
// Set by the signal handler to destroy the thread
volatile bool destroyThread;
volatile bool destroyDisplayPortThread;
string enabledPath;
constexpr char kHsi2cPath[] = "/sys/devices/platform/10cb0000.hsi2c";
constexpr char kI2CPath[] = "/sys/devices/platform/10cb0000.hsi2c/i2c-";
constexpr char kContaminantDetectionPath[] = "-0025/contaminant_detection";
constexpr char kDisplayPortDrmPath[] = "/sys/devices/platform/110f0000.drmdp/drm-displayport/";
constexpr char kDisplayPortUsbPath[] = "/sys/class/typec/port0-partner/";
constexpr char kStatusPath[] = "-0025/contaminant_detection_status";
constexpr char kSinkLimitEnable[] = "-0025/usb_limit_sink_enable";
constexpr char kSourceLimitEnable[] = "-0025/usb_limit_source_enable";
@ -395,7 +401,8 @@ Usb::Usb()
ThrottlingSeverity::NONE),
ZoneInfo(TemperatureType::UNKNOWN, kThermalZoneForTempReadSecondary2,
ThrottlingSeverity::NONE)}, kSamplingIntervalSec),
mUsbDataEnabled(true) {
mUsbDataEnabled(true),
mDisplayPortLock(PTHREAD_MUTEX_INITIALIZER) {
pthread_condattr_t attr;
if (pthread_condattr_init(&attr)) {
ALOGE("pthread_condattr_init failed: %s", strerror(errno));
@ -413,6 +420,11 @@ Usb::Usb()
ALOGE("pthread_condattr_destroy failed: %s", strerror(errno));
abort();
}
mDisplayPortShutdown = eventfd(0, EFD_NONBLOCK);
if (mDisplayPortShutdown == -1) {
ALOGE("mDisplayPortShutdown eventfd failed: %s", strerror(errno));
abort();
}
}
ScopedAStatus Usb::switchRole(const string& in_portName, const PortRole& in_role,
@ -850,10 +862,22 @@ struct data {
::aidl::android::hardware::usb::Usb *usb;
};
enum UeventType { UNKNOWN, BIND, CHANGE };
enum UeventType matchUeventType(char* str) {
if (!strncmp(str, "ACTION=bind", strlen("ACTION=bind"))) {
return UeventType::BIND;
} else if (!strncmp(str, "ACTION=change", strlen("ACTION=change"))) {
return UeventType::CHANGE;
}
return UeventType::UNKNOWN;
}
static void uevent_event(uint32_t /*epevents*/, struct data *payload) {
char msg[UEVENT_MSG_LEN + 2];
char *cp;
int n;
enum UeventType uevent_type = UeventType::UNKNOWN;
n = uevent_kernel_multicast_recv(payload->uevent_fd, msg, UEVENT_MSG_LEN);
if (n <= 0)
@ -897,10 +921,25 @@ static void uevent_event(uint32_t /*epevents*/, struct data *payload) {
}
pthread_mutex_unlock(&payload->usb->mRoleSwitchLock);
}
break;
if (!!strncmp(cp, "DEVTYPE=typec_alternate_mode", strlen("DEVTYPE=typec_alternate_mode"))) {
break;
}
} else if (!strncmp(cp, kOverheatStatsDev, strlen(kOverheatStatsDev))) {
ALOGV("Overheat Cooling device suez update");
report_overheat_event(payload->usb);
} else if (!(strncmp(cp, "ACTION=", strlen("ACTION=")))) {
uevent_type = matchUeventType(cp);
} else if (!strncmp(cp, "DRIVER=typec_displayport", strlen("DRIVER=typec_displayport"))) {
if (uevent_type == UeventType::BIND) {
pthread_mutex_lock(&payload->usb->mDisplayPortLock);
payload->usb->setupDisplayPortPoll();
pthread_mutex_unlock(&payload->usb->mDisplayPortLock);
} else if (uevent_type == UeventType::CHANGE) {
pthread_mutex_lock(&payload->usb->mDisplayPortLock);
payload->usb->shutdownDisplayPortPoll();
pthread_mutex_unlock(&payload->usb->mDisplayPortLock);
}
break;
}
/* advance to after the next \0 */
while (*cp++) {
@ -1016,6 +1055,304 @@ ScopedAStatus Usb::setCallback(const shared_ptr<IUsbCallback>& in_callback) {
return ScopedAStatus::ok();
}
Status Usb::getDisplayPortUsbPathHelper(string *path) {
DIR *dp;
Status result = Status::ERROR;
dp = opendir(kDisplayPortUsbPath);
if (dp != NULL) {
struct dirent *ep;
// Iterate through all alt mode directories to find displayport driver
while ((ep = readdir(dp))) {
if (ep->d_type == DT_DIR) {
DIR *displayPortDp;
string portPartnerPath = string(kDisplayPortUsbPath) + string(ep->d_name)
+ "/displayport/";
displayPortDp = opendir(portPartnerPath.c_str());
if (displayPortDp != NULL) {
*path = portPartnerPath;
closedir(displayPortDp);
result = Status::SUCCESS;
break;
}
}
}
closedir(dp);
}
return result;
}
Status Usb::writeDisplayPortAttributeOverride(string attribute, string value) {
string attrDrmPath;
// Get Drm Path
attrDrmPath = string(kDisplayPortDrmPath) + attribute;
// Write to drm
if(!WriteStringToFile(value, attrDrmPath)) {
ALOGE("usbdp: Failed to write attribute %s to drm: %s", attribute.c_str(), value.c_str());
return Status::ERROR;
}
ALOGI("usbdp: Successfully wrote attribute %s: %s to drm.", attribute.c_str(), value.c_str());
return Status::SUCCESS;
}
Status Usb::writeDisplayPortAttribute(string attribute, string usb_path) {
string attrUsb, attrDrm, attrDrmPath;
// Get Drm Path
attrDrmPath = string(kDisplayPortDrmPath) + attribute;
// Read Attribute
if(!ReadFileToString(usb_path, &attrUsb)) {
ALOGE("usbdp: Failed to open or read Type-C attribute %s", attribute.c_str());
return Status::ERROR;
}
// Separate Logic for hpd and pin_assignment
if (!strncmp(attribute.c_str(), "hpd", strlen("hpd"))) {
if (!strncmp(attrUsb.c_str(), "0", strlen("0"))) {
// Read DRM attribute to compare
if(!ReadFileToString(attrDrmPath, &attrDrm)) {
ALOGE("usbdp: Failed to open or read hpd from drm");
return Status::ERROR;
}
if (!strncmp(attrDrm.c_str(), "0", strlen("0"))) {
ALOGI("usbdp: Skipping hpd write when drm and usb both equal 0");
return Status::SUCCESS;
}
}
} else if (!strncmp(attribute.c_str(), "pin_assignment", strlen("pin_assignment"))) {
size_t pos = attrUsb.find("[");
if (pos != string::npos) {
ALOGI("usbdp: Modifying Pin Config from %s", attrUsb.c_str());
attrUsb = attrUsb.substr(pos+1, 1);
} else {
// Don't write anything
ALOGI("usbdp: Pin config not yet chosen, nothing written.");
return Status::SUCCESS;
}
}
// Write to drm
if(!WriteStringToFile(attrUsb, attrDrmPath)) {
ALOGE("usbdp: Failed to write attribute %s to drm: %s", attribute.c_str(), attrUsb.c_str());
return Status::ERROR;
}
ALOGI("usbdp: Successfully wrote attribute %s: %s to drm.", attribute.c_str(), attrUsb.c_str());
return Status::SUCCESS;
}
bool Usb::determineDisplayPortRetry(string linkPath, string hpdPath) {
string linkStatus, hpd;
if(ReadFileToString(linkPath, &linkStatus) && ReadFileToString(hpdPath, &hpd)) {
if (!strncmp(linkStatus.c_str(), "2", strlen("2")) &&
!strncmp(hpd.c_str(), "1", strlen("1"))) {
return true;
}
}
return false;
}
static int displayPortPollOpenFileHelper(const char *file, int flags) {
int fd = open(file, flags);
if (fd == -1) {
ALOGE("usbdp: open at %s failed; errno=%d", file, errno);
}
return fd;
}
void *displayPortPollWork(void *param) {
int epoll_fd;
struct epoll_event ev_hpd, ev_pin, ev_orientation, ev_eventfd, ev_link;
int nevents = 0;
int numRetries = 0;
int hpd_fd, pin_fd, orientation_fd, link_fd;
int file_flags = O_RDONLY;
int epoll_flags;
bool orientationSet = false;
bool pinSet = false;
string displayPortUsbPath;
string hpdPath, pinAssignmentPath, orientationPath, linkPath;
::aidl::android::hardware::usb::Usb *usb = (::aidl::android::hardware::usb::Usb *)param;
if (usb->getDisplayPortUsbPathHelper(&displayPortUsbPath) == Status::ERROR) {
ALOGE("usbdp: could not locate usb displayport directory");
goto usb_path_error;
}
ALOGI("usbdp: displayport usb path located at %s", displayPortUsbPath.c_str());
hpdPath = displayPortUsbPath + "hpd";
pinAssignmentPath = displayPortUsbPath + "pin_assignment";
orientationPath = "/sys/class/typec/port0/orientation";
linkPath = string(kDisplayPortDrmPath) + "link_status";
epoll_fd = epoll_create(64);
if (epoll_fd == -1) {
ALOGE("usbdp: epoll_create failed; errno=%d", errno);
goto epoll_fd_error;
}
if ((hpd_fd = displayPortPollOpenFileHelper(hpdPath.c_str(), file_flags)) == -1){
goto hpd_fd_error;
}
if ((pin_fd = displayPortPollOpenFileHelper(pinAssignmentPath.c_str(), file_flags)) == -1){
goto pin_fd_error;
}
if ((orientation_fd = displayPortPollOpenFileHelper(orientationPath.c_str(), file_flags))
== -1){
goto orientation_fd_error;
}
if ((link_fd = displayPortPollOpenFileHelper(linkPath.c_str(), file_flags)) == -1){
goto link_fd_error;
}
// Set epoll_event events and flags
epoll_flags = EPOLLIN | EPOLLET;
ev_hpd.events = epoll_flags;
ev_pin.events = epoll_flags;
ev_orientation.events = epoll_flags;
ev_eventfd.events = epoll_flags;
ev_link.events = epoll_flags;
ev_hpd.data.fd = hpd_fd;
ev_pin.data.fd = pin_fd;
ev_orientation.data.fd = orientation_fd;
ev_eventfd.data.fd = usb->mDisplayPortShutdown;
ev_link.data.fd = link_fd;
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, hpd_fd, &ev_hpd) == -1) {
ALOGE("usbdp: epoll_ctl failed to add hpd; errno=%d", errno);
goto error;
}
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, pin_fd, &ev_pin) == -1) {
ALOGE("usbdp: epoll_ctl failed to add pin; errno=%d", errno);
goto error;
}
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, orientation_fd, &ev_orientation) == -1) {
ALOGE("usbdp: epoll_ctl failed to add orientation; errno=%d", errno);
goto error;
}
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, link_fd, &ev_link) == -1) {
ALOGE("usbdp: epoll_ctl failed to add link status; errno=%d", errno);
goto error;
}
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, usb->mDisplayPortShutdown, &ev_eventfd) == -1) {
ALOGE("usbdp: epoll_ctl failed to add orientation; errno=%d", errno);
goto error;
}
while (!destroyDisplayPortThread) {
struct epoll_event events[64];
nevents = epoll_wait(epoll_fd, events, 64, -1);
if (nevents == -1) {
if (errno == EINTR)
continue;
ALOGE("usbdp: epoll_wait failed; errno=%d", errno);
break;
}
for (int n = 0; n < nevents; n++) {
if (events[n].data.fd == hpd_fd) {
if (!pinSet || !orientationSet) {
ALOGW("usbdp: HPD may be set before pin_assignment and orientation");
}
usb->writeDisplayPortAttribute("hpd", hpdPath);
} else if (events[n].data.fd == pin_fd) {
usb->writeDisplayPortAttribute("pin_assignment", pinAssignmentPath);
pinSet = true;
} else if (events[n].data.fd == orientation_fd) {
usb->writeDisplayPortAttribute("orientation", orientationPath);
orientationSet = true;
} else if (events[n].data.fd == link_fd) {
if (usb->determineDisplayPortRetry(linkPath, hpdPath) && numRetries < 3) {
ALOGW("usbdp: Link Training Failed, rewriting hpd to trigger retry.");
usb->writeDisplayPortAttributeOverride("hpd", "1");
numRetries++;
}
} else if (events[n].data.fd == usb->mDisplayPortShutdown) {
uint64_t flag = 0;
if (!read(usb->mDisplayPortShutdown, &flag, sizeof(flag))) {
if (errno == EAGAIN)
continue;
ALOGI("usbdp: Shutdown eventfd read error");
goto error;
}
if (flag == DISPLAYPORT_SHUTDOWN_SET) {
ALOGI("usbdp: Shutdown eventfd triggered");
destroyDisplayPortThread = true;
break;
}
}
}
}
error:
close(link_fd);
link_fd_error:
close(orientation_fd);
orientation_fd_error:
close(pin_fd);
pin_fd_error:
close(hpd_fd);
hpd_fd_error:
epoll_ctl(epoll_fd, EPOLL_CTL_DEL, usb->mDisplayPortShutdown, &ev_eventfd);
close(epoll_fd);
epoll_fd_error:
usb_path_error:
ALOGI("usbdp: Exiting worker thread");
return NULL;
}
void Usb::setupDisplayPortPoll() {
uint64_t flag = DISPLAYPORT_SHUTDOWN_CLEAR;
write(mDisplayPortShutdown, &flag, sizeof(flag));
destroyDisplayPortThread = false;
/*
* Create a background thread to poll DisplayPort system files
*/
if (pthread_create(&mDisplayPortPoll, NULL, displayPortPollWork, this)) {
ALOGE("usbdp: failed to create displayport poll thread %d", errno);
}
ALOGI("usbdp: successfully started DisplayPort poll thread");
return;
}
void Usb::shutdownDisplayPortPollHelper() {
pthread_join(mDisplayPortPoll, NULL);
}
void *shutdownDisplayPortPollWork(void *param) {
::aidl::android::hardware::usb::Usb *usb = (::aidl::android::hardware::usb::Usb *)param;
usb->shutdownDisplayPortPollHelper();
ALOGI("usbdp: DisplayPort Thread Shutdown");
return NULL;
}
void Usb::shutdownDisplayPortPoll() {
uint64_t flag = DISPLAYPORT_SHUTDOWN_SET;
string displayPortUsbPath;
// Determine if should shutdown thread
// getDisplayPortUsbPathHelper locates a DisplayPort directory, no need to double check
// directory.
if (getDisplayPortUsbPathHelper(&displayPortUsbPath) == Status::SUCCESS) {
return;
}
// Shutdown thread, make sure to rewrite hpd because file no longer exists.
write(mDisplayPortShutdown, &flag, sizeof(flag));
if (pthread_create(&mDisplayPortShutdownHelper, NULL, shutdownDisplayPortPollWork, this)) {
ALOGE("pthread creation failed %d", errno);
}
writeDisplayPortAttributeOverride("hpd", "0");
destroyDisplayPortThread = false;
}
} // namespace usb
} // namespace hardware
} // namespace android

View file

@ -20,6 +20,7 @@
#include <aidl/android/hardware/usb/BnUsb.h>
#include <aidl/android/hardware/usb/BnUsbCallback.h>
#include <pixelusb/UsbOverheatEvent.h>
#include <sys/eventfd.h>
#include <utils/Log.h>
#define UEVENT_MSG_LEN 2048
@ -38,6 +39,7 @@ using ::aidl::android::hardware::usb::IUsbCallback;
using ::aidl::android::hardware::usb::PortRole;
using ::android::base::ReadFileToString;
using ::android::base::WriteStringToFile;
using ::android::base::unique_fd;
using ::android::hardware::google::pixel::usb::UsbOverheatEvent;
using ::android::hardware::google::pixel::usb::ZoneInfo;
using ::android::hardware::thermal::V2_0::TemperatureType;
@ -46,6 +48,7 @@ using ::android::sp;
using ::ndk::ScopedAStatus;
using ::std::shared_ptr;
using ::std::string;
using ::std::thread;
constexpr char kGadgetName[] = "11210000.dwc3";
#define NEW_UDC_PATH "/sys/devices/platform/11210000.usb/"
@ -54,6 +57,9 @@ constexpr char kGadgetName[] = "11210000.dwc3";
#define VBUS_PATH NEW_UDC_PATH "dwc3_exynos_otg_b_sess"
#define USB_DATA_PATH NEW_UDC_PATH "usb_data_enabled"
#define DISPLAYPORT_SHUTDOWN_CLEAR 0
#define DISPLAYPORT_SHUTDOWN_SET 1
struct Usb : public BnUsb {
Usb();
@ -71,6 +77,14 @@ struct Usb : public BnUsb {
int64_t in_transactionId) override;
ScopedAStatus resetUsbPort(const string& in_portName, int64_t in_transactionId) override;
Status getDisplayPortUsbPathHelper(string *path);
Status writeDisplayPortAttributeOverride(string attribute, string value);
Status writeDisplayPortAttribute(string attribute, string usb_path);
bool determineDisplayPortRetry(string linkPath, string hpdPath);
void setupDisplayPortPoll();
void shutdownDisplayPortPollHelper();
void shutdownDisplayPortPoll();
std::shared_ptr<::aidl::android::hardware::usb::IUsbCallback> mCallback;
// Protects mCallback variable
pthread_mutex_t mLock;
@ -89,8 +103,16 @@ struct Usb : public BnUsb {
float mPluggedTemperatureCelsius;
// Usb Data status
bool mUsbDataEnabled;
// Protects writeDisplayPortToExynos(), setupDisplayPortPoll(), and
// shutdownDisplayPortPoll()
pthread_mutex_t mDisplayPortLock;
// eventfd to signal DisplayPort thread
int mDisplayPortShutdown;
private:
pthread_t mPoll;
pthread_t mDisplayPortPoll;
pthread_t mDisplayPortShutdownHelper;
};
} // namespace usb

View file

@ -68,6 +68,10 @@ on post-fs
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/usb_limit_source_enable
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/usb_limit_source_enable
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/usb_limit_source_enable
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/hpd
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/orientation
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/pin_assignment
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/link_status
chown root system /sys/devices/platform/11110000.usb/dwc3_exynos_otg_b_sess
chown root system /sys/devices/platform/11110000.usb/dwc3_exynos_otg_id
chown root system /sys/devices/platform/11110000.usb/usb_data_enabled
@ -138,4 +142,8 @@ on post-fs
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/usb_limit_source_enable
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/usb_limit_source_enable
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/usb_limit_source_enable
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/hpd
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/orientation
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/pin_assignment
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/link_status
chmod 664 /sys/devices/platform/google,pogo/enable_usb

View file

@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.usb</name>
<version>1</version>
<version>2</version>
<interface>
<name>IUsb</name>
<instance>default</instance>

1
vendor.prop Normal file
View file

@ -0,0 +1 @@
ro.soc.model=Tensor G3

View file

@ -1,4 +1,6 @@
PRODUCT_PACKAGES += \
android.hardware.drm-service.clearkey \
android.hardware.drm-service.widevine
android.hardware.drm-service.clearkey
-include vendor/widevine/libwvdrmengine/apex/device/device.mk
BOARD_VENDOR_SEPOLICY_DIRS += device/google/zuma-sepolicy/widevine