Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TPA6130A2 driver: kernel panic after unload; inability to re-load #10

Open
LRitzdorf opened this issue Feb 21, 2024 · 8 comments · May be fixed by #13
Open

TPA6130A2 driver: kernel panic after unload; inability to re-load #10

LRitzdorf opened this issue Feb 21, 2024 · 8 comments · May be fixed by #13
Labels
bug Something isn't working reproduced Bug has been reproduced

Comments

@LRitzdorf
Copy link
Contributor

This issue is mostly for "housekeeping" purposes, so that the problem described here is known about.

Issues with the existing TPA6130A2 headphone amplifier driver are two-fold:

  • The driver cannot be unloaded and re-loaded into the kernel. Relevant kernel messages (generated upon re-registration) are:
    Failed to register I2C driver
    Error: Driver 'Audio Logic tpa613a2 Driver' is already registered, aborting...
    platform_driver_register returned -16
    
  • Unloading the driver (even without attempting to re-load it later) causes a kernel panic the next time the system is powered off.

If someone (@tvannoy or myself, time allowing) are up for the task, this is probably best resolved by rewriting the TPA6130A2 driver in the style of Trevor's recent AD1939 update, since the latter a) does not exhibit this issue, and b) is much cleaner overall. No particular pressure at the moment, though!

@LRitzdorf
Copy link
Contributor Author

On a related note, the chip here is actually a TPA6130A2, not a TPA613A2. The former supports I2C, while the latter does not 🙂

@tvannoy tvannoy added bug Something isn't working reproduced Bug has been reproduced labels Feb 21, 2024
@tvannoy
Copy link
Collaborator

tvannoy commented Feb 21, 2024

Just a general question: what do we expect to happen when we unload a driver? Should removing the module uninitialize the physical hardware? Probably not, but just something to think about as I don't have a good feel for what is typical.

@rksnider
Copy link
Contributor

rksnider commented Feb 21, 2024 via email

@LRitzdorf
Copy link
Contributor Author

Muting (and otherwise resetting) the hardware on unload makes sense, but I could also see situations where that'd be undesirable. In particular, this would force us to have the HPS running in order to use the system; shutting down would unload the modules and reset the hardware.

Personally, I think it'd be neat if we at least had the option to shut down the HPS and leave the remaining audio hardware fully functional. This is absolutely something we can handle later, though, or not at all.

If we think the option to skip resetting hardware would be useful, I think the standard way to implement that would be as a kernel module parameter (resource, resource), which could default to "reset" but allow the user to specify "no reset" if they so desire. Using insmod, for example, that would look something like insmod ad1939.ko unload_reset=false.

@rksnider
Copy link
Contributor

rksnider commented Feb 22, 2024 via email

@tvannoy
Copy link
Collaborator

tvannoy commented Feb 23, 2024

Let's not complicate things for the sake of neat or nice-to-have-but-unnecessary feature creep. The goal should be making the code both functional and easy to learn from. Unnecessary complexity in the code is likely to result in extra complexity during the learning process. Keep it simple (but not the Arch Linux meaning of "simple").

@LRitzdorf
Copy link
Contributor Author

Good point! Also, if the textbook assumes constant HW/SW interoperation in order for the system to properly run, that makes a lot more sense.

@LRitzdorf
Copy link
Contributor Author

Currently working on a very basic driver which integrates properly with the device tree, based on Trevor's work with the AD1939. Once that's done, I can open a separate PR to handle mute-on-unload functionality, if desired.

@LRitzdorf LRitzdorf linked a pull request May 13, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproduced Bug has been reproduced
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants