summaryrefslogtreecommitdiff
path: root/sound/pci/hda/hda_tegra.c
AgeCommit message (Collapse)AuthorFilesLines
2018-08-30Merge tag 'hda-codec-h-move' of ↵Takashi Iwai1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next ALSA: Move hda_codec.h to include/sound For easier sharing with ASoC.
2018-08-30ALSA: hda: move hda_codec.h to include/soundPierre-Louis Bossart1-1/+1
As suggested by Takashi, move this header file to make it easier to include from e.g. the Intel Skylake driver in follow-up patches Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-28ALSA: hda: Remove substream allocation/free opsTakashi Iwai1-17/+1
Since we dropped the memory page fiddling in the own allocators in hda_intel.c, the substream allocation and free ops in both hda_intel.c and hda_tegra.c became nothing but the simple calls of the standard snd_pcm_lib helpers. As both are identical, there is no longer need for indirect calls via ops; it's a good opportunity for removing ops and simplifying the codes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-06-22ALSA: hda/tegra: iomem fixups for sparse warningsBen Dooks1-10/+10
The readl/writel are not being passed __iomem annotated variables, so fix the following sparse warnings by adding __iomem in: sound/pci/hda/hda_tegra.c:120:9: warning: incorrect type in argument 2 (different address spaces) sound/pci/hda/hda_tegra.c:120:9: expected void volatile [noderef] <asn:2>*addr sound/pci/hda/hda_tegra.c:120:9: got unsigned int [usertype] *addr sound/pci/hda/hda_tegra.c:125:16: warning: incorrect type in argument 1 (different address spaces) sound/pci/hda/hda_tegra.c:125:16: expected void const volatile [noderef] <asn:2>*addr sound/pci/hda/hda_tegra.c:125:16: got unsigned int [usertype] *addr sound/pci/hda/hda_tegra.c:134:13: warning: incorrect type in argument 1 (different address spaces) sound/pci/hda/hda_tegra.c:134:13: expected void const volatile [noderef] <asn:2>*addr sound/pci/hda/hda_tegra.c:134:13: got void *dword_addr sound/pci/hda/hda_tegra.c:137:9: warning: incorrect type in argument 2 (different address spaces) sound/pci/hda/hda_tegra.c:137:9: expected void volatile [noderef] <asn:2>*addr sound/pci/hda/hda_tegra.c:137:9: got void *dword_addr sound/pci/hda/hda_tegra.c:146:13: warning: incorrect type in argument 1 (different address spaces) sound/pci/hda/hda_tegra.c:146:13: expected void const volatile [noderef] <asn:2>*addr sound/pci/hda/hda_tegra.c:146:13: got void *dword_addr sound/pci/hda/hda_tegra.c:156:13: warning: incorrect type in argument 1 (different address spaces) sound/pci/hda/hda_tegra.c:156:13: expected void const volatile [noderef] <asn:2>*addr sound/pci/hda/hda_tegra.c:156:13: got void *dword_addr sound/pci/hda/hda_tegra.c:159:9: warning: incorrect type in argument 2 (different address spaces) sound/pci/hda/hda_tegra.c:159:9: expected void volatile [noderef] <asn:2>*addr sound/pci/hda/hda_tegra.c:159:9: got void *dword_addr sound/pci/hda/hda_tegra.c:168:13: warning: incorrect type in argument 1 (different address spaces) sound/pci/hda/hda_tegra.c:168:13: expected void const volatile [noderef] <asn:2>*addr sound/pci/hda/hda_tegra.c:168:13: got void *dword_addr sound/pci/hda/hda_tegra.c:173:23: warning: incorrect type in initializer (incompatible argument 2 (different address spaces)) sound/pci/hda/hda_tegra.c:173:23: expected void ( *reg_writel )( ... ) sound/pci/hda/hda_tegra.c:173:23: got void ( static [toplevel] *<noident> )( ... ) sound/pci/hda/hda_tegra.c:174:22: warning: incorrect type in initializer (incompatible argument 1 (different address spaces)) sound/pci/hda/hda_tegra.c:174:22: expected unsigned int ( *reg_readl )( ... ) sound/pci/hda/hda_tegra.c:174:22: got unsigned int ( static [toplevel] *<noident> )( ... ) sound/pci/hda/hda_tegra.c:175:23: warning: incorrect type in initializer (incompatible argument 2 (different address spaces)) sound/pci/hda/hda_tegra.c:175:23: expected void ( *reg_writew )( ... ) sound/pci/hda/hda_tegra.c:175:23: got void ( static [toplevel] *<noident> )( ... ) sound/pci/hda/hda_tegra.c:176:22: warning: incorrect type in initializer (incompatible argument 1 (different address spaces)) sound/pci/hda/hda_tegra.c:176:22: expected unsigned short ( *reg_readw )( ... ) sound/pci/hda/hda_tegra.c:176:22: got unsigned short ( static [toplevel] *<noident> )( ... ) sound/pci/hda/hda_tegra.c:177:23: warning: incorrect type in initializer (incompatible argument 2 (different address spaces)) sound/pci/hda/hda_tegra.c:177:23: expected void ( *reg_writeb )( ... ) sound/pci/hda/hda_tegra.c:177:23: got void ( static [toplevel] *<noident> )( ... ) sound/pci/hda/hda_tegra.c:178:22: warning: incorrect type in initializer (incompatible argument 1 (different address spaces)) sound/pci/hda/hda_tegra.c:178:22: expected unsigned char ( *reg_readb )( ... ) sound/pci/hda/hda_tegra.c:178:22: got unsigned char ( static [toplevel] *<noident> )( ... ) Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-12-17ALSA: hda - Raise AZX_DCAPS_RIRB_DELAY handling into top driversTakashi Iwai1-2/+3
AZX_DCAPS_RIRB_DELAY is dedicated only for Nvidia and its purpose is just to set a flag in bus. So it's better to be set in the toplevel driver, either hda_intel.c or hda_tegra.c, instead of the common hda_controller.c. This also allows us to strip this flag from dcaps, so save one more bit there. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-24ALSA: hda/tegra - async probe for avoiding module loading deadlockTakashi Iwai1-5/+25
The Tegra HD-audio controller driver causes deadlocks when loaded as a module since the driver invokes request_module() at binding with the codec driver. This patch works around it by deferring the probe in a work like Intel HD-audio controller driver does. Although hovering the codec probe stuff into udev would be a better solution, it may cause other regressions, so let's try this band-aid fix until the more proper solution gets landed. Reported-by: Thierry Reding <treding@nvidia.com> Tested-by: Thierry Reding <treding@nvidia.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18ALSA: hda/tegra - Improve error reportingThierry Reding1-6/+19
When probing, provide accurate error messages to help with debugging failures. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-18ALSA: hda/tegra - Set CORBRP self-clear flagThierry Reding1-1/+2
This is set for the MCP variants of the NVIDIA HDA controller, which the Tegra variant was derived from. This fixes the following warning at boot time: [ 2.486610] tegra-hda 70030000.hda: CORB reset timeout#1, CORBRP = 0 Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-05ALSA: hda/tegra - Fix oopsThierry Reding1-4/+4
Commit a41d122449be ("ALSA: hda - Embed bus into controller object") introduced a regression in the Tegra HDA driver that causes the following oops during boot: [ 2.333458] Unable to handle kernel NULL pointer dereference at virtual address 000004c4 [ 2.341537] pgd = c0004000 [ 2.344312] [000004c4] *pgd=00000000 [ 2.347898] Internal error: Oops: 5 [#1] PREEMPT SMP ARM [ 2.353200] Modules linked in: [ 2.356264] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 4.1.0-rc2-next-20150505-00344-g8577890defbf #79 [ 2.366682] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree) [ 2.372939] task: ee0d8b40 ti: ee0da000 task.ti: ee0da000 [ 2.378336] PC is at azx_bus_init+0x18/0xf4 [ 2.382516] LR is at hda_tegra_probe+0x6c/0x478 [ 2.387043] pc : [<c06156c4>] lr : [<c061cf00>] psr: 60000113 [ 2.387043] sp : ee0dbe38 ip : 00000000 fp : 00000000 [ 2.398501] r10: ed874c00 r9 : 000000fd r8 : 00000000 [ 2.403717] r7 : ed874c10 r6 : 00000000 r5 : 00000000 r4 : ed016810 [ 2.410232] r3 : c08a2ad4 r2 : c08a1ea0 r1 : 00000000 r0 : ed016810 [ 2.416750] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel [ 2.424046] Control: 10c5387d Table: 8000406a DAC: 00000015 [ 2.429783] Process swapper/0 (pid: 1, stack limit = 0xee0da210) [ 2.435778] Stack: (0xee0dbe38 to 0xee0dc000) [ 2.440129] be20: 00000000 ed016810 [ 2.448297] be40: 00000000 c061cf00 00000000 ee0dbe5c ed8735d0 c0a7bc48 ed02fd50 ed016000 [ 2.456462] be60: c1250164 ed874c10 c0c66bf8 fffffdfb 00000000 000000fd c0b8dc98 c046664c [ 2.464628] be80: c0466608 c1250164 ed874c10 00000000 c0c66bf8 c0464eb4 ed874c10 c0c66bf8 [ 2.472793] bea0: ed874c44 c0c43458 00000000 c04650d0 00000000 c0c66bf8 c046503c c04633b4 [ 2.480959] bec0: ee11bea4 ed85f390 c0c66bf8 ed017ac0 00000000 c0464634 c0ab2b7c c0c66bf8 [ 2.489125] bee0: c0bfde20 c0c66bf8 c0bfde20 ed01ce40 c0b7b414 c04656e8 c04665b0 c0bfde20 [ 2.497291] bf00: c0bfde20 c0009770 ee0d8b40 c0c02488 60000113 00000000 00000000 00000003 [ 2.505458] bf20: 00000000 c0c02488 60000113 00000000 c0b54598 c0b16a90 ef7fcc57 c0041228 [ 2.513624] bf40: c0a9150c ef7fcc5f 00000006 00000006 00000000 c0bf1fa8 c0bf2354 00000006 [ 2.521790] bf60: c0b8dc90 c0c7c000 c0c7c000 c0b8dc98 00000000 c0b54dd8 00000006 00000006 [ 2.529956] bf80: c0b54598 00000000 00000000 c07ff08c 00000000 00000000 00000000 00000000 [ 2.538122] bfa0: 00000000 c07ff094 00000000 c000f5a0 00000000 00000000 00000000 00000000 [ 2.546286] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 2.554451] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 fffff7ff c013f264 [ 2.562624] [<c06156c4>] (azx_bus_init) from [<c061cf00>] (hda_tegra_probe+0x6c/0x478) [ 2.570535] [<c061cf00>] (hda_tegra_probe) from [<c046664c>] (platform_drv_probe+0x44/0xa4) [ 2.578879] [<c046664c>] (platform_drv_probe) from [<c0464eb4>] (driver_probe_device+0x174/0x2b8) [ 2.587739] [<c0464eb4>] (driver_probe_device) from [<c04650d0>] (__driver_attach+0x94/0x98) [ 2.596172] [<c04650d0>] (__driver_attach) from [<c04633b4>] (bus_for_each_dev+0x6c/0xa0) [ 2.604342] [<c04633b4>] (bus_for_each_dev) from [<c0464634>] (bus_add_driver+0x148/0x1f0) [ 2.612597] [<c0464634>] (bus_add_driver) from [<c04656e8>] (driver_register+0x78/0xf8) [ 2.620593] [<c04656e8>] (driver_register) from [<c0009770>] (do_one_initcall+0x8c/0x1d4) [ 2.628765] [<c0009770>] (do_one_initcall) from [<c0b54dd8>] (kernel_init_freeable+0x144/0x1e4) [ 2.637459] [<c0b54dd8>] (kernel_init_freeable) from [<c07ff094>] (kernel_init+0x8/0xe8) [ 2.645543] [<c07ff094>] (kernel_init) from [<c000f5a0>] (ret_from_fork+0x14/0x34) This is caused by azx_bus_init() trying to dereference chip->card, which for the Tegra driver doesn't get initialized until sometime later during the call to hda_tegra_create(). Fix this by mimicking the behaviour of the Intel driver and defer HDA bus initialization until right before the call to snd_device_new(). Fixes: a41d122449be ('ALSA: hda - Embed bus into controller object') Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16ALSA: hda/tegra - Fix build error and warningTakashi Iwai1-3/+1
I seem to have failed to run the build test properly... sound/pci/hda/hda_tegra.c: In function 'hda_tegra_dev_free': sound/pci/hda/hda_tegra.c:310:20: error: 'bus' undeclared (first use in this function) snd_hdac_bus_exit(bus); Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16ALSA: hda - Minor refactoringTakashi Iwai1-3/+0
Move the small portion of the common sequence in hda_intel.c and hda_tegra.c into hda_controller.c. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16ALSA: hda - Embed bus into controller objectTakashi Iwai1-16/+27
... and replace with the existing hda-core helper codes. This reduces lots of lines, finally. Since struct hda_bus is now embedded into struct azx, snd_hda_bus_new() is moved and expanded from hda_codec.c to hda_controller.c, accordingly. Also private_free bus ops and private_data field are removed because we no longer need to point azx object from bus (we can use container_of()) The spin locks are consolidated into the single one, bus->reg_lock. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16ALSA: hda - Migrate more hdac_stream codesTakashi Iwai1-0/+1
... including dsp loader helpers. Lots of codes removed. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16ALSA: hda - Migrate hdac_stream into legacy driverTakashi Iwai1-10/+4
Embed hdac_stream object into azx_dev, and use a few basic helper functions. The most of helper codes for hdac_stream aren't still used yet. Also this commit disables the tracepoints temporarily due to build problems. It'll be enabled again later. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-16ALSA: hda - Pass bus io_ops directly from the top-level driverTakashi Iwai1-11/+14
One less redirection again. This also requires the change of the call order in the toplevel divers. Namely, the bus has to be created at first before other initializations since the memory allocation ops are called through bus object now. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-13ALSA: hda - Use shutdown driver ops instead of reboot notifierTakashi Iwai1-3/+13
The driver shutdown ops is simpler than registering reboot notifier manually. There should be no functional change by this -- the codec driver calls its own callback while the bus driver just calls azx_stop() like before. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-03-03ALSA: hda - Build PCMs and controls at codec driver probeTakashi Iwai1-10/+0
This makes the code flow easier -- instead of the controller driver calling snd_hda_build_pcms() and snd_hda_build_controls() explicitly, the codec driver itself builds PCMs and controls at probe time. Then the controller driver only needs to call snd_card_register(). Also, this allows us the full bind/unbind control, too. Even when a codec driver is bound later, it automatically registers the new PCM and controls by itself. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-26ALSA: hda - Power down codec automatically at registrationTakashi Iwai1-12/+0
So far, we let the controller driver power down the all codecs at the end of probe. But this can be done better in the codec's dev_register callback. This results in the reduction of duplicated codes in each control driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-26ALSA: hda - Drop power_save value indirection in hda_busTakashi Iwai1-2/+3
We used to pass the power_save option value to hda_bus via a given pointer. This was needed to refer to the value from the HD-audio core side. However, after the transition to the runtime PM, this is no longer needed. This patch drops the power_save value indirection in hda_bus above, and let the controller driver reprograms the autosuspend value explicitly by a new helper, snd_hda_set_power_save(). Without this call, the HD-audio core doesn't set up the autosuspend and flip the runtime PM. (User may still be able to set up via sysfs, though.) Along with this change, the pointer argument of azx_bus_create() is dropped as well. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-23ALSA: hda - Move codec suspend/resume to codec driverTakashi Iwai1-6/+0
This patch moves the suspend/resume mechanisms down to each codec driver level, as we have a proper codec driver bound on the bus now. Then we get the asynchronous PM gratis without fiddling much in the driver level. As a soft-landing transition, implement the common suspend/resume pm ops for hda_codec_driver and keep the each codec driver intact. Only the callers of suspend/resume in the controller side (azx_suspend() and azx_resume()) are removed. Another involved place is azx_bus_reset() calling the temporary suspend and resume as a hackish method of bus reset. The HD-audio core provide a helper function snd_hda_bus_reset() instead. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-19ALSA: hda - Split azx_codec_create() to two phasesTakashi Iwai1-1/+5
azx_create_codec() function does actually two things: create a bus and probe codecs. For the future work, split this to two logical functions, azx_bus_create() and azx_probe_codecs(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-19ALSA: hda - Drop azx_mixer_create()Takashi Iwai1-1/+1
It's just an indirection, so let the caller directly calling snd_hda_build_controls(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-19ALSA: hda - Fold hda_priv.h into hda_controller.hTakashi Iwai1-1/+0
There is no big reason to keep them separately. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-02-14ALSA: hda/tegra check correct return value from ioremap_resourceEliot Blennerhassett1-2/+2
Signed-off-by: Eliot Blennerhassett <eliot@blennerhassett.gen.nz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-15Merge branch 'for-linus' into for-nextTakashi Iwai1-1/+1
Since init_failed flag was moved to struct hda_intel, its access in the commit [4da63c6f: ALSA: hda - Fix broken PM due to incomplete i915 initialization] is also replaced with hda->init_failed appropriately.
2014-07-07ALSA: hda: Fix build warningThierry Reding1-1/+1
The hda_tegra_disable_clocks() function is only used by the suspend and resume code, so it needs to be included in the #ifdef CONFIG_PM_SLEEP block to prevent the following warning: CC sound/pci/hda/hda_tegra.o sound/pci/hda/hda_tegra.c:238:13: warning: 'hda_tegra_disable_clocks' defined but not used [-Wunused-function] static void hda_tegra_disable_clocks(struct hda_tegra *data) ^ Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-01ALSA: hda: Remove unused variableSachin Kamat1-4/+0
'status' is not used in the function. Remove it. Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com> Tested-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-07-01ALSA: hda - Fix build error in hda_tegra.cTakashi Iwai1-1/+0
The "list" field has been omitted from struct azx, but its initialization remained mistakenly in hda_tegra.c, which leads to a compile error: sound/pci/hda/hda_tegra.c: In function 'hda_tegra_create': sound/pci/hda/hda_tegra.c:481:22: error: 'struct azx' has no member named 'list' Reported-by: kbuild test robot <fengguang.wu@intel.com> Fixes: 9a34af4a3327 ('ALSA: hda - Move more PCI-controller-specific stuff from generic code') Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-06-26ALSA: hda - Use common reboot notifierTakashi Iwai1-27/+2
The very same notifier code is used in both hda_intel.c and hda_tegra.c. Move it to the generic code. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-06-26ALSA: hda - Make position_fix as generic callbackTakashi Iwai1-2/+0
... and move most parts into hda_intel.c from the generic controller code. This is a clean up, and there should be no functional change by this patch. Now, struct azx obtains the generic callbacks for getting the position and the delay. As default NULL, posbuf is read. These replace the old position_fix[], and each is implemented as a callback. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-27ALSA: hda: fix tegra buildArnd Bergmann1-0/+4
When CONFIG_PM is disabled, the CONFIG_SND_HDA_POWER_SAVE_DEFAULT symbol does not get defined, which causes a build error for the hda-tegra driver: hda/hda_tegra.c:80:25: error: 'CONFIG_SND_HDA_POWER_SAVE_DEFAULT' undeclared here (not in a function) static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; ^ /git/arm-soc/sound/pci/hda/hda_tegra.c:235:13: warning: 'hda_tegra_disable_clocks' defined but not used [-Wunused-function] static void hda_tegra_disable_clocks(struct hda_tegra *data) ^ This works around the problem by not referencing that macro when CONFIG_PM is disabled. Instead, we assume that it's disabled unconditionally and cannot be enabled at runtime. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Dylan Reid <dgreid@chromium.org> Cc: Stephen Warren <swarren@nvidia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-20ALSA: hda/tegra - Fix MODULE_DEVICE_TABLE typo.Dylan Reid1-1/+1
I missed a rename during the review process. Fix the MODULE_DEVICE_TABLE to match the structure. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-20ALSA: hda - Add driver for Tegra SoC HDADylan Reid1-0/+584
This adds a driver for the HDA block in Tegra SoCs. The HDA bus is used to communicate with the HDMI codec on Tegra124. Most of the code is re-used from the Intel/PCI HDA driver. It brings over only two of the module params, power_save and probe_mask. Signed-off-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>