@@ -187,7 +187,6 @@ struct HDAAudioState {
/* properties */
uint32_t debug;
bool mixer;
- bool use_timer;
};
static inline uint32_t hda_bytes_per_second(HDAAudioStream *st)
@@ -366,58 +365,6 @@ static void hda_audio_output_cb(void *opaque, int avail)
hda_timer_sync_adjust(st, (wpos - rpos) - (B_SIZE >> 1));
}
-static void hda_audio_compat_input_cb(void *opaque, int avail)
-{
- HDAAudioStream *st = opaque;
- int recv = 0;
- int len;
- bool rc;
-
- while (avail - recv >= sizeof(st->compat_buf)) {
- if (st->compat_bpos != sizeof(st->compat_buf)) {
- len = AUD_read(st->voice.in, st->compat_buf + st->compat_bpos,
- sizeof(st->compat_buf) - st->compat_bpos);
- st->compat_bpos += len;
- recv += len;
- if (st->compat_bpos != sizeof(st->compat_buf)) {
- break;
- }
- }
- rc = hda_codec_xfer(&st->state->hda, st->stream, false,
- st->compat_buf, sizeof(st->compat_buf));
- if (!rc) {
- break;
- }
- st->compat_bpos = 0;
- }
-}
-
-static void hda_audio_compat_output_cb(void *opaque, int avail)
-{
- HDAAudioStream *st = opaque;
- int sent = 0;
- int len;
- bool rc;
-
- while (avail - sent >= sizeof(st->compat_buf)) {
- if (st->compat_bpos == sizeof(st->compat_buf)) {
- rc = hda_codec_xfer(&st->state->hda, st->stream, true,
- st->compat_buf, sizeof(st->compat_buf));
- if (!rc) {
- break;
- }
- st->compat_bpos = 0;
- }
- len = AUD_write(st->voice.out, st->compat_buf + st->compat_bpos,
- sizeof(st->compat_buf) - st->compat_bpos);
- st->compat_bpos += len;
- sent += len;
- if (st->compat_bpos != sizeof(st->compat_buf)) {
- break;
- }
- }
-}
-
static void hda_audio_set_running(HDAAudioStream *st, bool running)
{
if (st->node == NULL) {
@@ -428,16 +375,14 @@ static void hda_audio_set_running(HDAAudioStream *st, bool running)
}
st->running = running;
trace_hda_audio_running(st->node->name, st->stream, st->running);
- if (st->state->use_timer) {
- if (running) {
- int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
- st->rpos = 0;
- st->wpos = 0;
- st->buft_start = now;
- timer_mod_anticipate_ns(st->buft, now + HDA_TIMER_TICKS);
- } else {
- timer_del(st->buft);
- }
+ if (running) {
+ int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
+ st->rpos = 0;
+ st->wpos = 0;
+ st->buft_start = now;
+ timer_mod_anticipate_ns(st->buft, now + HDA_TIMER_TICKS);
+ } else {
+ timer_del(st->buft);
}
if (st->output) {
AUD_set_active_out(st->voice.out, st->running);
@@ -474,7 +419,6 @@ static void hda_audio_set_amp(HDAAudioStream *st)
static void hda_audio_setup(HDAAudioStream *st)
{
- bool use_timer = st->state->use_timer;
audio_callback_fn cb;
if (st->node == NULL) {
@@ -485,21 +429,13 @@ static void hda_audio_setup(HDAAudioStream *st)
fmt2name[st->as.fmt], st->as.freq);
if (st->output) {
- if (use_timer) {
- cb = hda_audio_output_cb;
- timer_del(st->buft);
- } else {
- cb = hda_audio_compat_output_cb;
- }
+ cb = hda_audio_output_cb;
+ timer_del(st->buft);
st->voice.out = AUD_open_out(&st->state->card, st->voice.out,
st->node->name, st, cb, &st->as);
} else {
- if (use_timer) {
- cb = hda_audio_input_cb;
- timer_del(st->buft);
- } else {
- cb = hda_audio_compat_input_cb;
- }
+ cb = hda_audio_input_cb;
+ timer_del(st->buft);
st->voice.in = AUD_open_in(&st->state->card, st->voice.in,
st->node->name, st, cb, &st->as);
}
@@ -805,7 +741,7 @@ static void hda_audio_reset(DeviceState *dev)
static bool vmstate_hda_audio_stream_buf_needed(void *opaque)
{
HDAAudioStream *st = opaque;
- return st->state && st->state->use_timer;
+ return st->state;
}
static const VMStateDescription vmstate_hda_audio_stream_buf = {
@@ -861,7 +797,6 @@ static const Property hda_audio_properties[] = {
DEFINE_AUDIO_PROPERTIES(HDAAudioState, card),
DEFINE_PROP_UINT32("debug", HDAAudioState, debug, 0),
DEFINE_PROP_BOOL("mixer", HDAAudioState, mixer, true),
- DEFINE_PROP_BOOL("use-timer", HDAAudioState, use_timer, true),
};
static void hda_audio_init_output(HDACodecDevice *hda, Error **errp)
The HDAAudioState::use_timer boolean was only set in the hw_compat_2_12[] array, via the 'use-timer=false' property. We removed all machines using that array, lets remove that property and all the code around it, like the compatibility callbacks. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/audio/hda-codec.c | 91 +++++++------------------------------------- 1 file changed, 13 insertions(+), 78 deletions(-)