blob: 8008a3372632ba9797165bccf5f490304a8b30f5 [file] [log] [blame]
// Copyright 2019 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.power;
using zx;
type PowerDomainStatus = strict enum : uint8 {
DISABLED = 1;
ENABLED = 2;
};
@discoverable
closed protocol Device {
/// Register the callee for this power domain. The callee will be registered until
/// UnregisterPowerDomain is called. Any voltage changes to the power domain will
/// be made considering the min_needed_voltage(in uV) and max_supported_voltage(in uV) published here.
/// If voltages mentioned are out of supported voltage range of domain(obtained by calling
/// GetSupportedVoltageRange), the callee will be registered with the supported voltage range.
strict RegisterPowerDomain(struct {
min_needed_voltage uint32;
max_supported_voltage uint32;
}) -> () error zx.Status;
/// Unregister the callee for this power domain. The callee will no longer be considered as
/// a dependent of this power domain.
strict UnregisterPowerDomain() -> () error zx.Status;
/// Get Supported Voltage Range. min and max are in micorVolts(uV)
strict GetSupportedVoltageRange() -> (struct {
min uint32;
max uint32;
}) error zx.Status;
/// Request a particular voltage. The actual_voltage is the voltage that the power domain
/// is transitioned to after considering supported voltage ranges of all the registered
/// dependents. "voltage" should be in uV.
strict RequestVoltage(struct {
voltage uint32;
}) -> (struct {
actual_voltage uint32;
}) error zx.Status;
/// Get current voltage in uV.
strict GetCurrentVoltage(struct {
index uint32;
}) -> (struct {
current_voltage uint32;
}) error zx.Status;
/// Get power domain status
strict GetPowerDomainStatus() -> (struct {
status PowerDomainStatus;
}) error zx.Status;
/// Write to ctrl register of PMIC
strict WritePmicCtrlReg(struct {
reg_addr uint32;
value uint32;
}) -> () error zx.Status;
/// Read ctrl register of PMIC
strict ReadPmicCtrlReg(struct {
reg_addr uint32;
}) -> (struct {
value uint32;
}) error zx.Status;
};
service Service {
device client_end:Device;
};