Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fbd60ce7 authored by Mark Brown's avatar Mark Brown
Browse files

Merge remote branch 'broonie-asoc/for-2.6.37' into for-2.6.37

parents 9745e824 014a2755
Loading
Loading
Loading
Loading
+54 −3
Original line number Diff line number Diff line
@@ -789,13 +789,14 @@ static struct snd_soc_dai_driver atmel_ssc_dai[NUM_SSC_DEVICES] = {

static __devinit int asoc_ssc_probe(struct platform_device *pdev)
{
	return snd_soc_register_dais(&pdev->dev, atmel_ssc_dai,
			ARRAY_SIZE(atmel_ssc_dai));
	BUG_ON(pdev->id < 0);
	BUG_ON(pdev->id >= ARRAY_SIZE(atmel_ssc_dai));
	return snd_soc_register_dai(&pdev->dev, &atmel_ssc_dai[pdev->id]);
}

static int __devexit asoc_ssc_remove(struct platform_device *pdev)
{
	snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(atmel_ssc_dai));
	snd_soc_unregister_dai(&pdev->dev);
	return 0;
}

@@ -809,6 +810,56 @@ static struct platform_driver asoc_ssc_driver = {
	.remove = __devexit_p(asoc_ssc_remove),
};

/**
 * atmel_ssc_set_audio - Allocate the specified SSC for audio use.
 */
int atmel_ssc_set_audio(int ssc_id)
{
	struct ssc_device *ssc;
	static struct platform_device *dma_pdev;
	struct platform_device *ssc_pdev;
	int ret;

	if (ssc_id < 0 || ssc_id >= ARRAY_SIZE(atmel_ssc_dai))
		return -EINVAL;

	/* Allocate a dummy device for DMA if we don't have one already */
	if (!dma_pdev) {
		dma_pdev = platform_device_alloc("atmel-pcm-audio", -1);
		if (!dma_pdev)
			return -ENOMEM;

		ret = platform_device_add(dma_pdev);
		if (ret < 0) {
			platform_device_put(dma_pdev);
			dma_pdev = NULL;
			return ret;
		}
	}

	ssc_pdev = platform_device_alloc("atmel-ssc-dai", ssc_id);
	if (!ssc_pdev) {
		ssc_free(ssc);
		return -ENOMEM;
	}

	/* If we can grab the SSC briefly to parent the DAI device off it */
	ssc = ssc_request(ssc_id);
	if (IS_ERR(ssc))
		pr_warn("Unable to parent ASoC SSC DAI on SSC: %ld\n",
			PTR_ERR(ssc));
	else
		ssc_pdev->dev.parent = &(ssc->pdev->dev);
	ssc_free(ssc);

	ret = platform_device_add(ssc_pdev);
	if (ret < 0)
		platform_device_put(ssc_pdev);

	return ret;
}
EXPORT_SYMBOL_GPL(atmel_ssc_set_audio);

static int __init snd_atmel_ssc_init(void)
{
	return platform_driver_register(&asoc_ssc_driver);
+2 −0
Original line number Diff line number Diff line
@@ -117,4 +117,6 @@ struct atmel_ssc_info {
	struct atmel_ssc_state ssc_state;
};

int atmel_ssc_set_audio(int ssc);

#endif /* _AT91_SSC_DAI_H */
+8 −2
Original line number Diff line number Diff line
@@ -183,8 +183,8 @@ static struct snd_soc_dai_link at91sam9g20ek_dai = {
	.cpu_dai_name = "atmel-ssc-dai.0",
	.codec_dai_name = "wm8731-hifi",
	.init = at91sam9g20ek_wm8731_init,
	.platform_name = "atmel_pcm-audio",
	.codec_name = "wm8731-codec.0-001a",
	.platform_name = "atmel-pcm-audio",
	.codec_name = "wm8731-codec.0-001b",
	.ops = &at91sam9g20ek_ops,
};

@@ -205,6 +205,12 @@ static int __init at91sam9g20ek_init(void)
	if (!(machine_is_at91sam9g20ek() || machine_is_at91sam9g20ek_2mmc()))
		return -ENODEV;

	ret = atmel_ssc_set_audio(0);
	if (ret != 0) {
		pr_err("Failed to set SSC 0 for audio: %d\n", ret);
		return ret;
	}

	/*
	 * Codec MCLK is supplied by PCK0 - set it up.
	 */
+1486 −0

File added.

Preview size limit exceeded, changes collapsed.

+97 −0
Original line number Diff line number Diff line
/*
 * 88pm860x-codec.h -- 88PM860x ALSA SoC Audio Driver
 *
 * Copyright 2010 Marvell International Ltd.
 *	Haojian Zhuang <haojian.zhuang@marvell.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.
 */

#ifndef __88PM860X_H
#define __88PM860X_H

/* The offset of these registers are 0xb0 */
#define PM860X_PCM_IFACE_1		0x00
#define PM860X_PCM_IFACE_2		0x01
#define PM860X_PCM_IFACE_3		0x02
#define PM860X_PCM_RATE			0x03
#define PM860X_EC_PATH			0x04
#define PM860X_SIDETONE_L_GAIN		0x05
#define PM860X_SIDETONE_R_GAIN		0x06
#define PM860X_SIDETONE_SHIFT		0x07
#define PM860X_ADC_OFFSET_1		0x08
#define PM860X_ADC_OFFSET_2		0x09
#define PM860X_DMIC_DELAY		0x0a

#define PM860X_I2S_IFACE_1		0x0b
#define PM860X_I2S_IFACE_2		0x0c
#define PM860X_I2S_IFACE_3		0x0d
#define PM860X_I2S_IFACE_4		0x0e
#define PM860X_EQUALIZER_N0_1		0x0f
#define PM860X_EQUALIZER_N0_2		0x10
#define PM860X_EQUALIZER_N1_1		0x11
#define PM860X_EQUALIZER_N1_2		0x12
#define PM860X_EQUALIZER_D1_1		0x13
#define PM860X_EQUALIZER_D1_2		0x14
#define PM860X_LOFI_GAIN_LEFT		0x15
#define PM860X_LOFI_GAIN_RIGHT		0x16
#define PM860X_HIFIL_GAIN_LEFT		0x17
#define PM860X_HIFIL_GAIN_RIGHT		0x18
#define PM860X_HIFIR_GAIN_LEFT		0x19
#define PM860X_HIFIR_GAIN_RIGHT		0x1a
#define PM860X_DAC_OFFSET		0x1b
#define PM860X_OFFSET_LEFT_1		0x1c
#define PM860X_OFFSET_LEFT_2		0x1d
#define PM860X_OFFSET_RIGHT_1		0x1e
#define PM860X_OFFSET_RIGHT_2		0x1f
#define PM860X_ADC_ANA_1		0x20
#define PM860X_ADC_ANA_2		0x21
#define PM860X_ADC_ANA_3		0x22
#define PM860X_ADC_ANA_4		0x23
#define PM860X_ANA_TO_ANA		0x24
#define PM860X_HS1_CTRL			0x25
#define PM860X_HS2_CTRL			0x26
#define PM860X_LO1_CTRL			0x27
#define PM860X_LO2_CTRL			0x28
#define PM860X_EAR_CTRL_1		0x29
#define PM860X_EAR_CTRL_2		0x2a
#define PM860X_AUDIO_SUPPLIES_1		0x2b
#define PM860X_AUDIO_SUPPLIES_2		0x2c
#define PM860X_ADC_EN_1			0x2d
#define PM860X_ADC_EN_2			0x2e
#define PM860X_DAC_EN_1			0x2f
#define PM860X_DAC_EN_2			0x31
#define PM860X_AUDIO_CAL_1		0x32
#define PM860X_AUDIO_CAL_2		0x33
#define PM860X_AUDIO_CAL_3		0x34
#define PM860X_AUDIO_CAL_4		0x35
#define PM860X_AUDIO_CAL_5		0x36
#define PM860X_ANA_INPUT_SEL_1		0x37
#define PM860X_ANA_INPUT_SEL_2		0x38

#define PM860X_PCM_IFACE_4		0x39
#define PM860X_I2S_IFACE_5		0x3a

#define PM860X_SHORTS			0x3b
#define PM860X_PLL_ADJ_1		0x3c
#define PM860X_PLL_ADJ_2		0x3d

/* bits definition */
#define PM860X_CLK_DIR_IN		0
#define PM860X_CLK_DIR_OUT		1

#define PM860X_DET_HEADSET		(1 << 0)
#define PM860X_DET_MIC			(1 << 1)
#define PM860X_DET_HOOK			(1 << 2)
#define PM860X_SHORT_HEADSET		(1 << 3)
#define PM860X_SHORT_LINEOUT		(1 << 4)
#define PM860X_DET_MASK			0x1F

extern int pm860x_hs_jack_detect(struct snd_soc_codec *, struct snd_soc_jack *,
				 int, int, int, int);
extern int pm860x_mic_jack_detect(struct snd_soc_codec *, struct snd_soc_jack *,
				  int);

#endif	/* __88PM860X_H */
Loading