-
Notifications
You must be signed in to change notification settings - Fork 4
ASoC: sophgo: add CV1800 AIAO mux and I2S support #10
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
base: for-next
Are you sure you want to change the base?
Conversation
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 think this is a first step to review. I suggest you should check you patch format by executing scripts/checkpatch.pl with --strict parameter. I will continue to review your logic after this change. Thanks.
Documentation/devicetree/bindings/sound/sophgo,cv1800b-i2s.yaml
Outdated
Show resolved
Hide resolved
Documentation/devicetree/bindings/sound/cvitek,cv1800b-i2s.yaml
Outdated
Show resolved
Hide resolved
Documentation/devicetree/bindings/sound/cvitek,cv1800b-i2s.yaml
Outdated
Show resolved
Hide resolved
Documentation/devicetree/bindings/mux/sophgo,cv1800b-aiao-mux.yaml
Outdated
Show resolved
Hide resolved
Documentation/devicetree/bindings/sound/cvitek,cv1800b-i2s.yaml
Outdated
Show resolved
Hide resolved
9ea2622 to
f8343e3
Compare
This comment was marked as resolved.
This comment was marked as resolved.
f8343e3 to
dc8371d
Compare
|
Good update, and I think you should do the additional check for your patches:
|
Documentation/devicetree/bindings/sound/sophgo,cv1800b-i2s.yaml
Outdated
Show resolved
Hide resolved
Documentation/devicetree/bindings/sound/sophgo,cv1800b-i2s.yaml
Outdated
Show resolved
Hide resolved
cbb793a to
14e4e8c
Compare
This comment was marked as resolved.
This comment was marked as resolved.
2bed83b to
6efff4b
Compare
For simple thing like code refactor, you can just close the threads, for some complex thing, just leave it. And I will decide whether it is OK to close |
|
@stavinsky Also, if you can, just do a squash merge for the last commit, it is too hard to see the change. |
6efff4b to
bb7e2fc
Compare
This comment was marked as resolved.
This comment was marked as resolved.
98cfdb1 to
b986bf9
Compare
This comment was marked as resolved.
This comment was marked as resolved.
b986bf9 to
bfa862e
Compare
1cda8f1 to
6519dcd
Compare
|
@inochisa If you don't like this idea we could stay with current mux, but we will have to hardcode i2s slot width to 32, which is most common in my practice. And we will probably be not able to support PDM mode (I dont know if anyone will want to used it at all ) possible configuration could be like this |
It is fine to leave it if it is hard to implement, but I suggest leaving room for the PDM mode, it is a pain to refactor everything at the time we want to support it. In some times, it means the driver itself should be abandoned and a new one should be added. PS1: how about using |
|
|
||
| i2s0: i2s@4100000 { | ||
| compatible = "sophgo,cv1800b-i2s"; | ||
| reg = <0x04100000 0x10000>; |
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.
reg = <0x04100000 0x8000>; The mux is at the last 0x8000.
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.
true. Found this problem yesterday. it should be 1000 not 10000. Typo.
|
Some bad (or not so bad) thoughs:
|
I think I can write sound card driver in a few days. This means we will have possibility to configure everything we have in hardware. If you agree wth the plan, i will make this pull request as draft and come back to you when the card driver will be ready. |
Great
Agreed
OK, I think it is reasonable, It seems like better to leave the connection in the board.
Another is fine. Just be simple
It is OK for me.
Anyway, it is enough for something, if you feel too hard for it, I will take the rest. Thanks for your energy :).
I think it is good plan, let's start it.
It is good to follow ALSA, and I think it is necessary to keep simple.
In fact, it is kind of relaxed for devicetree, In my view, I prefer a extensible design, but if it is too hard, leave it and just make it worked. |
I will try to replicate dt as much as possible in the same way as simple-audio-card does with only 1 addition: mux connections. This mostly why we need our card. |
6519dcd to
2c44a76
Compare
|
@inochisa Hey. Hope you are doing well. I made a decision to get rid of mux driver in this commit. Internal ADC/DAC now works out of the box. I2S2 with external mic still need these settings for ethernet IP block. You said it should be done by mdio but mdio is not available yet. What we have nowtdm almost the same. Added a few callbacks to be compatible with simple-card Testing and resultscan be tested like this. Ideally with Duo Module 01 EVB board as it have standard jack and both channels available. My external I2S mic was also tested on Milk 256M and it works fine with 32 bit slot on I2S2 (ethernet pins from the side) all the commits were checked with As always appreciate for you support and attention to details. P.S. i've ordered PCM mic to try implement PCM mode. But this is a different story. |
Documentation/devicetree/bindings/sound/sophgo,cv1800b-i2s.yaml
Outdated
Show resolved
Hide resolved
| compatible = "sophgo,cv1800b-i2s"; | ||
| reg = <0x04110000 0x10000>; | ||
| #address-cells = <1>; | ||
| #size-cells = <0>;// check if can be dropped |
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 suggest just leave it, also remove the comment,
Documentation/devicetree/bindings/sound/sophgo,cv1800b-i2s.yaml
Outdated
Show resolved
Hide resolved
How about adding a property "sophgo,mux" syscon node? so we can configure the mux if needed.
The ethernet change I think it maybe too dirty to be upstreamed, so I think it is OK to just leave a comment for it |
|
@stavinsky In genernal, I think it is good enough and ready to go, feel free to sent it to the LKML and check if there is more advice, thanks for your PR. |
I'm preparing another patch series with custom sound card. Mux, clocks and so on should be there i think.
yep. Agree. |
Purpose: introduce DT schema for the CPU driver Signed-off-by: Anton D. Stavinskii <stavinsky@gmail.com>
The actual CPU DAI controller. Signed-off-by: Anton D. Stavinskii <stavinsky@gmail.com>
Document the internal ADC audio codec integrated in the Sophgo CV1800B SoC. Signed-off-by: Anton D. Stavinskii <stavinsky@gmail.com>
Codec DAI endpoint for TXDAC + basic controls. Signed-off-by: Anton D. Stavinskii <stavinsky@gmail.com>
Document the internal DAC audio codec integrated in the Sophgo CV1800B SoC. Signed-off-by: Anton D. Stavinskii <stavinsky@gmail.com>
Codec DAI endpoint for TXDAC + basic controls. Signed-off-by: Anton D. Stavinskii <stavinsky@gmail.com>
New dts nodes for TDMs and readable DMA names Signed-off-by: Anton D. Stavinskii <stavinsky@gmail.com>
Example of usage internal dac/adc and external I2S mic Signed-off-by: Anton D. Stavinskii <stavinsky@gmail.com>
2c44a76 to
b8b3663
Compare
Thanks for your help. It was a great journey. Ive sent to lkml as you can see :) |
When interrupting perf stat in repeat mode with a signal the signal is passed to the child process but the repeat doesn't terminate: ``` $ perf stat -v --null --repeat 10 sleep 1 Control descriptor is not initialized [ perf stat: executing run #1 ... ] [ perf stat: executing run #2 ... ] ^Csleep: Interrupt [ perf stat: executing run #3 ... ] [ perf stat: executing run #4 ... ] [ perf stat: executing run #5 ... ] [ perf stat: executing run #6 ... ] [ perf stat: executing run #7 ... ] [ perf stat: executing run #8 ... ] [ perf stat: executing run #9 ... ] [ perf stat: executing run #10 ... ] Performance counter stats for 'sleep 1' (10 runs): 0.9500 +- 0.0512 seconds time elapsed ( +- 5.39% ) 0.01user 0.02system 0:09.53elapsed 0%CPU (0avgtext+0avgdata 18940maxresident)k 29944inputs+0outputs (0major+2629minor)pagefaults 0swaps ``` Terminate the repeated run and give a reasonable exit value: ``` $ perf stat -v --null --repeat 10 sleep 1 Control descriptor is not initialized [ perf stat: executing run #1 ... ] [ perf stat: executing run #2 ... ] [ perf stat: executing run #3 ... ] ^Csleep: Interrupt Performance counter stats for 'sleep 1' (10 runs): 0.680 +- 0.321 seconds time elapsed ( +- 47.16% ) Command exited with non-zero status 130 0.00user 0.01system 0:02.05elapsed 0%CPU (0avgtext+0avgdata 70688maxresident)k 0inputs+0outputs (0major+5002minor)pagefaults 0swaps ``` Note, this also changes the exit value for non-repeat runs when interrupted by a signal. Reported-by: Ingo Molnar <mingo@kernel.org> Closes: https://lore.kernel.org/lkml/aS5wjmbAM9ka3M2g@gmail.com/ Signed-off-by: Ian Rogers <irogers@google.com> Tested-by: Thomas Richter <tmricht@linux.ibm.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This patch series adds basic audio support for Sophgo CV1800B, as used on boards such as the Milk-V Duo. The series introduces an AIAO audio mux driver, an I2S controller driver, corresponding DT bindings, and DTS updates to wire the components together.
The implementation is based on vendor documentation and testing on real hardware. This series relies on recent fixes in the DesignWare AXI DMA support; in particular, correct operation depends on the DMA changes discussed at:
https://lore.kernel.org/all/20251214224601.598358-1-inochiama@gmail.com/ The current driver implementation supports a fixed audio configuration of 48 kHz sample rate. The series has been tested on the Milk-V Duo and Milk-V Duo 256M boards using the Sophgo SG2002 SoC. The implementation is expected to also work on Milk-V Duo boards based on the SG2000 SoC, as the audio and DMA blocks are closely related.
Known hardware limitation:
On CV1800B / SG2002, the I2S2 output pins cannot be enabled via pinctrl alone. Due to SoC design constraints, the output path becomes functional only after additional vendor-specific register programming. This series makes the limitation explicit and does not attempt to work around it implicitly via pinctrl or undocumented behavior.