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

Commit ab8313ca authored by Oscar Shu's avatar Oscar Shu
Browse files

Add new API to set max power limits for mAFC

HAL API support for setting max permissible power on a range of
frequencies. Unspecified frequencies will get reverted to their
respective default values.

Also add capability flag for this new API.

Bug: 242917176
Test: make -j128
Test: Manually verified the framework can call the HAL API

Change-Id: I14ac494124b51ca0b85c394eefe6332c4b382d19
parent 1ae58617
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
///////////////////////////////////////////////////////////////////////////////

// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
//     the interface (from the latest frozen version), the build system will
//     prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.

package android.hardware.wifi;
@VintfStability
parcelable AvailableAfcFrequencyInfo {
  int startFrequencyMhz;
  int endFrequencyMhz;
  int maxPsd;
}
+2 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ interface IWifiChip {
  android.hardware.wifi.WifiRadioCombinationMatrix getSupportedRadioCombinationsMatrix();
  android.hardware.wifi.WifiChipCapabilities getWifiChipCapabilities();
  android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in android.hardware.wifi.WifiIfaceMode ifaceModeMask, in android.hardware.wifi.IWifiChip.UsableChannelFilter filterMask);
  void setAfcChannelAllowance(in android.hardware.wifi.AvailableAfcFrequencyInfo[] availableAfcFrequencyInfo);
  void registerEventCallback(in android.hardware.wifi.IWifiChipEventCallback callback);
  void removeApIface(in String ifname);
  void removeIfaceInstanceFromBridgedApIface(in String brIfaceName, in String ifaceInstanceName);
@@ -99,6 +100,7 @@ interface IWifiChip {
    SET_LATENCY_MODE = (1 << 12),
    P2P_RAND_MAC = (1 << 13),
    WIGIG = (1 << 14),
    SET_AFC_CHANNEL_ALLOWANCE = (1 << 15),
  }
  @VintfStability
  parcelable ChipConcurrencyCombinationLimit {
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.wifi;

/**
 * Defines the maximum permissible power spectral density on a range of
 * frequencies to support 6Ghz with standard power for AFC.
 * The format of the data follows spec from the Wi-Fi Alliance AFC System to
 * AFC Device Interface Specification: AvailableFrequencyInfo object.
 */
@VintfStability
parcelable AvailableAfcFrequencyInfo {
    /**
     * Defines the lowest frequency included in this 6Ghz frequency range.
     */
    int startFrequencyMhz;
    /**
     * Defines the highest frequency included in this 6Ghz frequency range.
     */
    int endFrequencyMhz;
    /**
     * The maximum permissible EIRP available in any one MHz bin within the
     * frequency range specified. The limit is expressed as a power spectral
     * density with units of dBm per MHz.
     */
    int maxPsd;
}
+18 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.hardware.wifi;

import android.hardware.wifi.AvailableAfcFrequencyInfo;
import android.hardware.wifi.IWifiApIface;
import android.hardware.wifi.IWifiChipEventCallback;
import android.hardware.wifi.IWifiNanIface;
@@ -105,6 +106,11 @@ interface IWifiChip {
         * Chip can operate in the 60GHz band (WiGig chip).
         */
        WIGIG = 1 << 14,
        /**
         * Chip supports setting allowed channels along with PSD in 6GHz band
         * for AFC purposes.
         */
        SET_AFC_CHANNEL_ALLOWANCE = 1 << 15,
    }

    /**
@@ -835,6 +841,18 @@ interface IWifiChip {
    WifiUsableChannel[] getUsableChannels(
            in WifiBand band, in WifiIfaceMode ifaceModeMask, in UsableChannelFilter filterMask);

    /*
     * Set the max power level the chip is allowed to transmit on for 6Ghz AFC
     * using an array of AvailableAfcFrequencyInfo. The max power for
     * frequencies not included in the input frequency ranges will be reset to
     * their respective default values.
     * @param availableAfcFrequencyInfo The list of frequency ranges and
     * corresponding max allowed power.
     * @throws ServiceSpecificException with one of the following values:
     *         |WifiStatusCode.ERROR_NOT_SUPPORTED|
     */
    void setAfcChannelAllowance(in AvailableAfcFrequencyInfo[] availableAfcFrequencyInfo);

    /**
     * Requests notifications of significant events on this chip. Multiple calls
     * to this must register multiple callbacks, each of which must receive all
+12 −0
Original line number Diff line number Diff line
@@ -670,6 +670,12 @@ ndk::ScopedAStatus WifiChip::getUsableChannels(WifiBand in_band, WifiIfaceMode i
                           in_ifaceModeMask, in_filterMask);
}

ndk::ScopedAStatus WifiChip::setAfcChannelAllowance(
        const std::vector<AvailableAfcFrequencyInfo>& availableAfcFrequencyInfo) {
    return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
                           &WifiChip::setAfcChannelAllowanceInternal, availableAfcFrequencyInfo);
}

ndk::ScopedAStatus WifiChip::triggerSubsystemRestart() {
    return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
                           &WifiChip::triggerSubsystemRestartInternal);
@@ -1394,6 +1400,12 @@ std::pair<std::vector<WifiUsableChannel>, ndk::ScopedAStatus> WifiChip::getUsabl
    return {aidl_usable_channels, ndk::ScopedAStatus::ok()};
}

ndk::ScopedAStatus WifiChip::setAfcChannelAllowanceInternal(
        const std::vector<AvailableAfcFrequencyInfo>& availableAfcFrequencyInfo) {
    LOG(INFO) << "setAfcChannelAllowance is not yet supported " << availableAfcFrequencyInfo.size();
    return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED);
}

std::pair<WifiRadioCombinationMatrix, ndk::ScopedAStatus>
WifiChip::getSupportedRadioCombinationsMatrixInternal() {
    legacy_hal::wifi_error legacy_status;
Loading