Commit 29793990 authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Lee Jones

mfd: madera: Add Madera core support for CS47L92

This patch adds all the core support and defines for the Cirrus
Logic CS42L92, CS47L92 and CS47L93 smart audio CODECs.

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 avatarStuart Henderson <stuarth@opensource.cirrus.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 avatarLee Jones <lee.jones@linaro.org>
parent 1ef921b6
......@@ -288,6 +288,13 @@ config MFD_CS47L90
help
Support for Cirrus Logic CS47L90 and CS47L91 Smart Codecs
config MFD_CS47L92
bool "Cirrus Logic CS47L92/93"
select PINCTRL_CS47L92
depends on MFD_MADERA
help
Support for Cirrus Logic CS42L92, CS47L92 and CS47L93 Smart Codecs
config MFD_ASIC3
bool "Compaq ASIC3"
depends on GPIOLIB && ARM
......
......@@ -87,6 +87,9 @@ endif
ifeq ($(CONFIG_MFD_CS47L90),y)
madera-objs += cs47l90-tables.o
endif
ifeq ($(CONFIG_MFD_CS47L92),y)
madera-objs += cs47l92-tables.o
endif
obj-$(CONFIG_MFD_MADERA) += madera.o
obj-$(CONFIG_MFD_MADERA_I2C) += madera-i2c.o
obj-$(CONFIG_MFD_MADERA_SPI) += madera-spi.o
......
This diff is collapsed.
......@@ -35,6 +35,7 @@
#define CS47L35_SILICON_ID 0x6360
#define CS47L85_SILICON_ID 0x6338
#define CS47L90_SILICON_ID 0x6364
#define CS47L92_SILICON_ID 0x6371
#define MADERA_32KZ_MCLK2 1
......@@ -148,6 +149,29 @@ static const struct mfd_cell cs47l90_devs[] = {
},
};
static const char * const cs47l92_supplies[] = {
"MICVDD",
"CPVDD1",
"CPVDD2",
};
static const struct mfd_cell cs47l92_devs[] = {
{ .name = "madera-pinctrl" },
{ .name = "madera-irq", },
{ .name = "madera-micsupp", },
{ .name = "madera-gpio" },
{
.name = "madera-extcon",
.parent_supplies = cs47l92_supplies,
.num_parent_supplies = 1, /* We only need MICVDD */
},
{
.name = "cs47l92-codec",
.parent_supplies = cs47l92_supplies,
.num_parent_supplies = ARRAY_SIZE(cs47l92_supplies),
},
};
/* Used by madera-i2c and madera-spi drivers */
const char *madera_name_from_type(enum madera_type type)
{
......@@ -162,6 +186,12 @@ const char *madera_name_from_type(enum madera_type type)
return "CS47L90";
case CS47L91:
return "CS47L91";
case CS42L92:
return "CS42L92";
case CS47L92:
return "CS47L92";
case CS47L93:
return "CS47L93";
case WM1840:
return "WM1840";
default:
......@@ -321,6 +351,9 @@ const struct of_device_id madera_of_match[] = {
{ .compatible = "cirrus,cs47l85", .data = (void *)CS47L85 },
{ .compatible = "cirrus,cs47l90", .data = (void *)CS47L90 },
{ .compatible = "cirrus,cs47l91", .data = (void *)CS47L91 },
{ .compatible = "cirrus,cs42l92", .data = (void *)CS42L92 },
{ .compatible = "cirrus,cs47l92", .data = (void *)CS47L92 },
{ .compatible = "cirrus,cs47l93", .data = (void *)CS47L93 },
{ .compatible = "cirrus,wm1840", .data = (void *)WM1840 },
{}
};
......@@ -385,6 +418,13 @@ static void madera_set_micbias_info(struct madera *madera)
madera->num_childbias[0] = 4;
madera->num_childbias[1] = 4;
return;
case CS42L92:
case CS47L92:
case CS47L93:
madera->num_micbias = 2;
madera->num_childbias[0] = 4;
madera->num_childbias[1] = 2;
return;
default:
return;
}
......@@ -436,6 +476,9 @@ int madera_dev_init(struct madera *madera)
case CS47L35:
case CS47L90:
case CS47L91:
case CS42L92:
case CS47L92:
case CS47L93:
break;
case CS47L85:
case WM1840:
......@@ -556,6 +599,21 @@ int madera_dev_init(struct madera *madera)
}
}
break;
case CS47L92_SILICON_ID:
if (IS_ENABLED(CONFIG_MFD_CS47L92)) {
switch (madera->type) {
case CS42L92:
case CS47L92:
case CS47L93:
patch_fn = cs47l92_patch;
mfd_devs = cs47l92_devs;
n_devs = ARRAY_SIZE(cs47l92_devs);
break;
default:
break;
}
}
break;
default:
dev_err(madera->dev, "Unknown device ID: %x\n", hwid);
ret = -EINVAL;
......
......@@ -65,6 +65,14 @@ static int madera_i2c_probe(struct i2c_client *i2c,
regmap_32bit_config = &cs47l90_32bit_i2c_regmap;
}
break;
case CS42L92:
case CS47L92:
case CS47L93:
if (IS_ENABLED(CONFIG_MFD_CS47L92)) {
regmap_16bit_config = &cs47l92_16bit_i2c_regmap;
regmap_32bit_config = &cs47l92_32bit_i2c_regmap;
}
break;
default:
dev_err(&i2c->dev,
"Unknown Madera I2C device type %ld\n", type);
......@@ -124,6 +132,9 @@ static const struct i2c_device_id madera_i2c_id[] = {
{ "cs47l85", CS47L85 },
{ "cs47l90", CS47L90 },
{ "cs47l91", CS47L91 },
{ "cs42l92", CS42L92 },
{ "cs47l92", CS47L92 },
{ "cs47l93", CS47L93 },
{ "wm1840", WM1840 },
{ }
};
......
......@@ -65,6 +65,14 @@ static int madera_spi_probe(struct spi_device *spi)
regmap_32bit_config = &cs47l90_32bit_spi_regmap;
}
break;
case CS42L92:
case CS47L92:
case CS47L93:
if (IS_ENABLED(CONFIG_MFD_CS47L92)) {
regmap_16bit_config = &cs47l92_16bit_spi_regmap;
regmap_32bit_config = &cs47l92_32bit_spi_regmap;
}
break;
default:
dev_err(&spi->dev,
"Unknown Madera SPI device type %ld\n", type);
......@@ -123,6 +131,9 @@ static const struct spi_device_id madera_spi_ids[] = {
{ "cs47l85", CS47L85 },
{ "cs47l90", CS47L90 },
{ "cs47l91", CS47L91 },
{ "cs42l92", CS42L92 },
{ "cs47l92", CS47L92 },
{ "cs47l93", CS47L93 },
{ "wm1840", WM1840 },
{ }
};
......
......@@ -47,4 +47,11 @@ extern const struct regmap_config cs47l90_32bit_spi_regmap;
extern const struct regmap_config cs47l90_16bit_i2c_regmap;
extern const struct regmap_config cs47l90_32bit_i2c_regmap;
int cs47l90_patch(struct madera *madera);
extern const struct regmap_config cs47l92_16bit_spi_regmap;
extern const struct regmap_config cs47l92_32bit_spi_regmap;
extern const struct regmap_config cs47l92_16bit_i2c_regmap;
extern const struct regmap_config cs47l92_32bit_i2c_regmap;
int cs47l92_patch(struct madera *madera);
#endif
......@@ -26,8 +26,11 @@ enum madera_type {
CS47L85 = 2,
CS47L90 = 3,
CS47L91 = 4,
CS47L92 = 5,
CS47L93 = 6,
WM1840 = 7,
CS47L15 = 8,
CS42L92 = 9,
};
#define MADERA_MAX_CORE_SUPPLIES 2
......@@ -37,6 +40,7 @@ enum madera_type {
#define CS47L35_NUM_GPIOS 16
#define CS47L85_NUM_GPIOS 40
#define CS47L90_NUM_GPIOS 38
#define CS47L92_NUM_GPIOS 16
#define MADERA_MAX_MICBIAS 4
......
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