Changes in 4.9.331 uas: add no-uas quirk for Hiksemi usb_disk usb-storage: Add Hiksemi USB3-FW to IGNORE_UAS uas: ignore UAS for Thinkplus chips net: usb: qmi_wwan: Add new usb-id for Dell branded EM7455 ntfs: fix BUG_ON in ntfs_lookup_inode_by_name() mmc: moxart: fix 4-bit bus width and remove 8-bit bus width mm: prevent page_frag_alloc() from corrupting the memory Revert "drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time" Input: melfas_mip4 - fix return value check in mip4_probe() usbnet: Fix memory leak in usbnet_disconnect() nvme: add new line after variable declatation nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices selftests: Fix the if conditions of in test_extra_filter() clk: iproc: Minor tidy up of iproc pll data structures clk: iproc: Do not rely on node name for correct PLL setup Makefile.extrawarn: Move -Wcast-function-type-strict to W=1 ARM: fix function graph tracer and unwinder dependencies fs: fix UAF/GPF bug in nilfs_mdt_destroy dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure ARM: dts: fix Moxa SDIO 'compatible', remove 'sdhci' misnomer net/ieee802154: fix uninit value bug in dgram_sendmsg um: Cleanup syscall_handler_t cast in syscalls_32.h um: Cleanup compiler warning in arch/x86/um/tls_32.c usb: mon: make mmapped memory read only USB: serial: ftdi_sio: fix 300 bps rate for SIO nilfs2: fix NULL pointer dereference at nilfs_bmap_lookup_at_level() nilfs2: fix leak of nilfs_root in case of writer thread creation failure nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure ceph: don't truncate file in atomic_open random: clamp credited irq bits to maximum mixed ALSA: hda: Fix position reporting on Poulsbo scsi: stex: Properly zero out the passthrough command structure USB: serial: qcserial: add new usb-id for Dell branded EM7455 random: avoid reading two cache lines on irq randomness wifi: mac80211_hwsim: avoid mac80211 warning on bad rate random: restore O_NONBLOCK support Input: xpad - add supported devices as contributed on github Input: xpad - fix wireless 360 controller breaking after suspend random: use expired timer rather than wq for mixing fast pool ALSA: oss: Fix potential deadlock at unregistration ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() ALSA: usb-audio: Fix potential memory leaks ALSA: usb-audio: Fix NULL dererence at error path iio: dac: ad5593r: Fix i2c read protocol requirements fs: dlm: fix race between test_bit() and queue_work() fs: dlm: handle -EBUSY first in lock arg validation quota: Check next/prev free block number after reading from quota file regulator: qcom_rpm: Fix circular deferral regression parisc: fbdev/stifb: Align graphics memory size to 4MB UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge fbdev: smscufx: Fix use-after-free in ufx_ops_open() nilfs2: fix use-after-free bug of struct nilfs_root ext4: avoid crash when inline data creation follows DIO write ext4: fix null-ptr-deref in ext4_write_info ext4: make ext4_lazyinit_thread freezable ext4: place buffer head allocation before handle start ring-buffer: Allow splice to read previous partially read pages ring-buffer: Check pending waiters when doing wake ups as well ring-buffer: Fix race between reset page and reading page KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility selinux: use "grep -E" instead of "egrep" sh: machvec: Use char[] for section boundaries wifi: ath10k: add peer map clean up for peer delete in ath10k_sta_state() wifi: mac80211: allow bw change during channel switch in mesh wifi: rtl8xxxu: tighten bounds checking in rtl8xxxu_read_efuse() spi: qup: add missing clk_disable_unprepare on error in spi_qup_resume() spi: qup: add missing clk_disable_unprepare on error in spi_qup_pm_resume_runtime() wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration net: fs_enet: Fix wrong check in do_pd_setup spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe mISDN: fix use-after-free bugs in l1oip timer handlers tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited net: rds: don't hold sock lock when cancelling work from rds_tcp_reset_callbacks() bnx2x: fix potential memory leak in bnx2x_tpa_stop() drm/mipi-dsi: Detach devices when removing the host platform/x86: msi-laptop: Fix old-ec check for backlight registering mmc: au1xmmc: Fix an error handling path in au1xmmc_probe() ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API ALSA: dmaengine: increment buffer pointer atomically memory: of: Fix refcount leak bug in of_get_ddr_timings() soc: qcom: smsm: Fix refcount leak bugs in qcom_smsm_probe() soc: qcom: smem_state: Add refcounting for the 'state->of_node' ARM: dts: kirkwood: lsxl: fix serial line ARM: dts: kirkwood: lsxl: remove first ethernet port ARM: Drop CMDLINE_* dependency on ATAGS ARM: dts: exynos: fix polarity of VBUS GPIO of Origen iio: adc: at91-sama5d2_adc: fix AT91_SAMA5D2_MR_TRACKTIM_MAX iio: inkern: only release the device node when done with it iio: ABI: Fix wrong format of differential capacitance channel ABI. clk: tegra: Fix refcount leak in tegra210_clock_init clk: tegra: Fix refcount leak in tegra114_clock_init clk: tegra20: Fix refcount leak in tegra20_clock_init HSI: omap_ssi: Fix refcount leak in ssi_probe HSI: omap_ssi_port: Fix dma_map_sg error check media: exynos4-is: fimc-is: Add of_node_put() when breaking out of loop tty: xilinx_uartps: Fix the ignore_status media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init RDMA/rxe: Fix "kernel NULL pointer dereference" error RDMA/rxe: Fix the error caused by qp->sk dyndbg: fix module.dyndbg handling dyndbg: let query-modname override actual module name ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting() ata: fix ata_id_has_devslp() ata: fix ata_id_has_ncq_autosense() ata: fix ata_id_has_dipm() drivers: serial: jsm: fix some leaks in probe firmware: google: Test spinlock on panic path to avoid lockups serial: 8250: Fix restoring termios speed after suspend mfd: intel_soc_pmic: Fix an error handling path in intel_soc_pmic_i2c_probe() mfd: lp8788: Fix an error handling path in lp8788_probe() mfd: lp8788: Fix an error handling path in lp8788_irq_init() and lp8788_irq_init() mfd: sm501: Add check for platform_driver_register() dmaengine: ioat: stop mod_timer from resurrecting deleted timer in __cleanup() clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe powerpc/math_emu/efp: Include module.h powerpc/pci_dn: Add missing of_node_put() powerpc: Fix SPE Power ISA properties for e500v1 platforms iommu/omap: Fix buffer overflow in debugfs f2fs: fix race condition on setting FI_NO_EXTENT flag ACPI: video: Add Toshiba Satellite/Portege Z830 quirk MIPS: BCM47XX: Cast memcmp() of function to (void *) powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash openvswitch: Fix double reporting of drops in dropwatch openvswitch: Fix overreporting of drops in dropwatch tcp: annotate data-race around tcp_md5sig_pool_populated xfrm: Update ipcomp_scratches with NULL when freed Bluetooth: L2CAP: initialize delayed works at l2cap_chan_create() Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times can: bcm: check the result of can_send() in bcm_can_tx() wifi: rt2x00: don't run Rt5592 IQ calibration on MT7620 Bluetooth: L2CAP: Fix user-after-free r8152: Rate limit overflow messages drm: Use size_t type for len variable in drm_copy_field() drm: Prevent drm_copy_field() to attempt copying a NULL pointer platform/x86: msi-laptop: Change DMI match / alias strings to fix module autoloading drm/amdgpu: fix initial connector audio value ARM: dts: imx7d-sdb: config the max pressure for tsc2046 ARM: dts: imx6q: add missing properties for sram ARM: dts: imx6dl: add missing properties for sram ARM: dts: imx6qp: add missing properties for sram ARM: dts: imx6sl: add missing properties for sram media: cx88: Fix a null-ptr-deref bug in buffer_prepare() scsi: 3w-9xxx: Avoid disabling device if failing to enable it HID: roccat: Fix use-after-free in roccat_read() usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info() usb: musb: Fix musb_gadget.c rxstate overflow bug Revert "usb: storage: Add quirk for Samsung Fit flash" usb: idmouse: fix an uninit-value in idmouse_open perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc net: ieee802154: return -EINVAL for unknown addr type net/ieee802154: don't warn zero-sized raw_sendmsg() ext4: continue to expand file system when the target size doesn't reach inet: fully convert sk->sk_rx_dst to RCU rules thermal: intel_powerclamp: Use first online CPU as control_cpu gcov: support GCC 12.1 and newer compilers Linux 4.9.331 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I105d6215a29d200abe3330f328ce3c2009ba0df9
238 lines
6.3 KiB
C
238 lines
6.3 KiB
C
/*
|
|
* eukrea-tlv320.c -- SoC audio for eukrea_cpuimxXX in I2S mode
|
|
*
|
|
* Copyright 2010 Eric Bénard, Eukréa Electromatique <eric@eukrea.com>
|
|
*
|
|
* based on sound/soc/s3c24xx/s3c24xx_simtec_tlv320aic23.c
|
|
* which is Copyright 2009 Simtec Electronics
|
|
* and on sound/soc/imx/phycore-ac97.c which is
|
|
* Copyright 2009 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
* option) any later version.
|
|
*
|
|
*/
|
|
|
|
#include <linux/errno.h>
|
|
#include <linux/module.h>
|
|
#include <linux/moduleparam.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_platform.h>
|
|
#include <linux/device.h>
|
|
#include <linux/i2c.h>
|
|
#include <sound/core.h>
|
|
#include <sound/pcm.h>
|
|
#include <sound/soc.h>
|
|
#include <asm/mach-types.h>
|
|
|
|
#include "../codecs/tlv320aic23.h"
|
|
#include "imx-ssi.h"
|
|
#include "fsl_ssi.h"
|
|
#include "imx-audmux.h"
|
|
|
|
#define CODEC_CLOCK 12000000
|
|
|
|
static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream,
|
|
struct snd_pcm_hw_params *params)
|
|
{
|
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
|
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
|
int ret;
|
|
|
|
ret = snd_soc_dai_set_sysclk(codec_dai, 0,
|
|
CODEC_CLOCK, SND_SOC_CLOCK_OUT);
|
|
if (ret) {
|
|
dev_err(cpu_dai->dev,
|
|
"Failed to set the codec sysclk.\n");
|
|
return ret;
|
|
}
|
|
|
|
snd_soc_dai_set_tdm_slot(cpu_dai, 0x3, 0x3, 2, 0);
|
|
|
|
ret = snd_soc_dai_set_sysclk(cpu_dai, IMX_SSP_SYS_CLK, 0,
|
|
SND_SOC_CLOCK_IN);
|
|
/* fsl_ssi lacks the set_sysclk ops */
|
|
if (ret && ret != -EINVAL) {
|
|
dev_err(cpu_dai->dev,
|
|
"Can't set the IMX_SSP_SYS_CLK CPU system clock.\n");
|
|
return ret;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static struct snd_soc_ops eukrea_tlv320_snd_ops = {
|
|
.hw_params = eukrea_tlv320_hw_params,
|
|
};
|
|
|
|
static struct snd_soc_dai_link eukrea_tlv320_dai = {
|
|
.name = "tlv320aic23",
|
|
.stream_name = "TLV320AIC23",
|
|
.codec_dai_name = "tlv320aic23-hifi",
|
|
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
|
|
SND_SOC_DAIFMT_CBM_CFM,
|
|
.ops = &eukrea_tlv320_snd_ops,
|
|
};
|
|
|
|
static struct snd_soc_card eukrea_tlv320 = {
|
|
.owner = THIS_MODULE,
|
|
.dai_link = &eukrea_tlv320_dai,
|
|
.num_links = 1,
|
|
};
|
|
|
|
static int eukrea_tlv320_probe(struct platform_device *pdev)
|
|
{
|
|
int ret;
|
|
int int_port = 0, ext_port;
|
|
struct device_node *np = pdev->dev.of_node;
|
|
struct device_node *ssi_np = NULL, *codec_np = NULL, *tmp_np = NULL;
|
|
|
|
eukrea_tlv320.dev = &pdev->dev;
|
|
if (np) {
|
|
ret = snd_soc_of_parse_card_name(&eukrea_tlv320,
|
|
"eukrea,model");
|
|
if (ret) {
|
|
dev_err(&pdev->dev,
|
|
"eukrea,model node missing or invalid.\n");
|
|
goto err;
|
|
}
|
|
|
|
ssi_np = of_parse_phandle(pdev->dev.of_node,
|
|
"ssi-controller", 0);
|
|
if (!ssi_np) {
|
|
dev_err(&pdev->dev,
|
|
"ssi-controller missing or invalid.\n");
|
|
ret = -ENODEV;
|
|
goto err;
|
|
}
|
|
|
|
codec_np = of_parse_phandle(ssi_np, "codec-handle", 0);
|
|
if (codec_np)
|
|
eukrea_tlv320_dai.codec_of_node = codec_np;
|
|
else
|
|
dev_err(&pdev->dev, "codec-handle node missing or invalid.\n");
|
|
|
|
ret = of_property_read_u32(np, "fsl,mux-int-port", &int_port);
|
|
if (ret) {
|
|
dev_err(&pdev->dev,
|
|
"fsl,mux-int-port node missing or invalid.\n");
|
|
goto err;
|
|
}
|
|
ret = of_property_read_u32(np, "fsl,mux-ext-port", &ext_port);
|
|
if (ret) {
|
|
dev_err(&pdev->dev,
|
|
"fsl,mux-ext-port node missing or invalid.\n");
|
|
goto err;
|
|
}
|
|
|
|
/*
|
|
* The port numbering in the hardware manual starts at 1, while
|
|
* the audmux API expects it starts at 0.
|
|
*/
|
|
int_port--;
|
|
ext_port--;
|
|
|
|
eukrea_tlv320_dai.cpu_of_node = ssi_np;
|
|
eukrea_tlv320_dai.platform_of_node = ssi_np;
|
|
} else {
|
|
eukrea_tlv320_dai.cpu_dai_name = "imx-ssi.0";
|
|
eukrea_tlv320_dai.platform_name = "imx-ssi.0";
|
|
eukrea_tlv320_dai.codec_name = "tlv320aic23-codec.0-001a";
|
|
eukrea_tlv320.name = "cpuimx-audio";
|
|
}
|
|
|
|
if (machine_is_eukrea_cpuimx27() ||
|
|
(tmp_np = of_find_compatible_node(NULL, NULL, "fsl,imx21-audmux"))) {
|
|
imx_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0,
|
|
IMX_AUDMUX_V1_PCR_SYN |
|
|
IMX_AUDMUX_V1_PCR_TFSDIR |
|
|
IMX_AUDMUX_V1_PCR_TCLKDIR |
|
|
IMX_AUDMUX_V1_PCR_RFSDIR |
|
|
IMX_AUDMUX_V1_PCR_RCLKDIR |
|
|
IMX_AUDMUX_V1_PCR_TFCSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4) |
|
|
IMX_AUDMUX_V1_PCR_RFCSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4) |
|
|
IMX_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4)
|
|
);
|
|
imx_audmux_v1_configure_port(MX27_AUDMUX_HPCR3_SSI_PINS_4,
|
|
IMX_AUDMUX_V1_PCR_SYN |
|
|
IMX_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0)
|
|
);
|
|
of_node_put(tmp_np);
|
|
} else if (machine_is_eukrea_cpuimx25sd() ||
|
|
machine_is_eukrea_cpuimx35sd() ||
|
|
machine_is_eukrea_cpuimx51sd() ||
|
|
(tmp_np = of_find_compatible_node(NULL, NULL, "fsl,imx31-audmux"))) {
|
|
if (!np)
|
|
ext_port = machine_is_eukrea_cpuimx25sd() ?
|
|
4 : 3;
|
|
|
|
imx_audmux_v2_configure_port(int_port,
|
|
IMX_AUDMUX_V2_PTCR_SYN |
|
|
IMX_AUDMUX_V2_PTCR_TFSDIR |
|
|
IMX_AUDMUX_V2_PTCR_TFSEL(ext_port) |
|
|
IMX_AUDMUX_V2_PTCR_TCLKDIR |
|
|
IMX_AUDMUX_V2_PTCR_TCSEL(ext_port),
|
|
IMX_AUDMUX_V2_PDCR_RXDSEL(ext_port)
|
|
);
|
|
imx_audmux_v2_configure_port(ext_port,
|
|
IMX_AUDMUX_V2_PTCR_SYN,
|
|
IMX_AUDMUX_V2_PDCR_RXDSEL(int_port)
|
|
);
|
|
of_node_put(tmp_np);
|
|
} else {
|
|
if (np) {
|
|
/* The eukrea,asoc-tlv320 driver was explicitly
|
|
* requested (through the device tree).
|
|
*/
|
|
dev_err(&pdev->dev,
|
|
"Missing or invalid audmux DT node.\n");
|
|
return -ENODEV;
|
|
} else {
|
|
/* Return happy.
|
|
* We might run on a totally different machine.
|
|
*/
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
ret = snd_soc_register_card(&eukrea_tlv320);
|
|
err:
|
|
if (ret)
|
|
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
|
|
of_node_put(ssi_np);
|
|
|
|
return ret;
|
|
}
|
|
|
|
static int eukrea_tlv320_remove(struct platform_device *pdev)
|
|
{
|
|
snd_soc_unregister_card(&eukrea_tlv320);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct of_device_id imx_tlv320_dt_ids[] = {
|
|
{ .compatible = "eukrea,asoc-tlv320"},
|
|
{ /* sentinel */ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, imx_tlv320_dt_ids);
|
|
|
|
static struct platform_driver eukrea_tlv320_driver = {
|
|
.driver = {
|
|
.name = "eukrea_tlv320",
|
|
.of_match_table = imx_tlv320_dt_ids,
|
|
},
|
|
.probe = eukrea_tlv320_probe,
|
|
.remove = eukrea_tlv320_remove,
|
|
};
|
|
|
|
module_platform_driver(eukrea_tlv320_driver);
|
|
|
|
MODULE_AUTHOR("Eric Bénard <eric@eukrea.com>");
|
|
MODULE_DESCRIPTION("CPUIMX ALSA SoC driver");
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_ALIAS("platform:eukrea_tlv320");
|