Lines Matching full:rt5682
3 // rt5682.c -- RT5682 ALSA SoC audio component driver
30 #include <sound/rt5682.h>
33 #include "rt5682.h"
40 .dai_clk_names[RT5682_DAI_WCLK_IDX] = "rt5682-dai-wclk",
41 .dai_clk_names[RT5682_DAI_BCLK_IDX] = "rt5682-dai-bclk",
59 struct rt5682_priv *rt5682 = container_of(work, struct rt5682_priv, in rt5682_jd_check_handler() local
62 if (snd_soc_component_read(rt5682->component, RT5682_AJD1_CTRL) in rt5682_jd_check_handler()
65 rt5682->jack_type = rt5682_headset_detect(rt5682->component, 0); in rt5682_jd_check_handler()
67 snd_soc_jack_report(rt5682->hs_jack, rt5682->jack_type, in rt5682_jd_check_handler()
72 schedule_delayed_work(&rt5682->jd_check_work, 500); in rt5682_jd_check_handler()
78 struct rt5682_priv *rt5682 = data; in rt5682_irq() local
81 &rt5682->jack_detect_work, msecs_to_jiffies(250)); in rt5682_irq()
88 .name = "rt5682-aif1",
107 .name = "rt5682-aif2",
122 struct rt5682_priv *rt5682 = data; in rt5682_i2c_disable_regulators() local
124 regulator_bulk_disable(ARRAY_SIZE(rt5682->supplies), rt5682->supplies); in rt5682_i2c_disable_regulators()
131 struct rt5682_priv *rt5682; in rt5682_i2c_probe() local
135 rt5682 = devm_kzalloc(&i2c->dev, sizeof(struct rt5682_priv), in rt5682_i2c_probe()
137 if (!rt5682) in rt5682_i2c_probe()
140 i2c_set_clientdata(i2c, rt5682); in rt5682_i2c_probe()
142 rt5682->pdata = i2s_default_platform_data; in rt5682_i2c_probe()
145 rt5682->pdata = *pdata; in rt5682_i2c_probe()
147 rt5682_parse_dt(rt5682, &i2c->dev); in rt5682_i2c_probe()
149 rt5682->regmap = devm_regmap_init_i2c(i2c, &rt5682_regmap); in rt5682_i2c_probe()
150 if (IS_ERR(rt5682->regmap)) { in rt5682_i2c_probe()
151 ret = PTR_ERR(rt5682->regmap); in rt5682_i2c_probe()
157 for (i = 0; i < ARRAY_SIZE(rt5682->supplies); i++) in rt5682_i2c_probe()
158 rt5682->supplies[i].supply = rt5682_supply_names[i]; in rt5682_i2c_probe()
160 ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(rt5682->supplies), in rt5682_i2c_probe()
161 rt5682->supplies); in rt5682_i2c_probe()
168 rt5682); in rt5682_i2c_probe()
172 ret = regulator_bulk_enable(ARRAY_SIZE(rt5682->supplies), in rt5682_i2c_probe()
173 rt5682->supplies); in rt5682_i2c_probe()
179 if (gpio_is_valid(rt5682->pdata.ldo1_en)) { in rt5682_i2c_probe()
180 if (devm_gpio_request_one(&i2c->dev, rt5682->pdata.ldo1_en, in rt5682_i2c_probe()
181 GPIOF_OUT_INIT_HIGH, "rt5682")) in rt5682_i2c_probe()
188 regmap_write(rt5682->regmap, RT5682_I2C_MODE, 0x1); in rt5682_i2c_probe()
191 regmap_read(rt5682->regmap, RT5682_DEVICE_ID, &val); in rt5682_i2c_probe()
194 "Device with ID register %x is not rt5682\n", val); in rt5682_i2c_probe()
198 mutex_init(&rt5682->calibrate_mutex); in rt5682_i2c_probe()
199 rt5682_calibrate(rt5682); in rt5682_i2c_probe()
201 rt5682_apply_patch_list(rt5682, &i2c->dev); in rt5682_i2c_probe()
203 regmap_write(rt5682->regmap, RT5682_DEPOP_1, 0x0000); in rt5682_i2c_probe()
206 if (rt5682->pdata.dmic1_data_pin != RT5682_DMIC1_NULL) { in rt5682_i2c_probe()
207 switch (rt5682->pdata.dmic1_data_pin) { in rt5682_i2c_probe()
209 regmap_update_bits(rt5682->regmap, RT5682_DMIC_CTRL_1, in rt5682_i2c_probe()
211 regmap_update_bits(rt5682->regmap, RT5682_GPIO_CTRL_1, in rt5682_i2c_probe()
216 regmap_update_bits(rt5682->regmap, RT5682_DMIC_CTRL_1, in rt5682_i2c_probe()
218 regmap_update_bits(rt5682->regmap, RT5682_GPIO_CTRL_1, in rt5682_i2c_probe()
227 switch (rt5682->pdata.dmic1_clk_pin) { in rt5682_i2c_probe()
229 regmap_update_bits(rt5682->regmap, RT5682_GPIO_CTRL_1, in rt5682_i2c_probe()
234 regmap_update_bits(rt5682->regmap, RT5682_GPIO_CTRL_1, in rt5682_i2c_probe()
244 regmap_update_bits(rt5682->regmap, RT5682_PWR_ANLG_1, in rt5682_i2c_probe()
247 regmap_write(rt5682->regmap, RT5682_MICBIAS_2, 0x0080); in rt5682_i2c_probe()
248 regmap_update_bits(rt5682->regmap, RT5682_GPIO_CTRL_1, in rt5682_i2c_probe()
251 regmap_write(rt5682->regmap, RT5682_TEST_MODE_CTRL_1, 0x0000); in rt5682_i2c_probe()
252 regmap_update_bits(rt5682->regmap, RT5682_BIAS_CUR_CTRL_8, in rt5682_i2c_probe()
254 regmap_update_bits(rt5682->regmap, RT5682_CHARGE_PUMP_1, in rt5682_i2c_probe()
256 regmap_update_bits(rt5682->regmap, RT5682_HP_CHARGE_PUMP_1, in rt5682_i2c_probe()
258 regmap_update_bits(rt5682->regmap, RT5682_DMIC_CTRL_1, in rt5682_i2c_probe()
261 INIT_DELAYED_WORK(&rt5682->jack_detect_work, in rt5682_i2c_probe()
263 INIT_DELAYED_WORK(&rt5682->jd_check_work, in rt5682_i2c_probe()
269 | IRQF_ONESHOT, "rt5682", rt5682); in rt5682_i2c_probe()
281 struct rt5682_priv *rt5682 = i2c_get_clientdata(client); in rt5682_i2c_shutdown() local
284 cancel_delayed_work_sync(&rt5682->jack_detect_work); in rt5682_i2c_shutdown()
285 cancel_delayed_work_sync(&rt5682->jd_check_work); in rt5682_i2c_shutdown()
287 rt5682_reset(rt5682); in rt5682_i2c_shutdown()
310 {"rt5682", 0},
317 .name = "rt5682",
329 MODULE_DESCRIPTION("ASoC RT5682 driver");