Lines Matching refs:tas5805m

188 static void tas5805m_refresh(struct tas5805m_priv *tas5805m)  in tas5805m_refresh()  argument
190 struct regmap *rm = tas5805m->regmap; in tas5805m_refresh()
192 dev_dbg(&tas5805m->i2c->dev, "refresh: is_muted=%d, vol=%d/%d\n", in tas5805m_refresh()
193 tas5805m->is_muted, tas5805m->vol[0], tas5805m->vol[1]); in tas5805m_refresh()
203 set_dsp_scale(rm, 0x24, tas5805m->vol[0]); in tas5805m_refresh()
204 set_dsp_scale(rm, 0x28, tas5805m->vol[1]); in tas5805m_refresh()
211 (tas5805m->is_muted ? DCTRL2_MUTE : 0) | in tas5805m_refresh()
231 struct tas5805m_priv *tas5805m = in tas5805m_vol_get() local
234 mutex_lock(&tas5805m->lock); in tas5805m_vol_get()
235 ucontrol->value.integer.value[0] = tas5805m->vol[0]; in tas5805m_vol_get()
236 ucontrol->value.integer.value[1] = tas5805m->vol[1]; in tas5805m_vol_get()
237 mutex_unlock(&tas5805m->lock); in tas5805m_vol_get()
252 struct tas5805m_priv *tas5805m = in tas5805m_vol_put() local
260 mutex_lock(&tas5805m->lock); in tas5805m_vol_put()
261 if (tas5805m->vol[0] != ucontrol->value.integer.value[0] || in tas5805m_vol_put()
262 tas5805m->vol[1] != ucontrol->value.integer.value[1]) { in tas5805m_vol_put()
263 tas5805m->vol[0] = ucontrol->value.integer.value[0]; in tas5805m_vol_put()
264 tas5805m->vol[1] = ucontrol->value.integer.value[1]; in tas5805m_vol_put()
266 tas5805m->vol[0], tas5805m->vol[1], in tas5805m_vol_put()
267 tas5805m->is_powered); in tas5805m_vol_put()
268 if (tas5805m->is_powered) in tas5805m_vol_put()
269 tas5805m_refresh(tas5805m); in tas5805m_vol_put()
272 mutex_unlock(&tas5805m->lock); in tas5805m_vol_put()
306 struct tas5805m_priv *tas5805m = in tas5805m_trigger() local
314 schedule_work(&tas5805m->work); in tas5805m_trigger()
331 struct tas5805m_priv *tas5805m = in do_work() local
333 struct regmap *rm = tas5805m->regmap; in do_work()
335 dev_dbg(&tas5805m->i2c->dev, "DSP startup\n"); in do_work()
337 mutex_lock(&tas5805m->lock); in do_work()
346 send_cfg(rm, tas5805m->dsp_cfg_data, tas5805m->dsp_cfg_len); in do_work()
348 tas5805m->is_powered = true; in do_work()
349 tas5805m_refresh(tas5805m); in do_work()
350 mutex_unlock(&tas5805m->lock); in do_work()
357 struct tas5805m_priv *tas5805m = in tas5805m_dac_event() local
359 struct regmap *rm = tas5805m->regmap; in tas5805m_dac_event()
365 cancel_work_sync(&tas5805m->work); in tas5805m_dac_event()
367 mutex_lock(&tas5805m->lock); in tas5805m_dac_event()
368 if (tas5805m->is_powered) { in tas5805m_dac_event()
369 tas5805m->is_powered = false; in tas5805m_dac_event()
384 mutex_unlock(&tas5805m->lock); in tas5805m_dac_event()
416 struct tas5805m_priv *tas5805m = in tas5805m_mute() local
419 mutex_lock(&tas5805m->lock); in tas5805m_mute()
421 mute, tas5805m->is_powered); in tas5805m_mute()
423 tas5805m->is_muted = mute; in tas5805m_mute()
424 if (tas5805m->is_powered) in tas5805m_mute()
425 tas5805m_refresh(tas5805m); in tas5805m_mute()
426 mutex_unlock(&tas5805m->lock); in tas5805m_mute()
464 struct tas5805m_priv *tas5805m; in tas5805m_i2c_probe() local
477 tas5805m = devm_kzalloc(dev, sizeof(struct tas5805m_priv), GFP_KERNEL); in tas5805m_i2c_probe()
478 if (!tas5805m) in tas5805m_i2c_probe()
481 tas5805m->i2c = i2c; in tas5805m_i2c_probe()
482 tas5805m->pvdd = devm_regulator_get(dev, "pvdd"); in tas5805m_i2c_probe()
483 if (IS_ERR(tas5805m->pvdd)) { in tas5805m_i2c_probe()
485 PTR_ERR(tas5805m->pvdd)); in tas5805m_i2c_probe()
486 return PTR_ERR(tas5805m->pvdd); in tas5805m_i2c_probe()
489 dev_set_drvdata(dev, tas5805m); in tas5805m_i2c_probe()
490 tas5805m->regmap = regmap; in tas5805m_i2c_probe()
491 tas5805m->gpio_pdn_n = devm_gpiod_get(dev, "pdn", GPIOD_OUT_LOW); in tas5805m_i2c_probe()
492 if (IS_ERR(tas5805m->gpio_pdn_n)) { in tas5805m_i2c_probe()
494 PTR_ERR(tas5805m->gpio_pdn_n)); in tas5805m_i2c_probe()
495 return PTR_ERR(tas5805m->gpio_pdn_n); in tas5805m_i2c_probe()
522 tas5805m->dsp_cfg_len = fw->size; in tas5805m_i2c_probe()
523 tas5805m->dsp_cfg_data = devm_kmemdup(dev, fw->data, fw->size, GFP_KERNEL); in tas5805m_i2c_probe()
524 if (!tas5805m->dsp_cfg_data) { in tas5805m_i2c_probe()
541 tas5805m->vol[0] = TAS5805M_VOLUME_MIN; in tas5805m_i2c_probe()
542 tas5805m->vol[1] = TAS5805M_VOLUME_MIN; in tas5805m_i2c_probe()
544 ret = regulator_enable(tas5805m->pvdd); in tas5805m_i2c_probe()
551 gpiod_set_value(tas5805m->gpio_pdn_n, 1); in tas5805m_i2c_probe()
554 INIT_WORK(&tas5805m->work, do_work); in tas5805m_i2c_probe()
555 mutex_init(&tas5805m->lock); in tas5805m_i2c_probe()
564 gpiod_set_value(tas5805m->gpio_pdn_n, 0); in tas5805m_i2c_probe()
565 regulator_disable(tas5805m->pvdd); in tas5805m_i2c_probe()
575 struct tas5805m_priv *tas5805m = dev_get_drvdata(dev); in tas5805m_i2c_remove() local
577 cancel_work_sync(&tas5805m->work); in tas5805m_i2c_remove()
579 gpiod_set_value(tas5805m->gpio_pdn_n, 0); in tas5805m_i2c_remove()
581 regulator_disable(tas5805m->pvdd); in tas5805m_i2c_remove()