You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (250 commits) ALSA: hda: Storage class should be before const qualifier ASoC: tpa6130a2: Remove CPVSS and HPVdd supplies ASoC: tpa6130a2: Define output pins with SND_SOC_DAPM_OUTPUT ASoC: sdp4430 - add sdp4430 pcm ops to DAI. ASoC: TWL6040: Enable earphone path in codec ASoC: SDP4430: Add support for Earphone speaker ASoC: SDP4430: Add sdp4430 machine driver ASoC: tlv320dac33: Avoid powering off while in BIAS_OFF ASoC: tlv320dac33: Use dev_dbg in dac33_hard_power function ALSA: sound/pci/asihpi: Use kzalloc ALSA: hdmi - dont fail on extra nodes ALSA: intelhdmi - add id for the CougarPoint chipset ALSA: intelhdmi - user friendly codec name ALSA: intelhdmi - add dependency on SND_DYNAMIC_MINORS ALSA: asihpi: incorrect range check ALSA: asihpi: testing the wrong variable ALSA: es1688: add pedantic range checks ARM: McBSP: Add support for omap4 in McBSP driver ARM: McBSP: Fix request for irq in OMAP4 OMAP: McBSP: Add 32-bit mode support ...
This commit is contained in:
@@ -5518,34 +5518,41 @@ struct _snd_pcm_runtime {
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
||||
For the raw data, <structfield>size</structfield> field must be
|
||||
set properly. This specifies the maximum size of the proc file access.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The callback is much more complicated than the text-file
|
||||
version. You need to use a low-level I/O functions such as
|
||||
The read/write callbacks of raw mode are more direct than the text mode.
|
||||
You need to use a low-level I/O functions such as
|
||||
<function>copy_from/to_user()</function> to transfer the
|
||||
data.
|
||||
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
static long my_file_io_read(struct snd_info_entry *entry,
|
||||
static ssize_t my_file_io_read(struct snd_info_entry *entry,
|
||||
void *file_private_data,
|
||||
struct file *file,
|
||||
char *buf,
|
||||
unsigned long count,
|
||||
unsigned long pos)
|
||||
size_t count,
|
||||
loff_t pos)
|
||||
{
|
||||
long size = count;
|
||||
if (pos + size > local_max_size)
|
||||
size = local_max_size - pos;
|
||||
if (copy_to_user(buf, local_data + pos, size))
|
||||
if (copy_to_user(buf, local_data + pos, count))
|
||||
return -EFAULT;
|
||||
return size;
|
||||
return count;
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
||||
If the size of the info entry has been set up properly,
|
||||
<structfield>count</structfield> and <structfield>pos</structfield> are
|
||||
guaranteed to fit within 0 and the given size.
|
||||
You don't have to check the range in the callbacks unless any
|
||||
other condition is required.
|
||||
|
||||
</para>
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -227,6 +227,16 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
|
||||
|
||||
The power-management is supported.
|
||||
|
||||
Module snd-asihpi
|
||||
-----------------
|
||||
|
||||
Module for AudioScience ASI soundcards
|
||||
|
||||
enable_hpi_hwdep - enable HPI hwdep for AudioScience soundcard
|
||||
|
||||
This module supports multiple cards.
|
||||
The driver requires the firmware loader support on kernel.
|
||||
|
||||
Module snd-atiixp
|
||||
-----------------
|
||||
|
||||
@@ -622,28 +632,23 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
|
||||
|
||||
The power-management is supported.
|
||||
|
||||
Module snd-es968
|
||||
----------------
|
||||
|
||||
Module for sound cards based on ESS ES968 chip (PnP only).
|
||||
|
||||
This module supports multiple cards, PnP and autoprobe.
|
||||
|
||||
The power-management is supported.
|
||||
|
||||
Module snd-es1688
|
||||
-----------------
|
||||
|
||||
Module for ESS AudioDrive ES-1688 and ES-688 sound cards.
|
||||
|
||||
port - port # for ES-1688 chip (0x220,0x240,0x260)
|
||||
fm_port - port # for OPL3 (option; share the same port as default)
|
||||
isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
|
||||
mpu_port - port # for MPU-401 port (0x300,0x310,0x320,0x330), -1 = disable (default)
|
||||
irq - IRQ # for ES-1688 chip (5,7,9,10)
|
||||
mpu_irq - IRQ # for MPU-401 port (5,7,9,10)
|
||||
fm_port - port # for OPL3 (option; share the same port as default)
|
||||
|
||||
with isapnp=0, the following additional options are available:
|
||||
port - port # for ES-1688 chip (0x220,0x240,0x260)
|
||||
irq - IRQ # for ES-1688 chip (5,7,9,10)
|
||||
dma8 - DMA # for ES-1688 chip (0,1,3)
|
||||
|
||||
This module supports multiple cards and autoprobe (without MPU-401 port).
|
||||
This module supports multiple cards and autoprobe (without MPU-401 port)
|
||||
and PnP with the ES968 chip.
|
||||
|
||||
Module snd-es18xx
|
||||
-----------------
|
||||
|
||||
@@ -204,7 +204,6 @@ generic parser regardless of the codec. Usually the codec-specific
|
||||
parser is much better than the generic parser (as now). Thus this
|
||||
option is more about the debugging purpose.
|
||||
|
||||
|
||||
Speaker and Headphone Output
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
One of the most frequent (and obvious) bugs with HD-audio is the
|
||||
@@ -600,6 +599,9 @@ probing, the proc file is available, so you can get the raw codec
|
||||
information before modified by the driver. Of course, the driver
|
||||
isn't usable with `probe_only=1`. But you can continue the
|
||||
configuration via hwdep sysfs file if hda-reconfig option is enabled.
|
||||
Using `probe_only` mask 2 skips the reset of HDA codecs (use
|
||||
`probe_only=3` as module option). The hwdep interface can be used
|
||||
to determine the BIOS codec initialization.
|
||||
|
||||
|
||||
hda-verb
|
||||
|
||||
@@ -600,7 +600,11 @@ static __init void dm365_evm_init(void)
|
||||
/* maybe setup mmc1/etc ... _after_ mmc0 */
|
||||
evm_init_cpld();
|
||||
|
||||
#ifdef CONFIG_SND_DM365_AIC3X_CODEC
|
||||
dm365_init_asp(&dm365_evm_snd_data);
|
||||
#elif defined(CONFIG_SND_DM365_VOICE_CODEC)
|
||||
dm365_init_vc(&dm365_evm_snd_data);
|
||||
#endif
|
||||
dm365_init_rtc();
|
||||
dm365_init_ks(&dm365evm_ks_data);
|
||||
|
||||
|
||||
@@ -187,32 +187,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,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <mach/regs-mem.h>
|
||||
#include <mach/regs-lcd.h>
|
||||
#include <mach/regs-sdi.h>
|
||||
#include <plat/regs-s3c2412-iis.h>
|
||||
#include <plat/regs-iis.h>
|
||||
#include <plat/regs-spi.h>
|
||||
|
||||
@@ -119,13 +118,11 @@ static struct s3c24xx_dma_map __initdata s3c2412_dma_mappings[] = {
|
||||
.name = "i2s-sdi",
|
||||
.channels = MAP(S3C2412_DMAREQSEL_I2SRX),
|
||||
.channels_rx = MAP(S3C2412_DMAREQSEL_I2SRX),
|
||||
.hw_addr.from = S3C2410_PA_IIS + S3C2412_IISRXD,
|
||||
},
|
||||
[DMACH_I2S_OUT] = {
|
||||
.name = "i2s-sdo",
|
||||
.channels = MAP(S3C2412_DMAREQSEL_I2STX),
|
||||
.channels_rx = MAP(S3C2412_DMAREQSEL_I2STX),
|
||||
.hw_addr.to = S3C2410_PA_IIS + S3C2412_IISTXD,
|
||||
},
|
||||
[DMACH_USB_EP1] = {
|
||||
.name = "usb-ep1",
|
||||
|
||||
@@ -149,6 +149,8 @@
|
||||
#define OMAP_MCBSP_REG_WAKEUPEN 0xA8
|
||||
#define OMAP_MCBSP_REG_XCCR 0xAC
|
||||
#define OMAP_MCBSP_REG_RCCR 0xB0
|
||||
#define OMAP_MCBSP_REG_XBUFFSTAT 0xB4
|
||||
#define OMAP_MCBSP_REG_RBUFFSTAT 0xB8
|
||||
#define OMAP_MCBSP_REG_SSELCR 0xBC
|
||||
|
||||
#define OMAP_ST_REG_REV 0x00
|
||||
@@ -471,6 +473,8 @@ void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold);
|
||||
void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold);
|
||||
u16 omap_mcbsp_get_max_tx_threshold(unsigned int id);
|
||||
u16 omap_mcbsp_get_max_rx_threshold(unsigned int id);
|
||||
u16 omap_mcbsp_get_tx_delay(unsigned int id);
|
||||
u16 omap_mcbsp_get_rx_delay(unsigned int id);
|
||||
int omap_mcbsp_get_dma_op_mode(unsigned int id);
|
||||
#else
|
||||
static inline void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
|
||||
@@ -479,6 +483,8 @@ static inline void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
|
||||
{ }
|
||||
static inline u16 omap_mcbsp_get_max_tx_threshold(unsigned int id) { return 0; }
|
||||
static inline u16 omap_mcbsp_get_max_rx_threshold(unsigned int id) { return 0; }
|
||||
static inline u16 omap_mcbsp_get_tx_delay(unsigned int id) { return 0; }
|
||||
static inline u16 omap_mcbsp_get_rx_delay(unsigned int id) { return 0; }
|
||||
static inline int omap_mcbsp_get_dma_op_mode(unsigned int id) { return 0; }
|
||||
#endif
|
||||
int omap_mcbsp_request(unsigned int id);
|
||||
|
||||
+74
-15
@@ -489,7 +489,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)) {
|
||||
@@ -511,7 +511,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)) {
|
||||
@@ -560,6 +560,61 @@ u16 omap_mcbsp_get_max_rx_threshold(unsigned int id)
|
||||
}
|
||||
EXPORT_SYMBOL(omap_mcbsp_get_max_rx_threshold);
|
||||
|
||||
#define MCBSP2_FIFO_SIZE 0x500 /* 1024 + 256 locations */
|
||||
#define MCBSP1345_FIFO_SIZE 0x80 /* 128 locations */
|
||||
/*
|
||||
* omap_mcbsp_get_tx_delay returns the number of used slots in the McBSP FIFO
|
||||
*/
|
||||
u16 omap_mcbsp_get_tx_delay(unsigned int id)
|
||||
{
|
||||
struct omap_mcbsp *mcbsp;
|
||||
u16 buffstat;
|
||||
|
||||
if (!omap_mcbsp_check_valid_id(id)) {
|
||||
printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
|
||||
return -ENODEV;
|
||||
}
|
||||
mcbsp = id_to_mcbsp_ptr(id);
|
||||
|
||||
/* Returns the number of free locations in the buffer */
|
||||
buffstat = MCBSP_READ(mcbsp, XBUFFSTAT);
|
||||
|
||||
/* Number of slots are different in McBSP ports */
|
||||
if (mcbsp->id == 2)
|
||||
return MCBSP2_FIFO_SIZE - buffstat;
|
||||
else
|
||||
return MCBSP1345_FIFO_SIZE - buffstat;
|
||||
}
|
||||
EXPORT_SYMBOL(omap_mcbsp_get_tx_delay);
|
||||
|
||||
/*
|
||||
* omap_mcbsp_get_rx_delay returns the number of free slots in the McBSP FIFO
|
||||
* to reach the threshold value (when the DMA will be triggered to read it)
|
||||
*/
|
||||
u16 omap_mcbsp_get_rx_delay(unsigned int id)
|
||||
{
|
||||
struct omap_mcbsp *mcbsp;
|
||||
u16 buffstat, threshold;
|
||||
|
||||
if (!omap_mcbsp_check_valid_id(id)) {
|
||||
printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
|
||||
return -ENODEV;
|
||||
}
|
||||
mcbsp = id_to_mcbsp_ptr(id);
|
||||
|
||||
/* Returns the number of used locations in the buffer */
|
||||
buffstat = MCBSP_READ(mcbsp, RBUFFSTAT);
|
||||
/* RX threshold */
|
||||
threshold = MCBSP_READ(mcbsp, THRSH1);
|
||||
|
||||
/* Return the number of location till we reach the threshold limit */
|
||||
if (threshold <= buffstat)
|
||||
return 0;
|
||||
else
|
||||
return threshold - buffstat;
|
||||
}
|
||||
EXPORT_SYMBOL(omap_mcbsp_get_rx_delay);
|
||||
|
||||
/*
|
||||
* omap_mcbsp_get_dma_op_mode just return the current configured
|
||||
* operating mode for the mcbsp channel
|
||||
@@ -587,7 +642,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);
|
||||
@@ -610,7 +665,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);
|
||||
@@ -724,14 +779,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -781,7 +839,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);
|
||||
}
|
||||
|
||||
@@ -855,7 +914,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);
|
||||
@@ -885,7 +944,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);
|
||||
@@ -895,7 +954,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);
|
||||
|
||||
@@ -81,6 +81,18 @@ static void wm8994_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
|
||||
wm8994_set_bits(wm8994, WM8994_GPIO_1 + offset, WM8994_GPN_LVL, value);
|
||||
}
|
||||
|
||||
static int wm8994_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
|
||||
{
|
||||
struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
|
||||
struct wm8994 *wm8994 = wm8994_gpio->wm8994;
|
||||
|
||||
if (!wm8994->irq_base)
|
||||
return -EINVAL;
|
||||
|
||||
return wm8994->irq_base + offset;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
|
||||
{
|
||||
|
||||
+6
-2
@@ -53,6 +53,10 @@ config MFD_SH_MOBILE_SDHI
|
||||
This driver supports the SDHI hardware block found in many
|
||||
SuperH Mobile SoCs.
|
||||
|
||||
config MFD_DAVINCI_VOICECODEC
|
||||
tristate
|
||||
select MFD_CORE
|
||||
|
||||
config MFD_DM355EVM_MSP
|
||||
bool "DaVinci DM355 EVM microcontroller"
|
||||
depends on I2C && MACH_DAVINCI_DM355_EVM
|
||||
@@ -297,9 +301,9 @@ config MFD_WM8350_I2C
|
||||
selected to enable support for the functionality of the chip.
|
||||
|
||||
config MFD_WM8994
|
||||
tristate "Support Wolfson Microelectronics WM8994"
|
||||
bool "Support Wolfson Microelectronics WM8994"
|
||||
select MFD_CORE
|
||||
depends on I2C
|
||||
depends on I2C=y && GENERIC_HARDIRQS
|
||||
help
|
||||
The WM8994 is a highly integrated hi-fi CODEC designed for
|
||||
smartphone applicatiosn. As well as audio functionality it
|
||||
|
||||
@@ -12,6 +12,7 @@ obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o
|
||||
obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o
|
||||
obj-$(CONFIG_HTC_I2CPLD) += htc-i2cpld.o
|
||||
|
||||
obj-$(CONFIG_MFD_DAVINCI_VOICECODEC) += davinci_voicecodec.o
|
||||
obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o
|
||||
|
||||
obj-$(CONFIG_MFD_T7L66XB) += t7l66xb.o tmio_core.o
|
||||
@@ -25,7 +26,7 @@ wm8350-objs := wm8350-core.o wm8350-regmap.o wm8350-gpio.o
|
||||
wm8350-objs += wm8350-irq.o
|
||||
obj-$(CONFIG_MFD_WM8350) += wm8350.o
|
||||
obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o
|
||||
obj-$(CONFIG_MFD_WM8994) += wm8994-core.o
|
||||
obj-$(CONFIG_MFD_WM8994) += wm8994-core.o wm8994-irq.o
|
||||
|
||||
obj-$(CONFIG_TPS65010) += tps65010.o
|
||||
obj-$(CONFIG_MENELAUS) += menelaus.o
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* DaVinci Voice Codec Core Interface for TI platforms
|
||||
*
|
||||
* Copyright (C) 2010 Texas Instruments, Inc
|
||||
*
|
||||
* Author: Miguel Aguilar <miguel.aguilar@ridgerun.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/clk.h>
|
||||
|
||||
#include <sound/pcm.h>
|
||||
|
||||
#include <linux/mfd/davinci_voicecodec.h>
|
||||
|
||||
u32 davinci_vc_read(struct davinci_vc *davinci_vc, int reg)
|
||||
{
|
||||
return __raw_readl(davinci_vc->base + reg);
|
||||
}
|
||||
|
||||
void davinci_vc_write(struct davinci_vc *davinci_vc,
|
||||
int reg, u32 val)
|
||||
{
|
||||
__raw_writel(val, davinci_vc->base + reg);
|
||||
}
|
||||
|
||||
static int __init davinci_vc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct davinci_vc *davinci_vc;
|
||||
struct resource *res, *mem;
|
||||
struct mfd_cell *cell = NULL;
|
||||
int ret;
|
||||
|
||||
davinci_vc = kzalloc(sizeof(struct davinci_vc), GFP_KERNEL);
|
||||
if (!davinci_vc) {
|
||||
dev_dbg(&pdev->dev,
|
||||
"could not allocate memory for private data\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
davinci_vc->clk = clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(davinci_vc->clk)) {
|
||||
dev_dbg(&pdev->dev,
|
||||
"could not get the clock for voice codec\n");
|
||||
ret = -ENODEV;
|
||||
goto fail1;
|
||||
}
|
||||
clk_enable(davinci_vc->clk);
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res) {
|
||||
dev_err(&pdev->dev, "no mem resource\n");
|
||||
ret = -ENODEV;
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
davinci_vc->pbase = res->start;
|
||||
davinci_vc->base_size = resource_size(res);
|
||||
|
||||
mem = request_mem_region(davinci_vc->pbase, davinci_vc->base_size,
|
||||
pdev->name);
|
||||
if (!mem) {
|
||||
dev_err(&pdev->dev, "VCIF region already claimed\n");
|
||||
ret = -EBUSY;
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
davinci_vc->base = ioremap(davinci_vc->pbase, davinci_vc->base_size);
|
||||
if (!davinci_vc->base) {
|
||||
dev_err(&pdev->dev, "can't ioremap mem resource.\n");
|
||||
ret = -ENOMEM;
|
||||
goto fail3;
|
||||
}
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
|
||||
if (!res) {
|
||||
dev_err(&pdev->dev, "no DMA resource\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
davinci_vc->davinci_vcif.dma_tx_channel = res->start;
|
||||
davinci_vc->davinci_vcif.dma_tx_addr =
|
||||
(dma_addr_t)(io_v2p(davinci_vc->base) + DAVINCI_VC_WFIFO);
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
|
||||
if (!res) {
|
||||
dev_err(&pdev->dev, "no DMA resource\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
davinci_vc->davinci_vcif.dma_rx_channel = res->start;
|
||||
davinci_vc->davinci_vcif.dma_rx_addr =
|
||||
(dma_addr_t)(io_v2p(davinci_vc->base) + DAVINCI_VC_RFIFO);
|
||||
|
||||
davinci_vc->dev = &pdev->dev;
|
||||
davinci_vc->pdev = pdev;
|
||||
|
||||
/* Voice codec interface client */
|
||||
cell = &davinci_vc->cells[DAVINCI_VC_VCIF_CELL];
|
||||
cell->name = "davinci_vcif";
|
||||
cell->driver_data = davinci_vc;
|
||||
|
||||
/* Voice codec CQ93VC client */
|
||||
cell = &davinci_vc->cells[DAVINCI_VC_CQ93VC_CELL];
|
||||
cell->name = "cq93vc";
|
||||
cell->driver_data = davinci_vc;
|
||||
|
||||
ret = mfd_add_devices(&pdev->dev, pdev->id, davinci_vc->cells,
|
||||
DAVINCI_VC_CELLS, NULL, 0);
|
||||
if (ret != 0) {
|
||||
dev_err(&pdev->dev, "fail to register client devices\n");
|
||||
goto fail4;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
fail4:
|
||||
iounmap(davinci_vc->base);
|
||||
fail3:
|
||||
release_mem_region(davinci_vc->pbase, davinci_vc->base_size);
|
||||
fail2:
|
||||
clk_disable(davinci_vc->clk);
|
||||
clk_put(davinci_vc->clk);
|
||||
davinci_vc->clk = NULL;
|
||||
fail1:
|
||||
kfree(davinci_vc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __devexit davinci_vc_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct davinci_vc *davinci_vc = platform_get_drvdata(pdev);
|
||||
|
||||
mfd_remove_devices(&pdev->dev);
|
||||
|
||||
iounmap(davinci_vc->base);
|
||||
release_mem_region(davinci_vc->pbase, davinci_vc->base_size);
|
||||
|
||||
clk_disable(davinci_vc->clk);
|
||||
clk_put(davinci_vc->clk);
|
||||
davinci_vc->clk = NULL;
|
||||
|
||||
kfree(davinci_vc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver davinci_vc_driver = {
|
||||
.driver = {
|
||||
.name = "davinci_voicecodec",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.remove = __devexit_p(davinci_vc_remove),
|
||||
};
|
||||
|
||||
static int __init davinci_vc_init(void)
|
||||
{
|
||||
return platform_driver_probe(&davinci_vc_driver, davinci_vc_probe);
|
||||
}
|
||||
module_init(davinci_vc_init);
|
||||
|
||||
static void __exit davinci_vc_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&davinci_vc_driver);
|
||||
}
|
||||
module_exit(davinci_vc_exit);
|
||||
|
||||
MODULE_AUTHOR("Miguel Aguilar");
|
||||
MODULE_DESCRIPTION("Texas Instruments DaVinci Voice Codec Core Interface");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -109,7 +109,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_TWL4030_CODEC) || defined(CONFIG_TWL4030_CODEC_MODULE) ||\
|
||||
defined(CONFIG_SND_SOC_TWL6030) || defined(CONFIG_SND_SOC_TWL6030_MODULE)
|
||||
defined(CONFIG_SND_SOC_TWL6040) || defined(CONFIG_SND_SOC_TWL6040_MODULE)
|
||||
#define twl_has_codec() true
|
||||
#else
|
||||
#define twl_has_codec() false
|
||||
@@ -708,7 +708,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
|
||||
/* Phoenix*/
|
||||
if (twl_has_codec() && pdata->codec && twl_class_is_6030()) {
|
||||
sub_chip_id = twl_map[TWL_MODULE_AUDIO_VOICE].sid;
|
||||
child = add_child(sub_chip_id, "twl6030_codec",
|
||||
child = add_child(sub_chip_id, "twl6040_codec",
|
||||
pdata->codec, sizeof(*pdata->codec),
|
||||
false, 0, 0);
|
||||
if (IS_ERR(child))
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <linux/mfd/wm831x/core.h>
|
||||
#include <linux/mfd/wm831x/pdata.h>
|
||||
#include <linux/mfd/wm831x/gpio.h>
|
||||
#include <linux/mfd/wm831x/irq.h>
|
||||
|
||||
#include <linux/delay.h>
|
||||
@@ -388,12 +389,41 @@ static void wm831x_irq_mask(unsigned int irq)
|
||||
wm831x->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask;
|
||||
}
|
||||
|
||||
static int wm831x_irq_set_type(unsigned int irq, unsigned int type)
|
||||
{
|
||||
struct wm831x *wm831x = get_irq_chip_data(irq);
|
||||
int val;
|
||||
|
||||
irq = irq - wm831x->irq_base;
|
||||
|
||||
if (irq < WM831X_IRQ_GPIO_1 || irq > WM831X_IRQ_GPIO_11)
|
||||
return -EINVAL;
|
||||
|
||||
switch (type) {
|
||||
case IRQ_TYPE_EDGE_BOTH:
|
||||
val = WM831X_GPN_INT_MODE;
|
||||
break;
|
||||
case IRQ_TYPE_EDGE_RISING:
|
||||
val = WM831X_GPN_POL;
|
||||
break;
|
||||
case IRQ_TYPE_EDGE_FALLING:
|
||||
val = 0;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + irq,
|
||||
WM831X_GPN_INT_MODE | WM831X_GPN_POL, val);
|
||||
}
|
||||
|
||||
static struct irq_chip wm831x_irq_chip = {
|
||||
.name = "wm831x",
|
||||
.bus_lock = wm831x_irq_lock,
|
||||
.bus_sync_unlock = wm831x_irq_sync_unlock,
|
||||
.mask = wm831x_irq_mask,
|
||||
.unmask = wm831x_irq_unmask,
|
||||
.set_type = wm831x_irq_set_type,
|
||||
};
|
||||
|
||||
/* The processing of the primary interrupt occurs in a thread so that
|
||||
|
||||
@@ -173,9 +173,34 @@ static struct mfd_cell wm8994_regulator_devs[] = {
|
||||
{ .name = "wm8994-ldo", .id = 2 },
|
||||
};
|
||||
|
||||
static struct resource wm8994_codec_resources[] = {
|
||||
{
|
||||
.start = WM8994_IRQ_TEMP_SHUT,
|
||||
.end = WM8994_IRQ_TEMP_WARN,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct resource wm8994_gpio_resources[] = {
|
||||
{
|
||||
.start = WM8994_IRQ_GPIO(1),
|
||||
.end = WM8994_IRQ_GPIO(11),
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct mfd_cell wm8994_devs[] = {
|
||||
{ .name = "wm8994-codec" },
|
||||
{ .name = "wm8994-gpio" },
|
||||
{
|
||||
.name = "wm8994-codec",
|
||||
.num_resources = ARRAY_SIZE(wm8994_codec_resources),
|
||||
.resources = wm8994_codec_resources,
|
||||
},
|
||||
|
||||
{
|
||||
.name = "wm8994-gpio",
|
||||
.num_resources = ARRAY_SIZE(wm8994_gpio_resources),
|
||||
.resources = wm8994_gpio_resources,
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -236,6 +261,11 @@ static int wm8994_device_resume(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = wm8994_write(wm8994, WM8994_INTERRUPT_STATUS_1_MASK,
|
||||
WM8994_NUM_IRQ_REGS * 2, &wm8994->irq_masks_cur);
|
||||
if (ret < 0)
|
||||
dev_err(dev, "Failed to restore interrupt masks: %d\n", ret);
|
||||
|
||||
ret = wm8994_write(wm8994, WM8994_LDO_1, WM8994_NUM_LDO_REGS * 2,
|
||||
&wm8994->ldo_regs);
|
||||
if (ret < 0)
|
||||
@@ -348,6 +378,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
|
||||
|
||||
|
||||
if (pdata) {
|
||||
wm8994->irq_base = pdata->irq_base;
|
||||
wm8994->gpio_base = pdata->gpio_base;
|
||||
|
||||
/* GPIO configuration is only applied if it's non-zero */
|
||||
@@ -375,16 +406,20 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
|
||||
WM8994_LDO1_DISCH, 0);
|
||||
}
|
||||
|
||||
wm8994_irq_init(wm8994);
|
||||
|
||||
ret = mfd_add_devices(wm8994->dev, -1,
|
||||
wm8994_devs, ARRAY_SIZE(wm8994_devs),
|
||||
NULL, 0);
|
||||
if (ret != 0) {
|
||||
dev_err(wm8994->dev, "Failed to add children: %d\n", ret);
|
||||
goto err_enable;
|
||||
goto err_irq;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_irq:
|
||||
wm8994_irq_exit(wm8994);
|
||||
err_enable:
|
||||
regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies),
|
||||
wm8994->supplies);
|
||||
@@ -401,6 +436,7 @@ err:
|
||||
static void wm8994_device_exit(struct wm8994 *wm8994)
|
||||
{
|
||||
mfd_remove_devices(wm8994->dev);
|
||||
wm8994_irq_exit(wm8994);
|
||||
regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies),
|
||||
wm8994->supplies);
|
||||
regulator_bulk_free(ARRAY_SIZE(wm8994_main_supplies), wm8994->supplies);
|
||||
@@ -469,6 +505,7 @@ static int wm8994_i2c_probe(struct i2c_client *i2c,
|
||||
wm8994->control_data = i2c;
|
||||
wm8994->read_dev = wm8994_i2c_read_device;
|
||||
wm8994->write_dev = wm8994_i2c_write_device;
|
||||
wm8994->irq = i2c->irq;
|
||||
|
||||
return wm8994_device_init(wm8994, id->driver_data, i2c->irq);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,310 @@
|
||||
/*
|
||||
* wm8994-irq.c -- Interrupt controller support for Wolfson WM8994
|
||||
*
|
||||
* Copyright 2010 Wolfson Microelectronics PLC.
|
||||
*
|
||||
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
#include <linux/mfd/wm8994/core.h>
|
||||
#include <linux/mfd/wm8994/registers.h>
|
||||
|
||||
#include <linux/delay.h>
|
||||
|
||||
struct wm8994_irq_data {
|
||||
int reg;
|
||||
int mask;
|
||||
};
|
||||
|
||||
static struct wm8994_irq_data wm8994_irqs[] = {
|
||||
[WM8994_IRQ_TEMP_SHUT] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_TEMP_SHUT_EINT,
|
||||
},
|
||||
[WM8994_IRQ_MIC1_DET] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_MIC1_DET_EINT,
|
||||
},
|
||||
[WM8994_IRQ_MIC1_SHRT] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_MIC1_SHRT_EINT,
|
||||
},
|
||||
[WM8994_IRQ_MIC2_DET] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_MIC2_DET_EINT,
|
||||
},
|
||||
[WM8994_IRQ_MIC2_SHRT] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_MIC2_SHRT_EINT,
|
||||
},
|
||||
[WM8994_IRQ_FLL1_LOCK] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_FLL1_LOCK_EINT,
|
||||
},
|
||||
[WM8994_IRQ_FLL2_LOCK] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_FLL2_LOCK_EINT,
|
||||
},
|
||||
[WM8994_IRQ_SRC1_LOCK] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_SRC1_LOCK_EINT,
|
||||
},
|
||||
[WM8994_IRQ_SRC2_LOCK] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_SRC2_LOCK_EINT,
|
||||
},
|
||||
[WM8994_IRQ_AIF1DRC1_SIG_DET] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_AIF1DRC1_SIG_DET,
|
||||
},
|
||||
[WM8994_IRQ_AIF1DRC2_SIG_DET] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_AIF1DRC2_SIG_DET_EINT,
|
||||
},
|
||||
[WM8994_IRQ_AIF2DRC_SIG_DET] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_AIF2DRC_SIG_DET_EINT,
|
||||
},
|
||||
[WM8994_IRQ_FIFOS_ERR] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_FIFOS_ERR_EINT,
|
||||
},
|
||||
[WM8994_IRQ_WSEQ_DONE] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_WSEQ_DONE_EINT,
|
||||
},
|
||||
[WM8994_IRQ_DCS_DONE] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_DCS_DONE_EINT,
|
||||
},
|
||||
[WM8994_IRQ_TEMP_WARN] = {
|
||||
.reg = 2,
|
||||
.mask = WM8994_TEMP_WARN_EINT,
|
||||
},
|
||||
[WM8994_IRQ_GPIO(1)] = {
|
||||
.reg = 1,
|
||||
.mask = WM8994_GP1_EINT,
|
||||
},
|
||||
[WM8994_IRQ_GPIO(2)] = {
|
||||
.reg = 1,
|
||||
.mask = WM8994_GP2_EINT,
|
||||
},
|
||||
[WM8994_IRQ_GPIO(3)] = {
|
||||
.reg = 1,
|
||||
.mask = WM8994_GP3_EINT,
|
||||
},
|
||||
[WM8994_IRQ_GPIO(4)] = {
|
||||
.reg = 1,
|
||||
.mask = WM8994_GP4_EINT,
|
||||
},
|
||||
[WM8994_IRQ_GPIO(5)] = {
|
||||
.reg = 1,
|
||||
.mask = WM8994_GP5_EINT,
|
||||
},
|
||||
[WM8994_IRQ_GPIO(6)] = {
|
||||
.reg = 1,
|
||||
.mask = WM8994_GP6_EINT,
|
||||
},
|
||||
[WM8994_IRQ_GPIO(7)] = {
|
||||
.reg = 1,
|
||||
.mask = WM8994_GP7_EINT,
|
||||
},
|
||||
[WM8994_IRQ_GPIO(8)] = {
|
||||
.reg = 1,
|
||||
.mask = WM8994_GP8_EINT,
|
||||
},
|
||||
[WM8994_IRQ_GPIO(9)] = {
|
||||
.reg = 1,
|
||||
.mask = WM8994_GP8_EINT,
|
||||
},
|
||||
[WM8994_IRQ_GPIO(10)] = {
|
||||
.reg = 1,
|
||||
.mask = WM8994_GP10_EINT,
|
||||
},
|
||||
[WM8994_IRQ_GPIO(11)] = {
|
||||
.reg = 1,
|
||||
.mask = WM8994_GP11_EINT,
|
||||
},
|
||||
};
|
||||
|
||||
static inline int irq_data_to_status_reg(struct wm8994_irq_data *irq_data)
|
||||
{
|
||||
return WM8994_INTERRUPT_STATUS_1 - 1 + irq_data->reg;
|
||||
}
|
||||
|
||||
static inline int irq_data_to_mask_reg(struct wm8994_irq_data *irq_data)
|
||||
{
|
||||
return WM8994_INTERRUPT_STATUS_1_MASK - 1 + irq_data->reg;
|
||||
}
|
||||
|
||||
static inline struct wm8994_irq_data *irq_to_wm8994_irq(struct wm8994 *wm8994,
|
||||
int irq)
|
||||
{
|
||||
return &wm8994_irqs[irq - wm8994->irq_base];
|
||||
}
|
||||
|
||||
static void wm8994_irq_lock(unsigned int irq)
|
||||
{
|
||||
struct wm8994 *wm8994 = get_irq_chip_data(irq);
|
||||
|
||||
mutex_lock(&wm8994->irq_lock);
|
||||
}
|
||||
|
||||
static void wm8994_irq_sync_unlock(unsigned int irq)
|
||||
{
|
||||
struct wm8994 *wm8994 = get_irq_chip_data(irq);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(wm8994->irq_masks_cur); i++) {
|
||||
/* If there's been a change in the mask write it back
|
||||
* to the hardware. */
|
||||
if (wm8994->irq_masks_cur[i] != wm8994->irq_masks_cache[i]) {
|
||||
wm8994->irq_masks_cache[i] = wm8994->irq_masks_cur[i];
|
||||
wm8994_reg_write(wm8994,
|
||||
WM8994_INTERRUPT_STATUS_1_MASK + i,
|
||||
wm8994->irq_masks_cur[i]);
|
||||
}
|
||||
}
|
||||
|
||||
mutex_unlock(&wm8994->irq_lock);
|
||||
}
|
||||
|
||||
static void wm8994_irq_unmask(unsigned int irq)
|
||||
{
|
||||
struct wm8994 *wm8994 = get_irq_chip_data(irq);
|
||||
struct wm8994_irq_data *irq_data = irq_to_wm8994_irq(wm8994, irq);
|
||||
|
||||
wm8994->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask;
|
||||
}
|
||||
|
||||
static void wm8994_irq_mask(unsigned int irq)
|
||||
{
|
||||
struct wm8994 *wm8994 = get_irq_chip_data(irq);
|
||||
struct wm8994_irq_data *irq_data = irq_to_wm8994_irq(wm8994, irq);
|
||||
|
||||
wm8994->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask;
|
||||
}
|
||||
|
||||
static struct irq_chip wm8994_irq_chip = {
|
||||
.name = "wm8994",
|
||||
.bus_lock = wm8994_irq_lock,
|
||||
.bus_sync_unlock = wm8994_irq_sync_unlock,
|
||||
.mask = wm8994_irq_mask,
|
||||
.unmask = wm8994_irq_unmask,
|
||||
};
|
||||
|
||||
/* The processing of the primary interrupt occurs in a thread so that
|
||||
* we can interact with the device over I2C or SPI. */
|
||||
static irqreturn_t wm8994_irq_thread(int irq, void *data)
|
||||
{
|
||||
struct wm8994 *wm8994 = data;
|
||||
unsigned int i;
|
||||
u16 status[WM8994_NUM_IRQ_REGS];
|
||||
int ret;
|
||||
|
||||
ret = wm8994_bulk_read(wm8994, WM8994_INTERRUPT_STATUS_1,
|
||||
WM8994_NUM_IRQ_REGS, status);
|
||||
if (ret < 0) {
|
||||
dev_err(wm8994->dev, "Failed to read interrupt status: %d\n",
|
||||
ret);
|
||||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
/* Apply masking */
|
||||
for (i = 0; i < WM8994_NUM_IRQ_REGS; i++)
|
||||
status[i] &= ~wm8994->irq_masks_cur[i];
|
||||
|
||||
/* Report */
|
||||
for (i = 0; i < ARRAY_SIZE(wm8994_irqs); i++) {
|
||||
if (status[wm8994_irqs[i].reg - 1] & wm8994_irqs[i].mask)
|
||||
handle_nested_irq(wm8994->irq_base + i);
|
||||
}
|
||||
|
||||
/* Ack any unmasked IRQs */
|
||||
for (i = 0; i < ARRAY_SIZE(status); i++) {
|
||||
if (status[i])
|
||||
wm8994_reg_write(wm8994, WM8994_INTERRUPT_STATUS_1 + i,
|
||||
status[i]);
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
int wm8994_irq_init(struct wm8994 *wm8994)
|
||||
{
|
||||
int i, cur_irq, ret;
|
||||
|
||||
mutex_init(&wm8994->irq_lock);
|
||||
|
||||
/* Mask the individual interrupt sources */
|
||||
for (i = 0; i < ARRAY_SIZE(wm8994->irq_masks_cur); i++) {
|
||||
wm8994->irq_masks_cur[i] = 0xffff;
|
||||
wm8994->irq_masks_cache[i] = 0xffff;
|
||||
wm8994_reg_write(wm8994, WM8994_INTERRUPT_STATUS_1_MASK + i,
|
||||
0xffff);
|
||||
}
|
||||
|
||||
if (!wm8994->irq) {
|
||||
dev_warn(wm8994->dev,
|
||||
"No interrupt specified, no interrupts\n");
|
||||
wm8994->irq_base = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!wm8994->irq_base) {
|
||||
dev_err(wm8994->dev,
|
||||
"No interrupt base specified, no interrupts\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Register them with genirq */
|
||||
for (cur_irq = wm8994->irq_base;
|
||||
cur_irq < ARRAY_SIZE(wm8994_irqs) + wm8994->irq_base;
|
||||
cur_irq++) {
|
||||
set_irq_chip_data(cur_irq, wm8994);
|
||||
set_irq_chip_and_handler(cur_irq, &wm8994_irq_chip,
|
||||
handle_edge_irq);
|
||||
set_irq_nested_thread(cur_irq, 1);
|
||||
|
||||
/* ARM needs us to explicitly flag the IRQ as valid
|
||||
* and will set them noprobe when we do so. */
|
||||
#ifdef CONFIG_ARM
|
||||
set_irq_flags(cur_irq, IRQF_VALID);
|
||||
#else
|
||||
set_irq_noprobe(cur_irq);
|
||||
#endif
|
||||
}
|
||||
|
||||
ret = request_threaded_irq(wm8994->irq, NULL, wm8994_irq_thread,
|
||||
IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
|
||||
"wm8994", wm8994);
|
||||
if (ret != 0) {
|
||||
dev_err(wm8994->dev, "Failed to request IRQ %d: %d\n",
|
||||
wm8994->irq, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Enable top level interrupt if it was masked */
|
||||
wm8994_reg_write(wm8994, WM8994_INTERRUPT_CONTROL, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wm8994_irq_exit(struct wm8994 *wm8994)
|
||||
{
|
||||
if (wm8994->irq)
|
||||
free_irq(wm8994->irq, wm8994);
|
||||
}
|
||||
@@ -569,9 +569,9 @@ struct twl4030_codec_data {
|
||||
struct twl4030_codec_audio_data *audio;
|
||||
struct twl4030_codec_vibra_data *vibra;
|
||||
|
||||
/* twl6030 */
|
||||
int audpwron_gpio; /* audio power-on gpio */
|
||||
int naudint_irq; /* audio interrupt */
|
||||
/* twl6040 */
|
||||
int audpwron_gpio; /* audio power-on gpio */
|
||||
int naudint_irq; /* audio interrupt */
|
||||
};
|
||||
|
||||
struct twl4030_platform_data {
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* DaVinci Voice Codec Core Interface for TI platforms
|
||||
*
|
||||
* Copyright (C) 2010 Texas Instruments, Inc
|
||||
*
|
||||
* Author: Miguel Aguilar <miguel.aguilar@ridgerun.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_MFD_DAVINCI_VOICECODEC_H_
|
||||
#define __LINUX_MFD_DAVINIC_VOICECODEC_H_
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mfd/core.h>
|
||||
|
||||
#include <mach/edma.h>
|
||||
|
||||
/*
|
||||
* Register values.
|
||||
*/
|
||||
#define DAVINCI_VC_PID 0x00
|
||||
#define DAVINCI_VC_CTRL 0x04
|
||||
#define DAVINCI_VC_INTEN 0x08
|
||||
#define DAVINCI_VC_INTSTATUS 0x0c
|
||||
#define DAVINCI_VC_INTCLR 0x10
|
||||
#define DAVINCI_VC_EMUL_CTRL 0x14
|
||||
#define DAVINCI_VC_RFIFO 0x20
|
||||
#define DAVINCI_VC_WFIFO 0x24
|
||||
#define DAVINCI_VC_FIFOSTAT 0x28
|
||||
#define DAVINCI_VC_TST_CTRL 0x2C
|
||||
#define DAVINCI_VC_REG05 0x94
|
||||
#define DAVINCI_VC_REG09 0xA4
|
||||
#define DAVINCI_VC_REG12 0xB0
|
||||
|
||||
/* DAVINCI_VC_CTRL bit fields */
|
||||
#define DAVINCI_VC_CTRL_MASK 0x5500
|
||||
#define DAVINCI_VC_CTRL_RSTADC BIT(0)
|
||||
#define DAVINCI_VC_CTRL_RSTDAC BIT(1)
|
||||
#define DAVINCI_VC_CTRL_RD_BITS_8 BIT(4)
|
||||
#define DAVINCI_VC_CTRL_RD_UNSIGNED BIT(5)
|
||||
#define DAVINCI_VC_CTRL_WD_BITS_8 BIT(6)
|
||||
#define DAVINCI_VC_CTRL_WD_UNSIGNED BIT(7)
|
||||
#define DAVINCI_VC_CTRL_RFIFOEN BIT(8)
|
||||
#define DAVINCI_VC_CTRL_RFIFOCL BIT(9)
|
||||
#define DAVINCI_VC_CTRL_RFIFOMD_WORD_1 BIT(10)
|
||||
#define DAVINCI_VC_CTRL_WFIFOEN BIT(12)
|
||||
#define DAVINCI_VC_CTRL_WFIFOCL BIT(13)
|
||||
#define DAVINCI_VC_CTRL_WFIFOMD_WORD_1 BIT(14)
|
||||
|
||||
/* DAVINCI_VC_INT bit fields */
|
||||
#define DAVINCI_VC_INT_MASK 0x3F
|
||||
#define DAVINCI_VC_INT_RDRDY_MASK BIT(0)
|
||||
#define DAVINCI_VC_INT_RERROVF_MASK BIT(1)
|
||||
#define DAVINCI_VC_INT_RERRUDR_MASK BIT(2)
|
||||
#define DAVINCI_VC_INT_WDREQ_MASK BIT(3)
|
||||
#define DAVINCI_VC_INT_WERROVF_MASKBIT BIT(4)
|
||||
#define DAVINCI_VC_INT_WERRUDR_MASK BIT(5)
|
||||
|
||||
/* DAVINCI_VC_REG05 bit fields */
|
||||
#define DAVINCI_VC_REG05_PGA_GAIN 0x07
|
||||
|
||||
/* DAVINCI_VC_REG09 bit fields */
|
||||
#define DAVINCI_VC_REG09_MUTE 0x40
|
||||
#define DAVINCI_VC_REG09_DIG_ATTEN 0x3F
|
||||
|
||||
/* DAVINCI_VC_REG12 bit fields */
|
||||
#define DAVINCI_VC_REG12_POWER_ALL_ON 0xFD
|
||||
#define DAVINCI_VC_REG12_POWER_ALL_OFF 0x00
|
||||
|
||||
#define DAVINCI_VC_CELLS 2
|
||||
|
||||
enum davinci_vc_cells {
|
||||
DAVINCI_VC_VCIF_CELL,
|
||||
DAVINCI_VC_CQ93VC_CELL,
|
||||
};
|
||||
|
||||
struct davinci_vcif {
|
||||
struct platform_device *pdev;
|
||||
u32 dma_tx_channel;
|
||||
u32 dma_rx_channel;
|
||||
dma_addr_t dma_tx_addr;
|
||||
dma_addr_t dma_rx_addr;
|
||||
};
|
||||
|
||||
struct cq93vc {
|
||||
struct platform_device *pdev;
|
||||
struct snd_soc_codec *codec;
|
||||
u32 sysclk;
|
||||
};
|
||||
|
||||
struct davinci_vc;
|
||||
|
||||
struct davinci_vc {
|
||||
/* Device data */
|
||||
struct device *dev;
|
||||
struct platform_device *pdev;
|
||||
struct clk *clk;
|
||||
|
||||
/* Memory resources */
|
||||
void __iomem *base;
|
||||
resource_size_t pbase;
|
||||
size_t base_size;
|
||||
|
||||
/* MFD cells */
|
||||
struct mfd_cell cells[DAVINCI_VC_CELLS];
|
||||
|
||||
/* Client devices */
|
||||
struct davinci_vcif davinci_vcif;
|
||||
struct cq93vc cq93vc;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -492,6 +492,8 @@
|
||||
*/
|
||||
#define WM8350_JACK_L_LVL 0x0800
|
||||
#define WM8350_JACK_R_LVL 0x0400
|
||||
#define WM8350_JACK_MICSCD_LVL 0x0200
|
||||
#define WM8350_JACK_MICSD_LVL 0x0100
|
||||
|
||||
/*
|
||||
* WM8350 Platform setup
|
||||
|
||||
@@ -15,14 +15,38 @@
|
||||
#ifndef __MFD_WM8994_CORE_H__
|
||||
#define __MFD_WM8994_CORE_H__
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
struct regulator_dev;
|
||||
struct regulator_bulk_data;
|
||||
|
||||
#define WM8994_NUM_GPIO_REGS 11
|
||||
#define WM8994_NUM_LDO_REGS 2
|
||||
#define WM8994_NUM_LDO_REGS 2
|
||||
#define WM8994_NUM_IRQ_REGS 2
|
||||
|
||||
#define WM8994_IRQ_TEMP_SHUT 0
|
||||
#define WM8994_IRQ_MIC1_DET 1
|
||||
#define WM8994_IRQ_MIC1_SHRT 2
|
||||
#define WM8994_IRQ_MIC2_DET 3
|
||||
#define WM8994_IRQ_MIC2_SHRT 4
|
||||
#define WM8994_IRQ_FLL1_LOCK 5
|
||||
#define WM8994_IRQ_FLL2_LOCK 6
|
||||
#define WM8994_IRQ_SRC1_LOCK 7
|
||||
#define WM8994_IRQ_SRC2_LOCK 8
|
||||
#define WM8994_IRQ_AIF1DRC1_SIG_DET 9
|
||||
#define WM8994_IRQ_AIF1DRC2_SIG_DET 10
|
||||
#define WM8994_IRQ_AIF2DRC_SIG_DET 11
|
||||
#define WM8994_IRQ_FIFOS_ERR 12
|
||||
#define WM8994_IRQ_WSEQ_DONE 13
|
||||
#define WM8994_IRQ_DCS_DONE 14
|
||||
#define WM8994_IRQ_TEMP_WARN 15
|
||||
|
||||
/* GPIOs in the chip are numbered from 1-11 */
|
||||
#define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN)
|
||||
|
||||
struct wm8994 {
|
||||
struct mutex io_lock;
|
||||
struct mutex irq_lock;
|
||||
|
||||
struct device *dev;
|
||||
int (*read_dev)(struct wm8994 *wm8994, unsigned short reg,
|
||||
@@ -33,6 +57,11 @@ struct wm8994 {
|
||||
void *control_data;
|
||||
|
||||
int gpio_base;
|
||||
int irq_base;
|
||||
|
||||
int irq;
|
||||
u16 irq_masks_cur[WM8994_NUM_IRQ_REGS];
|
||||
u16 irq_masks_cache[WM8994_NUM_IRQ_REGS];
|
||||
|
||||
/* Used over suspend/resume */
|
||||
u16 ldo_regs[WM8994_NUM_LDO_REGS];
|
||||
@@ -51,4 +80,26 @@ int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
|
||||
int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
|
||||
int count, u16 *buf);
|
||||
|
||||
|
||||
/* Helper to save on boilerplate */
|
||||
static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,
|
||||
irq_handler_t handler, const char *name,
|
||||
void *data)
|
||||
{
|
||||
if (!wm8994->irq_base)
|
||||
return -EINVAL;
|
||||
return request_threaded_irq(wm8994->irq_base + irq, NULL, handler,
|
||||
IRQF_TRIGGER_RISING, name,
|
||||
data);
|
||||
}
|
||||
static inline void wm8994_free_irq(struct wm8994 *wm8994, int irq, void *data)
|
||||
{
|
||||
if (!wm8994->irq_base)
|
||||
return;
|
||||
free_irq(wm8994->irq_base + irq, data);
|
||||
}
|
||||
|
||||
int wm8994_irq_init(struct wm8994 *wm8994);
|
||||
void wm8994_irq_exit(struct wm8994 *wm8994);
|
||||
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user