mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-24 21:24:00 +08:00
Merge commit 'topic/omap' into asoc-davinci
This commit is contained in:
commit
ab052d465b
@ -377,6 +377,8 @@ int snd_soc_resume(struct device *dev);
|
||||
int snd_soc_poweroff(struct device *dev);
|
||||
int snd_soc_register_platform(struct device *dev,
|
||||
const struct snd_soc_platform_driver *platform_drv);
|
||||
int devm_snd_soc_register_platform(struct device *dev,
|
||||
const struct snd_soc_platform_driver *platform_drv);
|
||||
void snd_soc_unregister_platform(struct device *dev);
|
||||
int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
|
||||
const struct snd_soc_platform_driver *platform_drv);
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "omap-mcbsp.h"
|
||||
#include "../codecs/cx20442.h"
|
||||
|
||||
|
||||
/* Board specific DAPM widgets */
|
||||
static const struct snd_soc_dapm_widget ams_delta_dapm_widgets[] = {
|
||||
/* Handset */
|
||||
@ -90,17 +89,23 @@ static const unsigned short ams_delta_audio_mode_pins[] = {
|
||||
|
||||
static unsigned short ams_delta_audio_agc;
|
||||
|
||||
/*
|
||||
* Used for passing a codec structure pointer
|
||||
* from the board initialization code to the tty line discipline.
|
||||
*/
|
||||
static struct snd_soc_codec *cx20442_codec;
|
||||
|
||||
static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_dapm_context *dapm = &codec->dapm;
|
||||
struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_dapm_context *dapm = &card->dapm;
|
||||
struct soc_enum *control = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned short pins;
|
||||
int pin, changed = 0;
|
||||
|
||||
/* Refuse any mode changes if we are not able to control the codec. */
|
||||
if (!codec->hw_write)
|
||||
if (!cx20442_codec->hw_write)
|
||||
return -EUNATCH;
|
||||
|
||||
if (ucontrol->value.enumerated.item[0] >= control->items)
|
||||
@ -166,8 +171,8 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
|
||||
static int ams_delta_get_audio_mode(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_dapm_context *dapm = &codec->dapm;
|
||||
struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_dapm_context *dapm = &card->dapm;
|
||||
unsigned short pins, mode;
|
||||
|
||||
pins = ((snd_soc_dapm_get_pin_status(dapm, "Mouthpiece") <<
|
||||
@ -270,12 +275,6 @@ static void cx81801_timeout(unsigned long data)
|
||||
ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Used for passing a codec structure pointer
|
||||
* from the board initialization code to the tty line discipline.
|
||||
*/
|
||||
static struct snd_soc_codec *cx20442_codec;
|
||||
|
||||
/* Line discipline .open() */
|
||||
static int cx81801_open(struct tty_struct *tty)
|
||||
{
|
||||
@ -302,7 +301,7 @@ static int cx81801_open(struct tty_struct *tty)
|
||||
static void cx81801_close(struct tty_struct *tty)
|
||||
{
|
||||
struct snd_soc_codec *codec = tty->disc_data;
|
||||
struct snd_soc_dapm_context *dapm = &codec->dapm;
|
||||
struct snd_soc_dapm_context *dapm = &codec->card->dapm;
|
||||
|
||||
del_timer_sync(&cx81801_timer);
|
||||
|
||||
@ -475,15 +474,14 @@ static void ams_delta_shutdown(struct snd_pcm_substream *substream)
|
||||
|
||||
static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
struct snd_soc_codec *codec = rtd->codec;
|
||||
struct snd_soc_dapm_context *dapm = &codec->dapm;
|
||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||
struct snd_soc_card *card = rtd->card;
|
||||
struct snd_soc_dapm_context *dapm = &card->dapm;
|
||||
int ret;
|
||||
/* Codec is ready, now add/activate board specific controls */
|
||||
|
||||
/* Store a pointer to the codec structure for tty ldisc use */
|
||||
cx20442_codec = codec;
|
||||
cx20442_codec = rtd->codec;
|
||||
|
||||
/* Set up digital mute if not provided by the codec */
|
||||
if (!codec_dai->driver->ops) {
|
||||
@ -520,25 +518,6 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Add board specific DAPM widgets and routes */
|
||||
ret = snd_soc_dapm_new_controls(dapm, ams_delta_dapm_widgets,
|
||||
ARRAY_SIZE(ams_delta_dapm_widgets));
|
||||
if (ret) {
|
||||
dev_warn(card->dev,
|
||||
"Failed to register DAPM controls, "
|
||||
"will continue without any.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = snd_soc_dapm_add_routes(dapm, ams_delta_audio_map,
|
||||
ARRAY_SIZE(ams_delta_audio_map));
|
||||
if (ret) {
|
||||
dev_warn(card->dev,
|
||||
"Failed to set up DAPM routes, "
|
||||
"will continue with codec default map.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Set up initial pin constellation */
|
||||
snd_soc_dapm_disable_pin(dapm, "Mouthpiece");
|
||||
snd_soc_dapm_enable_pin(dapm, "Earpiece");
|
||||
@ -547,14 +526,6 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
|
||||
snd_soc_dapm_disable_pin(dapm, "AGCIN");
|
||||
snd_soc_dapm_disable_pin(dapm, "AGCOUT");
|
||||
|
||||
/* Add virtual switch */
|
||||
ret = snd_soc_add_codec_controls(codec, ams_delta_audio_controls,
|
||||
ARRAY_SIZE(ams_delta_audio_controls));
|
||||
if (ret)
|
||||
dev_warn(card->dev,
|
||||
"Failed to register audio mode control, "
|
||||
"will continue without it.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -576,6 +547,13 @@ static struct snd_soc_card ams_delta_audio_card = {
|
||||
.owner = THIS_MODULE,
|
||||
.dai_link = &ams_delta_dai_link,
|
||||
.num_links = 1,
|
||||
|
||||
.controls = ams_delta_audio_controls,
|
||||
.num_controls = ARRAY_SIZE(ams_delta_audio_controls),
|
||||
.dapm_widgets = ams_delta_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(ams_delta_dapm_widgets),
|
||||
.dapm_routes = ams_delta_audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(ams_delta_audio_map),
|
||||
};
|
||||
|
||||
/* Module init/exit */
|
||||
|
@ -232,6 +232,12 @@ static struct snd_soc_platform_driver omap_soc_platform = {
|
||||
.pcm_free = omap_pcm_free_dma_buffers,
|
||||
};
|
||||
|
||||
int omap_pcm_platform_register(struct device *dev)
|
||||
{
|
||||
return devm_snd_soc_register_platform(dev, &omap_soc_platform);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(omap_pcm_platform_register);
|
||||
|
||||
static int omap_pcm_probe(struct platform_device *pdev)
|
||||
{
|
||||
return snd_soc_register_platform(&pdev->dev,
|
||||
|
30
sound/soc/omap/omap-pcm.h
Normal file
30
sound/soc/omap/omap-pcm.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* omap-pcm.h - OMAP PCM driver
|
||||
*
|
||||
* Copyright (C) 2014 Texas Instruments, Inc.
|
||||
*
|
||||
* Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __OMAP_PCM_H__
|
||||
#define __OMAP_PCM_H__
|
||||
|
||||
#if IS_ENABLED(CONFIG_SND_OMAP_SOC)
|
||||
int omap_pcm_platform_register(struct device *dev);
|
||||
#else
|
||||
static inline int omap_pcm_platform_register(struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_SND_OMAP_SOC */
|
||||
|
||||
#endif /* __OMAP_PCM_H__ */
|
@ -121,7 +121,7 @@ static int omap3pandora_hp_event(struct snd_soc_dapm_widget *w,
|
||||
* |A| <~~clk~~+
|
||||
* |P| <--- TWL4030 <--------- Line In and MICs
|
||||
*/
|
||||
static const struct snd_soc_dapm_widget omap3pandora_out_dapm_widgets[] = {
|
||||
static const struct snd_soc_dapm_widget omap3pandora_dapm_widgets[] = {
|
||||
SND_SOC_DAPM_DAC_E("PCM DAC", "HiFi Playback", SND_SOC_NOPM,
|
||||
0, 0, omap3pandora_dac_event,
|
||||
SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
|
||||
@ -130,22 +130,18 @@ static const struct snd_soc_dapm_widget omap3pandora_out_dapm_widgets[] = {
|
||||
SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
|
||||
SND_SOC_DAPM_HP("Headphone Jack", NULL),
|
||||
SND_SOC_DAPM_LINE("Line Out", NULL),
|
||||
};
|
||||
|
||||
static const struct snd_soc_dapm_widget omap3pandora_in_dapm_widgets[] = {
|
||||
SND_SOC_DAPM_MIC("Mic (internal)", NULL),
|
||||
SND_SOC_DAPM_MIC("Mic (external)", NULL),
|
||||
SND_SOC_DAPM_LINE("Line In", NULL),
|
||||
};
|
||||
|
||||
static const struct snd_soc_dapm_route omap3pandora_out_map[] = {
|
||||
static const struct snd_soc_dapm_route omap3pandora_map[] = {
|
||||
{"PCM DAC", NULL, "APLL Enable"},
|
||||
{"Headphone Amplifier", NULL, "PCM DAC"},
|
||||
{"Line Out", NULL, "PCM DAC"},
|
||||
{"Headphone Jack", NULL, "Headphone Amplifier"},
|
||||
};
|
||||
|
||||
static const struct snd_soc_dapm_route omap3pandora_in_map[] = {
|
||||
{"AUXL", NULL, "Line In"},
|
||||
{"AUXR", NULL, "Line In"},
|
||||
|
||||
@ -160,7 +156,6 @@ static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
struct snd_soc_codec *codec = rtd->codec;
|
||||
struct snd_soc_dapm_context *dapm = &codec->dapm;
|
||||
int ret;
|
||||
|
||||
/* All TWL4030 output pins are floating */
|
||||
snd_soc_dapm_nc_pin(dapm, "EARPIECE");
|
||||
@ -174,20 +169,13 @@ static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd)
|
||||
snd_soc_dapm_nc_pin(dapm, "HFR");
|
||||
snd_soc_dapm_nc_pin(dapm, "VIBRA");
|
||||
|
||||
ret = snd_soc_dapm_new_controls(dapm, omap3pandora_out_dapm_widgets,
|
||||
ARRAY_SIZE(omap3pandora_out_dapm_widgets));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return snd_soc_dapm_add_routes(dapm, omap3pandora_out_map,
|
||||
ARRAY_SIZE(omap3pandora_out_map));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
struct snd_soc_codec *codec = rtd->codec;
|
||||
struct snd_soc_dapm_context *dapm = &codec->dapm;
|
||||
int ret;
|
||||
|
||||
/* Not comnnected */
|
||||
snd_soc_dapm_nc_pin(dapm, "HSMIC");
|
||||
@ -195,13 +183,7 @@ static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
|
||||
snd_soc_dapm_nc_pin(dapm, "DIGIMIC0");
|
||||
snd_soc_dapm_nc_pin(dapm, "DIGIMIC1");
|
||||
|
||||
ret = snd_soc_dapm_new_controls(dapm, omap3pandora_in_dapm_widgets,
|
||||
ARRAY_SIZE(omap3pandora_in_dapm_widgets));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return snd_soc_dapm_add_routes(dapm, omap3pandora_in_map,
|
||||
ARRAY_SIZE(omap3pandora_in_map));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops omap3pandora_ops = {
|
||||
@ -241,6 +223,11 @@ static struct snd_soc_card snd_soc_card_omap3pandora = {
|
||||
.owner = THIS_MODULE,
|
||||
.dai_link = omap3pandora_dai,
|
||||
.num_links = ARRAY_SIZE(omap3pandora_dai),
|
||||
|
||||
.dapm_widgets = omap3pandora_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(omap3pandora_dapm_widgets),
|
||||
.dapm_routes = omap3pandora_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(omap3pandora_map),
|
||||
};
|
||||
|
||||
static struct platform_device *omap3pandora_snd_device;
|
||||
|
@ -237,9 +237,6 @@ static const struct snd_soc_dapm_widget aic34_dapm_widgets[] = {
|
||||
SND_SOC_DAPM_HP("Headphone Jack", rx51_hp_event),
|
||||
SND_SOC_DAPM_MIC("HS Mic", NULL),
|
||||
SND_SOC_DAPM_LINE("FM Transmitter", NULL),
|
||||
};
|
||||
|
||||
static const struct snd_soc_dapm_widget aic34_dapm_widgetsb[] = {
|
||||
SND_SOC_DAPM_SPK("Earphone", NULL),
|
||||
};
|
||||
|
||||
@ -253,9 +250,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
|
||||
|
||||
{"DMic Rate 64", NULL, "Mic Bias"},
|
||||
{"Mic Bias", NULL, "DMic"},
|
||||
};
|
||||
|
||||
static const struct snd_soc_dapm_route audio_mapb[] = {
|
||||
{"b LINE2R", NULL, "MONO_LOUT"},
|
||||
{"Earphone", NULL, "b HPLOUT"},
|
||||
|
||||
@ -281,9 +276,6 @@ static const struct snd_kcontrol_new aic34_rx51_controls[] = {
|
||||
SOC_ENUM_EXT("Jack Function", rx51_enum[2],
|
||||
rx51_get_jack, rx51_set_jack),
|
||||
SOC_DAPM_PIN_SWITCH("FM Transmitter"),
|
||||
};
|
||||
|
||||
static const struct snd_kcontrol_new aic34_rx51_controlsb[] = {
|
||||
SOC_DAPM_PIN_SWITCH("Earphone"),
|
||||
};
|
||||
|
||||
@ -298,19 +290,6 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
|
||||
snd_soc_dapm_nc_pin(dapm, "MIC3R");
|
||||
snd_soc_dapm_nc_pin(dapm, "LINE1R");
|
||||
|
||||
/* Add RX-51 specific controls */
|
||||
err = snd_soc_add_card_controls(rtd->card, aic34_rx51_controls,
|
||||
ARRAY_SIZE(aic34_rx51_controls));
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
/* Add RX-51 specific widgets */
|
||||
snd_soc_dapm_new_controls(dapm, aic34_dapm_widgets,
|
||||
ARRAY_SIZE(aic34_dapm_widgets));
|
||||
|
||||
/* Set up RX-51 specific audio path audio_map */
|
||||
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
|
||||
|
||||
err = tpa6130a2_add_controls(codec);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@ -333,24 +312,6 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int rx51_aic34b_init(struct snd_soc_dapm_context *dapm)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = snd_soc_add_card_controls(dapm->card, aic34_rx51_controlsb,
|
||||
ARRAY_SIZE(aic34_rx51_controlsb));
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
err = snd_soc_dapm_new_controls(dapm, aic34_dapm_widgetsb,
|
||||
ARRAY_SIZE(aic34_dapm_widgetsb));
|
||||
if (err < 0)
|
||||
return 0;
|
||||
|
||||
return snd_soc_dapm_add_routes(dapm, audio_mapb,
|
||||
ARRAY_SIZE(audio_mapb));
|
||||
}
|
||||
|
||||
/* Digital audio interface glue - connects codec <--> CPU */
|
||||
static struct snd_soc_dai_link rx51_dai[] = {
|
||||
{
|
||||
@ -371,7 +332,6 @@ static struct snd_soc_aux_dev rx51_aux_dev[] = {
|
||||
{
|
||||
.name = "TLV320AIC34b",
|
||||
.codec_name = "tlv320aic3x-codec.2-0019",
|
||||
.init = rx51_aic34b_init,
|
||||
},
|
||||
};
|
||||
|
||||
@ -392,6 +352,13 @@ static struct snd_soc_card rx51_sound_card = {
|
||||
.num_aux_devs = ARRAY_SIZE(rx51_aux_dev),
|
||||
.codec_conf = rx51_codec_conf,
|
||||
.num_configs = ARRAY_SIZE(rx51_codec_conf),
|
||||
|
||||
.controls = aic34_rx51_controls,
|
||||
.num_controls = ARRAY_SIZE(aic34_rx51_controls),
|
||||
.dapm_widgets = aic34_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(aic34_dapm_widgets),
|
||||
.dapm_routes = audio_map,
|
||||
.num_dapm_routes = ARRAY_SIZE(audio_map),
|
||||
};
|
||||
|
||||
static struct platform_device *rx51_snd_device;
|
||||
|
@ -52,6 +52,40 @@ int devm_snd_soc_register_component(struct device *dev,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_snd_soc_register_component);
|
||||
|
||||
static void devm_platform_release(struct device *dev, void *res)
|
||||
{
|
||||
snd_soc_unregister_platform(*(struct device **)res);
|
||||
}
|
||||
|
||||
/**
|
||||
* devm_snd_soc_register_platform - resource managed platform registration
|
||||
* @dev: Device used to manage platform
|
||||
* @platform: platform to register
|
||||
*
|
||||
* Register a platform driver with automatic unregistration when the device is
|
||||
* unregistered.
|
||||
*/
|
||||
int devm_snd_soc_register_platform(struct device *dev,
|
||||
const struct snd_soc_platform_driver *platform_drv)
|
||||
{
|
||||
struct device **ptr;
|
||||
int ret;
|
||||
|
||||
ptr = devres_alloc(devm_platform_release, sizeof(*ptr), GFP_KERNEL);
|
||||
if (!ptr)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = snd_soc_register_platform(dev, platform_drv);
|
||||
if (ret == 0) {
|
||||
*ptr = dev;
|
||||
devres_add(dev, ptr);
|
||||
} else {
|
||||
devres_free(ptr);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void devm_card_release(struct device *dev, void *res)
|
||||
{
|
||||
snd_soc_unregister_card(*(struct snd_soc_card **)res);
|
||||
|
Loading…
Reference in New Issue
Block a user