diff options
author | Rashed Abdel-Tawab <rashed@linux.com> | 2018-09-17 12:14:16 -0700 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2018-09-17 23:00:01 +0300 |
commit | bd767ce687270079bf436373a292922b7424f60d (patch) | |
tree | b55b2074ffa10a379f7bcc77e3c9593087089f57 | |
parent | ab7bde1b685fe5e587d72a43c67440e20ad8ced3 (diff) | |
download | android_hardware_qcom_power-bd767ce687270079bf436373a292922b7424f60d.tar.gz android_hardware_qcom_power-bd767ce687270079bf436373a292922b7424f60d.tar.bz2 android_hardware_qcom_power-bd767ce687270079bf436373a292922b7424f60d.zip |
power: Return empty subsystems power stats and always use Power@1.1
Instead of supporting a 1.0 HAL, always build the 1.1 HAL and just return an empty
subsystems supported count for devices that do not have wifi power stats
Change-Id: I9b4e37fb657b07529136bf7880de0f9fe5115a1c
-rw-r--r-- | Android.mk | 13 | ||||
-rw-r--r-- | Power.cpp | 23 | ||||
-rw-r--r-- | Power.h | 14 | ||||
-rw-r--r-- | power-helper.c | 10 | ||||
-rw-r--r-- | power-helper.h | 8 |
5 files changed, 21 insertions, 47 deletions
@@ -154,17 +154,12 @@ ifneq ($(TARGET_WLAN_POWER_STAT),) LOCAL_CFLAGS += -DWLAN_POWER_STAT=\"$(TARGET_WLAN_POWER_STAT)\" endif -ifeq ($(TARGET_HAS_NO_WIFI_STATS),true) -LOCAL_MODULE := android.hardware.power@1.0-service-qti -LOCAL_INIT_RC := android.hardware.power@1.0-service-qti.rc -LOCAL_SHARED_LIBRARIES += android.hardware.power@1.0 -LOCAL_CFLAGS += -DV1_0_HAL -else +ifeq ($(TARGET_HAS_NO_WLAN_STATS),true) +LOCAL_CFLAGS += -DNO_WLAN_STATS +endif LOCAL_MODULE := android.hardware.power@1.1-service-qti LOCAL_INIT_RC := android.hardware.power@1.1-service-qti.rc -LOCAL_SHARED_LIBRARIES += android.hardware.power@1.1 -endif -LOCAL_SHARED_LIBRARIES += vendor.lineage.power@1.0 +LOCAL_SHARED_LIBRARIES += android.hardware.power@1.1 vendor.lineage.power@1.0 LOCAL_MODULE_TAGS := optional LOCAL_MODULE_OWNER := qcom LOCAL_VENDOR_MODULE := true @@ -15,11 +15,7 @@ * limitations under the License. */ -#ifdef V1_0_HAL -#define LOG_TAG "android.hardware.power@1.0-service-qti" -#else #define LOG_TAG "android.hardware.power@1.1-service-qti" -#endif // #define LOG_NDEBUG 0 @@ -36,20 +32,14 @@ extern struct stat_pair rpm_stat_map[]; namespace android { namespace hardware { namespace power { -#ifdef V1_0_HAL -namespace V1_0 { -#else namespace V1_1 { -#endif namespace implementation { using ::android::hardware::power::V1_0::Feature; using ::android::hardware::power::V1_0::PowerHint; using ::android::hardware::power::V1_0::PowerStatePlatformSleepState; using ::android::hardware::power::V1_0::Status; -#ifndef V1_0_HAL using ::android::hardware::power::V1_1::PowerStateSubsystem; -#endif using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; @@ -176,9 +166,9 @@ done: #endif } -#ifndef V1_0_HAL // Methods from ::android::hardware::power::V1_1::IPower follow. +#ifndef NO_WLAN_STATS static int get_wlan_low_power_stats(struct PowerStateSubsystem &subsystem) { uint64_t stats[WLAN_POWER_PARAMS_COUNT] = {0}; @@ -210,10 +200,15 @@ static int get_wlan_low_power_stats(struct PowerStateSubsystem &subsystem) { return 0; } +#endif Return<void> Power::getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) { - hidl_vec<PowerStateSubsystem> subsystems; +#ifdef NO_WLAN_STATS + subsystems.resize(0); + _hidl_cb(subsystems, Status::SUCCESS); + return Void(); +#else int ret; subsystems.resize(subsystem_type::SUBSYSTEM_COUNT); @@ -228,13 +223,13 @@ Return<void> Power::getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl done: _hidl_cb(subsystems, Status::SUCCESS); return Void(); +#endif } Return<void> Power::powerHintAsync(PowerHint hint, int32_t data) { // just call the normal power hint in this oneway function return powerHint(hint, data); } -#endif Return<int32_t> Power::getFeature(LineageFeature feature) { if (feature == LineageFeature::SUPPORTED_PROFILES) { @@ -267,7 +262,7 @@ fail: } } // namespace implementation -} // namespace V1_0/1 +} // namespace V1_1 } // namespace power } // namespace hardware } // namespace android @@ -18,11 +18,7 @@ #ifndef ANDROID_HARDWARE_POWER_V1_1_POWER_H #define ANDROID_HARDWARE_POWER_V1_1_POWER_H -#ifdef V1_0_HAL -#include <android/hardware/power/1.0/IPower.h> -#else #include <android/hardware/power/1.1/IPower.h> -#endif #include <vendor/lineage/power/1.0/ILineagePower.h> #include <hidl/MQDescriptor.h> #include <hidl/Status.h> @@ -31,20 +27,12 @@ namespace android { namespace hardware { namespace power { -#ifdef V1_0_HAL -namespace V1_0 { -#else namespace V1_1 { -#endif namespace implementation { using ::android::hardware::power::V1_0::Feature; using ::android::hardware::power::V1_0::PowerHint; -#ifdef V1_0_HAL -using ::android::hardware::power::V1_0::IPower; -#else using ::android::hardware::power::V1_1::IPower; -#endif using ::vendor::lineage::power::V1_0::ILineagePower; using ::vendor::lineage::power::V1_0::LineageFeature; using ::android::hardware::Return; @@ -61,11 +49,9 @@ struct Power : public IPower, public ILineagePower { Return<void> setFeature(Feature feature, bool activate) override; Return<void> getPlatformLowPowerStats(getPlatformLowPowerStats_cb _hidl_cb) override; -#ifndef V1_0_HAL // Methods from ::android::hardware::power::V1_1::IPower follow. Return<void> getSubsystemLowPowerStats(getSubsystemLowPowerStats_cb _hidl_cb) override; Return<void> powerHintAsync(PowerHint hint, int32_t data) override; -#endif // Methods from ::vendor::lineage::power::V1_0::ILineagePower follow. Return<int32_t> getFeature(LineageFeature feature) override; diff --git a/power-helper.c b/power-helper.c index 1e4c05c..59f3ab7 100644 --- a/power-helper.c +++ b/power-helper.c @@ -75,7 +75,7 @@ Path for QCACLD2 and Prima: /d/wlan_wcnss/power_stats */ -#ifndef V1_0_HAL +#ifndef NO_WLAN_STATS #ifndef WLAN_POWER_STAT #define WLAN_POWER_STAT "/d/wlan0/power_stats" #endif @@ -103,7 +103,7 @@ static const char *rpm_master_param_names[] = { "xo_count" }; -#ifndef V1_0_HAL +#ifndef NO_WLAN_STATS static const char *wlan_param_names[] = { "cumulative_sleep_time_ms", "cumulative_total_on_time_ms", @@ -137,7 +137,7 @@ struct stat_pair rpm_stat_map[] = { }; #endif -#ifndef V1_0_HAL +#ifndef NO_WLAN_STATS const char *wlan_power_stat_params[] = { "cumulative_sleep_time_ms", "cumulative_total_on_time_ms", @@ -456,7 +456,7 @@ int extract_platform_stats(uint64_t *list) { return 0; } -#ifndef V1_0_HAL +#ifndef NO_WLAN_STATS int extract_wlan_stats(uint64_t *list) { int ret; ret = extract_stats(list, WLAN_POWER_STAT, wlan_param_names, WLAN_POWER_PARAMS_COUNT, false); @@ -554,7 +554,7 @@ int extract_platform_stats(uint64_t *list) { return extract_stats(list, RPM_SYSTEM_STAT, rpm_stat_map, ARRAY_SIZE(rpm_stat_map)); } -#ifndef V1_0_HAL +#ifndef NO_WLAN_STATS int extract_wlan_stats(uint64_t *list) { return extract_stats(list, WLAN_POWER_STAT, wlan_stat_map, ARRAY_SIZE(wlan_stat_map)); } diff --git a/power-helper.h b/power-helper.h index 3a5fc19..a5a6f27 100644 --- a/power-helper.h +++ b/power-helper.h @@ -75,23 +75,21 @@ enum stats_type { VOTER_SPSS, MAX_PLATFORM_STATS, -#ifndef V1_0_HAL +#ifndef NO_WLAN_STATS //WLAN Stats WLAN_POWER_DEBUG_STATS = 0, MAX_WLAN_STATS, #endif }; +#ifndef NO_WLAN_STATS enum subsystem_type { -#ifndef V1_0_HAL SUBSYSTEM_WLAN = 0, -#endif //Don't add any lines after this line SUBSYSTEM_COUNT }; -#ifndef V1_0_HAL enum wlan_sleep_states { WLAN_STATE_ACTIVE = 0, WLAN_STATE_DEEP_SLEEP, @@ -134,7 +132,7 @@ void power_hint(power_hint_t hint, void *data); void power_set_interactive(int on); void set_feature(feature_t feature, int state); int extract_platform_stats(uint64_t *list); -#ifndef V1_0_HAL +#ifndef NO_WLAN_STATS int extract_wlan_stats(uint64_t *list); #endif int __attribute__ ((weak)) get_number_of_profiles(); |