Commit 1ef921b6 authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Lee Jones

mfd: madera: Add Madera core support for CS47L15

This patch adds all the core support and defines for the Cirrus
Logic CS47L15 smart audio CODEC.

Registers or fields are named MADERA_* if it is part of the
common hardware platform and does not conflict with any other
Madera codecs. It is named CS47L15_* if it is unique to CS47L15
and conflicts with definitions on other codecs.
Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 8f759058
......@@ -260,6 +260,13 @@ config MFD_MADERA_SPI
Support for the Cirrus Logic Madera platform audio SoC
core functionality controlled via SPI.
config MFD_CS47L15
bool "Cirrus Logic CS47L15"
select PINCTRL_CS47L15
depends on MFD_MADERA
help
Support for Cirrus Logic CS47L15 Smart Codec
config MFD_CS47L35
bool "Cirrus Logic CS47L35"
select PINCTRL_CS47L35
......
......@@ -75,6 +75,9 @@ obj-$(CONFIG_MFD_WM8994) += wm8994.o
obj-$(CONFIG_MFD_WM97xx) += wm97xx-core.o
madera-objs := madera-core.o
ifeq ($(CONFIG_MFD_CS47L15),y)
madera-objs += cs47l15-tables.o
endif
ifeq ($(CONFIG_MFD_CS47L35),y)
madera-objs += cs47l35-tables.o
endif
......
This diff is collapsed.
......@@ -31,6 +31,7 @@
#include "madera.h"
#define CS47L15_SILICON_ID 0x6370
#define CS47L35_SILICON_ID 0x6360
#define CS47L85_SILICON_ID 0x6338
#define CS47L90_SILICON_ID 0x6364
......@@ -46,6 +47,28 @@ static const struct mfd_cell madera_ldo1_devs[] = {
{ .name = "madera-ldo1" },
};
static const char * const cs47l15_supplies[] = {
"MICVDD",
"CPVDD1",
"SPKVDD",
};
static const struct mfd_cell cs47l15_devs[] = {
{ .name = "madera-pinctrl", },
{ .name = "madera-irq" },
{ .name = "madera-gpio" },
{
.name = "madera-extcon",
.parent_supplies = cs47l15_supplies,
.num_parent_supplies = 1, /* We only need MICVDD */
},
{
.name = "cs47l15-codec",
.parent_supplies = cs47l15_supplies,
.num_parent_supplies = ARRAY_SIZE(cs47l15_supplies),
},
};
static const char * const cs47l35_supplies[] = {
"MICVDD",
"DBVDD2",
......@@ -129,6 +152,8 @@ static const struct mfd_cell cs47l90_devs[] = {
const char *madera_name_from_type(enum madera_type type)
{
switch (type) {
case CS47L15:
return "CS47L15";
case CS47L35:
return "CS47L35";
case CS47L85:
......@@ -291,6 +316,7 @@ const struct dev_pm_ops madera_pm_ops = {
EXPORT_SYMBOL_GPL(madera_pm_ops);
const struct of_device_id madera_of_match[] = {
{ .compatible = "cirrus,cs47l15", .data = (void *)CS47L15 },
{ .compatible = "cirrus,cs47l35", .data = (void *)CS47L35 },
{ .compatible = "cirrus,cs47l85", .data = (void *)CS47L85 },
{ .compatible = "cirrus,cs47l90", .data = (void *)CS47L90 },
......@@ -339,6 +365,10 @@ static void madera_set_micbias_info(struct madera *madera)
* childbiases for each micbias. Unspecified values default to 0.
*/
switch (madera->type) {
case CS47L15:
madera->num_micbias = 1;
madera->num_childbias[0] = 3;
return;
case CS47L35:
madera->num_micbias = 2;
madera->num_childbias[0] = 2;
......@@ -402,6 +432,7 @@ int madera_dev_init(struct madera *madera)
* No devm_ because we need to control shutdown order of children.
*/
switch (madera->type) {
case CS47L15:
case CS47L35:
case CS47L90:
case CS47L91:
......@@ -471,6 +502,19 @@ int madera_dev_init(struct madera *madera)
}
switch (hwid) {
case CS47L15_SILICON_ID:
if (IS_ENABLED(CONFIG_MFD_CS47L15)) {
switch (madera->type) {
case CS47L15:
patch_fn = &cs47l15_patch;
mfd_devs = cs47l15_devs;
n_devs = ARRAY_SIZE(cs47l15_devs);
break;
default:
break;
}
}
break;
case CS47L35_SILICON_ID:
if (IS_ENABLED(CONFIG_MFD_CS47L35)) {
switch (madera->type) {
......
......@@ -39,6 +39,12 @@ static int madera_i2c_probe(struct i2c_client *i2c,
type = id->driver_data;
switch (type) {
case CS47L15:
if (IS_ENABLED(CONFIG_MFD_CS47L15)) {
regmap_16bit_config = &cs47l15_16bit_i2c_regmap;
regmap_32bit_config = &cs47l15_32bit_i2c_regmap;
}
break;
case CS47L35:
if (IS_ENABLED(CONFIG_MFD_CS47L35)) {
regmap_16bit_config = &cs47l35_16bit_i2c_regmap;
......@@ -113,6 +119,7 @@ static int madera_i2c_remove(struct i2c_client *i2c)
}
static const struct i2c_device_id madera_i2c_id[] = {
{ "cs47l15", CS47L15 },
{ "cs47l35", CS47L35 },
{ "cs47l85", CS47L85 },
{ "cs47l90", CS47L90 },
......
......@@ -39,6 +39,12 @@ static int madera_spi_probe(struct spi_device *spi)
type = id->driver_data;
switch (type) {
case CS47L15:
if (IS_ENABLED(CONFIG_MFD_CS47L15)) {
regmap_16bit_config = &cs47l15_16bit_spi_regmap;
regmap_32bit_config = &cs47l15_32bit_spi_regmap;
}
break;
case CS47L35:
if (IS_ENABLED(CONFIG_MFD_CS47L35)) {
regmap_16bit_config = &cs47l35_16bit_spi_regmap;
......@@ -112,6 +118,7 @@ static int madera_spi_remove(struct spi_device *spi)
}
static const struct spi_device_id madera_spi_ids[] = {
{ "cs47l15", CS47L15 },
{ "cs47l35", CS47L35 },
{ "cs47l85", CS47L85 },
{ "cs47l90", CS47L90 },
......
......@@ -24,6 +24,12 @@ int madera_dev_exit(struct madera *madera);
const char *madera_name_from_type(enum madera_type type);
extern const struct regmap_config cs47l15_16bit_spi_regmap;
extern const struct regmap_config cs47l15_32bit_spi_regmap;
extern const struct regmap_config cs47l15_16bit_i2c_regmap;
extern const struct regmap_config cs47l15_32bit_i2c_regmap;
int cs47l15_patch(struct madera *madera);
extern const struct regmap_config cs47l35_16bit_spi_regmap;
extern const struct regmap_config cs47l35_32bit_spi_regmap;
extern const struct regmap_config cs47l35_16bit_i2c_regmap;
......
......@@ -27,11 +27,13 @@ enum madera_type {
CS47L90 = 3,
CS47L91 = 4,
WM1840 = 7,
CS47L15 = 8,
};
#define MADERA_MAX_CORE_SUPPLIES 2
#define MADERA_MAX_GPIOS 40
#define CS47L15_NUM_GPIOS 15
#define CS47L35_NUM_GPIOS 16
#define CS47L85_NUM_GPIOS 40
#define CS47L90_NUM_GPIOS 38
......
......@@ -244,6 +244,8 @@
#define MADERA_IN6R_CONTROL 0x33C
#define MADERA_ADC_DIGITAL_VOLUME_6R 0x33D
#define MADERA_DMIC6R_CONTROL 0x33E
#define CS47L15_ADC_INT_BIAS 0x3A8
#define CS47L15_PGA_BIAS_SEL 0x3C4
#define MADERA_OUTPUT_ENABLES_1 0x400
#define MADERA_OUTPUT_STATUS_1 0x401
#define MADERA_RAW_OUTPUT_STATUS_1 0x406
......@@ -1202,6 +1204,8 @@
#define MADERA_GPIO1_CTRL_2 0x1701
#define MADERA_GPIO2_CTRL_1 0x1702
#define MADERA_GPIO2_CTRL_2 0x1703
#define MADERA_GPIO15_CTRL_1 0x171C
#define MADERA_GPIO15_CTRL_2 0x171D
#define MADERA_GPIO16_CTRL_1 0x171E
#define MADERA_GPIO16_CTRL_2 0x171F
#define MADERA_GPIO38_CTRL_1 0x174A
......@@ -1232,6 +1236,7 @@
#define MADERA_IRQ2_CTRL 0x1A82
#define MADERA_INTERRUPT_RAW_STATUS_1 0x1AA0
#define MADERA_WSEQ_SEQUENCE_1 0x3000
#define MADERA_WSEQ_SEQUENCE_225 0x31C0
#define MADERA_WSEQ_SEQUENCE_252 0x31F6
#define CS47L35_OTP_HPDET_CAL_1 0x31F8
#define CS47L35_OTP_HPDET_CAL_2 0x31FA
......
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