G'day Henrik,
Which kernel was this based on? It won't apply to my 5.9 tree.
I assume the sprinkling of udelay(APPLESMC_MIN_WAIT) means the SMC is
slow in getting its status register set up. Could we instead just put
a single one of those up-front in wait_status?
Any chance you could try this one? I've added a retry to send_command and
added a single global APPLESMC_MIN_WAIT before each status read.
From looking at your modified send_command, it appears the trigger for a
retry is sending a command and the SMC doing absolutely nothing. This
should do the same thing.
Interestingly enough, by adding the udelay to wait_status on my machine I've
gone from 24 reads/s to 50 reads/s.
I've left out the remainder of the cleanups. Once we get a minimally working
patch I was going to look at a few cleanups, and I have some patches pending
to allow writing to the SMC from userspace (for setting BCLM and BFCL mainly)