aboutsummaryrefslogtreecommitdiff
path: root/include/sound.h
diff options
context:
space:
mode:
authorSimon Glass2019-02-16 20:24:54 -0700
committerBin Meng2019-02-20 15:27:08 +0800
commit2850266965ade165f913a66f679a0449faf21180 (patch)
treef173b23f448ab8db19adaf8ee75228baf281a42b /include/sound.h
parente65f9ef9f21058a7e4f54e11da1af49a8c1b0579 (diff)
sound: Add uclass operations for beeping
Some audio codecs such as Intel HDA do not need to use digital data to play sounds, but instead have a way to emit beeps. Add this interface as an option. If the beep interface is not supported, then the sound uclass falls back to the I2S interface. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/sound.h')
-rw-r--r--include/sound.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/include/sound.h b/include/sound.h
index 7d528c479ef..47de9fa3ed3 100644
--- a/include/sound.h
+++ b/include/sound.h
@@ -67,6 +67,28 @@ struct sound_ops {
* @return 0 if OK, -ve on error
*/
int (*play)(struct udevice *dev, void *data, uint data_size);
+
+ /**
+ * start_beep() - Start beeping (optional)
+ *
+ * This tells the sound hardware to start a beep. It will continue until
+ * stopped by sound_stop_beep().
+ *
+ * @dev: Sound device
+ * @frequency_hz: Beep frequency in hertz
+ * @return if OK, -ENOSYS if not supported, -ve on error
+ */
+ int (*start_beep)(struct udevice *dev, int frequency_hz);
+
+ /**
+ * stop_beep() - Stop beeping (optional)
+ *
+ * This tells the sound hardware to stop a previously started beep.
+ *
+ * @dev: Sound device
+ * @return if OK, -ve on error
+ */
+ int (*stop_beep)(struct udevice *dev);
};
#define sound_get_ops(dev) ((struct sound_ops *)(dev)->driver->ops)
@@ -87,6 +109,28 @@ int sound_setup(struct udevice *dev);
int sound_beep(struct udevice *dev, int msecs, int frequency_hz);
/**
+ * sound_start_beep() - Start beeping
+ *
+ * This tells the sound hardware to start a beep. It will continue until stopped
+ * by sound_stop_beep().
+ *
+ * @dev: Sound device
+ * @frequency_hz: Beep frequency in hertz
+ * @return if OK, -ve on error
+ */
+int sound_start_beep(struct udevice *dev, int frequency_hz);
+
+/**
+ * sound_stop_beep() - Stop beeping
+ *
+ * This tells the sound hardware to stop a previously started beep.
+ *
+ * @dev: Sound device
+ * @return if OK, -ve on error
+ */
+int sound_stop_beep(struct udevice *dev);
+
+/**
* sound_find_codec_i2s() - Called by sound drivers to locate codec and i2s
*
* This finds the audio codec and i2s devices and puts them in the uclass's