| // Copyright 2020 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.hardware.vreg; |
| |
| using zx; |
| |
| // The output for this voltage regulator is defined by the |
| // following formula: |
| // |
| // v_out = min_voltage + step_size * step |
| // |
| // Where the `step` is programmable by software. |
| |
| type VregParams = struct { |
| // Minimum voltage supported by this voltage regulator. |
| min_uv uint32; |
| |
| // Voltage increment at each step. |
| step_size_uv uint32; |
| |
| // Max number of steps. |
| num_steps uint32; |
| }; |
| |
| @transport("Banjo") |
| @banjo_layout("ddk-protocol") |
| protocol Vreg { |
| // Set the step which yields a voltage of min_uv + step_size_uv * step. |
| SetVoltageStep(struct { |
| step uint32; |
| }) -> (struct { |
| st zx.status; |
| }); |
| |
| // Get the current step. |
| GetVoltageStep() -> (struct { |
| result uint32; |
| }); |
| |
| // Obtain the parameters for this voltage regulator. |
| GetRegulatorParams() -> (struct { |
| params VregParams; |
| }); |
| }; |