mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 21:23:23 +00:00
regulator: arizona-micsupp: Make arizona_micsupp independent of struct arizona
In preparation for supporting Madera codecs, remove the dependency on struct arizona in the regulator callbacks and struct arizona_micsupp. Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
22161f3eb6
commit
e165983e51
@ -34,7 +34,10 @@
|
|||||||
|
|
||||||
struct arizona_micsupp {
|
struct arizona_micsupp {
|
||||||
struct regulator_dev *regulator;
|
struct regulator_dev *regulator;
|
||||||
struct arizona *arizona;
|
struct regmap *regmap;
|
||||||
|
struct snd_soc_dapm_context **dapm;
|
||||||
|
unsigned int enable_reg;
|
||||||
|
struct device *dev;
|
||||||
|
|
||||||
struct regulator_consumer_supply supply;
|
struct regulator_consumer_supply supply;
|
||||||
struct regulator_init_data init_data;
|
struct regulator_init_data init_data;
|
||||||
@ -46,21 +49,22 @@ static void arizona_micsupp_check_cp(struct work_struct *work)
|
|||||||
{
|
{
|
||||||
struct arizona_micsupp *micsupp =
|
struct arizona_micsupp *micsupp =
|
||||||
container_of(work, struct arizona_micsupp, check_cp_work);
|
container_of(work, struct arizona_micsupp, check_cp_work);
|
||||||
struct snd_soc_dapm_context *dapm = micsupp->arizona->dapm;
|
struct snd_soc_dapm_context *dapm = *micsupp->dapm;
|
||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
|
struct snd_soc_component *component;
|
||||||
struct arizona *arizona = micsupp->arizona;
|
unsigned int val;
|
||||||
struct regmap *regmap = arizona->regmap;
|
|
||||||
unsigned int reg;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = regmap_read(regmap, ARIZONA_MIC_CHARGE_PUMP_1, ®);
|
ret = regmap_read(micsupp->regmap, micsupp->enable_reg, &val);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
dev_err(arizona->dev, "Failed to read CP state: %d\n", ret);
|
dev_err(micsupp->dev,
|
||||||
|
"Failed to read CP state: %d\n", ret);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dapm) {
|
if (dapm) {
|
||||||
if ((reg & (ARIZONA_CPMIC_ENA | ARIZONA_CPMIC_BYPASS)) ==
|
component = snd_soc_dapm_to_component(dapm);
|
||||||
|
|
||||||
|
if ((val & (ARIZONA_CPMIC_ENA | ARIZONA_CPMIC_BYPASS)) ==
|
||||||
ARIZONA_CPMIC_ENA)
|
ARIZONA_CPMIC_ENA)
|
||||||
snd_soc_component_force_enable_pin(component,
|
snd_soc_component_force_enable_pin(component,
|
||||||
"MICSUPP");
|
"MICSUPP");
|
||||||
@ -240,7 +244,9 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
|
|||||||
if (!micsupp)
|
if (!micsupp)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
micsupp->arizona = arizona;
|
micsupp->regmap = arizona->regmap;
|
||||||
|
micsupp->dapm = &arizona->dapm;
|
||||||
|
micsupp->dev = arizona->dev;
|
||||||
INIT_WORK(&micsupp->check_cp_work, arizona_micsupp_check_cp);
|
INIT_WORK(&micsupp->check_cp_work, arizona_micsupp_check_cp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -263,6 +269,7 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
|
|||||||
micsupp->init_data.consumer_supplies = &micsupp->supply;
|
micsupp->init_data.consumer_supplies = &micsupp->supply;
|
||||||
micsupp->supply.supply = "MICVDD";
|
micsupp->supply.supply = "MICVDD";
|
||||||
micsupp->supply.dev_name = dev_name(arizona->dev);
|
micsupp->supply.dev_name = dev_name(arizona->dev);
|
||||||
|
micsupp->enable_reg = desc->enable_reg;
|
||||||
|
|
||||||
config.dev = arizona->dev;
|
config.dev = arizona->dev;
|
||||||
config.driver_data = micsupp;
|
config.driver_data = micsupp;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user