diff options
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/fsl/fsl_hdmi.c | 102 | ||||
-rw-r--r-- | sound/soc/fsl/imx-wm8962.c | 15 |
2 files changed, 115 insertions, 2 deletions
diff --git a/sound/soc/fsl/fsl_hdmi.c b/sound/soc/fsl/fsl_hdmi.c index fb9e8526b81c..cfa8677e88e7 100644 --- a/sound/soc/fsl/fsl_hdmi.c +++ b/sound/soc/fsl/fsl_hdmi.c @@ -1,7 +1,7 @@ /* * ALSA SoC HDMI Audio Layer for Freescale i.MX * - * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. + * Copyright (C) 2011-2014 Freescale Semiconductor, Inc. * * Some code from patch_hdmi.c * Copyright (c) 2008-2010 Intel Corporation. All rights reserved. @@ -454,6 +454,82 @@ static int fsl_hdmi_iec_put(struct snd_kcontrol *kcontrol, return 0; } +static int fsl_hdmi_channels_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + hdmi_get_edid_cfg(&edid_cfg); + fsl_hdmi_get_playback_channels(); + + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->count = playback_constraint_channels.count; + + return 0; +} + + +static int fsl_hdmi_channels_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *uvalue) +{ + int i; + hdmi_get_edid_cfg(&edid_cfg); + fsl_hdmi_get_playback_channels(); + + for (i = 0 ; i < playback_constraint_channels.count ; i++) + uvalue->value.integer.value[i] = playback_channels[i]; + + return 0; +} + +static int fsl_hdmi_rates_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + hdmi_get_edid_cfg(&edid_cfg); + fsl_hdmi_get_playback_rates(); + + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->count = playback_constraint_rates.count; + + return 0; +} + +static int fsl_hdmi_rates_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *uvalue) +{ + int i; + hdmi_get_edid_cfg(&edid_cfg); + fsl_hdmi_get_playback_rates(); + + for (i = 0 ; i < playback_constraint_rates.count ; i++) + uvalue->value.integer.value[i] = playback_rates[i]; + + return 0; +} + +static int fsl_hdmi_formats_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) +{ + hdmi_get_edid_cfg(&edid_cfg); + fsl_hdmi_get_playback_sample_size(); + + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + uinfo->count = playback_constraint_bits.count; + + return 0; +} + +static int fsl_hdmi_formats_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *uvalue) +{ + int i; + hdmi_get_edid_cfg(&edid_cfg); + fsl_hdmi_get_playback_sample_size(); + + for (i = 0 ; i < playback_constraint_bits.count ; i++) + uvalue->value.integer.value[i] = playback_sample_size[i]; + + return 0; +} + static struct snd_kcontrol_new fsl_hdmi_ctrls[] = { /* Status cchanel controller */ { @@ -466,6 +542,30 @@ static struct snd_kcontrol_new fsl_hdmi_ctrls[] = { .get = fsl_hdmi_iec_get, .put = fsl_hdmi_iec_put, }, + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "HDMI Support Channels", + .access = SNDRV_CTL_ELEM_ACCESS_READ | + SNDRV_CTL_ELEM_ACCESS_VOLATILE, + .info = fsl_hdmi_channels_info, + .get = fsl_hdmi_channels_get, + }, + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "HDMI Support Rates", + .access = SNDRV_CTL_ELEM_ACCESS_READ | + SNDRV_CTL_ELEM_ACCESS_VOLATILE, + .info = fsl_hdmi_rates_info, + .get = fsl_hdmi_rates_get, + }, + { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "HDMI Support Formats", + .access = SNDRV_CTL_ELEM_ACCESS_READ | + SNDRV_CTL_ELEM_ACCESS_VOLATILE, + .info = fsl_hdmi_formats_info, + .get = fsl_hdmi_formats_get, + }, }; static int fsl_hdmi_soc_dai_probe(struct snd_soc_dai *dai) diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c index 66cb2df64032..49689a841c11 100644 --- a/sound/soc/fsl/imx-wm8962.c +++ b/sound/soc/fsl/imx-wm8962.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Freescale Semiconductor, Inc. + * Copyright (C) 2013-2014 Freescale Semiconductor, Inc. * * Based on imx-sgtl5000.c * Copyright (C) 2012 Freescale Semiconductor, Inc. @@ -20,6 +20,7 @@ #include <linux/slab.h> #include <linux/gpio.h> #include <linux/clk.h> +#include <linux/switch.h> #include <sound/soc.h> #include <sound/jack.h> #include <sound/control.h> @@ -53,6 +54,7 @@ struct imx_priv { struct snd_pcm_substream *second_stream; struct snd_kcontrol *headphone_kctl; struct snd_card *snd_card; + struct switch_dev sdev; }; static struct imx_priv card_priv; @@ -104,11 +106,13 @@ static int hpjack_status_check(void) if (hp_status != priv->hp_active_low) { snprintf(buf, 32, "STATE=%d", 2); + switch_set_state(&priv->sdev, 2); snd_soc_dapm_disable_pin(&priv->codec->dapm, "Ext Spk"); ret = imx_hp_jack_gpio.report; snd_kctl_jack_report(priv->snd_card, priv->headphone_kctl, 1); } else { snprintf(buf, 32, "STATE=%d", 0); + switch_set_state(&priv->sdev, 0); snd_soc_dapm_enable_pin(&priv->codec->dapm, "Ext Spk"); ret = 0; snd_kctl_jack_report(priv->snd_card, priv->headphone_kctl, 0); @@ -517,6 +521,13 @@ audmux_bypass: platform_set_drvdata(pdev, &data->card); snd_soc_card_set_drvdata(&data->card, data); + priv->sdev.name = "h2w"; + ret = switch_dev_register(&priv->sdev); + if (ret < 0) { + ret = -EINVAL; + goto fail; + } + ret = snd_soc_register_card(&data->card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); @@ -565,11 +576,13 @@ fail: static int imx_wm8962_remove(struct platform_device *pdev) { struct snd_soc_card *card = platform_get_drvdata(pdev); + struct imx_priv *priv = &card_priv; driver_remove_file(pdev->dev.driver, &driver_attr_microphone); driver_remove_file(pdev->dev.driver, &driver_attr_headphone); snd_soc_unregister_card(card); + switch_dev_unregister(&priv->sdev); return 0; } |