diff options
author | Nicolin Chen <Guangyu.Chen@freescale.com> | 2014-03-11 03:35:08 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:57:54 -0400 |
commit | 1f0ef9767e33a7ccac10c8fac1459cd5e1cd9b09 (patch) | |
tree | 14654efd365f40a56459220c0b2258f411dc6fd0 | |
parent | 218e284028e5674f18a05ae421f4292331b2cae5 (diff) |
ENGR00303122-1 mxc: asrc: Fix asrc clocks management
ASRC needs three clocks from SoC, they are:
mem_clk: Peripheral access clock
ipg_clk: Peripheral clock
asrck_clk: ASRC module clock
while the current driver only maintains two of them and has confusing
clock names. Thus fix it.
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
-rw-r--r-- | drivers/mxc/asrc/mxc_asrc.c | 34 | ||||
-rw-r--r-- | include/linux/mxc_asrc.h | 6 |
2 files changed, 29 insertions, 11 deletions
diff --git a/drivers/mxc/asrc/mxc_asrc.c b/drivers/mxc/asrc/mxc_asrc.c index a9108488d1bc..c98fa4821b81 100644 --- a/drivers/mxc/asrc/mxc_asrc.c +++ b/drivers/mxc/asrc/mxc_asrc.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Freescale Asynchronous Sample Rate Converter (ASRC) driver | 2 | * Freescale Asynchronous Sample Rate Converter (ASRC) driver |
3 | * | 3 | * |
4 | * Copyright 2008-2013 Freescale Semiconductor, Inc. All Rights Reserved. | 4 | * Copyright 2008-2014 Freescale Semiconductor, Inc. All Rights Reserved. |
5 | * | 5 | * |
6 | * This file is licensed under the terms of the GNU General Public License | 6 | * This file is licensed under the terms of the GNU General Public License |
7 | * version 2. This program is licensed "as is" without any warranty of any | 7 | * version 2. This program is licensed "as is" without any warranty of any |
@@ -256,7 +256,7 @@ static int asrc_get_asrck_clock_divider(int samplerate) | |||
256 | return -EINVAL; | 256 | return -EINVAL; |
257 | } | 257 | } |
258 | 258 | ||
259 | bitclk = clk_get_rate(asrc->asrc_clk); | 259 | bitclk = clk_get_rate(asrc->asrck_clk); |
260 | 260 | ||
261 | ra = bitclk / samplerate; | 261 | ra = bitclk / samplerate; |
262 | ratio = ra; | 262 | ratio = ra; |
@@ -317,7 +317,9 @@ int asrc_req_pair(int chn_num, enum asrc_pair_index *index) | |||
317 | spin_unlock_irqrestore(&data_lock, lock_flags); | 317 | spin_unlock_irqrestore(&data_lock, lock_flags); |
318 | 318 | ||
319 | if (!ret) { | 319 | if (!ret) { |
320 | clk_enable(asrc->asrc_clk); | 320 | clk_prepare_enable(asrc->mem_clk); |
321 | clk_prepare_enable(asrc->ipg_clk); | ||
322 | clk_prepare_enable(asrc->asrck_clk); | ||
321 | clk_prepare_enable(asrc->dma_clk); | 323 | clk_prepare_enable(asrc->dma_clk); |
322 | } | 324 | } |
323 | 325 | ||
@@ -549,7 +551,9 @@ EXPORT_SYMBOL(asrc_stop_conv); | |||
549 | void asrc_finish_conv(enum asrc_pair_index index) | 551 | void asrc_finish_conv(enum asrc_pair_index index) |
550 | { | 552 | { |
551 | clk_disable_unprepare(asrc->dma_clk); | 553 | clk_disable_unprepare(asrc->dma_clk); |
552 | clk_disable(asrc->asrc_clk); | 554 | clk_disable_unprepare(asrc->asrck_clk); |
555 | clk_disable_unprepare(asrc->ipg_clk); | ||
556 | clk_disable_unprepare(asrc->mem_clk); | ||
553 | } | 557 | } |
554 | EXPORT_SYMBOL(asrc_finish_conv); | 558 | EXPORT_SYMBOL(asrc_finish_conv); |
555 | 559 | ||
@@ -1862,7 +1866,7 @@ static int mxc_asrc_probe(struct platform_device *pdev) | |||
1862 | 1866 | ||
1863 | /* Register regmap and let it prepare core clock */ | 1867 | /* Register regmap and let it prepare core clock */ |
1864 | asrc->regmap = devm_regmap_init_mmio_clk(&pdev->dev, | 1868 | asrc->regmap = devm_regmap_init_mmio_clk(&pdev->dev, |
1865 | "core", regs, &asrc_regmap_config); | 1869 | "mem", regs, &asrc_regmap_config); |
1866 | if (IS_ERR(asrc->regmap)) { | 1870 | if (IS_ERR(asrc->regmap)) { |
1867 | dev_err(&pdev->dev, "regmap init failed\n"); | 1871 | dev_err(&pdev->dev, "regmap init failed\n"); |
1868 | return PTR_ERR(asrc->regmap); | 1872 | return PTR_ERR(asrc->regmap); |
@@ -1880,10 +1884,22 @@ static int mxc_asrc_probe(struct platform_device *pdev) | |||
1880 | return ret; | 1884 | return ret; |
1881 | } | 1885 | } |
1882 | 1886 | ||
1883 | asrc->asrc_clk = devm_clk_get(&pdev->dev, "core"); | 1887 | asrc->mem_clk = devm_clk_get(&pdev->dev, "mem"); |
1884 | if (IS_ERR(asrc->asrc_clk)) { | 1888 | if (IS_ERR(asrc->mem_clk)) { |
1885 | dev_err(&pdev->dev, "failed to get core clock\n"); | 1889 | dev_err(&pdev->dev, "failed to get mem clock\n"); |
1886 | return PTR_ERR(asrc->asrc_clk); | 1890 | return PTR_ERR(asrc->ipg_clk); |
1891 | } | ||
1892 | |||
1893 | asrc->ipg_clk = devm_clk_get(&pdev->dev, "ipg"); | ||
1894 | if (IS_ERR(asrc->ipg_clk)) { | ||
1895 | dev_err(&pdev->dev, "failed to get ipg clock\n"); | ||
1896 | return PTR_ERR(asrc->ipg_clk); | ||
1897 | } | ||
1898 | |||
1899 | asrc->asrck_clk = devm_clk_get(&pdev->dev, "asrck"); | ||
1900 | if (IS_ERR(asrc->asrck_clk)) { | ||
1901 | dev_err(&pdev->dev, "failed to get asrck clock\n"); | ||
1902 | return PTR_ERR(asrc->asrck_clk); | ||
1887 | } | 1903 | } |
1888 | 1904 | ||
1889 | asrc->dma_clk = devm_clk_get(&pdev->dev, "dma"); | 1905 | asrc->dma_clk = devm_clk_get(&pdev->dev, "dma"); |
diff --git a/include/linux/mxc_asrc.h b/include/linux/mxc_asrc.h index 1131189540f6..98db3d587f43 100644 --- a/include/linux/mxc_asrc.h +++ b/include/linux/mxc_asrc.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2008-2013 Freescale Semiconductor, Inc. All Rights Reserved. | 2 | * Copyright 2008-2014 Freescale Semiconductor, Inc. All Rights Reserved. |
3 | * | 3 | * |
4 | * The code contained herein is licensed under the GNU General Public | 4 | * The code contained herein is licensed under the GNU General Public |
5 | * License. You may obtain a copy of the GNU General Public License | 5 | * License. You may obtain a copy of the GNU General Public License |
@@ -349,7 +349,9 @@ struct asrc_data { | |||
349 | struct proc_dir_entry *proc_asrc; | 349 | struct proc_dir_entry *proc_asrc; |
350 | struct class *asrc_class; | 350 | struct class *asrc_class; |
351 | struct regmap *regmap; | 351 | struct regmap *regmap; |
352 | struct clk *asrc_clk; | 352 | struct clk *mem_clk; |
353 | struct clk *ipg_clk; | ||
354 | struct clk *asrck_clk; | ||
353 | struct clk *dma_clk; | 355 | struct clk *dma_clk; |
354 | unsigned long paddr; | 356 | unsigned long paddr; |
355 | unsigned int channel_bits; | 357 | unsigned int channel_bits; |