Skip to content

Commit 4118674

Browse files
authored
Merge branch 'topic/sof-dev' into multi_core_rfc
2 parents ef8cf1e + c6cc9ca commit 4118674

File tree

18 files changed

+353
-173
lines changed

18 files changed

+353
-173
lines changed

include/sound/hdaudio.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,9 @@ struct hdac_bus {
358358
bool align_bdle_4k:1; /* BDLE align 4K boundary */
359359
bool reverse_assign:1; /* assign devices in reverse order */
360360
bool corbrp_self_clear:1; /* CORBRP clears itself after reset */
361+
bool polling_mode:1;
362+
363+
int poll_count;
361364

362365
int bdl_pos_adj; /* BDL position adjustment */
363366

sound/hda/hdac_controller.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ int snd_hdac_bus_get_response(struct hdac_bus *bus, unsigned int addr,
239239
timeout = jiffies + msecs_to_jiffies(1000);
240240

241241
for (loopcounter = 0;; loopcounter++) {
242+
if (bus->polling_mode)
243+
snd_hdac_bus_update_rirb(bus);
242244
spin_lock_irq(&bus->reg_lock);
243245
if (!bus->rirb.cmds[addr]) {
244246
if (res)

sound/pci/hda/hda_controller.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -806,11 +806,11 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr,
806806

807807
for (loopcounter = 0;; loopcounter++) {
808808
spin_lock_irq(&bus->reg_lock);
809-
if (chip->polling_mode || do_poll)
809+
if (bus->polling_mode || do_poll)
810810
snd_hdac_bus_update_rirb(bus);
811811
if (!bus->rirb.cmds[addr]) {
812812
if (!do_poll)
813-
chip->poll_count = 0;
813+
bus->poll_count = 0;
814814
if (res)
815815
*res = bus->rirb.res[addr]; /* the last value */
816816
spin_unlock_irq(&bus->reg_lock);
@@ -830,21 +830,21 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr,
830830
if (hbus->no_response_fallback)
831831
return -EIO;
832832

833-
if (!chip->polling_mode && chip->poll_count < 2) {
833+
if (!bus->polling_mode && bus->poll_count < 2) {
834834
dev_dbg(chip->card->dev,
835835
"azx_get_response timeout, polling the codec once: last cmd=0x%08x\n",
836836
bus->last_cmd[addr]);
837837
do_poll = 1;
838-
chip->poll_count++;
838+
bus->poll_count++;
839839
goto again;
840840
}
841841

842842

843-
if (!chip->polling_mode) {
843+
if (!bus->polling_mode) {
844844
dev_warn(chip->card->dev,
845845
"azx_get_response timeout, switching to polling mode: last cmd=0x%08x\n",
846846
bus->last_cmd[addr]);
847-
chip->polling_mode = 1;
847+
bus->polling_mode = 1;
848848
goto again;
849849
}
850850

sound/pci/hda/hda_controller.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,9 @@ struct azx {
142142

143143
/* flags */
144144
int bdl_pos_adj;
145-
int poll_count;
146145
unsigned int running:1;
147146
unsigned int fallback_to_single_cmd:1;
148147
unsigned int single_cmd:1;
149-
unsigned int polling_mode:1;
150148
unsigned int msi:1;
151149
unsigned int probing:1; /* codec probing phase */
152150
unsigned int snoop:1;

sound/pci/hda/hda_intel.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ enum {
375375

376376
#define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
377377
#define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348)
378+
#define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8)
378379

379380
static char *driver_short_names[] = {
380381
[AZX_DRIVER_ICH] = "HDA Intel",
@@ -1700,17 +1701,17 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
17001701
else
17011702
chip->bdl_pos_adj = bdl_pos_adj[dev];
17021703

1703-
/* Workaround for a communication error on CFL (bko#199007) */
1704-
if (IS_CFL(pci))
1705-
chip->polling_mode = 1;
1706-
17071704
err = azx_bus_init(chip, model[dev], &pci_hda_io_ops);
17081705
if (err < 0) {
17091706
kfree(hda);
17101707
pci_disable_device(pci);
17111708
return err;
17121709
}
17131710

1711+
/* Workaround for a communication error on CFL (bko#199007) and CNL */
1712+
if (IS_CFL(pci) || IS_CNL(pci))
1713+
azx_bus(chip)->polling_mode = 1;
1714+
17141715
if (chip->driver_type == AZX_DRIVER_NVIDIA) {
17151716
dev_dbg(chip->card->dev, "Enable delay in RIRB handling\n");
17161717
chip->bus.needs_damn_long_delay = 1;

sound/pci/hda/patch_realtek.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,8 @@ static void alc_pre_init(struct hda_codec *codec)
834834
alc_fill_eapd_coef(codec);
835835
}
836836

837+
#define is_s3_resume(codec) \
838+
((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
837839
#define is_s4_resume(codec) \
838840
((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
839841

@@ -4901,6 +4903,8 @@ static void alc_update_headset_mode(struct hda_codec *codec)
49014903
switch (new_headset_mode) {
49024904
case ALC_HEADSET_MODE_UNPLUGGED:
49034905
alc_headset_mode_unplugged(codec);
4906+
spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
4907+
spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
49044908
spec->gen.hp_jack_present = false;
49054909
break;
49064910
case ALC_HEADSET_MODE_HEADSET:
@@ -4943,8 +4947,6 @@ static void alc_update_headset_mode_hook(struct hda_codec *codec,
49434947
static void alc_update_headset_jack_cb(struct hda_codec *codec,
49444948
struct hda_jack_callback *jack)
49454949
{
4946-
struct alc_spec *spec = codec->spec;
4947-
spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
49484950
snd_hda_gen_hp_automute(codec, jack);
49494951
}
49504952

@@ -4981,7 +4983,10 @@ static void alc_fixup_headset_mode(struct hda_codec *codec,
49814983
alc_probe_headset_mode(codec);
49824984
break;
49834985
case HDA_FIXUP_ACT_INIT:
4984-
spec->current_headset_mode = 0;
4986+
if (is_s3_resume(codec) || is_s4_resume(codec)) {
4987+
spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
4988+
spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
4989+
}
49854990
alc_update_headset_mode(codec);
49864991
break;
49874992
}

sound/soc/sof/intel/apl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const struct snd_sof_dsp_ops sof_apl_ops = {
6161
.pcm_open = hda_dsp_pcm_open,
6262
.pcm_close = hda_dsp_pcm_close,
6363
.pcm_hw_params = hda_dsp_pcm_hw_params,
64+
.pcm_hw_free = hda_dsp_stream_hw_free,
6465
.pcm_trigger = hda_dsp_pcm_trigger,
6566
.pcm_pointer = hda_dsp_pcm_pointer,
6667

sound/soc/sof/intel/cnl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ const struct snd_sof_dsp_ops sof_cnl_ops = {
217217
.pcm_open = hda_dsp_pcm_open,
218218
.pcm_close = hda_dsp_pcm_close,
219219
.pcm_hw_params = hda_dsp_pcm_hw_params,
220+
.pcm_hw_free = hda_dsp_stream_hw_free,
220221
.pcm_trigger = hda_dsp_pcm_trigger,
221222
.pcm_pointer = hda_dsp_pcm_pointer,
222223

0 commit comments

Comments
 (0)