summaryrefslogtreecommitdiff
path: root/include/lid_switch.h
blob: 3d639b5782f71c4ac8ae178acc03c3a7d07d3bde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* Copyright 2013 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/* Lid switch API for Chrome EC */

#ifndef __CROS_EC_LID_SWITCH_H
#define __CROS_EC_LID_SWITCH_H

#include "common.h"
#include "stdbool.h"

/**
 * Debounce time for lid switch
 */
#define LID_DEBOUNCE_US (30 * MSEC)

/**
 * Return non-zero if lid is open.
 *
 * Uses the debounced lid state, not the raw signal from the GPIO.
 */
int lid_is_open(void);

/**
 * Interrupt handler for lid switch.
 *
 * @param signal	Signal which triggered the interrupt.
 */
void lid_interrupt(enum gpio_signal signal);

/**
 * Disable lid interrupt and set the lid open, when base is disconnected.
 *
 * @param enable    Flag that enables or disables lid interrupt.
 */
void enable_lid_detect(bool enable);

#endif /* __CROS_EC_LID_SWITCH_H */