Skip to content

Commit e72acfa

Browse files
committed
power: supply: macsmc: Add M3 generation power events
The Apple M3 machines, and potentially M1/M2 machines with updated SMC firmware generate a new set of SMC events starting with 0x7113 when cables are plugged or unplugged. Without this patch, the kernel logs "Unknown charger event" errors, and the power status may not update immediately. The event structure is 0x7113[Port][Status]. Observed on M3 Pro: - Port 0 (USB-C): 0x711300xx - Port 1 (USB-C): 0x711301xx - Port 2 (MagSafe): 0x711302xx - Disconnect: 0x7113ffxx Status 0x04 indicates a stable connection, while 0x02/0x03 appear during negotiation. This patch handles these events and triggers a power_supply_changed notification. Signed-off-by: Michael Reeves <michael.reeves077@gmail.com>
1 parent 7734019 commit e72acfa

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/power/supply/macsmc-power.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,21 @@ static int macsmc_power_event(struct notifier_block *nb, unsigned long event, vo
816816
power_supply_changed(power->batt);
817817
power_supply_changed(power->ac);
818818

819+
return NOTIFY_OK;
820+
} else if ((event & 0xffff0000) == 0x71130000) {
821+
u8 port_index = (event >> 8) & 0xff;
822+
u8 status = event & 0xff;
823+
824+
if (port_index == 0xff)
825+
dev_info(power->dev, "Connector event: Disconnect (status 0x%02x)\n",
826+
status);
827+
else
828+
dev_info(power->dev, "Connector event: Port %d (status 0x%02x)\n",
829+
port_index, status);
830+
831+
power_supply_changed(power->batt);
832+
power_supply_changed(power->ac);
833+
819834
return NOTIFY_OK;
820835
} else if ((event & 0xff000000) == 0x71000000) {
821836
dev_info(power->dev, "Unknown charger event 0x%lx\n", event);

0 commit comments

Comments
 (0)