summaryrefslogtreecommitdiff
path: root/include/tablet_mode.h
blob: 36cb75f2a779ddb009a4db8b55d878e228422d34 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* Copyright 2016 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef __CROS_EC_TABLET_MODE_H
#define __CROS_EC_TABLET_MODE_H

/**
 * Get tablet mode state
 *
 * Return 1 if in tablet mode, 0 otherwise
 */
int tablet_get_mode(void);

/* Bit mask of tablet mode trigger */
#define TABLET_TRIGGER_LID	BIT(0)
#define TABLET_TRIGGER_BASE	BIT(1)

/**
 * Set tablet mode state
 *
 * @param mode 1: tablet mode. 0 clamshell mode.
 * @param trigger: bitmask of the trigger, TABLET_TRIGGER_*.
 */
void tablet_set_mode(int mode, uint32_t trigger);

/**
 * Disable tablet mode
 */
void tablet_disable(void);

/**
 * Interrupt service routine for gmr sensor.
 *
 * GMR_TABLET_MODE_GPIO_L must be defined.
 *
 * @param signal: GPIO signal
 */
void gmr_tablet_switch_isr(enum gpio_signal signal);

/**
 * Disables the interrupt on GPIO connected to gmr sensor. Additionally, it
 * disables the tablet mode switch sub-system and turns off tablet mode. This
 * is useful when the same firmware is shared between convertible and clamshell
 * devices to turn off gmr sensor's tablet mode detection on clamshell.
 */
void gmr_tablet_switch_disable(void);

/**
 * This must be defined when CONFIG_GMR_TABLET_MODE_CUSTOM is defined. This
 * allows a board to override the default behavior that determines if the
 * 360 sensor is active: !gpio_get_level(GMR_TABLET_MODE_GPIO_L).
 *
 * Returns 1 if the 360 sensor is active; otherwise 0.
 */
int board_sensor_at_360(void);

#endif  /* __CROS_EC_TABLET_MODE_H */