2019-05-29 22:17:59 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2015-07-09 17:50:09 +08:00
|
|
|
/*
|
|
|
|
* skl.c - Implementation of ASoC Intel SKL HD Audio driver
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014-2015 Intel Corp
|
|
|
|
* Author: Jeeja KP <jeeja.kp@intel.com>
|
|
|
|
*
|
|
|
|
* Derived mostly from Intel HDA driver with following copyrights:
|
|
|
|
* Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
|
|
|
|
* PeiSen Hou <pshou@realtek.com.tw>
|
|
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
*
|
|
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/pm_runtime.h>
|
|
|
|
#include <linux/platform_device.h>
|
2016-01-05 19:46:04 +08:00
|
|
|
#include <linux/firmware.h>
|
2016-11-03 19:37:16 +08:00
|
|
|
#include <linux/delay.h>
|
2015-07-09 17:50:09 +08:00
|
|
|
#include <sound/pcm.h>
|
2017-10-13 07:49:38 +08:00
|
|
|
#include <sound/soc-acpi.h>
|
2018-06-19 02:29:37 +08:00
|
|
|
#include <sound/soc-acpi-intel-match.h>
|
2016-02-18 00:04:06 +08:00
|
|
|
#include <sound/hda_register.h>
|
|
|
|
#include <sound/hdaudio.h>
|
|
|
|
#include <sound/hda_i915.h>
|
2018-08-23 04:25:02 +08:00
|
|
|
#include <sound/hda_codec.h>
|
2019-07-29 23:51:50 +08:00
|
|
|
#include <sound/intel-nhlt.h>
|
2019-10-23 01:43:12 +08:00
|
|
|
#include <sound/intel-dsp-config.h>
|
2015-07-09 17:50:09 +08:00
|
|
|
#include "skl.h"
|
2015-12-18 17:42:03 +08:00
|
|
|
#include "skl-sst-dsp.h"
|
|
|
|
#include "skl-sst-ipc.h"
|
2019-07-29 23:51:50 +08:00
|
|
|
|
2018-11-19 06:38:09 +08:00
|
|
|
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC)
|
2018-08-23 04:25:03 +08:00
|
|
|
#include "../../../soc/codecs/hdac_hda.h"
|
2018-11-19 06:38:09 +08:00
|
|
|
#endif
|
2018-12-16 04:07:23 +08:00
|
|
|
static int skl_pci_binding;
|
|
|
|
module_param_named(pci_binding, skl_pci_binding, int, 0444);
|
|
|
|
MODULE_PARM_DESC(pci_binding, "PCI binding (0=auto, 1=only legacy, 2=only asoc");
|
2015-07-09 17:50:09 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* initialize the PCI registers
|
|
|
|
*/
|
|
|
|
static void skl_update_pci_byte(struct pci_dev *pci, unsigned int reg,
|
|
|
|
unsigned char mask, unsigned char val)
|
|
|
|
{
|
|
|
|
unsigned char data;
|
|
|
|
|
|
|
|
pci_read_config_byte(pci, reg, &data);
|
|
|
|
data &= ~mask;
|
|
|
|
data |= (val & mask);
|
|
|
|
pci_write_config_byte(pci, reg, data);
|
|
|
|
}
|
|
|
|
|
2019-07-23 22:58:48 +08:00
|
|
|
static void skl_init_pci(struct skl_dev *skl)
|
2015-07-09 17:50:09 +08:00
|
|
|
{
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = skl_to_bus(skl);
|
2015-07-09 17:50:09 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Clear bits 0-2 of PCI register TCSEL (at offset 0x44)
|
|
|
|
* TCSEL == Traffic Class Select Register, which sets PCI express QOS
|
|
|
|
* Ensuring these bits are 0 clears playback static on some HD Audio
|
|
|
|
* codecs.
|
|
|
|
* The PCI register TCSEL is defined in the Intel manuals.
|
|
|
|
*/
|
2018-06-02 11:53:50 +08:00
|
|
|
dev_dbg(bus->dev, "Clearing TCSEL\n");
|
2015-07-09 17:50:09 +08:00
|
|
|
skl_update_pci_byte(skl->pci, AZX_PCIREG_TCSEL, 0x07, 0);
|
|
|
|
}
|
|
|
|
|
2015-12-18 17:42:03 +08:00
|
|
|
static void update_pci_dword(struct pci_dev *pci,
|
|
|
|
unsigned int reg, u32 mask, u32 val)
|
|
|
|
{
|
|
|
|
u32 data = 0;
|
|
|
|
|
|
|
|
pci_read_config_dword(pci, reg, &data);
|
|
|
|
data &= ~mask;
|
|
|
|
data |= (val & mask);
|
|
|
|
pci_write_config_dword(pci, reg, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* skl_enable_miscbdcge - enable/dsiable CGCTL.MISCBDCGE bits
|
|
|
|
*
|
|
|
|
* @dev: device pointer
|
|
|
|
* @enable: enable/disable flag
|
|
|
|
*/
|
|
|
|
static void skl_enable_miscbdcge(struct device *dev, bool enable)
|
|
|
|
{
|
|
|
|
struct pci_dev *pci = to_pci_dev(dev);
|
|
|
|
u32 val;
|
|
|
|
|
|
|
|
val = enable ? AZX_CGCTL_MISCBDCGE_MASK : 0;
|
|
|
|
|
|
|
|
update_pci_dword(pci, AZX_PCIREG_CGCTL, AZX_CGCTL_MISCBDCGE_MASK, val);
|
|
|
|
}
|
|
|
|
|
2018-03-13 11:32:25 +08:00
|
|
|
/**
|
|
|
|
* skl_clock_power_gating: Enable/Disable clock and power gating
|
|
|
|
*
|
|
|
|
* @dev: Device pointer
|
|
|
|
* @enable: Enable/Disable flag
|
|
|
|
*/
|
|
|
|
static void skl_clock_power_gating(struct device *dev, bool enable)
|
|
|
|
{
|
|
|
|
struct pci_dev *pci = to_pci_dev(dev);
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = pci_get_drvdata(pci);
|
2018-03-13 11:32:25 +08:00
|
|
|
u32 val;
|
|
|
|
|
|
|
|
/* Update PDCGE bit of CGCTL register */
|
|
|
|
val = enable ? AZX_CGCTL_ADSPDCGE : 0;
|
|
|
|
update_pci_dword(pci, AZX_PCIREG_CGCTL, AZX_CGCTL_ADSPDCGE, val);
|
|
|
|
|
|
|
|
/* Update L1SEN bit of EM2 register */
|
|
|
|
val = enable ? AZX_REG_VS_EM2_L1SEN : 0;
|
|
|
|
snd_hdac_chip_updatel(bus, VS_EM2, AZX_REG_VS_EM2_L1SEN, val);
|
|
|
|
|
|
|
|
/* Update ADSPPGD bit of PGCTL register */
|
|
|
|
val = enable ? 0 : AZX_PGCTL_ADSPPGD;
|
|
|
|
update_pci_dword(pci, AZX_PCIREG_PGCTL, AZX_PGCTL_ADSPPGD, val);
|
|
|
|
}
|
|
|
|
|
2015-12-18 17:42:03 +08:00
|
|
|
/*
|
|
|
|
* While performing reset, controller may not come back properly causing
|
|
|
|
* issues, so recommendation is to set CGCTL.MISCBDCGE to 0 then do reset
|
|
|
|
* (init chip) and then again set CGCTL.MISCBDCGE to 1
|
|
|
|
*/
|
|
|
|
static int skl_init_chip(struct hdac_bus *bus, bool full_reset)
|
|
|
|
{
|
2018-04-01 17:43:23 +08:00
|
|
|
struct hdac_ext_link *hlink;
|
2015-12-18 17:42:03 +08:00
|
|
|
int ret;
|
|
|
|
|
2020-03-05 22:53:10 +08:00
|
|
|
snd_hdac_set_codec_wakeup(bus, true);
|
2015-12-18 17:42:03 +08:00
|
|
|
skl_enable_miscbdcge(bus->dev, false);
|
|
|
|
ret = snd_hdac_bus_init_chip(bus, full_reset);
|
2018-04-01 17:43:23 +08:00
|
|
|
|
|
|
|
/* Reset stream-to-link mapping */
|
2018-06-02 11:53:50 +08:00
|
|
|
list_for_each_entry(hlink, &bus->hlink_list, list)
|
2019-08-08 02:32:08 +08:00
|
|
|
writel(0, hlink->ml_addr + AZX_REG_ML_LOSIDV);
|
2018-04-01 17:43:23 +08:00
|
|
|
|
2015-12-18 17:42:03 +08:00
|
|
|
skl_enable_miscbdcge(bus->dev, true);
|
2020-03-05 22:53:10 +08:00
|
|
|
snd_hdac_set_codec_wakeup(bus, false);
|
2015-12-18 17:42:03 +08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-11-03 19:37:16 +08:00
|
|
|
void skl_update_d0i3c(struct device *dev, bool enable)
|
|
|
|
{
|
|
|
|
struct pci_dev *pci = to_pci_dev(dev);
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = pci_get_drvdata(pci);
|
2016-11-03 19:37:16 +08:00
|
|
|
u8 reg;
|
|
|
|
int timeout = 50;
|
|
|
|
|
|
|
|
reg = snd_hdac_chip_readb(bus, VS_D0I3C);
|
|
|
|
/* Do not write to D0I3C until command in progress bit is cleared */
|
|
|
|
while ((reg & AZX_REG_VS_D0I3C_CIP) && --timeout) {
|
|
|
|
udelay(10);
|
|
|
|
reg = snd_hdac_chip_readb(bus, VS_D0I3C);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Highly unlikely. But if it happens, flag error explicitly */
|
|
|
|
if (!timeout) {
|
|
|
|
dev_err(bus->dev, "Before D0I3C update: D0I3C CIP timeout\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (enable)
|
|
|
|
reg = reg | AZX_REG_VS_D0I3C_I3;
|
|
|
|
else
|
|
|
|
reg = reg & (~AZX_REG_VS_D0I3C_I3);
|
|
|
|
|
|
|
|
snd_hdac_chip_writeb(bus, VS_D0I3C, reg);
|
|
|
|
|
|
|
|
timeout = 50;
|
|
|
|
/* Wait for cmd in progress to be cleared before exiting the function */
|
|
|
|
reg = snd_hdac_chip_readb(bus, VS_D0I3C);
|
|
|
|
while ((reg & AZX_REG_VS_D0I3C_CIP) && --timeout) {
|
|
|
|
udelay(10);
|
|
|
|
reg = snd_hdac_chip_readb(bus, VS_D0I3C);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Highly unlikely. But if it happens, flag error explicitly */
|
|
|
|
if (!timeout) {
|
|
|
|
dev_err(bus->dev, "After D0I3C update: D0I3C CIP timeout\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dev_dbg(bus->dev, "D0I3C register = 0x%x\n",
|
|
|
|
snd_hdac_chip_readb(bus, VS_D0I3C));
|
|
|
|
}
|
|
|
|
|
2019-06-14 03:04:30 +08:00
|
|
|
/**
|
|
|
|
* skl_dum_set - set DUM bit in EM2 register
|
|
|
|
* @bus: HD-audio core bus
|
|
|
|
*
|
|
|
|
* Addresses incorrect position reporting for capture streams.
|
|
|
|
* Used on device power up.
|
|
|
|
*/
|
|
|
|
static void skl_dum_set(struct hdac_bus *bus)
|
|
|
|
{
|
|
|
|
/* For the DUM bit to be set, CRST needs to be out of reset state */
|
|
|
|
if (!(snd_hdac_chip_readb(bus, GCTL) & AZX_GCTL_RESET)) {
|
|
|
|
skl_enable_miscbdcge(bus->dev, false);
|
|
|
|
snd_hdac_bus_exit_link_reset(bus);
|
|
|
|
skl_enable_miscbdcge(bus->dev, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
snd_hdac_chip_updatel(bus, VS_EM2, AZX_VS_EM2_DUM, AZX_VS_EM2_DUM);
|
|
|
|
}
|
|
|
|
|
2015-07-09 17:50:09 +08:00
|
|
|
/* called from IRQ */
|
|
|
|
static void skl_stream_update(struct hdac_bus *bus, struct hdac_stream *hstr)
|
|
|
|
{
|
|
|
|
snd_pcm_period_elapsed(hstr->substream);
|
|
|
|
}
|
|
|
|
|
|
|
|
static irqreturn_t skl_interrupt(int irq, void *dev_id)
|
|
|
|
{
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = dev_id;
|
2015-07-09 17:50:09 +08:00
|
|
|
u32 status;
|
|
|
|
|
|
|
|
if (!pm_runtime_active(bus->dev))
|
|
|
|
return IRQ_NONE;
|
|
|
|
|
|
|
|
spin_lock(&bus->reg_lock);
|
|
|
|
|
|
|
|
status = snd_hdac_chip_readl(bus, INTSTS);
|
|
|
|
if (status == 0 || status == 0xffffffff) {
|
|
|
|
spin_unlock(&bus->reg_lock);
|
|
|
|
return IRQ_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clear rirb int */
|
|
|
|
status = snd_hdac_chip_readb(bus, RIRBSTS);
|
|
|
|
if (status & RIRB_INT_MASK) {
|
|
|
|
if (status & RIRB_INT_RESPONSE)
|
|
|
|
snd_hdac_bus_update_rirb(bus);
|
|
|
|
snd_hdac_chip_writeb(bus, RIRBSTS, RIRB_INT_MASK);
|
|
|
|
}
|
|
|
|
|
|
|
|
spin_unlock(&bus->reg_lock);
|
|
|
|
|
|
|
|
return snd_hdac_chip_readl(bus, INTSTS) ? IRQ_WAKE_THREAD : IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static irqreturn_t skl_threaded_handler(int irq, void *dev_id)
|
|
|
|
{
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = dev_id;
|
2015-07-09 17:50:09 +08:00
|
|
|
u32 status;
|
|
|
|
|
|
|
|
status = snd_hdac_chip_readl(bus, INTSTS);
|
|
|
|
|
|
|
|
snd_hdac_bus_handle_stream_irq(bus, status, skl_stream_update);
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
static int skl_acquire_irq(struct hdac_bus *bus, int do_disconnect)
|
2015-07-09 17:50:09 +08:00
|
|
|
{
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev *skl = bus_to_skl(bus);
|
2015-07-09 17:50:09 +08:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = request_threaded_irq(skl->pci->irq, skl_interrupt,
|
|
|
|
skl_threaded_handler,
|
|
|
|
IRQF_SHARED,
|
2018-06-02 11:53:50 +08:00
|
|
|
KBUILD_MODNAME, bus);
|
2015-07-09 17:50:09 +08:00
|
|
|
if (ret) {
|
|
|
|
dev_err(bus->dev,
|
|
|
|
"unable to grab IRQ %d, disabling device\n",
|
|
|
|
skl->pci->irq);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
bus->irq = skl->pci->irq;
|
|
|
|
pci_intx(skl->pci, 1);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-11-03 19:37:21 +08:00
|
|
|
static int skl_suspend_late(struct device *dev)
|
|
|
|
{
|
|
|
|
struct pci_dev *pci = to_pci_dev(dev);
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = pci_get_drvdata(pci);
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev *skl = bus_to_skl(bus);
|
2016-11-03 19:37:21 +08:00
|
|
|
|
|
|
|
return skl_suspend_late_dsp(skl);
|
|
|
|
}
|
|
|
|
|
2015-10-27 08:23:00 +08:00
|
|
|
#ifdef CONFIG_PM
|
2018-06-02 11:53:50 +08:00
|
|
|
static int _skl_suspend(struct hdac_bus *bus)
|
2015-10-27 08:23:00 +08:00
|
|
|
{
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev *skl = bus_to_skl(bus);
|
2016-06-03 20:59:37 +08:00
|
|
|
struct pci_dev *pci = to_pci_dev(bus->dev);
|
2015-10-27 08:23:00 +08:00
|
|
|
int ret;
|
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
snd_hdac_ext_bus_link_power_down_all(bus);
|
2015-10-27 08:23:00 +08:00
|
|
|
|
|
|
|
ret = skl_suspend_dsp(skl);
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
snd_hdac_bus_stop_chip(bus);
|
2016-06-03 20:59:37 +08:00
|
|
|
update_pci_dword(pci, AZX_PCIREG_PGCTL,
|
|
|
|
AZX_PGCTL_LSRMD_MASK, AZX_PGCTL_LSRMD_MASK);
|
2015-12-18 17:42:03 +08:00
|
|
|
skl_enable_miscbdcge(bus->dev, false);
|
2015-10-27 08:23:00 +08:00
|
|
|
snd_hdac_bus_enter_link_reset(bus);
|
2015-12-18 17:42:03 +08:00
|
|
|
skl_enable_miscbdcge(bus->dev, true);
|
2016-06-03 20:59:39 +08:00
|
|
|
skl_cleanup_resources(skl);
|
2015-10-27 08:23:00 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
static int _skl_resume(struct hdac_bus *bus)
|
2015-10-27 08:23:00 +08:00
|
|
|
{
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev *skl = bus_to_skl(bus);
|
2015-10-27 08:23:00 +08:00
|
|
|
|
|
|
|
skl_init_pci(skl);
|
2019-06-14 03:04:30 +08:00
|
|
|
skl_dum_set(bus);
|
2015-12-18 17:42:03 +08:00
|
|
|
skl_init_chip(bus, true);
|
2015-10-27 08:23:00 +08:00
|
|
|
|
|
|
|
return skl_resume_dsp(skl);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-07-09 17:50:09 +08:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
|
|
|
/*
|
|
|
|
* power management
|
|
|
|
*/
|
|
|
|
static int skl_suspend(struct device *dev)
|
|
|
|
{
|
|
|
|
struct pci_dev *pci = to_pci_dev(dev);
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = pci_get_drvdata(pci);
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev *skl = bus_to_skl(bus);
|
2018-12-09 17:04:25 +08:00
|
|
|
int ret;
|
2015-07-09 17:50:09 +08:00
|
|
|
|
2015-12-04 02:00:00 +08:00
|
|
|
/*
|
|
|
|
* Do not suspend if streams which are marked ignore suspend are
|
|
|
|
* running, we need to save the state for these and continue
|
|
|
|
*/
|
|
|
|
if (skl->supend_active) {
|
2016-05-12 11:28:54 +08:00
|
|
|
/* turn off the links and stop the CORB/RIRB DMA if it is On */
|
2018-06-02 11:53:50 +08:00
|
|
|
snd_hdac_ext_bus_link_power_down_all(bus);
|
2016-05-12 11:28:54 +08:00
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
if (bus->cmd_dma_state)
|
|
|
|
snd_hdac_bus_stop_cmd_io(bus);
|
2016-05-12 11:28:54 +08:00
|
|
|
|
2015-12-18 17:42:06 +08:00
|
|
|
enable_irq_wake(bus->irq);
|
2015-12-04 02:00:00 +08:00
|
|
|
pci_save_state(pci);
|
|
|
|
} else {
|
2018-06-02 11:53:50 +08:00
|
|
|
ret = _skl_suspend(bus);
|
2016-04-01 16:06:27 +08:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2019-07-23 22:58:48 +08:00
|
|
|
skl->fw_loaded = false;
|
2015-12-04 02:00:00 +08:00
|
|
|
}
|
2016-04-01 16:06:27 +08:00
|
|
|
|
2018-12-09 17:04:25 +08:00
|
|
|
return 0;
|
2015-07-09 17:50:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int skl_resume(struct device *dev)
|
|
|
|
{
|
|
|
|
struct pci_dev *pci = to_pci_dev(dev);
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = pci_get_drvdata(pci);
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev *skl = bus_to_skl(bus);
|
2020-03-13 03:48:55 +08:00
|
|
|
struct hdac_ext_link *hlink;
|
2015-12-04 02:00:00 +08:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* resume only when we are not in suspend active, otherwise need to
|
|
|
|
* restore the device
|
|
|
|
*/
|
|
|
|
if (skl->supend_active) {
|
|
|
|
pci_restore_state(pci);
|
2018-06-02 11:53:50 +08:00
|
|
|
snd_hdac_ext_bus_link_power_up_all(bus);
|
2015-12-18 17:42:06 +08:00
|
|
|
disable_irq_wake(bus->irq);
|
2016-05-12 11:28:54 +08:00
|
|
|
/*
|
|
|
|
* turn On the links which are On before active suspend
|
|
|
|
* and start the CORB/RIRB DMA if On before
|
|
|
|
* active suspend.
|
|
|
|
*/
|
2018-06-02 11:53:50 +08:00
|
|
|
list_for_each_entry(hlink, &bus->hlink_list, list) {
|
2016-05-12 11:28:54 +08:00
|
|
|
if (hlink->ref_count)
|
|
|
|
snd_hdac_ext_bus_link_power_up(hlink);
|
|
|
|
}
|
|
|
|
|
2017-11-06 21:30:36 +08:00
|
|
|
ret = 0;
|
2018-06-02 11:53:50 +08:00
|
|
|
if (bus->cmd_dma_state)
|
|
|
|
snd_hdac_bus_init_cmd_io(bus);
|
2015-12-04 02:00:00 +08:00
|
|
|
} else {
|
2018-06-02 11:53:50 +08:00
|
|
|
ret = _skl_resume(bus);
|
2016-05-12 11:28:54 +08:00
|
|
|
|
|
|
|
/* turn off the links which are off before suspend */
|
2018-06-02 11:53:50 +08:00
|
|
|
list_for_each_entry(hlink, &bus->hlink_list, list) {
|
2016-05-12 11:28:54 +08:00
|
|
|
if (!hlink->ref_count)
|
|
|
|
snd_hdac_ext_bus_link_power_down(hlink);
|
|
|
|
}
|
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
if (!bus->cmd_dma_state)
|
|
|
|
snd_hdac_bus_stop_cmd_io(bus);
|
2015-12-04 02:00:00 +08:00
|
|
|
}
|
2015-07-09 17:50:09 +08:00
|
|
|
|
2015-12-04 02:00:00 +08:00
|
|
|
return ret;
|
2015-07-09 17:50:09 +08:00
|
|
|
}
|
|
|
|
#endif /* CONFIG_PM_SLEEP */
|
|
|
|
|
|
|
|
#ifdef CONFIG_PM
|
|
|
|
static int skl_runtime_suspend(struct device *dev)
|
|
|
|
{
|
|
|
|
struct pci_dev *pci = to_pci_dev(dev);
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = pci_get_drvdata(pci);
|
2015-07-09 17:50:09 +08:00
|
|
|
|
|
|
|
dev_dbg(bus->dev, "in %s\n", __func__);
|
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
return _skl_suspend(bus);
|
2015-07-09 17:50:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int skl_runtime_resume(struct device *dev)
|
|
|
|
{
|
|
|
|
struct pci_dev *pci = to_pci_dev(dev);
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = pci_get_drvdata(pci);
|
2015-07-09 17:50:09 +08:00
|
|
|
|
|
|
|
dev_dbg(bus->dev, "in %s\n", __func__);
|
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
return _skl_resume(bus);
|
2015-07-09 17:50:09 +08:00
|
|
|
}
|
|
|
|
#endif /* CONFIG_PM */
|
|
|
|
|
|
|
|
static const struct dev_pm_ops skl_pm = {
|
|
|
|
SET_SYSTEM_SLEEP_PM_OPS(skl_suspend, skl_resume)
|
|
|
|
SET_RUNTIME_PM_OPS(skl_runtime_suspend, skl_runtime_resume, NULL)
|
2016-11-03 19:37:21 +08:00
|
|
|
.suspend_late = skl_suspend_late,
|
2015-07-09 17:50:09 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* destructor
|
|
|
|
*/
|
2018-06-02 11:53:50 +08:00
|
|
|
static int skl_free(struct hdac_bus *bus)
|
2015-07-09 17:50:09 +08:00
|
|
|
{
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev *skl = bus_to_skl(bus);
|
2015-07-09 17:50:09 +08:00
|
|
|
|
2017-05-04 16:39:10 +08:00
|
|
|
skl->init_done = 0; /* to be sure */
|
2015-07-09 17:50:09 +08:00
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
snd_hdac_ext_stop_streams(bus);
|
2015-07-09 17:50:09 +08:00
|
|
|
|
|
|
|
if (bus->irq >= 0)
|
2018-06-02 11:53:50 +08:00
|
|
|
free_irq(bus->irq, (void *)bus);
|
2015-07-09 17:50:09 +08:00
|
|
|
snd_hdac_bus_free_stream_pages(bus);
|
2018-06-02 11:53:50 +08:00
|
|
|
snd_hdac_stream_free_all(bus);
|
|
|
|
snd_hdac_link_free_all(bus);
|
2016-03-15 19:09:26 +08:00
|
|
|
|
|
|
|
if (bus->remap_addr)
|
|
|
|
iounmap(bus->remap_addr);
|
|
|
|
|
2015-07-09 17:50:09 +08:00
|
|
|
pci_release_regions(skl->pci);
|
|
|
|
pci_disable_device(skl->pci);
|
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
snd_hdac_ext_bus_exit(bus);
|
2015-07-09 17:50:09 +08:00
|
|
|
|
2019-01-08 18:37:31 +08:00
|
|
|
if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
|
|
|
|
snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);
|
2018-06-02 11:53:50 +08:00
|
|
|
snd_hdac_i915_exit(bus);
|
2019-01-08 18:37:31 +08:00
|
|
|
}
|
2017-05-04 16:39:10 +08:00
|
|
|
|
2015-07-09 17:50:09 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-11-22 20:09:46 +08:00
|
|
|
/*
|
|
|
|
* For each ssp there are 3 clocks (mclk/sclk/sclkfs).
|
|
|
|
* e.g. for ssp0, clocks will be named as
|
|
|
|
* "ssp0_mclk", "ssp0_sclk", "ssp0_sclkfs"
|
|
|
|
* So for skl+, there are 6 ssps, so 18 clocks will be created.
|
|
|
|
*/
|
|
|
|
static struct skl_ssp_clk skl_ssp_clks[] = {
|
|
|
|
{.name = "ssp0_mclk"}, {.name = "ssp1_mclk"}, {.name = "ssp2_mclk"},
|
|
|
|
{.name = "ssp3_mclk"}, {.name = "ssp4_mclk"}, {.name = "ssp5_mclk"},
|
|
|
|
{.name = "ssp0_sclk"}, {.name = "ssp1_sclk"}, {.name = "ssp2_sclk"},
|
|
|
|
{.name = "ssp3_sclk"}, {.name = "ssp4_sclk"}, {.name = "ssp5_sclk"},
|
|
|
|
{.name = "ssp0_sclkfs"}, {.name = "ssp1_sclkfs"},
|
|
|
|
{.name = "ssp2_sclkfs"},
|
|
|
|
{.name = "ssp3_sclkfs"}, {.name = "ssp4_sclkfs"},
|
|
|
|
{.name = "ssp5_sclkfs"},
|
|
|
|
};
|
|
|
|
|
2019-07-23 22:58:48 +08:00
|
|
|
static struct snd_soc_acpi_mach *skl_find_hda_machine(struct skl_dev *skl,
|
2018-08-23 04:25:00 +08:00
|
|
|
struct snd_soc_acpi_mach *machines)
|
|
|
|
{
|
|
|
|
struct snd_soc_acpi_mach *mach;
|
|
|
|
|
|
|
|
/* point to common table */
|
|
|
|
mach = snd_soc_acpi_intel_hda_machines;
|
|
|
|
|
|
|
|
/* all entries in the machine table use the same firmware */
|
|
|
|
mach->fw_filename = machines->fw_filename;
|
|
|
|
|
|
|
|
return mach;
|
|
|
|
}
|
|
|
|
|
2019-07-23 22:58:48 +08:00
|
|
|
static int skl_find_machine(struct skl_dev *skl, void *driver_data)
|
2015-11-06 00:04:13 +08:00
|
|
|
{
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = skl_to_bus(skl);
|
2017-10-13 07:49:38 +08:00
|
|
|
struct snd_soc_acpi_mach *mach = driver_data;
|
2017-12-18 13:16:50 +08:00
|
|
|
struct skl_machine_pdata *pdata;
|
2015-11-06 00:04:13 +08:00
|
|
|
|
2017-10-13 07:49:38 +08:00
|
|
|
mach = snd_soc_acpi_find_machine(mach);
|
2018-08-23 04:25:00 +08:00
|
|
|
if (!mach) {
|
|
|
|
dev_dbg(bus->dev, "No matching I2S machine driver found\n");
|
|
|
|
mach = skl_find_hda_machine(skl, driver_data);
|
|
|
|
if (!mach) {
|
|
|
|
dev_err(bus->dev, "No matching machine driver found\n");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
2015-11-06 00:04:13 +08:00
|
|
|
}
|
2017-12-18 13:16:50 +08:00
|
|
|
|
|
|
|
skl->mach = mach;
|
2015-11-06 00:04:15 +08:00
|
|
|
skl->fw_name = mach->fw_filename;
|
2018-06-19 02:29:36 +08:00
|
|
|
pdata = mach->pdata;
|
2017-12-18 13:16:50 +08:00
|
|
|
|
2018-06-19 02:29:36 +08:00
|
|
|
if (pdata) {
|
2017-12-18 13:16:50 +08:00
|
|
|
skl->use_tplg_pcm = pdata->use_tplg_pcm;
|
2019-07-29 23:51:50 +08:00
|
|
|
mach->mach_params.dmic_num =
|
|
|
|
intel_nhlt_get_dmic_geo(&skl->pci->dev,
|
|
|
|
skl->nhlt);
|
2018-06-19 02:29:36 +08:00
|
|
|
}
|
2017-12-18 13:16:50 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-23 22:58:48 +08:00
|
|
|
static int skl_machine_device_register(struct skl_dev *skl)
|
2017-12-18 13:16:50 +08:00
|
|
|
{
|
|
|
|
struct snd_soc_acpi_mach *mach = skl->mach;
|
2018-08-23 04:25:00 +08:00
|
|
|
struct hdac_bus *bus = skl_to_bus(skl);
|
2017-12-18 13:16:50 +08:00
|
|
|
struct platform_device *pdev;
|
|
|
|
int ret;
|
2015-11-06 00:04:13 +08:00
|
|
|
|
|
|
|
pdev = platform_device_alloc(mach->drv_name, -1);
|
|
|
|
if (pdev == NULL) {
|
|
|
|
dev_err(bus->dev, "platform device alloc failed\n");
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
2018-11-17 08:47:06 +08:00
|
|
|
mach->mach_params.platform = dev_name(bus->dev);
|
|
|
|
mach->mach_params.codec_mask = bus->codec_mask;
|
|
|
|
|
|
|
|
ret = platform_device_add_data(pdev, (const void *)mach, sizeof(*mach));
|
|
|
|
if (ret) {
|
|
|
|
dev_err(bus->dev, "failed to add machine device platform data\n");
|
|
|
|
platform_device_put(pdev);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-11-06 00:04:13 +08:00
|
|
|
ret = platform_device_add(pdev);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(bus->dev, "failed to add machine device\n");
|
|
|
|
platform_device_put(pdev);
|
|
|
|
return -EIO;
|
|
|
|
}
|
2016-05-27 12:30:15 +08:00
|
|
|
|
|
|
|
|
2015-11-06 00:04:13 +08:00
|
|
|
skl->i2s_dev = pdev;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-23 22:58:48 +08:00
|
|
|
static void skl_machine_device_unregister(struct skl_dev *skl)
|
2015-11-06 00:04:13 +08:00
|
|
|
{
|
|
|
|
if (skl->i2s_dev)
|
|
|
|
platform_device_unregister(skl->i2s_dev);
|
|
|
|
}
|
|
|
|
|
2019-07-23 22:58:48 +08:00
|
|
|
static int skl_dmic_device_register(struct skl_dev *skl)
|
2015-07-09 17:50:09 +08:00
|
|
|
{
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = skl_to_bus(skl);
|
2015-07-09 17:50:09 +08:00
|
|
|
struct platform_device *pdev;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* SKL has one dmic port, so allocate dmic device for this */
|
|
|
|
pdev = platform_device_alloc("dmic-codec", -1);
|
|
|
|
if (!pdev) {
|
|
|
|
dev_err(bus->dev, "failed to allocate dmic device\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = platform_device_add(pdev);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(bus->dev, "failed to add dmic device: %d\n", ret);
|
|
|
|
platform_device_put(pdev);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
skl->dmic_dev = pdev;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-23 22:58:48 +08:00
|
|
|
static void skl_dmic_device_unregister(struct skl_dev *skl)
|
2015-07-09 17:50:09 +08:00
|
|
|
{
|
|
|
|
if (skl->dmic_dev)
|
|
|
|
platform_device_unregister(skl->dmic_dev);
|
|
|
|
}
|
|
|
|
|
2017-11-22 20:09:46 +08:00
|
|
|
static struct skl_clk_parent_src skl_clk_src[] = {
|
|
|
|
{ .clk_id = SKL_XTAL, .name = "xtal" },
|
|
|
|
{ .clk_id = SKL_CARDINAL, .name = "cardinal", .rate = 24576000 },
|
|
|
|
{ .clk_id = SKL_PLL, .name = "pll", .rate = 96000000 },
|
|
|
|
};
|
|
|
|
|
|
|
|
struct skl_clk_parent_src *skl_get_parent_clk(u8 clk_id)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(skl_clk_src); i++) {
|
|
|
|
if (skl_clk_src[i].clk_id == clk_id)
|
|
|
|
return &skl_clk_src[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-12-04 13:00:11 +08:00
|
|
|
static void init_skl_xtal_rate(int pci_id)
|
2017-11-22 20:09:46 +08:00
|
|
|
{
|
|
|
|
switch (pci_id) {
|
|
|
|
case 0x9d70:
|
|
|
|
case 0x9d71:
|
|
|
|
skl_clk_src[0].rate = 24000000;
|
|
|
|
return;
|
|
|
|
|
|
|
|
default:
|
|
|
|
skl_clk_src[0].rate = 19200000;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-23 22:58:48 +08:00
|
|
|
static int skl_clock_device_register(struct skl_dev *skl)
|
2017-11-22 20:09:46 +08:00
|
|
|
{
|
|
|
|
struct platform_device_info pdevinfo = {NULL};
|
|
|
|
struct skl_clk_pdata *clk_pdata;
|
|
|
|
|
2020-03-05 22:53:11 +08:00
|
|
|
if (!skl->nhlt)
|
|
|
|
return 0;
|
|
|
|
|
2017-11-22 20:09:46 +08:00
|
|
|
clk_pdata = devm_kzalloc(&skl->pci->dev, sizeof(*clk_pdata),
|
|
|
|
GFP_KERNEL);
|
|
|
|
if (!clk_pdata)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
init_skl_xtal_rate(skl->pci->device);
|
|
|
|
|
|
|
|
clk_pdata->parent_clks = skl_clk_src;
|
|
|
|
clk_pdata->ssp_clks = skl_ssp_clks;
|
|
|
|
clk_pdata->num_clks = ARRAY_SIZE(skl_ssp_clks);
|
|
|
|
|
|
|
|
/* Query NHLT to fill the rates and parent */
|
|
|
|
skl_get_clks(skl, clk_pdata->ssp_clks);
|
|
|
|
clk_pdata->pvt_data = skl;
|
|
|
|
|
|
|
|
/* Register Platform device */
|
|
|
|
pdevinfo.parent = &skl->pci->dev;
|
|
|
|
pdevinfo.id = -1;
|
|
|
|
pdevinfo.name = "skl-ssp-clk";
|
|
|
|
pdevinfo.data = clk_pdata;
|
|
|
|
pdevinfo.size_data = sizeof(*clk_pdata);
|
|
|
|
skl->clk_dev = platform_device_register_full(&pdevinfo);
|
|
|
|
return PTR_ERR_OR_ZERO(skl->clk_dev);
|
|
|
|
}
|
|
|
|
|
2019-07-23 22:58:48 +08:00
|
|
|
static void skl_clock_device_unregister(struct skl_dev *skl)
|
2017-11-22 20:09:46 +08:00
|
|
|
{
|
|
|
|
if (skl->clk_dev)
|
|
|
|
platform_device_unregister(skl->clk_dev);
|
|
|
|
}
|
|
|
|
|
2018-11-19 06:38:09 +08:00
|
|
|
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC)
|
|
|
|
|
2018-08-23 04:25:03 +08:00
|
|
|
#define IDISP_INTEL_VENDOR_ID 0x80860000
|
|
|
|
|
|
|
|
/*
|
|
|
|
* load the legacy codec driver
|
|
|
|
*/
|
|
|
|
static void load_codec_module(struct hda_codec *codec)
|
|
|
|
{
|
|
|
|
#ifdef MODULE
|
|
|
|
char modalias[MODULE_NAME_LEN];
|
|
|
|
const char *mod = NULL;
|
|
|
|
|
|
|
|
snd_hdac_codec_modalias(&codec->core, modalias, sizeof(modalias));
|
|
|
|
mod = modalias;
|
|
|
|
dev_dbg(&codec->core.dev, "loading %s codec module\n", mod);
|
|
|
|
request_module(mod);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-11-19 06:38:09 +08:00
|
|
|
#endif /* CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC */
|
|
|
|
|
2015-07-09 17:50:09 +08:00
|
|
|
/*
|
|
|
|
* Probe the given codec address
|
|
|
|
*/
|
2018-06-02 11:53:50 +08:00
|
|
|
static int probe_codec(struct hdac_bus *bus, int addr)
|
2015-07-09 17:50:09 +08:00
|
|
|
{
|
|
|
|
unsigned int cmd = (addr << 28) | (AC_NODE_ROOT << 20) |
|
|
|
|
(AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID;
|
2017-04-20 18:17:02 +08:00
|
|
|
unsigned int res = -1;
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev *skl = bus_to_skl(bus);
|
2018-11-19 06:38:09 +08:00
|
|
|
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC)
|
2018-08-23 04:25:03 +08:00
|
|
|
struct hdac_hda_priv *hda_codec;
|
|
|
|
int err;
|
2018-11-19 06:38:09 +08:00
|
|
|
#endif
|
|
|
|
struct hdac_device *hdev;
|
2015-07-09 17:50:09 +08:00
|
|
|
|
|
|
|
mutex_lock(&bus->cmd_mutex);
|
|
|
|
snd_hdac_bus_send_cmd(bus, cmd);
|
|
|
|
snd_hdac_bus_get_response(bus, addr, &res);
|
|
|
|
mutex_unlock(&bus->cmd_mutex);
|
|
|
|
if (res == -1)
|
|
|
|
return -EIO;
|
2018-08-23 04:25:02 +08:00
|
|
|
dev_dbg(bus->dev, "codec #%d probed OK: %x\n", addr, res);
|
2015-07-09 17:50:09 +08:00
|
|
|
|
2018-11-19 06:38:09 +08:00
|
|
|
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC)
|
2018-08-23 04:25:03 +08:00
|
|
|
hda_codec = devm_kzalloc(&skl->pci->dev, sizeof(*hda_codec),
|
|
|
|
GFP_KERNEL);
|
|
|
|
if (!hda_codec)
|
2018-06-02 11:53:57 +08:00
|
|
|
return -ENOMEM;
|
|
|
|
|
2018-08-23 04:25:03 +08:00
|
|
|
hda_codec->codec.bus = skl_to_hbus(skl);
|
|
|
|
hdev = &hda_codec->codec.core;
|
|
|
|
|
|
|
|
err = snd_hdac_ext_bus_device_init(bus, addr, hdev);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
/* use legacy bus only for HDA codecs, idisp uses ext bus */
|
|
|
|
if ((res & 0xFFFF0000) != IDISP_INTEL_VENDOR_ID) {
|
|
|
|
hdev->type = HDA_DEV_LEGACY;
|
|
|
|
load_codec_module(&hda_codec->codec);
|
|
|
|
}
|
|
|
|
return 0;
|
2018-11-19 06:38:09 +08:00
|
|
|
#else
|
|
|
|
hdev = devm_kzalloc(&skl->pci->dev, sizeof(*hdev), GFP_KERNEL);
|
|
|
|
if (!hdev)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
return snd_hdac_ext_bus_device_init(bus, addr, hdev);
|
|
|
|
#endif /* CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC */
|
2015-07-09 17:50:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Codec initialization */
|
2018-06-02 11:53:50 +08:00
|
|
|
static void skl_codec_create(struct hdac_bus *bus)
|
2015-07-09 17:50:09 +08:00
|
|
|
{
|
|
|
|
int c, max_slots;
|
|
|
|
|
|
|
|
max_slots = HDA_MAX_CODECS;
|
|
|
|
|
|
|
|
/* First try to probe all given codec slots */
|
|
|
|
for (c = 0; c < max_slots; c++) {
|
|
|
|
if ((bus->codec_mask & (1 << c))) {
|
2018-06-02 11:53:50 +08:00
|
|
|
if (probe_codec(bus, c) < 0) {
|
2015-07-09 17:50:09 +08:00
|
|
|
/*
|
|
|
|
* Some BIOSen give you wrong codec addresses
|
|
|
|
* that don't exist
|
|
|
|
*/
|
|
|
|
dev_warn(bus->dev,
|
|
|
|
"Codec #%d probe error; disabling it...\n", c);
|
|
|
|
bus->codec_mask &= ~(1 << c);
|
|
|
|
/*
|
|
|
|
* More badly, accessing to a non-existing
|
|
|
|
* codec often screws up the controller bus,
|
|
|
|
* and disturbs the further communications.
|
|
|
|
* Thus if an error occurs during probing,
|
|
|
|
* better to reset the controller bus to get
|
|
|
|
* back to the sanity state.
|
|
|
|
*/
|
|
|
|
snd_hdac_bus_stop_chip(bus);
|
2015-12-18 17:42:03 +08:00
|
|
|
skl_init_chip(bus, true);
|
2015-07-09 17:50:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-04 16:39:10 +08:00
|
|
|
static int skl_i915_init(struct hdac_bus *bus)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The HDMI codec is in GPU so we need to ensure that it is powered
|
|
|
|
* up and ready for probe
|
|
|
|
*/
|
|
|
|
err = snd_hdac_i915_init(bus);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
2018-12-09 17:04:25 +08:00
|
|
|
snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, true);
|
2017-05-04 16:39:10 +08:00
|
|
|
|
2018-12-09 17:04:25 +08:00
|
|
|
return 0;
|
2017-05-04 16:39:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void skl_probe_work(struct work_struct *work)
|
|
|
|
{
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev *skl = container_of(work, struct skl_dev, probe_work);
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = skl_to_bus(skl);
|
2020-03-13 03:48:55 +08:00
|
|
|
struct hdac_ext_link *hlink;
|
2017-05-04 16:39:10 +08:00
|
|
|
int err;
|
|
|
|
|
|
|
|
if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
|
|
|
|
err = skl_i915_init(bus);
|
|
|
|
if (err < 0)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-03-05 22:53:08 +08:00
|
|
|
skl_init_pci(skl);
|
|
|
|
skl_dum_set(bus);
|
|
|
|
|
2017-05-04 16:39:10 +08:00
|
|
|
err = skl_init_chip(bus, true);
|
|
|
|
if (err < 0) {
|
|
|
|
dev_err(bus->dev, "Init chip failed with err: %d\n", err);
|
|
|
|
goto out_err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* codec detection */
|
|
|
|
if (!bus->codec_mask)
|
|
|
|
dev_info(bus->dev, "no hda codecs found!\n");
|
|
|
|
|
|
|
|
/* create codec instances */
|
2018-06-02 11:53:50 +08:00
|
|
|
skl_codec_create(bus);
|
2017-05-04 16:39:10 +08:00
|
|
|
|
2017-12-18 13:16:50 +08:00
|
|
|
/* register platform dai and controls */
|
|
|
|
err = skl_platform_register(bus->dev);
|
|
|
|
if (err < 0) {
|
|
|
|
dev_err(bus->dev, "platform register failed: %d\n", err);
|
2019-01-08 18:37:31 +08:00
|
|
|
goto out_err;
|
2017-12-18 13:16:50 +08:00
|
|
|
}
|
|
|
|
|
2018-12-08 07:50:06 +08:00
|
|
|
err = skl_machine_device_register(skl);
|
|
|
|
if (err < 0) {
|
|
|
|
dev_err(bus->dev, "machine register failed: %d\n", err);
|
|
|
|
goto out_err;
|
2017-12-18 13:16:50 +08:00
|
|
|
}
|
|
|
|
|
2018-11-10 03:39:23 +08:00
|
|
|
/*
|
|
|
|
* we are done probing so decrement link counts
|
|
|
|
*/
|
|
|
|
list_for_each_entry(hlink, &bus->hlink_list, list)
|
|
|
|
snd_hdac_ext_bus_link_put(bus, hlink);
|
|
|
|
|
2018-12-09 17:04:25 +08:00
|
|
|
if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
|
|
|
|
snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);
|
2017-05-04 16:39:10 +08:00
|
|
|
|
|
|
|
/* configure PM */
|
|
|
|
pm_runtime_put_noidle(bus->dev);
|
|
|
|
pm_runtime_allow(bus->dev);
|
|
|
|
skl->init_done = 1;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
out_err:
|
|
|
|
if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
|
2018-12-09 17:04:25 +08:00
|
|
|
snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);
|
2017-05-04 16:39:10 +08:00
|
|
|
}
|
|
|
|
|
2015-07-09 17:50:09 +08:00
|
|
|
/*
|
|
|
|
* constructor
|
|
|
|
*/
|
|
|
|
static int skl_create(struct pci_dev *pci,
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev **rskl)
|
2015-07-09 17:50:09 +08:00
|
|
|
{
|
2018-08-23 04:25:03 +08:00
|
|
|
struct hdac_ext_bus_ops *ext_ops = NULL;
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev *skl;
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus;
|
2018-08-23 04:25:02 +08:00
|
|
|
struct hda_bus *hbus;
|
2015-07-09 17:50:09 +08:00
|
|
|
int err;
|
|
|
|
|
|
|
|
*rskl = NULL;
|
|
|
|
|
|
|
|
err = pci_enable_device(pci);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
skl = devm_kzalloc(&pci->dev, sizeof(*skl), GFP_KERNEL);
|
|
|
|
if (!skl) {
|
|
|
|
pci_disable_device(pci);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2018-06-02 11:53:50 +08:00
|
|
|
|
2018-08-23 04:25:02 +08:00
|
|
|
hbus = skl_to_hbus(skl);
|
2018-06-02 11:53:50 +08:00
|
|
|
bus = skl_to_bus(skl);
|
2018-08-23 04:25:03 +08:00
|
|
|
|
2019-06-17 19:36:34 +08:00
|
|
|
INIT_LIST_HEAD(&skl->ppl_list);
|
|
|
|
INIT_LIST_HEAD(&skl->bind_list);
|
|
|
|
|
2018-11-19 06:38:09 +08:00
|
|
|
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC)
|
2018-08-23 04:25:03 +08:00
|
|
|
ext_ops = snd_soc_hdac_hda_get_ops();
|
|
|
|
#endif
|
2019-12-13 03:17:47 +08:00
|
|
|
snd_hdac_ext_bus_init(bus, &pci->dev, NULL, ext_ops);
|
2018-06-02 11:53:50 +08:00
|
|
|
bus->use_posbuf = 1;
|
2015-07-09 17:50:09 +08:00
|
|
|
skl->pci = pci;
|
2017-05-04 16:39:10 +08:00
|
|
|
INIT_WORK(&skl->probe_work, skl_probe_work);
|
2018-06-02 11:53:50 +08:00
|
|
|
bus->bdl_pos_adj = 0;
|
2015-07-09 17:50:09 +08:00
|
|
|
|
2018-08-23 04:25:02 +08:00
|
|
|
mutex_init(&hbus->prepare_mutex);
|
|
|
|
hbus->pci = pci;
|
|
|
|
hbus->mixer_assigned = -1;
|
|
|
|
hbus->modelname = "sklbus";
|
|
|
|
|
2015-07-09 17:50:09 +08:00
|
|
|
*rskl = skl;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
static int skl_first_init(struct hdac_bus *bus)
|
2015-07-09 17:50:09 +08:00
|
|
|
{
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev *skl = bus_to_skl(bus);
|
2015-07-09 17:50:09 +08:00
|
|
|
struct pci_dev *pci = skl->pci;
|
|
|
|
int err;
|
|
|
|
unsigned short gcap;
|
|
|
|
int cp_streams, pb_streams, start_idx;
|
|
|
|
|
|
|
|
err = pci_request_regions(pci, "Skylake HD audio");
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
bus->addr = pci_resource_start(pci, 0);
|
|
|
|
bus->remap_addr = pci_ioremap_bar(pci, 0);
|
|
|
|
if (bus->remap_addr == NULL) {
|
|
|
|
dev_err(bus->dev, "ioremap error\n");
|
|
|
|
return -ENXIO;
|
|
|
|
}
|
|
|
|
|
2016-08-04 18:16:01 +08:00
|
|
|
snd_hdac_bus_parse_capabilities(bus);
|
2015-07-09 17:50:11 +08:00
|
|
|
|
2018-12-08 07:50:05 +08:00
|
|
|
/* check if PPCAP exists */
|
|
|
|
if (!bus->ppcap) {
|
2020-08-25 04:09:12 +08:00
|
|
|
dev_err(bus->dev, "bus ppcap not set, HDAudio or DSP not present?\n");
|
2018-12-08 07:50:05 +08:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2018-09-12 05:12:46 +08:00
|
|
|
if (skl_acquire_irq(bus, 0) < 0)
|
|
|
|
return -EBUSY;
|
|
|
|
|
2015-07-09 17:50:09 +08:00
|
|
|
pci_set_master(pci);
|
2018-09-12 05:12:46 +08:00
|
|
|
synchronize_irq(bus->irq);
|
2015-07-09 17:50:09 +08:00
|
|
|
|
|
|
|
gcap = snd_hdac_chip_readw(bus, GCAP);
|
|
|
|
dev_dbg(bus->dev, "chipset global capabilities = 0x%x\n", gcap);
|
|
|
|
|
|
|
|
/* read number of streams from GCAP register */
|
|
|
|
cp_streams = (gcap >> 8) & 0x0f;
|
|
|
|
pb_streams = (gcap >> 12) & 0x0f;
|
|
|
|
|
2018-12-08 07:50:05 +08:00
|
|
|
if (!pb_streams && !cp_streams) {
|
|
|
|
dev_err(bus->dev, "no streams found in GCAP definitions?\n");
|
2015-07-09 17:50:09 +08:00
|
|
|
return -EIO;
|
2018-12-08 07:50:05 +08:00
|
|
|
}
|
2015-07-09 17:50:09 +08:00
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
bus->num_streams = cp_streams + pb_streams;
|
2015-07-09 17:50:09 +08:00
|
|
|
|
2018-12-08 07:50:05 +08:00
|
|
|
/* allow 64bit DMA address if supported by H/W */
|
|
|
|
if (!dma_set_mask(bus->dev, DMA_BIT_MASK(64))) {
|
|
|
|
dma_set_coherent_mask(bus->dev, DMA_BIT_MASK(64));
|
|
|
|
} else {
|
|
|
|
dma_set_mask(bus->dev, DMA_BIT_MASK(32));
|
|
|
|
dma_set_coherent_mask(bus->dev, DMA_BIT_MASK(32));
|
|
|
|
}
|
|
|
|
|
2015-07-09 17:50:09 +08:00
|
|
|
/* initialize streams */
|
|
|
|
snd_hdac_ext_stream_init_all
|
2018-06-02 11:53:50 +08:00
|
|
|
(bus, 0, cp_streams, SNDRV_PCM_STREAM_CAPTURE);
|
2015-07-09 17:50:09 +08:00
|
|
|
start_idx = cp_streams;
|
|
|
|
snd_hdac_ext_stream_init_all
|
2018-06-02 11:53:50 +08:00
|
|
|
(bus, start_idx, pb_streams, SNDRV_PCM_STREAM_PLAYBACK);
|
2015-07-09 17:50:09 +08:00
|
|
|
|
|
|
|
err = snd_hdac_bus_alloc_stream_pages(bus);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
2020-03-05 22:53:08 +08:00
|
|
|
return 0;
|
2015-07-09 17:50:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int skl_probe(struct pci_dev *pci,
|
|
|
|
const struct pci_device_id *pci_id)
|
|
|
|
{
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev *skl;
|
2015-07-09 17:50:09 +08:00
|
|
|
struct hdac_bus *bus = NULL;
|
|
|
|
int err;
|
|
|
|
|
2018-12-16 04:07:23 +08:00
|
|
|
switch (skl_pci_binding) {
|
|
|
|
case SND_SKL_PCI_BIND_AUTO:
|
2019-10-23 01:43:12 +08:00
|
|
|
err = snd_intel_dsp_driver_probe(pci);
|
|
|
|
if (err != SND_INTEL_DSP_DRIVER_ANY &&
|
|
|
|
err != SND_INTEL_DSP_DRIVER_SST)
|
2018-12-16 04:07:23 +08:00
|
|
|
return -ENODEV;
|
|
|
|
break;
|
|
|
|
case SND_SKL_PCI_BIND_LEGACY:
|
2020-08-25 04:09:12 +08:00
|
|
|
dev_info(&pci->dev, "Module parameter forced binding with HDAudio legacy, aborting probe\n");
|
2018-12-16 04:07:23 +08:00
|
|
|
return -ENODEV;
|
|
|
|
case SND_SKL_PCI_BIND_ASOC:
|
|
|
|
dev_info(&pci->dev, "Module parameter forced binding with SKL driver, bypassed detection logic\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
dev_err(&pci->dev, "invalid value for skl_pci_binding module parameter, ignored\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-07-09 17:50:09 +08:00
|
|
|
/* we use ext core ops, so provide NULL for ops here */
|
2019-08-08 02:32:08 +08:00
|
|
|
err = skl_create(pci, &skl);
|
2015-07-09 17:50:09 +08:00
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
bus = skl_to_bus(skl);
|
2015-07-09 17:50:09 +08:00
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
err = skl_first_init(bus);
|
2018-12-08 07:50:07 +08:00
|
|
|
if (err < 0) {
|
|
|
|
dev_err(bus->dev, "skl_first_init failed with err: %d\n", err);
|
2015-07-09 17:50:09 +08:00
|
|
|
goto out_free;
|
2018-12-08 07:50:07 +08:00
|
|
|
}
|
2015-07-09 17:50:09 +08:00
|
|
|
|
2016-02-19 14:12:34 +08:00
|
|
|
skl->pci_id = pci->device;
|
|
|
|
|
2016-06-22 22:14:19 +08:00
|
|
|
device_disable_async_suspend(bus->dev);
|
|
|
|
|
2019-07-29 23:51:50 +08:00
|
|
|
skl->nhlt = intel_nhlt_init(bus->dev);
|
2015-10-07 18:31:59 +08:00
|
|
|
|
2016-08-12 19:45:18 +08:00
|
|
|
if (skl->nhlt == NULL) {
|
2018-12-08 07:50:07 +08:00
|
|
|
#if !IS_ENABLED(CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC)
|
|
|
|
dev_err(bus->dev, "no nhlt info found\n");
|
2016-08-12 19:45:18 +08:00
|
|
|
err = -ENODEV;
|
2017-05-04 16:39:10 +08:00
|
|
|
goto out_free;
|
2018-12-08 07:50:07 +08:00
|
|
|
#else
|
2020-08-25 04:09:12 +08:00
|
|
|
dev_warn(bus->dev, "no nhlt info found, continuing to try to enable HDAudio codec\n");
|
2018-12-08 07:50:07 +08:00
|
|
|
#endif
|
|
|
|
} else {
|
2017-01-11 19:01:02 +08:00
|
|
|
|
2018-12-08 07:50:07 +08:00
|
|
|
err = skl_nhlt_create_sysfs(skl);
|
|
|
|
if (err < 0) {
|
|
|
|
dev_err(bus->dev, "skl_nhlt_create_sysfs failed with err: %d\n", err);
|
|
|
|
goto out_nhlt_free;
|
|
|
|
}
|
2016-02-19 14:12:34 +08:00
|
|
|
|
2018-12-08 07:50:07 +08:00
|
|
|
skl_nhlt_update_topology_bin(skl);
|
2015-07-09 17:50:09 +08:00
|
|
|
|
2017-11-22 20:09:46 +08:00
|
|
|
/* create device for dsp clk */
|
|
|
|
err = skl_clock_device_register(skl);
|
2018-12-08 07:50:07 +08:00
|
|
|
if (err < 0) {
|
|
|
|
dev_err(bus->dev, "skl_clock_device_register failed with err: %d\n", err);
|
2017-11-22 20:09:46 +08:00
|
|
|
goto out_clk_free;
|
2018-12-08 07:50:07 +08:00
|
|
|
}
|
|
|
|
}
|
2017-11-22 20:09:46 +08:00
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
pci_set_drvdata(skl->pci, bus);
|
2015-11-06 00:04:13 +08:00
|
|
|
|
2017-11-22 20:09:46 +08:00
|
|
|
|
2018-12-08 07:50:06 +08:00
|
|
|
err = skl_find_machine(skl, (void *)pci_id->driver_data);
|
2018-12-08 07:50:07 +08:00
|
|
|
if (err < 0) {
|
|
|
|
dev_err(bus->dev, "skl_find_machine failed with err: %d\n", err);
|
2018-12-08 07:50:06 +08:00
|
|
|
goto out_nhlt_free;
|
2018-12-08 07:50:07 +08:00
|
|
|
}
|
2015-11-06 00:04:13 +08:00
|
|
|
|
2018-12-08 07:50:06 +08:00
|
|
|
err = skl_init_dsp(skl);
|
|
|
|
if (err < 0) {
|
|
|
|
dev_dbg(bus->dev, "error failed to register dsp\n");
|
|
|
|
goto out_nhlt_free;
|
2015-07-09 17:50:11 +08:00
|
|
|
}
|
2019-07-23 22:58:48 +08:00
|
|
|
skl->enable_miscbdcge = skl_enable_miscbdcge;
|
|
|
|
skl->clock_power_gating = skl_clock_power_gating;
|
2018-12-08 07:50:06 +08:00
|
|
|
|
2016-08-04 18:16:01 +08:00
|
|
|
if (bus->mlcap)
|
2018-06-02 11:53:50 +08:00
|
|
|
snd_hdac_ext_bus_get_ml_capabilities(bus);
|
2015-07-09 17:50:11 +08:00
|
|
|
|
2015-07-09 17:50:09 +08:00
|
|
|
/* create device for soc dmic */
|
|
|
|
err = skl_dmic_device_register(skl);
|
2018-12-08 07:50:07 +08:00
|
|
|
if (err < 0) {
|
|
|
|
dev_err(bus->dev, "skl_dmic_device_register failed with err: %d\n", err);
|
2015-10-07 18:31:58 +08:00
|
|
|
goto out_dsp_free;
|
2018-12-08 07:50:07 +08:00
|
|
|
}
|
2015-07-09 17:50:09 +08:00
|
|
|
|
2017-05-04 16:39:10 +08:00
|
|
|
schedule_work(&skl->probe_work);
|
2015-07-09 17:50:09 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2015-10-07 18:31:58 +08:00
|
|
|
out_dsp_free:
|
|
|
|
skl_free_dsp(skl);
|
2017-11-22 20:09:46 +08:00
|
|
|
out_clk_free:
|
|
|
|
skl_clock_device_unregister(skl);
|
2016-05-05 13:49:19 +08:00
|
|
|
out_nhlt_free:
|
2020-03-05 22:53:11 +08:00
|
|
|
if (skl->nhlt)
|
|
|
|
intel_nhlt_free(skl->nhlt);
|
2015-07-09 17:50:09 +08:00
|
|
|
out_free:
|
2018-06-02 11:53:50 +08:00
|
|
|
skl_free(bus);
|
2015-07-09 17:50:09 +08:00
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2016-02-05 14:49:09 +08:00
|
|
|
static void skl_shutdown(struct pci_dev *pci)
|
|
|
|
{
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = pci_get_drvdata(pci);
|
2016-02-05 14:49:09 +08:00
|
|
|
struct hdac_stream *s;
|
|
|
|
struct hdac_ext_stream *stream;
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev *skl;
|
2016-02-05 14:49:09 +08:00
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
if (!bus)
|
2016-02-05 14:49:09 +08:00
|
|
|
return;
|
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
skl = bus_to_skl(bus);
|
2016-02-05 14:49:09 +08:00
|
|
|
|
2017-05-04 16:39:10 +08:00
|
|
|
if (!skl->init_done)
|
2016-02-05 14:49:09 +08:00
|
|
|
return;
|
|
|
|
|
2018-06-02 11:53:50 +08:00
|
|
|
snd_hdac_ext_stop_streams(bus);
|
2016-02-05 14:49:09 +08:00
|
|
|
list_for_each_entry(s, &bus->stream_list, list) {
|
|
|
|
stream = stream_to_hdac_ext_stream(s);
|
2018-06-02 11:53:50 +08:00
|
|
|
snd_hdac_ext_stream_decouple(bus, stream, false);
|
2016-02-05 14:49:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
snd_hdac_bus_stop_chip(bus);
|
|
|
|
}
|
|
|
|
|
2015-07-09 17:50:09 +08:00
|
|
|
static void skl_remove(struct pci_dev *pci)
|
|
|
|
{
|
2018-06-02 11:53:50 +08:00
|
|
|
struct hdac_bus *bus = pci_get_drvdata(pci);
|
2019-07-23 22:58:48 +08:00
|
|
|
struct skl_dev *skl = bus_to_skl(bus);
|
2015-07-09 17:50:09 +08:00
|
|
|
|
2019-06-17 19:36:34 +08:00
|
|
|
cancel_work_sync(&skl->probe_work);
|
2016-01-05 19:46:04 +08:00
|
|
|
|
2016-10-20 18:26:16 +08:00
|
|
|
pm_runtime_get_noresume(&pci->dev);
|
2016-03-15 19:09:24 +08:00
|
|
|
|
|
|
|
/* codec removal, invoke bus_device_remove */
|
2018-06-02 11:53:50 +08:00
|
|
|
snd_hdac_ext_bus_device_remove(bus);
|
2016-03-15 19:09:24 +08:00
|
|
|
|
2015-07-09 17:50:09 +08:00
|
|
|
skl_platform_unregister(&pci->dev);
|
2015-10-07 18:31:58 +08:00
|
|
|
skl_free_dsp(skl);
|
2015-11-06 00:04:13 +08:00
|
|
|
skl_machine_device_unregister(skl);
|
2015-07-09 17:50:09 +08:00
|
|
|
skl_dmic_device_unregister(skl);
|
2017-11-22 20:09:46 +08:00
|
|
|
skl_clock_device_unregister(skl);
|
2017-01-11 19:01:02 +08:00
|
|
|
skl_nhlt_remove_sysfs(skl);
|
2020-03-05 22:53:11 +08:00
|
|
|
if (skl->nhlt)
|
|
|
|
intel_nhlt_free(skl->nhlt);
|
2018-06-02 11:53:50 +08:00
|
|
|
skl_free(bus);
|
2015-07-09 17:50:09 +08:00
|
|
|
dev_set_drvdata(&pci->dev, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* PCI IDs */
|
|
|
|
static const struct pci_device_id skl_ids[] = {
|
2018-12-14 03:03:00 +08:00
|
|
|
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKL)
|
2015-07-09 17:50:09 +08:00
|
|
|
/* Sunrise Point-LP */
|
2015-11-06 00:04:13 +08:00
|
|
|
{ PCI_DEVICE(0x8086, 0x9d70),
|
2018-06-19 02:29:37 +08:00
|
|
|
.driver_data = (unsigned long)&snd_soc_acpi_intel_skl_machines},
|
2018-12-14 03:03:00 +08:00
|
|
|
#endif
|
|
|
|
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_APL)
|
2016-03-11 12:42:54 +08:00
|
|
|
/* BXT-P */
|
|
|
|
{ PCI_DEVICE(0x8086, 0x5a98),
|
2018-06-19 02:29:37 +08:00
|
|
|
.driver_data = (unsigned long)&snd_soc_acpi_intel_bxt_machines},
|
2018-12-14 03:03:00 +08:00
|
|
|
#endif
|
|
|
|
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_KBL)
|
2016-07-12 00:32:08 +08:00
|
|
|
/* KBL */
|
|
|
|
{ PCI_DEVICE(0x8086, 0x9D71),
|
2018-06-19 02:29:37 +08:00
|
|
|
.driver_data = (unsigned long)&snd_soc_acpi_intel_kbl_machines},
|
2018-12-14 03:03:00 +08:00
|
|
|
#endif
|
|
|
|
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_GLK)
|
2017-02-09 19:14:03 +08:00
|
|
|
/* GLK */
|
|
|
|
{ PCI_DEVICE(0x8086, 0x3198),
|
2018-06-19 02:29:37 +08:00
|
|
|
.driver_data = (unsigned long)&snd_soc_acpi_intel_glk_machines},
|
2018-12-14 03:03:00 +08:00
|
|
|
#endif
|
|
|
|
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_CNL)
|
2017-08-03 00:21:20 +08:00
|
|
|
/* CNL */
|
|
|
|
{ PCI_DEVICE(0x8086, 0x9dc8),
|
2018-06-19 02:29:37 +08:00
|
|
|
.driver_data = (unsigned long)&snd_soc_acpi_intel_cnl_machines},
|
2018-12-14 03:03:00 +08:00
|
|
|
#endif
|
|
|
|
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_CFL)
|
2018-12-08 07:50:03 +08:00
|
|
|
/* CFL */
|
|
|
|
{ PCI_DEVICE(0x8086, 0xa348),
|
|
|
|
.driver_data = (unsigned long)&snd_soc_acpi_intel_cnl_machines},
|
2019-05-11 06:39:29 +08:00
|
|
|
#endif
|
|
|
|
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_CML_LP)
|
|
|
|
/* CML-LP */
|
|
|
|
{ PCI_DEVICE(0x8086, 0x02c8),
|
|
|
|
.driver_data = (unsigned long)&snd_soc_acpi_intel_cnl_machines},
|
|
|
|
#endif
|
|
|
|
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_CML_H)
|
|
|
|
/* CML-H */
|
|
|
|
{ PCI_DEVICE(0x8086, 0x06c8),
|
|
|
|
.driver_data = (unsigned long)&snd_soc_acpi_intel_cnl_machines},
|
2018-12-14 03:03:00 +08:00
|
|
|
#endif
|
2015-07-09 17:50:09 +08:00
|
|
|
{ 0, }
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(pci, skl_ids);
|
|
|
|
|
|
|
|
/* pci_driver definition */
|
|
|
|
static struct pci_driver skl_driver = {
|
|
|
|
.name = KBUILD_MODNAME,
|
|
|
|
.id_table = skl_ids,
|
|
|
|
.probe = skl_probe,
|
|
|
|
.remove = skl_remove,
|
2016-02-05 14:49:09 +08:00
|
|
|
.shutdown = skl_shutdown,
|
2015-07-09 17:50:09 +08:00
|
|
|
.driver = {
|
|
|
|
.pm = &skl_pm,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
module_pci_driver(skl_driver);
|
|
|
|
|
|
|
|
MODULE_LICENSE("GPL v2");
|
|
|
|
MODULE_DESCRIPTION("Intel Skylake ASoC HDA driver");
|