#asahi-dev · 2026-10-25 08:14
yukasven: the amcc hv init is sadly very t604x specific#asahi-dev · 2026-10-25 06:54
Guest3839rtc, we use different keys, that exist on apple silicon too, but apple silicon dosent use them, so we need is_acpi, hwmon is very generic code (i think it can replace ur DT implementation, but i havent done that currently: https://github.com/t2linux/linux-t2-patches/blob/main/3013-hwmon-add-support-for-x86-macs-in-macsmc-hwmon.patch#L196)#asahi-dev · 2026-10-25 06:52
chadmedid argue that case is slightly different as its not really something fundamental to the rtkit implementation and does not matter outside the battery driver. if youve got mixed endianness/key-specific stuff happening in rtc (and possibly others) too then thats a bigger problem#asahi-dev · 2026-10-25 06:51
chadmedthats true actually, it does check for the existence of specific keys#asahi-dev · 2026-10-25 06:50
Guest3839and its not like the battery sensor dont use quirks, it does use quirks for firmware afair#asahi-dev · 2026-10-25 06:50
Guest3839the code in the platform device would get too big, and adding quirks everytime we want to add something or change something is not that great#asahi-dev · 2026-10-25 06:48
chadmedbut imo you should do everything in your power to avoid implementation details in the generic drivers#asahi-dev · 2026-10-25 06:48
chadmedsince these drivers are upstream its best to get maintainer input. maybe they dont care anymore#asahi-dev · 2026-10-25 06:48
Guest3839k will do#asahi-dev · 2026-10-25 06:47
chadmedperhaps send an RFC to the mailing lists anyway#asahi-dev · 2026-10-25 06:47
chadmed"harder to get right" sure#asahi-dev · 2026-10-25 06:47
Guest3839chadmed: "you just said theyre all like that", yeah sorry i meant all battery keys are mixed#asahi-dev · 2026-10-25 06:47
chadmedi dont think it is a "worse design" to avoid leaking implementation details into places where they do not fundamentally belong#asahi-dev · 2026-10-25 06:45
Guest3839hwmon is fine, rtc we need is_acpi#asahi-dev · 2026-10-25 06:45
chadmedyou just said theyre all like that#asahi-dev · 2026-10-25 06:45
Guest3839wont that be a worse design than just adding quirks?, only the battery sensor is that messed up, every other driver is fine#asahi-dev · 2026-10-25 06:43
chadmedthe frontend should not care at all#asahi-dev · 2026-10-25 06:42
chadmedyeah so your driver should just switch/case on the keys with the wrong endianness#asahi-dev · 2026-10-25 06:42
Guest3839instead of nvram it uses CLKO#asahi-dev · 2026-10-25 06:42
Guest3839rtc, also uses different keys#asahi-dev · 2026-10-25 06:42
Guest3839whole thing#asahi-dev · 2026-10-25 06:42
chadmedif the latter, put quirks in your backend#asahi-dev · 2026-10-25 06:41
chadmedis that limited to just the battery keys or is the whole thing mixed endian#asahi-dev · 2026-10-25 06:41
Guest3839standardised "read_u16" wont be able to fix the keys that use LE#asahi-dev · 2026-10-25 06:41
Guest3839some use LE#asahi-dev · 2026-10-25 06:41
Guest3839but the thing is not all keys use BE in battery#asahi-dev · 2026-10-25 06:40
chadmedtreat it like a subsystem i guess#asahi-dev · 2026-10-25 06:39
chadmedno, this is backwards. you should not introduce platform-specific API. what you need to do is rework the core so that it has something like struct macsmc_funcs which would just be a bunch of function pointers to the backend's implementations of e.g. read_u16#asahi-dev · 2026-10-25 06:34
Guest3839as you can see here, we need to do that in macsmc-power, for that we need to know if the backend is acpi or rtkit#asahi-dev · 2026-10-25 06:33
Guest3839we cant do all of that in the backend#asahi-dev · 2026-10-25 06:33
Guest3839https://github.com/t2linux/linux-t2-patches/blob/7.3/3010-power-supply-add-support-for-x86-macs-in-macsmc-powe.patch#L309#asahi-dev · 2026-10-25 06:33
chadmedyes, all of that is implementation details that belongs in your x86/acpi backend#asahi-dev · 2026-10-25 06:32
Guest3839(power keys in intel macs uses BE instead of LE, so we need to use that, and also hwmon, we dont use dt)#asahi-dev · 2026-10-25 06:32
chadmedeach backend should expose callbacks for the operations that the frontend consumes#asahi-dev · 2026-10-25 06:32
Guest3839uhh so how am i supposed to implement difference between acpi and rtkit code#asahi-dev · 2026-10-25 06:31
chadmedi dont think the "core" (which is really the frontend) should care at all about implementation details of the backends (is_acpi)#asahi-dev · 2026-10-25 06:31
Guest3839we have tested on mbp16,1 mbp15,1 imac20,1 mbp12,1 and mba4,1#asahi-dev · 2026-10-25 06:30
Guest3839and creates a new file macsmc-core.c#asahi-dev · 2026-10-25 06:30
Guest3839shifts the asahi backend to soc/apple/#asahi-dev · 2026-10-25 06:29
Guest3839chadmed: the code does that: https://github.com/t2linux/linux-t2-patches/blob/7.3/3001-treewide-add-backend-for-macsmc.patch#asahi-dev · 2026-10-25 06:29
chadmedyeah#asahi-dev · 2026-10-25 06:29
Guest3839JamesCalligeros[m]: ive seen the original smc implementation in ur linux github repo, this is inspired from that#asahi-dev · 2026-10-25 06:29
chadmedand take inspiration from it#asahi-dev · 2026-10-25 06:29
chadmedgo back to old versions of the downstream driver, which had a common frontend and then platform-specific backends to talk to the actual hardware#asahi-dev · 2026-10-25 06:28
Guest3839MichaelReeves[m]: so what are we supposed to do, as m-series and intel macs share a lot of keys (B0AP, B0AC, and a lot more, including the charge limit key used in new intel macs firmware), separate driver will mean duplicate code#asahi-dev · 2026-10-25 01:23
JamesCalligeros[m]And this is the result#asahi-dev · 2026-10-25 01:23
JamesCalligeros[m]Also for context the “original” smc implementation was a decoupled backend and frontend and upstream had a whinge about it#asahi-dev · 2026-10-25 01:22
JamesCalligeros[m]We probably want to figure out the unreasonable irq storm#asahi-dev · 2026-10-25 01:22
JamesCalligeros[m]spi hid is a bit of a mess#asahi-dev · 2026-10-25 01:20
MichaelReeves[m]on another note, I noticed you included the asahi M1 SPI hid patches. are you planning to upstream SPI hid? if so that would be very useful and appreciated, because I'm upstreaming dockchannel HID (M2+) so if they both get upstream, then HID is fully covered (and previously I thought I'd have to figure out SPI after DC is done)