Skip to contentSkip to conversation

ASoC: MAX9877: add MAX9877 amp driver

PATCH Applied Joonyoung Shim 2 participants 2 messages Jul 15, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 ASoC: MAX9877: add MAX9877 amp driver

The MAX9877 combines a high-efficiency Class D audio power amplifier with a stereo Class AB capacitor-less DirectDrive headphone amplifier.

The max9877_add_controls() is called to register the MAX9877 specific controls on machine specific init() of the machine driver.

The datasheet for the MAX9877 can find at the following url:
http://datasheets.maxim-ic.com/en/ds/MAX9877.pdf

---
This patch is version 2. I updated from review of version 1.

Change log:
v2: - add SND_SOC_MAX9877 to SND_SOC_ALL_CODECS on Kconfig.
- use SOC_DOUBLE_R_EXT_TLV instead of SOC_SINGLE_EXT_TLV for HP volume control.
- modify max9877_get_reg() and max9877_set_reg for double reg controls.
- add EXPORT_SYMBOL_GPL(max9877_add_controls).

 sound/soc/codecs/Kconfig   |    5 +
 sound/soc/codecs/Makefile  |    6 +
 sound/soc/codecs/max9877.c |  270 ++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/max9877.h |   37 ++++++
 4 files changed, 318 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/codecs/max9877.c
 create mode 100644 sound/soc/codecs/max9877.h
sound/soc/codecs/Kconfig +5 -0
index b674d3a..16a710f 100644
@@ -49,6 +49,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_WM9705 if SND_SOC_AC97_BUS
 	select SND_SOC_WM9712 if SND_SOC_AC97_BUS
 	select SND_SOC_WM9713 if SND_SOC_AC97_BUS
+	select SND_SOC_MAX9877 if I2C
         help
           Normally ASoC codec drivers are only built if a machine driver which
           uses them is also built since they are only usable with a machine
@@ -188,3 +189,7 @@ config SND_SOC_WM9712
 
 config SND_SOC_WM9713
 	tristate
+
+# Amp
+config SND_SOC_MAX9877
+	tristate
sound/soc/codecs/Makefile +6 -0
index 301eb08..cf111c9 100644
@@ -38,6 +38,9 @@ snd-soc-wm9705-objs := wm9705.o
 snd-soc-wm9712-objs := wm9712.o
 snd-soc-wm9713-objs := wm9713.o
 
+# Amp
+snd-soc-max9877-objs := max9877.o
+
 obj-$(CONFIG_SND_SOC_AC97_CODEC)	+= snd-soc-ac97.o
 obj-$(CONFIG_SND_SOC_AD1980)	+= snd-soc-ad1980.o
 obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o
@@ -77,3 +80,6 @@ obj-$(CONFIG_SND_SOC_WM9081)	+= snd-soc-wm9081.o
 obj-$(CONFIG_SND_SOC_WM9705)	+= snd-soc-wm9705.o
 obj-$(CONFIG_SND_SOC_WM9712)	+= snd-soc-wm9712.o
 obj-$(CONFIG_SND_SOC_WM9713)	+= snd-soc-wm9713.o
+
+# Amp
+obj-$(CONFIG_SND_SOC_MAX9877)	+= snd-soc-max9877.o
sound/soc/codecs/max9877.c new file +270 -0

270 lines not on this page · raw message

sound/soc/codecs/max9877.h new file +37 -0
new file mode 100644
index 0000000..6da7229
@@ -0,0 +1,37 @@
+/*
+ * max9877.h  --  amp driver for max9877
+ *
+ * Copyright (C) 2009 Samsung Electronics Co.Ltd
+ * Author: Joonyoung Shim <[email protected]>
+ *
+ *  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.
+ *
+ */
+
+#ifndef _MAX9877_H
+#define _MAX9877_H
+
+#define MAX9877_INPUT_MODE		0x00
+#define MAX9877_SPK_VOLUME		0x01
+#define MAX9877_HPL_VOLUME		0x02
+#define MAX9877_HPR_VOLUME		0x03
+#define MAX9877_OUTPUT_MODE		0x04
+
+/* MAX9877_INPUT_MODE */
+#define MAX9877_INB			(1 << 4)
+#define MAX9877_INA			(1 << 5)
+#define MAX9877_ZCD			(1 << 6)
+
+/* MAX9877_OUTPUT_MODE */
+#define MAX9877_OUTMODE_MASK		(15 << 0)
+#define MAX9877_OSC_MASK		(3 << 4)
+#define MAX9877_OSC_OFFSET		4
+#define MAX9877_BYPASS			(1 << 6)
+#define MAX9877_SHDN			(1 << 7)
+
+extern int max9877_add_controls(struct snd_soc_codec *codec);
+
+#endif
Signature · 1 line
1.6.0.4
Applied
#1 lore raw
Quoted 2 lines · Joonyoung Shim

The MAX9877 combines a high-efficiency Class D audio power amplifier with a stereo Class AB capacitor-less DirectDrive headphone amplifier.

Applied all three, thanks!

I did a small edit to the driver patch to sort the entry in SND_SOC_ALL_CODECS.