[ALSA] hda-intel - Show the last command in warning messages
Show the last issued command in warning messages when any communication error with CORB/RIRB occurs. Also, a bit code clean-up for composing the command value in *_send_cmd(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
This commit is contained in:
committed by
Jaroslav Kysela
parent
a4eed138ad
commit
43bbb6ccc6
+21
-24
@@ -341,6 +341,9 @@ struct azx {
|
|||||||
unsigned int single_cmd :1;
|
unsigned int single_cmd :1;
|
||||||
unsigned int polling_mode :1;
|
unsigned int polling_mode :1;
|
||||||
unsigned int msi :1;
|
unsigned int msi :1;
|
||||||
|
|
||||||
|
/* for debugging */
|
||||||
|
unsigned int last_cmd; /* last issued command (to sync) */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* driver types */
|
/* driver types */
|
||||||
@@ -466,18 +469,10 @@ static void azx_free_cmd_io(struct azx *chip)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* send a command */
|
/* send a command */
|
||||||
static int azx_corb_send_cmd(struct hda_codec *codec, hda_nid_t nid, int direct,
|
static int azx_corb_send_cmd(struct hda_codec *codec, u32 val)
|
||||||
unsigned int verb, unsigned int para)
|
|
||||||
{
|
{
|
||||||
struct azx *chip = codec->bus->private_data;
|
struct azx *chip = codec->bus->private_data;
|
||||||
unsigned int wp;
|
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 */
|
/* add command to corb */
|
||||||
wp = azx_readb(chip, CORBWP);
|
wp = azx_readb(chip, CORBWP);
|
||||||
@@ -543,7 +538,7 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec)
|
|||||||
|
|
||||||
if (chip->msi) {
|
if (chip->msi) {
|
||||||
snd_printk(KERN_WARNING "hda_intel: No response from codec, "
|
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);
|
free_irq(chip->irq, chip);
|
||||||
chip->irq = -1;
|
chip->irq = -1;
|
||||||
pci_disable_msi(chip->pci);
|
pci_disable_msi(chip->pci);
|
||||||
@@ -555,13 +550,15 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec)
|
|||||||
|
|
||||||
if (!chip->polling_mode) {
|
if (!chip->polling_mode) {
|
||||||
snd_printk(KERN_WARNING "hda_intel: azx_get_response timeout, "
|
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;
|
chip->polling_mode = 1;
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_printk(KERN_ERR "hda_intel: azx_get_response timeout, "
|
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.rp = azx_readb(chip, RIRBWP);
|
||||||
chip->rirb.cmds = 0;
|
chip->rirb.cmds = 0;
|
||||||
/* switch to single_cmd mode */
|
/* switch to single_cmd mode */
|
||||||
@@ -581,20 +578,11 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* send a command */
|
/* send a command */
|
||||||
static int azx_single_send_cmd(struct hda_codec *codec, hda_nid_t nid,
|
static int azx_single_send_cmd(struct hda_codec *codec, u32 val)
|
||||||
int direct, unsigned int verb,
|
|
||||||
unsigned int para)
|
|
||||||
{
|
{
|
||||||
struct azx *chip = codec->bus->private_data;
|
struct azx *chip = codec->bus->private_data;
|
||||||
u32 val;
|
|
||||||
int timeout = 50;
|
int timeout = 50;
|
||||||
|
|
||||||
val = (u32)(codec->addr & 0x0f) << 28;
|
|
||||||
val |= (u32)direct << 27;
|
|
||||||
val |= (u32)nid << 20;
|
|
||||||
val |= verb << 8;
|
|
||||||
val |= para;
|
|
||||||
|
|
||||||
while (timeout--) {
|
while (timeout--) {
|
||||||
/* check ICB busy bit */
|
/* check ICB busy bit */
|
||||||
if (! (azx_readw(chip, IRS) & ICH6_IRS_BUSY)) {
|
if (! (azx_readw(chip, IRS) & ICH6_IRS_BUSY)) {
|
||||||
@@ -639,10 +627,19 @@ static int azx_send_cmd(struct hda_codec *codec, hda_nid_t nid,
|
|||||||
unsigned int para)
|
unsigned int para)
|
||||||
{
|
{
|
||||||
struct azx *chip = codec->bus->private_data;
|
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)
|
if (chip->single_cmd)
|
||||||
return azx_single_send_cmd(codec, nid, direct, verb, para);
|
return azx_single_send_cmd(codec, val);
|
||||||
else
|
else
|
||||||
return azx_corb_send_cmd(codec, nid, direct, verb, para);
|
return azx_corb_send_cmd(codec, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get a response */
|
/* get a response */
|
||||||
|
|||||||
Reference in New Issue
Block a user