blob: 0ee0c021955b8554c3a3cae0a7b0af3a385f4a02 [file] [log] [blame]
Angel Pons210a0082020-04-02 23:48:24 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Patrick Rudolph1194aa82017-05-21 08:49:44 +02003
4#include <southbridge/intel/common/gpio.h>
5#include <console/console.h>
6#include <device/device.h>
7#include <ec/acpi/ec.h>
8#include <option.h>
Elyes HAOUAS4f66cb92019-12-01 13:21:52 +01009#include <types.h>
Patrick Rudolph1194aa82017-05-21 08:49:44 +020010
11#include "h8.h"
12#include "chip.h"
13
14/*
15 * Controls BDC (Bluetooth daughter card) power.
16 */
17void h8_bluetooth_enable(int on)
18{
19 if (on)
20 ec_set_bit(0x3a, 4);
21 else
22 ec_clr_bit(0x3a, 4);
23}
24
25/*
26 * Detect BDC on supported MBs.
27 */
28bool h8_has_bdc(struct device *dev)
29{
30 struct ec_lenovo_h8_config *conf = dev->chip_info;
31
32 if (!conf->has_bdc_detection) {
33 printk(BIOS_INFO, "H8: BDC detection not implemented. "
34 "Assuming BDC installed\n");
35 return true;
36 }
37
38 if (get_gpio(conf->bdc_gpio_num) == conf->bdc_gpio_lvl) {
39 printk(BIOS_INFO, "H8: BDC installed\n");
40 return true;
41 }
42
43 printk(BIOS_INFO, "H8: BDC not installed\n");
44 return false;
45}
46
47/*
48 * Return BDC NVRAM setting.
49 */
50bool h8_bluetooth_nv_enable(void)
51{
52 u8 val;
53
54 if (get_option(&val, "bluetooth") != CB_SUCCESS)
55 return true;
56
57 return val;
58}