diff options
-rw-r--r-- | sound/soc/mxs/mxs-saif.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index 9012a2036131..b42f301c6b96 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c | |||
@@ -119,23 +119,33 @@ static int mxs_saif_set_clk(struct mxs_saif *saif, | |||
119 | * Set SAIF clock | 119 | * Set SAIF clock |
120 | * | 120 | * |
121 | * The SAIF clock should be either 384*fs or 512*fs. | 121 | * The SAIF clock should be either 384*fs or 512*fs. |
122 | * If MCLK is used, the SAIF clk ratio need to match mclk ratio. | 122 | * If MCLK is used, the SAIF clk ratio needs to match mclk ratio. |
123 | * For 32x mclk, set saif clk as 512*fs. | 123 | * For 256x, 128x, 64x, and 32x sub-rates, set saif clk as 512*fs. |
124 | * For 48x mclk, set saif clk as 384*fs. | 124 | * For 192x, 96x, and 48x sub-rates, set saif clk as 384*fs. |
125 | * | 125 | * |
126 | * If MCLK is not used, we just set saif clk to 512*fs. | 126 | * If MCLK is not used, we just set saif clk to 512*fs. |
127 | */ | 127 | */ |
128 | clk_prepare_enable(master_saif->clk); | 128 | clk_prepare_enable(master_saif->clk); |
129 | 129 | ||
130 | if (master_saif->mclk_in_use) { | 130 | if (master_saif->mclk_in_use) { |
131 | if (mclk % 32 == 0) { | 131 | switch (mclk / rate) { |
132 | case 32: | ||
133 | case 64: | ||
134 | case 128: | ||
135 | case 256: | ||
136 | case 512: | ||
132 | scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE; | 137 | scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE; |
133 | ret = clk_set_rate(master_saif->clk, 512 * rate); | 138 | ret = clk_set_rate(master_saif->clk, 512 * rate); |
134 | } else if (mclk % 48 == 0) { | 139 | break; |
140 | case 48: | ||
141 | case 96: | ||
142 | case 192: | ||
143 | case 384: | ||
135 | scr |= BM_SAIF_CTRL_BITCLK_BASE_RATE; | 144 | scr |= BM_SAIF_CTRL_BITCLK_BASE_RATE; |
136 | ret = clk_set_rate(master_saif->clk, 384 * rate); | 145 | ret = clk_set_rate(master_saif->clk, 384 * rate); |
137 | } else { | 146 | break; |
138 | /* SAIF MCLK should be either 32x or 48x */ | 147 | default: |
148 | /* SAIF MCLK should be a sub-rate of 512x or 384x */ | ||
139 | clk_disable_unprepare(master_saif->clk); | 149 | clk_disable_unprepare(master_saif->clk); |
140 | return -EINVAL; | 150 | return -EINVAL; |
141 | } | 151 | } |