Exemple #1
0
ret_code_t nrf_pwr_mgmt_init(uint32_t ticks_per_1s)
{
    NRF_LOG_INFO("Init\r\n");
    DEBUG_PINS_INIT();
    SLEEP_INIT();

#if NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_ENABLED
    m_max_cpu_usage     = 0;
    m_ticks_sleeping    = 0;
    m_ticks_last        = 0;
#endif // NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_ENABLED

#if NRF_PWR_MGMT_CONFIG_STANDBY_TIMEOUT_ENABLED
    m_standby_counter   = 0;
#endif // NRF_PWR_MGMT_CONFIG_STANDBY_TIMEOUT_ENABLED
    m_sysoff_guard      = false;
    m_next_handler      = 0;

#if APP_TIMER_REQUIRED
    ret_code_t ret_code = app_timer_create(&m_pwr_mgmt_timer,
                                           APP_TIMER_MODE_REPEATED,
                                           nrf_pwr_mgmt_timeout_handler);
    VERIFY_SUCCESS(ret_code);

    return app_timer_start(m_pwr_mgmt_timer, ticks_per_1s, NULL);
#else
    return NRF_SUCCESS;
#endif // APP_TIMER_REQUIRED
}
Exemple #2
0
/*
 * Really ugly when CONFIG_BATTERY_RICOH619 is not selected.
 */
int g_soc;
int g_fg_on_mode;
#endif
#if 0
struct sleep_control_data {
	u8 reg_add;
};

#define SLEEP_INIT(_id, _reg)		\
	[RICOH619_DS_##_id] = {.reg_add = _reg}

static struct sleep_control_data sleep_data[] = {
	SLEEP_INIT(DC1, 0x16),
	SLEEP_INIT(DC2, 0x17),
	SLEEP_INIT(DC3, 0x18),
	SLEEP_INIT(DC4, 0x19),
	SLEEP_INIT(DC5, 0x1A),
	SLEEP_INIT(LDO1, 0x1B),
	SLEEP_INIT(LDO2, 0x1C),
	SLEEP_INIT(LDO3, 0x1D),
	SLEEP_INIT(LDO4, 0x1E),
	SLEEP_INIT(LDO5, 0x1F),
	SLEEP_INIT(LDO6, 0x20),
	SLEEP_INIT(LDO7, 0x21),
	SLEEP_INIT(LDO8, 0x22),
	SLEEP_INIT(LDO9, 0x23),
	SLEEP_INIT(LDO10, 0x24),
	SLEEP_INIT(PSO0, 0x25),
Exemple #3
0
#include <linux/slab.h>
#include <linux/gpio.h>
#include <linux/i2c.h>
#include <linux/mfd/core.h>
#include <linux/mfd/ricoh618.h>
#include <linux/mfd/pmu-common.h>

struct sleep_control_data {
	u8 reg_add;
};

#define SLEEP_INIT(_id, _reg)		\
	[RICOH618_DS_##_id] = {.reg_add = _reg}

static struct sleep_control_data sleep_data[] = {
	SLEEP_INIT(DC1, 0x16),
	SLEEP_INIT(DC2, 0x17),
	SLEEP_INIT(DC3, 0x18),
	SLEEP_INIT(LDO1, 0x1B),
	SLEEP_INIT(LDO2, 0x1C),
	SLEEP_INIT(LDO3, 0x1D),
	SLEEP_INIT(LDO4, 0x1E),
	SLEEP_INIT(LDO5, 0x1F),
	SLEEP_INIT(PSO0, 0x25),
	SLEEP_INIT(PSO1, 0x26),
	SLEEP_INIT(PSO2, 0x27),
	SLEEP_INIT(PSO3, 0x28),
	SLEEP_INIT(LDORTC1, 0x2A),
};

static inline int __ricoh618_read(struct i2c_client *client,