/* * Voltage regulator support for AMS AS3722 PMIC * * Copyright (C) 2013 ams * * Author: Florian Lobmaier * Author: Laxman Dewangan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include #include #include #include #include #include #include #include #include #include #include /* Regulator IDs */ enum as3722_regulators_id { AS3722_REGULATOR_ID_SD0, AS3722_REGULATOR_ID_SD1, AS3722_REGULATOR_ID_SD2, AS3722_REGULATOR_ID_SD3, AS3722_REGULATOR_ID_SD4, AS3722_REGULATOR_ID_SD5, AS3722_REGULATOR_ID_SD6, AS3722_REGULATOR_ID_LDO0, AS3722_REGULATOR_ID_LDO1, AS3722_REGULATOR_ID_LDO2, AS3722_REGULATOR_ID_LDO3, AS3722_REGULATOR_ID_LDO4, AS3722_REGULATOR_ID_LDO5, AS3722_REGULATOR_ID_LDO6, AS3722_REGULATOR_ID_LDO7, AS3722_REGULATOR_ID_LDO9, AS3722_REGULATOR_ID_LDO10, AS3722_REGULATOR_ID_LDO11, AS3722_REGULATOR_ID_MAX, }; struct as3722_register_mapping { u8 regulator_id; const char *name; const char *sname; u8 vsel_reg; u8 vsel_mask; int n_voltages; u32 enable_reg; u8 enable_mask; u32 control_reg; u8 mode_mask; u32 sleep_ctrl_reg; u8 sleep_ctrl_mask; }; struct as3722_regulator_config_data { struct regulator_init_data *reg_init; bool enable_tracking; int ext_control; }; struct as3722_regulators { struct device *dev; struct as3722 *as3722; struct regulator_dev *rdevs[AS3722_REGULATOR_ID_MAX]; struct regulator_desc desc[AS3722_REGULATOR_ID_MAX]; struct as3722_regulator_config_data reg_config_data[AS3722_REGULATOR_ID_MAX]; }; static const struct as3722_register_mapping as3722_reg_lookup[] = { { .regulator_id = AS3722_REGULATOR_ID_SD0, .name = "as3722-sd0", .vsel_reg = AS3722_SD0_VOLTAGE_REG, .vsel_mask = AS3722_SD_VSEL_MASK, .enable_reg = AS3722_SD_CONTROL_REG, .enable_mask = AS3722_SDn_CTRL(0), .sleep_ctrl_reg = AS3722_ENABLE_CTRL1_REG, .sleep_ctrl_mask = AS3722_SD0_EXT_ENABLE_MASK, .control_reg = AS3722_SD0_CONTROL_REG, .mode_mask = AS3722_SD0_MODE_FAST, }, { .regulator_id = AS3722_REGULATOR_ID_SD1, .name = "as3722-sd1", .vsel_reg = AS3722_SD1_VOLTAGE_REG, .vsel_mask = AS3722_SD_VSEL_MASK, .enable_reg = AS3722_SD_CONTROL_REG, .enable_mask = AS3722_SDn_CTRL(1), .sleep_ctrl_reg = AS3722_ENABLE_CTRL1_REG, .sleep_ctrl_mask = AS3722_SD1_EXT_ENABLE_MASK, .control_reg = AS3722_SD1_CONTROL_REG, .mode_mask = AS3722_SD1_MODE_FAST, }, { .regulator_id = AS3722_REGULATOR_ID_SD2, .name = "as3722-sd2", .sname = "vsup-sd2", .vsel_reg = AS3722_SD2_VOLTAGE_REG, .vsel_mask = AS3722_SD_VSEL_MASK, .enable_reg = AS3722_SD_CONTROL_REG, .enable_mask = AS3722_SDn_CTRL(2), .sleep_ctrl_reg = AS3722_ENABLE_CTRL1_REG, .sleep_ctrl_mask = AS3722_SD2_EXT_ENABLE_MASK, .control_reg = AS3722_SD23_CONTROL_REG, .mode_mask = AS3722_SD2_MODE_FAST, .n_voltages = AS3722_SD2_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_SD3, .name = "as3722-sd3", .sname = "vsup-sd3", .vsel_reg = AS3722_SD3_VOLTAGE_REG, .vsel_mask = AS3722_SD_VSEL_MASK, .enable_reg = AS3722_SD_CONTROL_REG, .enable_mask = AS3722_SDn_CTRL(3), .sleep_ctrl_reg = AS3722_ENABLE_CTRL1_REG, .sleep_ctrl_mask = AS3722_SD3_EXT_ENABLE_MASK, .control_reg = AS3722_SD23_CONTROL_REG, .mode_mask = AS3722_SD3_MODE_FAST, .n_voltages = AS3722_SD2_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_SD4, .name = "as3722-sd4", .sname = "vsup-sd4", .vsel_reg = AS3722_SD4_VOLTAGE_REG, .vsel_mask = AS3722_SD_VSEL_MASK, .enable_reg = AS3722_SD_CONTROL_REG, .enable_mask = AS3722_SDn_CTRL(4), .sleep_ctrl_reg = AS3722_ENABLE_CTRL2_REG, .sleep_ctrl_mask = AS3722_SD4_EXT_ENABLE_MASK, .control_reg = AS3722_SD4_CONTROL_REG, .mode_mask = AS3722_SD4_MODE_FAST, .n_voltages = AS3722_SD2_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_SD5, .name = "as3722-sd5", .sname = "vsup-sd5", .vsel_reg = AS3722_SD5_VOLTAGE_REG, .vsel_mask = AS3722_SD_VSEL_MASK, .enable_reg = AS3722_SD_CONTROL_REG, .enable_mask = AS3722_SDn_CTRL(5), .sleep_ctrl_reg = AS3722_ENABLE_CTRL2_REG, .sleep_ctrl_mask = AS3722_SD5_EXT_ENABLE_MASK, .control_reg = AS3722_SD5_CONTROL_REG, .mode_mask = AS3722_SD5_MODE_FAST, .n_voltages = AS3722_SD2_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_SD6, .name = "as3722-sd6", .vsel_reg = AS3722_SD6_VOLTAGE_REG, .vsel_mask = AS3722_SD_VSEL_MASK, .enable_reg = AS3722_SD_CONTROL_REG, .enable_mask = AS3722_SDn_CTRL(6), .sleep_ctrl_reg = AS3722_ENABLE_CTRL2_REG, .sleep_ctrl_mask = AS3722_SD6_EXT_ENABLE_MASK, .control_reg = AS3722_SD6_CONTROL_REG, .mode_mask = AS3722_SD6_MODE_FAST, }, { .regulator_id = AS3722_REGULATOR_ID_LDO0, .name = "as3722-ldo0", .sname = "vin-ldo0", .vsel_reg = AS3722_LDO0_VOLTAGE_REG, .vsel_mask = AS3722_LDO0_VSEL_MASK, .enable_reg = AS3722_LDOCONTROL0_REG, .enable_mask = AS3722_LDO0_CTRL, .sleep_ctrl_reg = AS3722_ENABLE_CTRL3_REG, .sleep_ctrl_mask = AS3722_LDO0_EXT_ENABLE_MASK, .n_voltages = AS3722_LDO0_NUM_VOLT, }, { .regulator_id = AS3722_REGULATOR_ID_LDO1, .name = "as3722-ldo1", .sname = "vin-ldo1-6", .vsel_reg = AS3722_LDO1_VOLTAGE_REG, .vsel_mask = AS3722_LDO_VSEL_MASK, .enable_reg = AS3722_LDOCONTROL0_REG, .enable_mask = AS3722_LDO1_CTRL, .sleep_ctrl_reg = AS3722_ENABLE_CTRL3_REG, .sleep_ctrl_mask = AS3722_LDO1_EXT_ENABLE_MASK, .n_voltages = AS3722_LDO_NUM_VOLT, }, { .regulator_id = AS3722_REGULATOR_ID_LDO2, .name = "as3722-ldo2", .sname = "vin-ldo2-5-7", .vsel_reg = AS3722_LDO2_VOLTAGE_REG, .vsel_mask = AS3722_LDO_VSEL_MASK, .enable_reg = AS3722_LDOCONTROL0_REG, .enable_mask = AS3722_LDO2_CTRL, .sleep_ctrl_reg = AS3722_ENABLE_CTRL3_REG, .sleep_ctrl_mask = AS3722_LDO2_EXT_ENABLE_MASK, .n_voltages = AS3722_LDO_NUM_VOLT, }, { .regulator_id = AS3722_REGULATOR_ID_LDO3, .name = "as3722-ldo3", .sname = "vin-ldo3-4", .vsel_reg = AS3722_LDO3_VOLTAGE_REG, .vsel_mask = AS3722_LDO3_VSEL_MASK, .enable_reg = AS3722_LDOCONTROL0_REG, .enable_mask = AS3722_LDO3_CTRL, .sleep_ctrl_reg = AS3722_ENABLE_CTRL3_REG, .sleep_ctrl_mask = AS3722_LDO3_EXT_ENABLE_MASK, .n_voltages = AS3722_LDO3_NUM_VOLT, }, { .regulator_id = AS3722_REGULATOR_ID_LDO4, .name = "as3722-ldo4", .sname = "vin-ldo3-4", .vsel_reg = AS3722_LDO4_VOLTAGE_REG, .vsel_mask = AS3722_LDO_VSEL_MASK, .enable_reg = AS3722_LDOCONTROL0_REG, .enable_mask = AS3722_LDO4_CTRL, .sleep_ctrl_reg = AS3722_ENABLE_CTRL4_REG, .sleep_ctrl_mask = AS3722_LDO4_EXT_ENABLE_MASK, .n_voltages = AS3722_LDO_NUM_VOLT, }, { .regulator_id = AS3722_REGULATOR_ID_LDO5, .name = "as3722-ldo5", .sname = "vin-ldo2-5-7", .vsel_reg = AS3722_LDO5_VOLTAGE_REG, .vsel_mask = AS3722_LDO_VSEL_MASK, .enable_reg = AS3722_LDOCONTROL0_REG, .enable_mask = AS3722_LDO5_CTRL, .sleep_ctrl_reg = AS3722_ENABLE_CTRL4_REG, .sleep_ctrl_mask = AS3722_LDO5_EXT_ENABLE_MASK, .n_voltages = AS3722_LDO_NUM_VOLT, }, { .regulator_id = AS3722_REGULATOR_ID_LDO6, .name = "as3722-ldo6", .sname = "vin-ldo1-6", .vsel_reg = AS3722_LDO6_VOLTAGE_
.. This work is licensed under a Creative Commons Attribution 4.0 International
.. License.
.. http://creativecommons.org/licenses/by/4.0
.. (c) OPNFV, Huawei Technologies Co.,Ltd and others.

*************************************
Yardstick Test Case Description TC080
*************************************

.. _Ping: https://linux.die.net/man/8/ping

+-----------------------------------------------------------------------------+
|Network Latency                                                              |
|                                                                             |
+--------------+--------------------------------------------------------------+
|test case id  | OPNFV_YARDSTICK_TC080_NETWORK_LATENCY_BETWEEN_CONTAINER      |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|metric        | RTT (Round Trip Time)                                        |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|test purpose  | The purpose of TC080 is to do a basic verification that      |
|              | network latency is within acceptable boundaries when packets |
|              | travel between containers located in two different           |
|              | Kubernetes pods.                                             |
|              |                                                              |
|              | The purpose is also to be able to spot the trends.           |
|              | Test results, graphs and similar shall be stored for         |
|              | comparison reasons and product evolution understanding       |
|              | between different OPNFV versions and/or configurations.      |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|test tool     | ping                                                         |
|              |                                                              |
|              | Ping is a computer network administration software utility   |
|              | used to test the reachability of a host on an Internet       |
|              | Protocol (IP) network. It measures the round-trip time for   |
|              | packet sent from the originating host to a destination       |
|              | computer that are echoed back to the source.                 |
|              |                                                              |
|              | Ping is normally part of any Linux distribution, hence it    |
|              | doesn't need to be installed. It is also part of the         |
|              | Yardstick Docker image.                                      |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|test topology | Ping packets (ICMP protocol's mandatory ECHO_REQUEST         |
|              | datagram) are sent from host container to target container   |
|              | to elicit ICMP ECHO_RESPONSE.                                |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|configuration | file: opnfv_yardstick_tc080.yaml                             |
|              |                                                              |
|              | Packet size 200 bytes. Test duration 60 seconds.             |
|              | SLA RTT is set to maximum 10 ms.                             |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|applicability | This test case can be configured with different:             |
|              |                                                              |
|              |  * packet sizes;                                             |
|              |  * burst sizes;                                              |
|              |  * ping intervals;                                           |
|              |  * test durations;                                           |
|              |  * test iterations.                                          |
|              |                                                              |
|              | Default values exist.                                        |
|              |                                                              |
|              | SLA is optional. The SLA in this test case serves as an      |
|              | example. Considerably lower RTT is expected, and also normal |
|              | to achieve in balanced L2 environments. However, to cover    |
|              | most configurations, both bare metal and fully virtualized   |
|              | ones, this value should be possible to achieve and           |
|              | acceptable for black box testing. Many real time             |
|              | applications start to suffer badly if the RTT time is higher |
|              | than this. Some may suffer bad also close to this RTT, while |
|              | others may not suffer at all. It is a compromise that may    |
|              | have to be tuned for different configuration purposes.       |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|usability     | This test case should be run in Kunernetes environment.      |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|references    | Ping_                                                        |
|              |                                                              |
|              | ETSI-NFV-TST001                                              |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|pre-test      | The test case Docker image (openretriever/yardstick) needs   |
|conditions    | to be pulled into Kubernetes environment.                    |
|              |                                                              |
|              | No further requirements have been identified.                |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|test sequence | description and expected result                              |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|step 1        | Two containers are booted, as server and client.             |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|step 2        | Yardstick is connected with the server container by using    |
|              | ssh. 'ping_benchmark' bash script is copied from Jump Host   |
|              | to the server container via the ssh tunnel.                  |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|step 3        | Ping is invoked. Ping packets are sent from server container |
|              | to client container. RTT results are calculated and checked  |
|              | against the SLA. Logs are produced and stored.               |
|              |                                                              |
|              | Result: Logs are stored.                                     |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|step 4        | Two containers are deleted.                                  |
|              |                                                              |
+--------------+--------------------------------------------------------------+
|test verdict  | Test should not PASS if any RTT is above the optional SLA    |
|              | value, or if there is a test case execution problem.         |
|              |                                                              |
+--------------+--------------------------------------------------------------+