Fix coding style in regulator interface (fix #777)
This commit is contained in:
parent
5a3c2c33b7
commit
a73dc1b581
|
@ -266,10 +266,10 @@ static void arndale_xhci_init()
|
||||||
{
|
{
|
||||||
/* enable USB3 clock and power up */
|
/* enable USB3 clock and power up */
|
||||||
Regulator::Connection reg_clk(Regulator::CLK_USB30);
|
Regulator::Connection reg_clk(Regulator::CLK_USB30);
|
||||||
reg_clk.set_state(true);
|
reg_clk.state(true);
|
||||||
|
|
||||||
Regulator::Connection reg_pwr(Regulator::PWR_USB30);
|
Regulator::Connection reg_pwr(Regulator::PWR_USB30);
|
||||||
reg_pwr.set_state(true);
|
reg_pwr.state(true);
|
||||||
|
|
||||||
/* setup PHY */
|
/* setup PHY */
|
||||||
Attached_io_mem_dataspace io_phy(DWC3_PHY_BASE, 0x1000);
|
Attached_io_mem_dataspace io_phy(DWC3_PHY_BASE, 0x1000);
|
||||||
|
|
|
@ -53,10 +53,10 @@ class Regulator::Session_component : public Regulator::Session_rpc_object
|
||||||
** Regulator session interface **
|
** Regulator session interface **
|
||||||
***********************************/
|
***********************************/
|
||||||
|
|
||||||
void set_level(unsigned long level) { _driver.set_level(_id, level); }
|
void level(unsigned long level) { _driver.level(_id, level); }
|
||||||
unsigned long level() { return _driver.level(_id); }
|
unsigned long level() { return _driver.level(_id); }
|
||||||
void set_state(bool enable) { _driver.set_state(_id, enable); }
|
void state(bool enable) { _driver.state(_id, enable); }
|
||||||
bool state() { return _driver.state(_id); }
|
bool state() { return _driver.state(_id); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,10 @@ namespace Regulator {
|
||||||
*/
|
*/
|
||||||
struct Driver
|
struct Driver
|
||||||
{
|
{
|
||||||
virtual void set_level(Regulator_id id, unsigned long level) = 0;
|
virtual void level(Regulator_id id, unsigned long level) = 0;
|
||||||
virtual unsigned long level(Regulator_id id) = 0;
|
virtual unsigned long level(Regulator_id id) = 0;
|
||||||
virtual void set_state(Regulator_id id, bool enable) = 0;
|
virtual void state(Regulator_id id, bool enable) = 0;
|
||||||
virtual bool state(Regulator_id id) = 0;
|
virtual bool state(Regulator_id id) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,10 +36,10 @@ namespace Regulator {
|
||||||
** Regulator session interface **
|
** Regulator session interface **
|
||||||
*********************************/
|
*********************************/
|
||||||
|
|
||||||
void set_level(unsigned long level) { call<Rpc_set_level>(level); }
|
void level(unsigned long level) { call<Rpc_set_level>(level); }
|
||||||
unsigned long level() { return call<Rpc_level>(); }
|
unsigned long level() { return call<Rpc_level>(); }
|
||||||
void set_state(bool enable) { call<Rpc_set_state>(enable); }
|
void state(bool enable) { call<Rpc_set_state>(enable); }
|
||||||
bool state() { return call<Rpc_state>(); }
|
bool state() { return call<Rpc_state>(); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,31 +27,31 @@ namespace Regulator {
|
||||||
/**
|
/**
|
||||||
* Set regulator specific level
|
* Set regulator specific level
|
||||||
*/
|
*/
|
||||||
virtual void set_level(unsigned long level) = 0;
|
virtual void level(unsigned long level) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns current regulator level
|
* Returns current regulator level
|
||||||
*/
|
*/
|
||||||
virtual unsigned long level() = 0;
|
virtual unsigned long level() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/disable regulator
|
* Enable/disable regulator
|
||||||
*/
|
*/
|
||||||
virtual void set_state(bool enable) = 0;
|
virtual void state(bool enable) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether regulator is enabled or not
|
* Returns whether regulator is enabled or not
|
||||||
*/
|
*/
|
||||||
virtual bool state() = 0;
|
virtual bool state() = 0;
|
||||||
|
|
||||||
|
|
||||||
/*******************
|
/*******************
|
||||||
** RPC interface **
|
** RPC interface **
|
||||||
*******************/
|
*******************/
|
||||||
|
|
||||||
GENODE_RPC(Rpc_set_level, void, set_level, unsigned long);
|
GENODE_RPC(Rpc_set_level, void, level, unsigned long);
|
||||||
GENODE_RPC(Rpc_level, unsigned long, level);
|
GENODE_RPC(Rpc_level, unsigned long, level);
|
||||||
GENODE_RPC(Rpc_set_state, void, set_state, bool);
|
GENODE_RPC(Rpc_set_state, void, state, bool);
|
||||||
GENODE_RPC(Rpc_state, bool, state);
|
GENODE_RPC(Rpc_state, bool, state);
|
||||||
GENODE_RPC_INTERFACE(Rpc_set_level, Rpc_level, Rpc_set_state, Rpc_state);
|
GENODE_RPC_INTERFACE(Rpc_set_level, Rpc_level, Rpc_set_state, Rpc_state);
|
||||||
};
|
};
|
||||||
|
|
|
@ -90,7 +90,7 @@ struct Cpufreq_command : Command
|
||||||
unsigned long f = 0;
|
unsigned long f = 0;
|
||||||
Genode::ascii_to(freq, &f, 10);
|
Genode::ascii_to(freq, &f, 10);
|
||||||
tprintf(terminal, "set frequency to %ld Hz\n", f);
|
tprintf(terminal, "set frequency to %ld Hz\n", f);
|
||||||
regulator.set_level(f);
|
regulator.level(f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -440,7 +440,7 @@ class Cmu : public Regulator::Driver,
|
||||||
** Regulator driver interface **
|
** Regulator driver interface **
|
||||||
********************************/
|
********************************/
|
||||||
|
|
||||||
void set_level(Regulator_id id, unsigned long level)
|
void level(Regulator_id id, unsigned long level)
|
||||||
{
|
{
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case CLK_CPU:
|
case CLK_CPU:
|
||||||
|
@ -465,7 +465,7 @@ class Cmu : public Regulator::Driver,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_state(Regulator_id id, bool enable)
|
void state(Regulator_id id, bool enable)
|
||||||
{
|
{
|
||||||
if (enable)
|
if (enable)
|
||||||
_enable(id);
|
_enable(id);
|
||||||
|
|
|
@ -157,7 +157,7 @@ class Pmu : public Regulator::Driver,
|
||||||
** Regulator driver interface **
|
** Regulator driver interface **
|
||||||
********************************/
|
********************************/
|
||||||
|
|
||||||
void set_level(Regulator_id id, unsigned long level)
|
void level(Regulator_id id, unsigned long level)
|
||||||
{
|
{
|
||||||
switch (id) {
|
switch (id) {
|
||||||
default:
|
default:
|
||||||
|
@ -174,7 +174,7 @@ class Pmu : public Regulator::Driver,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_state(Regulator_id id, bool enable)
|
void state(Regulator_id id, bool enable)
|
||||||
{
|
{
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case PWR_USB30:
|
case PWR_USB30:
|
||||||
|
|
|
@ -50,7 +50,7 @@ int main(int argc, char **argv)
|
||||||
static Cap_connection cap;
|
static Cap_connection cap;
|
||||||
static Rpc_entrypoint ep(&cap, STACK_SIZE, "block_ep");
|
static Rpc_entrypoint ep(&cap, STACK_SIZE, "block_ep");
|
||||||
static Regulator::Connection mmc0_regulator(Regulator::CLK_MMC0);
|
static Regulator::Connection mmc0_regulator(Regulator::CLK_MMC0);
|
||||||
mmc0_regulator.set_state(true);
|
mmc0_regulator.state(true);
|
||||||
static Block::Root block_root(&ep, env()->heap(), driver_factory);
|
static Block::Root block_root(&ep, env()->heap(), driver_factory);
|
||||||
env()->parent()->announce(ep.manage(&block_root));
|
env()->parent()->announce(ep.manage(&block_root));
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ int main(int argc, char **argv)
|
||||||
while (true) {
|
while (true) {
|
||||||
timer.msleep(10000);
|
timer.msleep(10000);
|
||||||
PINF("Setting CPU frequency %s", high ? "low" : "high");
|
PINF("Setting CPU frequency %s", high ? "low" : "high");
|
||||||
cpu_regulator.set_level(high ? Regulator::CPU_FREQ_200
|
cpu_regulator.level(high ? Regulator::CPU_FREQ_200
|
||||||
: Regulator::CPU_FREQ_1600);
|
: Regulator::CPU_FREQ_1600);
|
||||||
high = !high;
|
high = !high;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue