Patrick Rudolph | b8e325a | 2017-08-13 12:09:54 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2017 Patrick Rudolph <siro@das-labor.org> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | |
| 16 | #include <southbridge/intel/common/gpio.h> |
| 17 | #include <console/console.h> |
| 18 | #include <device/device.h> |
| 19 | #include <ec/acpi/ec.h> |
| 20 | #include <option.h> |
Elyes HAOUAS | 5fd93e0 | 2019-05-15 21:07:30 +0200 | [diff] [blame^] | 21 | #include <types.h> |
Patrick Rudolph | b8e325a | 2017-08-13 12:09:54 +0200 | [diff] [blame] | 22 | |
| 23 | #include "h8.h" |
| 24 | #include "chip.h" |
| 25 | |
| 26 | /* Controls radio-off pin in WWAN MiniPCIe slot. */ |
| 27 | void h8_wwan_enable(int on) |
| 28 | { |
| 29 | if (on) |
| 30 | ec_set_bit(0x3a, 6); |
| 31 | else |
| 32 | ec_clr_bit(0x3a, 6); |
| 33 | } |
| 34 | |
| 35 | /* |
| 36 | * Detect WWAN on supported MBs. |
| 37 | */ |
| 38 | bool h8_has_wwan(struct device *dev) |
| 39 | { |
| 40 | struct ec_lenovo_h8_config *conf = dev->chip_info; |
| 41 | |
| 42 | if (!conf->has_wwan_detection) { |
| 43 | printk(BIOS_INFO, "H8: WWAN detection not implemented. " |
| 44 | "Assuming WWAN installed\n"); |
| 45 | return true; |
| 46 | } |
| 47 | |
| 48 | if (get_gpio(conf->wwan_gpio_num) == conf->wwan_gpio_lvl) { |
| 49 | printk(BIOS_INFO, "H8: WWAN installed\n"); |
| 50 | return true; |
| 51 | } |
| 52 | |
| 53 | printk(BIOS_INFO, "H8: WWAN not installed\n"); |
| 54 | return false; |
| 55 | } |
| 56 | |
| 57 | /* |
| 58 | * Return WWAN NVRAM setting. |
| 59 | */ |
| 60 | bool h8_wwan_nv_enable(void) |
| 61 | { |
| 62 | u8 val; |
| 63 | |
| 64 | if (get_option(&val, "wwan") != CB_SUCCESS) |
| 65 | return true; |
| 66 | |
| 67 | return val; |
| 68 | } |