mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-08-18 02:22:47 -07:00
mfd: madera: Add common support for Cirrus Logic Madera codecs
This adds the generic core support for Cirrus Logic "Madera" class codecs. These are complex audio codec SoCs with a variety of digital and analogue I/O, onboard audio processing and DSPs, and other features. These codecs are all based off a common set of hardware IP so can be supported by a core of common code (with a few minor device-to-device variations). Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Nikesh Oswal <Nikesh.Oswal@cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
1 parent
2b49088cdb
commit
16b27467f4
9 files changed
+1215
No files matched your search
@@ -3487,7 +3487,10 @@ L: patches@opensource.cirrus.com
|
||||
T: git https://github.com/CirrusLogic/linux-drivers.git
|
||||
W: https://github.com/CirrusLogic/linux-drivers/wiki
|
||||
S: Supported
|
||||
F: Documentation/devicetree/bindings/mfd/madera.txt
|
||||
F: include/linux/mfd/madera/*
|
||||
F: drivers/mfd/madera*
|
||||
F: drivers/mfd/cs47l*
|
||||
|
||||
CLEANCACHE API
|
||||
M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
|
||||
@@ -232,6 +232,35 @@ config MFD_CROS_EC_CHARDEV
|
||||
If you have a supported Chromebook, choose Y or M here.
|
||||
The module will be called cros_ec_dev.
|
||||
|
||||
config MFD_MADERA
|
||||
tristate "Cirrus Logic Madera codecs"
|
||||
select MFD_CORE
|
||||
select REGMAP
|
||||
select REGMAP_IRQ
|
||||
select MADERA_IRQ
|
||||
select PINCTRL
|
||||
select PINCTRL_MADERA
|
||||
help
|
||||
Support for the Cirrus Logic Madera platform audio codecs
|
||||
|
||||
config MFD_MADERA_I2C
|
||||
tristate "Cirrus Logic Madera codecs with I2C"
|
||||
depends on MFD_MADERA
|
||||
depends on I2C
|
||||
select REGMAP_I2C
|
||||
help
|
||||
Support for the Cirrus Logic Madera platform audio SoC
|
||||
core functionality controlled via I2C.
|
||||
|
||||
config MFD_MADERA_SPI
|
||||
tristate "Cirrus Logic Madera codecs with SPI"
|
||||
depends on MFD_MADERA
|
||||
depends on SPI_MASTER
|
||||
select REGMAP_SPI
|
||||
help
|
||||
Support for the Cirrus Logic Madera platform audio SoC
|
||||
core functionality controlled via SPI.
|
||||
|
||||
config MFD_ASIC3
|
||||
bool "Compaq ASIC3"
|
||||
depends on GPIOLIB && ARM
|
||||
|
||||
@@ -73,6 +73,11 @@ wm8994-objs := wm8994-core.o wm8994-irq.o wm8994-regmap.o
|
||||
obj-$(CONFIG_MFD_WM8994) += wm8994.o
|
||||
obj-$(CONFIG_MFD_WM97xx) += wm97xx-core.o
|
||||
|
||||
madera-objs := madera-core.o
|
||||
obj-$(CONFIG_MFD_MADERA) += madera.o
|
||||
obj-$(CONFIG_MFD_MADERA_I2C) += madera-i2c.o
|
||||
obj-$(CONFIG_MFD_MADERA_SPI) += madera-spi.o
|
||||
|
||||
obj-$(CONFIG_TPS6105X) += tps6105x.o
|
||||
obj-$(CONFIG_TPS65010) += tps65010.o
|
||||
obj-$(CONFIG_TPS6507X) += tps6507x.o
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,140 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* I2C bus interface to Cirrus Logic Madera codecs
|
||||
*
|
||||
* Copyright (C) 2015-2018 Cirrus Logic
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; version 2.
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#include <linux/mfd/madera/core.h>
|
||||
|
||||
#include "madera.h"
|
||||
|
||||
static int madera_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct madera *madera;
|
||||
const struct regmap_config *regmap_16bit_config = NULL;
|
||||
const struct regmap_config *regmap_32bit_config = NULL;
|
||||
const void *of_data;
|
||||
unsigned long type;
|
||||
const char *name;
|
||||
int ret;
|
||||
|
||||
of_data = of_device_get_match_data(&i2c->dev);
|
||||
if (of_data)
|
||||
type = (unsigned long)of_data;
|
||||
else
|
||||
type = id->driver_data;
|
||||
|
||||
switch (type) {
|
||||
case CS47L35:
|
||||
if (IS_ENABLED(CONFIG_MFD_CS47L35)) {
|
||||
regmap_16bit_config = &cs47l35_16bit_i2c_regmap;
|
||||
regmap_32bit_config = &cs47l35_32bit_i2c_regmap;
|
||||
}
|
||||
break;
|
||||
case CS47L85:
|
||||
case WM1840:
|
||||
if (IS_ENABLED(CONFIG_MFD_CS47L85)) {
|
||||
regmap_16bit_config = &cs47l85_16bit_i2c_regmap;
|
||||
regmap_32bit_config = &cs47l85_32bit_i2c_regmap;
|
||||
}
|
||||
break;
|
||||
case CS47L90:
|
||||
case CS47L91:
|
||||
if (IS_ENABLED(CONFIG_MFD_CS47L90)) {
|
||||
regmap_16bit_config = &cs47l90_16bit_i2c_regmap;
|
||||
regmap_32bit_config = &cs47l90_32bit_i2c_regmap;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
dev_err(&i2c->dev,
|
||||
"Unknown Madera I2C device type %ld\n", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
name = madera_name_from_type(type);
|
||||
|
||||
if (!regmap_16bit_config) {
|
||||
/* it's polite to say which codec isn't built into the kernel */
|
||||
dev_err(&i2c->dev,
|
||||
"Kernel does not include support for %s\n", name);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
madera = devm_kzalloc(&i2c->dev, sizeof(*madera), GFP_KERNEL);
|
||||
if (!madera)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
madera->regmap = devm_regmap_init_i2c(i2c, regmap_16bit_config);
|
||||
if (IS_ERR(madera->regmap)) {
|
||||
ret = PTR_ERR(madera->regmap);
|
||||
dev_err(&i2c->dev,
|
||||
"Failed to allocate 16-bit register map: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
madera->regmap_32bit = devm_regmap_init_i2c(i2c, regmap_32bit_config);
|
||||
if (IS_ERR(madera->regmap_32bit)) {
|
||||
ret = PTR_ERR(madera->regmap_32bit);
|
||||
dev_err(&i2c->dev,
|
||||
"Failed to allocate 32-bit register map: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
madera->type = type;
|
||||
madera->type_name = name;
|
||||
madera->dev = &i2c->dev;
|
||||
madera->irq = i2c->irq;
|
||||
|
||||
return madera_dev_init(madera);
|
||||
}
|
||||
|
||||
static int madera_i2c_remove(struct i2c_client *i2c)
|
||||
{
|
||||
struct madera *madera = dev_get_drvdata(&i2c->dev);
|
||||
|
||||
madera_dev_exit(madera);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id madera_i2c_id[] = {
|
||||
{ "cs47l35", CS47L35 },
|
||||
{ "cs47l85", CS47L85 },
|
||||
{ "cs47l90", CS47L90 },
|
||||
{ "cs47l91", CS47L91 },
|
||||
{ "wm1840", WM1840 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, madera_i2c_id);
|
||||
|
||||
static struct i2c_driver madera_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "madera",
|
||||
.pm = &madera_pm_ops,
|
||||
.of_match_table = of_match_ptr(madera_of_match),
|
||||
},
|
||||
.probe = madera_i2c_probe,
|
||||
.remove = madera_i2c_remove,
|
||||
.id_table = madera_i2c_id,
|
||||
};
|
||||
|
||||
module_i2c_driver(madera_i2c_driver);
|
||||
|
||||
MODULE_DESCRIPTION("Madera I2C bus interface");
|
||||
MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.cirrus.com>");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
@@ -0,0 +1,139 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* SPI bus interface to Cirrus Logic Madera codecs
|
||||
*
|
||||
* Copyright (C) 2015-2018 Cirrus Logic
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; version 2.
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/spi/spi.h>
|
||||
|
||||
#include <linux/mfd/madera/core.h>
|
||||
|
||||
#include "madera.h"
|
||||
|
||||
static int madera_spi_probe(struct spi_device *spi)
|
||||
{
|
||||
const struct spi_device_id *id = spi_get_device_id(spi);
|
||||
struct madera *madera;
|
||||
const struct regmap_config *regmap_16bit_config = NULL;
|
||||
const struct regmap_config *regmap_32bit_config = NULL;
|
||||
const void *of_data;
|
||||
unsigned long type;
|
||||
const char *name;
|
||||
int ret;
|
||||
|
||||
of_data = of_device_get_match_data(&spi->dev);
|
||||
if (of_data)
|
||||
type = (unsigned long)of_data;
|
||||
else
|
||||
type = id->driver_data;
|
||||
|
||||
switch (type) {
|
||||
case CS47L35:
|
||||
if (IS_ENABLED(CONFIG_MFD_CS47L35)) {
|
||||
regmap_16bit_config = &cs47l35_16bit_spi_regmap;
|
||||
regmap_32bit_config = &cs47l35_32bit_spi_regmap;
|
||||
}
|
||||
break;
|
||||
case CS47L85:
|
||||
case WM1840:
|
||||
if (IS_ENABLED(CONFIG_MFD_CS47L85)) {
|
||||
regmap_16bit_config = &cs47l85_16bit_spi_regmap;
|
||||
regmap_32bit_config = &cs47l85_32bit_spi_regmap;
|
||||
}
|
||||
break;
|
||||
case CS47L90:
|
||||
case CS47L91:
|
||||
if (IS_ENABLED(CONFIG_MFD_CS47L90)) {
|
||||
regmap_16bit_config = &cs47l90_16bit_spi_regmap;
|
||||
regmap_32bit_config = &cs47l90_32bit_spi_regmap;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
dev_err(&spi->dev,
|
||||
"Unknown Madera SPI device type %ld\n", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
name = madera_name_from_type(type);
|
||||
|
||||
if (!regmap_16bit_config) {
|
||||
/* it's polite to say which codec isn't built into the kernel */
|
||||
dev_err(&spi->dev,
|
||||
"Kernel does not include support for %s\n", name);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
madera = devm_kzalloc(&spi->dev, sizeof(*madera), GFP_KERNEL);
|
||||
if (!madera)
|
||||
return -ENOMEM;
|
||||
|
||||
madera->regmap = devm_regmap_init_spi(spi, regmap_16bit_config);
|
||||
if (IS_ERR(madera->regmap)) {
|
||||
ret = PTR_ERR(madera->regmap);
|
||||
dev_err(&spi->dev,
|
||||
"Failed to allocate 16-bit register map: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
madera->regmap_32bit = devm_regmap_init_spi(spi, regmap_32bit_config);
|
||||
if (IS_ERR(madera->regmap_32bit)) {
|
||||
ret = PTR_ERR(madera->regmap_32bit);
|
||||
dev_err(&spi->dev,
|
||||
"Failed to allocate 32-bit register map: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
madera->type = type;
|
||||
madera->type_name = name;
|
||||
madera->dev = &spi->dev;
|
||||
madera->irq = spi->irq;
|
||||
|
||||
return madera_dev_init(madera);
|
||||
}
|
||||
|
||||
static int madera_spi_remove(struct spi_device *spi)
|
||||
{
|
||||
struct madera *madera = spi_get_drvdata(spi);
|
||||
|
||||
madera_dev_exit(madera);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct spi_device_id madera_spi_ids[] = {
|
||||
{ "cs47l35", CS47L35 },
|
||||
{ "cs47l85", CS47L85 },
|
||||
{ "cs47l90", CS47L90 },
|
||||
{ "cs47l91", CS47L91 },
|
||||
{ "wm1840", WM1840 },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(spi, madera_spi_ids);
|
||||
|
||||
static struct spi_driver madera_spi_driver = {
|
||||
.driver = {
|
||||
.name = "madera",
|
||||
.pm = &madera_pm_ops,
|
||||
.of_match_table = of_match_ptr(madera_of_match),
|
||||
},
|
||||
.probe = madera_spi_probe,
|
||||
.remove = madera_spi_remove,
|
||||
.id_table = madera_spi_ids,
|
||||
};
|
||||
|
||||
module_spi_driver(madera_spi_driver);
|
||||
|
||||
MODULE_DESCRIPTION("Madera SPI bus interface");
|
||||
MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.cirrus.com>");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* MFD internals for Cirrus Logic Madera codecs
|
||||
*
|
||||
* Copyright 2015-2018 Cirrus Logic
|
||||
*
|
||||
* 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_MFD_H
|
||||
#define MADERA_MFD_H
|
||||
|
||||
#include <linux/of.h>
|
||||
#include <linux/pm.h>
|
||||
|
||||
struct madera;
|
||||
|
||||
extern const struct dev_pm_ops madera_pm_ops;
|
||||
extern const struct of_device_id madera_of_match[];
|
||||
|
||||
int madera_dev_init(struct madera *madera);
|
||||
int madera_dev_exit(struct madera *madera);
|
||||
|
||||
const char *madera_name_from_type(enum madera_type type);
|
||||
|
||||
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;
|
||||
extern const struct regmap_config cs47l35_32bit_i2c_regmap;
|
||||
int cs47l35_patch(struct madera *madera);
|
||||
|
||||
extern const struct regmap_config cs47l85_16bit_spi_regmap;
|
||||
extern const struct regmap_config cs47l85_32bit_spi_regmap;
|
||||
extern const struct regmap_config cs47l85_16bit_i2c_regmap;
|
||||
extern const struct regmap_config cs47l85_32bit_i2c_regmap;
|
||||
int cs47l85_patch(struct madera *madera);
|
||||
|
||||
extern const struct regmap_config cs47l90_16bit_spi_regmap;
|
||||
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);
|
||||
#endif
|
||||
@@ -0,0 +1,187 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* MFD internals for Cirrus Logic Madera codecs
|
||||
*
|
||||
* Copyright (C) 2015-2018 Cirrus Logic
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; version 2.
|
||||
*/
|
||||
|
||||
#ifndef MADERA_CORE_H
|
||||
#define MADERA_CORE_H
|
||||
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/mfd/madera/pdata.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
|
||||
enum madera_type {
|
||||
/* 0 is reserved for indicating failure to identify */
|
||||
CS47L35 = 1,
|
||||
CS47L85 = 2,
|
||||
CS47L90 = 3,
|
||||
CS47L91 = 4,
|
||||
WM1840 = 7,
|
||||
};
|
||||
|
||||
#define MADERA_MAX_CORE_SUPPLIES 2
|
||||
#define MADERA_MAX_GPIOS 40
|
||||
|
||||
#define CS47L35_NUM_GPIOS 16
|
||||
#define CS47L85_NUM_GPIOS 40
|
||||
#define CS47L90_NUM_GPIOS 38
|
||||
|
||||
#define MADERA_MAX_MICBIAS 4
|
||||
|
||||
/* Notifier events */
|
||||
#define MADERA_NOTIFY_VOICE_TRIGGER 0x1
|
||||
#define MADERA_NOTIFY_HPDET 0x2
|
||||
#define MADERA_NOTIFY_MICDET 0x4
|
||||
|
||||
/* GPIO Function Definitions */
|
||||
#define MADERA_GP_FN_ALTERNATE 0x00
|
||||
#define MADERA_GP_FN_GPIO 0x01
|
||||
#define MADERA_GP_FN_DSP_GPIO 0x02
|
||||
#define MADERA_GP_FN_IRQ1 0x03
|
||||
#define MADERA_GP_FN_IRQ2 0x04
|
||||
#define MADERA_GP_FN_FLL1_CLOCK 0x10
|
||||
#define MADERA_GP_FN_FLL2_CLOCK 0x11
|
||||
#define MADERA_GP_FN_FLL3_CLOCK 0x12
|
||||
#define MADERA_GP_FN_FLLAO_CLOCK 0x13
|
||||
#define MADERA_GP_FN_FLL1_LOCK 0x18
|
||||
#define MADERA_GP_FN_FLL2_LOCK 0x19
|
||||
#define MADERA_GP_FN_FLL3_LOCK 0x1A
|
||||
#define MADERA_GP_FN_FLLAO_LOCK 0x1B
|
||||
#define MADERA_GP_FN_OPCLK_OUT 0x40
|
||||
#define MADERA_GP_FN_OPCLK_ASYNC_OUT 0x41
|
||||
#define MADERA_GP_FN_PWM1 0x48
|
||||
#define MADERA_GP_FN_PWM2 0x49
|
||||
#define MADERA_GP_FN_SPDIF_OUT 0x4C
|
||||
#define MADERA_GP_FN_HEADPHONE_DET 0x50
|
||||
#define MADERA_GP_FN_MIC_DET 0x58
|
||||
#define MADERA_GP_FN_DRC1_SIGNAL_DETECT 0x80
|
||||
#define MADERA_GP_FN_DRC2_SIGNAL_DETECT 0x81
|
||||
#define MADERA_GP_FN_ASRC1_IN1_LOCK 0x88
|
||||
#define MADERA_GP_FN_ASRC1_IN2_LOCK 0x89
|
||||
#define MADERA_GP_FN_ASRC2_IN1_LOCK 0x8A
|
||||
#define MADERA_GP_FN_ASRC2_IN2_LOCK 0x8B
|
||||
#define MADERA_GP_FN_DSP_IRQ1 0xA0
|
||||
#define MADERA_GP_FN_DSP_IRQ2 0xA1
|
||||
#define MADERA_GP_FN_DSP_IRQ3 0xA2
|
||||
#define MADERA_GP_FN_DSP_IRQ4 0xA3
|
||||
#define MADERA_GP_FN_DSP_IRQ5 0xA4
|
||||
#define MADERA_GP_FN_DSP_IRQ6 0xA5
|
||||
#define MADERA_GP_FN_DSP_IRQ7 0xA6
|
||||
#define MADERA_GP_FN_DSP_IRQ8 0xA7
|
||||
#define MADERA_GP_FN_DSP_IRQ9 0xA8
|
||||
#define MADERA_GP_FN_DSP_IRQ10 0xA9
|
||||
#define MADERA_GP_FN_DSP_IRQ11 0xAA
|
||||
#define MADERA_GP_FN_DSP_IRQ12 0xAB
|
||||
#define MADERA_GP_FN_DSP_IRQ13 0xAC
|
||||
#define MADERA_GP_FN_DSP_IRQ14 0xAD
|
||||
#define MADERA_GP_FN_DSP_IRQ15 0xAE
|
||||
#define MADERA_GP_FN_DSP_IRQ16 0xAF
|
||||
#define MADERA_GP_FN_HPOUT1L_SC 0xB0
|
||||
#define MADERA_GP_FN_HPOUT1R_SC 0xB1
|
||||
#define MADERA_GP_FN_HPOUT2L_SC 0xB2
|
||||
#define MADERA_GP_FN_HPOUT2R_SC 0xB3
|
||||
#define MADERA_GP_FN_HPOUT3L_SC 0xB4
|
||||
#define MADERA_GP_FN_HPOUT4R_SC 0xB5
|
||||
#define MADERA_GP_FN_SPKOUTL_SC 0xB6
|
||||
#define MADERA_GP_FN_SPKOUTR_SC 0xB7
|
||||
#define MADERA_GP_FN_HPOUT1L_ENA 0xC0
|
||||
#define MADERA_GP_FN_HPOUT1R_ENA 0xC1
|
||||
#define MADERA_GP_FN_HPOUT2L_ENA 0xC2
|
||||
#define MADERA_GP_FN_HPOUT2R_ENA 0xC3
|
||||
#define MADERA_GP_FN_HPOUT3L_ENA 0xC4
|
||||
#define MADERA_GP_FN_HPOUT4R_ENA 0xC5
|
||||
#define MADERA_GP_FN_SPKOUTL_ENA 0xC6
|
||||
#define MADERA_GP_FN_SPKOUTR_ENA 0xC7
|
||||
#define MADERA_GP_FN_HPOUT1L_DIS 0xD0
|
||||
#define MADERA_GP_FN_HPOUT1R_DIS 0xD1
|
||||
#define MADERA_GP_FN_HPOUT2L_DIS 0xD2
|
||||
#define MADERA_GP_FN_HPOUT2R_DIS 0xD3
|
||||
#define MADERA_GP_FN_HPOUT3L_DIS 0xD4
|
||||
#define MADERA_GP_FN_HPOUT4R_DIS 0xD5
|
||||
#define MADERA_GP_FN_SPKOUTL_DIS 0xD6
|
||||
#define MADERA_GP_FN_SPKOUTR_DIS 0xD7
|
||||
#define MADERA_GP_FN_SPK_SHUTDOWN 0xE0
|
||||
#define MADERA_GP_FN_SPK_OVH_SHUTDOWN 0xE1
|
||||
#define MADERA_GP_FN_SPK_OVH_WARN 0xE2
|
||||
#define MADERA_GP_FN_TIMER1_STATUS 0x140
|
||||
#define MADERA_GP_FN_TIMER2_STATUS 0x141
|
||||
#define MADERA_GP_FN_TIMER3_STATUS 0x142
|
||||
#define MADERA_GP_FN_TIMER4_STATUS 0x143
|
||||
#define MADERA_GP_FN_TIMER5_STATUS 0x144
|
||||
#define MADERA_GP_FN_TIMER6_STATUS 0x145
|
||||
#define MADERA_GP_FN_TIMER7_STATUS 0x146
|
||||
#define MADERA_GP_FN_TIMER8_STATUS 0x147
|
||||
#define MADERA_GP_FN_EVENTLOG1_FIFO_STS 0x150
|
||||
#define MADERA_GP_FN_EVENTLOG2_FIFO_STS 0x151
|
||||
#define MADERA_GP_FN_EVENTLOG3_FIFO_STS 0x152
|
||||
#define MADERA_GP_FN_EVENTLOG4_FIFO_STS 0x153
|
||||
#define MADERA_GP_FN_EVENTLOG5_FIFO_STS 0x154
|
||||
#define MADERA_GP_FN_EVENTLOG6_FIFO_STS 0x155
|
||||
#define MADERA_GP_FN_EVENTLOG7_FIFO_STS 0x156
|
||||
#define MADERA_GP_FN_EVENTLOG8_FIFO_STS 0x157
|
||||
|
||||
struct snd_soc_dapm_context;
|
||||
|
||||
/*
|
||||
* struct madera - internal data shared by the set of Madera drivers
|
||||
*
|
||||
* This should not be used by anything except child drivers of the Madera MFD
|
||||
*
|
||||
* @regmap: pointer to the regmap instance for 16-bit registers
|
||||
* @regmap_32bit: pointer to the regmap instance for 32-bit registers
|
||||
* @dev: pointer to the MFD device
|
||||
* @type: type of codec
|
||||
* @rev: silicon revision
|
||||
* @type_name: display name of this codec
|
||||
* @num_core_supplies: number of core supply regulators
|
||||
* @core_supplies: list of core supplies that are always required
|
||||
* @dcvdd: pointer to DCVDD regulator
|
||||
* @internal_dcvdd: true if DCVDD is supplied from the internal LDO1
|
||||
* @pdata: our pdata
|
||||
* @irq_dev: the irqchip child driver device
|
||||
* @irq: host irq number from SPI or I2C configuration
|
||||
* @out_clamp: indicates output clamp state for each analogue output
|
||||
* @out_shorted: indicates short circuit state for each analogue output
|
||||
* @hp_ena: bitflags of enable state for the headphone outputs
|
||||
* @num_micbias: number of MICBIAS outputs
|
||||
* @num_childbias: number of child biases for each MICBIAS
|
||||
* @dapm: pointer to codec driver DAPM context
|
||||
* @notifier: notifier for signalling events to ASoC machine driver
|
||||
*/
|
||||
struct madera {
|
||||
struct regmap *regmap;
|
||||
struct regmap *regmap_32bit;
|
||||
|
||||
struct device *dev;
|
||||
|
||||
enum madera_type type;
|
||||
unsigned int rev;
|
||||
const char *type_name;
|
||||
|
||||
int num_core_supplies;
|
||||
struct regulator_bulk_data core_supplies[MADERA_MAX_CORE_SUPPLIES];
|
||||
struct regulator *dcvdd;
|
||||
bool internal_dcvdd;
|
||||
|
||||
struct madera_pdata pdata;
|
||||
|
||||
struct device *irq_dev;
|
||||
int irq;
|
||||
|
||||
unsigned int num_micbias;
|
||||
unsigned int num_childbias[MADERA_MAX_MICBIAS];
|
||||
|
||||
struct snd_soc_dapm_context *dapm;
|
||||
|
||||
struct blocking_notifier_head notifier;
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,59 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Platform data for Cirrus Logic Madera codecs
|
||||
*
|
||||
* Copyright (C) 2015-2018 Cirrus Logic
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; version 2.
|
||||
*/
|
||||
|
||||
#ifndef MADERA_PDATA_H
|
||||
#define MADERA_PDATA_H
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/regulator/arizona-ldo1.h>
|
||||
#include <linux/regulator/arizona-micsupp.h>
|
||||
#include <linux/regulator/machine.h>
|
||||
|
||||
#define MADERA_MAX_MICBIAS 4
|
||||
#define MADERA_MAX_CHILD_MICBIAS 4
|
||||
|
||||
#define MADERA_MAX_GPSW 2
|
||||
|
||||
struct gpio_desc;
|
||||
struct pinctrl_map;
|
||||
struct madera_irqchip_pdata;
|
||||
struct madera_codec_pdata;
|
||||
|
||||
/**
|
||||
* struct madera_pdata - Configuration data for Madera devices
|
||||
*
|
||||
* @reset: GPIO controlling /RESET (NULL = none)
|
||||
* @ldo1: Substruct of pdata for the LDO1 regulator
|
||||
* @micvdd: Substruct of pdata for the MICVDD regulator
|
||||
* @irq_flags: Mode for primary IRQ (defaults to active low)
|
||||
* @gpio_base: Base GPIO number
|
||||
* @gpio_configs: Array of GPIO configurations (See Documentation/pinctrl.txt)
|
||||
* @n_gpio_configs: Number of entries in gpio_configs
|
||||
* @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)
|
||||
*/
|
||||
struct madera_pdata {
|
||||
struct gpio_desc *reset;
|
||||
|
||||
struct arizona_ldo1_pdata ldo1;
|
||||
struct arizona_micsupp_pdata micvdd;
|
||||
|
||||
unsigned int irq_flags;
|
||||
int gpio_base;
|
||||
|
||||
const struct pinctrl_map *gpio_configs;
|
||||
int n_gpio_configs;
|
||||
|
||||
u32 gpsw[MADERA_MAX_GPSW];
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user