diff options
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r-- | sound/soc/soc-core.c | 120 |
1 files changed, 98 insertions, 22 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b098c0b4c584..55fdb4abb179 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1300,6 +1300,8 @@ EXPORT_SYMBOL_GPL(snd_soc_test_bits); | |||
1300 | /** | 1300 | /** |
1301 | * snd_soc_new_pcms - create new sound card and pcms | 1301 | * snd_soc_new_pcms - create new sound card and pcms |
1302 | * @socdev: the SoC audio device | 1302 | * @socdev: the SoC audio device |
1303 | * @idx: ALSA card index | ||
1304 | * @xid: card identification | ||
1303 | * | 1305 | * |
1304 | * Create a new sound card based upon the codec and interface pcms. | 1306 | * Create a new sound card based upon the codec and interface pcms. |
1305 | * | 1307 | * |
@@ -1472,7 +1474,7 @@ EXPORT_SYMBOL_GPL(snd_soc_set_runtime_hwparams); | |||
1472 | * snd_soc_cnew - create new control | 1474 | * snd_soc_cnew - create new control |
1473 | * @_template: control template | 1475 | * @_template: control template |
1474 | * @data: control private data | 1476 | * @data: control private data |
1475 | * @lnng_name: control long name | 1477 | * @long_name: control long name |
1476 | * | 1478 | * |
1477 | * Create a new mixer control from a template control. | 1479 | * Create a new mixer control from a template control. |
1478 | * | 1480 | * |
@@ -1522,7 +1524,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_enum_double); | |||
1522 | /** | 1524 | /** |
1523 | * snd_soc_get_enum_double - enumerated double mixer get callback | 1525 | * snd_soc_get_enum_double - enumerated double mixer get callback |
1524 | * @kcontrol: mixer control | 1526 | * @kcontrol: mixer control |
1525 | * @uinfo: control element information | 1527 | * @ucontrol: control element information |
1526 | * | 1528 | * |
1527 | * Callback to get the value of a double enumerated mixer. | 1529 | * Callback to get the value of a double enumerated mixer. |
1528 | * | 1530 | * |
@@ -1551,7 +1553,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_enum_double); | |||
1551 | /** | 1553 | /** |
1552 | * snd_soc_put_enum_double - enumerated double mixer put callback | 1554 | * snd_soc_put_enum_double - enumerated double mixer put callback |
1553 | * @kcontrol: mixer control | 1555 | * @kcontrol: mixer control |
1554 | * @uinfo: control element information | 1556 | * @ucontrol: control element information |
1555 | * | 1557 | * |
1556 | * Callback to set the value of a double enumerated mixer. | 1558 | * Callback to set the value of a double enumerated mixer. |
1557 | * | 1559 | * |
@@ -1583,6 +1585,80 @@ int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, | |||
1583 | EXPORT_SYMBOL_GPL(snd_soc_put_enum_double); | 1585 | EXPORT_SYMBOL_GPL(snd_soc_put_enum_double); |
1584 | 1586 | ||
1585 | /** | 1587 | /** |
1588 | * snd_soc_get_value_enum_double - semi enumerated double mixer get callback | ||
1589 | * @kcontrol: mixer control | ||
1590 | * @ucontrol: control element information | ||
1591 | * | ||
1592 | * Callback to get the value of a double semi enumerated mixer. | ||
1593 | * | ||
1594 | * Semi enumerated mixer: the enumerated items are referred as values. Can be | ||
1595 | * used for handling bitfield coded enumeration for example. | ||
1596 | * | ||
1597 | * Returns 0 for success. | ||
1598 | */ | ||
1599 | int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol, | ||
1600 | struct snd_ctl_elem_value *ucontrol) | ||
1601 | { | ||
1602 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | ||
1603 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | ||
1604 | unsigned short reg_val, val, mux; | ||
1605 | |||
1606 | reg_val = snd_soc_read(codec, e->reg); | ||
1607 | val = (reg_val >> e->shift_l) & e->mask; | ||
1608 | for (mux = 0; mux < e->max; mux++) { | ||
1609 | if (val == e->values[mux]) | ||
1610 | break; | ||
1611 | } | ||
1612 | ucontrol->value.enumerated.item[0] = mux; | ||
1613 | if (e->shift_l != e->shift_r) { | ||
1614 | val = (reg_val >> e->shift_r) & e->mask; | ||
1615 | for (mux = 0; mux < e->max; mux++) { | ||
1616 | if (val == e->values[mux]) | ||
1617 | break; | ||
1618 | } | ||
1619 | ucontrol->value.enumerated.item[1] = mux; | ||
1620 | } | ||
1621 | |||
1622 | return 0; | ||
1623 | } | ||
1624 | EXPORT_SYMBOL_GPL(snd_soc_get_value_enum_double); | ||
1625 | |||
1626 | /** | ||
1627 | * snd_soc_put_value_enum_double - semi enumerated double mixer put callback | ||
1628 | * @kcontrol: mixer control | ||
1629 | * @ucontrol: control element information | ||
1630 | * | ||
1631 | * Callback to set the value of a double semi enumerated mixer. | ||
1632 | * | ||
1633 | * Semi enumerated mixer: the enumerated items are referred as values. Can be | ||
1634 | * used for handling bitfield coded enumeration for example. | ||
1635 | * | ||
1636 | * Returns 0 for success. | ||
1637 | */ | ||
1638 | int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol, | ||
1639 | struct snd_ctl_elem_value *ucontrol) | ||
1640 | { | ||
1641 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | ||
1642 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | ||
1643 | unsigned short val; | ||
1644 | unsigned short mask; | ||
1645 | |||
1646 | if (ucontrol->value.enumerated.item[0] > e->max - 1) | ||
1647 | return -EINVAL; | ||
1648 | val = e->values[ucontrol->value.enumerated.item[0]] << e->shift_l; | ||
1649 | mask = e->mask << e->shift_l; | ||
1650 | if (e->shift_l != e->shift_r) { | ||
1651 | if (ucontrol->value.enumerated.item[1] > e->max - 1) | ||
1652 | return -EINVAL; | ||
1653 | val |= e->values[ucontrol->value.enumerated.item[1]] << e->shift_r; | ||
1654 | mask |= e->mask << e->shift_r; | ||
1655 | } | ||
1656 | |||
1657 | return snd_soc_update_bits(codec, e->reg, mask, val); | ||
1658 | } | ||
1659 | EXPORT_SYMBOL_GPL(snd_soc_put_value_enum_double); | ||
1660 | |||
1661 | /** | ||
1586 | * snd_soc_info_enum_ext - external enumerated single mixer info callback | 1662 | * snd_soc_info_enum_ext - external enumerated single mixer info callback |
1587 | * @kcontrol: mixer control | 1663 | * @kcontrol: mixer control |
1588 | * @uinfo: control element information | 1664 | * @uinfo: control element information |
@@ -1668,7 +1744,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw); | |||
1668 | /** | 1744 | /** |
1669 | * snd_soc_get_volsw - single mixer get callback | 1745 | * snd_soc_get_volsw - single mixer get callback |
1670 | * @kcontrol: mixer control | 1746 | * @kcontrol: mixer control |
1671 | * @uinfo: control element information | 1747 | * @ucontrol: control element information |
1672 | * | 1748 | * |
1673 | * Callback to get the value of a single mixer control. | 1749 | * Callback to get the value of a single mixer control. |
1674 | * | 1750 | * |
@@ -1707,7 +1783,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw); | |||
1707 | /** | 1783 | /** |
1708 | * snd_soc_put_volsw - single mixer put callback | 1784 | * snd_soc_put_volsw - single mixer put callback |
1709 | * @kcontrol: mixer control | 1785 | * @kcontrol: mixer control |
1710 | * @uinfo: control element information | 1786 | * @ucontrol: control element information |
1711 | * | 1787 | * |
1712 | * Callback to set the value of a single mixer control. | 1788 | * Callback to set the value of a single mixer control. |
1713 | * | 1789 | * |
@@ -1775,7 +1851,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_2r); | |||
1775 | /** | 1851 | /** |
1776 | * snd_soc_get_volsw_2r - double mixer get callback | 1852 | * snd_soc_get_volsw_2r - double mixer get callback |
1777 | * @kcontrol: mixer control | 1853 | * @kcontrol: mixer control |
1778 | * @uinfo: control element information | 1854 | * @ucontrol: control element information |
1779 | * | 1855 | * |
1780 | * Callback to get the value of a double mixer control that spans 2 registers. | 1856 | * Callback to get the value of a double mixer control that spans 2 registers. |
1781 | * | 1857 | * |
@@ -1812,7 +1888,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_2r); | |||
1812 | /** | 1888 | /** |
1813 | * snd_soc_put_volsw_2r - double mixer set callback | 1889 | * snd_soc_put_volsw_2r - double mixer set callback |
1814 | * @kcontrol: mixer control | 1890 | * @kcontrol: mixer control |
1815 | * @uinfo: control element information | 1891 | * @ucontrol: control element information |
1816 | * | 1892 | * |
1817 | * Callback to set the value of a double mixer control that spans 2 registers. | 1893 | * Callback to set the value of a double mixer control that spans 2 registers. |
1818 | * | 1894 | * |
@@ -1882,7 +1958,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_s8); | |||
1882 | /** | 1958 | /** |
1883 | * snd_soc_get_volsw_s8 - signed mixer get callback | 1959 | * snd_soc_get_volsw_s8 - signed mixer get callback |
1884 | * @kcontrol: mixer control | 1960 | * @kcontrol: mixer control |
1885 | * @uinfo: control element information | 1961 | * @ucontrol: control element information |
1886 | * | 1962 | * |
1887 | * Callback to get the value of a signed mixer control. | 1963 | * Callback to get the value of a signed mixer control. |
1888 | * | 1964 | * |
@@ -1909,7 +1985,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_s8); | |||
1909 | /** | 1985 | /** |
1910 | * snd_soc_put_volsw_sgn - signed mixer put callback | 1986 | * snd_soc_put_volsw_sgn - signed mixer put callback |
1911 | * @kcontrol: mixer control | 1987 | * @kcontrol: mixer control |
1912 | * @uinfo: control element information | 1988 | * @ucontrol: control element information |
1913 | * | 1989 | * |
1914 | * Callback to set the value of a signed mixer control. | 1990 | * Callback to set the value of a signed mixer control. |
1915 | * | 1991 | * |
@@ -1954,7 +2030,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk); | |||
1954 | /** | 2030 | /** |
1955 | * snd_soc_dai_set_clkdiv - configure DAI clock dividers. | 2031 | * snd_soc_dai_set_clkdiv - configure DAI clock dividers. |
1956 | * @dai: DAI | 2032 | * @dai: DAI |
1957 | * @clk_id: DAI specific clock divider ID | 2033 | * @div_id: DAI specific clock divider ID |
1958 | * @div: new clock divisor. | 2034 | * @div: new clock divisor. |
1959 | * | 2035 | * |
1960 | * Configures the clock dividers. This is used to derive the best DAI bit and | 2036 | * Configures the clock dividers. This is used to derive the best DAI bit and |
@@ -2060,7 +2136,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_digital_mute); | |||
2060 | /** | 2136 | /** |
2061 | * snd_soc_register_card - Register a card with the ASoC core | 2137 | * snd_soc_register_card - Register a card with the ASoC core |
2062 | * | 2138 | * |
2063 | * @param card Card to register | 2139 | * @card: Card to register |
2064 | * | 2140 | * |
2065 | * Note that currently this is an internal only function: it will be | 2141 | * Note that currently this is an internal only function: it will be |
2066 | * exposed to machine drivers after further backporting of ASoC v2 | 2142 | * exposed to machine drivers after further backporting of ASoC v2 |
@@ -2087,7 +2163,7 @@ static int snd_soc_register_card(struct snd_soc_card *card) | |||
2087 | /** | 2163 | /** |
2088 | * snd_soc_unregister_card - Unregister a card with the ASoC core | 2164 | * snd_soc_unregister_card - Unregister a card with the ASoC core |
2089 | * | 2165 | * |
2090 | * @param card Card to unregister | 2166 | * @card: Card to unregister |
2091 | * | 2167 | * |
2092 | * Note that currently this is an internal only function: it will be | 2168 | * Note that currently this is an internal only function: it will be |
2093 | * exposed to machine drivers after further backporting of ASoC v2 | 2169 | * exposed to machine drivers after further backporting of ASoC v2 |
@@ -2107,7 +2183,7 @@ static int snd_soc_unregister_card(struct snd_soc_card *card) | |||
2107 | /** | 2183 | /** |
2108 | * snd_soc_register_dai - Register a DAI with the ASoC core | 2184 | * snd_soc_register_dai - Register a DAI with the ASoC core |
2109 | * | 2185 | * |
2110 | * @param dai DAI to register | 2186 | * @dai: DAI to register |
2111 | */ | 2187 | */ |
2112 | int snd_soc_register_dai(struct snd_soc_dai *dai) | 2188 | int snd_soc_register_dai(struct snd_soc_dai *dai) |
2113 | { | 2189 | { |
@@ -2134,7 +2210,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_dai); | |||
2134 | /** | 2210 | /** |
2135 | * snd_soc_unregister_dai - Unregister a DAI from the ASoC core | 2211 | * snd_soc_unregister_dai - Unregister a DAI from the ASoC core |
2136 | * | 2212 | * |
2137 | * @param dai DAI to unregister | 2213 | * @dai: DAI to unregister |
2138 | */ | 2214 | */ |
2139 | void snd_soc_unregister_dai(struct snd_soc_dai *dai) | 2215 | void snd_soc_unregister_dai(struct snd_soc_dai *dai) |
2140 | { | 2216 | { |
@@ -2149,8 +2225,8 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dai); | |||
2149 | /** | 2225 | /** |
2150 | * snd_soc_register_dais - Register multiple DAIs with the ASoC core | 2226 | * snd_soc_register_dais - Register multiple DAIs with the ASoC core |
2151 | * | 2227 | * |
2152 | * @param dai Array of DAIs to register | 2228 | * @dai: Array of DAIs to register |
2153 | * @param count Number of DAIs | 2229 | * @count: Number of DAIs |
2154 | */ | 2230 | */ |
2155 | int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count) | 2231 | int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count) |
2156 | { | 2232 | { |
@@ -2175,8 +2251,8 @@ EXPORT_SYMBOL_GPL(snd_soc_register_dais); | |||
2175 | /** | 2251 | /** |
2176 | * snd_soc_unregister_dais - Unregister multiple DAIs from the ASoC core | 2252 | * snd_soc_unregister_dais - Unregister multiple DAIs from the ASoC core |
2177 | * | 2253 | * |
2178 | * @param dai Array of DAIs to unregister | 2254 | * @dai: Array of DAIs to unregister |
2179 | * @param count Number of DAIs | 2255 | * @count: Number of DAIs |
2180 | */ | 2256 | */ |
2181 | void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count) | 2257 | void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count) |
2182 | { | 2258 | { |
@@ -2190,7 +2266,7 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dais); | |||
2190 | /** | 2266 | /** |
2191 | * snd_soc_register_platform - Register a platform with the ASoC core | 2267 | * snd_soc_register_platform - Register a platform with the ASoC core |
2192 | * | 2268 | * |
2193 | * @param platform platform to register | 2269 | * @platform: platform to register |
2194 | */ | 2270 | */ |
2195 | int snd_soc_register_platform(struct snd_soc_platform *platform) | 2271 | int snd_soc_register_platform(struct snd_soc_platform *platform) |
2196 | { | 2272 | { |
@@ -2213,7 +2289,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_platform); | |||
2213 | /** | 2289 | /** |
2214 | * snd_soc_unregister_platform - Unregister a platform from the ASoC core | 2290 | * snd_soc_unregister_platform - Unregister a platform from the ASoC core |
2215 | * | 2291 | * |
2216 | * @param platform platform to unregister | 2292 | * @platform: platform to unregister |
2217 | */ | 2293 | */ |
2218 | void snd_soc_unregister_platform(struct snd_soc_platform *platform) | 2294 | void snd_soc_unregister_platform(struct snd_soc_platform *platform) |
2219 | { | 2295 | { |
@@ -2228,7 +2304,7 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_platform); | |||
2228 | /** | 2304 | /** |
2229 | * snd_soc_register_codec - Register a codec with the ASoC core | 2305 | * snd_soc_register_codec - Register a codec with the ASoC core |
2230 | * | 2306 | * |
2231 | * @param codec codec to register | 2307 | * @codec: codec to register |
2232 | */ | 2308 | */ |
2233 | int snd_soc_register_codec(struct snd_soc_codec *codec) | 2309 | int snd_soc_register_codec(struct snd_soc_codec *codec) |
2234 | { | 2310 | { |
@@ -2255,7 +2331,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_codec); | |||
2255 | /** | 2331 | /** |
2256 | * snd_soc_unregister_codec - Unregister a codec from the ASoC core | 2332 | * snd_soc_unregister_codec - Unregister a codec from the ASoC core |
2257 | * | 2333 | * |
2258 | * @param codec codec to unregister | 2334 | * @codec: codec to unregister |
2259 | */ | 2335 | */ |
2260 | void snd_soc_unregister_codec(struct snd_soc_codec *codec) | 2336 | void snd_soc_unregister_codec(struct snd_soc_codec *codec) |
2261 | { | 2337 | { |