Changes in 4.9.300 can: bcm: fix UAF of bcm op Bluetooth: refactor malicious adv data check s390/hypfs: include z/VM guests with access control group set scsi: zfcp: Fix failed recovery on gone remote port with non-NPIV FCP devices udf: Restore i_lenAlloc when inode expansion fails udf: Fix NULL ptr deref when converting from inline format PM: wakeup: simplify the output logic of pm_show_wakelocks() serial: stm32: fix software flow control transfer tty: n_gsm: fix SW flow control encoding/handling tty: Add support for Brainboxes UC cards. usb-storage: Add unusual-devs entry for VL817 USB-SATA bridge usb: gadget: f_sourcesink: Fix isoc transfer for USB_SPEED_SUPER_PLUS USB: core: Fix hang in usb_kill_urb by adding memory barriers powerpc/32: Fix boot failure with GCC latent entropy plugin scsi: bnx2fc: Flush destroy_work queue before calling bnx2fc_interface_put() ipv6_tunnel: Rate limit warning messages net: fix information leakage in /proc/net/ptype ipv4: avoid using shared IP generator for connected sockets NFSv4: Handle case where the lookup of a directory fails NFSv4: nfs_atomic_open() can race when looking up a non-regular file net-procfs: show net devices bound packet types drm/msm: Fix wrong size calculation hwmon: (lm90) Reduce maximum conversion rate for G781 ipv4: raw: lock the socket in raw_bind() ipv4: tcp: send zero IPID in SYNACK messages netfilter: nat: remove l4 protocol port rovers netfilter: nat: limit port clash resolution attempts ipheth: fix EOVERFLOW in ipheth_rcvbulk_callback net: amd-xgbe: ensure to reset the tx_timer_active flag net: amd-xgbe: Fix skb data length underflow rtnetlink: make sure to refresh master_dev/m_ops in __rtnl_newlink() af_packet: fix data-race in packet_setsockopt / packet_setsockopt ASoC: ops: Reject out of bounds values in snd_soc_put_volsw() ASoC: ops: Reject out of bounds values in snd_soc_put_volsw_sx() ASoC: ops: Reject out of bounds values in snd_soc_put_xr_sx() drm/nouveau: fix off by one in BIOS boundary checking iommu/amd: Fix loop timeout issue in iommu_ga_log_enable() spi: bcm-qspi: check for valid cs before applying chip select spi: mediatek: Avoid NULL pointer crash in interrupt net: ieee802154: Return meaningful error codes from the netlink helpers net: macsec: Verify that send_sci is on when setting Tx sci explicitly ASoC: fsl: Add missing error handling in pcm030_fabric_probe scsi: bnx2fc: Make bnx2fc_recv_frame() mp safe nfsd: nfsd4_setclientid_confirm mistakenly expires confirmed client. rtc: cmos: Evaluate century appropriate EDAC/altera: Fix deferred probing EDAC/xgene: Fix deferred probing ext4: fix error handling in ext4_restore_inline_data() Linux 4.9.300 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I91b09ff3b20111994d43f92347b76da206627ca4
143 lines
3.4 KiB
C
143 lines
3.4 KiB
C
/*
|
|
* Phytec pcm030 driver for the PSC of the Freescale MPC52xx
|
|
* configured as AC97 interface
|
|
*
|
|
* Copyright 2008 Jon Smirl, Digispeaker
|
|
* Author: Jon Smirl <jonsmirl@gmail.com>
|
|
*
|
|
* This file is licensed under the terms of the GNU General Public License
|
|
* version 2. This program is licensed "as is" without any warranty of any
|
|
* kind, whether express or implied.
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
#include <linux/module.h>
|
|
#include <linux/device.h>
|
|
#include <linux/of_device.h>
|
|
#include <linux/of_platform.h>
|
|
|
|
#include <sound/soc.h>
|
|
|
|
#include "mpc5200_dma.h"
|
|
|
|
#define DRV_NAME "pcm030-audio-fabric"
|
|
|
|
struct pcm030_audio_data {
|
|
struct snd_soc_card *card;
|
|
struct platform_device *codec_device;
|
|
};
|
|
|
|
static struct snd_soc_dai_link pcm030_fabric_dai[] = {
|
|
{
|
|
.name = "AC97.0",
|
|
.stream_name = "AC97 Analog",
|
|
.codec_dai_name = "wm9712-hifi",
|
|
.cpu_dai_name = "mpc5200-psc-ac97.0",
|
|
.codec_name = "wm9712-codec",
|
|
},
|
|
{
|
|
.name = "AC97.1",
|
|
.stream_name = "AC97 IEC958",
|
|
.codec_dai_name = "wm9712-aux",
|
|
.cpu_dai_name = "mpc5200-psc-ac97.1",
|
|
.codec_name = "wm9712-codec",
|
|
},
|
|
};
|
|
|
|
static struct snd_soc_card pcm030_card = {
|
|
.name = "pcm030",
|
|
.owner = THIS_MODULE,
|
|
.dai_link = pcm030_fabric_dai,
|
|
.num_links = ARRAY_SIZE(pcm030_fabric_dai),
|
|
};
|
|
|
|
static int pcm030_fabric_probe(struct platform_device *op)
|
|
{
|
|
struct device_node *np = op->dev.of_node;
|
|
struct device_node *platform_np;
|
|
struct snd_soc_card *card = &pcm030_card;
|
|
struct pcm030_audio_data *pdata;
|
|
int ret;
|
|
int i;
|
|
|
|
if (!of_machine_is_compatible("phytec,pcm030"))
|
|
return -ENODEV;
|
|
|
|
pdata = devm_kzalloc(&op->dev, sizeof(struct pcm030_audio_data),
|
|
GFP_KERNEL);
|
|
if (!pdata)
|
|
return -ENOMEM;
|
|
|
|
card->dev = &op->dev;
|
|
|
|
pdata->card = card;
|
|
|
|
platform_np = of_parse_phandle(np, "asoc-platform", 0);
|
|
if (!platform_np) {
|
|
dev_err(&op->dev, "ac97 not registered\n");
|
|
return -ENODEV;
|
|
}
|
|
|
|
for (i = 0; i < card->num_links; i++)
|
|
card->dai_link[i].platform_of_node = platform_np;
|
|
|
|
ret = request_module("snd-soc-wm9712");
|
|
if (ret)
|
|
dev_err(&op->dev, "request_module returned: %d\n", ret);
|
|
|
|
pdata->codec_device = platform_device_alloc("wm9712-codec", -1);
|
|
if (!pdata->codec_device)
|
|
dev_err(&op->dev, "platform_device_alloc() failed\n");
|
|
|
|
ret = platform_device_add(pdata->codec_device);
|
|
if (ret) {
|
|
dev_err(&op->dev, "platform_device_add() failed: %d\n", ret);
|
|
platform_device_put(pdata->codec_device);
|
|
}
|
|
|
|
ret = snd_soc_register_card(card);
|
|
if (ret) {
|
|
dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
|
|
platform_device_del(pdata->codec_device);
|
|
platform_device_put(pdata->codec_device);
|
|
}
|
|
|
|
platform_set_drvdata(op, pdata);
|
|
return ret;
|
|
|
|
}
|
|
|
|
static int pcm030_fabric_remove(struct platform_device *op)
|
|
{
|
|
struct pcm030_audio_data *pdata = platform_get_drvdata(op);
|
|
int ret;
|
|
|
|
ret = snd_soc_unregister_card(pdata->card);
|
|
platform_device_unregister(pdata->codec_device);
|
|
|
|
return ret;
|
|
}
|
|
|
|
static const struct of_device_id pcm030_audio_match[] = {
|
|
{ .compatible = "phytec,pcm030-audio-fabric", },
|
|
{}
|
|
};
|
|
MODULE_DEVICE_TABLE(of, pcm030_audio_match);
|
|
|
|
static struct platform_driver pcm030_fabric_driver = {
|
|
.probe = pcm030_fabric_probe,
|
|
.remove = pcm030_fabric_remove,
|
|
.driver = {
|
|
.name = DRV_NAME,
|
|
.of_match_table = pcm030_audio_match,
|
|
},
|
|
};
|
|
|
|
module_platform_driver(pcm030_fabric_driver);
|
|
|
|
|
|
MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
|
|
MODULE_DESCRIPTION(DRV_NAME ": mpc5200 pcm030 fabric driver");
|
|
MODULE_LICENSE("GPL");
|
|
|