Lines Matching +full:comp +full:- +full:disable
1 // SPDX-License-Identifier: GPL-2.0
83 /* 11bit [min,max,step] = [-103.9375dB, 24dB, 0.0625dB] */
84 static const DECLARE_TLV_DB_SCALE(digital_tlv, -1039375, 625, 1);
110 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in internal_power_event() local
114 snd_soc_component_write(comp, RT9120_REG_ERRRPT, 0); in internal_power_event()
159 static int rt9120_codec_probe(struct snd_soc_component *comp) in rt9120_codec_probe() argument
161 struct rt9120_data *data = snd_soc_component_get_drvdata(comp); in rt9120_codec_probe()
163 snd_soc_component_init_regmap(comp, data->regmap); in rt9120_codec_probe()
165 pm_runtime_get_sync(comp->dev); in rt9120_codec_probe()
168 if (data->chip_idx == CHIP_IDX_RT9120S) { in rt9120_codec_probe()
169 snd_soc_component_write(comp, RT9120_REG_INTERCFG, 0xde); in rt9120_codec_probe()
170 snd_soc_component_write(comp, RT9120_REG_INTERNAL0, 0x66); in rt9120_codec_probe()
172 snd_soc_component_write(comp, RT9120_REG_INTERNAL0, 0x04); in rt9120_codec_probe()
174 pm_runtime_mark_last_busy(comp->dev); in rt9120_codec_probe()
175 pm_runtime_put(comp->dev); in rt9120_codec_probe()
180 static int rt9120_codec_suspend(struct snd_soc_component *comp) in rt9120_codec_suspend() argument
182 return pm_runtime_force_suspend(comp->dev); in rt9120_codec_suspend()
185 static int rt9120_codec_resume(struct snd_soc_component *comp) in rt9120_codec_resume() argument
187 return pm_runtime_force_resume(comp->dev); in rt9120_codec_resume()
205 struct snd_soc_component *comp = dai->component; in rt9120_set_fmt() local
225 dev_err(dai->dev, "Unknown dai format\n"); in rt9120_set_fmt()
226 return -EINVAL; in rt9120_set_fmt()
229 snd_soc_component_update_bits(comp, RT9120_REG_I2SFMT, in rt9120_set_fmt()
239 struct snd_soc_component *comp = dai->component; in rt9120_hw_params() local
255 dev_err(dai->dev, "Unsupported data width [%d]\n", width); in rt9120_hw_params()
256 return -EINVAL; in rt9120_hw_params()
259 snd_soc_component_update_bits(comp, RT9120_REG_I2SFMT, in rt9120_hw_params()
273 dev_err(dai->dev, "Unsupported slot width [%d]\n", width); in rt9120_hw_params()
274 return -EINVAL; in rt9120_hw_params()
277 snd_soc_component_update_bits(comp, RT9120_REG_I2SWL, in rt9120_hw_params()
281 /* If fs is divided by 48, disable auto sync */ in rt9120_hw_params()
287 snd_soc_component_update_bits(comp, RT9120_REG_DIGCFG, in rt9120_hw_params()
390 struct i2c_client *i2c = to_i2c_client(data->dev); in rt9120_reg_read()
399 return -EIO; in rt9120_reg_read()
421 struct i2c_client *i2c = to_i2c_client(data->dev); in rt9120_reg_write()
425 int offs = 4 - size; in rt9120_reg_write()
483 ret = regmap_read(data->regmap, RT9120_REG_DEVID, &devid); in rt9120_check_vendor_info()
490 data->chip_idx = CHIP_IDX_RT9120; in rt9120_check_vendor_info()
493 data->chip_idx = CHIP_IDX_RT9120S; in rt9120_check_vendor_info()
496 dev_err(data->dev, "DEVID not correct [0x%0x]\n", devid); in rt9120_check_vendor_info()
497 return -ENODEV; in rt9120_check_vendor_info()
507 ret = regmap_write(data->regmap, RT9120_REG_SWRESET, in rt9120_do_register_reset()
522 data = devm_kzalloc(&i2c->dev, sizeof(*data), GFP_KERNEL); in rt9120_probe()
524 return -ENOMEM; in rt9120_probe()
526 data->dev = &i2c->dev; in rt9120_probe()
529 data->pwdnn_gpio = devm_gpiod_get_optional(&i2c->dev, "pwdnn", in rt9120_probe()
531 if (IS_ERR(data->pwdnn_gpio)) { in rt9120_probe()
532 dev_err(&i2c->dev, "Failed to initialize 'pwdnn' gpio\n"); in rt9120_probe()
533 return PTR_ERR(data->pwdnn_gpio); in rt9120_probe()
534 } else if (data->pwdnn_gpio) { in rt9120_probe()
535 dev_dbg(&i2c->dev, "'pwdnn' from low to high, wait chip on\n"); in rt9120_probe()
539 data->regmap = devm_regmap_init(&i2c->dev, NULL, data, in rt9120_probe()
541 if (IS_ERR(data->regmap)) { in rt9120_probe()
542 ret = PTR_ERR(data->regmap); in rt9120_probe()
543 dev_err(&i2c->dev, "Failed to init regmap [%d]\n", ret); in rt9120_probe()
549 dev_err(&i2c->dev, "Failed to check vendor info\n"); in rt9120_probe()
555 dev_err(&i2c->dev, "Failed to do register reset\n"); in rt9120_probe()
559 dvdd_supply = devm_regulator_get(&i2c->dev, "dvdd"); in rt9120_probe()
561 dev_err(&i2c->dev, "No dvdd regulator found\n"); in rt9120_probe()
567 dev_dbg(&i2c->dev, "dvdd low voltage design\n"); in rt9120_probe()
568 ret = regmap_update_bits(data->regmap, RT9120_REG_UVPOPT, in rt9120_probe()
571 dev_err(&i2c->dev, "Failed to config dvdd uvsel\n"); in rt9120_probe()
576 pm_runtime_set_autosuspend_delay(&i2c->dev, 1000); in rt9120_probe()
577 pm_runtime_use_autosuspend(&i2c->dev); in rt9120_probe()
578 pm_runtime_set_active(&i2c->dev); in rt9120_probe()
579 pm_runtime_mark_last_busy(&i2c->dev); in rt9120_probe()
580 pm_runtime_enable(&i2c->dev); in rt9120_probe()
582 return devm_snd_soc_register_component(&i2c->dev, in rt9120_probe()
589 pm_runtime_disable(&i2c->dev); in rt9120_remove()
590 pm_runtime_set_suspended(&i2c->dev); in rt9120_remove()
597 if (data->pwdnn_gpio) { in rt9120_runtime_suspend()
598 regcache_cache_only(data->regmap, true); in rt9120_runtime_suspend()
599 regcache_mark_dirty(data->regmap); in rt9120_runtime_suspend()
600 gpiod_set_value(data->pwdnn_gpio, 0); in rt9120_runtime_suspend()
610 if (data->pwdnn_gpio) { in rt9120_runtime_resume()
611 gpiod_set_value(data->pwdnn_gpio, 1); in rt9120_runtime_resume()
613 regcache_cache_only(data->regmap, false); in rt9120_runtime_resume()
614 regcache_sync(data->regmap); in rt9120_runtime_resume()