Skip to content

Commit 9c370be

Browse files
author
Codrin Ciubotariu
committed
ASoC: atmel-i2s: Remove unnecessary audio PLL clock (aclk)
The generated clock (gclk) driver is able to set aclk as its parent and change its rate alone, if needed. This means that our driver no longer needs to configure aclk and we can let gclk select and configure its clock source. Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 0a1ed8f commit 9c370be

1 file changed

Lines changed: 7 additions & 39 deletions

File tree

sound/soc/atmel/atmel-i2s.c

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ struct atmel_i2s_dev {
206206
struct regmap *regmap;
207207
struct clk *pclk;
208208
struct clk *gclk;
209-
struct clk *aclk;
210209
struct snd_dmaengine_dai_dma_data playback;
211210
struct snd_dmaengine_dai_dma_data capture;
212211
unsigned int fmt;
@@ -303,7 +302,7 @@ static int atmel_i2s_get_gck_param(struct atmel_i2s_dev *dev, int fs)
303302
{
304303
int i, best;
305304

306-
if (!dev->gclk || !dev->aclk) {
305+
if (!dev->gclk) {
307306
dev_err(dev->dev, "cannot generate the I2S Master Clock\n");
308307
return -EINVAL;
309308
}
@@ -421,7 +420,7 @@ static int atmel_i2s_switch_mck_generator(struct atmel_i2s_dev *dev,
421420
bool enabled)
422421
{
423422
unsigned int mr, mr_mask;
424-
unsigned long aclk_rate;
423+
unsigned long gclk_rate;
425424
int ret;
426425

427426
mr = 0;
@@ -445,35 +444,18 @@ static int atmel_i2s_switch_mck_generator(struct atmel_i2s_dev *dev,
445444
/* Disable/unprepare the PMC generated clock. */
446445
clk_disable_unprepare(dev->gclk);
447446

448-
/* Disable/unprepare the PLL audio clock. */
449-
clk_disable_unprepare(dev->aclk);
450447
return 0;
451448
}
452449

453450
if (!dev->gck_param)
454451
return -EINVAL;
455452

456-
aclk_rate = dev->gck_param->mck * (dev->gck_param->imckdiv + 1);
453+
gclk_rate = dev->gck_param->mck * (dev->gck_param->imckdiv + 1);
457454

458-
/* Fist change the PLL audio clock frequency ... */
459-
ret = clk_set_rate(dev->aclk, aclk_rate);
455+
ret = clk_set_rate(dev->gclk, gclk_rate);
460456
if (ret)
461457
return ret;
462458

463-
/*
464-
* ... then set the PMC generated clock rate to the very same frequency
465-
* to set the gclk parent to aclk.
466-
*/
467-
ret = clk_set_rate(dev->gclk, aclk_rate);
468-
if (ret)
469-
return ret;
470-
471-
/* Prepare and enable the PLL audio clock first ... */
472-
ret = clk_prepare_enable(dev->aclk);
473-
if (ret)
474-
return ret;
475-
476-
/* ... then prepare and enable the PMC generated clock. */
477459
ret = clk_prepare_enable(dev->gclk);
478460
if (ret)
479461
return ret;
@@ -668,28 +650,14 @@ static int atmel_i2s_probe(struct platform_device *pdev)
668650
return err;
669651
}
670652

671-
/* Get audio clocks to generate the I2S Master Clock (I2S_MCK) */
672-
dev->aclk = devm_clk_get(&pdev->dev, "aclk");
653+
/* Get audio clock to generate the I2S Master Clock (I2S_MCK) */
673654
dev->gclk = devm_clk_get(&pdev->dev, "gclk");
674-
if (IS_ERR(dev->aclk) && IS_ERR(dev->gclk)) {
675-
if (PTR_ERR(dev->aclk) == -EPROBE_DEFER ||
676-
PTR_ERR(dev->gclk) == -EPROBE_DEFER)
655+
if (IS_ERR(dev->gclk)) {
656+
if (PTR_ERR(dev->gclk) == -EPROBE_DEFER)
677657
return -EPROBE_DEFER;
678658
/* Master Mode not supported */
679-
dev->aclk = NULL;
680659
dev->gclk = NULL;
681-
} else if (IS_ERR(dev->gclk)) {
682-
err = PTR_ERR(dev->gclk);
683-
dev_err(&pdev->dev,
684-
"failed to get the PMC generated clock: %d\n", err);
685-
return err;
686-
} else if (IS_ERR(dev->aclk)) {
687-
err = PTR_ERR(dev->aclk);
688-
dev_err(&pdev->dev,
689-
"failed to get the PLL audio clock: %d\n", err);
690-
return err;
691660
}
692-
693661
dev->dev = &pdev->dev;
694662
dev->regmap = regmap;
695663
platform_set_drvdata(pdev, dev);

0 commit comments

Comments
 (0)