aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/mc13783.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 12:08:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 12:08:25 -0400
commitb77279bc2e81545b20824da701b349272a78e4e7 (patch)
treed8f3a8ddf544cf201f8bdcb587cf360571487e5c /sound/soc/codecs/mc13783.c
parent15b588303155b22edd559672905db8e59a44ef9a (diff)
parent16088cb6c02d0b766b9b8d7edff98da7f1c93205 (diff)
Merge tag 'sound-3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound into next
Pull sound updates from Takashi Iwai: "At this time, majority of changes come from ASoC world while we got a few new drivers in other places for FireWire and USB. There have been lots of ASoC core cleanups / refactoring, but very little visible to external users. ASoC: - Support for specifying aux CODECs in DT - Removal of the deprecated mux and enum macros - More moves towards full componentisation - Removal of some unused I/O code - Lots of cleanups, fixes and enhancements to the davinci, Freescale, Haswell and Realtek drivers - Several drivers exposed directly in Kconfig for use with simple-card - GPIO descriptor support for jacks - More updates and fixes to the Freescale SSI, Intel and rsnd drivers - New drivers for Cirrus CS42L56, Realtek RT5639, RT5642 and RT5651 and ST STA350, Analog Devices ADAU1361, ADAU1381, ADAU1761 and ADAU1781, and Realtek RT5677 HD-audio: - Clean up Dell headset quirks - Noise fixes for Dell and Sony laptops - Thinkpad T440 dock fix - Realtek codec updates (ALC293,ALC233,ALC3235) - Tegra HD-audio HDMI support FireWire-audio: - FireWire audio stack enhancement (AMDTP, MIDI), support for incoming isochronous stream and duplex streams with timestamp synchronization - BeBoB-based devices support - Fireworks-based device support USB-audio: - Behringer BCD2000 USB device support Misc: - Clean up of a few old drivers, atmel, fm801, etc" * tag 'sound-3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (480 commits) ASoC: Fix wrong argument for card remove callbacks ASoC: free jack GPIOs before the sound card is freed ALSA: firewire-lib: Remove a comment about restriction of asynchronous operation ASoC: cache: Fix error code when not using ASoC level cache ALSA: hda/realtek - Fix COEF widget NID for ALC260 replacer fixup ALSA: hda/realtek - Correction of fixup codes for PB V7900 laptop ALSA: firewire-lib: Use IEC 61883-6 compliant labels for Raw Audio data ASoC: add RT5677 CODEC driver ASoC: intel: The Baytrail/MAX98090 driver depends on I2C ASoC: rt5640: Add the function "get_clk_info" to RL6231 shared support ASoC: rt5640: Add the function of the PLL clock calculation to RL6231 shared support ASoC: rt5640: Add RL6231 class device shared support for RT5640, RT5645 and RT5651 ASoC: cache: Fix possible ZERO_SIZE_PTR pointer dereferencing error. ASoC: Add helper functions to cast from DAPM context to CODEC/platform ALSA: bebob: sizeof() vs ARRAY_SIZE() typo ASoC: wm9713: correct mono out PGA sources ALSA: synth: emux: soundfont.c: Cleaning up memory leak ASoC: fsl: Remove dependencies of boards for SND_SOC_EUKREA_TLV320 ASoC: fsl-ssi: Use regmap ASoC: fsl-ssi: reorder and document fsl_ssi_private ...
Diffstat (limited to 'sound/soc/codecs/mc13783.c')
-rw-r--r--sound/soc/codecs/mc13783.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index 2c59b1fb69dc..9965277b595a 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -22,6 +22,7 @@
22 */ 22 */
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/of.h>
25#include <linux/mfd/mc13xxx.h> 26#include <linux/mfd/mc13xxx.h>
26#include <linux/slab.h> 27#include <linux/slab.h>
27#include <sound/core.h> 28#include <sound/core.h>
@@ -409,7 +410,7 @@ static const char * const adcl_enum_text[] = {
409static SOC_ENUM_SINGLE_VIRT_DECL(adcl_enum, adcl_enum_text); 410static SOC_ENUM_SINGLE_VIRT_DECL(adcl_enum, adcl_enum_text);
410 411
411static const struct snd_kcontrol_new left_input_mux = 412static const struct snd_kcontrol_new left_input_mux =
412 SOC_DAPM_ENUM_VIRT("Route", adcl_enum); 413 SOC_DAPM_ENUM("Route", adcl_enum);
413 414
414static const char * const adcr_enum_text[] = { 415static const char * const adcr_enum_text[] = {
415 "MC1R", "MC2", "RXINR", "TXIN", 416 "MC1R", "MC2", "RXINR", "TXIN",
@@ -418,7 +419,7 @@ static const char * const adcr_enum_text[] = {
418static SOC_ENUM_SINGLE_VIRT_DECL(adcr_enum, adcr_enum_text); 419static SOC_ENUM_SINGLE_VIRT_DECL(adcr_enum, adcr_enum_text);
419 420
420static const struct snd_kcontrol_new right_input_mux = 421static const struct snd_kcontrol_new right_input_mux =
421 SOC_DAPM_ENUM_VIRT("Route", adcr_enum); 422 SOC_DAPM_ENUM("Route", adcr_enum);
422 423
423static const struct snd_kcontrol_new samp_ctl = 424static const struct snd_kcontrol_new samp_ctl =
424 SOC_DAPM_SINGLE("Switch", MC13783_AUDIO_RX0, 3, 1, 0); 425 SOC_DAPM_SINGLE("Switch", MC13783_AUDIO_RX0, 3, 1, 0);
@@ -478,9 +479,9 @@ static const struct snd_soc_dapm_widget mc13783_dapm_widgets[] = {
478 SND_SOC_DAPM_SWITCH("MC2 Amp", MC13783_AUDIO_TX, 9, 0, &mc2_amp_ctl), 479 SND_SOC_DAPM_SWITCH("MC2 Amp", MC13783_AUDIO_TX, 9, 0, &mc2_amp_ctl),
479 SND_SOC_DAPM_SWITCH("TXIN Amp", MC13783_AUDIO_TX, 11, 0, &atx_amp_ctl), 480 SND_SOC_DAPM_SWITCH("TXIN Amp", MC13783_AUDIO_TX, 11, 0, &atx_amp_ctl),
480 481
481 SND_SOC_DAPM_VIRT_MUX("PGA Left Input Mux", SND_SOC_NOPM, 0, 0, 482 SND_SOC_DAPM_MUX("PGA Left Input Mux", SND_SOC_NOPM, 0, 0,
482 &left_input_mux), 483 &left_input_mux),
483 SND_SOC_DAPM_VIRT_MUX("PGA Right Input Mux", SND_SOC_NOPM, 0, 0, 484 SND_SOC_DAPM_MUX("PGA Right Input Mux", SND_SOC_NOPM, 0, 0,
484 &right_input_mux), 485 &right_input_mux),
485 486
486 SND_SOC_DAPM_MUX("Speaker Amp Source MUX", SND_SOC_NOPM, 0, 0, 487 SND_SOC_DAPM_MUX("Speaker Amp Source MUX", SND_SOC_NOPM, 0, 0,
@@ -608,14 +609,6 @@ static struct snd_kcontrol_new mc13783_control_list[] = {
608static int mc13783_probe(struct snd_soc_codec *codec) 609static int mc13783_probe(struct snd_soc_codec *codec)
609{ 610{
610 struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); 611 struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec);
611 int ret;
612
613 ret = snd_soc_codec_set_cache_io(codec,
614 dev_get_regmap(codec->dev->parent, NULL));
615 if (ret != 0) {
616 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
617 return ret;
618 }
619 612
620 /* these are the reset values */ 613 /* these are the reset values */
621 mc13xxx_reg_write(priv->mc13xxx, MC13783_AUDIO_RX0, 0x25893); 614 mc13xxx_reg_write(priv->mc13xxx, MC13783_AUDIO_RX0, 0x25893);
@@ -735,9 +728,15 @@ static struct snd_soc_dai_driver mc13783_dai_sync[] = {
735 } 728 }
736}; 729};
737 730
731static struct regmap *mc13783_get_regmap(struct device *dev)
732{
733 return dev_get_regmap(dev->parent, NULL);
734}
735
738static struct snd_soc_codec_driver soc_codec_dev_mc13783 = { 736static struct snd_soc_codec_driver soc_codec_dev_mc13783 = {
739 .probe = mc13783_probe, 737 .probe = mc13783_probe,
740 .remove = mc13783_remove, 738 .remove = mc13783_remove,
739 .get_regmap = mc13783_get_regmap,
741 .controls = mc13783_control_list, 740 .controls = mc13783_control_list,
742 .num_controls = ARRAY_SIZE(mc13783_control_list), 741 .num_controls = ARRAY_SIZE(mc13783_control_list),
743 .dapm_widgets = mc13783_dapm_widgets, 742 .dapm_widgets = mc13783_dapm_widgets,
@@ -750,6 +749,7 @@ static int __init mc13783_codec_probe(struct platform_device *pdev)
750{ 749{
751 struct mc13783_priv *priv; 750 struct mc13783_priv *priv;
752 struct mc13xxx_codec_platform_data *pdata = pdev->dev.platform_data; 751 struct mc13xxx_codec_platform_data *pdata = pdev->dev.platform_data;
752 struct device_node *np;
753 int ret; 753 int ret;
754 754
755 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 755 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
@@ -760,7 +760,17 @@ static int __init mc13783_codec_probe(struct platform_device *pdev)
760 priv->adc_ssi_port = pdata->adc_ssi_port; 760 priv->adc_ssi_port = pdata->adc_ssi_port;
761 priv->dac_ssi_port = pdata->dac_ssi_port; 761 priv->dac_ssi_port = pdata->dac_ssi_port;
762 } else { 762 } else {
763 return -ENOSYS; 763 np = of_get_child_by_name(pdev->dev.parent->of_node, "codec");
764 if (!np)
765 return -ENOSYS;
766
767 ret = of_property_read_u32(np, "adc-port", &priv->adc_ssi_port);
768 if (ret)
769 return ret;
770
771 ret = of_property_read_u32(np, "dac-port", &priv->dac_ssi_port);
772 if (ret)
773 return ret;
764 } 774 }
765 775
766 dev_set_drvdata(&pdev->dev, priv); 776 dev_set_drvdata(&pdev->dev, priv);