blob: 685886fcced460f2fc7ee06c1938b16854841603 [file] [log] [blame]
Angel Pons210a0082020-04-02 23:48:24 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Patrick Rudolphb8e325a2017-08-13 12:09:54 +02002
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 HAOUAS5fd93e02019-05-15 21:07:30 +02008#include <types.h>
Patrick Rudolphb8e325a2017-08-13 12:09:54 +02009
10#include "h8.h"
11#include "chip.h"
12
13/* Controls radio-off pin in WWAN MiniPCIe slot. */
14void h8_wwan_enable(int on)
15{
16 if (on)
17 ec_set_bit(0x3a, 6);
18 else
19 ec_clr_bit(0x3a, 6);
20}
21
22/*
23 * Detect WWAN on supported MBs.
24 */
Furquan Shaikh4fc17b42020-04-24 21:39:08 -070025bool h8_has_wwan(const struct device *dev)
Patrick Rudolphb8e325a2017-08-13 12:09:54 +020026{
27 struct ec_lenovo_h8_config *conf = dev->chip_info;
28
29 if (!conf->has_wwan_detection) {
30 printk(BIOS_INFO, "H8: WWAN detection not implemented. "
31 "Assuming WWAN installed\n");
32 return true;
33 }
34
35 if (get_gpio(conf->wwan_gpio_num) == conf->wwan_gpio_lvl) {
36 printk(BIOS_INFO, "H8: WWAN installed\n");
37 return true;
38 }
39
40 printk(BIOS_INFO, "H8: WWAN not installed\n");
41 return false;
42}
43
44/*
45 * Return WWAN NVRAM setting.
46 */
47bool h8_wwan_nv_enable(void)
48{
Angel Pons88dcb312021-04-26 17:10:28 +020049 return get_uint_option("wwan", true);
Patrick Rudolphb8e325a2017-08-13 12:09:54 +020050}