Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: tegra: utils: add support for Tegra30 devices

Tegra30 has some additional clocks that need to be manipulated, names
some clocks differently, runs PLLs at different base rates, etc. The
utility code needs to handle this.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

authored by

Stephen Warren and committed by
Mark Brown
c2f6702d a9005b67

+31 -7
+24 -5
sound/soc/tegra/tegra_asoc_utils.c
··· 2 2 * tegra_asoc_utils.c - Harmony machine ASoC driver 3 3 * 4 4 * Author: Stephen Warren <swarren@nvidia.com> 5 - * Copyright (C) 2010 - NVIDIA, Inc. 5 + * Copyright (C) 2010,2012 - NVIDIA, Inc. 6 6 * 7 7 * This program is free software; you can redistribute it and/or 8 8 * modify it under the terms of the GNU General Public License ··· 25 25 #include <linux/err.h> 26 26 #include <linux/kernel.h> 27 27 #include <linux/module.h> 28 + #include <linux/of.h> 28 29 29 30 #include "tegra_asoc_utils.h" 30 31 ··· 41 40 case 22050: 42 41 case 44100: 43 42 case 88200: 44 - new_baseclock = 56448000; 43 + if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA20) 44 + new_baseclock = 56448000; 45 + else 46 + new_baseclock = 564480000; 45 47 break; 46 48 case 8000: 47 49 case 16000: ··· 52 48 case 48000: 53 49 case 64000: 54 50 case 96000: 55 - new_baseclock = 73728000; 51 + if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA20) 52 + new_baseclock = 73728000; 53 + else 54 + new_baseclock = 552960000; 56 55 break; 57 56 default: 58 57 return -EINVAL; ··· 85 78 return err; 86 79 } 87 80 88 - /* Don't set cdev1 rate; its locked to pll_a_out0 */ 81 + /* Don't set cdev1/extern1 rate; it's locked to pll_a_out0 */ 89 82 90 83 err = clk_enable(data->clk_pll_a); 91 84 if (err) { ··· 119 112 120 113 data->dev = dev; 121 114 115 + if (!of_have_populated_dt()) 116 + data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA20; 117 + else if (of_machine_is_compatible("nvidia,tegra20")) 118 + data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA20; 119 + else if (of_machine_is_compatible("nvidia,tegra30")) 120 + data->soc = TEGRA_ASOC_UTILS_SOC_TEGRA30; 121 + else 122 + return -EINVAL; 123 + 122 124 data->clk_pll_a = clk_get_sys(NULL, "pll_a"); 123 125 if (IS_ERR(data->clk_pll_a)) { 124 126 dev_err(data->dev, "Can't retrieve clk pll_a\n"); ··· 142 126 goto err_put_pll_a; 143 127 } 144 128 145 - data->clk_cdev1 = clk_get_sys(NULL, "cdev1"); 129 + if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA20) 130 + data->clk_cdev1 = clk_get_sys(NULL, "cdev1"); 131 + else 132 + data->clk_cdev1 = clk_get_sys("extern1", NULL); 146 133 if (IS_ERR(data->clk_cdev1)) { 147 134 dev_err(data->dev, "Can't retrieve clk cdev1\n"); 148 135 ret = PTR_ERR(data->clk_cdev1);
+7 -2
sound/soc/tegra/tegra_asoc_utils.h
··· 2 2 * tegra_asoc_utils.h - Definitions for Tegra DAS driver 3 3 * 4 4 * Author: Stephen Warren <swarren@nvidia.com> 5 - * Copyright (C) 2010 - NVIDIA, Inc. 5 + * Copyright (C) 2010,2012 - NVIDIA, Inc. 6 6 * 7 7 * This program is free software; you can redistribute it and/or 8 8 * modify it under the terms of the GNU General Public License ··· 26 26 struct clk; 27 27 struct device; 28 28 29 + enum tegra_asoc_utils_soc { 30 + TEGRA_ASOC_UTILS_SOC_TEGRA20, 31 + TEGRA_ASOC_UTILS_SOC_TEGRA30, 32 + }; 33 + 29 34 struct tegra_asoc_utils_data { 30 35 struct device *dev; 36 + enum tegra_asoc_utils_soc soc; 31 37 struct clk *clk_pll_a; 32 38 struct clk *clk_pll_a_out0; 33 39 struct clk *clk_cdev1; ··· 48 42 void tegra_asoc_utils_fini(struct tegra_asoc_utils_data *data); 49 43 50 44 #endif 51 -