#ifndef __ADAU17X1_H__ #define __ADAU17X1_H__ #include #include #include "sigmadsp.h" enum adau17x1_type { ADAU1361, ADAU1761, ADAU1381, ADAU1781, }; enum adau17x1_pll { ADAU17X1_PLL, }; enum adau17x1_pll_src { ADAU17X1_PLL_SRC_MCLK, }; enum adau17x1_clk_src { /* Automatically configure PLL based on the sample rate */ ADAU17X1_CLK_SRC_PLL_AUTO, ADAU17X1_CLK_SRC_MCLK, ADAU17X1_CLK_SRC_PLL, }; struct clk; struct adau { unsigned int sysclk; unsigned int pll_freq; struct clk *mclk; enum adau17x1_clk_src clk_src; enum adau17x1_type type; void (*switch_mode)(struct device *dev); unsigned int dai_fmt; uint8_t pll_regs[6]; bool master; unsigned int tdm_slot[2]; bool dsp_bypass[2]; struct regmap *regmap; struct sigmadsp *sigmadsp; }; int adau17x1_add_widgets(struct snd_soc_codec *codec); int adau17x1_add_routes(struct snd_soc_codec *codec); int adau17x1_probe(struct device *dev, struct regmap *regmap, enum adau17x1_type type, void (*switch_mode)(struct device *dev), const char *firmware_name); void adau17x1_remove(struct device *dev); int adau17x1_set_micbias_voltage(struct snd_soc_codec *codec, enum adau17x1_micbias_voltage micbias); bool adau17x1_readable_register(struct device *dev, unsigned int reg); bool adau17x1_volatile_register(struct device *dev, unsigned int reg); bool adau17x1_precious_register(struct device *dev, unsigned int reg); int adau17x1_resume(struct snd_soc_codec *codec); extern const struct snd_soc_dai_ops adau17x1_dai_ops; int adau17x1_setup_firmware(struct adau *adau, unsigned int rate); bool adau17x1_has_dsp(struct adau *adau); #define ADAU17X1_CLOCK_CONTROL 0x4000 #define ADAU17X1_PLL_CONTROL 0x4002 #define ADAU17X1_REC_POWER_MGMT 0x4009 #define ADAU17X1_MICBIAS 0x4010 #define ADAU17X1_SERIAL_PORT0 0x4015 #define ADAU17X1_SERIAL_PORT1 0x4016 #define ADAU17X1_CONVERTER0 0x4017 #define ADAU17X1_CONVERTER1 0x4018 #define ADAU17X1_LEFT_INPUT_DIGITAL_VOL 0x401a #define ADAU17X1_RIGHT_INPUT_DIGITAL_VOL 0x401b #define ADAU17X1_ADC_CONTROL 0x4019 #define ADAU17X1_PLAY_POWER_MGMT 0x4029 #define ADAU17X1_DAC_CONTROL0 0x402a #define ADAU17X1_DAC_CONTROL1 0x402b #define ADAU17X1_DAC_CONTROL2 0x402c #define ADAU17X1_SERIAL_PORT_PAD 0x402d #define ADAU17X1_CONTROL_PORT_PAD0 0x402f #define ADAU17X1_CONTROL_PORT_PAD1 0x4030 #define ADAU17X1_DSP_SAMPLING_RATE 0x40eb #define ADAU17X1_SERIAL_INPUT_ROUTE 0x40f2 #define ADAU17X1_SERIAL_OUTPUT_ROUTE 0x40f3 #define ADAU17X1_DSP_ENABLE 0x40f5 #define ADAU17X1_DSP_RUN 0x40f6 #define ADAU17X1_SERIAL_SAMPLING_RATE 0x40f8 #define ADAU17X1_SERIAL_PORT0_BCLK_POL BIT(4) #define ADAU17X1_SERIAL_PORT0_LRCLK_POL BIT(3) #define ADAU17X1_SERIAL_PORT0_MASTER BIT(0) #define ADAU17X1_SERIAL_PORT1_DELAY1 0x00 #define ADAU17X1_SERIAL_PORT1_DELAY0 0x01 #define ADAU17X1_SERIAL_PORT1_DELAY8 0x02 #define ADAU17X1_SERIAL_PORT1_DELAY16 0x03 #define ADAU17X1_SERIAL_PORT1_DELAY_MASK 0x03 #define ADAU17X1_CLOCK_CONTROL_INFREQ_MASK 0x6 #define ADAU17X1_CLOCK_CONTROL_CORECLK_SRC_PLL BIT(3) #define ADAU17X1_CLOCK_CONTROL_SYSCLK_EN BIT(0) #define ADAU17X1_SERIAL_PORT1_BCLK64 (0x0 << 5) #define ADAU17X1_SERIAL_PORT1_BCLK32 (0x1 << 5) #define ADAU17X1_SERIAL_PORT1_BCLK48 (0x2 << 5) #define ADAU17X1_SERIAL_PORT1_BCLK128 (0x3 << 5) #define ADAU17X1_SERIAL_PORT1_BCLK256 (0x4 << 5) #define ADAU17X1_SERIAL_PORT1_BCLK_MASK (0x7 << 5) #define ADAU17X1_SERIAL_PORT0_STEREO (0x0 << 1) #define ADAU17X1_SERIAL_PORT0_TDM4 (0x1 << 1) #define ADAU17X1_SERIAL_PORT0_TDM8 (0x2 << 1) #define ADAU17X1_SERIAL_PORT0_TDM_MASK (0x3 << 1) #define ADAU17X1_SERIAL_PORT0_PULSE_MODE BIT(5) #define ADAU17X1_CONVERTER0_DAC_PAIR(x) (((x) - 1) << 5) #define ADAU17X1_CONVERTER0_DAC_PAIR_MASK (0x3 << 5) #define ADAU17X1_CONVERTER1_ADC_PAIR(x) ((x) - 1) #define ADAU17X1_CONVERTER1_ADC_PAIR_MASK 0x3 #define ADAU17X1_CONVERTER0_CONVSR_MASK 0x7 #endif '6'>6space:mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-29 13:50:06 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-29 13:50:06 -0800
commit39cb2c9a316e77f6dfba96c543e55b6672d5a37e (patch)
tree98fe974ee4e20121253de7f61fc8d01bdb3821c1 /sound/pci/echoaudio
parent2c5d9555d6d937966d79d4c6529a5f7b9206e405 (diff)
drm/i915: Check for NULL i915_vma in intel_unpin_fb_obj()
I've seen this trigger twice now, where the i915_gem_object_to_ggtt() call in intel_unpin_fb_obj() returns NULL, resulting in an oops immediately afterwards as the (inlined) call to i915_vma_unpin_fence() tries to dereference it. It seems to be some race condition where the object is going away at shutdown time, since both times happened when shutting down the X server. The call chains were different: - VT ioctl(KDSETMODE, KD_TEXT): intel_cleanup_plane_fb+0x5b/0xa0 [i915] drm_atomic_helper_cleanup_planes+0x6f/0x90 [drm_kms_helper] intel_atomic_commit_tail+0x749/0xfe0 [i915] intel_atomic_commit+0x3cb/0x4f0 [i915] drm_atomic_commit+0x4b/0x50 [drm] restore_fbdev_mode+0x14c/0x2a0 [drm_kms_helper] drm_fb_helper_restore_fbdev_mode_unlocked+0x34/0x80 [drm_kms_helper] drm_fb_helper_set_par+0x2d/0x60 [drm_kms_helper] intel_fbdev_set_par+0x18/0x70 [i915] fb_set_var+0x236/0x460 fbcon_blank+0x30f/0x350 do_unblank_screen+0xd2/0x1a0 vt_ioctl+0x507/0x12a0 tty_ioctl+0x355/0xc30 do_vfs_ioctl+0xa3/0x5e0 SyS_ioctl+0x79/0x90 entry_SYSCALL_64_fastpath+0x13/0x94 - i915 unpin_work workqueue: intel_unpin_work_fn+0x58/0x140 [i915] process_one_work+0x1f1/0x480 worker_thread+0x48/0x4d0 kthread+0x101/0x140 and this patch purely papers over the issue by adding a NULL pointer check and a WARN_ON_ONCE() to avoid the oops that would then generally make the machine unresponsive. Other callers of i915_gem_object_to_ggtt() seem to also check for the returned pointer being NULL and warn about it, so this clearly has happened before in other places. [ Reported it originally to the i915 developers on Jan 8, applying the ugly workaround on my own now after triggering the problem for the second time with no feedback. This is likely to be the same bug reported as https://bugs.freedesktop.org/show_bug.cgi?id=98829 https://bugs.freedesktop.org/show_bug.cgi?id=99134 which has a patch for the underlying problem, but it hasn't gotten to me, so I'm applying the workaround. ] Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Imre Deak <imre.deak@intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'sound/pci/echoaudio')
back.sh: timeout works ./fw_fallback.sh: firmware comparison works ./fw_fallback.sh: fallback mechanism works [ this then sits here when it is trying the cancellation test ] Kernel log: test_firmware: loading 'nope-test-firmware.bin' misc test_firmware: Direct firmware load for nope-test-firmware.bin failed with error -2 misc test_firmware: Falling back to user helper BUG: unable to handle kernel NULL pointer dereference at 0000000000000038 IP: _request_firmware+0xa27/0xad0 PGD 0 Oops: 0000 [#1] SMP Modules linked in: test_firmware(E) ... etc ... CPU: 1 PID: 1396 Comm: fw_fallback.sh Tainted: G W E 4.10.0-rc3-next-20170111+ #30 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.10.1-0-g8891697-prebuilt.qemu-project.org 04/01/2014 task: ffff9740b27f4340 task.stack: ffffbb15c0bc8000 RIP: 0010:_request_firmware+0xa27/0xad0 RSP: 0018:ffffbb15c0bcbd10 EFLAGS: 00010246 RAX: 00000000fffffffe RBX: ffff9740afe5aa80 RCX: 0000000000000000 RDX: ffff9740b27f4340 RSI: 0000000000000283 RDI: 0000000000000000 RBP: ffffbb15c0bcbd90 R08: ffffbb15c0bcbcd8 R09: 0000000000000000 R10: 0000000894a0d4b1 R11: 000000000000008c R12: ffffffffc0312480 R13: 0000000000000005 R14: ffff9740b1c32400 R15: 00000000000003e8 FS: 00007f8604422700(0000) GS:ffff9740bfc80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000038 CR3: 000000012164c000 CR4: 00000000000006e0 Call Trace: request_firmware+0x37/0x50 trigger_request_store+0x79/0xd0 [test_firmware] dev_attr_store+0x18/0x30 sysfs_kf_write+0x37/0x40 kernfs_fop_write+0x110/0x1a0 __vfs_write+0x37/0x160 ? _cond_resched+0x1a/0x50 vfs_write+0xb5/0x1a0 SyS_write+0x55/0xc0 ? trace_do_page_fault+0x37/0xd0 entry_SYSCALL_64_fastpath+0x1e/0xad RIP: 0033:0x7f8603f49620 RSP: 002b:00007fff6287b788 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 000055c307b110a0 RCX: 00007f8603f49620 RDX: 0000000000000016 RSI: 000055c3084d8a90 RDI: 0000000000000001 RBP: 0000000000000016 R08: 000000000000c0ff R09: 000055c3084d6336 R10: 000055c307b108b0 R11: 0000000000000246 R12: 000055c307b13c80 R13: 000055c3084d6320 R14: 0000000000000000 R15: 00007fff6287b950 Code: 9f 64 84 e8 9c 61 fe ff b8 f4 ff ff ff e9 6b f9 ff ff 48 c7 c7 40 6b 8d 84 89 45 a8 e8 43 84 18 00 49 8b be 00 03 00 00 8b 45 a8 <83> 7f 38 02 74 08 e8 6e ec ff ff 8b 45 a8 49 c7 86 00 03 00 00 RIP: _request_firmware+0xa27/0xad0 RSP: ffffbb15c0bcbd10 CR2: 0000000000000038 ---[ end trace 6d94ac339c133e6f ]--- Fixes: 5d47ec02c37e ("firmware: Correct handling of fw_state_wait() return value") Reported-and-Tested-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reported-and-Tested-by: Patrick Bruenn <p.bruenn@beckhoff.com> Reported-by: Chris Wilson <chris@chris-wilson.co.uk> CC: <stable@vger.kernel.org> [3.10+] Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/spi/Makefile')