/* * Apple Onboard Audio driver for Toonie codec * * Copyright 2006 Johannes Berg * * GPL v2, can be found in COPYING. * * * This is a driver for the toonie codec chip. This chip is present * on the Mac Mini and is nothing but a DAC. */ #include #include #include MODULE_AUTHOR("Johannes Berg "); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("toonie codec driver for snd-aoa"); #include "../aoa.h" #include "../soundbus/soundbus.h" #define PFX "snd-aoa-codec-toonie: " struct toonie { struct aoa_codec codec; }; #define codec_to_toonie(c) container_of(c, struct toonie, codec) static int toonie_dev_register(struct snd_device *dev) { return 0; } static struct snd_device_ops ops = { .dev_register = toonie_dev_register, }; static struct transfer_info toonie_transfers[] = { /* This thing *only* has analog output, * the rates are taken from Info.plist * from Darwin. */ { .formats = SNDRV_PCM_FMTBIT_S16_BE | SNDRV_PCM_FMTBIT_S24_BE, .rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000, }, {} }; static int toonie_usable(struct codec_info_item *cii, struct transfer_info *ti, struct transfer_info *out) { return 1; } #ifdef CONFIG_PM static int toonie_suspend(struct codec_info_item *cii, pm_message_t state) { /* can we turn it off somehow? */ return 0; } static int toonie_resume(struct codec_info_item *cii) { return 0; } #endif /* CONFIG_PM */ static struct codec_info toonie_codec_info = { .transfers = toonie_transfers, .sysclock_factor = 256, .bus_factor = 64, .owner = THIS_MODULE, .usable = toonie_usable, #ifdef CONFIG_PM .suspend = toonie_suspend, .resume = toonie_resume, #endif }; static int toonie_init_codec(struct aoa_codec *codec) { struct toonie *toonie = codec_to_toonie(codec); /* nothing connected? what a joke! */ if (toonie->codec.connected != 1) return -ENOTCONN; if (aoa_snd_device_new(SNDRV_DEV_CODEC, toonie, &ops)) { printk(KERN_ERR PFX "failed to create toonie snd device!\n"); return -ENODEV; } if (toonie->codec.soundbus_dev->attach_codec(toonie->codec.soundbus_dev, aoa_get_card(), &toonie_codec_info, toonie)) { printk(KERN_ERR PFX "error creating toonie pcm\n"); snd_device_free(aoa_get_card(), toonie); return -ENODEV; } return 0; } static void toonie_exit_codec(struct aoa_codec *codec) { struct toonie *toonie = codec_to_toonie(codec); if (!toonie->codec.soundbus_dev) { printk(KERN_ERR PFX "toonie_exit_codec called without soundbus_dev!\n"); return; } toonie->codec.soundbus_dev->detach_codec(toonie->codec.soundbus_dev, toonie); } static struct toonie *toonie; static int __init toonie_init(void) { toonie = kzalloc(sizeof(struct toonie), GFP_KERNEL); if (!toonie) return -ENOMEM; strlcpy(toonie->codec.name, "toonie", sizeof(toonie->codec.name)); toonie->codec.owner = THIS_MODULE; toonie->codec.init = toonie_init_codec; toonie->codec.exit = toonie_exit_codec; if (aoa_codec_register(&toonie->codec)) { kfree(toonie); return -EINVAL; } return 0; } static void __exit toonie_exit(void) { aoa_codec_unregister(&toonie->codec); kfree(toonie); } module_init(toonie_init); module_exit(toonie_exit); ='c8f325a59cfc718d13a50fbc746ed9b415c25e92'/>
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2017-02-01 17:45:02 +0000
committerIngo Molnar <mingo@kernel.org>2017-02-01 21:17:49 +0100
commitc8f325a59cfc718d13a50fbc746ed9b415c25e92 (patch)
treed53fbdac9d0781e39a13b2ac6b2bd258cf3b4140 /sound/soc/jz4740/Kconfig
parentbf29bddf0417a4783da3b24e8c9e017ac649326f (diff)
efi/fdt: Avoid FDT manipulation after ExitBootServices()
Some AArch64 UEFI implementations disable the MMU in ExitBootServices(), after which unaligned accesses to RAM are no longer supported. Commit: abfb7b686a3e ("efi/libstub/arm*: Pass latest memory map to the kernel") fixed an issue in the memory map handling of the stub FDT code, but inadvertently created an issue with such firmware, by moving some of the FDT manipulation to after the invocation of ExitBootServices(). Given that the stub's libfdt implementation uses the ordinary, accelerated string functions, which rely on hardware handling of unaligned accesses, manipulating the FDT with the MMU off may result in alignment faults. So fix the situation by moving the update_fdt_memmap() call into the callback function invoked by efi_exit_boot_services() right before it calls the ExitBootServices() UEFI service (which is arguably a better place for it anyway) Note that disabling the MMU in ExitBootServices() is not compliant with the UEFI spec, and carries great risk due to the fact that switching from cached to uncached memory accesses halfway through compiler generated code (i.e., involving a stack) can never be done in a way that is architecturally safe. Fixes: abfb7b686a3e ("efi/libstub/arm*: Pass latest memory map to the kernel") Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Riku Voipio <riku.voipio@linaro.org> Cc: <stable@vger.kernel.org> Cc: mark.rutland@arm.com Cc: linux-efi@vger.kernel.org Cc: matt@codeblueprint.co.uk Cc: leif.lindholm@linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1485971102-23330-2-git-send-email-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'sound/soc/jz4740/Kconfig')