Lines Matching +full:reset +full:- +full:assert +full:- +full:ms

1 // SPDX-License-Identifier: GPL-2.0-only
13 #include <linux/reset.h>
23 #include <sound/soc-component.h>
65 struct reset_control *reset; member
72 0, 1, TLV_DB_SCALE_ITEM(-15000, 0, 0),
73 2, 6, TLV_DB_SCALE_ITEM(-15000, 1000, 0),
74 7, 0xff, TLV_DB_SCALE_ITEM(-10000, 50, 0),
80 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; in ntp8835_mute_info()
81 uinfo->access = in ntp8835_mute_info()
83 uinfo->count = 1; in ntp8835_mute_info()
85 uinfo->value.integer.min = 0; in ntp8835_mute_info()
86 uinfo->value.integer.max = 1; in ntp8835_mute_info()
87 uinfo->value.integer.step = 1; in ntp8835_mute_info()
100 ucontrol->value.integer.value[0] = val ? 0 : 1; in ntp8835_mute_get()
110 val = ucontrol->value.integer.value[0] ? 0 : 7; in ntp8835_mute_put()
134 * /RESET signal low during power up for at least 0.1us. The sequence is, in ntp8835_reset_gpio()
136 * Deassert for T2 >= 1ms... in ntp8835_reset_gpio()
138 reset_control_deassert(ntp8835->reset); in ntp8835_reset_gpio()
141 /* ...Assert for T3 >= 0.1us... */ in ntp8835_reset_gpio()
142 reset_control_assert(ntp8835->reset); in ntp8835_reset_gpio()
145 /* ...Deassert, and wait for T4 >= 0.5ms before sound on sequence. */ in ntp8835_reset_gpio()
146 reset_control_deassert(ntp8835->reset); in ntp8835_reset_gpio()
173 ret = ntpfw_load(ntp8835->i2c, NTP8835_FW_NAME, NTP8835_FW_MAGIC); in ntp8835_load_firmware()
174 if (ret == -ENOENT) { in ntp8835_load_firmware()
175 dev_warn_once(&ntp8835->i2c->dev, in ntp8835_load_firmware()
187 regcache_cache_only(component->regmap, true); in ntp8835_snd_suspend()
189 regmap_multi_reg_write_bypassed(component->regmap, in ntp8835_snd_suspend()
195 * wait after sound off for T6 >= 0.5ms in ntp8835_snd_suspend()
198 reset_control_assert(ntp8835->reset); in ntp8835_snd_suspend()
200 regcache_mark_dirty(component->regmap); in ntp8835_snd_suspend()
201 clk_disable_unprepare(ntp8835->mclk); in ntp8835_snd_suspend()
212 ret = clk_prepare_enable(ntp8835->mclk); in ntp8835_snd_resume()
216 regmap_multi_reg_write_bypassed(component->regmap, in ntp8835_snd_resume()
222 dev_err(&ntp8835->i2c->dev, "Failed to load firmware\n"); in ntp8835_snd_resume()
226 regcache_cache_only(component->regmap, false); in ntp8835_snd_resume()
236 struct device *dev = component->dev; in ntp8835_probe()
274 ntp8835->mclk_rate = freq; in ntp8835_set_component_sysclk()
277 ntp8835->mclk_rate = 0; in ntp8835_set_component_sysclk()
278 dev_err(component->dev, "Unsupported MCLK value: %u", freq); in ntp8835_set_component_sysclk()
279 return -EINVAL; in ntp8835_set_component_sysclk()
300 struct snd_soc_component *component = dai->component; in ntp8835_hw_params()
308 switch (ntp8835->mclk_rate) { in ntp8835_hw_params()
319 return -EINVAL; in ntp8835_hw_params()
327 switch (ntp8835->format) { in ntp8835_hw_params()
361 return -EINVAL; in ntp8835_hw_params()
373 struct snd_soc_component *component = dai->component; in ntp8835_set_fmt()
380 ntp8835->format = fmt & SND_SOC_DAIFMT_FORMAT_MASK; in ntp8835_set_fmt()
383 return -EINVAL; in ntp8835_set_fmt()
394 .name = "ntp8835-amplifier",
418 ntp8835 = devm_kzalloc(&i2c->dev, sizeof(*ntp8835), GFP_KERNEL); in ntp8835_i2c_probe()
420 return -ENOMEM; in ntp8835_i2c_probe()
422 ntp8835->i2c = i2c; in ntp8835_i2c_probe()
424 ntp8835->reset = devm_reset_control_get_shared(&i2c->dev, NULL); in ntp8835_i2c_probe()
425 if (IS_ERR(ntp8835->reset)) in ntp8835_i2c_probe()
426 return dev_err_probe(&i2c->dev, PTR_ERR(ntp8835->reset), in ntp8835_i2c_probe()
427 "Failed to get reset\n"); in ntp8835_i2c_probe()
429 ret = reset_control_deassert(ntp8835->reset); in ntp8835_i2c_probe()
431 return dev_err_probe(&i2c->dev, ret, in ntp8835_i2c_probe()
432 "Failed to deassert reset\n"); in ntp8835_i2c_probe()
434 dev_set_drvdata(&i2c->dev, ntp8835); in ntp8835_i2c_probe()
440 return dev_err_probe(&i2c->dev, PTR_ERR(regmap), in ntp8835_i2c_probe()
443 ret = devm_snd_soc_register_component(&i2c->dev, &soc_component_ntp8835, in ntp8835_i2c_probe()
446 return dev_err_probe(&i2c->dev, ret, in ntp8835_i2c_probe()
449 ntp8835->mclk = devm_clk_get_enabled(&i2c->dev, "mclk"); in ntp8835_i2c_probe()
450 if (IS_ERR(ntp8835->mclk)) in ntp8835_i2c_probe()
451 return dev_err_probe(&i2c->dev, PTR_ERR(ntp8835->mclk), "failed to get mclk\n"); in ntp8835_i2c_probe()