Skip to content

Commit

Permalink
ALSA: hda: avoid reset of sdo_limit
Browse files Browse the repository at this point in the history
By default 'sdo_limit' is initialized with a default value of '8'
as per spec. This is overridden in cases where a different value is
required. However this is getting reset when snd_hdac_bus_init_chip()
is called again, which happens during runtime PM cycle.

Avoid this reset by moving 'sdo_limit' setup to 'snd_hdac_bus_init()'
function which would be called only once.

Fixes: 67ae482 ("ALSA: hda: add member to store ratio for stripe control")
Cc: <[email protected]>
Signed-off-by: Sameer Pujar <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
pujars authored and tiwai committed Aug 19, 2020
1 parent e17f02d commit b90b925
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
12 changes: 12 additions & 0 deletions sound/hda/hdac_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
INIT_LIST_HEAD(&bus->hlink_list);
init_waitqueue_head(&bus->rirb_wq);
bus->irq = -1;

/*
* Default value of '8' is as per the HD audio specification (Rev 1.0a).
* Following relation is used to derive STRIPE control value.
* For sample rate <= 48K:
* { ((num_channels * bits_per_sample) / number of SDOs) >= 8 }
* For sample rate > 48K:
* { ((num_channels * bits_per_sample * rate/48000) /
* number of SDOs) >= 8 }
*/
bus->sdo_limit = 8;

return 0;
}
EXPORT_SYMBOL_GPL(snd_hdac_bus_init);
Expand Down
11 changes: 0 additions & 11 deletions sound/hda/hdac_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,17 +529,6 @@ bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset)

bus->chip_init = true;

/*
* Default value of '8' is as per the HD audio specification (Rev 1.0a).
* Following relation is used to derive STRIPE control value.
* For sample rate <= 48K:
* { ((num_channels * bits_per_sample) / number of SDOs) >= 8 }
* For sample rate > 48K:
* { ((num_channels * bits_per_sample * rate/48000) /
* number of SDOs) >= 8 }
*/
bus->sdo_limit = 8;

return true;
}
EXPORT_SYMBOL_GPL(snd_hdac_bus_init_chip);
Expand Down

0 comments on commit b90b925

Please sign in to comment.