summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2016-05-30 04:23:49 -0400
committerTony Lindgren <tony@atomide.com>2016-06-10 08:07:24 -0400
commitbbfa26c530c108ddb8f5305a1a93756b6a767d88 (patch)
treec99417326f40d47c103475f33a6afedaa0ab9868 /sound
parent6610d3571b3daefca47f6735ee400f9e85f91e3d (diff)
ASoC: omap-mcbsp: sidetone: Use the new callback for iclk handling
The McBSP sidetone (in OMAP3 McBSP2 and 3 module) is working with the module's interface clock. When the sidetone is enabled the iclk must not idle because it will result in choppy sidetone. Switch to use the new callback for handling the iclk allow/deny idle configuration. For this the driver needs to get the module's ick clock and pass the clk pointer to the callback. In DT boot, the pdata-quirk is going to set up the callback for the driver so save it if it is set in the pdata of the device. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/omap/mcbsp.c19
-rw-r--r--sound/soc/omap/mcbsp.h1
-rw-r--r--sound/soc/omap/omap-mcbsp.c3
3 files changed, 18 insertions, 5 deletions
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
index ace73b97769f..76ce33199bf9 100644
--- a/sound/soc/omap/mcbsp.c
+++ b/sound/soc/omap/mcbsp.c
@@ -257,8 +257,8 @@ static void omap_st_on(struct omap_mcbsp *mcbsp)
257{ 257{
258 unsigned int w; 258 unsigned int w;
259 259
260 if (mcbsp->pdata->enable_st_clock) 260 if (mcbsp->pdata->force_ick_on)
261 mcbsp->pdata->enable_st_clock(mcbsp->id, 1); 261 mcbsp->pdata->force_ick_on(mcbsp->st_data->mcbsp_iclk, true);
262 262
263 /* Disable Sidetone clock auto-gating for normal operation */ 263 /* Disable Sidetone clock auto-gating for normal operation */
264 w = MCBSP_ST_READ(mcbsp, SYSCONFIG); 264 w = MCBSP_ST_READ(mcbsp, SYSCONFIG);
@@ -287,8 +287,8 @@ static void omap_st_off(struct omap_mcbsp *mcbsp)
287 w = MCBSP_ST_READ(mcbsp, SYSCONFIG); 287 w = MCBSP_ST_READ(mcbsp, SYSCONFIG);
288 MCBSP_ST_WRITE(mcbsp, SYSCONFIG, w | ST_AUTOIDLE); 288 MCBSP_ST_WRITE(mcbsp, SYSCONFIG, w | ST_AUTOIDLE);
289 289
290 if (mcbsp->pdata->enable_st_clock) 290 if (mcbsp->pdata->force_ick_on)
291 mcbsp->pdata->enable_st_clock(mcbsp->id, 0); 291 mcbsp->pdata->force_ick_on(mcbsp->st_data->mcbsp_iclk, false);
292} 292}
293 293
294static void omap_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir) 294static void omap_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir)
@@ -946,6 +946,13 @@ static int omap_st_add(struct omap_mcbsp *mcbsp, struct resource *res)
946 if (!st_data) 946 if (!st_data)
947 return -ENOMEM; 947 return -ENOMEM;
948 948
949 st_data->mcbsp_iclk = clk_get(mcbsp->dev, "ick");
950 if (IS_ERR(st_data->mcbsp_iclk)) {
951 dev_warn(mcbsp->dev,
952 "Failed to get ick, sidetone might be broken\n");
953 st_data->mcbsp_iclk = NULL;
954 }
955
949 st_data->io_base_st = devm_ioremap(mcbsp->dev, res->start, 956 st_data->io_base_st = devm_ioremap(mcbsp->dev, res->start,
950 resource_size(res)); 957 resource_size(res));
951 if (!st_data->io_base_st) 958 if (!st_data->io_base_st)
@@ -1093,6 +1100,8 @@ void omap_mcbsp_cleanup(struct omap_mcbsp *mcbsp)
1093 if (mcbsp->pdata->buffer_size) 1100 if (mcbsp->pdata->buffer_size)
1094 sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group); 1101 sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group);
1095 1102
1096 if (mcbsp->st_data) 1103 if (mcbsp->st_data) {
1097 sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group); 1104 sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group);
1105 clk_put(mcbsp->st_data->mcbsp_iclk);
1106 }
1098} 1107}
diff --git a/sound/soc/omap/mcbsp.h b/sound/soc/omap/mcbsp.h
index ce6cbbf923a4..61e93b1c185d 100644
--- a/sound/soc/omap/mcbsp.h
+++ b/sound/soc/omap/mcbsp.h
@@ -280,6 +280,7 @@ struct omap_mcbsp_reg_cfg {
280 280
281struct omap_mcbsp_st_data { 281struct omap_mcbsp_st_data {
282 void __iomem *io_base_st; 282 void __iomem *io_base_st;
283 struct clk *mcbsp_iclk;
283 bool running; 284 bool running;
284 bool enabled; 285 bool enabled;
285 s16 taps[128]; /* Sidetone filter coefficients */ 286 s16 taps[128]; /* Sidetone filter coefficients */
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index db07debb4a9c..d018e966e533 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -788,6 +788,7 @@ static int asoc_mcbsp_probe(struct platform_device *pdev)
788 match = of_match_device(omap_mcbsp_of_match, &pdev->dev); 788 match = of_match_device(omap_mcbsp_of_match, &pdev->dev);
789 if (match) { 789 if (match) {
790 struct device_node *node = pdev->dev.of_node; 790 struct device_node *node = pdev->dev.of_node;
791 struct omap_mcbsp_platform_data *pdata_quirk = pdata;
791 int buffer_size; 792 int buffer_size;
792 793
793 pdata = devm_kzalloc(&pdev->dev, 794 pdata = devm_kzalloc(&pdev->dev,
@@ -799,6 +800,8 @@ static int asoc_mcbsp_probe(struct platform_device *pdev)
799 memcpy(pdata, match->data, sizeof(*pdata)); 800 memcpy(pdata, match->data, sizeof(*pdata));
800 if (!of_property_read_u32(node, "ti,buffer-size", &buffer_size)) 801 if (!of_property_read_u32(node, "ti,buffer-size", &buffer_size))
801 pdata->buffer_size = buffer_size; 802 pdata->buffer_size = buffer_size;
803 if (pdata_quirk)
804 pdata->force_ick_on = pdata_quirk->force_ick_on;
802 } else if (!pdata) { 805 } else if (!pdata) {
803 dev_err(&pdev->dev, "missing platform data.\n"); 806 dev_err(&pdev->dev, "missing platform data.\n");
804 return -EINVAL; 807 return -EINVAL;