Lines Matching +full:adc +full:- +full:dev
1 // SPDX-License-Identifier: GPL-2.0
3 // Audio driver for AK5558 ADC
21 #include <sound/soc-dapm.h>
63 "Sharp Roll-Off", "Show Roll-Off",
64 "Short Delay Sharp Roll-Off", "Short Delay Show Roll-Off",
88 SND_SOC_DAPM_ADC("ADC Ch1", NULL, AK5558_00_POWER_MANAGEMENT1, 0, 0),
89 SND_SOC_DAPM_ADC("ADC Ch2", NULL, AK5558_00_POWER_MANAGEMENT1, 1, 0),
90 SND_SOC_DAPM_ADC("ADC Ch3", NULL, AK5558_00_POWER_MANAGEMENT1, 2, 0),
91 SND_SOC_DAPM_ADC("ADC Ch4", NULL, AK5558_00_POWER_MANAGEMENT1, 3, 0),
92 SND_SOC_DAPM_ADC("ADC Ch5", NULL, AK5558_00_POWER_MANAGEMENT1, 4, 0),
93 SND_SOC_DAPM_ADC("ADC Ch6", NULL, AK5558_00_POWER_MANAGEMENT1, 5, 0),
94 SND_SOC_DAPM_ADC("ADC Ch7", NULL, AK5558_00_POWER_MANAGEMENT1, 6, 0),
95 SND_SOC_DAPM_ADC("ADC Ch8", NULL, AK5558_00_POWER_MANAGEMENT1, 7, 0),
101 {"ADC Ch1", NULL, "AIN1"},
102 {"SDTO", NULL, "ADC Ch1"},
104 {"ADC Ch2", NULL, "AIN2"},
105 {"SDTO", NULL, "ADC Ch2"},
107 {"ADC Ch3", NULL, "AIN3"},
108 {"SDTO", NULL, "ADC Ch3"},
110 {"ADC Ch4", NULL, "AIN4"},
111 {"SDTO", NULL, "ADC Ch4"},
113 {"ADC Ch5", NULL, "AIN5"},
114 {"SDTO", NULL, "ADC Ch5"},
116 {"ADC Ch6", NULL, "AIN6"},
117 {"SDTO", NULL, "ADC Ch6"},
119 {"ADC Ch7", NULL, "AIN7"},
120 {"SDTO", NULL, "ADC Ch7"},
122 {"ADC Ch8", NULL, "AIN8"},
123 {"SDTO", NULL, "ADC Ch8"},
136 struct snd_soc_component *component = dai->component; in ak5558_hw_params()
139 int pcm_width = max(params_physical_width(params), ak5558->slot_width); in ak5558_hw_params()
149 return -EINVAL; in ak5558_hw_params()
159 struct snd_soc_component *component = dai->component; in ak5558_set_dai_fmt()
170 dev_err(dai->dev, "Clock mode unsupported"); in ak5558_set_dai_fmt()
171 return -EINVAL; in ak5558_set_dai_fmt()
186 return -EINVAL; in ak5558_set_dai_fmt()
198 struct snd_soc_component *component = dai->component; in ak5558_set_tdm_slot()
202 ak5558->slots = slots; in ak5558_set_tdm_slot()
203 ak5558->slot_width = slot_width; in ak5558_set_tdm_slot()
245 return snd_pcm_hw_constraint_list(substream->runtime, 0, in ak5558_startup()
259 .name = "ak5558-aif",
272 if (!ak5558->reset_gpiod) in ak5558_power_off()
275 gpiod_set_value_cansleep(ak5558->reset_gpiod, 1); in ak5558_power_off()
281 if (!ak5558->reset_gpiod) in ak5558_power_on()
284 gpiod_set_value_cansleep(ak5558->reset_gpiod, 0); in ak5558_power_on()
303 static int __maybe_unused ak5558_runtime_suspend(struct device *dev) in ak5558_runtime_suspend() argument
305 struct ak5558_priv *ak5558 = dev_get_drvdata(dev); in ak5558_runtime_suspend()
307 regcache_cache_only(ak5558->regmap, true); in ak5558_runtime_suspend()
310 regulator_bulk_disable(ARRAY_SIZE(ak5558->supplies), in ak5558_runtime_suspend()
311 ak5558->supplies); in ak5558_runtime_suspend()
315 static int __maybe_unused ak5558_runtime_resume(struct device *dev) in ak5558_runtime_resume() argument
317 struct ak5558_priv *ak5558 = dev_get_drvdata(dev); in ak5558_runtime_resume()
320 ret = regulator_bulk_enable(ARRAY_SIZE(ak5558->supplies), in ak5558_runtime_resume()
321 ak5558->supplies); in ak5558_runtime_resume()
323 dev_err(dev, "Failed to enable supplies: %d\n", ret); in ak5558_runtime_resume()
330 regcache_cache_only(ak5558->regmap, false); in ak5558_runtime_resume()
331 regcache_mark_dirty(ak5558->regmap); in ak5558_runtime_resume()
333 return regcache_sync(ak5558->regmap); in ak5558_runtime_resume()
373 ak5558 = devm_kzalloc(&i2c->dev, sizeof(*ak5558), GFP_KERNEL); in ak5558_i2c_probe()
375 return -ENOMEM; in ak5558_i2c_probe()
377 ak5558->regmap = devm_regmap_init_i2c(i2c, &ak5558_regmap); in ak5558_i2c_probe()
378 if (IS_ERR(ak5558->regmap)) in ak5558_i2c_probe()
379 return PTR_ERR(ak5558->regmap); in ak5558_i2c_probe()
382 ak5558->i2c = i2c; in ak5558_i2c_probe()
384 ak5558->reset_gpiod = devm_gpiod_get_optional(&i2c->dev, "reset", in ak5558_i2c_probe()
386 if (IS_ERR(ak5558->reset_gpiod)) in ak5558_i2c_probe()
387 return PTR_ERR(ak5558->reset_gpiod); in ak5558_i2c_probe()
389 for (i = 0; i < ARRAY_SIZE(ak5558->supplies); i++) in ak5558_i2c_probe()
390 ak5558->supplies[i].supply = ak5558_supply_names[i]; in ak5558_i2c_probe()
392 ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(ak5558->supplies), in ak5558_i2c_probe()
393 ak5558->supplies); in ak5558_i2c_probe()
395 dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); in ak5558_i2c_probe()
399 ret = devm_snd_soc_register_component(&i2c->dev, in ak5558_i2c_probe()
405 pm_runtime_enable(&i2c->dev); in ak5558_i2c_probe()
406 regcache_cache_only(ak5558->regmap, true); in ak5558_i2c_probe()
413 pm_runtime_disable(&i2c->dev); in ak5558_i2c_remove()
419 { .compatible = "asahi-kasei,ak5558"},
436 MODULE_AUTHOR("Junichi Wakasugi <wakasugi.jb@om.asahi-kasei.co.jp>");
438 MODULE_DESCRIPTION("ASoC AK5558 ADC driver");