diff options
author | Nicolin Chen <nicoleotsuka@gmail.com> | 2014-10-24 22:03:57 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-10-27 20:17:02 -0400 |
commit | 86a570c577b7975f31c0539f6a724194892ebc43 (patch) | |
tree | 80649335879ee003f748e983e771ec93270729e7 /sound/soc/fsl/fsl_asrc.c | |
parent | f114040e3ea6e07372334ade75d1ee0775c355e1 (diff) |
ASoC: fsl_asrc: Add reg_defaults for regmap to fix kernel dump
Kernel dump (WARN_ON) ocurred during system boot-up inside regmap_write():
------------[ cut here ]------------
WARNING: CPU: 0 PID: 47 at kernel/locking/lockdep.c:2744 lockdep_trace_alloc+0xe8/0x108()
DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags))
Modules linked in:
CPU: 0 PID: 47 Comm: kworker/u2:2 Not tainted 3.18.0-rc1-10245-gb75d289-dirty #56
Workqueue: deferwq deferred_probe_work_func
Backtrace:
[<80012294>] (dump_backtrace) from [<80012578>] (show_stack+0x18/0x1c)
r6:8097c73c r5:8097c73c r4:00000000 r3:be33ba80
[<80012560>] (show_stack) from [<806aac48>] (dump_stack+0x8c/0xa4)
[<806aabbc>] (dump_stack) from [<8002a694>] (warn_slowpath_common+0x70/0x94)
r6:80062838 r5:00000009 r4:bd827b30 r3:be33ba80
[<8002a624>] (warn_slowpath_common) from [<8002a6f0>] (warn_slowpath_fmt+0x38/0x40)
r8:00000004 r7:00000001 r6:000080d0 r5:60000193 r4:bd826010
[<8002a6bc>] (warn_slowpath_fmt) from [<80062838>] (lockdep_trace_alloc+0xe8/0x108)
r3:80831590 r2:8082e160
[<80062750>] (lockdep_trace_alloc) from [<800ea5dc>] (kmem_cache_alloc+0x28/0x134)
r5:000080d0 r4:be001f00
[<800ea5b4>] (kmem_cache_alloc) from [<8038d72c>] (regcache_rbtree_write+0x15c/0x648)
r10:00000000 r9:0000001c r8:00000004 r7:00000001 r6:00000000 r5:bd819a00
r4:00000000 r3:811aea88
[<8038d5d0>] (regcache_rbtree_write) from [<8038c4d8>] (regcache_write+0x5c/0x64)
r10:be3f9f88 r9:00000000 r8:00000004 r7:00000001 r6:00000000 r5:00000001
r4:bd819a00
[<8038c47c>] (regcache_write) from [<8038b0dc>] (_regmap_raw_write+0x134/0x5f4)
r6:be3f9f84 r5:00000001 r4:bd819a00 r3:00000001
[<8038afa8>] (_regmap_raw_write) from [<8038b610>] (_regmap_bus_raw_write+0x74/0x94)
r10:00000000 r9:00000001 r8:be3fb080 r7:bd819a00 r6:00000001 r5:00000000
r4:bd819a00
[<8038b59c>] (_regmap_bus_raw_write) from [<8038a8b4>] (_regmap_write+0x60/0x9c)
r6:00000001 r5:00000000 r4:bd819a00 r3:8038b59c
[<8038a854>] (_regmap_write) from [<8038ba24>] (regmap_write+0x48/0x68)
r7:bd81ad80 r6:00000001 r5:00000000 r4:bd819a00
[<8038b9dc>] (regmap_write) from [<80528f30>] (fsl_asrc_dai_probe+0x34/0x104)
r6:bd888628 r5:be3fb080 r4:be3b4410 r3:be3b442c
------------[ dump end ]------------
=============================================================================
2741 /*
2742 * Oi! Can't be having __GFP_FS allocations with IRQs disabled.
2743 */
2744 if (DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)))
2745 return;
=============================================================================
By looking at 2744 line, we can get that it's because regcache_rbtree_write()
would call kmalloc() with GFP flag if it couldn't find an existing block to
insert nodes while this kmalloc() call is inside a spin_lock_irq_save pair,
i.e. IRQs disabled.
Even though this may be a bug that should be fixed, I still try to send this
patch as a quick fix (work around) since it does no harm to assign default
values of every registers when using regcache.
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/fsl/fsl_asrc.c')
-rw-r--r-- | sound/soc/fsl/fsl_asrc.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 3b145313f93e..653dbaab83a6 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c | |||
@@ -684,12 +684,38 @@ static bool fsl_asrc_writeable_reg(struct device *dev, unsigned int reg) | |||
684 | } | 684 | } |
685 | } | 685 | } |
686 | 686 | ||
687 | static struct reg_default fsl_asrc_reg[] = { | ||
688 | { REG_ASRCTR, 0x0000 }, { REG_ASRIER, 0x0000 }, | ||
689 | { REG_ASRCNCR, 0x0000 }, { REG_ASRCFG, 0x0000 }, | ||
690 | { REG_ASRCSR, 0x0000 }, { REG_ASRCDR1, 0x0000 }, | ||
691 | { REG_ASRCDR2, 0x0000 }, { REG_ASRSTR, 0x0000 }, | ||
692 | { REG_ASRRA, 0x0000 }, { REG_ASRRB, 0x0000 }, | ||
693 | { REG_ASRRC, 0x0000 }, { REG_ASRPM1, 0x0000 }, | ||
694 | { REG_ASRPM2, 0x0000 }, { REG_ASRPM3, 0x0000 }, | ||
695 | { REG_ASRPM4, 0x0000 }, { REG_ASRPM5, 0x0000 }, | ||
696 | { REG_ASRTFR1, 0x0000 }, { REG_ASRCCR, 0x0000 }, | ||
697 | { REG_ASRDIA, 0x0000 }, { REG_ASRDOA, 0x0000 }, | ||
698 | { REG_ASRDIB, 0x0000 }, { REG_ASRDOB, 0x0000 }, | ||
699 | { REG_ASRDIC, 0x0000 }, { REG_ASRDOC, 0x0000 }, | ||
700 | { REG_ASRIDRHA, 0x0000 }, { REG_ASRIDRLA, 0x0000 }, | ||
701 | { REG_ASRIDRHB, 0x0000 }, { REG_ASRIDRLB, 0x0000 }, | ||
702 | { REG_ASRIDRHC, 0x0000 }, { REG_ASRIDRLC, 0x0000 }, | ||
703 | { REG_ASR76K, 0x0A47 }, { REG_ASR56K, 0x0DF3 }, | ||
704 | { REG_ASRMCRA, 0x0000 }, { REG_ASRFSTA, 0x0000 }, | ||
705 | { REG_ASRMCRB, 0x0000 }, { REG_ASRFSTB, 0x0000 }, | ||
706 | { REG_ASRMCRC, 0x0000 }, { REG_ASRFSTC, 0x0000 }, | ||
707 | { REG_ASRMCR1A, 0x0000 }, { REG_ASRMCR1B, 0x0000 }, | ||
708 | { REG_ASRMCR1C, 0x0000 }, | ||
709 | }; | ||
710 | |||
687 | static const struct regmap_config fsl_asrc_regmap_config = { | 711 | static const struct regmap_config fsl_asrc_regmap_config = { |
688 | .reg_bits = 32, | 712 | .reg_bits = 32, |
689 | .reg_stride = 4, | 713 | .reg_stride = 4, |
690 | .val_bits = 32, | 714 | .val_bits = 32, |
691 | 715 | ||
692 | .max_register = REG_ASRMCR1C, | 716 | .max_register = REG_ASRMCR1C, |
717 | .reg_defaults = fsl_asrc_reg, | ||
718 | .num_reg_defaults = ARRAY_SIZE(fsl_asrc_reg), | ||
693 | .readable_reg = fsl_asrc_readable_reg, | 719 | .readable_reg = fsl_asrc_readable_reg, |
694 | .volatile_reg = fsl_asrc_volatile_reg, | 720 | .volatile_reg = fsl_asrc_volatile_reg, |
695 | .writeable_reg = fsl_asrc_writeable_reg, | 721 | .writeable_reg = fsl_asrc_writeable_reg, |