Commit 2735b683 authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Mark Brown

ASoC: madera: Add common support for Cirrus Logic Madera codecs

The Cirrus Logic Madera codecs are a family of related codecs with
extensive digital and analogue I/O, digital mixing and routing,
signal processing and programmable DSPs. This patch adds common
support code shared by all Madera codecs.

This patch also adds the pdata to the parent mfd pdata struct.
Since there is a circular build dependency it's convenient to
patch them both atomically.
Signed-off-by: default avatarNariman Poushin <nariman@opensource.cirrus.com>
Signed-off-by: default avatarNikesh Oswal <Nikesh.Oswal@cirrus.com>
Signed-off-by: default avatarPiotr Stankiewicz <piotrs@opensource.cirrus.com>
Signed-off-by: default avatarAjit Pandey <ajit.pandey@incubesol.com>
Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f0b1f5f0
......@@ -3915,14 +3915,18 @@ W: https://github.com/CirrusLogic/linux-drivers/wiki
S: Supported
F: Documentation/devicetree/bindings/mfd/madera.txt
F: Documentation/devicetree/bindings/pinctrl/cirrus,madera-pinctrl.txt
F: Documentation/devicetree/bindings/sound/madera.txt
F: include/dt-bindings/sound/madera*
F: include/linux/irqchip/irq-madera*
F: include/linux/mfd/madera/*
F: include/sound/madera*
F: drivers/gpio/gpio-madera*
F: drivers/irqchip/irq-madera*
F: drivers/mfd/madera*
F: drivers/mfd/cs47l*
F: drivers/pinctrl/cirrus/*
F: sound/soc/codecs/cs47l*
F: sound/soc/codecs/madera*
CLANG-FORMAT FILE
M: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
......
......@@ -16,6 +16,7 @@
#include <linux/regulator/arizona-ldo1.h>
#include <linux/regulator/arizona-micsupp.h>
#include <linux/regulator/machine.h>
#include <sound/madera-pdata.h>
#define MADERA_MAX_MICBIAS 4
#define MADERA_MAX_CHILD_MICBIAS 4
......@@ -39,6 +40,7 @@ struct madera_codec_pdata;
* @gpsw: General purpose switch mode setting. Depends on the external
* hardware connected to the switch. (See the SW1_MODE field
* in the datasheet for the available values for your codec)
* @codec: Substruct of pdata for the ASoC codec driver
*/
struct madera_pdata {
struct gpio_desc *reset;
......@@ -53,6 +55,8 @@ struct madera_pdata {
int n_gpio_configs;
u32 gpsw[MADERA_MAX_GPSW];
struct madera_codec_pdata codec;
};
#endif
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Platform data for Madera codec driver
*
* Copyright (C) 2016-2019 Cirrus Logic, Inc. and
* Cirrus Logic International Semiconductor Ltd.
*
* 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 MADERA_CODEC_PDATA_H
#define MADERA_CODEC_PDATA_H
#include <linux/kernel.h>
#define MADERA_MAX_INPUT 6
#define MADERA_MAX_MUXED_CHANNELS 4
#define MADERA_MAX_OUTPUT 6
#define MADERA_MAX_AIF 4
#define MADERA_MAX_PDM_SPK 2
#define MADERA_MAX_DSP 7
/**
* struct madera_codec_pdata
*
* @max_channels_clocked: Maximum number of channels that I2S clocks will be
* generated for. Useful when clock master for systems
* where the I2S bus has multiple data lines.
* @dmic_ref: Indicates how the MICBIAS pins have been externally
* connected to DMICs on each input. A value of 0
* indicates MICVDD and is the default. Other values are:
* For CS47L35 one of the CS47L35_DMIC_REF_xxx values
* For all other codecs one of the MADERA_DMIC_REF_xxx
* Also see the datasheet for a description of the
* INn_DMIC_SUP field.
* @inmode: Mode for the ADC inputs. One of the MADERA_INMODE_xxx
* values. Two-dimensional array
* [input_number][channel number], with four slots per
* input in the order
* [n][0]=INnAL [n][1]=INnAR [n][2]=INnBL [n][3]=INnBR
* @out_mono: For each output set the value to TRUE to indicate that
* the output is mono. [0]=OUT1, [1]=OUT2, ...
* @pdm_fmt: PDM speaker data format. See the PDM_SPKn_FMT field in
* the datasheet for a description of this value.
* @pdm_mute: PDM mute format. See the PDM_SPKn_CTRL_1 register
* in the datasheet for a description of this value.
*/
struct madera_codec_pdata {
u32 max_channels_clocked[MADERA_MAX_AIF];
u32 dmic_ref[MADERA_MAX_INPUT];
u32 inmode[MADERA_MAX_INPUT][MADERA_MAX_MUXED_CHANNELS];
bool out_mono[MADERA_MAX_OUTPUT];
u32 pdm_fmt[MADERA_MAX_PDM_SPK];
u32 pdm_mute[MADERA_MAX_PDM_SPK];
};
#endif
......@@ -284,10 +284,12 @@ config SND_SOC_WM_HUBS
config SND_SOC_WM_ADSP
tristate
select SND_SOC_COMPRESS
default y if SND_SOC_MADERA=y
default y if SND_SOC_CS47L24=y
default y if SND_SOC_WM5102=y
default y if SND_SOC_WM5110=y
default y if SND_SOC_WM2200=y
default m if SND_SOC_MADERA=m
default m if SND_SOC_CS47L24=m
default m if SND_SOC_WM5102=m
default m if SND_SOC_WM5110=m
......@@ -704,6 +706,9 @@ config SND_SOC_LOCHNAGAR_SC
This driver support the sound card functionality of the Cirrus
Logic Lochnagar audio development board.
config SND_SOC_MADERA
tristate
config SND_SOC_MAX98088
tristate "Maxim MAX98088/9 Low-Power, Stereo Audio Codec"
depends on I2C
......
......@@ -93,6 +93,7 @@ snd-soc-l3-objs := l3.o
snd-soc-lm4857-objs := lm4857.o
snd-soc-lm49453-objs := lm49453.o
snd-soc-lochnagar-sc-objs := lochnagar-sc.o
snd-soc-madera-objs := madera.o
snd-soc-max9759-objs := max9759.o
snd-soc-max9768-objs := max9768.o
snd-soc-max98088-objs := max98088.o
......@@ -369,6 +370,7 @@ obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o
obj-$(CONFIG_SND_SOC_LM4857) += snd-soc-lm4857.o
obj-$(CONFIG_SND_SOC_LM49453) += snd-soc-lm49453.o
obj-$(CONFIG_SND_SOC_LOCHNAGAR_SC) += snd-soc-lochnagar-sc.o
obj-$(CONFIG_SND_SOC_MADERA) += snd-soc-madera.o
obj-$(CONFIG_SND_SOC_MAX9759) += snd-soc-max9759.o
obj-$(CONFIG_SND_SOC_MAX9768) += snd-soc-max9768.o
obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment