dm: sound: Create a uclass for sound

The sound driver pulls together the audio codec and i2s drivers in order
to actually make sounds. It supports setup() and play() methods. The
sound_find_codec_i2s() function allows locating the linked codec and i2s
devices. They can be referred to from uclass-private data.

Add a uclass and a test for sound.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2018-12-10 10:37:36 -07:00
parent e625b68b04
commit d490189865
10 changed files with 351 additions and 4 deletions

View File

@@ -538,6 +538,17 @@
compatible = "sandbox,smem";
};
sound {
compatible = "sandbox,sound";
cpu {
sound-dai = <&i2s 0>;
};
codec {
sound-dai = <&audio 0>;
};
};
spi@0 {
#address-cells = <1>;
#size-cells = <0>;

View File

@@ -141,4 +141,24 @@ void sandbox_get_codec_params(struct udevice *dev, int *interfacep, int *ratep,
*/
int sandbox_get_i2s_sum(struct udevice *dev);
/**
* sandbox_get_setup_called() - Returns the number of times setup(*) was called
*
* This is used in the sound test
*
* @dev: Device to check
* @return call count for the setup() method
*/
int sandbox_get_setup_called(struct udevice *dev);
/**
* sandbox_get_sound_sum() - Read back the sum of the sound data so far
*
* This data is provided to the sandbox driver by the sound play() method.
*
* @dev: Device to check
* @return sum of audio data
*/
int sandbox_get_sound_sum(struct udevice *dev);
#endif