Lines Matching refs:aw88395

29 static void aw88395_start_pa(struct aw88395 *aw88395)  in aw88395_start_pa()  argument
34 ret = aw88395_dev_start(aw88395->aw_pa); in aw88395_start_pa()
36 dev_err(aw88395->aw_pa->dev, "aw88395 device start failed. retry = %d", i); in aw88395_start_pa()
37 ret = aw88395_dev_fw_update(aw88395->aw_pa, AW88395_DSP_FW_UPDATE_ON, true); in aw88395_start_pa()
39 dev_err(aw88395->aw_pa->dev, "fw update failed"); in aw88395_start_pa()
43 dev_info(aw88395->aw_pa->dev, "start success\n"); in aw88395_start_pa()
51 struct aw88395 *aw88395 = in aw88395_startup_work() local
52 container_of(work, struct aw88395, start_work.work); in aw88395_startup_work()
54 mutex_lock(&aw88395->lock); in aw88395_startup_work()
55 aw88395_start_pa(aw88395); in aw88395_startup_work()
56 mutex_unlock(&aw88395->lock); in aw88395_startup_work()
59 static void aw88395_start(struct aw88395 *aw88395, bool sync_start) in aw88395_start() argument
63 if (aw88395->aw_pa->fw_status != AW88395_DEV_FW_OK) in aw88395_start()
66 if (aw88395->aw_pa->status == AW88395_DEV_PW_ON) in aw88395_start()
69 ret = aw88395_dev_fw_update(aw88395->aw_pa, AW88395_DSP_FW_UPDATE_OFF, true); in aw88395_start()
71 dev_err(aw88395->aw_pa->dev, "fw update failed."); in aw88395_start()
76 aw88395_start_pa(aw88395); in aw88395_start()
79 &aw88395->start_work, in aw88395_start()
108 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); in aw88395_get_fade_in_time() local
109 struct aw_device *aw_dev = aw88395->aw_pa; in aw88395_get_fade_in_time()
120 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); in aw88395_set_fade_in_time() local
123 struct aw_device *aw_dev = aw88395->aw_pa; in aw88395_set_fade_in_time()
143 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); in aw88395_get_fade_out_time() local
144 struct aw_device *aw_dev = aw88395->aw_pa; in aw88395_get_fade_out_time()
155 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); in aw88395_set_fade_out_time() local
158 struct aw_device *aw_dev = aw88395->aw_pa; in aw88395_set_fade_out_time()
177 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); in aw88395_profile_info() local
184 count = aw88395_dev_get_profile_count(aw88395->aw_pa); in aw88395_profile_info()
198 ret = aw88395_dev_get_prof_name(aw88395->aw_pa, count, &prof_name); in aw88395_profile_info()
214 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); in aw88395_profile_get() local
216 ucontrol->value.integer.value[0] = aw88395_dev_get_profile_index(aw88395->aw_pa); in aw88395_profile_get()
225 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); in aw88395_profile_set() local
229 mutex_lock(&aw88395->lock); in aw88395_profile_set()
230 ret = aw88395_dev_set_profile_index(aw88395->aw_pa, ucontrol->value.integer.value[0]); in aw88395_profile_set()
233 mutex_unlock(&aw88395->lock); in aw88395_profile_set()
237 if (aw88395->aw_pa->status) { in aw88395_profile_set()
238 aw88395_dev_stop(aw88395->aw_pa); in aw88395_profile_set()
239 aw88395_start(aw88395, AW88395_SYNC_START); in aw88395_profile_set()
242 mutex_unlock(&aw88395->lock); in aw88395_profile_set()
251 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); in aw88395_volume_get() local
252 struct aw_volume_desc *vol_desc = &aw88395->aw_pa->volume_desc; in aw88395_volume_get()
263 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); in aw88395_volume_set() local
264 struct aw_volume_desc *vol_desc = &aw88395->aw_pa->volume_desc; in aw88395_volume_set()
275 aw88395_dev_set_volume(aw88395->aw_pa, vol_desc->ctl_volume); in aw88395_volume_set()
287 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); in aw88395_get_fade_step() local
289 ucontrol->value.integer.value[0] = aw88395->aw_pa->fade_step; in aw88395_get_fade_step()
298 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); in aw88395_set_fade_step() local
307 if (aw88395->aw_pa->fade_step != value) { in aw88395_set_fade_step()
308 aw88395->aw_pa->fade_step = value; in aw88395_set_fade_step()
319 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); in aw88395_re_get() local
320 struct aw_device *aw_dev = aw88395->aw_pa; in aw88395_re_get()
331 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); in aw88395_re_set() local
334 struct aw_device *aw_dev = aw88395->aw_pa; in aw88395_re_set()
369 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); in aw88395_playback_event() local
371 mutex_lock(&aw88395->lock); in aw88395_playback_event()
374 aw88395_start(aw88395, AW88395_ASYNC_START); in aw88395_playback_event()
377 aw88395_dev_stop(aw88395->aw_pa); in aw88395_playback_event()
382 mutex_unlock(&aw88395->lock); in aw88395_playback_event()
407 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); in aw88395_codec_probe() local
410 INIT_DELAYED_WORK(&aw88395->start_work, aw88395_startup_work); in aw88395_codec_probe()
432 struct aw88395 *aw88395 = snd_soc_component_get_drvdata(aw_codec); in aw88395_codec_remove() local
434 cancel_delayed_work_sync(&aw88395->start_work); in aw88395_codec_remove()
442 static struct aw88395 *aw88395_malloc_init(struct i2c_client *i2c) in aw88395_malloc_init()
444 struct aw88395 *aw88395 = devm_kzalloc(&i2c->dev, in aw88395_malloc_init() local
445 sizeof(struct aw88395), GFP_KERNEL); in aw88395_malloc_init()
446 if (!aw88395) in aw88395_malloc_init()
449 mutex_init(&aw88395->lock); in aw88395_malloc_init()
451 return aw88395; in aw88395_malloc_init()
454 static void aw88395_hw_reset(struct aw88395 *aw88395) in aw88395_hw_reset() argument
456 if (aw88395->reset_gpio) { in aw88395_hw_reset()
457 gpiod_set_value_cansleep(aw88395->reset_gpio, 0); in aw88395_hw_reset()
459 gpiod_set_value_cansleep(aw88395->reset_gpio, 1); in aw88395_hw_reset()
462 dev_err(aw88395->aw_pa->dev, "%s failed", __func__); in aw88395_hw_reset()
466 static int aw88395_request_firmware_file(struct aw88395 *aw88395) in aw88395_request_firmware_file() argument
471 aw88395->aw_pa->fw_status = AW88395_DEV_FW_FAILED; in aw88395_request_firmware_file()
473 ret = request_firmware(&cont, AW88395_ACF_FILE, aw88395->aw_pa->dev); in aw88395_request_firmware_file()
475 dev_err(aw88395->aw_pa->dev, "load [%s] failed!", AW88395_ACF_FILE); in aw88395_request_firmware_file()
479 dev_info(aw88395->aw_pa->dev, "loaded %s - size: %zu\n", in aw88395_request_firmware_file()
482 aw88395->aw_cfg = devm_kzalloc(aw88395->aw_pa->dev, cont->size + sizeof(int), GFP_KERNEL); in aw88395_request_firmware_file()
483 if (!aw88395->aw_cfg) { in aw88395_request_firmware_file()
487 aw88395->aw_cfg->len = (int)cont->size; in aw88395_request_firmware_file()
488 memcpy(aw88395->aw_cfg->data, cont->data, cont->size); in aw88395_request_firmware_file()
491 ret = aw88395_dev_load_acf_check(aw88395->aw_pa, aw88395->aw_cfg); in aw88395_request_firmware_file()
493 dev_err(aw88395->aw_pa->dev, "Load [%s] failed ....!", AW88395_ACF_FILE); in aw88395_request_firmware_file()
497 dev_dbg(aw88395->aw_pa->dev, "%s : bin load success\n", __func__); in aw88395_request_firmware_file()
499 mutex_lock(&aw88395->lock); in aw88395_request_firmware_file()
501 ret = aw88395_dev_init(aw88395->aw_pa, aw88395->aw_cfg); in aw88395_request_firmware_file()
503 dev_err(aw88395->aw_pa->dev, "dev init failed"); in aw88395_request_firmware_file()
504 mutex_unlock(&aw88395->lock); in aw88395_request_firmware_file()
511 struct aw88395 *aw88395; in aw88395_i2c_probe() local
519 aw88395 = aw88395_malloc_init(i2c); in aw88395_i2c_probe()
520 if (!aw88395) { in aw88395_i2c_probe()
524 i2c_set_clientdata(i2c, aw88395); in aw88395_i2c_probe()
526 aw88395->reset_gpio = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_LOW); in aw88395_i2c_probe()
527 if (IS_ERR(aw88395->reset_gpio)) in aw88395_i2c_probe()
531 aw88395_hw_reset(aw88395); in aw88395_i2c_probe()
533 aw88395->regmap = devm_regmap_init_i2c(i2c, &aw88395_remap_config); in aw88395_i2c_probe()
534 if (IS_ERR(aw88395->regmap)) { in aw88395_i2c_probe()
535 ret = PTR_ERR(aw88395->regmap); in aw88395_i2c_probe()
541 ret = aw88395_init(&aw88395->aw_pa, i2c, aw88395->regmap); in aw88395_i2c_probe()
545 ret = aw88395_request_firmware_file(aw88395); in aw88395_i2c_probe()