Commit 4f0189be authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Clean up the code to check bdl_pos_adj option

Just a minor cleanup; instead of passing an array, pass the assigned
bdl_pos_adj option value directory in struct azx.  Also split the code
to get the default bdl_pos_adj value for the change that will follow
after this.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 17074c1a
...@@ -1050,8 +1050,7 @@ int azx_bus_init(struct azx *chip, const char *model, ...@@ -1050,8 +1050,7 @@ int azx_bus_init(struct azx *chip, const char *model,
if (chip->get_position[0] != azx_get_pos_lpib || if (chip->get_position[0] != azx_get_pos_lpib ||
chip->get_position[1] != azx_get_pos_lpib) chip->get_position[1] != azx_get_pos_lpib)
bus->core.use_posbuf = true; bus->core.use_posbuf = true;
if (chip->bdl_pos_adj) bus->core.bdl_pos_adj = chip->bdl_pos_adj;
bus->core.bdl_pos_adj = chip->bdl_pos_adj[chip->dev_index];
if (chip->driver_caps & AZX_DCAPS_CORBRP_SELF_CLEAR) if (chip->driver_caps & AZX_DCAPS_CORBRP_SELF_CLEAR)
bus->core.corbrp_self_clear = true; bus->core.corbrp_self_clear = true;
......
...@@ -147,7 +147,7 @@ struct azx { ...@@ -147,7 +147,7 @@ struct azx {
#endif #endif
/* flags */ /* flags */
const int *bdl_pos_adj; int bdl_pos_adj;
int poll_count; int poll_count;
unsigned int running:1; unsigned int running:1;
unsigned int single_cmd:1; unsigned int single_cmd:1;
......
...@@ -632,7 +632,7 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) ...@@ -632,7 +632,7 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
if (wallclk < (azx_dev->core.period_wallclk * 5) / 4 && if (wallclk < (azx_dev->core.period_wallclk * 5) / 4 &&
pos % azx_dev->core.period_bytes > azx_dev->core.period_bytes / 2) pos % azx_dev->core.period_bytes > azx_dev->core.period_bytes / 2)
/* NG - it's below the first next period boundary */ /* NG - it's below the first next period boundary */
return chip->bdl_pos_adj[chip->dev_index] ? 0 : -1; return chip->bdl_pos_adj ? 0 : -1;
azx_dev->core.start_wallclk += wallclk; azx_dev->core.start_wallclk += wallclk;
return 1; /* OK, it's fine */ return 1; /* OK, it's fine */
} }
...@@ -1488,6 +1488,17 @@ static void azx_probe_work(struct work_struct *work) ...@@ -1488,6 +1488,17 @@ static void azx_probe_work(struct work_struct *work)
azx_probe_continue(&hda->chip); azx_probe_continue(&hda->chip);
} }
static int default_bdl_pos_adj(struct azx *chip)
{
switch (chip->driver_type) {
case AZX_DRIVER_ICH:
case AZX_DRIVER_PCH:
return 1;
default:
return 32;
}
}
/* /*
* constructor * constructor
*/ */
...@@ -1541,18 +1552,10 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, ...@@ -1541,18 +1552,10 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
chip->single_cmd = single_cmd; chip->single_cmd = single_cmd;
azx_check_snoop_available(chip); azx_check_snoop_available(chip);
if (bdl_pos_adj[dev] < 0) { if (bdl_pos_adj[dev] < 0)
switch (chip->driver_type) { chip->bdl_pos_adj = default_bdl_pos_adj(chip);
case AZX_DRIVER_ICH: else
case AZX_DRIVER_PCH: chip->bdl_pos_adj = bdl_pos_adj[dev];
bdl_pos_adj[dev] = 1;
break;
default:
bdl_pos_adj[dev] = 32;
break;
}
}
chip->bdl_pos_adj = bdl_pos_adj;
err = azx_bus_init(chip, model[dev], &pci_hda_io_ops); err = azx_bus_init(chip, model[dev], &pci_hda_io_ops);
if (err < 0) { if (err < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment