diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index a034d527dce99..01a05f5a22862 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -52,6 +52,7 @@ dtb-$(CONFIG_ARCH_AT91) += sama5d36ek.dtb dtb-$(CONFIG_ARCH_ATLAS6) += atlas6-evb.dtb dtb-$(CONFIG_ARCH_AXXIA) += axm5516-amarillo.dtb dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b.dtb +dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b-plus.dtb dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb dtb-$(CONFIG_ARCH_BCM_5301X) += bcm4708-netgear-r6250.dtb dtb-$(CONFIG_ARCH_BCM_MOBILE) += bcm28155-ap.dtb \ @@ -495,6 +496,7 @@ dtb-$(CONFIG_MACH_DOVE) += dove-cm-a510.dtb \ targets += dtbs dtbs_install targets += $(dtb-y) + endif # *.dtb used to be generated in the directory above. Clean out the diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts new file mode 100644 index 0000000000000..983c23f6467db --- /dev/null +++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts @@ -0,0 +1,81 @@ +/dts-v1/; + +/include/ "bcm2708.dtsi" + +/ { + compatible = "brcm,bcm2708"; + model = "Raspberry Pi Model B+"; + + aliases { + spi0 = &spi0; + i2c0 = &i2c0; + i2c1 = &i2c1; + i2s = &i2s; + gpio = &gpio; + sound = &sound; + }; + + sound: sound { + }; +}; + +&gpio { + spi0_pins: spi0_pins { + brcm,pins = <7 8 9 10 11>; + brcm,function = <4>; /* alt0 */ + }; + + i2c0_pins: i2c0 { + brcm,pins = <0 1>; + brcm,function = <4>; + }; + + i2c1_pins: i2c1 { + brcm,pins = <2 3>; + brcm,function = <4>; + }; + + i2s_pins: i2s { + brcm,pins = <18 19 20 21>; + brcm,function = <4>; /* alt0 */ + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; + + spidev@0{ + compatible = "spidev"; + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; + spi-max-frequency = <500000>; + }; + + spidev@1{ + compatible = "spidev"; + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; + spi-max-frequency = <500000>; + }; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + clock-frequency = <100000>; +}; + +&i2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_pins>; + clock-frequency = <100000>; +}; + +&i2s { + #sound-dai-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&i2s_pins>; +}; diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts index 5893122ff7306..d8c6d15c9e777 100644 --- a/arch/arm/boot/dts/bcm2708-rpi-b.dts +++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts @@ -4,12 +4,18 @@ / { compatible = "brcm,bcm2708"; - model = "Raspberry Pi"; + model = "Raspberry Pi Model B"; aliases { spi0 = &spi0; i2c0 = &i2c0; i2c1 = &i2c1; + i2s = &i2s; + gpio = &gpio; + sound = &sound; + }; + + sound: sound { }; }; @@ -28,6 +34,11 @@ brcm,pins = <2 3>; brcm,function = <4>; }; + + i2s_pins: i2s { + brcm,pins = <28 29 30 31>; + brcm,function = <4>; /* alt0 */ + }; }; &spi0 { @@ -62,3 +73,9 @@ pinctrl-0 = <&i2c1_pins>; clock-frequency = <100000>; }; + +&i2s { + #sound-dai-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&i2s_pins>; +}; diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi index edf361940decc..3e035db0a2e0c 100644 --- a/arch/arm/boot/dts/bcm2708.dtsi +++ b/arch/arm/boot/dts/bcm2708.dtsi @@ -7,11 +7,8 @@ interrupt-parent = <&intc>; chosen { - /* - bootargs must be 1024 characters long because the - VC bootloader can't expand it - */ - bootargs = "console=ttyAMA0 "; + /* No padding required - the boot loader can do that. */ + bootargs = "console=ttyAMA0"; }; soc { @@ -34,6 +31,17 @@ #gpio-cells = <2>; }; + i2s: i2s@7e203000 { + compatible = "brcm,bcm2708-i2s"; + reg = <0x7e203000 0x20>, + <0x7e101098 0x02>; + + //dmas = <&dma 2>, + // <&dma 3>; + dma-names = "tx", "rx"; + status = "disabled"; + }; + spi0: spi@7e204000 { compatible = "brcm,bcm2708-spi"; reg = <0x7e204000 0x1000>; diff --git a/arch/arm/boot/dts/hifiberry-dac-overlay.dts b/arch/arm/boot/dts/hifiberry-dac-overlay.dts new file mode 100644 index 0000000000000..5e7633ae85cd3 --- /dev/null +++ b/arch/arm/boot/dts/hifiberry-dac-overlay.dts @@ -0,0 +1,34 @@ +// Definitions for HiFiBerry DAC +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2708"; + + fragment@0 { + target = <&sound>; + __overlay__ { + compatible = "hifiberry,hifiberry-dac"; + i2s-controller = <&i2s>; + status = "okay"; + }; + }; + + fragment@1 { + target = <&i2s>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@2 { + target-path = "/"; + __overlay__ { + pcm5102a-codec { + #sound-dai-cells = <0>; + compatible = "ti,pcm5102a"; + status = "okay"; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/hifiberry-dacplus-overlay.dts new file mode 100644 index 0000000000000..deb9c625fe861 --- /dev/null +++ b/arch/arm/boot/dts/hifiberry-dacplus-overlay.dts @@ -0,0 +1,39 @@ +// Definitions for HiFiBerry DAC+ +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2708"; + + fragment@0 { + target = <&sound>; + __overlay__ { + compatible = "hifiberry,hifiberry-dacplus"; + i2s-controller = <&i2s>; + status = "okay"; + }; + }; + + fragment@1 { + target = <&i2s>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@2 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + pcm5122@4d { + #sound-dai-cells = <0>; + compatible = "ti,pcm5122"; + reg = <0x4d>; + status = "okay"; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/hifiberry-digi-overlay.dts b/arch/arm/boot/dts/hifiberry-digi-overlay.dts new file mode 100644 index 0000000000000..d0e0d8aa63a9b --- /dev/null +++ b/arch/arm/boot/dts/hifiberry-digi-overlay.dts @@ -0,0 +1,39 @@ +// Definitions for HiFiBerry Digi +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2708"; + + fragment@0 { + target = <&sound>; + __overlay__ { + compatible = "hifiberry,hifiberry-digi"; + i2s-controller = <&i2s>; + status = "okay"; + }; + }; + + fragment@1 { + target = <&i2s>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@2 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + wm8804@3b { + #sound-dai-cells = <0>; + compatible = "wlf,wm8804"; + reg = <0x3b>; + status = "okay"; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/iqaudio-dac-overlay.dts b/arch/arm/boot/dts/iqaudio-dac-overlay.dts new file mode 100644 index 0000000000000..ea8173e529117 --- /dev/null +++ b/arch/arm/boot/dts/iqaudio-dac-overlay.dts @@ -0,0 +1,39 @@ +// Definitions for IQaudIO DAC +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2708"; + + fragment@0 { + target = <&sound>; + __overlay__ { + compatible = "iqaudio,iqaudio-dac"; + i2s-controller = <&i2s>; + status = "okay"; + }; + }; + + fragment@1 { + target = <&i2s>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@2 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + pcm5122@4c { + #sound-dai-cells = <0>; + compatible = "ti,pcm5122"; + reg = <0x4c>; + status = "okay"; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/iqaudio-dacplus-overlay.dts new file mode 100644 index 0000000000000..735d8abfccb2e --- /dev/null +++ b/arch/arm/boot/dts/iqaudio-dacplus-overlay.dts @@ -0,0 +1,39 @@ +// Definitions for IQaudIO DAC+ +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2708"; + + fragment@0 { + target = <&sound>; + __overlay__ { + compatible = "iqaudio,iqaudio-dac"; + i2s-controller = <&i2s>; + status = "okay"; + }; + }; + + fragment@1 { + target = <&i2s>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@2 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + pcm5122@4c { + #sound-dai-cells = <0>; + compatible = "ti,pcm5122"; + reg = <0x4c>; + status = "okay"; + }; + }; + }; +}; diff --git a/sound/soc/bcm/hifiberry_dac.c b/sound/soc/bcm/hifiberry_dac.c index 4b70b45a1cf72..3ab0f4705a9ff 100644 --- a/sound/soc/bcm/hifiberry_dac.c +++ b/sound/soc/bcm/hifiberry_dac.c @@ -72,6 +72,21 @@ static int snd_rpi_hifiberry_dac_probe(struct platform_device *pdev) int ret = 0; snd_rpi_hifiberry_dac.dev = &pdev->dev; + + if (pdev->dev.of_node) { + struct device_node *i2s_node; + struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_dac_dai[0]; + i2s_node = of_parse_phandle(pdev->dev.of_node, + "i2s-controller", 0); + + if (i2s_node) { + dai->cpu_dai_name = NULL; + dai->cpu_of_node = i2s_node; + dai->platform_name = NULL; + dai->platform_of_node = i2s_node; + } + } + ret = snd_soc_register_card(&snd_rpi_hifiberry_dac); if (ret) dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); @@ -84,10 +99,17 @@ static int snd_rpi_hifiberry_dac_remove(struct platform_device *pdev) return snd_soc_unregister_card(&snd_rpi_hifiberry_dac); } +static const struct of_device_id snd_rpi_hifiberry_dac_of_match[] = { + { .compatible = "hifiberry,hifiberry-dac", }, + {}, +}; +MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dac_of_match); + static struct platform_driver snd_rpi_hifiberry_dac_driver = { .driver = { .name = "snd-hifiberry-dac", .owner = THIS_MODULE, + .of_match_table = snd_rpi_hifiberry_dac_of_match, }, .probe = snd_rpi_hifiberry_dac_probe, .remove = snd_rpi_hifiberry_dac_remove, diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c index c63387b59fb41..11e4f3918bfc6 100644 --- a/sound/soc/bcm/hifiberry_dacplus.c +++ b/sound/soc/bcm/hifiberry_dacplus.c @@ -90,6 +90,21 @@ static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) int ret = 0; snd_rpi_hifiberry_dacplus.dev = &pdev->dev; + + if (pdev->dev.of_node) { + struct device_node *i2s_node; + struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_dacplus_dai[0]; + i2s_node = of_parse_phandle(pdev->dev.of_node, + "i2s-controller", 0); + + if (i2s_node) { + dai->cpu_dai_name = NULL; + dai->cpu_of_node = i2s_node; + dai->platform_name = NULL; + dai->platform_of_node = i2s_node; + } + } + ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); if (ret) dev_err(&pdev->dev, @@ -103,10 +118,17 @@ static int snd_rpi_hifiberry_dacplus_remove(struct platform_device *pdev) return snd_soc_unregister_card(&snd_rpi_hifiberry_dacplus); } +static const struct of_device_id snd_rpi_hifiberry_dacplus_of_match[] = { + { .compatible = "hifiberry,hifiberry-dacplus", }, + {}, +}; +MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_dacplus_of_match); + static struct platform_driver snd_rpi_hifiberry_dacplus_driver = { .driver = { .name = "snd-rpi-hifiberry-dacplus", .owner = THIS_MODULE, + .of_match_table = snd_rpi_hifiberry_dacplus_of_match, }, .probe = snd_rpi_hifiberry_dacplus_probe, .remove = snd_rpi_hifiberry_dacplus_remove, diff --git a/sound/soc/bcm/hifiberry_digi.c b/sound/soc/bcm/hifiberry_digi.c index e4f769de46df0..76af8a6f58ad3 100644 --- a/sound/soc/bcm/hifiberry_digi.c +++ b/sound/soc/bcm/hifiberry_digi.c @@ -125,6 +125,21 @@ static int snd_rpi_hifiberry_digi_probe(struct platform_device *pdev) int ret = 0; snd_rpi_hifiberry_digi.dev = &pdev->dev; + + if (pdev->dev.of_node) { + struct device_node *i2s_node; + struct snd_soc_dai_link *dai = &snd_rpi_hifiberry_digi_dai[0]; + i2s_node = of_parse_phandle(pdev->dev.of_node, + "i2s-controller", 0); + + if (i2s_node) { + dai->cpu_dai_name = NULL; + dai->cpu_of_node = i2s_node; + dai->platform_name = NULL; + dai->platform_of_node = i2s_node; + } + } + ret = snd_soc_register_card(&snd_rpi_hifiberry_digi); if (ret) dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); @@ -137,10 +152,17 @@ static int snd_rpi_hifiberry_digi_remove(struct platform_device *pdev) return snd_soc_unregister_card(&snd_rpi_hifiberry_digi); } +static const struct of_device_id snd_rpi_hifiberry_digi_of_match[] = { + { .compatible = "hifiberry,hifiberry-digi", }, + {}, +}; +MODULE_DEVICE_TABLE(of, snd_rpi_hifiberry_digi_of_match); + static struct platform_driver snd_rpi_hifiberry_digi_driver = { .driver = { .name = "snd-hifiberry-digi", .owner = THIS_MODULE, + .of_match_table = snd_rpi_hifiberry_digi_of_match, }, .probe = snd_rpi_hifiberry_digi_probe, .remove = snd_rpi_hifiberry_digi_remove, diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c index 8d0e2aebad97f..ee8cd6ee4b2d6 100644 --- a/sound/soc/bcm/iqaudio-dac.c +++ b/sound/soc/bcm/iqaudio-dac.c @@ -76,6 +76,21 @@ static int snd_rpi_iqaudio_dac_probe(struct platform_device *pdev) int ret = 0; snd_rpi_iqaudio_dac.dev = &pdev->dev; + + if (pdev->dev.of_node) { + struct device_node *i2s_node; + struct snd_soc_dai_link *dai = &snd_rpi_iqaudio_dac_dai[0]; + i2s_node = of_parse_phandle(pdev->dev.of_node, + "i2s-controller", 0); + + if (i2s_node) { + dai->cpu_dai_name = NULL; + dai->cpu_of_node = i2s_node; + dai->platform_name = NULL; + dai->platform_of_node = i2s_node; + } + } + ret = snd_soc_register_card(&snd_rpi_iqaudio_dac); if (ret) dev_err(&pdev->dev, @@ -93,6 +108,7 @@ static const struct of_device_id iqaudio_of_match[] = { { .compatible = "iqaudio,iqaudio-dac", }, {}, }; +MODULE_DEVICE_TABLE(of, iqaudio_of_match); static struct platform_driver snd_rpi_iqaudio_dac_driver = { .driver = { diff --git a/sound/soc/codecs/pcm5102a.c b/sound/soc/codecs/pcm5102a.c index 126f1e97b0adc..7c6598e717c52 100644 --- a/sound/soc/codecs/pcm5102a.c +++ b/sound/soc/codecs/pcm5102a.c @@ -47,12 +47,19 @@ static int pcm5102a_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id pcm5102a_of_match[] = { + { .compatible = "ti,pcm5102a", }, + { } +}; +MODULE_DEVICE_TABLE(of, pcm5102a_of_match); + static struct platform_driver pcm5102a_codec_driver = { .probe = pcm5102a_probe, .remove = pcm5102a_remove, .driver = { .name = "pcm5102a-codec", .owner = THIS_MODULE, + .of_match_table = pcm5102a_of_match, }, };