Skip to content

Commit

Permalink
Merge remote-tracking branch 'asoc/topic/samsung' into asoc-next
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Brown committed Feb 11, 2013
2 parents f8843c9 + 5b1d3c3 commit 2944c2f
Show file tree
Hide file tree
Showing 16 changed files with 438 additions and 129 deletions.
14 changes: 14 additions & 0 deletions Documentation/devicetree/bindings/sound/samsung,smdk-wm8994.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Samsung SMDK audio complex

Required properties:
- compatible : "samsung,smdk-wm8994"
- samsung,i2s-controller: The phandle of the Samsung I2S0 controller
- samsung,audio-codec: The phandle of the WM8994 audio codec
Example:

sound {
compatible = "samsung,smdk-wm8994";

samsung,i2s-controller = <&i2s0>;
samsung,audio-codec = <&wm8994>;
};
63 changes: 63 additions & 0 deletions Documentation/devicetree/bindings/sound/samsung-i2s.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
* Samsung I2S controller

Required SoC Specific Properties:

- compatible : "samsung,i2s-v5"
- reg: physical base address of the controller and length of memory mapped
region.
- dmas: list of DMA controller phandle and DMA request line ordered pairs.
- dma-names: identifier string for each DMA request line in the dmas property.
These strings correspond 1:1 with the ordered pairs in dmas.

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]>

Example:

- SoC Specific Portion:

i2s@03830000 {
compatible = "samsung,i2s-v5";
reg = <0x03830000 0x100>;
dmas = <&pdma0 10
&pdma0 9
&pdma0 8>;
dma-names = "tx", "rx", "tx-sec";
samsung,supports-6ch;
samsung,supports-rstclr;
samsung,supports-secdai;
samsung,idma-addr = <0x03000000>;
};

- Board Specific Portion:

i2s@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] */
};
26 changes: 26 additions & 0 deletions arch/arm/boot/dts/exynos5250-smdk5250.dts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
compatible = "samsung,s524ad0xd1";
reg = <0x51>;
};

wm8994: wm8994@1a {
compatible = "wlf,wm8994";
reg = <0x1a>;
};
};

i2c@121D0000 {
Expand Down Expand Up @@ -204,4 +209,25 @@
samsung,mfc-r = <0x43000000 0x800000>;
samsung,mfc-l = <0x51000000 0x800000>;
};

i2s0: i2s@03830000 {
gpios = <&gpz 0 2 0 0>, <&gpz 1 2 0 0>, <&gpz 2 2 0 0>,
<&gpz 3 2 0 0>, <&gpz 4 2 0 0>, <&gpz 5 2 0 0>,
<&gpz 6 2 0 0>;
};

i2s1: i2s@12D60000 {
status = "disabled";
};

i2s2: i2s@12D70000 {
status = "disabled";
};

sound {
compatible = "samsung,smdk-wm8994";

samsung,i2s-controller = <&i2s0>;
samsung,audio-codec = <&wm8994>;
};
};
44 changes: 38 additions & 6 deletions arch/arm/boot/dts/exynos5250.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,9 @@
compatible = "samsung,exynos4210-spi";
reg = <0x12d20000 0x100>;
interrupts = <0 66 0>;
tx-dma-channel = <&pdma0 5>; /* preliminary */
rx-dma-channel = <&pdma0 4>; /* preliminary */
dmas = <&pdma0 5
&pdma0 4>;
dma-names = "tx", "rx";
#address-cells = <1>;
#size-cells = <0>;
};
Expand All @@ -221,8 +222,9 @@
compatible = "samsung,exynos4210-spi";
reg = <0x12d30000 0x100>;
interrupts = <0 67 0>;
tx-dma-channel = <&pdma1 5>; /* preliminary */
rx-dma-channel = <&pdma1 4>; /* preliminary */
dmas = <&pdma1 5
&pdma1 4>;
dma-names = "tx", "rx";
#address-cells = <1>;
#size-cells = <0>;
};
Expand All @@ -231,8 +233,9 @@
compatible = "samsung,exynos4210-spi";
reg = <0x12d40000 0x100>;
interrupts = <0 68 0>;
tx-dma-channel = <&pdma0 7>; /* preliminary */
rx-dma-channel = <&pdma0 6>; /* preliminary */
dmas = <&pdma0 7
&pdma0 6>;
dma-names = "tx", "rx";
#address-cells = <1>;
#size-cells = <0>;
};
Expand Down Expand Up @@ -269,6 +272,35 @@
#size-cells = <0>;
};

i2s0: i2s@03830000 {
compatible = "samsung,i2s-v5";
reg = <0x03830000 0x100>;
dmas = <&pdma0 10
&pdma0 9
&pdma0 8>;
dma-names = "tx", "rx", "tx-sec";
samsung,supports-6ch;
samsung,supports-rstclr;
samsung,supports-secdai;
samsung,idma-addr = <0x03000000>;
};

i2s1: i2s@12D60000 {
compatible = "samsung,i2s-v5";
reg = <0x12D60000 0x100>;
dmas = <&pdma1 12
&pdma1 11>;
dma-names = "tx", "rx";
};

i2s2: i2s@12D70000 {
compatible = "samsung,i2s-v5";
reg = <0x12D70000 0x100>;
dmas = <&pdma0 12
&pdma0 11>;
dma-names = "tx", "rx";
};

amba {
#address-cells = <1>;
#size-cells = <1>;
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/mach-exynos/mach-exynos5-dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
OF_DEV_AUXDATA("samsung,mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
OF_DEV_AUXDATA("samsung,exynos5250-tmu", 0x10060000,
"exynos-tmu", NULL),
OF_DEV_AUXDATA("samsung,i2s-v5", 0x03830000,
"samsung-i2s.0", NULL),
OF_DEV_AUXDATA("samsung,i2s-v5", 0x12D60000,
"samsung-i2s.1", NULL),
OF_DEV_AUXDATA("samsung,i2s-v5", 0x12D70000,
"samsung-i2s.2", NULL),
{},
};

Expand Down
10 changes: 8 additions & 2 deletions arch/arm/plat-samsung/dma-ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
#include <mach/dma.h>

static unsigned samsung_dmadev_request(enum dma_ch dma_ch,
struct samsung_dma_req *param)
struct samsung_dma_req *param,
struct device *dev, char *ch_name)
{
dma_cap_mask_t mask;
void *filter_param;
Expand All @@ -33,7 +34,12 @@ static unsigned samsung_dmadev_request(enum dma_ch dma_ch,
*/
filter_param = (dma_ch == DMACH_DT_PROP) ?
(void *)param->dt_dmach_prop : (void *)dma_ch;
return (unsigned)dma_request_channel(mask, pl330_filter, filter_param);

if (dev->of_node)
return (unsigned)dma_request_slave_channel(dev, ch_name);
else
return (unsigned)dma_request_channel(mask, pl330_filter,
filter_param);
}

static int samsung_dmadev_release(unsigned ch, void *param)
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/plat-samsung/include/plat/dma-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ struct samsung_dma_config {
};

struct samsung_dma_ops {
unsigned (*request)(enum dma_ch ch, struct samsung_dma_req *param);
unsigned (*request)(enum dma_ch ch, struct samsung_dma_req *param,
struct device *dev, char *ch_name);
int (*release)(unsigned ch, void *param);
int (*config)(unsigned ch, struct samsung_dma_config *param);
int (*prepare)(unsigned ch, struct samsung_dma_prep *param);
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/plat-samsung/s3c-dma-ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ static void s3c_dma_cb(struct s3c2410_dma_chan *channel, void *param,
}

static unsigned s3c_dma_request(enum dma_ch dma_ch,
struct samsung_dma_req *param)
struct samsung_dma_req *param,
struct device *dev, char *ch_name)
{
struct cb_data *data;

Expand Down
77 changes: 23 additions & 54 deletions drivers/spi/spi-s3c64xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ struct s3c64xx_spi_dma_data {
unsigned ch;
enum dma_transfer_direction direction;
enum dma_ch dmach;
struct property *dma_prop;
};

/**
Expand Down Expand Up @@ -319,16 +318,15 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma,
static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
{
struct samsung_dma_req req;
struct device *dev = &sdd->pdev->dev;

sdd->ops = samsung_dma_get_ops();

req.cap = DMA_SLAVE;
req.client = &s3c64xx_spi_dma_client;

req.dt_dmach_prop = sdd->rx_dma.dma_prop;
sdd->rx_dma.ch = sdd->ops->request(sdd->rx_dma.dmach, &req);
req.dt_dmach_prop = sdd->tx_dma.dma_prop;
sdd->tx_dma.ch = sdd->ops->request(sdd->tx_dma.dmach, &req);
sdd->rx_dma.ch = sdd->ops->request(sdd->rx_dma.dmach, &req, dev, "rx");
sdd->tx_dma.ch = sdd->ops->request(sdd->tx_dma.dmach, &req, dev, "tx");

return 1;
}
Expand Down Expand Up @@ -1054,49 +1052,6 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel)
flush_fifo(sdd);
}

static int s3c64xx_spi_get_dmares(
struct s3c64xx_spi_driver_data *sdd, bool tx)
{
struct platform_device *pdev = sdd->pdev;
struct s3c64xx_spi_dma_data *dma_data;
struct property *prop;
struct resource *res;
char prop_name[15], *chan_str;

if (tx) {
dma_data = &sdd->tx_dma;
dma_data->direction = DMA_MEM_TO_DEV;
chan_str = "tx";
} else {
dma_data = &sdd->rx_dma;
dma_data->direction = DMA_DEV_TO_MEM;
chan_str = "rx";
}

if (!sdd->pdev->dev.of_node) {
res = platform_get_resource(pdev, IORESOURCE_DMA, tx ? 0 : 1);
if (!res) {
dev_err(&pdev->dev, "Unable to get SPI-%s dma "
"resource\n", chan_str);
return -ENXIO;
}
dma_data->dmach = res->start;
return 0;
}

sprintf(prop_name, "%s-dma-channel", chan_str);
prop = of_find_property(pdev->dev.of_node, prop_name, NULL);
if (!prop) {
dev_err(&pdev->dev, "%s dma channel property not specified\n",
chan_str);
return -ENXIO;
}

dma_data->dmach = DMACH_DT_PROP;
dma_data->dma_prop = prop;
return 0;
}

#ifdef CONFIG_OF
static int s3c64xx_spi_parse_dt_gpio(struct s3c64xx_spi_driver_data *sdd)
{
Expand Down Expand Up @@ -1198,6 +1153,7 @@ static inline struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config(
static int __init s3c64xx_spi_probe(struct platform_device *pdev)
{
struct resource *mem_res;
struct resource *res;
struct s3c64xx_spi_driver_data *sdd;
struct s3c64xx_spi_info *sci = pdev->dev.platform_data;
struct spi_master *master;
Expand Down Expand Up @@ -1256,13 +1212,26 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)

sdd->cur_bpw = 8;

ret = s3c64xx_spi_get_dmares(sdd, true);
if (ret)
goto err0;
if (!sdd->pdev->dev.of_node) {
res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!res) {
dev_err(&pdev->dev, "Unable to get SPI tx dma "
"resource\n");
return -ENXIO;
}
sdd->tx_dma.dmach = res->start;

res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
if (!res) {
dev_err(&pdev->dev, "Unable to get SPI rx dma "
"resource\n");
return -ENXIO;
}
sdd->rx_dma.dmach = res->start;
}

ret = s3c64xx_spi_get_dmares(sdd, false);
if (ret)
goto err0;
sdd->tx_dma.direction = DMA_MEM_TO_DEV;
sdd->rx_dma.direction = DMA_DEV_TO_MEM;

master->dev.of_node = pdev->dev.of_node;
master->bus_num = sdd->port_id;
Expand Down
6 changes: 3 additions & 3 deletions sound/soc/samsung/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ config SND_SOC_SAMSUNG_SMDK_WM8580

config SND_SOC_SAMSUNG_SMDK_WM8994
tristate "SoC I2S Audio support for WM8994 on SMDK"
depends on SND_SOC_SAMSUNG && (MACH_SMDKV310 || MACH_SMDKC210 || MACH_SMDK4212)
depends on SND_SOC_SAMSUNG
depends on I2C=y && GENERIC_HARDIRQS
select MFD_WM8994
select SND_SOC_WM8994
Expand Down Expand Up @@ -162,7 +162,7 @@ config SND_SOC_GONI_AQUILA_WM8994

config SND_SOC_SAMSUNG_SMDK_SPDIF
tristate "SoC S/PDIF Audio support for SMDK"
depends on SND_SOC_SAMSUNG && (MACH_SMDKC100 || MACH_SMDKC110 || MACH_SMDKV210 || MACH_SMDKV310 || MACH_SMDK4212)
depends on SND_SOC_SAMSUNG
select SND_SAMSUNG_SPDIF
help
Say Y if you want to add support for SoC S/PDIF audio on the SMDK.
Expand All @@ -177,7 +177,7 @@ config SND_SOC_SMDK_WM8580_PCM

config SND_SOC_SMDK_WM8994_PCM
tristate "SoC PCM Audio support for WM8994 on SMDK"
depends on SND_SOC_SAMSUNG && (MACH_SMDKC210 || MACH_SMDKV310 || MACH_SMDK4212)
depends on SND_SOC_SAMSUNG
depends on I2C=y && GENERIC_HARDIRQS
select MFD_WM8994
select SND_SOC_WM8994
Expand Down
Loading

0 comments on commit 2944c2f

Please sign in to comment.