summaryrefslogtreecommitdiff
path: root/drivers/sound/sound-uclass.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-02-03 07:36:06 -0700
committerSimon Glass <sjg@chromium.org>2020-02-05 19:33:46 -0700
commit3062cd17af35b691582230c382dd125625d3b7ca (patch)
tree2fda0d01ece1da65ea3e0dd0d7790e2129aaa064 /drivers/sound/sound-uclass.c
parent3ff6fe5fab11a99d4b3ec94a8a4a238d6f96f5ba (diff)
sound: Add a new stop_play() method
At present there is no positive indication that U-Boot has finished sending sound data. This means that it is not possible to power down an audio codec, for example. Add a new method that is called once all sound data has been sent. Add a new method for this, called when the sound_play() call is done. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/sound/sound-uclass.c')
-rw-r--r--drivers/sound/sound-uclass.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/sound/sound-uclass.c b/drivers/sound/sound-uclass.c
index d49f29bcd5b..c213472d606 100644
--- a/drivers/sound/sound-uclass.c
+++ b/drivers/sound/sound-uclass.c
@@ -31,6 +31,16 @@ int sound_play(struct udevice *dev, void *data, uint data_size)
return ops->play(dev, data, data_size);
}
+int sound_stop_play(struct udevice *dev)
+{
+ struct sound_ops *ops = sound_get_ops(dev);
+
+ if (!ops->play)
+ return -ENOSYS;
+
+ return ops->stop_play(dev);
+}
+
int sound_start_beep(struct udevice *dev, int frequency_hz)
{
struct sound_ops *ops = sound_get_ops(dev);
@@ -97,6 +107,7 @@ int sound_beep(struct udevice *dev, int msecs, int frequency_hz)
ret = sound_play(dev, data, size);
}
+ sound_stop_play(dev);
free(data);