Lines Matching +full:cpvdd +full:- +full:supply

1 // SPDX-License-Identifier: GPL-2.0+
3 // arizona-micsupp.c -- Microphone supply for Arizona devices
31 #include <linux/regulator/arizona-micsupp.h>
40 struct regulator_consumer_supply supply; member
50 struct snd_soc_dapm_context *dapm = *micsupp->dapm; in arizona_micsupp_check_cp()
52 const struct regulator_desc *desc = micsupp->desc; in arizona_micsupp_check_cp()
56 ret = regmap_read(micsupp->regmap, desc->enable_reg, &val); in arizona_micsupp_check_cp()
58 dev_err(micsupp->dev, in arizona_micsupp_check_cp()
66 if ((val & (desc->enable_mask | desc->bypass_mask)) == in arizona_micsupp_check_cp()
67 desc->enable_mask) in arizona_micsupp_check_cp()
85 schedule_work(&micsupp->check_cp_work); in arizona_micsupp_enable()
97 schedule_work(&micsupp->check_cp_work); in arizona_micsupp_disable()
109 schedule_work(&micsupp->check_cp_work); in arizona_micsupp_set_bypass()
136 .supply_name = "CPVDD",
163 .supply_name = "CPVDD",
232 struct arizona_micsupp *micsupp = config->driver_data; in arizona_micsupp_of_get_pdata()
236 np = of_get_child_by_name(config->dev->of_node, "micvdd"); in arizona_micsupp_of_get_pdata()
239 config->of_node = np; in arizona_micsupp_of_get_pdata()
241 init_data = of_get_regulator_init_data(config->dev, np, desc); in arizona_micsupp_of_get_pdata()
244 init_data->consumer_supplies = &micsupp->supply; in arizona_micsupp_of_get_pdata()
245 init_data->num_consumer_supplies = 1; in arizona_micsupp_of_get_pdata()
247 pdata->init_data = init_data; in arizona_micsupp_of_get_pdata()
262 INIT_WORK(&micsupp->check_cp_work, arizona_micsupp_check_cp); in arizona_micsupp_common_init()
264 micsupp->init_data.consumer_supplies = &micsupp->supply; in arizona_micsupp_common_init()
265 micsupp->supply.dev_name = dev_name(micsupp->dev); in arizona_micsupp_common_init()
266 micsupp->desc = desc; in arizona_micsupp_common_init()
268 config.dev = micsupp->dev; in arizona_micsupp_common_init()
270 config.regmap = micsupp->regmap; in arizona_micsupp_common_init()
273 if (!dev_get_platdata(micsupp->dev)) { in arizona_micsupp_common_init()
281 if (pdata->init_data) in arizona_micsupp_common_init()
282 config.init_data = pdata->init_data; in arizona_micsupp_common_init()
284 config.init_data = &micsupp->init_data; in arizona_micsupp_common_init()
287 regmap_update_bits(micsupp->regmap, desc->enable_reg, desc->bypass_mask, 0); in arizona_micsupp_common_init()
289 micsupp->regulator = devm_regulator_register(&pdev->dev, in arizona_micsupp_common_init()
295 if (IS_ERR(micsupp->regulator)) { in arizona_micsupp_common_init()
296 ret = PTR_ERR(micsupp->regulator); in arizona_micsupp_common_init()
297 dev_err(micsupp->dev, "Failed to register mic supply: %d\n", in arizona_micsupp_common_init()
309 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); in arizona_micsupp_probe()
313 micsupp = devm_kzalloc(&pdev->dev, sizeof(*micsupp), GFP_KERNEL); in arizona_micsupp_probe()
315 return -ENOMEM; in arizona_micsupp_probe()
317 micsupp->regmap = arizona->regmap; in arizona_micsupp_probe()
318 micsupp->dapm = &arizona->dapm; in arizona_micsupp_probe()
319 micsupp->dev = arizona->dev; in arizona_micsupp_probe()
321 micsupp->supply.supply = "MICVDD"; in arizona_micsupp_probe()
328 switch (arizona->type) { in arizona_micsupp_probe()
332 micsupp->init_data = arizona_micsupp_ext_default; in arizona_micsupp_probe()
336 micsupp->init_data = arizona_micsupp_default; in arizona_micsupp_probe()
341 &arizona->pdata.micvdd); in arizona_micsupp_probe()
346 struct madera *madera = dev_get_drvdata(pdev->dev.parent); in madera_micsupp_probe()
349 micsupp = devm_kzalloc(&pdev->dev, sizeof(*micsupp), GFP_KERNEL); in madera_micsupp_probe()
351 return -ENOMEM; in madera_micsupp_probe()
353 micsupp->regmap = madera->regmap; in madera_micsupp_probe()
354 micsupp->dapm = &madera->dapm; in madera_micsupp_probe()
355 micsupp->dev = madera->dev; in madera_micsupp_probe()
356 micsupp->init_data = arizona_micsupp_ext_default; in madera_micsupp_probe()
358 micsupp->supply.supply = "MICVDD"; in madera_micsupp_probe()
361 &madera->pdata.micvdd); in madera_micsupp_probe()
367 .name = "arizona-micsupp",
375 .name = "madera-micsupp",
401 MODULE_DESCRIPTION("Arizona microphone supply driver");
403 MODULE_ALIAS("platform:arizona-micsupp");
404 MODULE_ALIAS("platform:madera-micsupp");