leifliddy / macbook12-audio-driver

WIP audio driver for the cs4208 codec found in the 12" MacBook (MacBook9,1, MacBook10,1).
84 stars 9 forks source link

build an out-of-tree kernel module #1

Closed meeuw closed 2 years ago

meeuw commented 4 years ago

You might be interested in my work for building an out-of-tree kernel module: https://github.com/meeuw/snd_hda_macbookpro/tree/master-v5.1.20

This allows you to build a module using kernel-devel instead of kernel-sources.

I'm planning to create an akmod module for Fedora, I wondered if the sources in thos repository are ahead of the patches from davidjo (do you have other sources?).

leifliddy commented 4 years ago

The patches in this repository are completely different then davidjo's (different macbook models) Our patches would need to be merged together, mainly just patch_cirrus.c, as patch_cirrus_a1534.h can stand alone. But, first I need to clean up patch_cirrus.c. There a ton of cruft leftover from testing that needs to be removed. I'm on vacation at the moment, but I should have time to do it next week. I like the idea of merging these repositories together. Hopefully, davidjo would be open to this idea. If I could merge my stuff with his, I could shut this repo down.

leifliddy commented 4 years ago

I was able to clean up the code quite a bit. I offloaded as many mb9-specific functions as I could to the patch_cirrus_a1534_setup.h and patch_cirrus_a1534_pcm.h files. The goal was to leave patch_cirrus.c as close to the original file as possible (this will make patching future kernels super easy). It would be nice if someone could confirm whether this driver works on the macbook8,1 and 10,1 models as I only have a macbook9,1 model to test on. I'm not a kernel developer and am sort of learning as I go. If anyone has any ideas on how to improve this repo, please let me know.

meeuw commented 4 years ago

nice work! I have an macbook pro 13,3 but I haven't tried your or davidjo's work on it.

davidjo posted that he intends to push more updates: https://github.com/davidjo/snd_hda_macbookpro/issues/3

Could you please share how you got your information for the changes you've made? I actually have some kernel development experience and I'd love to help.

leifliddy commented 4 years ago

So @davidjo provided @dvulricht with the tools necessary to view the vendor node commands used by macos. I then gave @dvulricht access to my macbook9,1. He was then able to craft the driver by combining these vendor node commands (patch_cirrus_a1534_setup.h) with @davidjo's pcm functions (patch_cirrus_a1534_pcm.h). @dvulricht did get the headphones (HP) partially working, but 50% of the time I used the driver the HP audio was super distorted and REALLY loud (the other 50% of the time the HP audio was perfect). So, we're leaving that functionality out until we find a more consistent solution. So, I'm left in the position of hosting this repo even though I'm dependent on outside developers to perform the low-level kernel work.