1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef HARDWARE_GOOGLE_PIXEL_POWERSTATS_IAXXXSTATERESIDENCYDATAPROVIDER_H
17 #define HARDWARE_GOOGLE_PIXEL_POWERSTATS_IAXXXSTATERESIDENCYDATAPROVIDER_H
18 
19 #include <pixelpowerstats/PowerStats.h>
20 
21 #include <unordered_map>
22 
23 #include <linux/mfd/adnc/iaxxx-module.h>
24 
25 namespace android {
26 namespace hardware {
27 namespace google {
28 namespace pixel {
29 namespace powerstats {
30 
31 class IaxxxStateResidencyDataProvider : public IStateResidencyDataProvider {
32   public:
33     IaxxxStateResidencyDataProvider(uint32_t id);
34     ~IaxxxStateResidencyDataProvider() = default;
35     bool getResults(
36             std::unordered_map<uint32_t, PowerEntityStateResidencyResult> &results) override;
37     std::vector<PowerEntityStateSpace> getStateSpaces() override;
38 
39   private:
40     const std::string mPath;
41     const uint32_t mPowerEntityId;
42     static constexpr std::string_view mStateNames[] = {
43         "MPLL_3MHz",  "MPLL_5MHz",  "MPLL_6MHz",   "MPLL_8MHz",  "MPLL_10MHz", "MPLL_15MHz",
44         "MPLL_30MHz", "MPLL_35MHz", "MPLL_40MHz",  "MPLL_45MHz", "MPLL_50MHz", "MPLL_55MHz",
45         "MPLL_60MHz", "MPLL_80MHz", "MPLL_120MHz", "Sleep"};
46     static_assert(NUM_MPLL_CLK_FREQ + 1 == sizeof(mStateNames) / sizeof(*mStateNames),
47                   "mStateNames must have an entry for each of the MPLL frequencies and sleep");
48 };
49 
50 }  // namespace powerstats
51 }  // namespace pixel
52 }  // namespace google
53 }  // namespace hardware
54 }  // namespace android
55 
56 #endif  // HARDWARE_GOOGLE_PIXEL_POWERSTATS_IAXXXSTATERESIDENCYDATAPROVIDER_H
57