You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
freifunkist-firmware/target/linux/brcm2708/patches-4.14/950-0085-Add-support-for-Fe...

210 lines
6.4 KiB

brcm2708: add kernel 4.14 support Patch generation process: - rebase rpi/rpi-4.14.y on v4.14.89 from linux-stable - git format-patch v4.14.89 Patches skipped during rebase: - lan78xx: Read MAC address from DT if present - lan78xx: Enable LEDs and auto-negotiation - Revert "softirq: Let ksoftirqd do its job" - sc16is7xx: Fix for multi-channel stall - lan78xx: Ignore DT MAC address if already valid - lan78xx: Simple patch to prevent some crashes - tcp_write_queue_purge clears all the SKBs in the write queue - Revert "lan78xx: Simple patch to prevent some crashes" - lan78xx: Connect phy early - Arm: mm: ftrace: Only set text back to ro after kernel has been marked ro - Revert "Revert "softirq: Let ksoftirqd do its job"" - ASoC: cs4265: SOC_SINGLE register value error fix - Revert "ASoC: cs4265: SOC_SINGLE register value error fix" - Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends" - Revert "Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends"" Patches dropped after rebase: - net: Add non-mainline source for rtl8192cu wlan - net: Fix rtl8192cu build errors on other platforms - brcm: adds support for BCM43341 wifi - brcmfmac: Mute expected startup 'errors' - ARM64: Fix build break for RTL8187/RTL8192CU wifi - ARM64: Enable RTL8187/RTL8192CU wifi in build config - This is the driver for Sony CXD2880 DVB-T2/T tuner + demodulator - brcmfmac: add CLM download support - brcmfmac: request_firmware_direct is quieter - Sets the BCDC priority to constant 0 - brcmfmac: Disable ARP offloading when promiscuous - brcmfmac: Avoid possible out-of-bounds read - brcmfmac: Delete redundant length check - net: rtl8192cu: Normalize indentation - net: rtl8192cu: Fix implicit fallthrough warnings - Revert "Sets the BCDC priority to constant 0" - media: cxd2880: Bump to match 4.18.y version - media: cxd2880-spi: Bump to match 4.18.y version - Revert "mm: alloc_contig: re-allow CMA to compact FS pages" - Revert "Revert "mm: alloc_contig: re-allow CMA to compact FS pages"" - cxd2880: CXD2880_SPI_DRV should select DVB_CXD2880 with MEDIA_SUBDRV_AUTOSELECT - 950-0421-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch - 950-0453-Add-hid-bigbenff-to-list-of-have_special_driver-for-.patch Make I2C built-in instead of modular as in upstream defconfig; also the easiest way to get MFD_ARIZONA enabled, which is required by kmod-sound-soc-rpi-cirrus. Add missing compatible strings from 4.9/960-add-rasbperrypi-compatible.patch, using upstream names for compute modules. Add extra patch to enable the LEDs on lan78xx. Compile-tested: bcm2708, bcm2709, bcm2710 (with CONFIG_ALL_KMODS=y) Runtime-tested: bcm2708, bcm2710 Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
6 years ago
From 5ab1ef51caf57e4419bdc6fe1e59ea99dd54ce09 Mon Sep 17 00:00:00 2001
From: Fe-Pi <fe-pi@cox.net>
Date: Wed, 1 Mar 2017 04:42:43 -0700
Subject: [PATCH 085/454] Add support for Fe-Pi audio sound card. (#1867)
Fe-Pi Audio Sound Card is based on NXP SGTL5000 codec.
Mechanical specification of the board is the same the Raspberry Pi Zero.
3.5mm jacks for Headphone/Mic, Line In, and Line Out.
Signed-off-by: Henry Kupis <fe-pi@cox.net>
---
sound/soc/bcm/Kconfig | 7 ++
sound/soc/bcm/Makefile | 2 +
sound/soc/bcm/fe-pi-audio.c | 158 ++++++++++++++++++++++++++++++++++++
3 files changed, 167 insertions(+)
create mode 100644 sound/soc/bcm/fe-pi-audio.c
--- a/sound/soc/bcm/Kconfig
+++ b/sound/soc/bcm/Kconfig
@@ -162,6 +162,13 @@ config SND_BCM2708_SOC_ALLO_BOSS_DAC
help
Say Y or M if you want to add support for Allo Boss DAC.
+config SND_BCM2708_SOC_FE_PI_AUDIO
+ tristate "Support for Fe-Pi-Audio"
+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
+ select SND_SOC_SGTL5000
+ help
+ Say Y or M if you want to add support for Fe-Pi-Audio.
+
config SND_PISOUND
tristate "Support for Blokas Labs pisound"
depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
--- a/sound/soc/bcm/Makefile
+++ b/sound/soc/bcm/Makefile
@@ -30,6 +30,7 @@ snd-soc-allo-boss-dac-objs := allo-boss-
snd-soc-allo-piano-dac-objs := allo-piano-dac.o
snd-soc-allo-piano-dac-plus-objs := allo-piano-dac-plus.o
snd-soc-pisound-objs := pisound.o
+snd-soc-fe-pi-audio-objs := fe-pi-audio.o
obj-$(CONFIG_SND_BCM2708_SOC_ADAU1977_ADC) += snd-soc-adau1977-adc.o
obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP) += snd-soc-hifiberry-amp.o
@@ -52,3 +53,4 @@ obj-$(CONFIG_SND_BCM2708_SOC_ALLO_BOSS_D
obj-$(CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC) += snd-soc-allo-piano-dac.o
obj-$(CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC_PLUS) += snd-soc-allo-piano-dac-plus.o
obj-$(CONFIG_SND_PISOUND) += snd-soc-pisound.o
+obj-$(CONFIG_SND_BCM2708_SOC_FE_PI_AUDIO) += snd-soc-fe-pi-audio.o
--- /dev/null
+++ b/sound/soc/bcm/fe-pi-audio.c
@@ -0,0 +1,158 @@
+/*
+ * ASoC Driver for Fe-Pi Audio Sound Card
+ *
+ * Author: Henry Kupis <kuupaz@gmail.com>
+ * Copyright 2016
+ * based on code by Florian Meier <florian.meier@koalo.de>
+ * based on code by Shawn Guo <shawn.guo@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * 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.
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/jack.h>
+
+#include "../codecs/sgtl5000.h"
+
+static int snd_fe_pi_audio_init(struct snd_soc_pcm_runtime *rtd)
+{
+ struct snd_soc_card *card = rtd->card;
+ struct snd_soc_codec *codec = rtd->codec;
+
+ snd_soc_dapm_force_enable_pin(&card->dapm, "LO");
+ snd_soc_dapm_force_enable_pin(&card->dapm, "ADC");
+ snd_soc_dapm_force_enable_pin(&card->dapm, "DAC");
+ snd_soc_dapm_force_enable_pin(&card->dapm, "HP");
+ snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
+ SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP);
+
+ return 0;
+}
+
+static int snd_fe_pi_audio_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct device *dev = rtd->card->dev;
+ struct snd_soc_dai *codec_dai = rtd->codec_dai;
+
+ int ret;
+
+ /* Set SGTL5000's SYSCLK */
+ ret = snd_soc_dai_set_sysclk(codec_dai, SGTL5000_SYSCLK, 12288000, SND_SOC_CLOCK_IN);
+ if (ret) {
+ dev_err(dev, "could not set codec driver clock params\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+
+static struct snd_soc_ops snd_fe_pi_audio_ops = {
+ .hw_params = snd_fe_pi_audio_hw_params,
+};
+
+static struct snd_soc_dai_link snd_fe_pi_audio_dai[] = {
+ {
+ .name = "FE-PI",
+ .stream_name = "Fe-Pi HiFi",
+ .cpu_dai_name = "bcm2708-i2s.0",
+ .codec_dai_name = "sgtl5000",
+ .platform_name = "bcm2708-i2s.0",
+ .codec_name = "sgtl5000.1-000a",
+ .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+ SND_SOC_DAIFMT_CBM_CFM,
+ .ops = &snd_fe_pi_audio_ops,
+ .init = snd_fe_pi_audio_init,
+ },
+};
+
+static const struct snd_soc_dapm_route fe_pi_audio_dapm_routes[] = {
+ {"ADC", NULL, "Mic Bias"},
+};
+
+
+static struct snd_soc_card fe_pi_audio = {
+ .name = "Fe-Pi Audio",
+ .owner = THIS_MODULE,
+ .dai_link = snd_fe_pi_audio_dai,
+ .num_links = ARRAY_SIZE(snd_fe_pi_audio_dai),
+
+ .dapm_routes = fe_pi_audio_dapm_routes,
+ .num_dapm_routes = ARRAY_SIZE(fe_pi_audio_dapm_routes),
+};
+
+static int snd_fe_pi_audio_probe(struct platform_device *pdev)
+{
+ int ret = 0;
+ struct snd_soc_card *card = &fe_pi_audio;
+ struct device_node *np = pdev->dev.of_node;
+ struct device_node *i2s_node;
+ struct snd_soc_dai_link *dai = &snd_fe_pi_audio_dai[0];
+
+ fe_pi_audio.dev = &pdev->dev;
+
+ i2s_node = of_parse_phandle(np, "i2s-controller", 0);
+ if (!i2s_node) {
+ dev_err(&pdev->dev, "i2s_node phandle missing or invalid\n");
+ return -EINVAL;
+ }
+
+ dai->cpu_dai_name = NULL;
+ dai->cpu_of_node = i2s_node;
+ dai->platform_name = NULL;
+ dai->platform_of_node = i2s_node;
+
+ of_node_put(i2s_node);
+
+ card->dev = &pdev->dev;
+ platform_set_drvdata(pdev, card);
+
+ ret = snd_soc_register_card(card);
+ if (ret && ret != -EPROBE_DEFER)
+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret);
+
+ return ret;
+}
+
+static int snd_fe_pi_audio_remove(struct platform_device *pdev)
+{
+ return snd_soc_unregister_card(&fe_pi_audio);
+}
+
+static const struct of_device_id snd_fe_pi_audio_of_match[] = {
+ { .compatible = "fe-pi,fe-pi-audio", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, snd_fe_pi_audio_of_match);
+
+static struct platform_driver snd_fe_pi_audio_driver = {
+ .driver = {
+ .name = "snd-fe-pi-audio",
+ .owner = THIS_MODULE,
+ .of_match_table = snd_fe_pi_audio_of_match,
+ },
+ .probe = snd_fe_pi_audio_probe,
+ .remove = snd_fe_pi_audio_remove,
+};
+
+module_platform_driver(snd_fe_pi_audio_driver);
+
+MODULE_AUTHOR("Henry Kupis <fe-pi@cox.net>");
+MODULE_DESCRIPTION("ASoC Driver for Fe-Pi Audio");
+MODULE_LICENSE("GPL v2");