mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 02:35:28 +00:00
This change corrects charger interrupt event handling, charger enable gpio, battery full condition, EC deep sleep mode support when AC unplugged, and lid controlled power off. Signed-off-by: Rong Chang <rongchang@chromium.org> BRANCH=snow BUG=chrome-os-partner:12573,12574,12575 TEST=manual - ec console command 'gpioget': - SPI1_MISO should be 0 when AP off - CHARGER_EN should be 0 after AC unplugged - charging led should be off after AC unplugged - when battery remaining charge < 3%, system should be powered off without AC. - ec console command 'sleepmask 0', turn off AP: - deep sleep only when AC unplugged Change-Id: I0f63835dae67d90de7a8c8c6c3537ca9a16faed4 Reviewed-on: https://gerrit.chromium.org/gerrit/30316 Commit-Ready: Rong Chang <rongchang@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org> Tested-by: Rong Chang <rongchang@chromium.org>
57 lines
1.4 KiB
C
57 lines
1.4 KiB
C
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
/* Clocks and power management settings */
|
|
|
|
#ifndef __CROS_EC_CLOCK_H
|
|
#define __CROS_EC_CLOCK_H
|
|
|
|
#include "common.h"
|
|
|
|
/**
|
|
* Set the CPU clocks and PLLs.
|
|
*/
|
|
int clock_init(void);
|
|
|
|
/**
|
|
* Return the current clock frequency in Hz.
|
|
*/
|
|
int clock_get_freq(void);
|
|
|
|
/**
|
|
* Enable or disable the PLL.
|
|
*
|
|
* @param enable Enable PLL if non-zero; disable if zero.
|
|
* @param notify Notify other modules of the PLL change. This should
|
|
* be 1 unless you're briefly turning on the PLL to work
|
|
* around a chip errata at init time.
|
|
*/
|
|
int clock_enable_pll(int enable, int notify);
|
|
|
|
/**
|
|
* Wait for a number of clock cycles.
|
|
*
|
|
* Simple busy waiting for use before clocks/timers are initialized.
|
|
*
|
|
* @param cycles Number of cycles to wait.
|
|
*/
|
|
void clock_wait_cycles(uint32_t cycles);
|
|
|
|
/* Low power modes for idle API */
|
|
|
|
enum {
|
|
SLEEP_MASK_AP_RUN = (1 << 0), /* the main CPU is running */
|
|
SLEEP_MASK_UART = (1 << 1), /* UART communication on-going */
|
|
SLEEP_MASK_I2C = (1 << 2), /* I2C master communication on-going */
|
|
SLEEP_MASK_CHARGING = (1 << 3), /* Charging loop on-going */
|
|
|
|
SLEEP_MASK_FORCE = (1 << 31), /* Force disabling low power modes */
|
|
};
|
|
|
|
void enable_sleep(uint32_t mask);
|
|
void disable_sleep(uint32_t mask);
|
|
|
|
#endif /* __CROS_EC_CLOCK_H */
|