Lines Matching refs:cs35l56
53 static void cs35l56_hda_wait_dsp_ready(struct cs35l56_hda *cs35l56) in cs35l56_hda_wait_dsp_ready() argument
56 flush_work(&cs35l56->dsp_work); in cs35l56_hda_wait_dsp_ready()
59 static void cs35l56_hda_play(struct cs35l56_hda *cs35l56) in cs35l56_hda_play() argument
64 cs35l56_hda_wait_dsp_ready(cs35l56); in cs35l56_hda_play()
66 pm_runtime_get_sync(cs35l56->base.dev); in cs35l56_hda_play()
67 ret = cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_AUDIO_PLAY); in cs35l56_hda_play()
70 ret = regmap_read_poll_timeout(cs35l56->base.regmap, in cs35l56_hda_play()
76 dev_warn(cs35l56->base.dev, "PS0 wait failed: %d\n", ret); in cs35l56_hda_play()
78 regmap_set_bits(cs35l56->base.regmap, CS35L56_ASP1_ENABLES1, in cs35l56_hda_play()
80 cs35l56->asp_tx_mask); in cs35l56_hda_play()
81 cs35l56->playing = true; in cs35l56_hda_play()
84 static void cs35l56_hda_pause(struct cs35l56_hda *cs35l56) in cs35l56_hda_pause() argument
86 cs35l56->playing = false; in cs35l56_hda_pause()
87 cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_AUDIO_PAUSE); in cs35l56_hda_pause()
88 regmap_clear_bits(cs35l56->base.regmap, CS35L56_ASP1_ENABLES1, in cs35l56_hda_pause()
93 pm_runtime_mark_last_busy(cs35l56->base.dev); in cs35l56_hda_pause()
94 pm_runtime_put_autosuspend(cs35l56->base.dev); in cs35l56_hda_pause()
99 struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev); in cs35l56_hda_playback_hook() local
101 dev_dbg(cs35l56->base.dev, "%s()%d: action: %d\n", __func__, __LINE__, action); in cs35l56_hda_playback_hook()
105 if (cs35l56->playing) in cs35l56_hda_playback_hook()
109 if (cs35l56->suspended) { in cs35l56_hda_playback_hook()
110 cs35l56->playing = true; in cs35l56_hda_playback_hook()
114 cs35l56_hda_play(cs35l56); in cs35l56_hda_playback_hook()
117 if (!cs35l56->playing) in cs35l56_hda_playback_hook()
120 cs35l56_hda_pause(cs35l56); in cs35l56_hda_playback_hook()
129 struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev); in cs35l56_hda_runtime_suspend() local
131 if (cs35l56->cs_dsp.booted) in cs35l56_hda_runtime_suspend()
132 cs_dsp_stop(&cs35l56->cs_dsp); in cs35l56_hda_runtime_suspend()
134 return cs35l56_runtime_suspend_common(&cs35l56->base); in cs35l56_hda_runtime_suspend()
139 struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev); in cs35l56_hda_runtime_resume() local
142 ret = cs35l56_runtime_resume_common(&cs35l56->base, false); in cs35l56_hda_runtime_resume()
146 if (cs35l56->cs_dsp.booted) { in cs35l56_hda_runtime_resume()
147 ret = cs_dsp_run(&cs35l56->cs_dsp); in cs35l56_hda_runtime_resume()
149 dev_dbg(cs35l56->base.dev, "%s: cs_dsp_run ret %d\n", __func__, ret); in cs35l56_hda_runtime_resume()
154 ret = cs35l56_force_sync_asp1_registers_from_cache(&cs35l56->base); in cs35l56_hda_runtime_resume()
161 cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_ALLOW_AUTO_HIBERNATE); in cs35l56_hda_runtime_resume()
162 regmap_write(cs35l56->base.regmap, CS35L56_DSP_VIRTUAL1_MBOX_1, in cs35l56_hda_runtime_resume()
165 regcache_cache_only(cs35l56->base.regmap, true); in cs35l56_hda_runtime_resume()
187 struct cs35l56_hda *cs35l56 = (struct cs35l56_hda *)kcontrol->private_data; in cs35l56_hda_mixer_get() local
191 cs35l56_hda_wait_dsp_ready(cs35l56); in cs35l56_hda_mixer_get()
193 regmap_read(cs35l56->base.regmap, kcontrol->private_value, ®_val); in cs35l56_hda_mixer_get()
209 struct cs35l56_hda *cs35l56 = (struct cs35l56_hda *)kcontrol->private_data; in cs35l56_hda_mixer_put() local
216 cs35l56_hda_wait_dsp_ready(cs35l56); in cs35l56_hda_mixer_put()
218 regmap_update_bits_check(cs35l56->base.regmap, kcontrol->private_value, in cs35l56_hda_mixer_put()
238 struct cs35l56_hda *cs35l56 = (struct cs35l56_hda *)kcontrol->private_data; in cs35l56_hda_posture_get() local
242 cs35l56_hda_wait_dsp_ready(cs35l56); in cs35l56_hda_posture_get()
244 ret = regmap_read(cs35l56->base.regmap, CS35L56_MAIN_POSTURE_NUMBER, &pos); in cs35l56_hda_posture_get()
256 struct cs35l56_hda *cs35l56 = (struct cs35l56_hda *)kcontrol->private_data; in cs35l56_hda_posture_put() local
265 cs35l56_hda_wait_dsp_ready(cs35l56); in cs35l56_hda_posture_put()
267 ret = regmap_update_bits_check(cs35l56->base.regmap, in cs35l56_hda_posture_put()
305 struct cs35l56_hda *cs35l56 = (struct cs35l56_hda *)kcontrol->private_data; in cs35l56_hda_vol_get() local
310 cs35l56_hda_wait_dsp_ready(cs35l56); in cs35l56_hda_vol_get()
312 ret = regmap_read(cs35l56->base.regmap, CS35L56_MAIN_RENDER_USER_VOLUME, &raw_vol); in cs35l56_hda_vol_get()
331 struct cs35l56_hda *cs35l56 = (struct cs35l56_hda *)kcontrol->private_data; in cs35l56_hda_vol_put() local
344 cs35l56_hda_wait_dsp_ready(cs35l56); in cs35l56_hda_vol_put()
346 ret = regmap_update_bits_check(cs35l56->base.regmap, in cs35l56_hda_vol_put()
356 static void cs35l56_hda_create_controls(struct cs35l56_hda *cs35l56) in cs35l56_hda_create_controls() argument
368 snprintf(name, sizeof(name), "%s Posture Number", cs35l56->amp_name); in cs35l56_hda_create_controls()
370 cs35l56->posture_ctl = snd_ctl_new1(&ctl_template, cs35l56); in cs35l56_hda_create_controls()
371 if (snd_ctl_add(cs35l56->codec->card, cs35l56->posture_ctl)) in cs35l56_hda_create_controls()
372 dev_err(cs35l56->base.dev, "Failed to add KControl: %s\n", ctl_template.name); in cs35l56_hda_create_controls()
379 BUILD_BUG_ON(ARRAY_SIZE(cs35l56->mixer_ctl) != ARRAY_SIZE(cs35l56_hda_mixer_controls)); in cs35l56_hda_create_controls()
382 snprintf(name, sizeof(name), "%s %s", cs35l56->amp_name, in cs35l56_hda_create_controls()
385 cs35l56->mixer_ctl[i] = snd_ctl_new1(&ctl_template, cs35l56); in cs35l56_hda_create_controls()
386 if (snd_ctl_add(cs35l56->codec->card, cs35l56->mixer_ctl[i])) { in cs35l56_hda_create_controls()
387 dev_err(cs35l56->base.dev, "Failed to add KControl: %s\n", in cs35l56_hda_create_controls()
397 snprintf(name, sizeof(name), "%s Speaker Playback Volume", cs35l56->amp_name); in cs35l56_hda_create_controls()
399 cs35l56->volume_ctl = snd_ctl_new1(&ctl_template, cs35l56); in cs35l56_hda_create_controls()
400 if (snd_ctl_add(cs35l56->codec->card, cs35l56->volume_ctl)) in cs35l56_hda_create_controls()
401 dev_err(cs35l56->base.dev, "Failed to add KControl: %s\n", ctl_template.name); in cs35l56_hda_create_controls()
404 static void cs35l56_hda_remove_controls(struct cs35l56_hda *cs35l56) in cs35l56_hda_remove_controls() argument
408 for (i = ARRAY_SIZE(cs35l56->mixer_ctl) - 1; i >= 0; i--) in cs35l56_hda_remove_controls()
409 snd_ctl_remove(cs35l56->codec->card, cs35l56->mixer_ctl[i]); in cs35l56_hda_remove_controls()
411 snd_ctl_remove(cs35l56->codec->card, cs35l56->posture_ctl); in cs35l56_hda_remove_controls()
412 snd_ctl_remove(cs35l56->codec->card, cs35l56->volume_ctl); in cs35l56_hda_remove_controls()
419 static int cs35l56_hda_request_firmware_file(struct cs35l56_hda *cs35l56, in cs35l56_hda_request_firmware_file() argument
455 ret = firmware_request_nowarn(firmware, *filename, cs35l56->base.dev); in cs35l56_hda_request_firmware_file()
457 dev_dbg(cs35l56->base.dev, "Failed to request '%s'\n", *filename); in cs35l56_hda_request_firmware_file()
463 dev_dbg(cs35l56->base.dev, "Found '%s'\n", *filename); in cs35l56_hda_request_firmware_file()
468 static void cs35l56_hda_request_firmware_files(struct cs35l56_hda *cs35l56, in cs35l56_hda_request_firmware_files() argument
475 const char *system_name = cs35l56->system_name; in cs35l56_hda_request_firmware_files()
476 const char *amp_name = cs35l56->amp_name; in cs35l56_hda_request_firmware_files()
483 cs35l56->base.type, in cs35l56_hda_request_firmware_files()
484 cs35l56->base.rev, in cs35l56_hda_request_firmware_files()
485 cs35l56->base.secured ? "-s" : "", in cs35l56_hda_request_firmware_files()
490 cs35l56->base.type, in cs35l56_hda_request_firmware_files()
491 cs35l56->base.rev, in cs35l56_hda_request_firmware_files()
492 cs35l56->base.secured ? "-s" : ""); in cs35l56_hda_request_firmware_files()
496 if (!cs35l56_hda_request_firmware_file(cs35l56, wmfw_firmware, wmfw_filename, in cs35l56_hda_request_firmware_files()
498 cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename, in cs35l56_hda_request_firmware_files()
505 if (!cs35l56_hda_request_firmware_file(cs35l56, wmfw_firmware, wmfw_filename, in cs35l56_hda_request_firmware_files()
508 cs35l56_hda_request_firmware_file(cs35l56, in cs35l56_hda_request_firmware_files()
513 cs35l56_hda_request_firmware_file(cs35l56, in cs35l56_hda_request_firmware_files()
525 cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename, in cs35l56_hda_request_firmware_files()
528 cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename, in cs35l56_hda_request_firmware_files()
535 ret = cs35l56_hda_request_firmware_file(cs35l56, wmfw_firmware, wmfw_filename, in cs35l56_hda_request_firmware_files()
538 cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename, in cs35l56_hda_request_firmware_files()
544 cs35l56_hda_request_firmware_file(cs35l56, coeff_firmware, coeff_filename, in cs35l56_hda_request_firmware_files()
562 static void cs35l56_hda_apply_calibration(struct cs35l56_hda *cs35l56) in cs35l56_hda_apply_calibration() argument
566 if (!cs35l56->base.cal_data_valid || cs35l56->base.secured) in cs35l56_hda_apply_calibration()
569 ret = cs_amp_write_cal_coeffs(&cs35l56->cs_dsp, in cs35l56_hda_apply_calibration()
571 &cs35l56->base.cal_data); in cs35l56_hda_apply_calibration()
573 dev_warn(cs35l56->base.dev, "Failed to write calibration: %d\n", ret); in cs35l56_hda_apply_calibration()
575 dev_info(cs35l56->base.dev, "Calibration applied\n"); in cs35l56_hda_apply_calibration()
578 static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56) in cs35l56_hda_fw_load() argument
593 if (cs35l56->base.fw_patched) in cs35l56_hda_fw_load()
594 cs_dsp_power_down(&cs35l56->cs_dsp); in cs35l56_hda_fw_load()
596 cs35l56->base.fw_patched = false; in cs35l56_hda_fw_load()
598 ret = pm_runtime_resume_and_get(cs35l56->base.dev); in cs35l56_hda_fw_load()
600 dev_err(cs35l56->base.dev, "Failed to resume and get %d\n", ret); in cs35l56_hda_fw_load()
609 ret = cs35l56_read_prot_status(&cs35l56->base, &firmware_missing, &preloaded_fw_ver); in cs35l56_hda_fw_load()
616 cs35l56_hda_request_firmware_files(cs35l56, preloaded_fw_ver, in cs35l56_hda_fw_load()
625 dev_err(cs35l56->base.dev, ".bin file required but not found\n"); in cs35l56_hda_fw_load()
629 mutex_lock(&cs35l56->base.irq_lock); in cs35l56_hda_fw_load()
638 ret = cs35l56_firmware_shutdown(&cs35l56->base); in cs35l56_hda_fw_load()
643 ret = cs_dsp_power_up(&cs35l56->cs_dsp, wmfw_firmware, wmfw_filename, in cs35l56_hda_fw_load()
646 dev_dbg(cs35l56->base.dev, "%s: cs_dsp_power_up ret %d\n", __func__, ret); in cs35l56_hda_fw_load()
651 dev_dbg(cs35l56->base.dev, "Loaded WMFW Firmware: %s\n", wmfw_filename); in cs35l56_hda_fw_load()
654 dev_dbg(cs35l56->base.dev, "Loaded Coefficients: %s\n", coeff_filename); in cs35l56_hda_fw_load()
658 cs35l56_system_reset(&cs35l56->base, false); in cs35l56_hda_fw_load()
659 regcache_mark_dirty(cs35l56->base.regmap); in cs35l56_hda_fw_load()
660 ret = cs35l56_wait_for_firmware_boot(&cs35l56->base); in cs35l56_hda_fw_load()
664 regcache_cache_only(cs35l56->base.regmap, false); in cs35l56_hda_fw_load()
668 ret = cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_PREVENT_AUTO_HIBERNATE); in cs35l56_hda_fw_load()
672 regcache_sync(cs35l56->base.regmap); in cs35l56_hda_fw_load()
674 regmap_clear_bits(cs35l56->base.regmap, CS35L56_PROTECTION_STATUS, in cs35l56_hda_fw_load()
676 cs35l56->base.fw_patched = true; in cs35l56_hda_fw_load()
678 ret = cs_dsp_run(&cs35l56->cs_dsp); in cs35l56_hda_fw_load()
680 dev_dbg(cs35l56->base.dev, "%s: cs_dsp_run ret %d\n", __func__, ret); in cs35l56_hda_fw_load()
682 cs35l56_hda_apply_calibration(cs35l56); in cs35l56_hda_fw_load()
683 ret = cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_AUDIO_REINIT); in cs35l56_hda_fw_load()
685 cs_dsp_stop(&cs35l56->cs_dsp); in cs35l56_hda_fw_load()
688 if (!cs35l56->base.fw_patched) in cs35l56_hda_fw_load()
689 cs_dsp_power_down(&cs35l56->cs_dsp); in cs35l56_hda_fw_load()
691 mutex_unlock(&cs35l56->base.irq_lock); in cs35l56_hda_fw_load()
696 pm_runtime_put(cs35l56->base.dev); in cs35l56_hda_fw_load()
701 struct cs35l56_hda *cs35l56 = container_of(work, struct cs35l56_hda, dsp_work); in cs35l56_hda_dsp_work() local
703 cs35l56_hda_fw_load(cs35l56); in cs35l56_hda_dsp_work()
708 struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev); in cs35l56_hda_bind() local
712 comp = hda_component_from_index(parent, cs35l56->index); in cs35l56_hda_bind()
720 cs35l56->codec = parent->codec; in cs35l56_hda_bind()
724 queue_work(system_long_wq, &cs35l56->dsp_work); in cs35l56_hda_bind()
726 cs35l56_hda_create_controls(cs35l56); in cs35l56_hda_bind()
729 cs35l56->debugfs_root = debugfs_create_dir(dev_name(cs35l56->base.dev), sound_debugfs_root); in cs35l56_hda_bind()
730 cs_dsp_init_debugfs(&cs35l56->cs_dsp, cs35l56->debugfs_root); in cs35l56_hda_bind()
733 dev_dbg(cs35l56->base.dev, "Bound\n"); in cs35l56_hda_bind()
740 struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev); in cs35l56_hda_unbind() local
744 cancel_work_sync(&cs35l56->dsp_work); in cs35l56_hda_unbind()
746 cs35l56_hda_remove_controls(cs35l56); in cs35l56_hda_unbind()
749 cs_dsp_cleanup_debugfs(&cs35l56->cs_dsp); in cs35l56_hda_unbind()
750 debugfs_remove_recursive(cs35l56->debugfs_root); in cs35l56_hda_unbind()
753 if (cs35l56->base.fw_patched) in cs35l56_hda_unbind()
754 cs_dsp_power_down(&cs35l56->cs_dsp); in cs35l56_hda_unbind()
756 comp = hda_component_from_index(parent, cs35l56->index); in cs35l56_hda_unbind()
760 cs35l56->codec = NULL; in cs35l56_hda_unbind()
762 dev_dbg(cs35l56->base.dev, "Unbound\n"); in cs35l56_hda_unbind()
772 struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev); in cs35l56_hda_system_suspend() local
774 cs35l56_hda_wait_dsp_ready(cs35l56); in cs35l56_hda_system_suspend()
776 if (cs35l56->playing) in cs35l56_hda_system_suspend()
777 cs35l56_hda_pause(cs35l56); in cs35l56_hda_system_suspend()
779 cs35l56->suspended = true; in cs35l56_hda_system_suspend()
787 if (cs35l56->base.irq) in cs35l56_hda_system_suspend()
788 disable_irq(cs35l56->base.irq); in cs35l56_hda_system_suspend()
795 struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev); in cs35l56_hda_system_suspend_late() local
801 if (cs35l56->base.reset_gpio) { in cs35l56_hda_system_suspend_late()
802 gpiod_set_value_cansleep(cs35l56->base.reset_gpio, 0); in cs35l56_hda_system_suspend_late()
811 struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev); in cs35l56_hda_system_suspend_no_irq() local
814 if (cs35l56->base.irq) in cs35l56_hda_system_suspend_no_irq()
815 enable_irq(cs35l56->base.irq); in cs35l56_hda_system_suspend_no_irq()
822 struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev); in cs35l56_hda_system_resume_no_irq() local
831 if (cs35l56->base.irq) in cs35l56_hda_system_resume_no_irq()
832 disable_irq(cs35l56->base.irq); in cs35l56_hda_system_resume_no_irq()
839 struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev); in cs35l56_hda_system_resume_early() local
842 if (cs35l56->base.reset_gpio) { in cs35l56_hda_system_resume_early()
843 gpiod_set_value_cansleep(cs35l56->base.reset_gpio, 0); in cs35l56_hda_system_resume_early()
847 gpiod_set_value_cansleep(cs35l56->base.reset_gpio, 1); in cs35l56_hda_system_resume_early()
856 struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev); in cs35l56_hda_system_resume() local
861 if (cs35l56->base.irq) in cs35l56_hda_system_resume()
862 enable_irq(cs35l56->base.irq); in cs35l56_hda_system_resume()
867 cs35l56->suspended = false; in cs35l56_hda_system_resume()
869 if (!cs35l56->codec) in cs35l56_hda_system_resume()
872 ret = cs35l56_is_fw_reload_needed(&cs35l56->base); in cs35l56_hda_system_resume()
873 dev_dbg(cs35l56->base.dev, "fw_reload_needed: %d\n", ret); in cs35l56_hda_system_resume()
875 queue_work(system_long_wq, &cs35l56->dsp_work); in cs35l56_hda_system_resume()
877 if (cs35l56->playing) in cs35l56_hda_system_resume()
878 cs35l56_hda_play(cs35l56); in cs35l56_hda_system_resume()
883 static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int hid, int id) in cs35l56_hda_read_acpi() argument
896 if (!ACPI_COMPANION(cs35l56->base.dev)) { in cs35l56_hda_read_acpi()
900 dev_err(cs35l56->base.dev, "Failed to find an ACPI device for %s\n", in cs35l56_hda_read_acpi()
901 dev_name(cs35l56->base.dev)); in cs35l56_hda_read_acpi()
904 ACPI_COMPANION_SET(cs35l56->base.dev, adev); in cs35l56_hda_read_acpi()
908 ret = device_property_count_u32(cs35l56->base.dev, property); in cs35l56_hda_read_acpi()
918 ret = device_property_read_u32_array(cs35l56->base.dev, property, values, nval); in cs35l56_hda_read_acpi()
922 cs35l56->index = -1; in cs35l56_hda_read_acpi()
925 cs35l56->index = i; in cs35l56_hda_read_acpi()
933 if (cs35l56->index == -1) { in cs35l56_hda_read_acpi()
934 dev_dbg(cs35l56->base.dev, "No index found in %s\n", property); in cs35l56_hda_read_acpi()
939 sub = acpi_get_subsystem_id(ACPI_HANDLE(cs35l56->base.dev)); in cs35l56_hda_read_acpi()
942 dev_info(cs35l56->base.dev, in cs35l56_hda_read_acpi()
946 ret = cirrus_scodec_get_speaker_id(cs35l56->base.dev, cs35l56->index, nval, -1); in cs35l56_hda_read_acpi()
948 cs35l56->system_name = sub; in cs35l56_hda_read_acpi()
950 cs35l56->system_name = kasprintf(GFP_KERNEL, "%s-spkid%d", sub, ret); in cs35l56_hda_read_acpi()
952 if (!cs35l56->system_name) in cs35l56_hda_read_acpi()
959 cs35l56->base.reset_gpio = devm_gpiod_get_index_optional(cs35l56->base.dev, in cs35l56_hda_read_acpi()
961 cs35l56->index, in cs35l56_hda_read_acpi()
963 if (IS_ERR(cs35l56->base.reset_gpio)) { in cs35l56_hda_read_acpi()
964 ret = PTR_ERR(cs35l56->base.reset_gpio); in cs35l56_hda_read_acpi()
971 return dev_err_probe(cs35l56->base.dev, ret, "Failed to get reset GPIO\n"); in cs35l56_hda_read_acpi()
973 dev_info(cs35l56->base.dev, "Reset GPIO busy, assume shared reset\n"); in cs35l56_hda_read_acpi()
974 cs35l56->base.reset_gpio = NULL; in cs35l56_hda_read_acpi()
981 dev_err(cs35l56->base.dev, "Failed property %s: %d\n", property, ret); in cs35l56_hda_read_acpi()
986 int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id) in cs35l56_hda_common_probe() argument
990 mutex_init(&cs35l56->base.irq_lock); in cs35l56_hda_common_probe()
991 dev_set_drvdata(cs35l56->base.dev, cs35l56); in cs35l56_hda_common_probe()
993 INIT_WORK(&cs35l56->dsp_work, cs35l56_hda_dsp_work); in cs35l56_hda_common_probe()
995 ret = cs35l56_hda_read_acpi(cs35l56, hid, id); in cs35l56_hda_common_probe()
999 cs35l56->amp_name = devm_kasprintf(cs35l56->base.dev, GFP_KERNEL, "AMP%d", in cs35l56_hda_common_probe()
1000 cs35l56->index + 1); in cs35l56_hda_common_probe()
1001 if (!cs35l56->amp_name) { in cs35l56_hda_common_probe()
1006 cs35l56->base.cal_index = -1; in cs35l56_hda_common_probe()
1008 cs35l56_init_cs_dsp(&cs35l56->base, &cs35l56->cs_dsp); in cs35l56_hda_common_probe()
1009 cs35l56->cs_dsp.client_ops = &cs35l56_hda_client_ops; in cs35l56_hda_common_probe()
1011 if (cs35l56->base.reset_gpio) { in cs35l56_hda_common_probe()
1012 dev_dbg(cs35l56->base.dev, "Hard reset\n"); in cs35l56_hda_common_probe()
1018 gpiod_set_value_cansleep(cs35l56->base.reset_gpio, 0); in cs35l56_hda_common_probe()
1020 gpiod_set_value_cansleep(cs35l56->base.reset_gpio, 1); in cs35l56_hda_common_probe()
1023 ret = cs35l56_hw_init(&cs35l56->base); in cs35l56_hda_common_probe()
1028 cs35l56_system_reset(&cs35l56->base, false); in cs35l56_hda_common_probe()
1029 ret = cs35l56_wait_for_firmware_boot(&cs35l56->base); in cs35l56_hda_common_probe()
1033 regcache_cache_only(cs35l56->base.regmap, false); in cs35l56_hda_common_probe()
1035 ret = cs35l56_set_patch(&cs35l56->base); in cs35l56_hda_common_probe()
1039 regcache_mark_dirty(cs35l56->base.regmap); in cs35l56_hda_common_probe()
1040 regcache_sync(cs35l56->base.regmap); in cs35l56_hda_common_probe()
1043 ret = cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_PREVENT_AUTO_HIBERNATE); in cs35l56_hda_common_probe()
1047 ret = cs35l56_get_calibration(&cs35l56->base); in cs35l56_hda_common_probe()
1051 ret = cs_dsp_halo_init(&cs35l56->cs_dsp); in cs35l56_hda_common_probe()
1053 dev_err_probe(cs35l56->base.dev, ret, "cs_dsp_halo_init failed\n"); in cs35l56_hda_common_probe()
1057 dev_info(cs35l56->base.dev, "DSP system name: '%s', amp name: '%s'\n", in cs35l56_hda_common_probe()
1058 cs35l56->system_name, cs35l56->amp_name); in cs35l56_hda_common_probe()
1060 regmap_multi_reg_write(cs35l56->base.regmap, cs35l56_hda_dai_config, in cs35l56_hda_common_probe()
1062 ret = cs35l56_force_sync_asp1_registers_from_cache(&cs35l56->base); in cs35l56_hda_common_probe()
1070 cs35l56->asp_tx_mask = BIT(cs35l56->index); in cs35l56_hda_common_probe()
1072 pm_runtime_set_autosuspend_delay(cs35l56->base.dev, 3000); in cs35l56_hda_common_probe()
1073 pm_runtime_use_autosuspend(cs35l56->base.dev); in cs35l56_hda_common_probe()
1074 pm_runtime_set_active(cs35l56->base.dev); in cs35l56_hda_common_probe()
1075 pm_runtime_mark_last_busy(cs35l56->base.dev); in cs35l56_hda_common_probe()
1076 pm_runtime_enable(cs35l56->base.dev); in cs35l56_hda_common_probe()
1078 cs35l56->base.init_done = true; in cs35l56_hda_common_probe()
1080 ret = component_add(cs35l56->base.dev, &cs35l56_hda_comp_ops); in cs35l56_hda_common_probe()
1082 dev_err(cs35l56->base.dev, "Register component failed: %d\n", ret); in cs35l56_hda_common_probe()
1089 pm_runtime_disable(cs35l56->base.dev); in cs35l56_hda_common_probe()
1091 cs_dsp_remove(&cs35l56->cs_dsp); in cs35l56_hda_common_probe()
1093 gpiod_set_value_cansleep(cs35l56->base.reset_gpio, 0); in cs35l56_hda_common_probe()
1101 struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev); in cs35l56_hda_remove() local
1103 component_del(cs35l56->base.dev, &cs35l56_hda_comp_ops); in cs35l56_hda_remove()
1105 pm_runtime_dont_use_autosuspend(cs35l56->base.dev); in cs35l56_hda_remove()
1106 pm_runtime_get_sync(cs35l56->base.dev); in cs35l56_hda_remove()
1107 pm_runtime_disable(cs35l56->base.dev); in cs35l56_hda_remove()
1109 cs_dsp_remove(&cs35l56->cs_dsp); in cs35l56_hda_remove()
1111 kfree(cs35l56->system_name); in cs35l56_hda_remove()
1112 pm_runtime_put_noidle(cs35l56->base.dev); in cs35l56_hda_remove()
1114 gpiod_set_value_cansleep(cs35l56->base.reset_gpio, 0); in cs35l56_hda_remove()