Skip to content

Commit

Permalink
Use control messages for audio data to fix scratch hang.
Browse files Browse the repository at this point in the history
Use vchiq versioning to try to handle mismatches kernel.img/start.elf
  • Loading branch information
popcornmix committed Feb 7, 2013
1 parent 191293f commit 6c4c94d
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 69 deletions.
12 changes: 6 additions & 6 deletions sound/arm/bcm2835-ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
static int snd_bcm2835_ctl_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
audio_info(" ... IN ");
audio_info(" ... IN\n");
if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) {
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1;
Expand All @@ -58,7 +58,7 @@ static int snd_bcm2835_ctl_info(struct snd_kcontrol *kcontrol,
uinfo->value.integer.min = 0;
uinfo->value.integer.max = AUDIO_DEST_MAX-1;
}
audio_info(" ... OUT ");
audio_info(" ... OUT\n");
return 0;
}

Expand All @@ -75,13 +75,13 @@ static int toggle_mute(struct bcm2835_chip *chip, int nmute)
if(chip->mute == CTRL_VOL_MUTE)
{
chip->volume = chip->old_volume; /* copy the old volume back */
audio_info("Unmuting, old_volume = %d, volume = %d ...", chip->old_volume, chip->volume);
audio_info("Unmuting, old_volume = %d, volume = %d ...\n", chip->old_volume, chip->volume);
}
else /* otherwise we mute */
{
chip->old_volume = chip->volume;
chip->volume = 26214; /* set volume to minimum level AKA mute */
audio_info("Muting, old_volume = %d, volume = %d ...", chip->old_volume, chip->volume);
audio_info("Muting, old_volume = %d, volume = %d ...\n", chip->old_volume, chip->volume);
}

chip->mute = nmute;
Expand Down Expand Up @@ -112,7 +112,7 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol,
int changed = 0;

if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) {
audio_info("Volume change attempted.. volume = %d new_volume = %d", chip->volume, (int)ucontrol->value.integer.value[0]);
audio_info("Volume change attempted.. volume = %d new_volume = %d\n", chip->volume, (int)ucontrol->value.integer.value[0]);
if (chip->mute == CTRL_VOL_MUTE) {
/* changed = toggle_mute(chip, CTRL_VOL_UNMUTE); */
return 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */
Expand All @@ -126,7 +126,7 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol,

} else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) {
/* Now implemented */
audio_info(" Mute attempted");
audio_info(" Mute attempted\n");
changed = toggle_mute(chip, ucontrol->value.integer.value[0]);

} else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) {
Expand Down
7 changes: 4 additions & 3 deletions sound/arm/bcm2835-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,15 @@ static int snd_bcm2835_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
if (err == 0) {
alsa_stream->running = 1;
alsa_stream->draining = 1;
} else {
audio_error(" Failed to START alsa device (%d)\n", err);
}
}
break;
case SNDRV_PCM_TRIGGER_STOP:
audio_debug
("bcm2835_AUDIO_TRIGGER_STOP running=%d draining=%d\n",
runtime->status->state == SNDRV_PCM_STATE_DRAINING,
alsa_stream->running);
alsa_stream->running, runtime->status->state == SNDRV_PCM_STATE_DRAINING);
if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) {
audio_info("DRAINING\n");
alsa_stream->draining = 1;
Expand All @@ -299,7 +300,7 @@ static int snd_bcm2835_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
if (alsa_stream->running) {
err = bcm2835_audio_stop(alsa_stream);
if (err != 0)
audio_error(" Failed to STOP alsa device\n");
audio_error(" Failed to STOP alsa device (%d)\n", err);
alsa_stream->running = 0;
}
break;
Expand Down
Loading

0 comments on commit 6c4c94d

Please sign in to comment.