Files
OpenCellular/common/extpower_snow.c
Randall Spangler 34b94121c7 Remove bolt, daisy, kirby, puppy, slippy boards
These boards are unloved and unsupported.  They'll never grow up to be
laptops, and hardware is increasingly hard to come by.

Comparable functionality is available in the other, more-loved boards.

Removing these boards speeds up util/make_all.sh by 40%.  (If you're
not running that before every upload, you should be...)

BUG=chrome-os-partner:24062
BRANCH=none
TEST=build all remaining platforms and pass unit tests

Change-Id: I4d8a49e4d52d7393471f1b1cbef059c8db4a4f77
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177373
2013-11-21 22:21:56 +00:00

47 lines
1.2 KiB
C

/* Copyright (c) 2013 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.
*/
/* External power detection for snow */
#include "common.h"
#include "extpower.h"
#include "gpio.h"
#include "pmu_tpschrome.h"
#include "task.h"
int extpower_is_present(void)
{
/*
* Detect AC state using combined gpio pins
*
* On snow, there's no single gpio signal to detect AC.
* GPIO_AC_PWRBTN_L provides AC on and PWRBTN release.
* GPIO_KB_PWR_ON_L provides PWRBTN release.
*
* When AC plugged, both GPIOs will be high.
*
* One drawback of this detection is, when press-and-hold power
* button. AC state will be unknown. This function will fallback
* to PMU VACG.
*/
int ac_good = 1, battery_good;
if (gpio_get_level(GPIO_KB_PWR_ON_L))
return gpio_get_level(GPIO_AC_PWRBTN_L);
/* Check PMU VACG */
if (!in_interrupt_context())
pmu_get_power_source(&ac_good, &battery_good);
/*
* Charging task only interacts with AP in discharging state. So
* return 1 when AC status can not be detected by GPIO or VACG.
*/
return ac_good;
}
/* TODO(crosbug.com/p/23810): host events and hook notifications */