* [PATCH V5 0/2] Add DT support for i2s
@ 2012-12-13 10:42 Padmavathi Venna
2012-12-13 10:42 ` [PATCH V5 1/2] ASoC: Samsung: Rename samsung i2s secondary device name Padmavathi Venna
2012-12-13 10:42 ` [PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s Padmavathi Venna
0 siblings, 2 replies; 12+ messages in thread
From: Padmavathi Venna @ 2012-12-13 10:42 UTC (permalink / raw)
To: linux-arm-kernel
V5 patches are based on Mark Brown's for-next branch of
"git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git"
Changes since V4:
- Add a new patch for renaming the samsung i2s secondary fifo interface
device name from "samsung-i2s.4" to "samsung-i2s-sec"
- Add platform_device_id table for the primary and secondary DAIs
- Avoid using of alias ids in the i2s driver by adding of_device_id
table. Primary device can get registered via dt or non-dt but secondary
device can get registered only at runtime because the secondary is not
physically present on the board.
Changes since V3:
- Added syntex of gpio specifier as suggested by Mark Brown in
DT document file
- Added the requirement for having I2S alias ids
- Explained about gpio lines
- Made a seperate patch to get the I2S rclk src clk from alias ID
Changes since V2:
- Rebased on 3.7-rc3
- Custom DT bindings are prefixed with samsung
- As generic device tree DMA helpers not yet mainlined
I am still using custom dma bindings. So added a
priliminary statement regarding the same. I will rework
on my patch once generic DMA helpers are mainlined.
Chnages since V1:
- Rebased on 3.6-rc6
Padmavathi Venna (2):
ASoC: Samsung: Rename samsung i2s secondary device name
ASoC: SAMSUNG: Add DT support for i2s
.../devicetree/bindings/sound/samsung-i2s.txt | 75 ++++++
sound/soc/samsung/dma.c | 1 +
sound/soc/samsung/dma.h | 1 +
sound/soc/samsung/i2s.c | 262 ++++++++++++++++----
sound/soc/samsung/i2s.h | 7 -
sound/soc/samsung/smdk_wm8580.c | 7 +-
sound/soc/samsung/smdk_wm8994.c | 4 +-
7 files changed, 300 insertions(+), 57 deletions(-)
create mode 100644 Documentation/devicetree/bindings/sound/samsung-i2s.txt
--
1.7.4.4
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH V5 1/2] ASoC: Samsung: Rename samsung i2s secondary device name
2012-12-13 10:42 [PATCH V5 0/2] Add DT support for i2s Padmavathi Venna
@ 2012-12-13 10:42 ` Padmavathi Venna
2012-12-13 10:42 ` [PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s Padmavathi Venna
1 sibling, 0 replies; 12+ messages in thread
From: Padmavathi Venna @ 2012-12-13 10:42 UTC (permalink / raw)
To: linux-arm-kernel
All Samsung SoCs has max 3 i2s controllers. So the i2s secondary fifo
interface device id was named as samsung-i2s.4. Renaming this to
"samsung-i2s-sec" to support device tree in i2s driver.
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---
sound/soc/samsung/i2s.c | 31 ++++++++++++++++++++++++++++---
sound/soc/samsung/i2s.h | 7 -------
sound/soc/samsung/smdk_wm8580.c | 7 ++-----
sound/soc/samsung/smdk_wm8994.c | 4 ++--
4 files changed, 32 insertions(+), 17 deletions(-)
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index d2d124f..ed5eeae 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -29,6 +29,11 @@
#define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t)
+enum samsung_dai_type {
+ TYPE_PRI,
+ TYPE_SEC,
+};
+
struct i2s_dai {
/* Platform device for this DAI */
struct platform_device *pdev;
@@ -981,8 +986,7 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
i2s->i2s_dai_drv.capture.formats = SAMSUNG_I2S_FMTS;
} else { /* Create a new platform_device for Secondary */
i2s->pdev = platform_device_register_resndata(NULL,
- pdev->name, pdev->id + SAMSUNG_I2S_SECOFF,
- NULL, 0, NULL, 0);
+ "samsung-i2s-sec", -1, NULL, 0, NULL, 0);
if (IS_ERR(i2s->pdev))
return NULL;
}
@@ -993,6 +997,11 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
return i2s;
}
+static inline int samsung_i2s_get_driver_data(struct platform_device *pdev)
+{
+ return platform_get_device_id(pdev)->driver_data;
+}
+
static int samsung_i2s_probe(struct platform_device *pdev)
{
u32 dma_pl_chan, dma_cp_chan, dma_pl_sec_chan;
@@ -1001,10 +1010,13 @@ static int samsung_i2s_probe(struct platform_device *pdev)
struct samsung_i2s *i2s_cfg;
struct resource *res;
u32 regs_base, quirks;
+ enum samsung_dai_type samsung_dai_type;
int ret = 0;
/* Call during Seconday interface registration */
- if (pdev->id >= SAMSUNG_I2S_SECOFF) {
+ samsung_dai_type = samsung_i2s_get_driver_data(pdev);
+
+ if (samsung_dai_type == TYPE_SEC) {
sec_dai = dev_get_drvdata(&pdev->dev);
snd_soc_register_dai(&sec_dai->pdev->dev,
&sec_dai->i2s_dai_drv);
@@ -1143,9 +1155,22 @@ static int samsung_i2s_remove(struct platform_device *pdev)
return 0;
}
+static struct platform_device_id samsung_i2s_driver_ids[] = {
+ {
+ .name = "samsung-i2s",
+ .driver_data = TYPE_PRI,
+ }, {
+ .name = "samsung-i2s-sec",
+ .driver_data = TYPE_SEC,
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(platform, samsung-i2s-driver-ids);
+
static struct platform_driver samsung_i2s_driver = {
.probe = samsung_i2s_probe,
.remove = samsung_i2s_remove,
+ .id_table = samsung_i2s_driver_ids,
.driver = {
.name = "samsung-i2s",
.owner = THIS_MODULE,
diff --git a/sound/soc/samsung/i2s.h b/sound/soc/samsung/i2s.h
index d420a7c..7966afc 100644
--- a/sound/soc/samsung/i2s.h
+++ b/sound/soc/samsung/i2s.h
@@ -13,13 +13,6 @@
#ifndef __SND_SOC_SAMSUNG_I2S_H
#define __SND_SOC_SAMSUNG_I2S_H
-/*
- * Maximum number of I2S blocks that any SoC can have.
- * The secondary interface of a CPU dai(if there exists any),
- * is indexed at [cpu-dai's ID + SAMSUNG_I2S_SECOFF]
- */
-#define SAMSUNG_I2S_SECOFF 4
-
#define SAMSUNG_I2S_DIV_BCLK 1
#define SAMSUNG_I2S_RCLKSRC_0 0
diff --git a/sound/soc/samsung/smdk_wm8580.c b/sound/soc/samsung/smdk_wm8580.c
index 7e2b710..7a16b32 100644
--- a/sound/soc/samsung/smdk_wm8580.c
+++ b/sound/soc/samsung/smdk_wm8580.c
@@ -193,9 +193,9 @@ static struct snd_soc_dai_link smdk_dai[] = {
[SEC_PLAYBACK] = { /* Sec_Fifo Playback i/f */
.name = "Sec_FIFO TX",
.stream_name = "Playback",
- .cpu_dai_name = "samsung-i2s.x",
+ .cpu_dai_name = "samsung-i2s-sec",
.codec_dai_name = "wm8580-hifi-playback",
- .platform_name = "samsung-i2s.x",
+ .platform_name = "samsung-i2s-sec",
.codec_name = "wm8580.0-001b",
.ops = &smdk_ops,
},
@@ -223,9 +223,6 @@ static int __init smdk_audio_init(void)
if (machine_is_smdkc100()
|| machine_is_smdkv210() || machine_is_smdkc110()) {
smdk.num_links = 3;
- /* Secondary is at offset SAMSUNG_I2S_SECOFF from Primary */
- str = (char *)smdk_dai[SEC_PLAYBACK].cpu_dai_name;
- str[strlen(str) - 1] = '0' + SAMSUNG_I2S_SECOFF;
} else if (machine_is_smdk6410()) {
str = (char *)smdk_dai[PRI_PLAYBACK].cpu_dai_name;
str[strlen(str) - 1] = '2';
diff --git a/sound/soc/samsung/smdk_wm8994.c b/sound/soc/samsung/smdk_wm8994.c
index b0d0ab8..cc2f407 100644
--- a/sound/soc/samsung/smdk_wm8994.c
+++ b/sound/soc/samsung/smdk_wm8994.c
@@ -134,9 +134,9 @@ static struct snd_soc_dai_link smdk_dai[] = {
}, { /* Sec_Fifo Playback i/f */
.name = "Sec_FIFO TX",
.stream_name = "Sec_Dai",
- .cpu_dai_name = "samsung-i2s.4",
+ .cpu_dai_name = "samsung-i2s-sec",
.codec_dai_name = "wm8994-aif1",
- .platform_name = "samsung-i2s.4",
+ .platform_name = "samsung-i2s-sec",
.codec_name = "wm8994-codec",
.ops = &smdk_ops,
},
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s
2012-12-13 10:42 [PATCH V5 0/2] Add DT support for i2s Padmavathi Venna
2012-12-13 10:42 ` [PATCH V5 1/2] ASoC: Samsung: Rename samsung i2s secondary device name Padmavathi Venna
@ 2012-12-13 10:42 ` Padmavathi Venna
2012-12-19 13:24 ` Grant Likely
1 sibling, 1 reply; 12+ messages in thread
From: Padmavathi Venna @ 2012-12-13 10:42 UTC (permalink / raw)
To: linux-arm-kernel
Add support for device based discovery.
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
---
.../devicetree/bindings/sound/samsung-i2s.txt | 75 +++++++
sound/soc/samsung/dma.c | 1 +
sound/soc/samsung/dma.h | 1 +
sound/soc/samsung/i2s.c | 233 ++++++++++++++++----
4 files changed, 269 insertions(+), 41 deletions(-)
create mode 100644 Documentation/devicetree/bindings/sound/samsung-i2s.txt
diff --git a/Documentation/devicetree/bindings/sound/samsung-i2s.txt b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
new file mode 100644
index 0000000..bff47b4
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
@@ -0,0 +1,75 @@
+* Samsung I2S controller
+
+Required SoC Specific Properties:
+
+- compatible : "samsung,samsung-i2s"
+- reg: physical base address of the controller and length of memory mapped
+ region.
+
+[PRELIMINARY: the dma channel allocation will change once there are
+official DMA bindings]
+
+- tx-dma-channel-secondary: The dma channel specifier for secondary tx
+ operations. The format of the dma specifier depends on the dma
+ controller.
+- tx-dma-channel: The dma channel specifier for tx operations. The format of
+ the dma specifier depends on the dma controller.
+- rx-dma-channel: The dma channel specifier for rx operations. The format of
+ the dma specifier depends on the dma controller.
+
+Optional SoC Specific Properties:
+
+- samsung,supports-6ch: If the I2S Primary sound source has 5.1 Channel
+ support, this flag is enabled.
+- samsung,supports-rstclr: This flag should be set if I2S software reset bit
+ control is required. When this flag is set I2S software reset bit will be
+ enabled or disabled based on need.
+- samsung,supports-secdai:If I2S block has a secondary FIFO and internal DMA,
+ then this flag is enabled.
+- samsung,idma-addr: Internal DMA register base address of the audio
+ sub system(used in secondary sound source).
+
+Required Board Specific Properties:
+
+- gpios: The gpio specifier for data out,data in, LRCLK, CDCLK and SCLK
+ interface lines. The format of the gpio specifier depends on the gpio
+ controller.
+ The syntax of samsung gpio specifier is
+ <[phandle of the gpio controller node]
+ [pin number within the gpio controller]
+ [mux function]
+ [flags and pull up/down]
+ [drive strength]>
+
+Aliases:
+
+- All the I2S controller nodes are represented in the aliases node using
+ the following format 'i2s{n}' where n is a unique number for the alias.
+
+Example:
+
+- SoC Specific Portion:
+
+i2s at 03830000 {
+ compatible = "samsung,samsung-i2s";
+ reg = <0x03830000 0x100>;
+ tx-dma-channel-secondary = <&pdma0 8>;
+ tx-dma-channel = <&pdma0 10>;
+ rx-dma-channel = <&pdma0 9>;
+ samsung,supports-6ch;
+ samsung,supports-rstclr;
+ samsung,supports-secdai;
+ samsung,idma-addr = <0x03000000>;
+};
+
+- Board Specific Portion:
+
+i2s_0: i2s at 03830000 {
+ gpios = <&gpz 0 2 0 0>, /* I2S_0_SCLK */
+ <&gpz 1 2 0 0>, /* I2S_0_CDCLK */
+ <&gpz 2 2 0 0>, /* I2S_0_LRCK */
+ <&gpz 3 2 0 0>, /* I2S_0_SDI */
+ <&gpz 4 2 0 0>, /* I2S_0_SDO[1] */
+ <&gpz 5 2 0 0>, /* I2S_0_SDO[2] */
+ <&gpz 6 2 0 0>; /* I2S_0_SDO[3] */
+};
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
index db87628..eb79844 100644
--- a/sound/soc/samsung/dma.c
+++ b/sound/soc/samsung/dma.c
@@ -168,6 +168,7 @@ static int dma_hw_params(struct snd_pcm_substream *substream,
req.cap = (samsung_dma_has_circular() ?
DMA_CYCLIC : DMA_SLAVE);
req.client = prtd->params->client;
+ req.dt_dmach_prop = prtd->params->dma_prop;
config.direction =
(substream->stream == SNDRV_PCM_STREAM_PLAYBACK
? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
diff --git a/sound/soc/samsung/dma.h b/sound/soc/samsung/dma.h
index 73d8c7c..9f5b35c 100644
--- a/sound/soc/samsung/dma.h
+++ b/sound/soc/samsung/dma.h
@@ -19,6 +19,7 @@ struct s3c_dma_params {
int dma_size; /* Size of the DMA transfer */
unsigned ch;
struct samsung_dma_ops *ops;
+ struct property *dma_prop;
};
int asoc_dma_platform_register(struct device *dev);
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index ed5eeae..e3c9673 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -15,11 +15,15 @@
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
#include <linux/pm_runtime.h>
#include <sound/soc.h>
#include <sound/pcm_params.h>
+#include <mach/dma.h>
+
#include <linux/platform_data/asoc-s3c.h>
#include "dma.h"
@@ -34,6 +38,10 @@ enum samsung_dai_type {
TYPE_SEC,
};
+struct samsung_i2s_dai_data {
+ int dai_type;
+};
+
struct i2s_dai {
/* Platform device for this DAI */
struct platform_device *pdev;
@@ -71,6 +79,7 @@ struct i2s_dai {
u32 suspend_i2smod;
u32 suspend_i2scon;
u32 suspend_i2spsr;
+ unsigned long gpios[7]; /* i2s gpio line numbers */
};
/* Lock for cross i/f checks */
@@ -997,19 +1006,79 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
return i2s;
}
+#ifdef CONFIG_OF
+static int samsung_i2s_parse_dt_gpio(struct i2s_dai *i2s)
+{
+ struct device *dev = &i2s->pdev->dev;
+ int index, gpio, ret;
+
+ for (index = 0; index < 7; index++) {
+ gpio = of_get_gpio(dev->of_node, index);
+ if (!gpio_is_valid(gpio)) {
+ dev_err(dev, "invalid gpio[%d]: %d\n", index, gpio);
+ goto free_gpio;
+ }
+
+ ret = gpio_request(gpio, dev_name(dev));
+ if (ret) {
+ dev_err(dev, "gpio [%d] request failed\n", gpio);
+ goto free_gpio;
+ }
+ i2s->gpios[index] = gpio;
+ }
+ return 0;
+
+free_gpio:
+ while (--index >= 0)
+ gpio_free(i2s->gpios[index]);
+ return -EINVAL;
+}
+
+static void samsung_i2s_dt_gpio_free(struct i2s_dai *i2s)
+{
+ unsigned int index;
+ for (index = 0; index < 7; index++)
+ gpio_free(i2s->gpios[index]);
+}
+#else
+static int samsung_i2s_parse_dt_gpio(struct i2s_dai *dai)
+{
+ return -EINVAL;
+}
+
+static void samsung_i2s_dt_gpio_free(struct i2s_dai *dai)
+{
+}
+
+#endif
+
+static const struct of_device_id exynos_i2s_match[];
+
static inline int samsung_i2s_get_driver_data(struct platform_device *pdev)
{
- return platform_get_device_id(pdev)->driver_data;
+#ifdef CONFIG_OF
+ struct samsung_i2s_dai_data *data;
+ if (pdev->dev.of_node) {
+ const struct of_device_id *match;
+ match = of_match_node(exynos_i2s_match, pdev->dev.of_node);
+ data = (struct samsung_i2s_dai_data *) match->data;
+ return data->dai_type;
+ } else
+#endif
+ return platform_get_device_id(pdev)->driver_data;
}
static int samsung_i2s_probe(struct platform_device *pdev)
{
- u32 dma_pl_chan, dma_cp_chan, dma_pl_sec_chan;
+ u32 dma_pl_chan, dma_cp_chan;
+ u32 dma_pl_sec_chan = 0;
struct i2s_dai *pri_dai, *sec_dai = NULL;
- struct s3c_audio_pdata *i2s_pdata;
- struct samsung_i2s *i2s_cfg;
+ struct s3c_audio_pdata *i2s_pdata = pdev->dev.platform_data;
+ struct samsung_i2s *i2s_cfg = NULL;
struct resource *res;
- u32 regs_base, quirks;
+ u32 regs_base, quirks = 0, idma_addr = 0;
+ struct property *prop;
+ struct device_node *np = pdev->dev.of_node;
enum samsung_dai_type samsung_dai_type;
int ret = 0;
@@ -1024,31 +1093,82 @@ static int samsung_i2s_probe(struct platform_device *pdev)
return 0;
}
- i2s_pdata = pdev->dev.platform_data;
- if (i2s_pdata == NULL) {
- dev_err(&pdev->dev, "Can't work without s3c_audio_pdata\n");
- return -EINVAL;
+ pri_dai = i2s_alloc_dai(pdev, false);
+ if (!pri_dai) {
+ dev_err(&pdev->dev, "Unable to alloc I2S_pri\n");
+ return -ENOMEM;
}
- res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (!res) {
- dev_err(&pdev->dev, "Unable to get I2S-TX dma resource\n");
- return -ENXIO;
- }
- dma_pl_chan = res->start;
+ if (!np) {
+ res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+ if (!res) {
+ dev_err(&pdev->dev,
+ "Unable to get I2S-TX dma resource\n");
+ return -ENXIO;
+ }
+ dma_pl_chan = res->start;
- res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
- if (!res) {
- dev_err(&pdev->dev, "Unable to get I2S-RX dma resource\n");
- return -ENXIO;
- }
- dma_cp_chan = res->start;
+ res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
+ if (!res) {
+ dev_err(&pdev->dev,
+ "Unable to get I2S-RX dma resource\n");
+ return -ENXIO;
+ }
+ dma_cp_chan = res->start;
- res = platform_get_resource(pdev, IORESOURCE_DMA, 2);
- if (res)
- dma_pl_sec_chan = res->start;
- else
- dma_pl_sec_chan = 0;
+ res = platform_get_resource(pdev, IORESOURCE_DMA, 2);
+ if (res)
+ dma_pl_sec_chan = res->start;
+
+ if (i2s_pdata == NULL) {
+ dev_err(&pdev->dev, "Can't work without s3c_audio_pdata\n");
+ return -EINVAL;
+ }
+
+ if (&i2s_pdata->type)
+ i2s_cfg = &i2s_pdata->type.i2s;
+
+ if (i2s_cfg) {
+ quirks = i2s_cfg->quirks;
+ idma_addr = i2s_cfg->idma_addr;
+ }
+ } else {
+ prop = of_find_property(np, "tx-dma-channel", NULL);
+ if (!prop) {
+ dev_err(&pdev->dev, "tx dma channel property not"\
+ "specified\n");
+ return -ENXIO;
+ }
+ dma_pl_chan = DMACH_DT_PROP;
+ pri_dai->dma_playback.dma_prop = prop;
+
+ prop = of_find_property(np, "rx-dma-channel", NULL);
+ if (!prop) {
+ dev_err(&pdev->dev, "tx dma channel property not"\
+ "specified\n");
+ return -ENXIO;
+ }
+ dma_cp_chan = DMACH_DT_PROP;
+ pri_dai->dma_capture.dma_prop = prop;
+
+ if (of_find_property(np, "samsung,supports-6ch", NULL))
+ quirks |= QUIRK_PRI_6CHAN;
+
+ if (of_find_property(np, "samsung,supports-secdai", NULL))
+ quirks |= QUIRK_SEC_DAI;
+
+ if (of_find_property(np, "samsung,supports-rstclr", NULL))
+ quirks |= QUIRK_NEED_RSTCLR;
+
+ if (of_property_read_u32(np, "samsung,idma-addr",
+ &idma_addr)) {
+ if (quirks & QUIRK_SEC_DAI) {
+ dev_err(&pdev->dev, "idma address is not"\
+ "specified");
+ return -EINVAL;
+ }
+ }
+ }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
@@ -1063,16 +1183,6 @@ static int samsung_i2s_probe(struct platform_device *pdev)
}
regs_base = res->start;
- i2s_cfg = &i2s_pdata->type.i2s;
- quirks = i2s_cfg->quirks;
-
- pri_dai = i2s_alloc_dai(pdev, false);
- if (!pri_dai) {
- dev_err(&pdev->dev, "Unable to alloc I2S_pri\n");
- ret = -ENOMEM;
- goto err;
- }
-
pri_dai->dma_playback.dma_addr = regs_base + I2STXD;
pri_dai->dma_capture.dma_addr = regs_base + I2SRXD;
pri_dai->dma_playback.client =
@@ -1099,20 +1209,41 @@ static int samsung_i2s_probe(struct platform_device *pdev)
sec_dai->dma_playback.dma_addr = regs_base + I2STXDS;
sec_dai->dma_playback.client =
(struct s3c2410_dma_client *)&sec_dai->dma_playback;
+
+ if (np) {
+ prop = of_find_property(np, "tx-dma-channel-secondary",
+ NULL);
+ if (!prop) {
+ dev_err(&pdev->dev, "tx dma channel property"\
+ "not specified\n");
+ ret = -ENXIO;
+ goto err;
+ }
+ sec_dai->dma_playback.dma_prop = prop;
+ }
+
/* Use iDMA always if SysDMA not provided */
sec_dai->dma_playback.channel = dma_pl_sec_chan ? : -1;
sec_dai->dma_playback.dma_size = 4;
sec_dai->base = regs_base;
sec_dai->quirks = quirks;
- sec_dai->idma_playback.dma_addr = i2s_cfg->idma_addr;
+ sec_dai->idma_playback.dma_addr = idma_addr;
sec_dai->pri_dai = pri_dai;
pri_dai->sec_dai = sec_dai;
}
- if (i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) {
- dev_err(&pdev->dev, "Unable to configure gpio\n");
- ret = -EINVAL;
- goto err;
+ if (np) {
+ if (samsung_i2s_parse_dt_gpio(pri_dai)) {
+ dev_err(&pdev->dev, "Unable to configure gpio\n");
+ ret = -EINVAL;
+ goto err;
+ }
+ } else {
+ if (i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) {
+ dev_err(&pdev->dev, "Unable to configure gpio\n");
+ ret = -EINVAL;
+ goto err;
+ }
}
snd_soc_register_dai(&pri_dai->pdev->dev, &pri_dai->i2s_dai_drv);
@@ -1132,10 +1263,14 @@ static int samsung_i2s_remove(struct platform_device *pdev)
{
struct i2s_dai *i2s, *other;
struct resource *res;
+ struct s3c_audio_pdata *i2s_pdata = pdev->dev.platform_data;
i2s = dev_get_drvdata(&pdev->dev);
other = i2s->pri_dai ? : i2s->sec_dai;
+ if (!i2s_pdata->cfg_gpio && pdev->dev.of_node)
+ samsung_i2s_dt_gpio_free(i2s->pri_dai);
+
if (other) {
other->pri_dai = NULL;
other->sec_dai = NULL;
@@ -1167,6 +1302,21 @@ static struct platform_device_id samsung_i2s_driver_ids[] = {
};
MODULE_DEVICE_TABLE(platform, samsung-i2s-driver-ids);
+#ifdef CONFIG_OF
+static struct samsung_i2s_dai_data samsung_i2s_dai_data_array[] = {
+ [TYPE_PRI] = { TYPE_PRI },
+ [TYPE_SEC] = { TYPE_SEC },
+};
+
+static const struct of_device_id exynos_i2s_match[] = {
+ { .compatible = "samsung,samsung-i2s",
+ .data = &samsung_i2s_dai_data_array[TYPE_PRI],
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(of, exynos_i2s_match);
+#endif
+
static struct platform_driver samsung_i2s_driver = {
.probe = samsung_i2s_probe,
.remove = samsung_i2s_remove,
@@ -1174,6 +1324,7 @@ static struct platform_driver samsung_i2s_driver = {
.driver = {
.name = "samsung-i2s",
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(exynos_i2s_match),
},
};
--
1.7.4.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s
2012-12-13 10:42 ` [PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s Padmavathi Venna
@ 2012-12-19 13:24 ` Grant Likely
2012-12-19 17:09 ` Mark Brown
0 siblings, 1 reply; 12+ messages in thread
From: Grant Likely @ 2012-12-19 13:24 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, 13 Dec 2012 16:12:53 +0530, Padmavathi Venna <padma.v@samsung.com> wrote:
> Add support for device based discovery.
>
> Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
> ---
> .../devicetree/bindings/sound/samsung-i2s.txt | 75 +++++++
> sound/soc/samsung/dma.c | 1 +
> sound/soc/samsung/dma.h | 1 +
> sound/soc/samsung/i2s.c | 233 ++++++++++++++++----
> 4 files changed, 269 insertions(+), 41 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/sound/samsung-i2s.txt
>
> diff --git a/Documentation/devicetree/bindings/sound/samsung-i2s.txt b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
> new file mode 100644
> index 0000000..bff47b4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
> @@ -0,0 +1,75 @@
> +* Samsung I2S controller
> +
> +Required SoC Specific Properties:
> +
> +- compatible : "samsung,samsung-i2s"
Isn't that kind of redundant? :-)
The format of the compatible strings should be "<vendor>,<part-number>-i2s".
Please be specific about the part number that you're doing the binding
for. For example; use "samsung,exynos4210-i2s" instead of "samsung,exynos-i2s".
> +- reg: physical base address of the controller and length of memory mapped
> + region.
> +
> +[PRELIMINARY: the dma channel allocation will change once there are
> +official DMA bindings]
> +
> +- tx-dma-channel-secondary: The dma channel specifier for secondary tx
> + operations. The format of the dma specifier depends on the dma
> + controller.
> +- tx-dma-channel: The dma channel specifier for tx operations. The format of
> + the dma specifier depends on the dma controller.
> +- rx-dma-channel: The dma channel specifier for rx operations. The format of
> + the dma specifier depends on the dma controller.
> +
> +Optional SoC Specific Properties:
> +
> +- samsung,supports-6ch: If the I2S Primary sound source has 5.1 Channel
> + support, this flag is enabled.
> +- samsung,supports-rstclr: This flag should be set if I2S software reset bit
> + control is required. When this flag is set I2S software reset bit will be
> + enabled or disabled based on need.
> +- samsung,supports-secdai:If I2S block has a secondary FIFO and internal DMA,
> + then this flag is enabled.
> +- samsung,idma-addr: Internal DMA register base address of the audio
> + sub system(used in secondary sound source).
> +
> +Required Board Specific Properties:
> +
> +- gpios: The gpio specifier for data out,data in, LRCLK, CDCLK and SCLK
> + interface lines. The format of the gpio specifier depends on the gpio
> + controller.
> + The syntax of samsung gpio specifier is
> + <[phandle of the gpio controller node]
> + [pin number within the gpio controller]
> + [mux function]
> + [flags and pull up/down]
> + [drive strength]>
> +
> +Aliases:
> +
> +- All the I2S controller nodes are represented in the aliases node using
> + the following format 'i2s{n}' where n is a unique number for the alias.
Are the aliases actually being used now? If not, then drop this section.
I don't see any references in this patch.
Otherwise the binding looks good to me.
g.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s
2012-12-19 13:24 ` Grant Likely
@ 2012-12-19 17:09 ` Mark Brown
2012-12-19 17:37 ` Kukjin Kim
2012-12-21 11:36 ` Padma Venkat
0 siblings, 2 replies; 12+ messages in thread
From: Mark Brown @ 2012-12-19 17:09 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Dec 19, 2012 at 01:24:14PM +0000, Grant Likely wrote:
> On Thu, 13 Dec 2012 16:12:53 +0530, Padmavathi Venna <padma.v@samsung.com> wrote:
> > +- compatible : "samsung,samsung-i2s"
> Isn't that kind of redundant? :-)
> The format of the compatible strings should be "<vendor>,<part-number>-i2s".
> Please be specific about the part number that you're doing the binding
> for. For example; use "samsung,exynos4210-i2s" instead of "samsung,exynos-i2s".
There are actually versioned IPs here (where the versions are used
publically in a few places) but it's not clearly documented which is
which. It would be reasonable to use the IP versions here I think.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121219/840a7bdc/attachment.sig>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s
2012-12-19 17:09 ` Mark Brown
@ 2012-12-19 17:37 ` Kukjin Kim
2012-12-21 11:36 ` Padma Venkat
1 sibling, 0 replies; 12+ messages in thread
From: Kukjin Kim @ 2012-12-19 17:37 UTC (permalink / raw)
To: linux-arm-kernel
Kukjin Kim wrote:
>
> Mark Brown wrote:
> >
> > On Wed, Dec 19, 2012 at 01:24:14PM +0000, Grant Likely wrote:
> > > On Thu, 13 Dec 2012 16:12:53 +0530, Padmavathi Venna
> > <padma.v@samsung.com> wrote:
> >
> > > > +- compatible : "samsung,samsung-i2s"
> >
> > > Isn't that kind of redundant? :-)
> >
> > > The format of the compatible strings should be "<vendor>,<part-
> number>-
> > i2s".
> > > Please be specific about the part number that you're doing the binding
> > > for. For example; use "samsung,exynos4210-i2s" instead of
> > "samsung,exynos-i2s".
> >
> > There are actually versioned IPs here (where the versions are used
> > publically in a few places) but it's not clearly documented which is
> > which. It would be reasonable to use the IP versions here I think.
>
Oops, I'm resending due to problem of my e-mail client.
> I agree with Mark Brown. That makes sense, for example, see mfc.
> compatible = "samsung,mfc-v6"
> Same versioned IPs can be used on different SoCs, so in my opinion, in
this
> case, to use version is more clear.
>
- Kukjin
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s
2012-12-19 17:09 ` Mark Brown
2012-12-19 17:37 ` Kukjin Kim
@ 2012-12-21 11:36 ` Padma Venkat
2012-12-21 19:02 ` Kukjin Kim
2012-12-23 23:13 ` Kukjin Kim
1 sibling, 2 replies; 12+ messages in thread
From: Padma Venkat @ 2012-12-21 11:36 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Wed, Dec 19, 2012 at 10:39 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Wed, Dec 19, 2012 at 01:24:14PM +0000, Grant Likely wrote:
>> On Thu, 13 Dec 2012 16:12:53 +0530, Padmavathi Venna <padma.v@samsung.com> wrote:
>
>> > +- compatible : "samsung,samsung-i2s"
>
>> Isn't that kind of redundant? :-)
>
>> The format of the compatible strings should be "<vendor>,<part-number>-i2s".
>> Please be specific about the part number that you're doing the binding
>> for. For example; use "samsung,exynos4210-i2s" instead of "samsung,exynos-i2s".
>
> There are actually versioned IPs here (where the versions are used
> publically in a few places) but it's not clearly documented which is
> which. It would be reasonable to use the IP versions here I think.
Samsung has three i2s drivers one for s3c24xx, one for s3c2412 and one
for rest of the platforms. The above mentioned other platforms has
Version 3/4/5 of i2s controllers. This dt binding is for for the i2s
driver that has support for Version 3/4/5 of i2s controller. So
"samsung,i2s-v5" is okay as compatible name? Please suggest me.
Thanks
Padma
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s
2012-12-21 11:36 ` Padma Venkat
@ 2012-12-21 19:02 ` Kukjin Kim
2012-12-24 4:03 ` Padma Venkat
2012-12-23 23:13 ` Kukjin Kim
1 sibling, 1 reply; 12+ messages in thread
From: Kukjin Kim @ 2012-12-21 19:02 UTC (permalink / raw)
To: linux-arm-kernel
Padma Venkat wrote:
>
> Hi,
>
> On Wed, Dec 19, 2012 at 10:39 PM, Mark Brown
> <broonie@opensource.wolfsonmicro.com> wrote:
> > On Wed, Dec 19, 2012 at 01:24:14PM +0000, Grant Likely wrote:
> >> On Thu, 13 Dec 2012 16:12:53 +0530, Padmavathi Venna
> <padma.v@samsung.com> wrote:
> >
> >> > +- compatible : "samsung,samsung-i2s"
> >
> >> Isn't that kind of redundant? :-)
> >
> >> The format of the compatible strings should be "<vendor>,<part-
> number>-i2s".
> >> Please be specific about the part number that you're doing the binding
> >> for. For example; use "samsung,exynos4210-i2s" instead of
> "samsung,exynos-i2s".
> >
> > There are actually versioned IPs here (where the versions are used
> > publically in a few places) but it's not clearly documented which is
> > which. It would be reasonable to use the IP versions here I think.
>
> Samsung has three i2s drivers one for s3c24xx, one for s3c2412 and one
> for rest of the platforms. The above mentioned other platforms has
> Version 3/4/5 of i2s controllers. This dt binding is for for the i2s
Where is the version defined such as 3, 4, 5? So, what is the
"sound/soc/Samsung/s3c-i2s-v2.[ch]"?
> driver that has support for Version 3/4/5 of i2s controller. So
> "samsung,i2s-v5" is okay as compatible name? Please suggest me.
>
I agree with using version here but we need some consensus about that.
- Kukjin
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s
2012-12-21 11:36 ` Padma Venkat
2012-12-21 19:02 ` Kukjin Kim
@ 2012-12-23 23:13 ` Kukjin Kim
1 sibling, 0 replies; 12+ messages in thread
From: Kukjin Kim @ 2012-12-23 23:13 UTC (permalink / raw)
To: linux-arm-kernel
Kukjin Kim wrote:
>
Re-sending due to e-mail client problem :(
> Padma Venkat wrote:
> >
> > Hi,
> >
> > On Wed, Dec 19, 2012 at 10:39 PM, Mark Brown
> > <broonie@opensource.wolfsonmicro.com> wrote:
> > > On Wed, Dec 19, 2012 at 01:24:14PM +0000, Grant Likely wrote:
> > >> On Thu, 13 Dec 2012 16:12:53 +0530, Padmavathi Venna
> > <padma.v@samsung.com> wrote:
> > >
> > >> > +- compatible : "samsung,samsung-i2s"
> > >
> > >> Isn't that kind of redundant? :-)
> > >
> > >> The format of the compatible strings should be "<vendor>,<part-
> > number>-i2s".
> > >> Please be specific about the part number that you're doing the
> > >> binding for. For example; use "samsung,exynos4210-i2s" instead of
> > "samsung,exynos-i2s".
> > >
> > > There are actually versioned IPs here (where the versions are used
> > > publically in a few places) but it's not clearly documented which is
> > > which. It would be reasonable to use the IP versions here I think.
> >
> > Samsung has three i2s drivers one for s3c24xx, one for s3c2412 and one
> > for rest of the platforms. The above mentioned other platforms has
> > Version 3/4/5 of i2s controllers. This dt binding is for for the i2s
>
> Where is the version defined such as 3, 4, 5? So, what is the
> "sound/soc/Samsung/s3c-i2s-v2.[ch]"?
>
> > driver that has support for Version 3/4/5 of i2s controller. So
> > "samsung,i2s-v5" is okay as compatible name? Please suggest me.
> >
> I agree with using version here but we need some consensus about that.
>
> - Kukjin
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s
2012-12-21 19:02 ` Kukjin Kim
@ 2012-12-24 4:03 ` Padma Venkat
2012-12-26 10:51 ` Padma Venkat
0 siblings, 1 reply; 12+ messages in thread
From: Padma Venkat @ 2012-12-24 4:03 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Sat, Dec 22, 2012 at 12:32 AM, Kukjin Kim <kgene.kim@samsung.com> wrote:
> Padma Venkat wrote:
>>
>> Hi,
>>
>> On Wed, Dec 19, 2012 at 10:39 PM, Mark Brown
>> <broonie@opensource.wolfsonmicro.com> wrote:
>> > On Wed, Dec 19, 2012 at 01:24:14PM +0000, Grant Likely wrote:
>> >> On Thu, 13 Dec 2012 16:12:53 +0530, Padmavathi Venna
>> <padma.v@samsung.com> wrote:
>> >
>> >> > +- compatible : "samsung,samsung-i2s"
>> >
>> >> Isn't that kind of redundant? :-)
>> >
>> >> The format of the compatible strings should be "<vendor>,<part-
>> number>-i2s".
>> >> Please be specific about the part number that you're doing the binding
>> >> for. For example; use "samsung,exynos4210-i2s" instead of
>> "samsung,exynos-i2s".
>> >
>> > There are actually versioned IPs here (where the versions are used
>> > publically in a few places) but it's not clearly documented which is
>> > which. It would be reasonable to use the IP versions here I think.
>>
>> Samsung has three i2s drivers one for s3c24xx, one for s3c2412 and one
>> for rest of the platforms. The above mentioned other platforms has
>> Version 3/4/5 of i2s controllers. This dt binding is for for the i2s
>
> Where is the version defined such as 3, 4, 5? So, what is the
> "sound/soc/Samsung/s3c-i2s-v2.[ch]"?
Versions 3, 4, 5 are defined in dev-audio.c file of corresponding platforms.
s3c-i2s-v2 is used in s3c2412 platform.
>
>> driver that has support for Version 3/4/5 of i2s controller. So
>> "samsung,i2s-v5" is okay as compatible name? Please suggest me.
>>
> I agree with using version here but we need some consensus about that.
>
> - Kukjin
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks
Padma
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s
2012-12-24 4:03 ` Padma Venkat
@ 2012-12-26 10:51 ` Padma Venkat
2012-12-27 16:48 ` Mark Brown
0 siblings, 1 reply; 12+ messages in thread
From: Padma Venkat @ 2012-12-26 10:51 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Mon, Dec 24, 2012 at 9:33 AM, Padma Venkat <padma.kvr@gmail.com> wrote:
> Hi,
>
> On Sat, Dec 22, 2012 at 12:32 AM, Kukjin Kim <kgene.kim@samsung.com> wrote:
>> Padma Venkat wrote:
>>>
>>> Hi,
>>>
>>> On Wed, Dec 19, 2012 at 10:39 PM, Mark Brown
>>> <broonie@opensource.wolfsonmicro.com> wrote:
>>> > On Wed, Dec 19, 2012 at 01:24:14PM +0000, Grant Likely wrote:
>>> >> On Thu, 13 Dec 2012 16:12:53 +0530, Padmavathi Venna
>>> <padma.v@samsung.com> wrote:
>>> >
>>> >> > +- compatible : "samsung,samsung-i2s"
>>> >
>>> >> Isn't that kind of redundant? :-)
>>> >
>>> >> The format of the compatible strings should be "<vendor>,<part-
>>> number>-i2s".
>>> >> Please be specific about the part number that you're doing the binding
>>> >> for. For example; use "samsung,exynos4210-i2s" instead of
>>> "samsung,exynos-i2s".
>>> >
>>> > There are actually versioned IPs here (where the versions are used
>>> > publically in a few places) but it's not clearly documented which is
>>> > which. It would be reasonable to use the IP versions here I think.
>>>
>>> Samsung has three i2s drivers one for s3c24xx, one for s3c2412 and one
>>> for rest of the platforms. The above mentioned other platforms has
>>> Version 3/4/5 of i2s controllers. This dt binding is for for the i2s
>>
>> Where is the version defined such as 3, 4, 5? So, what is the
>> "sound/soc/Samsung/s3c-i2s-v2.[ch]"?
>
> Versions 3, 4, 5 are defined in dev-audio.c file of corresponding platforms.
> s3c-i2s-v2 is used in s3c2412 platform.
>
>>
>>> driver that has support for Version 3/4/5 of i2s controller. So
>>> "samsung,i2s-v5" is okay as compatible name? Please suggest me.
>>>
>> I agree with using version here but we need some consensus about that.
Any suggestions on i2s compatible name or "samsung,i2s-v5" is okay?
>>
>> - Kukjin
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
>> the body of a message to majordomo at vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> Thanks
> Padma
Thanks
Padma
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s
2012-12-26 10:51 ` Padma Venkat
@ 2012-12-27 16:48 ` Mark Brown
0 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2012-12-27 16:48 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Dec 26, 2012 at 04:21:58PM +0530, Padma Venkat wrote:
> Hi,
>
> On Mon, Dec 24, 2012 at 9:33 AM, Padma Venkat <padma.kvr@gmail.com> wrote:
> > Hi,
You should always delete irrelevant text from mails, it makes it much
easier for people to find whatever content you've added.
> >> I agree with using version here but we need some consensus about that.
> Any suggestions on i2s compatible name or "samsung,i2s-v5" is okay?
I think that's fine.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121227/170caedc/attachment.sig>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2012-12-27 16:48 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-13 10:42 [PATCH V5 0/2] Add DT support for i2s Padmavathi Venna
2012-12-13 10:42 ` [PATCH V5 1/2] ASoC: Samsung: Rename samsung i2s secondary device name Padmavathi Venna
2012-12-13 10:42 ` [PATCH V5 2/2] ASoC: SAMSUNG: Add DT support for i2s Padmavathi Venna
2012-12-19 13:24 ` Grant Likely
2012-12-19 17:09 ` Mark Brown
2012-12-19 17:37 ` Kukjin Kim
2012-12-21 11:36 ` Padma Venkat
2012-12-21 19:02 ` Kukjin Kim
2012-12-24 4:03 ` Padma Venkat
2012-12-26 10:51 ` Padma Venkat
2012-12-27 16:48 ` Mark Brown
2012-12-23 23:13 ` Kukjin Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).