From: RongJun Ying <rjying@gmail.com>
To: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
rjying@gmail.com
Cc: Takashi Iwai <tiwai@suse.de>, Rongjun Ying <rongjun.ying@csr.com>,
alsa-devel@alsa-project.org, workgroup.linux@csr.com
Subject: [PATCH v4-resend 7/7] ASoC: sirf: Add bt-sco card
Date: Wed, 26 Feb 2014 15:22:22 +0800 [thread overview]
Message-ID: <1393399342-31177-8-git-send-email-rongjun.ying@csr.com> (raw)
In-Reply-To: <1393399342-31177-1-git-send-email-rongjun.ying@csr.com>
From: Rongjun Ying <rongjun.ying@csr.com>
This connects platform DAI, USP(DSP mode) CPU DAI and
bt-sco Codec DAI together and works as a mach driver.
Signed-off-by: Rongjun Ying <rongjun.ying@csr.com>
---
.../devicetree/bindings/sound/sirf-bt-sco.txt | 18 ++++
sound/soc/sirf/Kconfig | 6 +
sound/soc/sirf/Makefile | 2 +
sound/soc/sirf/sirf-bt-sco.c | 99 ++++++++++++++++++++
4 files changed, 125 insertions(+), 0 deletions(-)
create mode 100644 Documentation/devicetree/bindings/sound/sirf-bt-sco.txt
create mode 100644 sound/soc/sirf/sirf-bt-sco.c
diff --git a/Documentation/devicetree/bindings/sound/sirf-bt-sco.txt b/Documentation/devicetree/bindings/sound/sirf-bt-sco.txt
new file mode 100644
index 0000000..e51de20
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/sirf-bt-sco.txt
@@ -0,0 +1,18 @@
+* SiRF atlas6/prima2 and bt-sco based audio setups
+
+Required properties:
+- compatible: "sirf,sirf-bt-sco"
+- sirf,usp-controller: The phandle of the SiRF usp controller.
+
+Optional properties:
+- bt-sco-master: The phandle of who is master, if set,
+ the codec is master, Otherwiss, the soc is master.
+
+Example:
+
+sirf-bt-sco {
+ compatible = "sirf,sirf-bt-sco";
+ sirf,usp-controller = <&usp0>;
+ bt-sco-master;
+};
+
diff --git a/sound/soc/sirf/Kconfig b/sound/soc/sirf/Kconfig
index bdd5869..a24a992 100644
--- a/sound/soc/sirf/Kconfig
+++ b/sound/soc/sirf/Kconfig
@@ -21,6 +21,12 @@ config SND_SOC_SIRF_I2S
select REGMAP_MMIO
tristate
+config SND_SOC_SIRF_BT_SCO
+ tristate "SoC Audio support for BT SCO"
+ depends on SND_SOC_SIRF
+ select SND_SOC_BT_SCO
+ select SND_SOC_SIRF_USP
+
config SND_SOC_SIRF_HDMI
tristate "SoC Audio support for SiRF HDMI"
depends on SND_SOC_SIRF
diff --git a/sound/soc/sirf/Makefile b/sound/soc/sirf/Makefile
index 1581b5a..0d4a6b7 100644
--- a/sound/soc/sirf/Makefile
+++ b/sound/soc/sirf/Makefile
@@ -2,10 +2,12 @@ snd-soc-sirf-audio-port-objs := sirf-audio-port.o
snd-soc-sirf-audio-objs := sirf-audio.o
snd-soc-sirf-usp-objs := sirf-usp.o
snd-soc-sirf-i2s-objs := sirf-i2s.o
+snd-soc-sirf-bt-sco-objs := sirf-bt-sco.o
snd-soc-sirf-hdmi-objs := sirf-hdmi.o
obj-$(CONFIG_SND_SOC_SIRF_AUDIO_PORT) += snd-soc-sirf-audio-port.o
obj-$(CONFIG_SND_SOC_SIRF_AUDIO) += snd-soc-sirf-audio.o
obj-$(CONFIG_SND_SOC_SIRF_USP) += snd-soc-sirf-usp.o
obj-$(CONFIG_SND_SOC_SIRF_I2S) += snd-soc-sirf-i2s.o
+obj-$(CONFIG_SND_SOC_SIRF_BT_SCO) += snd-soc-sirf-bt-sco.o
obj-$(CONFIG_SND_SOC_SIRF_HDMI) += snd-soc-sirf-hdmi.o
diff --git a/sound/soc/sirf/sirf-bt-sco.c b/sound/soc/sirf/sirf-bt-sco.c
new file mode 100644
index 0000000..e01b280
--- /dev/null
+++ b/sound/soc/sirf/sirf-bt-sco.c
@@ -0,0 +1,99 @@
+/*
+ * SiRF bt sco ALSA SoC Audio board driver
+ *
+ * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
+ *
+ * Licensed under GPLv2 or later.
+ */
+#include <linux/module.h>
+#include <linux/of.h>
+
+#include <sound/soc.h>
+
+static int sirf_bt_sco_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+ struct snd_soc_codec *codec = rtd->codec;
+ struct snd_soc_card *card = codec->card;
+ unsigned int fmt;
+ int ret;
+
+ fmt = card->dai_link[0].dai_fmt;
+
+ /* Set cpu DAI configuration */
+ ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
+ if (ret < 0) {
+ dev_err(card->dev, "can't set cpu DAI configuration\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+static struct snd_soc_ops sirf_bt_sco_ops = {
+ .hw_params = sirf_bt_sco_hw_params,
+};
+
+/* Digital audio interface glue - connects codec <--> CPU */
+static struct snd_soc_dai_link sirf_bt_sco_dai_links[] = {
+ {
+ .name = "SiRF BT SCO",
+ .stream_name = "SiRF BT_SCO",
+ .codec_dai_name = "bt-sco-pcm",
+ .codec_name = "bt-sco",
+ .ops = &sirf_bt_sco_ops,
+ },
+};
+
+static struct snd_soc_card snd_soc_sirf_bt_sco_card = {
+ .name = "SiRF BT SCO",
+ .owner = THIS_MODULE,
+ .dai_link = sirf_bt_sco_dai_links,
+ .num_links = ARRAY_SIZE(sirf_bt_sco_dai_links),
+};
+
+static int sirf_bt_sco_probe(struct platform_device *pdev)
+{
+ struct snd_soc_card *card = &snd_soc_sirf_bt_sco_card;
+ int ret;
+
+ sirf_bt_sco_dai_links[0].cpu_of_node =
+ of_parse_phandle(pdev->dev.of_node, "sirf,usp-controller", 0);
+ sirf_bt_sco_dai_links[0].platform_of_node =
+ of_parse_phandle(pdev->dev.of_node, "sirf,usp-controller", 0);
+ if (of_property_read_bool(pdev->dev.of_node, "bt-sco-master"))
+ sirf_bt_sco_dai_links[0].dai_fmt = SND_SOC_DAIFMT_CBM_CFM;
+ else
+ sirf_bt_sco_dai_links[0].dai_fmt = SND_SOC_DAIFMT_CBS_CFS;
+ card->dev = &pdev->dev;
+
+ ret = devm_snd_soc_register_card(&pdev->dev, card);
+ if (ret)
+ dev_err(&pdev->dev, "snd_soc_register_card() failed:%d\n", ret);
+
+ return ret;
+}
+
+static const struct of_device_id sirf_bt_sco_of_match[] = {
+ { .compatible = "sirf,sirf-bt-sco", },
+ {}
+};
+MODULE_DEVICE_TABLE(of, sirf_bt_sco_of_match);
+
+static struct platform_driver sirf_bt_sco_driver = {
+ .driver = {
+ .name = "sirf-bt-sco",
+ .owner = THIS_MODULE,
+ .pm = &snd_soc_pm_ops,
+ .of_match_table = sirf_bt_sco_of_match,
+ },
+ .probe = sirf_bt_sco_probe,
+};
+
+module_platform_driver(sirf_bt_sco_driver);
+
+MODULE_DESCRIPTION("SIRF BT SCO ALSA SoC Audio board driver");
+MODULE_AUTHOR("RongJun Ying <Rongjun.Ying@csr.com>");
+MODULE_LICENSE("GPL v2");
--
1.7.5.4
prev parent reply other threads:[~2014-02-26 7:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-26 7:22 [PATCH v4-resend 0/7] ASoC: add CSR SiRFSoC sound drivers RongJun Ying
2014-02-26 7:22 ` [PATCH v4-resend 1/7] ASoC: sirf: Add SiRF internal audio codec driver RongJun Ying
2014-02-27 5:33 ` Mark Brown
2014-02-28 1:52 ` Rongjun Ying
2014-03-01 3:16 ` Mark Brown
2014-03-03 2:15 ` Rongjun Ying
2014-03-03 5:07 ` Mark Brown
2014-03-03 7:48 ` Barry Song
2014-03-04 4:58 ` Mark Brown
2014-03-04 5:11 ` RongJun Ying
2014-03-05 3:34 ` Mark Brown
2014-03-05 5:34 ` RongJun Ying
2014-02-26 7:22 ` [PATCH v4-resend 2/7] ASoC: sirf: Add SiRF audio port driver is used by SiRF internal audio codec RongJun Ying
2014-03-01 4:49 ` Mark Brown
2014-02-26 7:22 ` [PATCH v4-resend 3/7] ASoC: sirf: Add SiRF audio card RongJun Ying
2014-02-26 7:22 ` [PATCH v4-resend 4/7] ASoC: sirf: Add SiRF I2S driver RongJun Ying
2014-02-26 7:22 ` [PATCH v4-resend 5/7] ASoC: sirf: Add hdmi card RongJun Ying
2014-02-26 7:22 ` [PATCH v4-resend 6/7] ASoC: sirf: Add usp driver which is used by dsp mode RongJun Ying
2014-02-26 7:22 ` RongJun Ying [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1393399342-31177-8-git-send-email-rongjun.ying@csr.com \
--to=rjying@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=rongjun.ying@csr.com \
--cc=tiwai@suse.de \
--cc=workgroup.linux@csr.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox