Angel Pons | 210a008 | 2020-04-02 23:48:24 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Patrick Rudolph | 1194aa8 | 2017-05-21 08:49:44 +0200 | [diff] [blame] | 2 | |
| 3 | #include <southbridge/intel/common/gpio.h> |
| 4 | #include <console/console.h> |
| 5 | #include <device/device.h> |
| 6 | #include <ec/acpi/ec.h> |
| 7 | #include <option.h> |
Elyes HAOUAS | 4f66cb9 | 2019-12-01 13:21:52 +0100 | [diff] [blame] | 8 | #include <types.h> |
Patrick Rudolph | 1194aa8 | 2017-05-21 08:49:44 +0200 | [diff] [blame] | 9 | |
| 10 | #include "h8.h" |
| 11 | #include "chip.h" |
| 12 | |
| 13 | /* |
| 14 | * Controls BDC (Bluetooth daughter card) power. |
| 15 | */ |
| 16 | void h8_bluetooth_enable(int on) |
| 17 | { |
| 18 | if (on) |
| 19 | ec_set_bit(0x3a, 4); |
| 20 | else |
| 21 | ec_clr_bit(0x3a, 4); |
| 22 | } |
| 23 | |
| 24 | /* |
| 25 | * Detect BDC on supported MBs. |
| 26 | */ |
Furquan Shaikh | 4fc17b4 | 2020-04-24 21:39:08 -0700 | [diff] [blame] | 27 | bool h8_has_bdc(const struct device *dev) |
Patrick Rudolph | 1194aa8 | 2017-05-21 08:49:44 +0200 | [diff] [blame] | 28 | { |
| 29 | struct ec_lenovo_h8_config *conf = dev->chip_info; |
| 30 | |
| 31 | if (!conf->has_bdc_detection) { |
| 32 | printk(BIOS_INFO, "H8: BDC detection not implemented. " |
| 33 | "Assuming BDC installed\n"); |
| 34 | return true; |
| 35 | } |
| 36 | |
| 37 | if (get_gpio(conf->bdc_gpio_num) == conf->bdc_gpio_lvl) { |
| 38 | printk(BIOS_INFO, "H8: BDC installed\n"); |
| 39 | return true; |
| 40 | } |
| 41 | |
| 42 | printk(BIOS_INFO, "H8: BDC not installed\n"); |
| 43 | return false; |
| 44 | } |
| 45 | |
| 46 | /* |
| 47 | * Return BDC NVRAM setting. |
| 48 | */ |
| 49 | bool h8_bluetooth_nv_enable(void) |
| 50 | { |
Angel Pons | 9dc1c51 | 2020-11-02 20:59:32 +0100 | [diff] [blame] | 51 | return get_int_option("bluetooth", true); |
Patrick Rudolph | 1194aa8 | 2017-05-21 08:49:44 +0200 | [diff] [blame] | 52 | } |