-
-
Save clivem/9d1da750f666dc1d1ede4df761079742 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/sound/soc/bcm/bcm2835-i2s.c 2016-05-13 19:49:44.236844756 +0100 | |
+++ b/sound/soc/bcm/bcm2835-i2s.c 2016-05-13 20:15:04.063569480 +0100 | |
@@ -110,6 +110,8 @@ | |
#define BCM2835_I2S_INT_RXR BIT(1) | |
#define BCM2835_I2S_INT_TXW BIT(0) | |
+static bool bclk_ratio_integer_div = false; | |
+ | |
/* General device struct */ | |
struct bcm2835_i2s_dev { | |
struct device *dev; | |
@@ -296,6 +298,20 @@ | |
/* If bclk_ratio already set, use that one. */ | |
if (dev->bclk_ratio) | |
bclk_ratio = dev->bclk_ratio; | |
+ else if (bclk_ratio_integer_div && sampling_rate >= 8000 && | |
+ sampling_rate < 192000 && sampling_rate % 8000 == 0) { | |
+ switch(data_length) { | |
+ case 16: | |
+ case 24: | |
+ bclk_ratio = 50; | |
+ break; | |
+ case 32: | |
+ bclk_ratio = 100; | |
+ break; | |
+ default: | |
+ return -EINVAL; | |
+ } | |
+ } | |
else | |
/* otherwise calculate a fitting block ratio */ | |
bclk_ratio = 2 * data_length; | |
@@ -752,6 +768,9 @@ | |
dev->dma_data[SNDRV_PCM_STREAM_CAPTURE].flags = | |
SND_DMAENGINE_PCM_DAI_FLAG_PACK; | |
+ bclk_ratio_integer_div = of_property_read_bool(pdev->dev.of_node, | |
+ "brcm,bclk_ratio_integer_div"); | |
+ | |
/* BCLK ratio - use default */ | |
dev->bclk_ratio = 0; | |
--- a/arch/arm/boot/dts/overlays/Makefile 2016-05-14 08:12:02.162552494 +0100 | |
+++ b/arch/arm/boot/dts/overlays/Makefile 2016-05-14 08:12:02.179552658 +0100 | |
@@ -75,6 +75,8 @@ | |
dtbo-$(RPI_DT_OVERLAYS) += sdio.dtbo | |
dtbo-$(RPI_DT_OVERLAYS) += sdio-1bit.dtbo | |
dtbo-$(RPI_DT_OVERLAYS) += sdtweak.dtbo | |
+dtbo-$(RPI_DT_OVERLAYS) += simple-es9023-dac.dtbo | |
+dtbo-$(RPI_DT_OVERLAYS) += simple-pcm5102a-dac.dtbo | |
dtbo-$(RPI_DT_OVERLAYS) += smi-dev.dtbo | |
dtbo-$(RPI_DT_OVERLAYS) += smi-nand.dtbo | |
dtbo-$(RPI_DT_OVERLAYS) += smi.dtbo | |
--- a/arch/arm/boot/dts/overlays/README 2016-05-14 08:12:02.166552533 +0100 | |
+++ b/arch/arm/boot/dts/overlays/README 2016-05-14 08:12:02.179552658 +0100 | |
@@ -988,6 +988,26 @@ | |
debug Enable debug output (default off) | |
+Name: simple-es9023-dac | |
+Info: Configures a generic board or HAT using ESS Sabre ES9023 DAC | |
+Load: dtoverlay=simple-es9023-dac,<param>,<param>=<val> | |
+Params: 384k Instructs the es9023 codec driver to support | |
+ 352k8 and 384k sample rates. | |
+ bclk_ratio_integer_div Use bclk_ratio=50 for 16 and 24 bps and | |
+ bclk_ratio=100 for 32 bps media when sample rate | |
+ is a multiple of 8000 and less than 192kHz, | |
+ which allows the use of the OSC with integer | |
+ divider rather than PLL with fractional (MASH) | |
+ divider. | |
+ card-name Override the default, "es9023", card name. | |
+ | |
+ | |
+Name: simple-pcm5102a-dac | |
+Info: Configures a generic board or HAT using the TI PCM510x DAC | |
+Load: dtoverlay=simple-pcm5102a-dac,<param>=<val> | |
+Params: card-name Override the default, "pcm5102a", card name. | |
+ | |
+ | |
Name: smi | |
Info: Enables the Secondary Memory Interface peripheral. Uses GPIOs 2-25! | |
Load: dtoverlay=smi | |
--- /dev/null 2016-05-10 03:25:07.508683409 +0100 | |
+++ b/arch/arm/boot/dts/overlays/simple-es9023-dac-overlay.dts 2016-05-15 01:48:29.153985281 +0100 | |
@@ -0,0 +1,47 @@ | |
+// Definitions for a generic board or HAT using ESS Sabre ES9023 DAC | |
+/dts-v1/; | |
+/plugin/; | |
+ | |
+/ { | |
+ compatible = "brcm,bcm2708"; | |
+ | |
+ fragment@0 { | |
+ target = <&i2s>; | |
+ i2s_overlay: __overlay__ { | |
+ status = "okay"; | |
+ }; | |
+ }; | |
+ | |
+ fragment@1 { | |
+ target-path = "/"; | |
+ __overlay__ { | |
+ es9023_codec: es9023-codec { | |
+ #sound-dai-cells = <0>; | |
+ compatible = "ess,es9023"; | |
+ status = "okay"; | |
+ }; | |
+ }; | |
+ }; | |
+ | |
+ fragment@2 { | |
+ target = <&sound>; | |
+ sound_overlay: __overlay__ { | |
+ compatible = "simple-audio-card"; | |
+ simple-audio-card,format = "i2s"; | |
+ simple-audio-card,name = "es9023"; | |
+ status = "okay"; | |
+ simple-audio-card,cpu { | |
+ sound-dai = <&i2s>; | |
+ }; | |
+ simple-audio-card,codec { | |
+ sound-dai = <&es9023_codec>; | |
+ }; | |
+ }; | |
+ }; | |
+ | |
+ __overrides__ { | |
+ 384k = <&es9023_codec>,"es9023,384k?"; | |
+ bclk_ratio_integer_div = <&i2s_overlay>,"brcm,bclk_ratio_integer_div?"; | |
+ card-name = <&sound_overlay>,"simple-audio-card,name"; | |
+ }; | |
+}; | |
--- /dev/null 2016-05-10 03:25:07.508683409 +0100 | |
+++ b/arch/arm/boot/dts/overlays/simple-pcm5102a-dac-overlay.dts 2016-05-15 01:42:07.645365639 +0100 | |
@@ -0,0 +1,46 @@ | |
+// Definitions for a generic board or HAT using TI PCM510x | |
+/dts-v1/; | |
+/plugin/; | |
+ | |
+/ { | |
+ compatible = "brcm,bcm2708"; | |
+ | |
+ fragment@0 { | |
+ target = <&i2s>; | |
+ __overlay__ { | |
+ status = "okay"; | |
+ }; | |
+ }; | |
+ | |
+ fragment@1 { | |
+ target-path = "/"; | |
+ __overlay__ { | |
+ pcm5102a_codec: pcm5102a-codec { | |
+ #sound-dai-cells = <0>; | |
+ compatible = "ti,pcm5102a"; | |
+ pcm5102a,384k; | |
+ status = "okay"; | |
+ }; | |
+ }; | |
+ }; | |
+ | |
+ fragment@2 { | |
+ target = <&sound>; | |
+ sound_overlay: __overlay__ { | |
+ compatible = "simple-audio-card"; | |
+ simple-audio-card,format = "i2s"; | |
+ simple-audio-card,name = "pcm5102a"; | |
+ status = "okay"; | |
+ simple-audio-card,cpu { | |
+ sound-dai = <&i2s>; | |
+ }; | |
+ simple-audio-card,codec { | |
+ sound-dai = <&pcm5102a_codec>; | |
+ }; | |
+ }; | |
+ }; | |
+ | |
+ __overrides__ { | |
+ card-name = <&sound_overlay>,"simple-audio-card,name"; | |
+ }; | |
+}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment