| /* |
| * Copyright (c) 2016, The Linux Foundation. All rights reserved. |
| * |
| * This program is free software; you can redistribute it and/or modify |
| * it under the terms of the GNU General Public License version 2 and |
| * only version 2 as published by the Free Software Foundation. |
| * |
| * This program is distributed in the hope that it will be useful, |
| * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| * GNU General Public License for more details. |
| */ |
| |
| #ifndef __DRIVERS_CLK_QCOM_VDD_LEVEL_COBALT_H |
| #define __DRIVERS_CLK_QCOM_VDD_LEVEL_COBALT_H |
| |
| #include <linux/regulator/consumer.h> |
| #include <dt-bindings/regulator/qcom,rpmh-regulator.h> |
| |
| #define VDD_CX_FMAX_MAP1(l1, f1) \ |
| .vdd_class = &vdd_cx, \ |
| .rate_max = (unsigned long[VDD_CX_NUM]) { \ |
| [VDD_CX_##l1] = (f1), \ |
| }, \ |
| .num_rate_max = VDD_CX_NUM |
| |
| #define VDD_CX_FMAX_MAP2(l1, f1, l2, f2) \ |
| .vdd_class = &vdd_cx, \ |
| .rate_max = (unsigned long[VDD_CX_NUM]) { \ |
| [VDD_CX_##l1] = (f1), \ |
| [VDD_CX_##l2] = (f2), \ |
| }, \ |
| .num_rate_max = VDD_CX_NUM |
| |
| #define VDD_CX_FMAX_MAP3(l1, f1, l2, f2, l3, f3) \ |
| .vdd_class = &vdd_cx, \ |
| .rate_max = (unsigned long[VDD_CX_NUM]) { \ |
| [VDD_CX_##l1] = (f1), \ |
| [VDD_CX_##l2] = (f2), \ |
| [VDD_CX_##l3] = (f3), \ |
| }, \ |
| .num_rate_max = VDD_CX_NUM |
| |
| #define VDD_CX_FMAX_MAP4(l1, f1, l2, f2, l3, f3, l4, f4) \ |
| .vdd_class = &vdd_cx, \ |
| .rate_max = (unsigned long[VDD_CX_NUM]) { \ |
| [VDD_CX_##l1] = (f1), \ |
| [VDD_CX_##l2] = (f2), \ |
| [VDD_CX_##l3] = (f3), \ |
| [VDD_CX_##l4] = (f4), \ |
| }, \ |
| .num_rate_max = VDD_CX_NUM |
| |
| #define VDD_CX_FMAX_MAP5(l1, f1, l2, f2, l3, f3, l4, f4, l5, f5) \ |
| .vdd_class = &vdd_cx, \ |
| .rate_max = (unsigned long[VDD_CX_NUM]) { \ |
| [VDD_CX_##l1] = (f1), \ |
| [VDD_CX_##l2] = (f2), \ |
| [VDD_CX_##l3] = (f3), \ |
| [VDD_CX_##l4] = (f4), \ |
| [VDD_CX_##l5] = (f5), \ |
| }, \ |
| .num_rate_max = VDD_CX_NUM |
| |
| #define VDD_CX_FMAX_MAP6(l1, f1, l2, f2, l3, f3, l4, f4, l5, f5, l6, f6) \ |
| .vdd_class = &vdd_cx, \ |
| .rate_max = (unsigned long[VDD_CX_NUM]) { \ |
| [VDD_CX_##l1] = (f1), \ |
| [VDD_CX_##l2] = (f2), \ |
| [VDD_CX_##l3] = (f3), \ |
| [VDD_CX_##l4] = (f4), \ |
| [VDD_CX_##l5] = (f5), \ |
| [VDD_CX_##l6] = (f6), \ |
| }, \ |
| .num_rate_max = VDD_CX_NUM |
| |
| #define VDD_CX_FMAX_MAP1_AO(l1, f1) \ |
| .vdd_class = &vdd_cx_ao, \ |
| .rate_max = (unsigned long[VDD_CX_NUM]) { \ |
| [VDD_CX_##l1] = (f1), \ |
| }, \ |
| .num_rate_max = VDD_CX_NUM |
| |
| #define VDD_CX_FMAX_MAP3_AO(l1, f1, l2, f2, l3, f3) \ |
| .vdd_class = &vdd_cx_ao, \ |
| .rate_max = (unsigned long[VDD_CX_NUM]) { \ |
| [VDD_CX_##l1] = (f1), \ |
| [VDD_CX_##l2] = (f2), \ |
| [VDD_CX_##l3] = (f3), \ |
| }, \ |
| .num_rate_max = VDD_CX_NUM |
| |
| |
| enum vdd_cx_levels { |
| VDD_CX_NONE, |
| VDD_CX_MIN, /* MIN SVS */ |
| VDD_CX_LOWER, /* SVS2 */ |
| VDD_CX_LOW, /* SVS */ |
| VDD_CX_LOW_L1, /* SVSL1 */ |
| VDD_CX_NOMINAL, /* NOM */ |
| VDD_CX_HIGH, /* TURBO */ |
| VDD_CX_NUM, |
| }; |
| |
| /* Need to use the correct VI/VL mappings */ |
| static int vdd_corner[] = { |
| RPMH_REGULATOR_LEVEL_OFF, /* VDD_CX_NONE */ |
| RPMH_REGULATOR_LEVEL_MIN_SVS, /* VDD_CX_MIN */ |
| RPMH_REGULATOR_LEVEL_LOW_SVS, /* VDD_CX_LOWER */ |
| RPMH_REGULATOR_LEVEL_SVS, /* VDD_CX_LOW */ |
| RPMH_REGULATOR_LEVEL_SVS_L1, /* VDD_CX_LOW_L1 */ |
| RPMH_REGULATOR_LEVEL_NOM, /* VDD_CX_NOMINAL */ |
| RPMH_REGULATOR_LEVEL_TURBO, /* VDD_CX_HIGH */ |
| }; |
| |
| #endif |