/* * Copyright (c) 2010-2011,2013-2015 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * storm.c -- ALSA SoC machine driver for QTi ipq806x-based Storm board */ #include #include #include #include #include #include #include #include #define STORM_SYSCLK_MULT 4 static int storm_ops_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; struct snd_soc_card *card = soc_runtime->card; snd_pcm_format_t format = params_format(params); unsigned int rate = params_rate(params); unsigned int sysclk_freq; int bitwidth, ret; bitwidth = snd_pcm_format_width(format); if (bitwidth < 0) { dev_err(card->dev, "%s() invalid bit width given: %d\n", __func__, bitwidth); return bitwidth; } /* * as the CPU DAI is the I2S bus master and no system clock is needed by * the MAX98357a DAC, simply set the system clock to be a constant * multiple of the bit clock for the clock divider */ sysclk_freq = rate * bitwidth * 2 * STORM_SYSCLK_MULT; ret = snd_soc_dai_set_sysclk(soc_runtime->cpu_dai, 0, sysclk_freq, 0); if (ret) { dev_err(card->dev, "%s() error setting sysclk to %u: %d\n", __func__, sysclk_freq, ret); return ret; } return 0; } static const struct snd_soc_ops storm_soc_ops = { .hw_params = storm_ops_hw_params, }; static struct snd_soc_dai_link storm_dai_link = { .name = "Primary", .stream_name = "Primary", .codec_dai_name = "HiFi", .ops = &storm_soc_ops, }; static int storm_parse_of(struct snd_soc_card *card) { struct snd_soc_dai_link *dai_link = card->dai_link; struct device_node *np = card->dev->of_node; dai_link->cpu_of_node = of_parse_phandle(np, "cpu", 0); if (!dai_link->cpu_of_node) { dev_err(card->dev, "%s() error getting cpu phandle\n", __func__); return -EINVAL; } dai_link->platform_of_node = dai_link->cpu_of_node; dai_link->codec_of_node = of_parse_phandle(np, "codec", 0); if (!dai_link->codec_of_node) { dev_err(card->dev, "%s() error getting codec phandle\n", __func__); return -EINVAL; } return 0; } static int storm_platform_probe(struct platform_device *pdev) { struct snd_soc_card *card; int ret; card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL); if (!card) return -ENOMEM; card->dev = &pdev->dev; platform_set_drvdata(pdev, card); ret = snd_soc_of_parse_card_name(card, "qcom,model"); if (ret) { dev_err(&pdev->dev, "%s() error parsing card name: %d\n", __func__, ret); return ret; } card->dai_link = &storm_dai_link; card->num_links = 1; ret = storm_parse_of(card); if (ret) { dev_err(&pdev->dev, "%s() error resolving dai links: %d\n", __func__, ret); return ret; } ret = devm_snd_soc_register_card(&pdev->dev, card); if (ret) dev_err(&pdev->dev, "%s() error registering soundcard: %d\n", __func__, ret); return ret; } #ifdef CONFIG_OF static const struct of_device_id storm_device_id[] = { { .compatible = "google,storm-audio" }, {}, }; MODULE_DEVICE_TABLE(of, storm_device_id); #endif static struct platform_driver storm_platform_driver = { .driver = { .name = "storm-audio", .of_match_table = of_match_ptr(storm_device_id), }, .probe = storm_platform_probe, }; module_platform_driver(storm_platform_driver); MODULE_DESCRIPTION("QTi IPQ806x-based Storm Machine Driver"); MODULE_LICENSE("GPL v2"); value='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 /tools/testing/selftests/powerpc/tm/tm-signal-context-chk-vsx.c
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 'tools/testing/selftests/powerpc/tm/tm-signal-context-chk-vsx.c')