Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62101
b: refs/heads/master
c: 43bbb6c
h: refs/heads/master
i:
  62099: d94403c
v: v3
  • Loading branch information
Takashi Iwai authored and Jaroslav Kysela committed Jul 20, 2007
1 parent 9bfeca4 commit 58901e3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a4eed138add1018846d17e813560b0c7c0ae8e01
refs/heads/master: 43bbb6ccc67775b432c31d5fd2e1050329ffdcbf
45 changes: 21 additions & 24 deletions trunk/sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,9 @@ struct azx {
unsigned int single_cmd :1;
unsigned int polling_mode :1;
unsigned int msi :1;

/* for debugging */
unsigned int last_cmd; /* last issued command (to sync) */
};

/* driver types */
Expand Down Expand Up @@ -466,18 +469,10 @@ static void azx_free_cmd_io(struct azx *chip)
}

/* send a command */
static int azx_corb_send_cmd(struct hda_codec *codec, hda_nid_t nid, int direct,
unsigned int verb, unsigned int para)
static int azx_corb_send_cmd(struct hda_codec *codec, u32 val)
{
struct azx *chip = codec->bus->private_data;
unsigned int wp;
u32 val;

val = (u32)(codec->addr & 0x0f) << 28;
val |= (u32)direct << 27;
val |= (u32)nid << 20;
val |= verb << 8;
val |= para;

/* add command to corb */
wp = azx_readb(chip, CORBWP);
Expand Down Expand Up @@ -543,7 +538,7 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec)

if (chip->msi) {
snd_printk(KERN_WARNING "hda_intel: No response from codec, "
"disabling MSI...\n");
"disabling MSI: last cmd=0x%08x\n", chip->last_cmd);
free_irq(chip->irq, chip);
chip->irq = -1;
pci_disable_msi(chip->pci);
Expand All @@ -555,13 +550,15 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec)

if (!chip->polling_mode) {
snd_printk(KERN_WARNING "hda_intel: azx_get_response timeout, "
"switching to polling mode...\n");
"switching to polling mode: last cmd=0x%08x\n",
chip->last_cmd);
chip->polling_mode = 1;
goto again;
}

snd_printk(KERN_ERR "hda_intel: azx_get_response timeout, "
"switching to single_cmd mode...\n");
"switching to single_cmd mode: last cmd=0x%08x\n",
chip->last_cmd);
chip->rirb.rp = azx_readb(chip, RIRBWP);
chip->rirb.cmds = 0;
/* switch to single_cmd mode */
Expand All @@ -581,20 +578,11 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec)
*/

/* send a command */
static int azx_single_send_cmd(struct hda_codec *codec, hda_nid_t nid,
int direct, unsigned int verb,
unsigned int para)
static int azx_single_send_cmd(struct hda_codec *codec, u32 val)
{
struct azx *chip = codec->bus->private_data;
u32 val;
int timeout = 50;

val = (u32)(codec->addr & 0x0f) << 28;
val |= (u32)direct << 27;
val |= (u32)nid << 20;
val |= verb << 8;
val |= para;

while (timeout--) {
/* check ICB busy bit */
if (! (azx_readw(chip, IRS) & ICH6_IRS_BUSY)) {
Expand Down Expand Up @@ -639,10 +627,19 @@ static int azx_send_cmd(struct hda_codec *codec, hda_nid_t nid,
unsigned int para)
{
struct azx *chip = codec->bus->private_data;
u32 val;

val = (u32)(codec->addr & 0x0f) << 28;
val |= (u32)direct << 27;
val |= (u32)nid << 20;
val |= verb << 8;
val |= para;
chip->last_cmd = val;

if (chip->single_cmd)
return azx_single_send_cmd(codec, nid, direct, verb, para);
return azx_single_send_cmd(codec, val);
else
return azx_corb_send_cmd(codec, nid, direct, verb, para);
return azx_corb_send_cmd(codec, val);
}

/* get a response */
Expand Down

0 comments on commit 58901e3

Please sign in to comment.