aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBo Shen <voice.shen@atmel.com>2014-02-10 01:09:45 -0500
committerMark Brown <broonie@linaro.org>2014-02-12 12:21:22 -0500
commit048d4ff81f1cf26b3f3627a9a69d35aff7898bb3 (patch)
tree694e6f6a08952f43c704693523984a3d8414d3eb
parent38dbfb59d1175ef458d006556061adeaa8751b72 (diff)
ASoC: atmel_ssc_dai: make option to choose clock
When SSC works in slave mode, according to the hardware design, the clock can get from TK pin, also can get from RK pin. So, add one parameter to choose where the clock from. Signed-off-by: Bo Shen <voice.shen@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--drivers/misc/atmel-ssc.c6
-rw-r--r--include/linux/atmel-ssc.h1
-rw-r--r--sound/soc/atmel/atmel_ssc_dai.c13
3 files changed, 16 insertions, 4 deletions
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index 5be808406edc..22de13727641 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -150,6 +150,12 @@ static int ssc_probe(struct platform_device *pdev)
150 return -ENODEV; 150 return -ENODEV;
151 ssc->pdata = (struct atmel_ssc_platform_data *)plat_dat; 151 ssc->pdata = (struct atmel_ssc_platform_data *)plat_dat;
152 152
153 if (pdev->dev.of_node) {
154 struct device_node *np = pdev->dev.of_node;
155 ssc->clk_from_rk_pin =
156 of_property_read_bool(np, "atmel,clk-from-rk-pin");
157 }
158
153 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 159 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
154 ssc->regs = devm_ioremap_resource(&pdev->dev, regs); 160 ssc->regs = devm_ioremap_resource(&pdev->dev, regs);
155 if (IS_ERR(ssc->regs)) 161 if (IS_ERR(ssc->regs))
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
index 66a0e5384edd..571a12ebb018 100644
--- a/include/linux/atmel-ssc.h
+++ b/include/linux/atmel-ssc.h
@@ -18,6 +18,7 @@ struct ssc_device {
18 struct clk *clk; 18 struct clk *clk;
19 int user; 19 int user;
20 int irq; 20 int irq;
21 bool clk_from_rk_pin;
21}; 22};
22 23
23struct ssc_device * __must_check ssc_request(unsigned int ssc_num); 24struct ssc_device * __must_check ssc_request(unsigned int ssc_num);
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index 1ead3c977a51..de433cfd044c 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -341,6 +341,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
341{ 341{
342 int id = dai->id; 342 int id = dai->id;
343 struct atmel_ssc_info *ssc_p = &ssc_info[id]; 343 struct atmel_ssc_info *ssc_p = &ssc_info[id];
344 struct ssc_device *ssc = ssc_p->ssc;
344 struct atmel_pcm_dma_params *dma_params; 345 struct atmel_pcm_dma_params *dma_params;
345 int dir, channels, bits; 346 int dir, channels, bits;
346 u32 tfmr, rfmr, tcmr, rcmr; 347 u32 tfmr, rfmr, tcmr, rcmr;
@@ -466,7 +467,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
466 | SSC_BF(RCMR_START, start_event) 467 | SSC_BF(RCMR_START, start_event)
467 | SSC_BF(RCMR_CKI, SSC_CKI_RISING) 468 | SSC_BF(RCMR_CKI, SSC_CKI_RISING)
468 | SSC_BF(RCMR_CKO, SSC_CKO_NONE) 469 | SSC_BF(RCMR_CKO, SSC_CKO_NONE)
469 | SSC_BF(RCMR_CKS, SSC_CKS_CLOCK); 470 | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
471 SSC_CKS_PIN : SSC_CKS_CLOCK);
470 472
471 rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE) 473 rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
472 | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE) 474 | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE)
@@ -481,7 +483,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
481 | SSC_BF(TCMR_START, start_event) 483 | SSC_BF(TCMR_START, start_event)
482 | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) 484 | SSC_BF(TCMR_CKI, SSC_CKI_FALLING)
483 | SSC_BF(TCMR_CKO, SSC_CKO_NONE) 485 | SSC_BF(TCMR_CKO, SSC_CKO_NONE)
484 | SSC_BF(TCMR_CKS, SSC_CKS_PIN); 486 | SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ?
487 SSC_CKS_CLOCK : SSC_CKS_PIN);
485 488
486 tfmr = SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE) 489 tfmr = SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
487 | SSC_BF(TFMR_FSDEN, 0) 490 | SSC_BF(TFMR_FSDEN, 0)
@@ -550,7 +553,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
550 | SSC_BF(RCMR_START, SSC_START_RISING_RF) 553 | SSC_BF(RCMR_START, SSC_START_RISING_RF)
551 | SSC_BF(RCMR_CKI, SSC_CKI_RISING) 554 | SSC_BF(RCMR_CKI, SSC_CKI_RISING)
552 | SSC_BF(RCMR_CKO, SSC_CKO_NONE) 555 | SSC_BF(RCMR_CKO, SSC_CKO_NONE)
553 | SSC_BF(RCMR_CKS, SSC_CKS_PIN); 556 | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
557 SSC_CKS_PIN : SSC_CKS_CLOCK);
554 558
555 rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE) 559 rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
556 | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE) 560 | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE)
@@ -565,7 +569,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
565 | SSC_BF(TCMR_START, SSC_START_RISING_RF) 569 | SSC_BF(TCMR_START, SSC_START_RISING_RF)
566 | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) 570 | SSC_BF(TCMR_CKI, SSC_CKI_FALLING)
567 | SSC_BF(TCMR_CKO, SSC_CKO_NONE) 571 | SSC_BF(TCMR_CKO, SSC_CKO_NONE)
568 | SSC_BF(TCMR_CKS, SSC_CKS_PIN); 572 | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
573 SSC_CKS_CLOCK : SSC_CKS_PIN);
569 574
570 tfmr = SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE) 575 tfmr = SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
571 | SSC_BF(TFMR_FSDEN, 0) 576 | SSC_BF(TFMR_FSDEN, 0)