Lines Matching +full:i2s +full:- +full:tx +full:- +full:route
1 // SPDX-License-Identifier: GPL-2.0-only
3 // aw88261.c -- AW88261 ALSA SoC Audio driver
23 .max_register = AW88261_REG_MAX - 1,
30 struct aw_volume_desc *vol_desc = &aw_dev->volume_desc; in aw88261_dev_set_volume()
34 volume = min((value + vol_desc->init_volume), (unsigned int)AW88261_MUTE_VOL); in aw88261_dev_set_volume()
37 regmap_read(aw_dev->regmap, AW88261_SYSCTRL2_REG, ®_value); in aw88261_dev_set_volume()
41 dev_dbg(aw_dev->dev, "value 0x%x , real_value:0x%x", value, real_value); in aw88261_dev_set_volume()
43 regmap_write(aw_dev->regmap, AW88261_SYSCTRL2_REG, real_value); in aw88261_dev_set_volume()
48 struct aw_volume_desc *desc = &aw_dev->volume_desc; in aw88261_dev_fade_in()
49 int fade_in_vol = desc->ctl_volume; in aw88261_dev_fade_in()
50 int fade_step = aw_dev->fade_step; in aw88261_dev_fade_in()
53 if (fade_step == 0 || aw_dev->fade_in_time == 0) { in aw88261_dev_fade_in()
58 for (i = AW88261_MUTE_VOL; i >= fade_in_vol; i -= fade_step) { in aw88261_dev_fade_in()
60 usleep_range(aw_dev->fade_in_time, in aw88261_dev_fade_in()
61 aw_dev->fade_in_time + 10); in aw88261_dev_fade_in()
70 struct aw_volume_desc *desc = &aw_dev->volume_desc; in aw88261_dev_fade_out()
71 int fade_step = aw_dev->fade_step; in aw88261_dev_fade_out()
74 if (fade_step == 0 || aw_dev->fade_out_time == 0) { in aw88261_dev_fade_out()
79 for (i = desc->ctl_volume; i <= AW88261_MUTE_VOL; i += fade_step) { in aw88261_dev_fade_out()
81 usleep_range(aw_dev->fade_out_time, aw_dev->fade_out_time + 10); in aw88261_dev_fade_out()
86 usleep_range(aw_dev->fade_out_time, aw_dev->fade_out_time + 10); in aw88261_dev_fade_out()
93 regmap_update_bits(aw_dev->regmap, AW88261_I2SCFG1_REG, in aw88261_dev_i2s_tx_enable()
96 regmap_update_bits(aw_dev->regmap, AW88261_I2SCFG1_REG, in aw88261_dev_i2s_tx_enable()
103 regmap_update_bits(aw_dev->regmap, AW88261_SYSCTRL_REG, in aw88261_dev_pwd()
106 regmap_update_bits(aw_dev->regmap, AW88261_SYSCTRL_REG, in aw88261_dev_pwd()
113 regmap_update_bits(aw_dev->regmap, AW88261_SYSCTRL_REG, in aw88261_dev_amppd()
116 regmap_update_bits(aw_dev->regmap, AW88261_SYSCTRL_REG, in aw88261_dev_amppd()
124 regmap_update_bits(aw_dev->regmap, AW88261_SYSCTRL_REG, in aw88261_dev_mute()
127 regmap_update_bits(aw_dev->regmap, AW88261_SYSCTRL_REG, in aw88261_dev_mute()
138 regmap_read(aw_dev->regmap, AW88261_SYSINT_REG, &int_status); in aw88261_dev_clear_int_status()
140 regmap_read(aw_dev->regmap, AW88261_SYSINT_REG, &int_status); in aw88261_dev_clear_int_status()
142 dev_dbg(aw_dev->dev, "read interrupt reg = 0x%04x", int_status); in aw88261_dev_clear_int_status()
150 ret = regmap_read(aw_dev->regmap, AW88261_SYSST_REG, ®_val); in aw88261_dev_get_iis_status()
154 dev_err(aw_dev->dev, "check pll lock fail,reg_val:0x%04x", reg_val); in aw88261_dev_get_iis_status()
155 return -EINVAL; in aw88261_dev_get_iis_status()
168 dev_err(aw_dev->dev, "mode1 iis signal check error"); in aw88261_dev_check_mode1_pll()
175 return -EPERM; in aw88261_dev_check_mode1_pll()
183 ret = regmap_read(aw_dev->regmap, AW88261_PLLCTRL1_REG, ®_val); in aw88261_dev_check_mode2_pll()
189 dev_dbg(aw_dev->dev, "CCO_MUX is already divider"); in aw88261_dev_check_mode2_pll()
190 return -EPERM; in aw88261_dev_check_mode2_pll()
194 ret = regmap_update_bits(aw_dev->regmap, AW88261_PLLCTRL1_REG, in aw88261_dev_check_mode2_pll()
202 dev_err(aw_dev->dev, "mode2 iis signal check error"); in aw88261_dev_check_mode2_pll()
210 ret = regmap_update_bits(aw_dev->regmap, AW88261_PLLCTRL1_REG, in aw88261_dev_check_mode2_pll()
217 dev_err(aw_dev->dev, "mode2 switch to mode1, iis signal check error"); in aw88261_dev_check_mode2_pll()
234 dev_dbg(aw_dev->dev, "mode1 check iis failed try switch to mode2 check"); in aw88261_dev_check_syspll()
237 dev_err(aw_dev->dev, "mode2 check iis failed"); in aw88261_dev_check_syspll()
252 ret = regmap_read(aw_dev->regmap, AW88261_SYSST_REG, ®_val); in aw88261_dev_check_sysst()
259 dev_err(aw_dev->dev, "check sysst fail, reg_val=0x%04x, check:0x%x", in aw88261_dev_check_sysst()
267 return -EPERM; in aw88261_dev_check_sysst()
273 regmap_update_bits(aw_dev->regmap, AW88261_SYSCTRL_REG, in aw88261_dev_uls_hmute()
277 regmap_update_bits(aw_dev->regmap, AW88261_SYSCTRL_REG, in aw88261_dev_uls_hmute()
284 if (aw88261->frcset_en == AW88261_FRCSET_ENABLE) { in aw88261_reg_force_set()
286 regmap_update_bits(aw88261->regmap, AW88261_BSTCTRL3_REG, in aw88261_reg_force_set()
289 regmap_update_bits(aw88261->regmap, AW88261_BSTCTRL5_REG, in aw88261_reg_force_set()
292 regmap_update_bits(aw88261->regmap, AW88261_BSTCTRL6_REG, in aw88261_reg_force_set()
295 regmap_update_bits(aw88261->regmap, AW88261_BSTCTRL7_REG, in aw88261_reg_force_set()
298 regmap_update_bits(aw88261->regmap, AW88261_BSTCTRL8_REG, in aw88261_reg_force_set()
301 regmap_update_bits(aw88261->regmap, AW88261_BSTCTRL9_REG, in aw88261_reg_force_set()
304 dev_dbg(aw88261->aw_pa->dev, "needn't set reg value"); in aw88261_reg_force_set()
314 ret = regmap_read(aw_dev->regmap, AW88261_EFRH4_REG, ®_val); in aw88261_dev_get_icalk()
320 ret = regmap_read(aw_dev->regmap, AW88261_EFRL4_REG, ®_val); in aw88261_dev_get_icalk()
342 ret = regmap_read(aw_dev->regmap, AW88261_EFRH3_REG, ®_val); in aw88261_dev_get_vcalk()
348 ret = regmap_read(aw_dev->regmap, AW88261_EFRL3_REG, ®_val); in aw88261_dev_get_vcalk()
381 return -EINVAL; in aw88261_dev_set_vcalb()
386 dev_dbg(aw_dev->dev, "icalk=%d, vcalk=%d, vcalb=%d, reg_val=0x%04x", in aw88261_dev_set_vcalb()
388 ret = regmap_write(aw_dev->regmap, AW88261_VSNTM1_REG, reg_val); in aw88261_dev_set_vcalb()
396 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_dev_reg_update()
397 struct aw_volume_desc *vol_desc = &aw_dev->volume_desc; in aw88261_dev_reg_update()
405 dev_err(aw_dev->dev, "reg data is null or len is 0"); in aw88261_dev_reg_update()
406 return -EINVAL; in aw88261_dev_reg_update()
413 dev_err(aw_dev->dev, "data len:%d unsupported", data_len); in aw88261_dev_reg_update()
414 return -EINVAL; in aw88261_dev_reg_update()
422 aw88261->amppd_st = reg_val & (~AW88261_AMPPD_MASK); in aw88261_dev_reg_update()
423 ret = regmap_read(aw_dev->regmap, reg_addr, &read_val); in aw88261_dev_reg_update()
440 aw88261->efuse_check = AW88261_EF_OR_CHECK; in aw88261_dev_reg_update()
442 aw88261->efuse_check = AW88261_EF_AND_CHECK; in aw88261_dev_reg_update()
447 /* close tx */ in aw88261_dev_reg_update()
455 aw_dev->volume_desc.init_volume = in aw88261_dev_reg_update()
462 ret = regmap_write(aw_dev->regmap, reg_addr, reg_val); in aw88261_dev_reg_update()
471 if (aw_dev->prof_cur != aw_dev->prof_index) in aw88261_dev_reg_update()
472 vol_desc->ctl_volume = 0; in aw88261_dev_reg_update()
475 aw88261_dev_set_volume(aw_dev, vol_desc->mute_volume); in aw88261_dev_reg_update()
482 struct aw_prof_info *prof_info = &aw_dev->prof_info; in aw88261_dev_get_prof_name()
485 if ((index >= aw_dev->prof_info.count) || (index < 0)) { in aw88261_dev_get_prof_name()
486 dev_err(aw_dev->dev, "index[%d] overflow count[%d]", in aw88261_dev_get_prof_name()
487 index, aw_dev->prof_info.count); in aw88261_dev_get_prof_name()
491 prof_desc = &aw_dev->prof_info.prof_desc[index]; in aw88261_dev_get_prof_name()
493 return prof_info->prof_name_list[prof_desc->id]; in aw88261_dev_get_prof_name()
499 if ((index >= aw_dev->prof_info.count) || (index < 0)) { in aw88261_dev_get_prof_data()
500 dev_err(aw_dev->dev, "%s: index[%d] overflow count[%d]\n", in aw88261_dev_get_prof_data()
501 __func__, index, aw_dev->prof_info.count); in aw88261_dev_get_prof_data()
502 return -EINVAL; in aw88261_dev_get_prof_data()
505 *prof_desc = &aw_dev->prof_info.prof_desc[index]; in aw88261_dev_get_prof_data()
512 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_dev_fw_update()
518 prof_name = aw88261_dev_get_prof_name(aw_dev, aw_dev->prof_index); in aw88261_dev_fw_update()
520 dev_err(aw_dev->dev, "get prof name failed"); in aw88261_dev_fw_update()
521 return -EINVAL; in aw88261_dev_fw_update()
524 dev_dbg(aw_dev->dev, "start update %s", prof_name); in aw88261_dev_fw_update()
526 ret = aw88261_dev_get_prof_data(aw_dev, aw_dev->prof_index, &prof_index_desc); in aw88261_dev_fw_update()
531 sec_desc = prof_index_desc->sec_desc; in aw88261_dev_fw_update()
535 dev_err(aw_dev->dev, "update reg failed"); in aw88261_dev_fw_update()
539 aw_dev->prof_cur = aw_dev->prof_index; in aw88261_dev_fw_update()
546 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_dev_start()
549 if (aw_dev->status == AW88261_DEV_PW_ON) { in aw88261_dev_start()
550 dev_info(aw_dev->dev, "already power on"); in aw88261_dev_start()
560 dev_err(aw_dev->dev, "pll check failed cannot start"); in aw88261_dev_start()
568 /* check i2s status */ in aw88261_dev_start()
571 dev_err(aw_dev->dev, "sysst check failed"); in aw88261_dev_start()
575 /* enable tx feedback */ in aw88261_dev_start()
578 if (aw88261->amppd_st) in aw88261_dev_start()
587 if (!aw88261->mute_st) in aw88261_dev_start()
592 aw_dev->status = AW88261_DEV_PW_ON; in aw88261_dev_start()
602 aw_dev->status = AW88261_DEV_PW_OFF; in aw88261_dev_start()
609 if (aw_dev->status == AW88261_DEV_PW_OFF) { in aw88261_dev_stop()
610 dev_info(aw_dev->dev, "already power off"); in aw88261_dev_stop()
614 aw_dev->status = AW88261_DEV_PW_OFF; in aw88261_dev_stop()
623 /* close tx feedback */ in aw88261_dev_stop()
638 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_reg_update()
642 ret = regmap_write(aw_dev->regmap, in aw88261_reg_update()
651 if (aw_dev->prof_cur != aw_dev->prof_index) { in aw88261_reg_update()
660 aw_dev->prof_cur = aw_dev->prof_index; in aw88261_reg_update()
670 ret = aw88261_reg_update(aw88261, aw88261->phase_sync); in aw88261_start_pa()
672 dev_err(aw88261->aw_pa->dev, "fw update failed, cnt:%d\n", i); in aw88261_start_pa()
677 dev_err(aw88261->aw_pa->dev, "aw88261 device start failed. retry = %d", i); in aw88261_start_pa()
680 dev_info(aw88261->aw_pa->dev, "start success\n"); in aw88261_start_pa()
691 mutex_lock(&aw88261->lock); in aw88261_startup_work()
693 mutex_unlock(&aw88261->lock); in aw88261_startup_work()
698 if (aw88261->aw_pa->fw_status != AW88261_DEV_FW_OK) in aw88261_start()
701 if (aw88261->aw_pa->status == AW88261_DEV_PW_ON) in aw88261_start()
708 &aw88261->start_work, in aw88261_start()
714 .name = "aw88261-aif",
738 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_get_fade_in_time()
740 ucontrol->value.integer.value[0] = aw_dev->fade_in_time; in aw88261_get_fade_in_time()
751 (struct soc_mixer_control *)kcontrol->private_value; in aw88261_set_fade_in_time()
752 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_set_fade_in_time()
755 time = ucontrol->value.integer.value[0]; in aw88261_set_fade_in_time()
757 if (time < mc->min || time > mc->max) in aw88261_set_fade_in_time()
758 return -EINVAL; in aw88261_set_fade_in_time()
760 if (time != aw_dev->fade_in_time) { in aw88261_set_fade_in_time()
761 aw_dev->fade_in_time = time; in aw88261_set_fade_in_time()
773 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_get_fade_out_time()
775 ucontrol->value.integer.value[0] = aw_dev->fade_out_time; in aw88261_get_fade_out_time()
786 (struct soc_mixer_control *)kcontrol->private_value; in aw88261_set_fade_out_time()
787 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_set_fade_out_time()
790 time = ucontrol->value.integer.value[0]; in aw88261_set_fade_out_time()
791 if (time < mc->min || time > mc->max) in aw88261_set_fade_out_time()
792 return -EINVAL; in aw88261_set_fade_out_time()
794 if (time != aw_dev->fade_out_time) { in aw88261_set_fade_out_time()
795 aw_dev->fade_out_time = time; in aw88261_set_fade_out_time()
805 if ((index >= aw_dev->prof_info.count) || (index < 0)) in aw88261_dev_set_profile_index()
806 return -EINVAL; in aw88261_dev_set_profile_index()
808 if (aw_dev->prof_index == index) in aw88261_dev_set_profile_index()
809 return -EPERM; in aw88261_dev_set_profile_index()
811 aw_dev->prof_index = index; in aw88261_dev_set_profile_index()
825 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in aw88261_profile_info()
826 uinfo->count = 1; in aw88261_profile_info()
828 count = aw88261->aw_pa->prof_info.count; in aw88261_profile_info()
830 uinfo->value.enumerated.items = 0; in aw88261_profile_info()
834 uinfo->value.enumerated.items = count; in aw88261_profile_info()
836 if (uinfo->value.enumerated.item >= count) in aw88261_profile_info()
837 uinfo->value.enumerated.item = count - 1; in aw88261_profile_info()
839 name = uinfo->value.enumerated.name; in aw88261_profile_info()
840 count = uinfo->value.enumerated.item; in aw88261_profile_info()
842 prof_name = aw88261_dev_get_prof_name(aw88261->aw_pa, count); in aw88261_profile_info()
844 strscpy(uinfo->value.enumerated.name, "null", in aw88261_profile_info()
849 strscpy(name, prof_name, sizeof(uinfo->value.enumerated.name)); in aw88261_profile_info()
860 ucontrol->value.integer.value[0] = aw88261->aw_pa->prof_index; in aw88261_profile_get()
873 mutex_lock(&aw88261->lock); in aw88261_profile_set()
874 ret = aw88261_dev_set_profile_index(aw88261->aw_pa, ucontrol->value.integer.value[0]); in aw88261_profile_set()
876 dev_dbg(codec->dev, "profile index does not change"); in aw88261_profile_set()
877 mutex_unlock(&aw88261->lock); in aw88261_profile_set()
881 if (aw88261->aw_pa->status) { in aw88261_profile_set()
882 aw88261_dev_stop(aw88261->aw_pa); in aw88261_profile_set()
886 mutex_unlock(&aw88261->lock); in aw88261_profile_set()
896 struct aw_volume_desc *vol_desc = &aw88261->aw_pa->volume_desc; in aw88261_volume_get()
898 ucontrol->value.integer.value[0] = vol_desc->ctl_volume; in aw88261_volume_get()
908 struct aw_volume_desc *vol_desc = &aw88261->aw_pa->volume_desc; in aw88261_volume_set()
910 (struct soc_mixer_control *)kcontrol->private_value; in aw88261_volume_set()
913 value = ucontrol->value.integer.value[0]; in aw88261_volume_set()
915 if (value < mc->min || value > mc->max) in aw88261_volume_set()
916 return -EINVAL; in aw88261_volume_set()
918 if (vol_desc->ctl_volume != value) { in aw88261_volume_set()
919 vol_desc->ctl_volume = value; in aw88261_volume_set()
920 aw88261_dev_set_volume(aw88261->aw_pa, vol_desc->ctl_volume); in aw88261_volume_set()
934 ucontrol->value.integer.value[0] = aw88261->aw_pa->fade_step; in aw88261_get_fade_step()
945 (struct soc_mixer_control *)kcontrol->private_value; in aw88261_set_fade_step()
948 value = ucontrol->value.integer.value[0]; in aw88261_set_fade_step()
949 if (value < mc->min || value > mc->max) in aw88261_set_fade_step()
950 return -EINVAL; in aw88261_set_fade_step()
952 if (aw88261->aw_pa->fade_step != value) { in aw88261_set_fade_step()
953 aw88261->aw_pa->fade_step = value; in aw88261_set_fade_step()
977 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in aw88261_playback_event()
980 mutex_lock(&aw88261->lock); in aw88261_playback_event()
986 aw88261_dev_stop(aw88261->aw_pa); in aw88261_playback_event()
991 mutex_unlock(&aw88261->lock); in aw88261_playback_event()
1019 ret = regmap_read(aw88261->regmap, AW88261_EFRH3_REG, ®_val); in aw88261_frcset_check()
1024 ret = regmap_read(aw88261->regmap, AW88261_EFRL3_REG, ®_val); in aw88261_frcset_check()
1029 if (aw88261->efuse_check == AW88261_EF_OR_CHECK) in aw88261_frcset_check()
1035 aw88261->frcset_en = AW88261_FRCSET_ENABLE; in aw88261_frcset_check()
1037 aw88261->frcset_en = AW88261_FRCSET_DISABLE; in aw88261_frcset_check()
1039 dev_dbg(aw88261->aw_pa->dev, "tem is 0x%04x, frcset_en is %d", in aw88261_frcset_check()
1040 tem, aw88261->frcset_en); in aw88261_frcset_check()
1047 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_dev_init()
1052 dev_err(aw_dev->dev, "aw_dev acf parse failed"); in aw88261_dev_init()
1053 return -EINVAL; in aw88261_dev_init()
1056 ret = regmap_write(aw_dev->regmap, AW88261_ID_REG, AW88261_SOFT_RESET_VALUE); in aw88261_dev_init()
1060 aw_dev->fade_in_time = AW88261_500_US; in aw88261_dev_init()
1061 aw_dev->fade_out_time = AW88261_500_US; in aw88261_dev_init()
1062 aw_dev->prof_cur = AW88261_INIT_PROFILE; in aw88261_dev_init()
1063 aw_dev->prof_index = AW88261_INIT_PROFILE; in aw88261_dev_init()
1067 dev_err(aw_dev->dev, "fw update failed ret = %d\n", ret); in aw88261_dev_init()
1073 dev_err(aw_dev->dev, "aw88261_frcset_check ret = %d\n", ret); in aw88261_dev_init()
1099 aw88261->aw_pa->fw_status = AW88261_DEV_FW_FAILED; in aw88261_request_firmware_file()
1101 ret = request_firmware(&cont, AW88261_ACF_FILE, aw88261->aw_pa->dev); in aw88261_request_firmware_file()
1103 return dev_err_probe(aw88261->aw_pa->dev, ret, in aw88261_request_firmware_file()
1106 dev_info(aw88261->aw_pa->dev, "loaded %s - size: %zu\n", in aw88261_request_firmware_file()
1107 AW88261_ACF_FILE, cont ? cont->size : 0); in aw88261_request_firmware_file()
1109 aw88261->aw_cfg = devm_kzalloc(aw88261->aw_pa->dev, cont->size + sizeof(int), GFP_KERNEL); in aw88261_request_firmware_file()
1110 if (!aw88261->aw_cfg) { in aw88261_request_firmware_file()
1112 return -ENOMEM; in aw88261_request_firmware_file()
1114 aw88261->aw_cfg->len = (int)cont->size; in aw88261_request_firmware_file()
1115 memcpy(aw88261->aw_cfg->data, cont->data, cont->size); in aw88261_request_firmware_file()
1118 ret = aw88395_dev_load_acf_check(aw88261->aw_pa, aw88261->aw_cfg); in aw88261_request_firmware_file()
1120 dev_err(aw88261->aw_pa->dev, "load [%s] failed !", AW88261_ACF_FILE); in aw88261_request_firmware_file()
1124 mutex_lock(&aw88261->lock); in aw88261_request_firmware_file()
1126 ret = aw88261_dev_init(aw88261, aw88261->aw_cfg); in aw88261_request_firmware_file()
1128 dev_err(aw88261->aw_pa->dev, "dev init failed"); in aw88261_request_firmware_file()
1129 mutex_unlock(&aw88261->lock); in aw88261_request_firmware_file()
1140 INIT_DELAYED_WORK(&aw88261->start_work, aw88261_startup_work); in aw88261_codec_probe()
1144 return dev_err_probe(aw88261->aw_pa->dev, ret, in aw88261_codec_probe()
1153 /* add route */ in aw88261_codec_probe()
1169 cancel_delayed_work_sync(&aw88261->start_work); in aw88261_codec_remove()
1179 gpiod_set_value_cansleep(aw88261->reset_gpio, 0); in aw88261_hw_reset()
1181 gpiod_set_value_cansleep(aw88261->reset_gpio, 1); in aw88261_hw_reset()
1187 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_parse_channel_dt()
1188 struct device_node *np = aw_dev->dev->of_node; in aw88261_parse_channel_dt()
1192 of_property_read_u32(np, "sound-channel", &channel_value); in aw88261_parse_channel_dt()
1193 of_property_read_u32(np, "sync-flag", &sync_enable); in aw88261_parse_channel_dt()
1195 aw_dev->channel = channel_value; in aw88261_parse_channel_dt()
1196 aw88261->phase_sync = sync_enable; in aw88261_parse_channel_dt()
1208 dev_err(&i2c->dev, "%s read chipid error. ret = %d", __func__, ret); in aw88261_init()
1212 dev_err(&i2c->dev, "unsupported device"); in aw88261_init()
1213 return -ENXIO; in aw88261_init()
1216 dev_info(&i2c->dev, "chip id = %x\n", chip_id); in aw88261_init()
1218 aw_dev = devm_kzalloc(&i2c->dev, sizeof(*aw_dev), GFP_KERNEL); in aw88261_init()
1220 return -ENOMEM; in aw88261_init()
1222 (*aw88261)->aw_pa = aw_dev; in aw88261_init()
1223 aw_dev->i2c = i2c; in aw88261_init()
1224 aw_dev->regmap = regmap; in aw88261_init()
1225 aw_dev->dev = &i2c->dev; in aw88261_init()
1226 aw_dev->chip_id = AW88261_CHIP_ID; in aw88261_init()
1227 aw_dev->acf = NULL; in aw88261_init()
1228 aw_dev->prof_info.prof_desc = NULL; in aw88261_init()
1229 aw_dev->prof_info.count = 0; in aw88261_init()
1230 aw_dev->prof_info.prof_type = AW88395_DEV_NONE_TYPE_ID; in aw88261_init()
1231 aw_dev->channel = 0; in aw88261_init()
1232 aw_dev->fw_status = AW88261_DEV_FW_FAILED; in aw88261_init()
1233 aw_dev->fade_step = AW88261_VOLUME_STEP_DB; in aw88261_init()
1234 aw_dev->volume_desc.ctl_volume = AW88261_VOL_DEFAULT_VALUE; in aw88261_init()
1235 aw_dev->volume_desc.mute_volume = AW88261_MUTE_VOL; in aw88261_init()
1246 ret = i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C); in aw88261_i2c_probe()
1248 return dev_err_probe(&i2c->dev, -ENXIO, "check_functionality failed"); in aw88261_i2c_probe()
1250 aw88261 = devm_kzalloc(&i2c->dev, sizeof(*aw88261), GFP_KERNEL); in aw88261_i2c_probe()
1252 return -ENOMEM; in aw88261_i2c_probe()
1254 mutex_init(&aw88261->lock); in aw88261_i2c_probe()
1258 aw88261->reset_gpio = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_LOW); in aw88261_i2c_probe()
1259 if (IS_ERR(aw88261->reset_gpio)) in aw88261_i2c_probe()
1260 dev_info(&i2c->dev, "reset gpio not defined\n"); in aw88261_i2c_probe()
1264 aw88261->regmap = devm_regmap_init_i2c(i2c, &aw88261_remap_config); in aw88261_i2c_probe()
1265 if (IS_ERR(aw88261->regmap)) { in aw88261_i2c_probe()
1266 ret = PTR_ERR(aw88261->regmap); in aw88261_i2c_probe()
1267 return dev_err_probe(&i2c->dev, ret, "failed to init regmap: %d\n", ret); in aw88261_i2c_probe()
1271 ret = aw88261_init(&aw88261, i2c, aw88261->regmap); in aw88261_i2c_probe()
1275 ret = devm_snd_soc_register_component(&i2c->dev, in aw88261_i2c_probe()
1279 dev_err(&i2c->dev, "failed to register aw88261: %d", ret); in aw88261_i2c_probe()