]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Merge remote-tracking branch 'asoc/fix/intel' into asoc-linus
authorMark Brown <broonie@kernel.org>
Fri, 4 Nov 2016 18:33:45 +0000 (12:33 -0600)
committerMark Brown <broonie@kernel.org>
Fri, 4 Nov 2016 18:33:45 +0000 (12:33 -0600)
1  2 
sound/soc/intel/Kconfig
sound/soc/intel/atom/sst/sst_acpi.c
sound/soc/intel/boards/bxt_da7219_max98357a.c
sound/soc/intel/skylake/skl.c

diff --combined sound/soc/intel/Kconfig
index 26eb5a0a55754c43f94afe8a3403982b408d3e2b,54dec9161cefcd3e70bf086269b017cfd1b48fb4..fd5d1e0910382e94233702094658b6b868c71b83
@@@ -25,7 -25,6 +25,7 @@@ config SND_SST_IPC_ACP
        tristate
        select SND_SST_IPC
        select SND_SOC_INTEL_SST
 +      select IOSF_MBI
  
  config SND_SOC_INTEL_SST
        tristate
@@@ -47,6 -46,7 +47,7 @@@ config SND_SOC_INTEL_SST_MATC
  
  config SND_SOC_INTEL_HASWELL
        tristate
+       select SND_SOC_INTEL_SST_FIRMWARE
  
  config SND_SOC_INTEL_BAYTRAIL
        tristate
@@@ -56,7 -56,6 +57,6 @@@ config SND_SOC_INTEL_HASWELL_MAC
        depends on X86_INTEL_LPSS && I2C && I2C_DESIGNWARE_PLATFORM
        depends on DW_DMAC_CORE
        select SND_SOC_INTEL_SST
-       select SND_SOC_INTEL_SST_FIRMWARE
        select SND_SOC_INTEL_HASWELL
        select SND_SOC_RT5640
        help
@@@ -121,24 -120,12 +121,23 @@@ config SND_SOC_INTEL_BYT_MAX98090_MAC
          This adds audio driver for Intel Baytrail platform based boards
          with the MAX98090 audio codec.
  
 +config SND_SOC_INTEL_BDW_RT5677_MACH
 +      tristate "ASoC Audio driver for Intel Broadwell with RT5677 codec"
 +      depends on X86_INTEL_LPSS && GPIOLIB && I2C && DW_DMAC
 +      depends on DW_DMAC_CORE=y
 +      select SND_SOC_INTEL_SST
 +      select SND_SOC_INTEL_HASWELL
 +      select SND_SOC_RT5677
 +      help
 +        This adds support for Intel Broadwell platform based boards with
 +        the RT5677 audio codec.
 +
  config SND_SOC_INTEL_BROADWELL_MACH
        tristate "ASoC Audio DSP support for Intel Broadwell Wildcatpoint"
        depends on X86_INTEL_LPSS && I2C && DW_DMAC && \
                   I2C_DESIGNWARE_PLATFORM
        depends on DW_DMAC_CORE
        select SND_SOC_INTEL_SST
-       select SND_SOC_INTEL_SST_FIRMWARE
        select SND_SOC_INTEL_HASWELL
        select SND_SOC_RT286
        help
index ba5c0d71720ab8548fddbb42cd79dd90c869abab,748a0f68fc6cd38b0f8a3c0bc56e04f58d304264..0a88537ca58a19c9c47df036c6cd95e7d2701837
@@@ -39,8 -39,6 +39,8 @@@
  #include <acpi/platform/aclinux.h>
  #include <acpi/actypes.h>
  #include <acpi/acpi_bus.h>
 +#include <asm/cpu_device_id.h>
 +#include <asm/iosf_mbi.h>
  #include "../sst-mfld-platform.h"
  #include "../../common/sst-dsp.h"
  #include "../../common/sst-acpi.h"
@@@ -115,28 -113,6 +115,28 @@@ static const struct sst_res_info byt_rv
        .acpi_ipc_irq_index = 5,
  };
  
 +/* BYTCR has different BIOS from BYT */
 +static const struct sst_res_info bytcr_res_info = {
 +      .shim_offset = 0x140000,
 +      .shim_size = 0x000100,
 +      .shim_phy_addr = SST_BYT_SHIM_PHY_ADDR,
 +      .ssp0_offset = 0xa0000,
 +      .ssp0_size = 0x1000,
 +      .dma0_offset = 0x98000,
 +      .dma0_size = 0x4000,
 +      .dma1_offset = 0x9c000,
 +      .dma1_size = 0x4000,
 +      .iram_offset = 0x0c0000,
 +      .iram_size = 0x14000,
 +      .dram_offset = 0x100000,
 +      .dram_size = 0x28000,
 +      .mbox_offset = 0x144000,
 +      .mbox_size = 0x1000,
 +      .acpi_lpe_res_index = 0,
 +      .acpi_ddr_index = 2,
 +      .acpi_ipc_irq_index = 0
 +};
 +
  static struct sst_platform_info byt_rvp_platform_data = {
        .probe_data = &byt_fwparse_info,
        .ipc_info = &byt_ipc_info,
@@@ -166,7 -142,7 +166,7 @@@ static int sst_platform_get_resources(s
        rsrc = platform_get_resource(pdev, IORESOURCE_MEM,
                                        ctx->pdata->res_info->acpi_lpe_res_index);
        if (!rsrc) {
 -              dev_err(ctx->dev, "Invalid SHIM base from IFWI");
 +              dev_err(ctx->dev, "Invalid SHIM base from IFWI\n");
                return -EIO;
        }
        dev_info(ctx->dev, "LPE base: %#x size:%#x", (unsigned int) rsrc->start,
        ctx->iram = devm_ioremap_nocache(ctx->dev, ctx->iram_base,
                                         ctx->pdata->res_info->iram_size);
        if (!ctx->iram) {
 -              dev_err(ctx->dev, "unable to map IRAM");
 +              dev_err(ctx->dev, "unable to map IRAM\n");
                return -EIO;
        }
  
        ctx->dram = devm_ioremap_nocache(ctx->dev, ctx->dram_base,
                                         ctx->pdata->res_info->dram_size);
        if (!ctx->dram) {
 -              dev_err(ctx->dev, "unable to map DRAM");
 +              dev_err(ctx->dev, "unable to map DRAM\n");
                return -EIO;
        }
  
        ctx->shim = devm_ioremap_nocache(ctx->dev, ctx->shim_phy_add,
                                        ctx->pdata->res_info->shim_size);
        if (!ctx->shim) {
 -              dev_err(ctx->dev, "unable to map SHIM");
 +              dev_err(ctx->dev, "unable to map SHIM\n");
                return -EIO;
        }
  
        ctx->mailbox = devm_ioremap_nocache(ctx->dev, ctx->mailbox_add,
                                            ctx->pdata->res_info->mbox_size);
        if (!ctx->mailbox) {
 -              dev_err(ctx->dev, "unable to map mailbox");
 +              dev_err(ctx->dev, "unable to map mailbox\n");
                return -EIO;
        }
  
        rsrc = platform_get_resource(pdev, IORESOURCE_MEM,
                                        ctx->pdata->res_info->acpi_ddr_index);
        if (!rsrc) {
 -              dev_err(ctx->dev, "Invalid DDR base from IFWI");
 +              dev_err(ctx->dev, "Invalid DDR base from IFWI\n");
                return -EIO;
        }
        ctx->ddr_base = rsrc->start;
        ctx->ddr = devm_ioremap_nocache(ctx->dev, ctx->ddr_base,
                                        resource_size(rsrc));
        if (!ctx->ddr) {
 -              dev_err(ctx->dev, "unable to map DDR");
 +              dev_err(ctx->dev, "unable to map DDR\n");
                return -EIO;
        }
  
        return 0;
  }
  
 +
 +static int is_byt_cr(struct device *dev, bool *bytcr)
 +{
 +      int status = 0;
 +
 +      if (IS_ENABLED(CONFIG_IOSF_MBI)) {
 +              static const struct x86_cpu_id cpu_ids[] = {
 +                      { X86_VENDOR_INTEL, 6, 55 }, /* Valleyview, Bay Trail */
 +                      {}
 +              };
 +              u32 bios_status;
 +
 +              if (!x86_match_cpu(cpu_ids) || !iosf_mbi_available()) {
 +                      /* bail silently */
 +                      return status;
 +              }
 +
 +              status = iosf_mbi_read(BT_MBI_UNIT_PMC, /* 0x04 PUNIT */
 +                                     MBI_REG_READ, /* 0x10 */
 +                                     0x006, /* BIOS_CONFIG */
 +                                     &bios_status);
 +
 +              if (status) {
 +                      dev_err(dev, "could not read PUNIT BIOS_CONFIG\n");
 +              } else {
 +                      /* bits 26:27 mirror PMIC options */
 +                      bios_status = (bios_status >> 26) & 3;
 +
 +                      if ((bios_status == 1) || (bios_status == 3))
 +                              *bytcr = true;
 +                      else
 +                              dev_info(dev, "BYT-CR not detected\n");
 +              }
 +      } else {
 +              dev_info(dev, "IOSF_MBI not enabled, no BYT-CR detection\n");
 +      }
 +      return status;
 +}
 +
 +
  static int sst_acpi_probe(struct platform_device *pdev)
  {
        struct device *dev = &pdev->dev;
        struct platform_device *plat_dev;
        struct sst_platform_info *pdata;
        unsigned int dev_id;
 +      bool bytcr = false;
  
        id = acpi_match_device(dev->driver->acpi_match_table, dev);
        if (!id)
                return -ENODEV;
 -      dev_dbg(dev, "for %s", id->id);
 +      dev_dbg(dev, "for %s\n", id->id);
  
        mach = (struct sst_acpi_mach *)id->driver_data;
        mach = sst_acpi_find_machine(mach);
  
        dev_dbg(dev, "ACPI device id: %x\n", dev_id);
  
 +      ret = sst_alloc_drv_context(&ctx, dev, dev_id);
 +      if (ret < 0)
 +              return ret;
 +
 +      ret = is_byt_cr(dev, &bytcr);
 +      if (!((ret < 0) || (bytcr == false))) {
 +              dev_info(dev, "Detected Baytrail-CR platform\n");
 +
 +              /* override resource info */
 +              byt_rvp_platform_data.res_info = &bytcr_res_info;
 +      }
 +
        plat_dev = platform_device_register_data(dev, pdata->platform, -1,
                                                NULL, 0);
        if (IS_ERR(plat_dev)) {
                return PTR_ERR(mdev);
        }
  
 -      ret = sst_alloc_drv_context(&ctx, dev, dev_id);
 -      if (ret < 0)
 -              return ret;
 -
        /* Fill sst platform data */
        ctx->pdata = pdata;
        strcpy(ctx->firmware_name, mach->fw_filename);
@@@ -416,6 -343,7 +416,7 @@@ static const struct dmi_system_id cht_t
                        DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
                },
        },
+       { }
  };
  
  
index 6532b8f0ab2fc475f09116d24dcf316170ce5618,2c93fa26e13b8f5b594453d7e0b9a4a7fd34540e..865a21e557cce330508ceee677c16f82359087ee
@@@ -37,7 -37,6 +37,7 @@@ enum 
        BXT_DPCM_AUDIO_PB = 0,
        BXT_DPCM_AUDIO_CP,
        BXT_DPCM_AUDIO_REF_CP,
 +      BXT_DPCM_AUDIO_DMIC_CP,
        BXT_DPCM_AUDIO_HDMI1_PB,
        BXT_DPCM_AUDIO_HDMI2_PB,
        BXT_DPCM_AUDIO_HDMI3_PB,
@@@ -130,8 -129,8 +130,8 @@@ static int broxton_da7219_codec_init(st
         */
        ret = snd_soc_card_jack_new(rtd->card, "Headset Jack",
                        SND_JACK_HEADSET | SND_JACK_BTN_0 | SND_JACK_BTN_1 |
-                       SND_JACK_BTN_2 | SND_JACK_BTN_3, &broxton_headset,
-                       NULL, 0);
+                       SND_JACK_BTN_2 | SND_JACK_BTN_3 | SND_JACK_LINEOUT,
+                       &broxton_headset, NULL, 0);
        if (ret) {
                dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
                return ret;
@@@ -253,56 -252,10 +253,56 @@@ static struct snd_soc_ops broxton_da721
        .hw_free = broxton_da7219_hw_free,
  };
  
 +static int broxton_dmic_fixup(struct snd_soc_pcm_runtime *rtd,
 +                      struct snd_pcm_hw_params *params)
 +{
 +      struct snd_interval *channels = hw_param_interval(params,
 +                                              SNDRV_PCM_HW_PARAM_CHANNELS);
 +      channels->min = channels->max = DUAL_CHANNEL;
 +
 +      return 0;
 +}
 +
 +static int broxton_dmic_startup(struct snd_pcm_substream *substream)
 +{
 +      struct snd_pcm_runtime *runtime = substream->runtime;
 +
 +      runtime->hw.channels_max = DUAL_CHANNEL;
 +      snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
 +                      &constraints_channels);
 +
 +      return snd_pcm_hw_constraint_list(substream->runtime, 0,
 +                      SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
 +}
 +
 +static const struct snd_soc_ops broxton_dmic_ops = {
 +      .startup = broxton_dmic_startup,
 +};
 +
 +static const unsigned int rates_16000[] = {
 +      16000,
 +};
 +
 +static const struct snd_pcm_hw_constraint_list constraints_16000 = {
 +      .count = ARRAY_SIZE(rates_16000),
 +      .list  = rates_16000,
 +};
 +
 +static int broxton_refcap_startup(struct snd_pcm_substream *substream)
 +{
 +      return snd_pcm_hw_constraint_list(substream->runtime, 0,
 +                      SNDRV_PCM_HW_PARAM_RATE,
 +                      &constraints_16000);
 +};
 +
 +static struct snd_soc_ops broxton_refcap_ops = {
 +      .startup = broxton_refcap_startup,
 +};
 +
  /* broxton digital audio interface glue - connects codec <--> CPU */
  static struct snd_soc_dai_link broxton_dais[] = {
        /* Front End DAI links */
 -      [BXT_DPCM_AUDIO_PB]
 +      [BXT_DPCM_AUDIO_PB] =
        {
                .name = "Bxt Audio Port",
                .stream_name = "Audio",
                .dpcm_playback = 1,
                .ops = &broxton_da7219_fe_ops,
        },
 -      [BXT_DPCM_AUDIO_CP]
 +      [BXT_DPCM_AUDIO_CP] =
        {
                .name = "Bxt Audio Capture Port",
                .stream_name = "Audio Record",
                .dpcm_capture = 1,
                .ops = &broxton_da7219_fe_ops,
        },
 -      [BXT_DPCM_AUDIO_REF_CP]
 +      [BXT_DPCM_AUDIO_REF_CP] =
        {
                .name = "Bxt Audio Reference cap",
                .stream_name = "Refcap",
                .ignore_suspend = 1,
                .nonatomic = 1,
                .dynamic = 1,
 +              .ops = &broxton_refcap_ops,
 +      },
 +      [BXT_DPCM_AUDIO_DMIC_CP]
 +      {
 +              .name = "Bxt Audio DMIC cap",
 +              .stream_name = "dmiccap",
 +              .cpu_dai_name = "DMIC Pin",
 +              .codec_name = "snd-soc-dummy",
 +              .codec_dai_name = "snd-soc-dummy-dai",
 +              .platform_name = "0000:00:0e.0",
 +              .init = NULL,
 +              .dpcm_capture = 1,
 +              .nonatomic = 1,
 +              .dynamic = 1,
 +              .ops = &broxton_dmic_ops,
        },
 -      [BXT_DPCM_AUDIO_HDMI1_PB]
 +      [BXT_DPCM_AUDIO_HDMI1_PB] =
        {
                .name = "Bxt HDMI Port1",
                .stream_name = "Hdmi1",
                .nonatomic = 1,
                .dynamic = 1,
        },
 -      [BXT_DPCM_AUDIO_HDMI2_PB]
 +      [BXT_DPCM_AUDIO_HDMI2_PB] =
        {
                .name = "Bxt HDMI Port2",
                .stream_name = "Hdmi2",
                .nonatomic = 1,
                .dynamic = 1,
        },
 -      [BXT_DPCM_AUDIO_HDMI3_PB]
 +      [BXT_DPCM_AUDIO_HDMI3_PB] =
        {
                .name = "Bxt HDMI Port3",
                .stream_name = "Hdmi3",
                .codec_dai_name = "dmic-hifi",
                .platform_name = "0000:00:0e.0",
                .ignore_suspend = 1,
 +              .be_hw_params_fixup = broxton_dmic_fixup,
                .dpcm_capture = 1,
                .no_pcm = 1,
        },
index 2989c164dafe3a719ed219d2f47ddf73a20ea64d,3fc30cbe83c1006c6474fb9bb3552158fc0d7728..06fa5e85dd0e0177f6e886065e23060a87a958fa
@@@ -587,7 -587,7 +587,7 @@@ static int skl_first_init(struct hdac_e
                return -ENXIO;
        }
  
 -      snd_hdac_ext_bus_parse_capabilities(ebus);
 +      snd_hdac_bus_parse_capabilities(bus);
  
        if (skl_acquire_irq(ebus, 0) < 0)
                return -EBUSY;
@@@ -674,7 -674,7 +674,7 @@@ static int skl_probe(struct pci_dev *pc
  
        if (skl->nhlt == NULL) {
                err = -ENODEV;
-               goto out_free;
+               goto out_display_power_off;
        }
  
        skl_nhlt_update_topology_bin(skl);
        skl_dmic_data.dmic_num = skl_get_dmic_geo(skl);
  
        /* check if dsp is there */
 -      if (ebus->ppcap) {
 +      if (bus->ppcap) {
                err = skl_machine_device_register(skl,
                                  (void *)pci_id->driver_data);
                if (err < 0)
                skl->skl_sst->enable_miscbdcge = skl_enable_miscbdcge;
  
        }
 -      if (ebus->mlcap)
 +      if (bus->mlcap)
                snd_hdac_ext_bus_get_ml_capabilities(ebus);
  
        /* create device for soc dmic */
@@@ -746,6 -746,9 +746,9 @@@ out_mach_free
        skl_machine_device_unregister(skl);
  out_nhlt_free:
        skl_nhlt_free(skl->nhlt);
+ out_display_power_off:
+       if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI))
+               snd_hdac_display_power(bus, false);
  out_free:
        skl->init_failed = 1;
        skl_free(ebus);
@@@ -785,8 -788,7 +788,7 @@@ static void skl_remove(struct pci_dev *
  
        release_firmware(skl->tplg);
  
-       if (pci_dev_run_wake(pci))
-               pm_runtime_get_noresume(&pci->dev);
+       pm_runtime_get_noresume(&pci->dev);
  
        /* codec removal, invoke bus_device_remove */
        snd_hdac_ext_bus_device_remove(ebus);