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

Commit 0b1107b2 authored by Mark Brown's avatar Mark Brown
Browse files

Merge remote-tracking branch 'asoc/topic/arizona' into asoc-next

parents 3e4ea1f9 c5efb38a
Loading
Loading
Loading
Loading
+96 −0
Original line number Original line Diff line number Diff line
/*
 * GPIO configuration for Arizona devices
 *
 * Copyright 2013 Wolfson Microelectronics. PLC.
 *
 * Author: Charles Keepax <ckeepax@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 version 2 as
 * published by the Free Software Foundation.
 */

#ifndef _ARIZONA_GPIO_H
#define _ARIZONA_GPIO_H

#define ARIZONA_GP_FN_TXLRCLK                    0x00
#define ARIZONA_GP_FN_GPIO                       0x01
#define ARIZONA_GP_FN_IRQ1                       0x02
#define ARIZONA_GP_FN_IRQ2                       0x03
#define ARIZONA_GP_FN_OPCLK                      0x04
#define ARIZONA_GP_FN_FLL1_OUT                   0x05
#define ARIZONA_GP_FN_FLL2_OUT                   0x06
#define ARIZONA_GP_FN_PWM1                       0x08
#define ARIZONA_GP_FN_PWM2                       0x09
#define ARIZONA_GP_FN_SYSCLK_UNDERCLOCKED        0x0A
#define ARIZONA_GP_FN_ASYNCCLK_UNDERCLOCKED      0x0B
#define ARIZONA_GP_FN_FLL1_LOCK                  0x0C
#define ARIZONA_GP_FN_FLL2_LOCK                  0x0D
#define ARIZONA_GP_FN_FLL1_CLOCK_OK              0x0F
#define ARIZONA_GP_FN_FLL2_CLOCK_OK              0x10
#define ARIZONA_GP_FN_HEADPHONE_DET              0x12
#define ARIZONA_GP_FN_MIC_DET                    0x13
#define ARIZONA_GP_FN_WSEQ_STATUS                0x15
#define ARIZONA_GP_FN_CIF_ADDRESS_ERROR          0x16
#define ARIZONA_GP_FN_ASRC1_LOCK                 0x1A
#define ARIZONA_GP_FN_ASRC2_LOCK                 0x1B
#define ARIZONA_GP_FN_ASRC_CONFIG_ERROR          0x1C
#define ARIZONA_GP_FN_DRC1_SIGNAL_DETECT         0x1D
#define ARIZONA_GP_FN_DRC1_ANTICLIP              0x1E
#define ARIZONA_GP_FN_DRC1_DECAY                 0x1F
#define ARIZONA_GP_FN_DRC1_NOISE                 0x20
#define ARIZONA_GP_FN_DRC1_QUICK_RELEASE         0x21
#define ARIZONA_GP_FN_DRC2_SIGNAL_DETECT         0x22
#define ARIZONA_GP_FN_DRC2_ANTICLIP              0x23
#define ARIZONA_GP_FN_DRC2_DECAY                 0x24
#define ARIZONA_GP_FN_DRC2_NOISE                 0x25
#define ARIZONA_GP_FN_DRC2_QUICK_RELEASE         0x26
#define ARIZONA_GP_FN_MIXER_DROPPED_SAMPLE       0x27
#define ARIZONA_GP_FN_AIF1_CONFIG_ERROR          0x28
#define ARIZONA_GP_FN_AIF2_CONFIG_ERROR          0x29
#define ARIZONA_GP_FN_AIF3_CONFIG_ERROR          0x2A
#define ARIZONA_GP_FN_SPK_TEMP_SHUTDOWN          0x2B
#define ARIZONA_GP_FN_SPK_TEMP_WARNING           0x2C
#define ARIZONA_GP_FN_UNDERCLOCKED               0x2D
#define ARIZONA_GP_FN_OVERCLOCKED                0x2E
#define ARIZONA_GP_FN_DSP_IRQ1                   0x35
#define ARIZONA_GP_FN_DSP_IRQ2                   0x36
#define ARIZONA_GP_FN_ASYNC_OPCLK                0x3D
#define ARIZONA_GP_FN_BOOT_DONE                  0x44
#define ARIZONA_GP_FN_DSP1_RAM_READY             0x45
#define ARIZONA_GP_FN_SYSCLK_ENA_STATUS          0x4B
#define ARIZONA_GP_FN_ASYNCCLK_ENA_STATUS        0x4C

#define ARIZONA_GPN_DIR                          0x8000  /* GPN_DIR */
#define ARIZONA_GPN_DIR_MASK                     0x8000  /* GPN_DIR */
#define ARIZONA_GPN_DIR_SHIFT                        15  /* GPN_DIR */
#define ARIZONA_GPN_DIR_WIDTH                         1  /* GPN_DIR */
#define ARIZONA_GPN_PU                           0x4000  /* GPN_PU */
#define ARIZONA_GPN_PU_MASK                      0x4000  /* GPN_PU */
#define ARIZONA_GPN_PU_SHIFT                         14  /* GPN_PU */
#define ARIZONA_GPN_PU_WIDTH                          1  /* GPN_PU */
#define ARIZONA_GPN_PD                           0x2000  /* GPN_PD */
#define ARIZONA_GPN_PD_MASK                      0x2000  /* GPN_PD */
#define ARIZONA_GPN_PD_SHIFT                         13  /* GPN_PD */
#define ARIZONA_GPN_PD_WIDTH                          1  /* GPN_PD */
#define ARIZONA_GPN_LVL                          0x0800  /* GPN_LVL */
#define ARIZONA_GPN_LVL_MASK                     0x0800  /* GPN_LVL */
#define ARIZONA_GPN_LVL_SHIFT                        11  /* GPN_LVL */
#define ARIZONA_GPN_LVL_WIDTH                         1  /* GPN_LVL */
#define ARIZONA_GPN_POL                          0x0400  /* GPN_POL */
#define ARIZONA_GPN_POL_MASK                     0x0400  /* GPN_POL */
#define ARIZONA_GPN_POL_SHIFT                        10  /* GPN_POL */
#define ARIZONA_GPN_POL_WIDTH                         1  /* GPN_POL */
#define ARIZONA_GPN_OP_CFG                       0x0200  /* GPN_OP_CFG */
#define ARIZONA_GPN_OP_CFG_MASK                  0x0200  /* GPN_OP_CFG */
#define ARIZONA_GPN_OP_CFG_SHIFT                      9  /* GPN_OP_CFG */
#define ARIZONA_GPN_OP_CFG_WIDTH                      1  /* GPN_OP_CFG */
#define ARIZONA_GPN_DB                           0x0100  /* GPN_DB */
#define ARIZONA_GPN_DB_MASK                      0x0100  /* GPN_DB */
#define ARIZONA_GPN_DB_SHIFT                          8  /* GPN_DB */
#define ARIZONA_GPN_DB_WIDTH                          1  /* GPN_DB */
#define ARIZONA_GPN_FN_MASK                      0x007F  /* GPN_DB */
#define ARIZONA_GPN_FN_SHIFT                          0  /* GPN_DB */
#define ARIZONA_GPN_FN_WIDTH                          7  /* GPN_DB */

#endif
+6 −0
Original line number Original line Diff line number Diff line
@@ -123,6 +123,7 @@ config SND_SOC_ALL_CODECS
	select SND_SOC_WM8994 if MFD_WM8994
	select SND_SOC_WM8994 if MFD_WM8994
	select SND_SOC_WM8995 if SND_SOC_I2C_AND_SPI
	select SND_SOC_WM8995 if SND_SOC_I2C_AND_SPI
	select SND_SOC_WM8996 if I2C
	select SND_SOC_WM8996 if I2C
	select SND_SOC_WM8997 if MFD_WM8997
	select SND_SOC_WM9081 if I2C
	select SND_SOC_WM9081 if I2C
	select SND_SOC_WM9090 if I2C
	select SND_SOC_WM9090 if I2C
	select SND_SOC_WM9705 if SND_SOC_AC97_BUS
	select SND_SOC_WM9705 if SND_SOC_AC97_BUS
@@ -146,8 +147,10 @@ config SND_SOC_ARIZONA
	tristate
	tristate
	default y if SND_SOC_WM5102=y
	default y if SND_SOC_WM5102=y
	default y if SND_SOC_WM5110=y
	default y if SND_SOC_WM5110=y
	default y if SND_SOC_WM8997=y
	default m if SND_SOC_WM5102=m
	default m if SND_SOC_WM5102=m
	default m if SND_SOC_WM5110=m
	default m if SND_SOC_WM5110=m
	default m if SND_SOC_WM8997=m


config SND_SOC_WM_HUBS
config SND_SOC_WM_HUBS
	tristate
	tristate
@@ -504,6 +507,9 @@ config SND_SOC_WM8995
config SND_SOC_WM8996
config SND_SOC_WM8996
	tristate
	tristate


config SND_SOC_WM8997
	tristate

config SND_SOC_WM9081
config SND_SOC_WM9081
	tristate
	tristate


+2 −0
Original line number Original line Diff line number Diff line
@@ -115,6 +115,7 @@ snd-soc-wm8991-objs := wm8991.o
snd-soc-wm8993-objs := wm8993.o
snd-soc-wm8993-objs := wm8993.o
snd-soc-wm8994-objs := wm8994.o wm8958-dsp2.o
snd-soc-wm8994-objs := wm8994.o wm8958-dsp2.o
snd-soc-wm8995-objs := wm8995.o
snd-soc-wm8995-objs := wm8995.o
snd-soc-wm8997-objs := wm8997.o
snd-soc-wm9081-objs := wm9081.o
snd-soc-wm9081-objs := wm9081.o
snd-soc-wm9090-objs := wm9090.o
snd-soc-wm9090-objs := wm9090.o
snd-soc-wm9705-objs := wm9705.o
snd-soc-wm9705-objs := wm9705.o
@@ -241,6 +242,7 @@ obj-$(CONFIG_SND_SOC_WM8991) += snd-soc-wm8991.o
obj-$(CONFIG_SND_SOC_WM8993)	+= snd-soc-wm8993.o
obj-$(CONFIG_SND_SOC_WM8993)	+= snd-soc-wm8993.o
obj-$(CONFIG_SND_SOC_WM8994)	+= snd-soc-wm8994.o
obj-$(CONFIG_SND_SOC_WM8994)	+= snd-soc-wm8994.o
obj-$(CONFIG_SND_SOC_WM8995)	+= snd-soc-wm8995.o
obj-$(CONFIG_SND_SOC_WM8995)	+= snd-soc-wm8995.o
obj-$(CONFIG_SND_SOC_WM8997)	+= snd-soc-wm8997.o
obj-$(CONFIG_SND_SOC_WM9081)	+= snd-soc-wm9081.o
obj-$(CONFIG_SND_SOC_WM9081)	+= snd-soc-wm9081.o
obj-$(CONFIG_SND_SOC_WM9090)	+= snd-soc-wm9090.o
obj-$(CONFIG_SND_SOC_WM9090)	+= snd-soc-wm9090.o
obj-$(CONFIG_SND_SOC_WM9705)	+= snd-soc-wm9705.o
obj-$(CONFIG_SND_SOC_WM9705)	+= snd-soc-wm9705.o
+66 −3
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@
#include <sound/tlv.h>
#include <sound/tlv.h>


#include <linux/mfd/arizona/core.h>
#include <linux/mfd/arizona/core.h>
#include <linux/mfd/arizona/gpio.h>
#include <linux/mfd/arizona/registers.h>
#include <linux/mfd/arizona/registers.h>


#include "arizona.h"
#include "arizona.h"
@@ -199,9 +200,16 @@ int arizona_init_spk(struct snd_soc_codec *codec)
	if (ret != 0)
	if (ret != 0)
		return ret;
		return ret;


	ret = snd_soc_dapm_new_controls(&codec->dapm, &arizona_spkr, 1);
	switch (arizona->type) {
	case WM8997:
		break;
	default:
		ret = snd_soc_dapm_new_controls(&codec->dapm,
						&arizona_spkr, 1);
		if (ret != 0)
		if (ret != 0)
			return ret;
			return ret;
		break;
	}


	ret = arizona_request_irq(arizona, ARIZONA_IRQ_SPK_SHUTDOWN_WARN,
	ret = arizona_request_irq(arizona, ARIZONA_IRQ_SPK_SHUTDOWN_WARN,
				  "Thermal warning", arizona_thermal_warn,
				  "Thermal warning", arizona_thermal_warn,
@@ -223,6 +231,41 @@ int arizona_init_spk(struct snd_soc_codec *codec)
}
}
EXPORT_SYMBOL_GPL(arizona_init_spk);
EXPORT_SYMBOL_GPL(arizona_init_spk);


int arizona_init_gpio(struct snd_soc_codec *codec)
{
	struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct arizona *arizona = priv->arizona;
	int i;

	switch (arizona->type) {
	case WM5110:
		snd_soc_dapm_disable_pin(&codec->dapm, "DRC2 Signal Activity");
		break;
	default:
		break;
	}

	snd_soc_dapm_disable_pin(&codec->dapm, "DRC1 Signal Activity");

	for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) {
		switch (arizona->pdata.gpio_defaults[i] & ARIZONA_GPN_FN_MASK) {
		case ARIZONA_GP_FN_DRC1_SIGNAL_DETECT:
			snd_soc_dapm_enable_pin(&codec->dapm,
						"DRC1 Signal Activity");
			break;
		case ARIZONA_GP_FN_DRC2_SIGNAL_DETECT:
			snd_soc_dapm_enable_pin(&codec->dapm,
						"DRC2 Signal Activity");
			break;
		default:
			break;
		}
	}

	return 0;
}
EXPORT_SYMBOL_GPL(arizona_init_gpio);

const char *arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS] = {
const char *arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS] = {
	"None",
	"None",
	"Tone Generator 1",
	"Tone Generator 1",
@@ -517,6 +560,26 @@ const struct soc_enum arizona_ng_hold =
			4, arizona_ng_hold_text);
			4, arizona_ng_hold_text);
EXPORT_SYMBOL_GPL(arizona_ng_hold);
EXPORT_SYMBOL_GPL(arizona_ng_hold);


static const char * const arizona_in_dmic_osr_text[] = {
	"1.536MHz", "3.072MHz", "6.144MHz",
};

const struct soc_enum arizona_in_dmic_osr[] = {
	SOC_ENUM_SINGLE(ARIZONA_IN1L_CONTROL, ARIZONA_IN1_OSR_SHIFT,
			ARRAY_SIZE(arizona_in_dmic_osr_text),
			arizona_in_dmic_osr_text),
	SOC_ENUM_SINGLE(ARIZONA_IN2L_CONTROL, ARIZONA_IN2_OSR_SHIFT,
			ARRAY_SIZE(arizona_in_dmic_osr_text),
			arizona_in_dmic_osr_text),
	SOC_ENUM_SINGLE(ARIZONA_IN3L_CONTROL, ARIZONA_IN3_OSR_SHIFT,
			ARRAY_SIZE(arizona_in_dmic_osr_text),
			arizona_in_dmic_osr_text),
	SOC_ENUM_SINGLE(ARIZONA_IN4L_CONTROL, ARIZONA_IN4_OSR_SHIFT,
			ARRAY_SIZE(arizona_in_dmic_osr_text),
			arizona_in_dmic_osr_text),
};
EXPORT_SYMBOL_GPL(arizona_in_dmic_osr);

static void arizona_in_set_vu(struct snd_soc_codec *codec, int ena)
static void arizona_in_set_vu(struct snd_soc_codec *codec, int ena)
{
{
	struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
	struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
+4 −1
Original line number Original line Diff line number Diff line
@@ -150,7 +150,8 @@ extern int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS];
	ARIZONA_MUX(name_str " Aux 5", &name##_aux5_mux), \
	ARIZONA_MUX(name_str " Aux 5", &name##_aux5_mux), \
	ARIZONA_MUX(name_str " Aux 6", &name##_aux6_mux)
	ARIZONA_MUX(name_str " Aux 6", &name##_aux6_mux)


#define ARIZONA_MUX_ROUTES(name) \
#define ARIZONA_MUX_ROUTES(widget, name) \
	{ widget, NULL, name " Input" }, \
	ARIZONA_MIXER_INPUT_ROUTES(name " Input")
	ARIZONA_MIXER_INPUT_ROUTES(name " Input")


#define ARIZONA_MIXER_ROUTES(widget, name) \
#define ARIZONA_MIXER_ROUTES(widget, name) \
@@ -198,6 +199,7 @@ extern const struct soc_enum arizona_lhpf3_mode;
extern const struct soc_enum arizona_lhpf4_mode;
extern const struct soc_enum arizona_lhpf4_mode;


extern const struct soc_enum arizona_ng_hold;
extern const struct soc_enum arizona_ng_hold;
extern const struct soc_enum arizona_in_dmic_osr[];


extern int arizona_in_ev(struct snd_soc_dapm_widget *w,
extern int arizona_in_ev(struct snd_soc_dapm_widget *w,
			 struct snd_kcontrol *kcontrol,
			 struct snd_kcontrol *kcontrol,
@@ -242,6 +244,7 @@ extern int arizona_set_fll(struct arizona_fll *fll, int source,
			   unsigned int Fref, unsigned int Fout);
			   unsigned int Fref, unsigned int Fout);


extern int arizona_init_spk(struct snd_soc_codec *codec);
extern int arizona_init_spk(struct snd_soc_codec *codec);
extern int arizona_init_gpio(struct snd_soc_codec *codec);


extern int arizona_init_dai(struct arizona_priv *priv, int dai);
extern int arizona_init_dai(struct arizona_priv *priv, int dai);


Loading