summaryrefslogtreecommitdiff
path: root/src/ec
diff options
context:
space:
mode:
authorNicholas Chin <nic.c3.14@gmail.com>2023-08-27 17:36:36 -0600
committerFelix Held <felix-coreboot@felixheld.de>2024-01-23 23:00:59 +0000
commit2f48eaf36f02a6607b4f94b6e8e48ec21b910e87 (patch)
tree4951954a75d17d5338aba934e95d2b342d56f241 /src/ec
parent59917544517a8da047c588a36d4c1ce493653adf (diff)
ec/dell/mec5035: Add command to control radio state
This was determined by sniffing the LPC bus while moving the hardware wireless switch between the enabled and disabled positions on the Latitude E6400. The vendor BIOS provides options to change which radios the switch controls, which was used to determine the mapping between each radio device and the command argument values. Change-Id: I173dc197d63cda232dd7ede0cb798ab0a364482b Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/77534 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Diffstat (limited to 'src/ec')
-rw-r--r--src/ec/dell/mec5035/mec5035.c9
-rw-r--r--src/ec/dell/mec5035/mec5035.h14
2 files changed, 23 insertions, 0 deletions
diff --git a/src/ec/dell/mec5035/mec5035.c b/src/ec/dell/mec5035/mec5035.c
index 8da11e5b1c..41b8dca978 100644
--- a/src/ec/dell/mec5035/mec5035.c
+++ b/src/ec/dell/mec5035/mec5035.c
@@ -84,6 +84,15 @@ u8 mec5035_mouse_touchpad(u8 setting)
return buf[0];
}
+void mec5035_control_radio(enum ec_radio_dev dev, enum ec_radio_state state)
+{
+ /* From LPC traces and userspace testing with other values,
+ the second byte has to be 2 for an unknown reason. */
+ u8 buf[RADIO_CTRL_NUM_ARGS] = {(u8)dev, 2, (u8)state};
+ write_mailbox_regs(buf, 2, RADIO_CTRL_NUM_ARGS);
+ ec_command(CMD_RADIO_CTRL);
+}
+
void mec5035_early_init(void)
{
/* If this isn't sent the EC shuts down the system after about 15
diff --git a/src/ec/dell/mec5035/mec5035.h b/src/ec/dell/mec5035/mec5035.h
index e7a05b64d4..fa15a9d621 100644
--- a/src/ec/dell/mec5035/mec5035.h
+++ b/src/ec/dell/mec5035/mec5035.h
@@ -16,8 +16,22 @@
#define CMD_CPU_OK 0xc2
+#define CMD_RADIO_CTRL 0x2b
+#define RADIO_CTRL_NUM_ARGS 3
+enum ec_radio_dev {
+ RADIO_WLAN = 0,
+ RADIO_WWAN,
+ RADIO_BT
+};
+
+enum ec_radio_state {
+ RADIO_OFF = 0,
+ RADIO_ON
+};
+
u8 mec5035_mouse_touchpad(u8 setting);
void mec5035_cpu_ok(void);
void mec5035_early_init(void);
+void mec5035_control_radio(enum ec_radio_dev device, enum ec_radio_state state);
#endif /* _EC_DELL_MEC5035_H_ */