-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmisc.c
47 lines (33 loc) · 945 Bytes
/
misc.c
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
// SPDX-License-Identifier: GPL-2.0
#include "pr.h"
#include <linux/bug.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include "ec.h"
#include "misc.h"
#include "util.h"
/* ========================================================================== */
int qc71_rfkill_get_wifi_state(void)
{
int err = ec_read_byte(DEVICE_STATUS_ADDR);
if (err < 0)
return err;
return !!(err & DEVICE_STATUS_WIFI_ON);
}
/* ========================================================================== */
int qc71_fn_lock_get_state(void)
{
int status = ec_read_byte(BIOS_CTRL_1_ADDR);
if (status < 0)
return status;
return !!(status & BIOS_CTRL_1_FN_LOCK_STATUS);
}
int qc71_fn_lock_set_state(bool state)
{
int status = ec_read_byte(BIOS_CTRL_1_ADDR);
if (status < 0)
return status;
status = SET_BIT(status, BIOS_CTRL_1_FN_LOCK_STATUS, state);
return ec_write_byte(BIOS_CTRL_1_ADDR, status);
}