ChanServ changed the topic of #asahi-dev to: Asahi Linux: porting Linux to Apple Silicon macs | General development | GitHub: https://alx.sh/g | Wiki: https://alx.sh/w | Logs: https://alx.sh/l/asahi-dev
yuyichao_ has quit [Ping timeout: 480 seconds]
yuyichao_ has joined #asahi-dev
PhilippvK has joined #asahi-dev
phiologe has quit [Ping timeout: 480 seconds]
squags has joined #asahi-dev
yrlf5 has quit []
yrlf has joined #asahi-dev
Dcow_ has joined #asahi-dev
Dcow has quit [Ping timeout: 480 seconds]
aleasto has joined #asahi-dev
aleasto has quit [Remote host closed the connection]
aleasto has joined #asahi-dev
kettenis_ is now known as kettenis
gruetzkopf has joined #asahi-dev
gruetze_ has quit [Ping timeout: 480 seconds]
kettenis_ has joined #asahi-dev
kettenis has quit [Read error: Connection reset by peer]
kettenis_ is now known as kettenis
Dcow has joined #asahi-dev
Dcow_ has quit [Ping timeout: 480 seconds]
Dcow_ has joined #asahi-dev
Dcow has quit [Ping timeout: 480 seconds]
minecrell has quit [Read error: Connection reset by peer]
minecrell has joined #asahi-dev
N3ros[m] has joined #asahi-dev
<marcan> there's your SPI driver :)
<marcan> cc jannau, j_ey_, sven
<marcan> Hope it works with the keyboard. We aren't implementing any of the delays yet, but the spi core might take care of that? Turns out we can't use hardware CS anyway so...
<marcan> I tested it with the NOR flash
<marcan> oh, I didn't even notice, but the genpd stuff works fine too, it's clockgating it properly
<kettenis> so one interesting thing is that all previous drivers explicitly control CS# through pinctrl
<kettenis> whereas your driver controls it through the SPI controller itself isn't it?
<FireFox317> marcan, apparantly the flash@0 node also dont need the #address-cells and #size-cells properties, but i guess we would also find that when we would upstream these bindings
<marcan> kettenis: indeed
<marcan> both should work ~identically
<marcan> apple uses pinctrl
<marcan> firefox317: that's probably for defining flash partitions, which we will want to later
<kettenis> marcan: does that mean that pinctrl should configure the pin appropriately?
<marcan> pinctrl needs to set the pin to peripheral 1 for the internal controller CS to work
<marcan> which I do now in the DT
<marcan> alternatively you can drive it as a GPIO
<marcan> both work
aleasto has quit [Remote host closed the connection]
<kettenis> so we could explicitly list the gpio in the DT and your driver would simply ignore that?
<marcan> I'm not sure how the spi core handles that; I need to check to see if that needs to be explicitly implemented
<marcan> but I imagine it's just a change to the probe function if so
<marcan> since the spi core definitely has gpio CS handling code already
<FireFox317> marcan, ah yep, you are correct. Indeed that can be used for defining partitions
<marcan> you need to pick one since you need to do pinctrl anyway; either internal CS or gpio CS
<marcan> kettenis: btw, since I ended up not looking at the openbsd driver... how does it compare with what you had? :)
<marcan> (CS stuff aside)
<kettenis> I can probably switch the OpenBSD driver to use the internal CS# control pretty quickly
<ar> /42/42
<kettenis> marcan: I think the fundamentals are quite close, but I don't bother with interrupts yet in the openbsd driver
<marcan> ah, I see
<marcan> I assume you don't have the 1~32 bit per word, cpha/cpol/bitreverse features though
<marcan> did you find the FIFO reset bits?
<kettenis> indeed, I don't have any of those features
<kettenis> didn't find the FIFO reset bits (but didn't really need them)
<kettenis> I obviously need to go in and replace some of the magic numbers now ;)
<marcan> :-)
<kettenis> I'll probably only implement the features that are really needed
<kettenis> I like keeping my drivers minimal ;)
<marcan> well, it was easy to implement that stuff :p
<kettenis> yup, yours is nice and concise as well
<kettenis> great work!
<marcan> :)
<marcan> thanks!
<marcan> alright, time for dinner :)
<kettenis> * Based on spi-apple.c, Copyright 2018 SiFive, Inc.
conected has joined #asahi-dev
<kettenis> should have skipped that on the global search and replace ;)
<j_ey_> marcan: use_gpio_descriptors will let the spi core know about the gpios-cs from the DT
<marcan> kettenis: ahaha, thanks for catching that :)
<kettenis> j_ey_ but you have to pick one or the other
<kettenis> letting the controller control CS# is nicer, but if Apple ever decides to use an arbitrary GPIO to control CS# we'll have to use a gpio descriptor
<j_ey_> marcan: Ill try it out later with the keyboard!
<povik> pushed new version of the audio driver, on top of the asahi branch
<povik> it has all kinds of improvements, but user-visible it supports the jack on Mac mini now
<povik> also can do various bit depths and sample rates
<povik> should detect jack insertion
<povik> on the M1 laptops, jack support may be just a matter of appropriate DT nodes
<povik> and the speakers there may need some code changes also in addition to DT nodes, don't know
<povik> i only have an M1X laptop to test on, and there it's a little bit more complicated
<povik> hm, but maybe i should bring up audio on an M1X laptop, ignoring the fancy extra speakers
<povik> of course i should do that
<povik> and that may be pretty similar to how the speakers are wired on the M1 laptops
<FireFox317> povik, I can test it on a M1 air
<povik> great
<povik> we need to figure out the DT nodes first
<povik> feel free to review ^^ if you are in the mood
<povik> especially the NCO and ADMAC driver could be send out soon
<povik> in first version
<FireFox317> povik, added some general comments. Feel free to ignore them :)
kgarrington has joined #asahi-dev
kgarrington has quit [Remote host closed the connection]
kgarrington has joined #asahi-dev
kgarrington has quit [Remote host closed the connection]
akemin_dayo has quit [Ping timeout: 480 seconds]
akemin_dayo has joined #asahi-dev
yuyichao_ has quit [Ping timeout: 480 seconds]
<marcan> povik: awesome!
<marcan> I can test on an M1Pro if you have some baseline
conected has quit []
yuyichao_ has joined #asahi-dev
sirn has quit [Quit: ZNC 1.8.2 - https://znc.in]
sirn has joined #asahi-dev
<sven> marcan: nice!
<sven> i think you want to get rid of the "retries++;"
<sven> there's also devm_spi_alloc_master
<j_ey_> also you might want a timeout. in the transfer_one. sifive didnt, but I saw some other drivers that did. and the core will set one up for you (if you structure the code differently)
j_ey_ is now known as j`ey
<sven> and this doesn't matter here because the refclock is constant but i think you should use devm_add_action_or_reset to clk_disable_unprepare the clock.
<sven> otherwise you could in theory disable the clock before the spi controller is removed
bps has quit [Ping timeout: 480 seconds]
<sven> (guenter roeck pointed that out in my watchdog v1)
<marcan> sven: yeah, someone emailed (!) me about retries++, lol
<sven> hah :D
<j`ey> leave the retries++ in. it's nice, ying and yang. equlibrium
<marcan> lol
<sven> it also looks like this nvme controller just doesn't support the abort command :/
yuyichao has joined #asahi-dev
akemin_dayo has quit [Ping timeout: 480 seconds]
yuyichao_ has quit [Ping timeout: 480 seconds]
<sven> povik: i briefly looked at it and left some general comments. i don't know anything about those subsystems but it mostly already looks good to me
<sven> (except for all those HACKs ofc ;))
<povik> sven, firefox317: thanks for the comments! good there have been some eyes on it
<povik> marcan: M1Pro laptop i do have, it's just that i prefer calling it M1X
akemin_dayo has joined #asahi-dev
bps has joined #asahi-dev
<j`ey> marcan: what are the 4 spi1_pins?
<j`ey> I guess CS, mosi, miso, ???
<j`ey> clk
<_jannau_> j`ey: see https://github.com/AsahiLinux/m1n1/commit/e8b30c93257b4d9d882463b573815f5c4d89681d line 173 for reference of the pin layout for m1 pro/max spi3
<j`ey> _jannau_: thanks, I have to figure out the m1 air ones then
<_jannau_> I would guess the layout is the same so the other pins are adjacent from cs
<kettenis> the clk, mosi and miso pins should already be set correctly
<kettenis> otherwise the corellium spi driver wouldn't work
<j`ey> true
<_jannau_> oh, I missed that spi1 doesn't use consecutive
<j`ey> how do I run the adt.py command? I always get some python module errors
<j`ey> I think it generates a better/readable format now, so want to regenerate my copy
<jannau> j`ey: python3.9 -m m1n1.adt j314c_dev.bin
<j`ey> jannau: how do I get the .bin?
<_jannau_> the module has '-r' to retrieve and save the adt from the device
<j`ey> thanks!
<j`ey> I don't see any obvious dmesg errors, but keyboard doesn't work currently
<_jannau_> j`ey: try to comment the delay hacks in applespi. I think those are only comaptible with the corellium spi driver
<j`ey> think my mac just ran out of battery, woops, will charge for a bit and try later
Gaspare has joined #asahi-dev
Glanzmann has joined #asahi-dev
<Glanzmann> j`ey: Do you use the macbook air as workstation under Linux? If so, how long does the battery last?
<j`ey> Glanzmann: I dont use it yet
<j`ey> just for testing patches
<Glanzmann> I
<Glanzmann> see.
<jannau> I see "Command 1 timed out" with corellium's applespi on top of AsahiLinux/linux/asahi
<j`ey> jannau: after removing the delays?
<j`ey> or just as-is
roxfan has joined #asahi-dev
roxfan2 has quit [Ping timeout: 480 seconds]
<jannau> j`ey: both, haven't looked into it beyond that
<j`ey> jannau: ok, I'm not going to look tonight e9ther
Gaspare has quit [Ping timeout: 480 seconds]
<Glanzmann> jannau: Tried your patchset on the mini, works great.
mipmeb has joined #asahi-dev
<mipmeb> ???? c / e r t a i n l y , z a m e r i c a n s n e e d e d s o m e t h i n g l i k e 9 / 11 t o J u s t i f y i n v a d i n g - i r - a q w h i c h h a s b e e n a l r e a d y p la n n e d a s a p a r t o f c r e a t i v e c -h a o s D i d u s a t r a i n & s u p p l y i s i s w i t h
<mipmeb> w e a p o n s l i k e i t d i d w i t h a l - q a- e d a t o j u s t i f y c r e a t i n g w a r .s C R E - A T - I V E C H A - O S d i d c i a - d i d 9 / 11 o r i t j u s t l e t i t h a p p e n p l a n f o r m i d d l e -e a s t i f a l q a e d a d i d i t
<mipmeb> W H Y t o k - i - l - l 9 m i l l i o n i r -a q i - s a b o u t 9 m i l l i o n i r a q i - d i -e d E i t h e r -b e c a u s e - o f d i r e c t a m e r ic a n v i o l e n c e a n d b e c a u s e o f s i e g e u s a m a d e a g a i n s t i r - a q t h a t p r e v e n t e d i -r a -q i f r o m e s s e n
<mipmeb> t i a l l i v i n g m a t e r i a l s , f o o d , m e d i c i n e a n d e v e n p e n c i l s f o r z c h i l d e r n - i s i s a n d a l q- a e d a - o n l y a p p e a r e d i n i r - a q a f t e r u s a i n v a s i o n , D i d u s a p a v e t h e w a y for i s- i s t o i r a -q ? s a d -d -a m
<mipmeb> h u s- s i n who l o s t m o s t of his p o -w e r in 1 st , 2 nd g u l f w a r s a n d d u r i n g 1 0 y e a r s of s i e g e , d i d n o t a l l o w i s ` i s or a l , q a , e d e a t o e n t e r i r -a q , e v e n t o ` h e l p h i m a g a i n st u s a
Ganneff has joined #asahi-dev
mipmeb has quit [Remote host closed the connection]
___nick___ has joined #asahi-dev
___nick___ has quit []
___nick___ has joined #asahi-dev
os has quit [Ping timeout: 480 seconds]
os has joined #asahi-dev
DarkShadow44 has quit [Quit: ZNC - https://znc.in]
DarkShadow44 has joined #asahi-dev
TheLink has quit [Quit: ZNC 1.8.2 - https://znc.in]
TheLink has joined #asahi-dev
ar has quit [Ping timeout: 480 seconds]
ar has joined #asahi-dev
___nick___ has quit [Ping timeout: 480 seconds]
Ganneff has left #asahi-dev [#asahi-dev]
<j`ey> jannau: oh, if you want to try again, theres that retries++ line you could try delete
<jannau> j`ey: works now with printks and not fully priming the tx fifo
<j`ey> great!
<j`ey> jannau: put the diff somewhere i can try the air tomorrow
<jannau> will do, currently reverting hopefully unrelated changes to have a minimal diff
<j`ey> seems like we had different issues anyway, but worth trying
<jannau> increased delays in applespi were required
<j`ey> it seems like thats a property of the device connected via SPI then, and not the controller itself
<j`ey> (delays after CS assertion)
<kettenis> probably should set the cs_delay member of struct spi_device appropriately
<kettenis> that seems to be a relatively recent addition though
<j`ey> I dont see a cs_delay, but theres a bunch of other ones here https://www.kernel.org/doc/html/latest/driver-api/spi.html
<jannau> no, existing delays are fine, I should not have increased the amount of fifo priming
<kettenis> sorry, cs_setup
<jannau> also not just priming but maximal write size
<kettenis> ah, yes, the fifo size is only 16
<j`ey> wait.. im confused by APPLE_SPI_FIFOSTAT_LEVEL_TX - inuse
<j`ey> was thta meant to be FIFOSIZE - inuse?
<kettenis> I think so
<kettenis> or at least it should have the min_t that jannau suggests
<kettenis> APPLE_SPI_FIFO_DEPTH instead of 16 of course
<jannau> APPLE_SPI_FIFO_DEPTH
<j`ey> APPLE_SPI_FIFOSTAT_LEVEL_TX GENMASK(15, 8)
<j`ey> yeah
<kettenis> wonder if there is a register that indicates the actual fifo size
<j`ey> jannau: so does that fix it too? min_t(u32, *left, APPLE_SPI_FIFO_DEPTH - inuse);
<jannau> yes
<jannau> caps lock led toggling works now and doesn't break the touchpad
<j`ey> jannau: woot
<jannau> I suppose discarding input data on a write broke it with the corellium driver
<j`ey> jannau: how is the trackpad in general?
<j`ey> marcan: pinging marcan on the FIFO_DEPTH to make surehe sees it
<kettenis> it feels like an apple trackpad
<kettenis> so quite good
<j`ey> nice nice
<j`ey> I got very frustrated with my thinkpad's one
<kettenis> had to get used to the one on my x395
<kettenis> but having three proper mouse buttons is nice
<jannau> it's not smooth when tracing spi in the hypervisor
<j`ey> jannau: :D
<kettenis> mwahaha
<jannau> delays are still too short or missing. it is still broken on baremetal
Dcow_ has quit [Read error: Connection reset by peer]
Dcow has joined #asahi-dev
StupidYui has joined #asahi-dev
<jannau> j`ey: https://github.com/jannau/linux/tree/exp/spi-keyboard is my current state, the touchpad still can be wedged easily
<jannau> setting cs_setup from the applespi probe function doesn't seem to have an effect