Merge branch 'asoc-4.19' into asoc-4.20 for rt5682 deps.
authorMark Brown <broonie@kernel.org>
Tue, 18 Sep 2018 17:30:14 +0000 (10:30 -0700)
committerMark Brown <broonie@kernel.org>
Tue, 18 Sep 2018 17:30:14 +0000 (10:30 -0700)
include/sound/hdaudio.h
sound/hda/hdac_controller.c
sound/soc/codecs/rt5514-spi.c
sound/soc/codecs/rt5682.c
sound/soc/intel/skylake/skl.c

index 6f1e1f3b30633927283a0bbf09df6fa4418c2f28..cd1773d0e08f07247a42788a035a0355da113493 100644 (file)
@@ -412,6 +412,7 @@ void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus);
 void snd_hdac_bus_stop_cmd_io(struct hdac_bus *bus);
 void snd_hdac_bus_enter_link_reset(struct hdac_bus *bus);
 void snd_hdac_bus_exit_link_reset(struct hdac_bus *bus);
+int snd_hdac_bus_reset_link(struct hdac_bus *bus, bool full_reset);
 
 void snd_hdac_bus_update_rirb(struct hdac_bus *bus);
 int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
index 560ec0986e1a56d46d9a5c7814cf4175a469249f..74244d8e2909090cfb3bfc54c57c9591332decdd 100644 (file)
@@ -40,6 +40,8 @@ static void azx_clear_corbrp(struct hdac_bus *bus)
  */
 void snd_hdac_bus_init_cmd_io(struct hdac_bus *bus)
 {
+       WARN_ON_ONCE(!bus->rb.area);
+
        spin_lock_irq(&bus->reg_lock);
        /* CORB set up */
        bus->corb.addr = bus->rb.addr;
@@ -383,7 +385,7 @@ void snd_hdac_bus_exit_link_reset(struct hdac_bus *bus)
 EXPORT_SYMBOL_GPL(snd_hdac_bus_exit_link_reset);
 
 /* reset codec link */
-static int azx_reset(struct hdac_bus *bus, bool full_reset)
+int snd_hdac_bus_reset_link(struct hdac_bus *bus, bool full_reset)
 {
        if (!full_reset)
                goto skip_reset;
@@ -408,7 +410,7 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset)
  skip_reset:
        /* check to see if controller is ready */
        if (!snd_hdac_chip_readb(bus, GCTL)) {
-               dev_dbg(bus->dev, "azx_reset: controller not ready!\n");
+               dev_dbg(bus->dev, "controller not ready!\n");
                return -EBUSY;
        }
 
@@ -423,6 +425,7 @@ static int azx_reset(struct hdac_bus *bus, bool full_reset)
 
        return 0;
 }
+EXPORT_SYMBOL_GPL(snd_hdac_bus_reset_link);
 
 /* enable interrupts */
 static void azx_int_enable(struct hdac_bus *bus)
@@ -477,15 +480,17 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)
                return false;
 
        /* reset controller */
-       azx_reset(bus, full_reset);
+       snd_hdac_bus_reset_link(bus, full_reset);
 
-       /* initialize interrupts */
+       /* clear interrupts */
        azx_int_clear(bus);
-       azx_int_enable(bus);
 
        /* initialize the codec command I/O */
        snd_hdac_bus_init_cmd_io(bus);
 
+       /* enable interrupts after CORB/RIRB buffers are initialized above */
+       azx_int_enable(bus);
+
        /* program the position buffer */
        if (bus->use_posbuf && bus->posbuf.addr) {
                snd_hdac_chip_writel(bus, DPLBASE, (u32)bus->posbuf.addr);
index 6478d10c4f4af3e055666ce1095b22086033d847..4d46f4567c3a8c69cab55ca45ab1bbbc686b8945 100644 (file)
@@ -91,6 +91,14 @@ static void rt5514_spi_copy_work(struct work_struct *work)
 
        runtime = rt5514_dsp->substream->runtime;
        period_bytes = snd_pcm_lib_period_bytes(rt5514_dsp->substream);
+       if (!period_bytes) {
+               schedule_delayed_work(&rt5514_dsp->copy_work, 5);
+               goto done;
+       }
+
+       if (rt5514_dsp->buf_size % period_bytes)
+               rt5514_dsp->buf_size = (rt5514_dsp->buf_size / period_bytes) *
+                       period_bytes;
 
        if (rt5514_dsp->get_size >= rt5514_dsp->buf_size) {
                rt5514_spi_burst_read(RT5514_BUFFER_VOICE_WP, (u8 *)&buf,
@@ -149,13 +157,11 @@ done:
 
 static void rt5514_schedule_copy(struct rt5514_dsp *rt5514_dsp)
 {
-       size_t period_bytes;
        u8 buf[8];
 
        if (!rt5514_dsp->substream)
                return;
 
-       period_bytes = snd_pcm_lib_period_bytes(rt5514_dsp->substream);
        rt5514_dsp->get_size = 0;
 
        /**
@@ -183,10 +189,6 @@ static void rt5514_schedule_copy(struct rt5514_dsp *rt5514_dsp)
 
        rt5514_dsp->buf_size = rt5514_dsp->buf_limit - rt5514_dsp->buf_base;
 
-       if (rt5514_dsp->buf_size % period_bytes)
-               rt5514_dsp->buf_size = (rt5514_dsp->buf_size / period_bytes) *
-                       period_bytes;
-
        if (rt5514_dsp->buf_base && rt5514_dsp->buf_limit &&
                rt5514_dsp->buf_rp && rt5514_dsp->buf_size)
                schedule_delayed_work(&rt5514_dsp->copy_work, 0);
index 83202e9e5abd3747f04049071ee6bec65fb8c547..7213b1cfb18ac04088f42f125df1fc9490e84a27 100644 (file)
@@ -749,7 +749,6 @@ static bool rt5682_readable_register(struct device *dev, unsigned int reg)
        }
 }
 
-static const DECLARE_TLV_DB_SCALE(hp_vol_tlv, -2250, 150, 0);
 static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -6525, 75, 0);
 static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -1725, 75, 0);
 static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0);
@@ -1108,10 +1107,6 @@ static void rt5682_jack_detect_handler(struct work_struct *work)
 }
 
 static const struct snd_kcontrol_new rt5682_snd_controls[] = {
-       /* Headphone Output Volume */
-       SOC_DOUBLE_R_TLV("Headphone Playback Volume", RT5682_HPL_GAIN,
-               RT5682_HPR_GAIN, RT5682_G_HP_SFT, 15, 1, hp_vol_tlv),
-
        /* DAC Digital Volume */
        SOC_DOUBLE_TLV("DAC1 Playback Volume", RT5682_DAC1_DIG_VOL,
                RT5682_L_VOL_SFT + 1, RT5682_R_VOL_SFT + 1, 86, 0, dac_vol_tlv),
index e7fd14daeb4fe318b04bb63715847543989acd6c..29225623b4b40d1c8fea6822b85b007e57aba690 100644 (file)
@@ -908,11 +908,15 @@ static int skl_first_init(struct hdac_bus *bus)
                return -ENXIO;
        }
 
-       skl_init_chip(bus, true);
+       snd_hdac_bus_reset_link(bus, true);
 
        snd_hdac_bus_parse_capabilities(bus);
 
+       if (skl_acquire_irq(bus, 0) < 0)
+               return -EBUSY;
+
        pci_set_master(pci);
+       synchronize_irq(bus->irq);
 
        gcap = snd_hdac_chip_readw(bus, GCAP);
        dev_dbg(bus->dev, "chipset global capabilities = 0x%x\n", gcap);
@@ -945,12 +949,6 @@ static int skl_first_init(struct hdac_bus *bus)
        if (err < 0)
                return err;
 
-       err = skl_acquire_irq(bus, 0);
-       if (err < 0)
-               return err;
-
-       synchronize_irq(bus->irq);
-
        /* initialize chip */
        skl_init_pci(skl);