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

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

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
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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
+3 −0
Original line number Diff line number Diff line
@@ -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
+1301 −0

File added.

Preview size limit exceeded, changes collapsed.

+44 −0
Original line number Diff line number Diff line
@@ -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) {
+7 −0
Original line number Diff line number Diff line
@@ -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 },
Loading