Skip to content

Commit

Permalink
Merge branch 'topic/asoc' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/tiwai/sound-2.6 into for-2.6.36
  • Loading branch information
Mark Brown committed May 20, 2010
2 parents 1082e27 + ad8332c commit 669be07
Show file tree
Hide file tree
Showing 10 changed files with 347 additions and 65 deletions.
12 changes: 4 additions & 8 deletions arch/arm/mach-omap2/mcbsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,32 +186,28 @@ static struct omap_mcbsp_platform_data omap44xx_mcbsp_pdata[] = {
.phys_base = OMAP44XX_MCBSP1_BASE,
.dma_rx_sync = OMAP44XX_DMA_MCBSP1_RX,
.dma_tx_sync = OMAP44XX_DMA_MCBSP1_TX,
.rx_irq = INT_24XX_MCBSP1_IRQ_RX,
.tx_irq = INT_24XX_MCBSP1_IRQ_TX,
.tx_irq = OMAP44XX_IRQ_MCBSP1,
.ops = &omap2_mcbsp_ops,
},
{
.phys_base = OMAP44XX_MCBSP2_BASE,
.dma_rx_sync = OMAP44XX_DMA_MCBSP2_RX,
.dma_tx_sync = OMAP44XX_DMA_MCBSP2_TX,
.rx_irq = INT_24XX_MCBSP2_IRQ_RX,
.tx_irq = INT_24XX_MCBSP2_IRQ_TX,
.tx_irq = OMAP44XX_IRQ_MCBSP2,
.ops = &omap2_mcbsp_ops,
},
{
.phys_base = OMAP44XX_MCBSP3_BASE,
.dma_rx_sync = OMAP44XX_DMA_MCBSP3_RX,
.dma_tx_sync = OMAP44XX_DMA_MCBSP3_TX,
.rx_irq = INT_24XX_MCBSP3_IRQ_RX,
.tx_irq = INT_24XX_MCBSP3_IRQ_TX,
.tx_irq = OMAP44XX_IRQ_MCBSP3,
.ops = &omap2_mcbsp_ops,
},
{
.phys_base = OMAP44XX_MCBSP4_BASE,
.dma_rx_sync = OMAP44XX_DMA_MCBSP4_RX,
.dma_tx_sync = OMAP44XX_DMA_MCBSP4_TX,
.rx_irq = INT_24XX_MCBSP4_IRQ_RX,
.tx_irq = INT_24XX_MCBSP4_IRQ_TX,
.tx_irq = OMAP44XX_IRQ_MCBSP4,
.ops = &omap2_mcbsp_ops,
},
};
Expand Down
34 changes: 19 additions & 15 deletions arch/arm/plat-omap/mcbsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
{
struct omap_mcbsp *mcbsp;

if (!cpu_is_omap34xx())
if (!cpu_is_omap34xx() && !cpu_is_omap44xx())
return;

if (!omap_mcbsp_check_valid_id(id)) {
Expand All @@ -510,7 +510,7 @@ void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
{
struct omap_mcbsp *mcbsp;

if (!cpu_is_omap34xx())
if (!cpu_is_omap34xx() && !cpu_is_omap44xx())
return;

if (!omap_mcbsp_check_valid_id(id)) {
Expand Down Expand Up @@ -641,7 +641,7 @@ static inline void omap34xx_mcbsp_request(struct omap_mcbsp *mcbsp)
* Enable wakup behavior, smart idle and all wakeups
* REVISIT: some wakeups may be unnecessary
*/
if (cpu_is_omap34xx()) {
if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
u16 syscon;

syscon = MCBSP_READ(mcbsp, SYSCON);
Expand All @@ -664,7 +664,7 @@ static inline void omap34xx_mcbsp_free(struct omap_mcbsp *mcbsp)
/*
* Disable wakup behavior, smart idle and all wakeups
*/
if (cpu_is_omap34xx()) {
if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
u16 syscon;

syscon = MCBSP_READ(mcbsp, SYSCON);
Expand Down Expand Up @@ -778,14 +778,17 @@ int omap_mcbsp_request(unsigned int id)
goto err_clk_disable;
}

init_completion(&mcbsp->rx_irq_completion);
err = request_irq(mcbsp->rx_irq, omap_mcbsp_rx_irq_handler,
if (mcbsp->rx_irq) {
init_completion(&mcbsp->rx_irq_completion);
err = request_irq(mcbsp->rx_irq,
omap_mcbsp_rx_irq_handler,
0, "McBSP", (void *)mcbsp);
if (err != 0) {
dev_err(mcbsp->dev, "Unable to request RX IRQ %d "
"for McBSP%d\n", mcbsp->rx_irq,
mcbsp->id);
goto err_free_irq;
if (err != 0) {
dev_err(mcbsp->dev, "Unable to request RX IRQ %d "
"for McBSP%d\n", mcbsp->rx_irq,
mcbsp->id);
goto err_free_irq;
}
}
}

Expand Down Expand Up @@ -835,7 +838,8 @@ void omap_mcbsp_free(unsigned int id)

if (mcbsp->io_type == OMAP_MCBSP_IRQ_IO) {
/* Free IRQs */
free_irq(mcbsp->rx_irq, (void *)mcbsp);
if (mcbsp->rx_irq)
free_irq(mcbsp->rx_irq, (void *)mcbsp);
free_irq(mcbsp->tx_irq, (void *)mcbsp);
}

Expand Down Expand Up @@ -909,7 +913,7 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7));
}

if (cpu_is_omap2430() || cpu_is_omap34xx()) {
if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
/* Release the transmitter and receiver */
w = MCBSP_READ_CACHE(mcbsp, XCCR);
w &= ~(tx ? XDISABLE : 0);
Expand Down Expand Up @@ -939,7 +943,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)

/* Reset transmitter */
tx &= 1;
if (cpu_is_omap2430() || cpu_is_omap34xx()) {
if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
w = MCBSP_READ_CACHE(mcbsp, XCCR);
w |= (tx ? XDISABLE : 0);
MCBSP_WRITE(mcbsp, XCCR, w);
Expand All @@ -949,7 +953,7 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)

/* Reset receiver */
rx &= 1;
if (cpu_is_omap2430() || cpu_is_omap34xx()) {
if (cpu_is_omap2430() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
w = MCBSP_READ_CACHE(mcbsp, RCCR);
w |= (rx ? RDISABLE : 0);
MCBSP_WRITE(mcbsp, RCCR, w);
Expand Down
5 changes: 4 additions & 1 deletion sound/soc/codecs/tlv320dac33.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ static int dac33_hard_power(struct snd_soc_codec *codec, int power)

/* Safety check */
if (unlikely(power == dac33->chip_power)) {
dev_warn(codec->dev, "Trying to set the same power state: %s\n",
dev_dbg(codec->dev, "Trying to set the same power state: %s\n",
power ? "ON" : "OFF");
goto exit;
}
Expand Down Expand Up @@ -589,6 +589,9 @@ static int dac33_set_bias_level(struct snd_soc_codec *codec,
}
break;
case SND_SOC_BIAS_OFF:
/* Do not power off, when the codec is already off */
if (codec->bias_level == SND_SOC_BIAS_OFF)
return 0;
ret = dac33_hard_power(codec, 0);
if (ret != 0)
return ret;
Expand Down
56 changes: 20 additions & 36 deletions sound/soc/codecs/tpa6130a2.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,11 @@

static struct i2c_client *tpa6130a2_client;

#define TPA6130A2_NUM_SUPPLIES 2
static const char *tpa6130a2_supply_names[TPA6130A2_NUM_SUPPLIES] = {
"CPVSS",
"Vdd",
};

static const char *tpa6140a2_supply_names[TPA6130A2_NUM_SUPPLIES] = {
"HPVdd",
"AVdd",
};

/* This struct is used to save the context */
struct tpa6130a2_data {
struct mutex mutex;
unsigned char regs[TPA6130A2_CACHEREGNUM];
struct regulator_bulk_data supplies[TPA6130A2_NUM_SUPPLIES];
struct regulator *supply;
int power_gpio;
unsigned char power_state;
enum tpa_model id;
Expand Down Expand Up @@ -135,11 +124,10 @@ static int tpa6130a2_power(int power)
if (data->power_gpio >= 0)
gpio_set_value(data->power_gpio, 1);

ret = regulator_bulk_enable(ARRAY_SIZE(data->supplies),
data->supplies);
ret = regulator_enable(data->supply);
if (ret != 0) {
dev_err(&tpa6130a2_client->dev,
"Failed to enable supplies: %d\n", ret);
"Failed to enable supply: %d\n", ret);
goto exit;
}

Expand All @@ -160,11 +148,10 @@ static int tpa6130a2_power(int power)
if (data->power_gpio >= 0)
gpio_set_value(data->power_gpio, 0);

ret = regulator_bulk_disable(ARRAY_SIZE(data->supplies),
data->supplies);
ret = regulator_disable(data->supply);
if (ret != 0) {
dev_err(&tpa6130a2_client->dev,
"Failed to disable supplies: %d\n", ret);
"Failed to disable supply: %d\n", ret);
goto exit;
}

Expand Down Expand Up @@ -371,8 +358,8 @@ static const struct snd_soc_dapm_widget tpa6130a2_dapm_widgets[] = {
0, 0, tpa6130a2_supply_event,
SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD),
/* Outputs */
SND_SOC_DAPM_HP("TPA6130A2 Headphone Left", NULL),
SND_SOC_DAPM_HP("TPA6130A2 Headphone Right", NULL),
SND_SOC_DAPM_OUTPUT("TPA6130A2 Headphone Left"),
SND_SOC_DAPM_OUTPUT("TPA6130A2 Headphone Right"),
};

static const struct snd_soc_dapm_route audio_map[] = {
Expand Down Expand Up @@ -411,7 +398,8 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
struct device *dev;
struct tpa6130a2_data *data;
struct tpa6130a2_platform_data *pdata;
int i, ret;
const char *regulator;
int ret;

dev = &client->dev;

Expand Down Expand Up @@ -453,25 +441,21 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
}

switch (data->id) {
default:
dev_warn(dev, "Unknown TPA model (%d). Assuming 6130A2\n",
pdata->id);
case TPA6130A2:
for (i = 0; i < ARRAY_SIZE(data->supplies); i++)
data->supplies[i].supply = tpa6130a2_supply_names[i];
regulator = "Vdd";
break;
case TPA6140A2:
for (i = 0; i < ARRAY_SIZE(data->supplies); i++)
data->supplies[i].supply = tpa6140a2_supply_names[i];;
regulator = "AVdd";
break;
default:
dev_warn(dev, "Unknown TPA model (%d). Assuming 6130A2\n",
pdata->id);
for (i = 0; i < ARRAY_SIZE(data->supplies); i++)
data->supplies[i].supply = tpa6130a2_supply_names[i];
}

ret = regulator_bulk_get(dev, ARRAY_SIZE(data->supplies),
data->supplies);
if (ret != 0) {
dev_err(dev, "Failed to request supplies: %d\n", ret);
data->supply = regulator_get(dev, regulator);
if (IS_ERR(data->supply)) {
ret = PTR_ERR(data->supply);
dev_err(dev, "Failed to request supply: %d\n", ret);
goto err_regulator;
}

Expand All @@ -494,7 +478,7 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
return 0;

err_power:
regulator_bulk_free(ARRAY_SIZE(data->supplies), data->supplies);
regulator_put(data->supply);
err_regulator:
if (data->power_gpio >= 0)
gpio_free(data->power_gpio);
Expand All @@ -515,7 +499,7 @@ static int __devexit tpa6130a2_remove(struct i2c_client *client)
if (data->power_gpio >= 0)
gpio_free(data->power_gpio);

regulator_bulk_free(ARRAY_SIZE(data->supplies), data->supplies);
regulator_put(data->supply);

kfree(data);
tpa6130a2_client = NULL;
Expand Down
12 changes: 12 additions & 0 deletions sound/soc/codecs/twl4030.c
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,16 @@ static const struct soc_enum twl4030_vibradir_enum =
ARRAY_SIZE(twl4030_vibradir_texts),
twl4030_vibradir_texts);

/* Digimic Left and right swapping */
static const char *twl4030_digimicswap_texts[] = {
"Not swapped", "Swapped",
};

static const struct soc_enum twl4030_digimicswap_enum =
SOC_ENUM_SINGLE(TWL4030_REG_MISC_SET_1, 0,
ARRAY_SIZE(twl4030_digimicswap_texts),
twl4030_digimicswap_texts);

static const struct snd_kcontrol_new twl4030_snd_controls[] = {
/* Codec operation mode control */
SOC_ENUM_EXT("Codec Operation Mode", twl4030_op_modes_enum,
Expand Down Expand Up @@ -1178,6 +1188,8 @@ static const struct snd_kcontrol_new twl4030_snd_controls[] = {

SOC_ENUM("Vibra H-bridge mode", twl4030_vibradirmode_enum),
SOC_ENUM("Vibra H-bridge direction", twl4030_vibradir_enum),

SOC_ENUM("Digimic LR Swap", twl4030_digimicswap_enum),
};

static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
Expand Down
21 changes: 20 additions & 1 deletion sound/soc/codecs/twl6040.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,12 @@ static DECLARE_TLV_DB_SCALE(hs_tlv, -3000, 200, 0);
*/
static DECLARE_TLV_DB_SCALE(hf_tlv, -5200, 200, 0);

/*
* EPGAIN volume control:
* from -24 to 6 dB in 2 dB steps
*/
static DECLARE_TLV_DB_SCALE(ep_tlv, -2400, 200, 0);

/* Left analog microphone selection */
static const char *twl6040_amicl_texts[] =
{"Headset Mic", "Main Mic", "Aux/FM Left", "Off"};
Expand Down Expand Up @@ -479,6 +485,9 @@ static const struct snd_kcontrol_new hfl_driver_switch_controls =
static const struct snd_kcontrol_new hfr_driver_switch_controls =
SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFRCTL, 4, 1, 0);

static const struct snd_kcontrol_new ep_driver_switch_controls =
SOC_DAPM_SINGLE("Switch", TWL6040_REG_EARCTL, 0, 1, 0);

static const struct snd_kcontrol_new twl6040_snd_controls[] = {
/* Capture gains */
SOC_DOUBLE_TLV("Capture Preamplifier Volume",
Expand All @@ -491,7 +500,8 @@ static const struct snd_kcontrol_new twl6040_snd_controls[] = {
TWL6040_REG_HSGAIN, 0, 4, 0xF, 1, hs_tlv),
SOC_DOUBLE_R_TLV("Handsfree Playback Volume",
TWL6040_REG_HFLGAIN, TWL6040_REG_HFRGAIN, 0, 0x1D, 1, hf_tlv),

SOC_SINGLE_TLV("Earphone Playback Volume",
TWL6040_REG_EARCTL, 1, 0xF, 1, ep_tlv),
};

static const struct snd_soc_dapm_widget twl6040_dapm_widgets[] = {
Expand All @@ -507,6 +517,7 @@ static const struct snd_soc_dapm_widget twl6040_dapm_widgets[] = {
SND_SOC_DAPM_OUTPUT("HSOR"),
SND_SOC_DAPM_OUTPUT("HFL"),
SND_SOC_DAPM_OUTPUT("HFR"),
SND_SOC_DAPM_OUTPUT("EP"),

/* Analog input muxes for the capture amplifiers */
SND_SOC_DAPM_MUX("Analog Left Capture Route",
Expand Down Expand Up @@ -572,6 +583,10 @@ static const struct snd_soc_dapm_widget twl6040_dapm_widgets[] = {
SND_SOC_NOPM, 0, 0, &hfr_driver_switch_controls,
twl6040_power_mode_event,
SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_SWITCH_E("Earphone Driver",
SND_SOC_NOPM, 0, 0, &ep_driver_switch_controls,
twl6040_power_mode_event,
SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),

/* Analog playback PGAs */
SND_SOC_DAPM_PGA("HFDAC Left PGA",
Expand Down Expand Up @@ -607,6 +622,10 @@ static const struct snd_soc_dapm_route intercon[] = {
{"HSOL", NULL, "Headset Left Driver"},
{"HSOR", NULL, "Headset Right Driver"},

/* Earphone playback path */
{"Earphone Driver", "Switch", "HSDAC Left"},
{"EP", NULL, "Earphone Driver"},

/* Handsfree playback path */
{"HFDAC Left Playback", "Switch", "HFDAC Left"},
{"HFDAC Right Playback", "Switch", "HFDAC Right"},
Expand Down
9 changes: 9 additions & 0 deletions sound/soc/omap/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ config SND_OMAP_SOC_SDP3430
Say Y if you want to add support for SoC audio on Texas Instruments
SDP3430.

config SND_OMAP_SOC_SDP4430
tristate "SoC Audio support for Texas Instruments SDP4430"
depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP_4430SDP
select SND_OMAP_SOC_MCPDM
select SND_SOC_TWL6040
help
Say Y if you want to add support for SoC audio on Texas Instruments
SDP4430.

config SND_OMAP_SOC_OMAP3_PANDORA
tristate "SoC Audio support for OMAP3 Pandora"
depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3_PANDORA
Expand Down
Loading

0 comments on commit 669be07

Please sign in to comment.