Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82396e9e authored by Roshan Pius's avatar Roshan Pius Committed by android-build-merger
Browse files

Merge "wifi(hidl): Modify the SAR power levels interface" into oc-dr1-dev

am: dda74bcf

Change-Id: I504fe9096b855c6270c50c1e46b4e5ee26b9ea67
parents 74fcad94 dda74bcf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -220,4 +220,4 @@ bb7c96762d0aa3ddb874c8815bacdd3cbc8fb87ea2f82b928bc29e24a3593055 android.hardwar
c3354ab0d381a236c12dc486ad4b6bec28c979d26748b4661f12ede36f392808 android.hardware.wifi.offload@1.0::IOffloadCallback
b18caefefcc765092412285d776234fcf213b73bdf07ae1b67a5f71b2d2464e3 android.hardware.wifi.offload@1.0::types
c26473e2e4a00af43e28a0ddf9002e5062a7d0940429e5efb6e5513a8abcb75c android.hardware.wifi@1.1::IWifi
bfcf4856c7b6c66ebc56785ed3e5d181b7be859c2add672497a843b024518737 android.hardware.wifi@1.1::IWifiChip
b056e1defab4071584214584057d0bc73a613081bf1152590549649d4582c13c android.hardware.wifi@1.1::IWifiChip
+25 −9
Original line number Diff line number Diff line
/*
 * Copyright 2016 The Android Open Source Project
 * Copyright 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -44,11 +44,26 @@ interface IWifiChip extends @1.0::IWifiChip {
  };

  /**
   * API to set TX power limit.
   * This is used for meeting SAR requirements while making VOIP calls for
   * example.
   * List of preset wifi radio TX power levels for different scenarios.
   * The actual power values (typically varies based on the channel,
   * 802.11 connection type, number of MIMO streams, etc) for each scenario
   * is defined by the OEM as a BDF file since it varies for each wifi chip
   * vendor and device.
   */
  enum TxPowerScenario : uint32_t {
    VOICE_CALL = 0,
  };

  /**
   * API to select one of the preset TX power scenarios.
   *
   * The framework must invoke this method with the appropriate scenario to let
   * the wifi chip change it's transmitting power levels.
   * OEM's should define various power profiles for each of the scenarios
   * above (defined in |TxPowerScenario|).
   *
   * @param powerInDbm Power level in dBm.
   * @param scenario One of the preselected scenarios defined in
   *        |TxPowerScenario|.
   * @return status WifiStatus of the operation.
   *         Possible status codes:
   *         |WifiStatusCode.SUCCESS|,
@@ -57,11 +72,12 @@ interface IWifiChip extends @1.0::IWifiChip {
   *         |WifiStatusCode.NOT_AVAILABLE|,
   *         |WifiStatusCode.UNKNOWN|
   */
  setTxPowerLimit(int32_t powerInDbm) generates (WifiStatus status);
  selectTxPowerScenario(TxPowerScenario scenario) generates (WifiStatus status);

  /**
   * API to reset TX power limit.
   * This is used to set the power back to default values.
   * API to reset TX power levels.
   * This is used to indicate the end of the previously selected TX power
   * scenario and let the wifi chip fall back to the default power values.
   *
   * @return status WifiStatus of the operation.
   *         Possible status codes:
@@ -71,5 +87,5 @@ interface IWifiChip extends @1.0::IWifiChip {
   *         |WifiStatusCode.NOT_AVAILABLE|,
   *         |WifiStatusCode.UNKNOWN|
   */
  resetTxPowerLimit() generates (WifiStatus status);
  resetTxPowerScenario() generates (WifiStatus status);
};
+9 −3
Original line number Diff line number Diff line
@@ -17,9 +17,6 @@
#include <android-base/logging.h>
#include <utils/SystemClock.h>

#include <android/hardware/wifi/1.0/IWifiChip.h>
#include <android/hardware/wifi/1.1/IWifiChip.h>

#include "hidl_struct_util.h"

namespace android {
@@ -260,6 +257,15 @@ bool convertLegacyWakeReasonStatsToHidl(
  return true;
}

legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy(
    V1_1::IWifiChip::TxPowerScenario hidl_scenario) {
  switch (hidl_scenario) {
    case V1_1::IWifiChip::TxPowerScenario::VOICE_CALL:
      return legacy_hal::WIFI_POWER_SCENARIO_VOICE_CALL;
  };
  CHECK(false);
}

bool convertLegacyFeaturesToHidlStaCapabilities(
    uint32_t legacy_feature_set,
    uint32_t legacy_logger_feature_set,
+4 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@
#include <vector>

#include <android/hardware/wifi/1.0/types.h>
#include <android/hardware/wifi/1.0/IWifiChip.h>
#include <android/hardware/wifi/1.1/IWifiChip.h>

#include "wifi_legacy_hal.h"

@@ -51,6 +53,8 @@ bool convertLegacyVectorOfDebugRingBufferStatusToHidl(
bool convertLegacyWakeReasonStatsToHidl(
    const legacy_hal::WakeReasonStats& legacy_stats,
    WifiDebugHostWakeReasonStats* hidl_stats);
legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy(
    V1_1::IWifiChip::TxPowerScenario hidl_scenario);

// STA iface conversion methods.
bool convertLegacyFeaturesToHidlStaCapabilities(
+12 −11
Original line number Diff line number Diff line
@@ -343,20 +343,20 @@ Return<void> WifiChip::enableDebugErrorAlerts(
                         enable);
}

Return<void> WifiChip::setTxPowerLimit(
    int32_t powerInDbm, setTxPowerLimit_cb hidl_status_cb) {
Return<void> WifiChip::selectTxPowerScenario(
    TxPowerScenario scenario, selectTxPowerScenario_cb hidl_status_cb) {
  return validateAndCall(this,
                         WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
                         &WifiChip::setTxPowerLimitInternal,
                         &WifiChip::selectTxPowerScenarioInternal,
                         hidl_status_cb,
                         powerInDbm);
                         scenario);
}

Return<void> WifiChip::resetTxPowerLimit(
    resetTxPowerLimit_cb hidl_status_cb) {
Return<void> WifiChip::resetTxPowerScenario(
    resetTxPowerScenario_cb hidl_status_cb) {
  return validateAndCall(this,
                         WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
                         &WifiChip::resetTxPowerLimitInternal,
                         &WifiChip::resetTxPowerScenarioInternal,
                         hidl_status_cb);
}

@@ -824,13 +824,14 @@ WifiStatus WifiChip::enableDebugErrorAlertsInternal(bool enable) {
  return createWifiStatusFromLegacyError(legacy_status);
}

WifiStatus WifiChip::setTxPowerLimitInternal(int32_t powerInDbm) {
  auto legacy_status = legacy_hal_.lock()->setTxPowerLimit(powerInDbm);
WifiStatus WifiChip::selectTxPowerScenarioInternal(TxPowerScenario scenario) {
  auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario(
      hidl_struct_util::convertHidlTxPowerScenarioToLegacy(scenario));
  return createWifiStatusFromLegacyError(legacy_status);
}

WifiStatus WifiChip::resetTxPowerLimitInternal() {
  auto legacy_status = legacy_hal_.lock()->resetTxPowerLimit();
WifiStatus WifiChip::resetTxPowerScenarioInternal() {
  auto legacy_status = legacy_hal_.lock()->resetTxPowerScenario();
  return createWifiStatusFromLegacyError(legacy_status);
}

Loading