aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/sound/ssm2518.txt20
-rw-r--r--include/linux/platform_data/ssm2518.h22
-rw-r--r--sound/soc/codecs/Kconfig4
-rw-r--r--sound/soc/codecs/Makefile2
-rw-r--r--sound/soc/codecs/ssm2518.c856
-rw-r--r--sound/soc/codecs/ssm2518.h20
6 files changed, 924 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/sound/ssm2518.txt b/Documentation/devicetree/bindings/sound/ssm2518.txt
new file mode 100644
index 000000000000..59381a778c79
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/ssm2518.txt
@@ -0,0 +1,20 @@
1SSM2518 audio amplifier
2
3This device supports I2C only.
4
5Required properties:
6 - compatible : Must be "adi,ssm2518"
7 - reg : the I2C address of the device. This will either be 0x34 (ADDR pin low)
8 or 0x35 (ADDR pin high)
9
10Optional properties:
11 - gpios : GPIO connected to the nSD pin. If the property is not present it is
12 assumed that the nSD pin is hardwired to always on.
13
14Example:
15
16 ssm2518: ssm2518@34 {
17 compatible = "adi,ssm2518";
18 reg = <0x34>;
19 gpios = <&gpio 5 0>;
20 };
diff --git a/include/linux/platform_data/ssm2518.h b/include/linux/platform_data/ssm2518.h
new file mode 100644
index 000000000000..9a8e3ea287e3
--- /dev/null
+++ b/include/linux/platform_data/ssm2518.h
@@ -0,0 +1,22 @@
1/*
2 * SSM2518 amplifier audio driver
3 *
4 * Copyright 2013 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2.
8 */
9
10#ifndef __LINUX_PLATFORM_DATA_SSM2518_H__
11#define __LINUX_PLATFORM_DATA_SSM2518_H__
12
13/**
14 * struct ssm2518_platform_data - Platform data for the ssm2518 driver
15 * @enable_gpio: GPIO connected to the nSD pin. Set to -1 if the nSD pin is
16 * hardwired.
17 */
18struct ssm2518_platform_data {
19 int enable_gpio;
20};
21
22#endif
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 0615e00b4ab7..badb6fbacaa6 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -61,6 +61,7 @@ config SND_SOC_ALL_CODECS
61 select SND_SOC_SI476X if MFD_SI476X_CORE 61 select SND_SOC_SI476X if MFD_SI476X_CORE
62 select SND_SOC_SN95031 if INTEL_SCU_IPC 62 select SND_SOC_SN95031 if INTEL_SCU_IPC
63 select SND_SOC_SPDIF 63 select SND_SOC_SPDIF
64 select SND_SOC_SSM2518 if I2C
64 select SND_SOC_SSM2602 if SND_SOC_I2C_AND_SPI 65 select SND_SOC_SSM2602 if SND_SOC_I2C_AND_SPI
65 select SND_SOC_STA32X if I2C 66 select SND_SOC_STA32X if I2C
66 select SND_SOC_STA529 if I2C 67 select SND_SOC_STA529 if I2C
@@ -317,6 +318,9 @@ config SND_SOC_SN95031
317config SND_SOC_SPDIF 318config SND_SOC_SPDIF
318 tristate 319 tristate
319 320
321config SND_SOC_SSM2518
322 tristate
323
320config SND_SOC_SSM2602 324config SND_SOC_SSM2602
321 tristate 325 tristate
322 326
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index c8117cbd8864..70fd8066f546 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -53,6 +53,7 @@ snd-soc-si476x-objs := si476x.o
53snd-soc-sn95031-objs := sn95031.o 53snd-soc-sn95031-objs := sn95031.o
54snd-soc-spdif-tx-objs := spdif_transmitter.o 54snd-soc-spdif-tx-objs := spdif_transmitter.o
55snd-soc-spdif-rx-objs := spdif_receiver.o 55snd-soc-spdif-rx-objs := spdif_receiver.o
56snd-soc-ssm2518-objs := ssm2518.o
56snd-soc-ssm2602-objs := ssm2602.o 57snd-soc-ssm2602-objs := ssm2602.o
57snd-soc-sta32x-objs := sta32x.o 58snd-soc-sta32x-objs := sta32x.o
58snd-soc-sta529-objs := sta529.o 59snd-soc-sta529-objs := sta529.o
@@ -178,6 +179,7 @@ obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o
178obj-$(CONFIG_SND_SOC_SI476X) += snd-soc-si476x.o 179obj-$(CONFIG_SND_SOC_SI476X) += snd-soc-si476x.o
179obj-$(CONFIG_SND_SOC_SN95031) +=snd-soc-sn95031.o 180obj-$(CONFIG_SND_SOC_SN95031) +=snd-soc-sn95031.o
180obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif-rx.o snd-soc-spdif-tx.o 181obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif-rx.o snd-soc-spdif-tx.o
182obj-$(CONFIG_SND_SOC_SSM2518) += snd-soc-ssm2518.o
181obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o 183obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o
182obj-$(CONFIG_SND_SOC_STA32X) += snd-soc-sta32x.o 184obj-$(CONFIG_SND_SOC_STA32X) += snd-soc-sta32x.o
183obj-$(CONFIG_SND_SOC_STA529) += snd-soc-sta529.o 185obj-$(CONFIG_SND_SOC_STA529) += snd-soc-sta529.o
diff --git a/sound/soc/codecs/ssm2518.c b/sound/soc/codecs/ssm2518.c
new file mode 100644
index 000000000000..95aed552139a
--- /dev/null
+++ b/sound/soc/codecs/ssm2518.c
@@ -0,0 +1,856 @@
1/*
2 * SSM2518 amplifier audio driver
3 *
4 * Copyright 2013 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2.
8 */
9
10#include <linux/module.h>
11#include <linux/init.h>
12#include <linux/i2c.h>
13#include <linux/regmap.h>
14#include <linux/slab.h>
15#include <linux/gpio.h>
16#include <linux/of_gpio.h>
17#include <linux/platform_data/ssm2518.h>
18#include <sound/core.h>
19#include <sound/pcm.h>
20#include <sound/pcm_params.h>
21#include <sound/soc.h>
22#include <sound/initval.h>
23#include <sound/tlv.h>
24
25#include "ssm2518.h"
26
27#define SSM2518_REG_POWER1 0x00
28#define SSM2518_REG_CLOCK 0x01
29#define SSM2518_REG_SAI_CTRL1 0x02
30#define SSM2518_REG_SAI_CTRL2 0x03
31#define SSM2518_REG_CHAN_MAP 0x04
32#define SSM2518_REG_LEFT_VOL 0x05
33#define SSM2518_REG_RIGHT_VOL 0x06
34#define SSM2518_REG_MUTE_CTRL 0x07
35#define SSM2518_REG_FAULT_CTRL 0x08
36#define SSM2518_REG_POWER2 0x09
37#define SSM2518_REG_DRC_1 0x0a
38#define SSM2518_REG_DRC_2 0x0b
39#define SSM2518_REG_DRC_3 0x0c
40#define SSM2518_REG_DRC_4 0x0d
41#define SSM2518_REG_DRC_5 0x0e
42#define SSM2518_REG_DRC_6 0x0f
43#define SSM2518_REG_DRC_7 0x10
44#define SSM2518_REG_DRC_8 0x11
45#define SSM2518_REG_DRC_9 0x12
46
47#define SSM2518_POWER1_RESET BIT(7)
48#define SSM2518_POWER1_NO_BCLK BIT(5)
49#define SSM2518_POWER1_MCS_MASK (0xf << 1)
50#define SSM2518_POWER1_MCS_64FS (0x0 << 1)
51#define SSM2518_POWER1_MCS_128FS (0x1 << 1)
52#define SSM2518_POWER1_MCS_256FS (0x2 << 1)
53#define SSM2518_POWER1_MCS_384FS (0x3 << 1)
54#define SSM2518_POWER1_MCS_512FS (0x4 << 1)
55#define SSM2518_POWER1_MCS_768FS (0x5 << 1)
56#define SSM2518_POWER1_MCS_100FS (0x6 << 1)
57#define SSM2518_POWER1_MCS_200FS (0x7 << 1)
58#define SSM2518_POWER1_MCS_400FS (0x8 << 1)
59#define SSM2518_POWER1_SPWDN BIT(0)
60
61#define SSM2518_CLOCK_ASR BIT(0)
62
63#define SSM2518_SAI_CTRL1_FMT_MASK (0x3 << 5)
64#define SSM2518_SAI_CTRL1_FMT_I2S (0x0 << 5)
65#define SSM2518_SAI_CTRL1_FMT_LJ (0x1 << 5)
66#define SSM2518_SAI_CTRL1_FMT_RJ_24BIT (0x2 << 5)
67#define SSM2518_SAI_CTRL1_FMT_RJ_16BIT (0x3 << 5)
68
69#define SSM2518_SAI_CTRL1_SAI_MASK (0x7 << 2)
70#define SSM2518_SAI_CTRL1_SAI_I2S (0x0 << 2)
71#define SSM2518_SAI_CTRL1_SAI_TDM_2 (0x1 << 2)
72#define SSM2518_SAI_CTRL1_SAI_TDM_4 (0x2 << 2)
73#define SSM2518_SAI_CTRL1_SAI_TDM_8 (0x3 << 2)
74#define SSM2518_SAI_CTRL1_SAI_TDM_16 (0x4 << 2)
75#define SSM2518_SAI_CTRL1_SAI_MONO (0x5 << 2)
76
77#define SSM2518_SAI_CTRL1_FS_MASK (0x3)
78#define SSM2518_SAI_CTRL1_FS_8000_12000 (0x0)
79#define SSM2518_SAI_CTRL1_FS_16000_24000 (0x1)
80#define SSM2518_SAI_CTRL1_FS_32000_48000 (0x2)
81#define SSM2518_SAI_CTRL1_FS_64000_96000 (0x3)
82
83#define SSM2518_SAI_CTRL2_BCLK_INTERAL BIT(7)
84#define SSM2518_SAI_CTRL2_LRCLK_PULSE BIT(6)
85#define SSM2518_SAI_CTRL2_LRCLK_INVERT BIT(5)
86#define SSM2518_SAI_CTRL2_MSB BIT(4)
87#define SSM2518_SAI_CTRL2_SLOT_WIDTH_MASK (0x3 << 2)
88#define SSM2518_SAI_CTRL2_SLOT_WIDTH_32 (0x0 << 2)
89#define SSM2518_SAI_CTRL2_SLOT_WIDTH_24 (0x1 << 2)
90#define SSM2518_SAI_CTRL2_SLOT_WIDTH_16 (0x2 << 2)
91#define SSM2518_SAI_CTRL2_BCLK_INVERT BIT(1)
92
93#define SSM2518_CHAN_MAP_RIGHT_SLOT_OFFSET 4
94#define SSM2518_CHAN_MAP_RIGHT_SLOT_MASK 0xf0
95#define SSM2518_CHAN_MAP_LEFT_SLOT_OFFSET 0