Skip to content

Add Device Tree support for RPi-DAC. #916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions arch/arm/boot/dts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb
dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb
dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb
dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb
dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb
dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb
dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb
dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb
Expand Down
34 changes: 34 additions & 0 deletions arch/arm/boot/dts/rpi-dac-overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Definitions for RPi DAC
/dts-v1/;
/plugin/;

/ {
compatible = "brcm,bcm2708";

fragment@0 {
target = <&sound>;
__overlay__ {
compatible = "rpi,rpi-dac";
i2s-controller = <&i2s>;
status = "okay";
};
};

fragment@1 {
target = <&i2s>;
__overlay__ {
status = "okay";
};
};

fragment@2 {
target-path = "/";
__overlay__ {
pcm1794a-codec {
#sound-dai-cells = <0>;
compatible = "ti,pcm1794a";
status = "okay";
};
};
};
};
21 changes: 21 additions & 0 deletions sound/soc/bcm/rpi-dac.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ static int snd_rpi_rpi_dac_probe(struct platform_device *pdev)
int ret = 0;

snd_rpi_rpi_dac.dev = &pdev->dev;

if (pdev->dev.of_node) {
struct device_node *i2s_node;
struct snd_soc_dai_link *dai = &snd_rpi_rpi_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_rpi_dac);
if (ret)
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret);
Expand All @@ -81,10 +95,17 @@ static int snd_rpi_rpi_dac_remove(struct platform_device *pdev)
return snd_soc_unregister_card(&snd_rpi_rpi_dac);
}

static const struct of_device_id snd_rpi_rpi_dac_of_match[] = {
{ .compatible = "rpi,rpi-dac", },
{},
};
MODULE_DEVICE_TABLE(of, snd_rpi_rpi_dac_of_match);

static struct platform_driver snd_rpi_rpi_dac_driver = {
.driver = {
.name = "snd-rpi-dac",
.owner = THIS_MODULE,
.of_match_table = snd_rpi_rpi_dac_of_match,
},
.probe = snd_rpi_rpi_dac_probe,
.remove = snd_rpi_rpi_dac_remove,
Expand Down
7 changes: 7 additions & 0 deletions sound/soc/codecs/pcm1794a.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,19 @@ static int pcm1794a_remove(struct platform_device *pdev)
return 0;
}

static const struct of_device_id pcm1794a_of_match[] = {
{ .compatible = "ti,pcm1794a", },
{ }
};
MODULE_DEVICE_TABLE(of, pcm1794a_of_match);

static struct platform_driver pcm1794a_codec_driver = {
.probe = pcm1794a_probe,
.remove = pcm1794a_remove,
.driver = {
.name = "pcm1794a-codec",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(pcm1794a_of_match),
},
};

Expand Down