blob: 920069bef60e1f02dc92bb5cdd94dae223ad94bd (
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
|
/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* kingler button */
#include "button.h"
#include "cros_board_info.h"
#include "gpio.h"
#include "hooks.h"
static void buttons_hook(void)
{
int version;
if (cbi_get_board_version(&version)) {
return;
}
/* b:219891339: drop this workaround when we deprecate rev0 */
if (version == 0) {
/* swap VOLUP/VOLDN */
button_reassign_gpio(BUTTON_VOLUME_DOWN, GPIO_VOLUME_UP_L);
button_reassign_gpio(BUTTON_VOLUME_UP, GPIO_VOLUME_DOWN_L);
/*
* button_reassign_gpio will disable the old button interrupt
* and then enable the new button interrupt which cause the
* GPIO_VOLUME_UP_L interrupt disabled after we reassign
* BUTTON_VOLUME_UP, so we need to re-enable it here.
*/
gpio_enable_interrupt(GPIO_VOLUME_UP_L);
}
}
DECLARE_HOOK(HOOK_INIT, buttons_hook, HOOK_PRIO_DEFAULT);
|