-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
RP1 Audio Out #6668
base: rpi-6.12.y
Are you sure you want to change the base?
RP1 Audio Out #6668
Conversation
aa9d461
to
aec0c90
Compare
@pelwell could you cast an eye over the first two commits please (since renamed for rebase), to check they don't break I2S or anything else? Thanks. |
Do you need a card to test with? |
8d163a9
to
50b8659
Compare
ba43740
to
94160db
Compare
Successfully tested JustBoom DAC Zero and IQaudIO Pi-Codec+ hats at various sample rates. I could even load and use the rp1aout driver at the same time, but (predictably) I2S stomped on rp1aout's clock when using the (crystal-less) JustBoom hat; they did seem able to coexist with the IQaudIO. Getting 48000Hz and 44100Hz-based rates at the same time is impractical with a single audio PLL. Running two outputs at (48000*32, 48000*3200) ought to be achievable, but the RP1 clk driver doesn't currently oblige. It's not a vital use case. |
25c7358
to
c3fe22d
Compare
sound/soc/raspberrypi/rp1_aout.c
Outdated
if (ret) | ||
return dev_err_probe(&pdev->dev, ret, "failed to register pcm\n"); | ||
|
||
/* TODO: More PM stuff? */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will have an effect unless you define dev_pm_ops with suspend/resume/idle callbacks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is what I was wondering. I suppose it ought to be done.
cmd == SNDRV_PCM_TRIGGER_SUSPEND || | ||
cmd == SNDRV_PCM_TRIGGER_PAUSE_PUSH) { | ||
/* Push a zero sample (assuming DMA has stopped already?) */ | ||
aout_reg_wr(aout, AUDIO_OUT_SAMPLE_FIFO, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Underflow should be handled gracefully by the hardware (the last sample plays forever) - ASoC decouples DMA ops from driver visibility so you may introduce a glitch here if DMA is still running. I don't know if it synchronously drains the DMA buffers or flushes them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In tests it does seem to use the given value quite reliably -- I'll remove the question mark
It wasn't clear to me whether a step to zero would be more or less objectionable than a nonstandard DC value (perhaps followed by a step later). Maybe 'stop' and 'pause' cases should be treated differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a bit more debug: I haven't actually observed a PAUSE_PUSH or SUSPEND -- when I Ctrl-Z aplay
, it does a STOP. I think I will keep the zero as it seems to work, and may be better than sticking at an arbitrary value.
b81599d
to
0ab48b8
Compare
Rebooting with the carrier active doesn't result in a clean shutdown - it goes thump. snd_soc_dai_ops needs a shutdown callback... |
I think platform shutdown is the one I want: DAI shutdown happens after every stream, and we decided we wanted to leave the "bias" on in those cases. But I am currently battling a suspected race condition here... |
Created a tag https://github.com/njhollinghurst/linux/tree/audio_out_wip with current history. |
fd2db7e
to
031a382
Compare
Change the standard rate of PLL_AUDIO_SEC from 192MHz to 153.6MHz to suit audio out. Declare audio out hardware and give it a named pin control. Signed-off-by: Nick Hollinghurst <[email protected]>
…rror Connect PLL_AUDIO_SEC to CLK_AUDIO_OUT, which had been commented out to avoid interference with I2S: we expect them never to be enabled at the same time. Work around a rounding error that occurs when the desired rate is exactly the max but not exactly achievable by the PLL. Signed-off-by: Nick Hollinghurst <[email protected]>
b59584e
to
37d7eca
Compare
Only 48000Hz stereo 16-bit output is currently supported. It requires some additional OF plumbing to connect it to a "dummy" codec and generic sound card. Signed-off-by: Nick Hollinghurst <[email protected]>
Since RP1 Audio Out can only work on GPIOs 12, 13 which would previously have needed dtoverlay=audremap, overload it both to enable and pin-map the block (do not enable for other pinouts). At the same time, generate a default "codec" and "sound card". Signed-off-by: Nick Hollinghurst <[email protected]>
37d7eca
to
d16651b
Compare
Candidate version of an RP1 Audio Out driver
48kHz stereo only. GPIO 12/13 only.
Now rewritten as an ASOC DAI driver; a generic sound card and "dummy" codec must also be enabled via OF.