Skip to content

bcm2708-i2s add mono support #694

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

Closed
wants to merge 2 commits into from

Conversation

plughplover
Copy link

A small patch to enable mono support. Tested for 16/24/32 bit capture, and should also work for playback. All the i2s framing and timings remain the same, just don't enable channel 2 transfers.

A small patch to enable mono support. Tested for 16/24/32 bit capture, and should also work for playback. All the i2s framing and timings remain the same, just don't enable channel 2 transfers.
@popcornmix
Copy link
Collaborator

Looks fine to me. If no objections in the new few days I'll merge.

Always enable hardware 'receive sign extension' flag. Has no effect for tx, or on 16/32 bit rx, thus only affects S24_LE capture. If driver ever adds support for U24_LE format this will need to 'fixed'.
@plughplover
Copy link
Author

Obviously I don't understand the system.

I committed a separate change (sign extension) in my 'fork' that I wanted to open up for discussion here and it now appears it has been linked to the mono one above. It is an independent patch.

@asb
Copy link

asb commented Sep 26, 2014

@plughplover it's a common mistake - you want to create a different branch for each active pull request to avoid this.

@popcornmix
Copy link
Collaborator

@plughplover
Probably the best way of fixing this is to get this PR merged first.
So:

git rebase -i HEAD~2
(follow instructions to delete the sign extend commit)
git push -f

That should make this PR look correct. Once that is merged, you can do:

git cherry-pick e1a19c7
git push

and the second PR should look correct.

As asb says, next time PR a topic branch. E.g.

git checkout -b mono_enhancement
(add your commits)
git push
(create PR from branch "mono_enhancement")

Now you can have as many outstanding PRs as you want.

@plughplover
Copy link
Author

@popcornmix I don't have 'git' installed. I did those using the web-site.
fyi - I used "rpi-source" to create source tree / build environment

Is there a way to just delete the rxsex commit? Or just wait and see if rxsex is agreeable to everyone and include it? It looks like I can edit the text labels for the "PR".

Sorry for the fumbles. (I really didn't want to start down this path yet).

@plughplover
Copy link
Author

@asb - don't know how to create a separate branch. Do know how to select a particular generation of a source file on the web-site. If (in the future) I selected the 'base' generation and edited / committed that, would that give the desired result? (Thinking about it, I should have done that with rxsex patch - I see now how editing the 'mono' commit linked rxsex to it.)

@plughplover
Copy link
Author

Hold off on this. Over the week-end I put together a completely synthetic test setup to exercise both these patches using simultaneous playback and capture. I'm seeing "something" with the mono case that I need to dig into more deeply (my current suspicions are directed at the TX FIFO). I think next step is to break out my ancient but trusty HP logic analyzer and grab some bit-stream traces off the i2s pins. fwiw, the rxsex patch is passing with flying colors...

IMHO the test setup is pretty 'darn' cool. Only hardware needed is a pi and a jumper. More later...

@plughplover
Copy link
Author

Found https://help.github.com/articles/github-flow-in-the-browser/ which clarified things a bit.

I'm going to close this PR and (hopefully - fingers crossed) redo it with just the mono part.

@plughplover plughplover closed this Oct 2, 2014
anholt pushed a commit to anholt/linux that referenced this pull request May 16, 2017
By poking at /debug/sched_features I triggered the following splat:

 [] ======================================================
 [] WARNING: possible circular locking dependency detected
 [] 4.11.0-00873-g964c8b7-dirty raspberrypi#694 Not tainted
 [] ------------------------------------------------------
 [] bash/2109 is trying to acquire lock:
 []  (cpu_hotplug_lock.rw_sem){++++++}, at: [<ffffffff8120cb8b>] static_key_slow_dec+0x1b/0x50
 []
 [] but task is already holding lock:
 []  (&sb->s_type->i_mutex_key#4){+++++.}, at: [<ffffffff81140216>] sched_feat_write+0x86/0x170
 []
 [] which lock already depends on the new lock.
 []
 []
 [] the existing dependency chain (in reverse order) is:
 []
 [] -> #2 (&sb->s_type->i_mutex_key#4){+++++.}:
 []        lock_acquire+0x100/0x210
 []        down_write+0x28/0x60
 []        start_creating+0x5e/0xf0
 []        debugfs_create_dir+0x13/0x110
 []        blk_mq_debugfs_register+0x21/0x70
 []        blk_mq_register_dev+0x64/0xd0
 []        blk_register_queue+0x6a/0x170
 []        device_add_disk+0x22d/0x440
 []        loop_add+0x1f3/0x280
 []        loop_init+0x104/0x142
 []        do_one_initcall+0x43/0x180
 []        kernel_init_freeable+0x1de/0x266
 []        kernel_init+0xe/0x100
 []        ret_from_fork+0x31/0x40
 []
 [] -> #1 (all_q_mutex){+.+.+.}:
 []        lock_acquire+0x100/0x210
 []        __mutex_lock+0x6c/0x960
 []        mutex_lock_nested+0x1b/0x20
 []        blk_mq_init_allocated_queue+0x37c/0x4e0
 []        blk_mq_init_queue+0x3a/0x60
 []        loop_add+0xe5/0x280
 []        loop_init+0x104/0x142
 []        do_one_initcall+0x43/0x180
 []        kernel_init_freeable+0x1de/0x266
 []        kernel_init+0xe/0x100
 []        ret_from_fork+0x31/0x40

 []  *** DEADLOCK ***
 []
 [] 3 locks held by bash/2109:
 []  #0:  (sb_writers#11){.+.+.+}, at: [<ffffffff81292bcd>] vfs_write+0x17d/0x1a0
 []  #1:  (debugfs_srcu){......}, at: [<ffffffff8155a90d>] full_proxy_write+0x5d/0xd0
 []  #2:  (&sb->s_type->i_mutex_key#4){+++++.}, at: [<ffffffff81140216>] sched_feat_write+0x86/0x170
 []
 [] stack backtrace:
 [] CPU: 9 PID: 2109 Comm: bash Not tainted 4.11.0-00873-g964c8b7-dirty raspberrypi#694
 [] Hardware name: Intel Corporation S2600GZ/S2600GZ, BIOS SE5C600.86B.02.02.0002.122320131210 12/23/2013
 [] Call Trace:

 []  lock_acquire+0x100/0x210
 []  get_online_cpus+0x2a/0x90
 []  static_key_slow_dec+0x1b/0x50
 []  static_key_disable+0x20/0x30
 []  sched_feat_write+0x131/0x170
 []  full_proxy_write+0x97/0xd0
 []  __vfs_write+0x28/0x120
 []  vfs_write+0xb5/0x1a0
 []  SyS_write+0x49/0xa0
 []  entry_SYSCALL_64_fastpath+0x23/0xc2

This is because of the cpu hotplug lock rework. Break the chain at #1
by reversing the lock acquisition order. This way i_mutex_key#4 no
longer depends on cpu_hotplug_lock and things are good.

Cc: Jens Axboe <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
popcornmix pushed a commit that referenced this pull request Aug 14, 2017
Fix lockdep splat introduced in v4.13-rc4.

[  266.297226] ------------[ cut here ]------------
[  266.300078] WARNING: CPU: 2 PID: 176 at /mnt/src/jaja/git/tf300t/include/linux/blkdev.h:657 mmc_blk_remove_req+0xd0/0xe8 [mmc_block]
[  266.302937] Modules linked in: mmc_block(-) sdhci_tegra sdhci_pltfm sdhci pwrseq_simple pwrseq_emmc mmc_core
[  266.305941] CPU: 2 PID: 176 Comm: rmmod Tainted: G        W       4.13.0-rc4mq-00208-gb691e67724b8-dirty #694
[  266.308852] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
[  266.311719] [<b011144c>] (unwind_backtrace) from [<b010ca54>] (show_stack+0x18/0x1c)
[  266.314664] [<b010ca54>] (show_stack) from [<b062e3f4>] (dump_stack+0x84/0x98)
[  266.317644] [<b062e3f4>] (dump_stack) from [<b01214f4>] (__warn+0xf4/0x10c)
[  266.320542] [<b01214f4>] (__warn) from [<b01215d4>] (warn_slowpath_null+0x28/0x30)
[  266.323534] [<b01215d4>] (warn_slowpath_null) from [<af067858>] (mmc_blk_remove_req+0xd0/0xe8 [mmc_block])
[  266.326568] [<af067858>] (mmc_blk_remove_req [mmc_block]) from [<af068f40>] (mmc_blk_remove_parts.constprop.6+0x50/0x64 [mmc_block])
[  266.329678] [<af068f40>] (mmc_blk_remove_parts.constprop.6 [mmc_block]) from [<af0693b8>] (mmc_blk_remove+0x24/0x140 [mmc_block])
[  266.332894] [<af0693b8>] (mmc_blk_remove [mmc_block]) from [<af0052ec>] (mmc_bus_remove+0x20/0x28 [mmc_core])
[  266.336198] [<af0052ec>] (mmc_bus_remove [mmc_core]) from [<b046aa64>] (device_release_driver_internal+0x164/0x200)
[  266.339367] [<b046aa64>] (device_release_driver_internal) from [<b046ab54>] (driver_detach+0x40/0x74)
[  266.342537] [<b046ab54>] (driver_detach) from [<b046982c>] (bus_remove_driver+0x68/0xdc)
[  266.345660] [<b046982c>] (bus_remove_driver) from [<af06ad40>] (mmc_blk_exit+0xc/0x2cc [mmc_block])
[  266.348875] [<af06ad40>] (mmc_blk_exit [mmc_block]) from [<b01aee30>] (SyS_delete_module+0x1c4/0x254)
[  266.352068] [<b01aee30>] (SyS_delete_module) from [<b0108480>] (ret_fast_syscall+0x0/0x34)
[  266.355308] ---[ end trace f68728a0d3053b72 ]---

Fixes: 7c84b8b ("mmc: block: bypass the queue even if usage is present for hotplug")
Signed-off-by: Michał Mirosław <[email protected]>
Reviewed-by: Shawn Lin <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
pfpacket pushed a commit to pfpacket/linux-rpi-rust that referenced this pull request Apr 7, 2023
rust: generate target specification files on the fly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants