From: Mark Brown Date: Sun, 15 Sep 2019 09:31:44 +0000 (+0100) Subject: Merge branch 'asoc-5.4' into asoc-next X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a54f8485727e6e85b5dfe1d9708b80d13fe8bf5f;p=openwrt%2Fstaging%2Fblogic.git Merge branch 'asoc-5.4' into asoc-next --- a54f8485727e6e85b5dfe1d9708b80d13fe8bf5f diff --cc sound/soc/atmel/mchp-i2s-mcc.c index ab7d5f98e759,9a406144b18f..befc2a3a05b0 --- a/sound/soc/atmel/mchp-i2s-mcc.c +++ b/sound/soc/atmel/mchp-i2s-mcc.c @@@ -656,27 -652,30 +652,35 @@@ static int mchp_i2s_mcc_hw_params(struc return 0; } - /* Save the number of channels to know what interrupts to enable */ - dev->channels = channels; - - if (set_divs) { - bclk_rate = frame_length * params_rate(params); - ret = mchp_i2s_mcc_config_divs(dev, bclk_rate, &mra); + if (mra & MCHP_I2SMCC_MRA_SRCCLK_GCLK && !dev->gclk_use) { + /* set the rate */ + ret = clk_set_rate(dev->gclk, rate); if (ret) { - dev_err(dev->dev, "unable to configure the divisors: %d\n", - ret); + dev_err(dev->dev, + "unable to set rate %lu to GCLK: %d\n", + rate, ret); return ret; } + + ret = clk_prepare(dev->gclk); + if (ret < 0) { + dev_err(dev->dev, "unable to prepare GCLK: %d\n", ret); + return ret; + } + dev->gclk_use = 1; } + /* Save the number of channels to know what interrupts to enable */ + dev->channels = channels; + ret = regmap_write(dev->regmap, MCHP_I2SMCC_MRA, mra); - if (ret < 0) + if (ret < 0) { + if (dev->gclk_use) { + clk_unprepare(dev->gclk); + dev->gclk_use = 0; + } return ret; + } return regmap_write(dev->regmap, MCHP_I2SMCC_MRB, mrb); }