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

Commit 8380222e authored by Sascha Hauer's avatar Sascha Hauer Committed by Mark Brown
Browse files

ASoC: Add a new imx-ssi sound driver



The old driver has the number of SSI units in the system hardcoded,
does not make use of the device model and works only on i.MX21/27.

This driver replaces it. It works in DMA mode on i.MX21/27 and using
an FIQ handler on other systems. It also supports AC97 mode of
the SSI units.

Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Acked-by: default avatarJavier Martin <javier.martin@vista-silicon.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 53242c68
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -9,3 +9,9 @@ obj-$(CONFIG_ARCH_MX1) += iomux-mx1-mx2.o dma-mx1-mx2.o
obj-$(CONFIG_ARCH_MX2) += iomux-mx1-mx2.o dma-mx1-mx2.o
obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
obj-$(CONFIG_MXC_PWM)  += pwm.o
obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o
obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o
ifdef CONFIG_SND_IMX_SOC
obj-y += ssi-fiq.o
obj-y += ssi-fiq-ksym.o
endif
+20 −0
Original line number Diff line number Diff line
/*
 * Exported ksyms for the SSI FIQ handler
 *
 * Copyright (C) 2009, Sascha Hauer <s.hauer@pengutronix.de>
 *
 * 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.
 */

#include <linux/module.h>

#include <mach/ssi.h>

EXPORT_SYMBOL(imx_ssi_fiq_tx_buffer);
EXPORT_SYMBOL(imx_ssi_fiq_rx_buffer);
EXPORT_SYMBOL(imx_ssi_fiq_start);
EXPORT_SYMBOL(imx_ssi_fiq_end);
EXPORT_SYMBOL(imx_ssi_fiq_base);
+134 −0
Original line number Diff line number Diff line
/*
 *  Copyright (C) 2009 Sascha Hauer <s.hauer@pengutronix.de>
 *
 * 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.
 */

#include <linux/linkage.h>
#include <asm/assembler.h>

/*
 * r8  = bit 0-15: tx offset, bit 16-31: tx buffer size
 * r9  = bit 0-15: rx offset, bit 16-31: rx buffer size
 */

#define SSI_STX0	0x00
#define SSI_SRX0	0x08
#define SSI_SISR	0x14
#define SSI_SIER	0x18
#define SSI_SACNT	0x38

#define SSI_SACNT_AC97EN	(1 << 0)

#define SSI_SIER_TFE0_EN	(1 << 0)
#define SSI_SISR_TFE0		(1 << 0)
#define SSI_SISR_RFF0		(1 << 2)
#define SSI_SIER_RFF0_EN	(1 << 2)

		.text
		.global	imx_ssi_fiq_start
		.global	imx_ssi_fiq_end
		.global imx_ssi_fiq_base
		.global imx_ssi_fiq_rx_buffer
		.global imx_ssi_fiq_tx_buffer

imx_ssi_fiq_start:
		ldr r12, imx_ssi_fiq_base

		/* TX */
		ldr r11, imx_ssi_fiq_tx_buffer

		/* shall we send? */
		ldr r13, [r12, #SSI_SIER]
		tst r13, #SSI_SIER_TFE0_EN
		beq 1f

		/* TX FIFO empty? */
		ldr r13, [r12, #SSI_SISR]
		tst r13, #SSI_SISR_TFE0
		beq 1f

		mov r10, #0x10000
		sub r10, #1
		and r10, r10, r8	/* r10: current buffer offset */

		add r11, r11, r10

		ldrh r13, [r11]
		strh r13, [r12, #SSI_STX0]

		ldrh r13, [r11, #2]
		strh r13, [r12, #SSI_STX0]

		ldrh r13, [r11, #4]
		strh r13, [r12, #SSI_STX0]

		ldrh r13, [r11, #6]
		strh r13, [r12, #SSI_STX0]

		add r10, #8
		lsr r13, r8, #16	/* r13: buffer size */
		cmp r10, r13
		lslgt r8, r13, #16
		addle r8, #8
1:
		/* RX */

		/* shall we receive? */
		ldr r13, [r12, #SSI_SIER]
		tst r13, #SSI_SIER_RFF0_EN
		beq 1f

		/* RX FIFO full? */
		ldr r13, [r12, #SSI_SISR]
		tst r13, #SSI_SISR_RFF0
		beq 1f

		ldr r11, imx_ssi_fiq_rx_buffer

		mov r10, #0x10000
		sub r10, #1
		and r10, r10, r9	/* r10: current buffer offset */

		add r11, r11, r10

		ldr r13, [r12, #SSI_SACNT]
		tst r13, #SSI_SACNT_AC97EN

		ldr r13, [r12, #SSI_SRX0]
		strh r13, [r11]

		ldr r13, [r12, #SSI_SRX0]
		strh r13, [r11, #2]

		/* dummy read to skip slot 12 */
		ldrne r13, [r12, #SSI_SRX0]

		ldr r13, [r12, #SSI_SRX0]
		strh r13, [r11, #4]

		ldr r13, [r12, #SSI_SRX0]
		strh r13, [r11, #6]

		/* dummy read to skip slot 12 */
		ldrne r13, [r12, #SSI_SRX0]

		add r10, #8
		lsr r13, r9, #16	/* r13: buffer size */
		cmp r10, r13
		lslgt r9, r13, #16
		addle r9, #8

1:
		@ return from FIQ
		subs	pc, lr, #4
imx_ssi_fiq_base:
		.word 0x0
imx_ssi_fiq_rx_buffer:
		.word 0x0
imx_ssi_fiq_tx_buffer:
		.word 0x0
imx_ssi_fiq_end:
+6 −14
Original line number Diff line number Diff line
config SND_MX1_MX2_SOC
	tristate "SoC Audio for Freecale i.MX1x i.MX2x CPUs"
	depends on ARCH_MX2 || ARCH_MX1
config SND_IMX_SOC
	tristate "SoC Audio for Freecale i.MX CPUs"
	depends on ARCH_MXC
	select SND_PCM
	select FIQ
	select SND_SOC_AC97_BUS
	help
	  Say Y or M if you want to add support for codecs attached to
	  the MX1 or MX2 SSI interface.
	  the i.MX SSI interface.

config SND_MXC_SOC_SSI
	tristate
config SND_SOC_MX27VIS_WM8974
	tristate "SoC Audio support for MX27 - WM8974 Visstrim_sm10 board"
	depends on SND_MX1_MX2_SOC && MACH_MX27 && MACH_IMX27_VISSTRIM_M10
	select SND_MXC_SOC_SSI
	select SND_SOC_WM8974
	help
	  Say Y if you want to add support for SoC audio on Visstrim SM10
	  board with WM8974.

+6 −6
Original line number Diff line number Diff line
# i.MX Platform Support
snd-soc-mx1_mx2-objs := mx1_mx2-pcm.o
snd-soc-mxc-ssi-objs := mxc-ssi.o
snd-soc-imx-objs := imx-ssi.o imx-pcm-fiq.o imx-pcm-dma-mx2.o

obj-$(CONFIG_SND_MX1_MX2_SOC) += snd-soc-mx1_mx2.o
obj-$(CONFIG_SND_MXC_SOC_SSI) += snd-soc-mxc-ssi.o
ifdef CONFIG_MACH_MX27
snd-soc-imx-objs += imx-pcm-dma-mx2.o
endif

obj-$(CONFIG_SND_IMX_SOC) += snd-soc-imx.o

# i.MX Machine Support
snd-soc-mx27vis-wm8974-objs := mx27vis_wm8974.o
obj-$(CONFIG_SND_SOC_MX27VIS_WM8974) += snd-soc-mx27vis-wm8974.o
Loading