Angel Pons | 210a008 | 2020-04-02 23:48:24 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Patrick Rudolph | 1194aa8 | 2017-05-21 08:49:44 +0200 | [diff] [blame] | 3 | |
| 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 HAOUAS | 4f66cb9 | 2019-12-01 13:21:52 +0100 | [diff] [blame] | 9 | #include <types.h> |
Patrick Rudolph | 1194aa8 | 2017-05-21 08:49:44 +0200 | [diff] [blame] | 10 | |
| 11 | #include "h8.h" |
| 12 | #include "chip.h" |
| 13 | |
| 14 | /* |
| 15 | * Controls BDC (Bluetooth daughter card) power. |
| 16 | */ |
| 17 | void 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 | */ |
| 28 | bool 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 | */ |
| 50 | bool 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 | } |