aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2014-07-09 12:41:47 -0400
committerMark Brown <broonie@linaro.org>2014-07-10 06:09:15 -0400
commitc393aca94f26e90290cd861743efbfbcd97c0316 (patch)
tree3da2bc35c3b8fa9354041a0a607f8cf7f58cbd4b
parent613124ce644c38857ef5780a96e6d400d6b11abd (diff)
ASoC: arizona: Correct return value of arizona_is_enabled_fll
arizona_is_enabled_fll currently returns a bool, but can throw an error. The error will be basically ignored and we will treat the FLL as already on. This patch changes the return to be an int and adds error code to propagate the error up to the callback. Reported-by: Anil Kumar <anil.kumar@wolfsonmicro.com> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/codecs/arizona.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 0a417e8bcadd..a6f09bb0a2e9 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1716,7 +1716,7 @@ static void arizona_apply_fll(struct arizona *arizona, unsigned int base,
1716 ARIZONA_FLL1_CTRL_UPD | cfg->n); 1716 ARIZONA_FLL1_CTRL_UPD | cfg->n);
1717} 1717}
1718 1718
1719static bool arizona_is_enabled_fll(struct arizona_fll *fll) 1719static int arizona_is_enabled_fll(struct arizona_fll *fll)
1720{ 1720{
1721 struct arizona *arizona = fll->arizona; 1721 struct arizona *arizona = fll->arizona;
1722 unsigned int reg; 1722 unsigned int reg;
@@ -1732,13 +1732,17 @@ static bool arizona_is_enabled_fll(struct arizona_fll *fll)
1732 return reg & ARIZONA_FLL1_ENA; 1732 return reg & ARIZONA_FLL1_ENA;
1733} 1733}
1734 1734
1735static void arizona_enable_fll(struct arizona_fll *fll) 1735static int arizona_enable_fll(struct arizona_fll *fll)
1736{ 1736{
1737 struct arizona *arizona = fll->arizona; 1737 struct arizona *arizona = fll->arizona;
1738 int ret; 1738 int ret;
1739 bool use_sync = false; 1739 bool use_sync = false;
1740 int already_enabled = arizona_is_enabled_fll(fll);
1740 struct arizona_fll_cfg cfg; 1741 struct arizona_fll_cfg cfg;
1741 1742
1743 if (already_enabled < 0)
1744 return already_enabled;
1745
1742 /* 1746 /*
1743 * If we have both REFCLK and SYNCCLK then enable both, 1747 * If we have both REFCLK and SYNCCLK then enable both,
1744 * otherwise apply the SYNCCLK settings to REFCLK. 1748 * otherwise apply the SYNCCLK settings to REFCLK.
@@ -1766,7 +1770,7 @@ static void arizona_enable_fll(struct arizona_fll *fll)
1766 ARIZONA_FLL1_SYNC_ENA, 0); 1770 ARIZONA_FLL1_SYNC_ENA, 0);
1767 } else { 1771 } else {
1768 arizona_fll_err(fll, "No clocks provided\n"); 1772 arizona_fll_err(fll, "No clocks provided\n");
1769 return; 1773 return -EINVAL;
1770 } 1774 }
1771 1775
1772 /* 1776 /*
@@ -1781,7 +1785,7 @@ static void arizona_enable_fll(struct arizona_fll *fll)
1781 ARIZONA_FLL1_SYNC_BW, 1785 ARIZONA_FLL1_SYNC_BW,
1782 ARIZONA_FLL1_SYNC_BW); 1786 ARIZONA_FLL1_SYNC_BW);
1783 1787
1784 if (!arizona_is_enabled_fll(fll)) 1788 if (!already_enabled)
1785 pm_runtime_get(arizona->dev); 1789 pm_runtime_get(arizona->dev);
1786 1790
1787 /* Clear any pending completions */ 1791 /* Clear any pending completions */
@@ -1800,6 +1804,8 @@ static void arizona_enable_fll(struct arizona_fll *fll)
1800 msecs_to_jiffies(250)); 1804 msecs_to_jiffies(250));
1801 if (ret == 0) 1805 if (ret == 0)
1802 arizona_fll_warn(fll, "Timed out waiting for lock\n"); 1806 arizona_fll_warn(fll, "Timed out waiting for lock\n");
1807
1808 return 0;
1803} 1809}
1804 1810
1805static void arizona_disable_fll(struct arizona_fll *fll) 1811static void arizona_disable_fll(struct arizona_fll *fll)
@@ -1821,7 +1827,7 @@ static void arizona_disable_fll(struct arizona_fll *fll)
1821int arizona_set_fll_refclk(struct arizona_fll *fll, int source, 1827int arizona_set_fll_refclk(struct arizona_fll *fll, int source,
1822 unsigned int Fref, unsigned int Fout) 1828 unsigned int Fref, unsigned int Fout)
1823{ 1829{
1824 int ret; 1830 int ret = 0;
1825 1831
1826 if (fll->ref_src == source && fll->ref_freq == Fref) 1832 if (fll->ref_src == source && fll->ref_freq == Fref)
1827 return 0; 1833 return 0;
@@ -1836,17 +1842,17 @@ int arizona_set_fll_refclk(struct arizona_fll *fll, int source,
1836 fll->ref_freq = Fref; 1842 fll->ref_freq = Fref;
1837 1843
1838 if (fll->fout && Fref > 0) { 1844 if (fll->fout && Fref > 0) {
1839 arizona_enable_fll(fll); 1845 ret = arizona_enable_fll(fll);
1840 } 1846 }
1841 1847
1842 return 0; 1848 return ret;
1843} 1849}
1844EXPORT_SYMBOL_GPL(arizona_set_fll_refclk); 1850EXPORT_SYMBOL_GPL(arizona_set_fll_refclk);
1845 1851
1846int arizona_set_fll(struct arizona_fll *fll, int source, 1852int arizona_set_fll(struct arizona_fll *fll, int source,
1847 unsigned int Fref, unsigned int Fout) 1853 unsigned int Fref, unsigned int Fout)
1848{ 1854{
1849 int ret; 1855 int ret = 0;
1850 1856
1851 if (fll->sync_src == source && 1857 if (fll->sync_src == source &&
1852 fll->sync_freq == Fref && fll->fout == Fout) 1858 fll->sync_freq == Fref && fll->fout == Fout)
@@ -1869,11 +1875,11 @@ int arizona_set_fll(struct arizona_fll *fll, int source,
1869 fll->fout = Fout; 1875 fll->fout = Fout;
1870 1876
1871 if (Fout) 1877 if (Fout)
1872 arizona_enable_fll(fll); 1878 ret = arizona_enable_fll(fll);
1873 else 1879 else
1874 arizona_disable_fll(fll); 1880 arizona_disable_fll(fll);
1875 1881
1876 return 0; 1882 return ret;
1877} 1883}
1878EXPORT_SYMBOL_GPL(arizona_set_fll); 1884EXPORT_SYMBOL_GPL(arizona_set_fll);
1879 1885