X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fsound.h;h=71bd850652e4421a27244978b60258345cc027cf;hb=6d5d0c955e2ca035481bc133d453fccd065b80e8;hp=02acefd34f0946c82e20faa47c994a40bc9a3630;hpb=f2b25c9bf8212139f43ded090c78d604babc4337;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/sound.h b/include/sound.h index 02acefd..71bd850 100644 --- a/include/sound.h +++ b/include/sound.h @@ -37,13 +37,14 @@ struct sound_uc_priv { /** * Generates square wave sound data for 1 second * - * @param sample_rate Sample rate in Hz - * @param data data buffer pointer - * @param size size of the buffer in bytes - * @param freq frequency of the wave + * @sample_rate: Sample rate in Hz + * @data: data buffer pointer + * @size: size of the buffer in bytes + * @freq: frequency of the wave + * @channels: Number of channels to use */ void sound_create_square_wave(uint sample_rate, unsigned short *data, int size, - uint freq); + uint freq, uint channels); /* * The sound uclass brings together a data transport (currently only I2C) and a @@ -53,7 +54,7 @@ void sound_create_square_wave(uint sample_rate, unsigned short *data, int size, /* Operations for sound */ struct sound_ops { /** - * setup() - Set up to play a sound + * setup() - Set up to play a sound (optional) */ int (*setup)(struct udevice *dev); @@ -66,6 +67,40 @@ struct sound_ops { * @return 0 if OK, -ve on error */ int (*play)(struct udevice *dev, void *data, uint data_size); + + /** + * stop_play() - Indicate that there is no more data coming + * + * This is called once play() has finished sending all the data to the + * output device. This may be used to tell the hardware to turn off the + * codec, for example. + * + * @dev: Sound device + * @return 0 if OK, -ve on error + */ + int (*stop_play)(struct udevice *dev); + + /** + * 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) @@ -86,6 +121,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