Commit bbfa26c5 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Tony Lindgren

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: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 6610d357
...@@ -257,8 +257,8 @@ static void omap_st_on(struct omap_mcbsp *mcbsp) ...@@ -257,8 +257,8 @@ static void omap_st_on(struct omap_mcbsp *mcbsp)
{ {
unsigned int w; unsigned int w;
if (mcbsp->pdata->enable_st_clock) if (mcbsp->pdata->force_ick_on)
mcbsp->pdata->enable_st_clock(mcbsp->id, 1); mcbsp->pdata->force_ick_on(mcbsp->st_data->mcbsp_iclk, true);
/* Disable Sidetone clock auto-gating for normal operation */ /* Disable Sidetone clock auto-gating for normal operation */
w = MCBSP_ST_READ(mcbsp, SYSCONFIG); w = MCBSP_ST_READ(mcbsp, SYSCONFIG);
...@@ -287,8 +287,8 @@ static void omap_st_off(struct omap_mcbsp *mcbsp) ...@@ -287,8 +287,8 @@ static void omap_st_off(struct omap_mcbsp *mcbsp)
w = MCBSP_ST_READ(mcbsp, SYSCONFIG); w = MCBSP_ST_READ(mcbsp, SYSCONFIG);
MCBSP_ST_WRITE(mcbsp, SYSCONFIG, w | ST_AUTOIDLE); MCBSP_ST_WRITE(mcbsp, SYSCONFIG, w | ST_AUTOIDLE);
if (mcbsp->pdata->enable_st_clock) if (mcbsp->pdata->force_ick_on)
mcbsp->pdata->enable_st_clock(mcbsp->id, 0); mcbsp->pdata->force_ick_on(mcbsp->st_data->mcbsp_iclk, false);
} }
static void omap_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir) static 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,6 +946,13 @@ static int omap_st_add(struct omap_mcbsp *mcbsp, struct resource *res)
if (!st_data) if (!st_data)
return -ENOMEM; return -ENOMEM;
st_data->mcbsp_iclk = clk_get(mcbsp->dev, "ick");
if (IS_ERR(st_data->mcbsp_iclk)) {
dev_warn(mcbsp->dev,
"Failed to get ick, sidetone might be broken\n");
st_data->mcbsp_iclk = NULL;
}
st_data->io_base_st = devm_ioremap(mcbsp->dev, res->start, st_data->io_base_st = devm_ioremap(mcbsp->dev, res->start,
resource_size(res)); resource_size(res));
if (!st_data->io_base_st) if (!st_data->io_base_st)
...@@ -1093,6 +1100,8 @@ void omap_mcbsp_cleanup(struct omap_mcbsp *mcbsp) ...@@ -1093,6 +1100,8 @@ void omap_mcbsp_cleanup(struct omap_mcbsp *mcbsp)
if (mcbsp->pdata->buffer_size) if (mcbsp->pdata->buffer_size)
sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group); sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group);
if (mcbsp->st_data) if (mcbsp->st_data) {
sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group); sysfs_remove_group(&mcbsp->dev->kobj, &sidetone_attr_group);
clk_put(mcbsp->st_data->mcbsp_iclk);
}
} }
...@@ -280,6 +280,7 @@ struct omap_mcbsp_reg_cfg { ...@@ -280,6 +280,7 @@ struct omap_mcbsp_reg_cfg {
struct omap_mcbsp_st_data { struct omap_mcbsp_st_data {
void __iomem *io_base_st; void __iomem *io_base_st;
struct clk *mcbsp_iclk;
bool running; bool running;
bool enabled; bool enabled;
s16 taps[128]; /* Sidetone filter coefficients */ s16 taps[128]; /* Sidetone filter coefficients */
......
...@@ -788,6 +788,7 @@ static int asoc_mcbsp_probe(struct platform_device *pdev) ...@@ -788,6 +788,7 @@ static int asoc_mcbsp_probe(struct platform_device *pdev)
match = of_match_device(omap_mcbsp_of_match, &pdev->dev); match = of_match_device(omap_mcbsp_of_match, &pdev->dev);
if (match) { if (match) {
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
struct omap_mcbsp_platform_data *pdata_quirk = pdata;
int buffer_size; int buffer_size;
pdata = devm_kzalloc(&pdev->dev, pdata = devm_kzalloc(&pdev->dev,
...@@ -799,6 +800,8 @@ static int asoc_mcbsp_probe(struct platform_device *pdev) ...@@ -799,6 +800,8 @@ static int asoc_mcbsp_probe(struct platform_device *pdev)
memcpy(pdata, match->data, sizeof(*pdata)); memcpy(pdata, match->data, sizeof(*pdata));
if (!of_property_read_u32(node, "ti,buffer-size", &buffer_size)) if (!of_property_read_u32(node, "ti,buffer-size", &buffer_size))
pdata->buffer_size = buffer_size; pdata->buffer_size = buffer_size;
if (pdata_quirk)
pdata->force_ick_on = pdata_quirk->force_ick_on;
} else if (!pdata) { } else if (!pdata) {
dev_err(&pdev->dev, "missing platform data.\n"); dev_err(&pdev->dev, "missing platform data.\n");
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment