Merge branch 'asoc-5.2' into asoc-linus
authorMark Brown <broonie@kernel.org>
Sat, 6 Jul 2019 11:25:24 +0000 (12:25 +0100)
committerMark Brown <broonie@kernel.org>
Sat, 6 Jul 2019 11:25:24 +0000 (12:25 +0100)
1  2 
sound/soc/codecs/ad193x.c
sound/soc/codecs/hdac_hdmi.c
sound/soc/codecs/nau8825.c
sound/soc/codecs/nau8825.h
sound/soc/intel/skylake/skl.c
sound/soc/intel/skylake/skl.h
sound/soc/soc-dapm.c
sound/soc/ti/davinci-mcasp.c
sound/soc/ti/omap-mcbsp.c

@@@ -1,8 -1,9 +1,8 @@@
 +// SPDX-License-Identifier: GPL-2.0-or-later
  /*
   * AD193X Audio Codec driver supporting AD1936/7/8/9
   *
   * Copyright 2010 Analog Devices Inc.
 - *
 - * Licensed under the GPL-2 or later.
   */
  
  #include <linux/module.h>
@@@ -240,10 -241,8 +240,8 @@@ static int ad193x_set_dai_fmt(struct sn
        }
  
        /* For DSP_*, LRCLK's polarity must be inverted */
-       if (fmt & SND_SOC_DAIFMT_DSP_A) {
-               change_bit(ffs(AD193X_DAC_LEFT_HIGH) - 1,
-                          (unsigned long *)&dac_fmt);
-       }
+       if (fmt & SND_SOC_DAIFMT_DSP_A)
+               dac_fmt ^= AD193X_DAC_LEFT_HIGH;
  
        switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
        case SND_SOC_DAIFMT_CBM_CFM: /* codec clk & frm master */
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   *  hdac_hdmi.c - ASoc HDA-HDMI codec driver for Intel platforms
   *
@@@ -7,6 -6,15 +7,6 @@@
   *        Subhransu S. Prusty <subhransu.s.prusty@intel.com>
   *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   *
 - *  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; version 2 of the License.
 - *
 - *  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/init.h>
@@@ -538,6 -546,29 +538,29 @@@ static struct hdac_hdmi_port *hdac_hdmi
        return NULL;
  }
  
+ /*
+  * Go through all converters and ensure connection is set to
+  * the correct pin as set via kcontrols.
+  */
+ static void hdac_hdmi_verify_connect_sel_all_pins(struct hdac_device *hdev)
+ {
+       struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
+       struct hdac_hdmi_port *port;
+       struct hdac_hdmi_cvt *cvt;
+       int cvt_idx = 0;
+       list_for_each_entry(cvt, &hdmi->cvt_list, head) {
+               port = hdac_hdmi_get_port_from_cvt(hdev, hdmi, cvt);
+               if (port && port->pin) {
+                       snd_hdac_codec_write(hdev, port->pin->nid, 0,
+                                            AC_VERB_SET_CONNECT_SEL, cvt_idx);
+                       dev_dbg(&hdev->dev, "%s: %s set connect %d -> %d\n",
+                               __func__, cvt->name, port->pin->nid, cvt_idx);
+               }
+               ++cvt_idx;
+       }
+ }
  /*
   * This tries to get a valid pin and set the HW constraints based on the
   * ELD. Even if a valid pin is not found return success so that device open
@@@ -798,6 -829,14 +821,14 @@@ static int hdac_hdmi_cvt_output_widget_
                                AC_VERB_SET_CHANNEL_STREAMID, pcm->stream_tag);
                snd_hdac_codec_write(hdev, cvt->nid, 0,
                                AC_VERB_SET_STREAM_FORMAT, pcm->format);
+               /*
+                * The connection indices are shared by all converters and
+                * may interfere with each other. Ensure correct
+                * routing for all converters at stream start.
+                */
+               hdac_hdmi_verify_connect_sel_all_pins(hdev);
                break;
  
        case SND_SOC_DAPM_POST_PMD:
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   * Nuvoton NAU8825 audio codec driver
   *
@@@ -6,6 -5,8 +6,6 @@@
   *  Author: Anatol Pomozov <anatol@chromium.org>
   * Copyright 2015 Nuvoton Technology Corp.
   *  Co-author: Meng-Huang Kuo <mhkuo@nuvoton.com>
 - *
 - * Licensed under the GPL-2.
   */
  
  #include <linux/module.h>
@@@ -1880,6 -1881,10 +1880,10 @@@ static void nau8825_init_regs(struct na
                NAU8825_JACK_EJECT_DEBOUNCE_MASK,
                nau8825->jack_eject_debounce << NAU8825_JACK_EJECT_DEBOUNCE_SFT);
  
+       /* Pull up IRQ pin */
+       regmap_update_bits(regmap, NAU8825_REG_INTERRUPT_MASK,
+               NAU8825_IRQ_PIN_PULLUP | NAU8825_IRQ_PIN_PULL_EN,
+               NAU8825_IRQ_PIN_PULLUP | NAU8825_IRQ_PIN_PULL_EN);
        /* Mask unneeded IRQs: 1 - disable, 0 - enable */
        regmap_update_bits(regmap, NAU8825_REG_INTERRUPT_MASK, 0x7ff, 0x7ff);
  
@@@ -1,9 -1,12 +1,9 @@@
 +/* SPDX-License-Identifier: GPL-2.0-only */
  /*
   * NAU8825 ALSA SoC audio driver
   *
   * Copyright 2015 Google Inc.
   * Author: Anatol Pomozov <anatol.pomozov@chrominium.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.
   */
  
  #ifndef __NAU8825_H__
  #define NAU8825_JACK_POLARITY (1 << 1) /* 0 - active low, 1 - active high */
  
  /* INTERRUPT_MASK (0xf) */
+ #define NAU8825_IRQ_PIN_PULLUP (1 << 14)
+ #define NAU8825_IRQ_PIN_PULL_EN (1 << 13)
  #define NAU8825_IRQ_OUTPUT_EN (1 << 11)
  #define NAU8825_IRQ_HEADSET_COMPLETE_EN (1 << 10)
  #define NAU8825_IRQ_RMS_EN (1 << 8)
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   *  skl.c - Implementation of ASoC Intel SKL HD Audio driver
   *
@@@ -10,6 -9,15 +10,6 @@@
   *                     PeiSen Hou <pshou@realtek.com.tw>
   *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   *
 - *  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; version 2 of the License.
 - *
 - *  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.
 - *
   * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   */
  
@@@ -184,6 -192,25 +184,25 @@@ void skl_update_d0i3c(struct device *de
                        snd_hdac_chip_readb(bus, VS_D0I3C));
  }
  
+ /**
+  * 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);
+ }
  /* called from IRQ */
  static void skl_stream_update(struct hdac_bus *bus, struct hdac_stream *hstr)
  {
@@@ -291,6 -318,7 +310,7 @@@ static int _skl_resume(struct hdac_bus 
        struct skl *skl = bus_to_skl(bus);
  
        skl_init_pci(skl);
+       skl_dum_set(bus);
        skl_init_chip(bus, true);
  
        return skl_resume_dsp(skl);
@@@ -948,6 -976,7 +968,7 @@@ static int skl_first_init(struct hdac_b
  
        /* initialize chip */
        skl_init_pci(skl);
+       skl_dum_set(bus);
  
        return skl_init_chip(bus, true);
  }
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0-only */
  /*
   *  skl.h - HD Audio skylake defintions.
   *
@@@ -6,7 -5,17 +6,7 @@@
   *  Author: Jeeja KP <jeeja.kp@intel.com>
   *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   *
 - *  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; version 2 of the License.
 - *
 - *  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.
 - *
   * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 - *
   */
  
  #ifndef __SOUND_SOC_SKL_H
@@@ -37,6 -46,7 +37,7 @@@
  #define DMA_TRANSMITION_START 2
  #define DMA_TRANSMITION_STOP  3
  
+ #define AZX_VS_EM2_DUM                        BIT(23)
  #define AZX_REG_VS_EM2_L1SEN          BIT(13)
  
  struct skl_dsp_resource {
diff --combined sound/soc/soc-dapm.c
@@@ -883,7 -883,6 +883,7 @@@ static int dapm_create_or_share_kcontro
                        case snd_soc_dapm_switch:
                        case snd_soc_dapm_mixer:
                        case snd_soc_dapm_pga:
 +                      case snd_soc_dapm_effect:
                        case snd_soc_dapm_out_drv:
                                wname_in_long_name = true;
                                kcname_in_long_name = true;
@@@ -2155,23 -2154,25 +2155,25 @@@ void snd_soc_dapm_debugfs_init(struct s
  {
        struct dentry *d;
  
-       if (!parent)
+       if (!parent || IS_ERR(parent))
                return;
  
        dapm->debugfs_dapm = debugfs_create_dir("dapm", parent);
  
-       if (!dapm->debugfs_dapm) {
+       if (IS_ERR(dapm->debugfs_dapm)) {
                dev_warn(dapm->dev,
-                      "ASoC: Failed to create DAPM debugfs directory\n");
+                        "ASoC: Failed to create DAPM debugfs directory %ld\n",
+                        PTR_ERR(dapm->debugfs_dapm));
                return;
        }
  
        d = debugfs_create_file("bias_level", 0444,
                                dapm->debugfs_dapm, dapm,
                                &dapm_bias_fops);
-       if (!d)
+       if (IS_ERR(d))
                dev_warn(dapm->dev,
-                        "ASoC: Failed to create bias level debugfs file\n");
+                        "ASoC: Failed to create bias level debugfs file: %ld\n",
+                        PTR_ERR(d));
  }
  
  static void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w)
        d = debugfs_create_file(w->name, 0444,
                                dapm->debugfs_dapm, w,
                                &dapm_widget_power_fops);
-       if (!d)
+       if (IS_ERR(d))
                dev_warn(w->dapm->dev,
-                       "ASoC: Failed to create %s debugfs file\n",
-                       w->name);
+                        "ASoC: Failed to create %s debugfs file: %ld\n",
+                        w->name, PTR_ERR(d));
  }
  
  static void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm)
@@@ -2374,7 -2375,6 +2376,7 @@@ static ssize_t dapm_widget_show_compone
                case snd_soc_dapm_dac:
                case snd_soc_dapm_adc:
                case snd_soc_dapm_pga:
 +              case snd_soc_dapm_effect:
                case snd_soc_dapm_out_drv:
                case snd_soc_dapm_mixer:
                case snd_soc_dapm_mixer_named_ctl:
@@@ -3202,7 -3202,6 +3204,7 @@@ int snd_soc_dapm_new_widgets(struct snd
                        dapm_new_mux(w);
                        break;
                case snd_soc_dapm_pga:
 +              case snd_soc_dapm_effect:
                case snd_soc_dapm_out_drv:
                        dapm_new_pga(w);
                        break;
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   * ALSA SoC McASP Audio Layer for TI DAVINCI processor
   *
@@@ -10,6 -9,10 +10,6 @@@
   *
   * Copyright:   (C) 2009 MontaVista Software, Inc., <source@mvista.com>
   * Copyright:   (C) 2009  Texas Instruments, India
 - *
 - * 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.
   */
  
  #include <linux/init.h>
@@@ -2234,7 -2237,7 +2234,7 @@@ static int davinci_mcasp_probe(struct p
                ret = edma_pcm_platform_register(&pdev->dev);
                break;
        case PCM_SDMA:
-               ret = sdma_pcm_platform_register(&pdev->dev, NULL, NULL);
+               ret = sdma_pcm_platform_register(&pdev->dev, "tx", "rx");
                break;
        default:
                dev_err(&pdev->dev, "No DMA controller found (%d)\n", ret);
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   * omap-mcbsp.c  --  OMAP ALSA SoC DAI driver using McBSP port
   *
@@@ -6,6 -5,21 +6,6 @@@
   *
   * Contact: Jarkko Nikula <jarkko.nikula@bitmer.com>
   *          Peter Ujfalusi <peter.ujfalusi@ti.com>
 - *
 - * 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.
 - *
 - * You should have received a copy of the GNU General Public License
 - * along with this program; if not, write to the Free Software
 - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 - * 02110-1301 USA
 - *
   */
  
  #include <linux/init.h>
@@@ -1424,7 -1438,7 +1424,7 @@@ static int asoc_mcbsp_probe(struct plat
        if (ret)
                return ret;
  
-       return sdma_pcm_platform_register(&pdev->dev, NULL, NULL);
+       return sdma_pcm_platform_register(&pdev->dev, "tx", "rx");
  }
  
  static int asoc_mcbsp_remove(struct platform_device *pdev)