Lines Matching refs:aw88261
281 static void aw88261_reg_force_set(struct aw88261 *aw88261) in aw88261_reg_force_set() argument
283 if (aw88261->frcset_en == AW88261_FRCSET_ENABLE) { in aw88261_reg_force_set()
285 regmap_update_bits(aw88261->regmap, AW88261_BSTCTRL3_REG, in aw88261_reg_force_set()
288 regmap_update_bits(aw88261->regmap, AW88261_BSTCTRL5_REG, in aw88261_reg_force_set()
291 regmap_update_bits(aw88261->regmap, AW88261_BSTCTRL6_REG, in aw88261_reg_force_set()
294 regmap_update_bits(aw88261->regmap, AW88261_BSTCTRL7_REG, in aw88261_reg_force_set()
297 regmap_update_bits(aw88261->regmap, AW88261_BSTCTRL8_REG, in aw88261_reg_force_set()
300 regmap_update_bits(aw88261->regmap, AW88261_BSTCTRL9_REG, in aw88261_reg_force_set()
303 dev_dbg(aw88261->aw_pa->dev, "needn't set reg value"); in aw88261_reg_force_set()
392 static int aw88261_dev_reg_update(struct aw88261 *aw88261, in aw88261_dev_reg_update() argument
395 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_dev_reg_update()
421 aw88261->amppd_st = reg_val & (~AW88261_AMPPD_MASK); in aw88261_dev_reg_update()
439 aw88261->efuse_check = AW88261_EF_OR_CHECK; in aw88261_dev_reg_update()
441 aw88261->efuse_check = AW88261_EF_AND_CHECK; in aw88261_dev_reg_update()
511 static int aw88261_dev_fw_update(struct aw88261 *aw88261) in aw88261_dev_fw_update() argument
513 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_dev_fw_update()
533 ret = aw88261_dev_reg_update(aw88261, sec_desc[AW88395_DATA_TYPE_REG].data, in aw88261_dev_fw_update()
545 static int aw88261_dev_start(struct aw88261 *aw88261) in aw88261_dev_start() argument
547 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_dev_start()
579 if (aw88261->amppd_st) in aw88261_dev_start()
582 aw88261_reg_force_set(aw88261); in aw88261_dev_start()
588 if (!aw88261->mute_st) in aw88261_dev_start()
637 static int aw88261_reg_update(struct aw88261 *aw88261, bool force) in aw88261_reg_update() argument
639 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_reg_update()
648 ret = aw88261_dev_fw_update(aw88261); in aw88261_reg_update()
653 ret = aw88261_dev_fw_update(aw88261); in aw88261_reg_update()
666 static void aw88261_start_pa(struct aw88261 *aw88261) in aw88261_start_pa() argument
671 ret = aw88261_reg_update(aw88261, aw88261->phase_sync); in aw88261_start_pa()
673 dev_err(aw88261->aw_pa->dev, "fw update failed, cnt:%d\n", i); in aw88261_start_pa()
676 ret = aw88261_dev_start(aw88261); in aw88261_start_pa()
678 dev_err(aw88261->aw_pa->dev, "aw88261 device start failed. retry = %d", i); in aw88261_start_pa()
681 dev_info(aw88261->aw_pa->dev, "start success\n"); in aw88261_start_pa()
689 struct aw88261 *aw88261 = in aw88261_startup_work() local
690 container_of(work, struct aw88261, start_work.work); in aw88261_startup_work()
692 mutex_lock(&aw88261->lock); in aw88261_startup_work()
693 aw88261_start_pa(aw88261); in aw88261_startup_work()
694 mutex_unlock(&aw88261->lock); in aw88261_startup_work()
697 static void aw88261_start(struct aw88261 *aw88261, bool sync_start) in aw88261_start() argument
699 if (aw88261->aw_pa->fw_status != AW88261_DEV_FW_OK) in aw88261_start()
702 if (aw88261->aw_pa->status == AW88261_DEV_PW_ON) in aw88261_start()
706 aw88261_start_pa(aw88261); in aw88261_start()
709 &aw88261->start_work, in aw88261_start()
738 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); in aw88261_get_fade_in_time() local
739 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_get_fade_in_time()
750 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); in aw88261_set_fade_in_time() local
753 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_set_fade_in_time()
773 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); in aw88261_get_fade_out_time() local
774 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_get_fade_out_time()
785 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); in aw88261_set_fade_out_time() local
788 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_set_fade_out_time()
821 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); in aw88261_profile_info() local
828 count = aw88261->aw_pa->prof_info.count; in aw88261_profile_info()
842 ret = aw88261_dev_get_prof_name(aw88261->aw_pa, count, &prof_name); in aw88261_profile_info()
858 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); in aw88261_profile_get() local
860 ucontrol->value.integer.value[0] = aw88261->aw_pa->prof_index; in aw88261_profile_get()
869 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); in aw88261_profile_set() local
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()
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()
883 aw88261_start(aw88261, AW88261_SYNC_START); in aw88261_profile_set()
886 mutex_unlock(&aw88261->lock); in aw88261_profile_set()
895 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); in aw88261_volume_get() local
896 struct aw_volume_desc *vol_desc = &aw88261->aw_pa->volume_desc; in aw88261_volume_get()
907 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); in aw88261_volume_set() local
908 struct aw_volume_desc *vol_desc = &aw88261->aw_pa->volume_desc; in aw88261_volume_set()
920 aw88261_dev_set_volume(aw88261->aw_pa, vol_desc->ctl_volume); in aw88261_volume_set()
932 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); in aw88261_get_fade_step() local
934 ucontrol->value.integer.value[0] = aw88261->aw_pa->fade_step; in aw88261_get_fade_step()
943 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); in aw88261_set_fade_step() local
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()
978 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); in aw88261_playback_event() local
980 mutex_lock(&aw88261->lock); in aw88261_playback_event()
983 aw88261_start(aw88261, AW88261_ASYNC_START); in aw88261_playback_event()
986 aw88261_dev_stop(aw88261->aw_pa); in aw88261_playback_event()
991 mutex_unlock(&aw88261->lock); in aw88261_playback_event()
1013 static int aw88261_frcset_check(struct aw88261 *aw88261) in aw88261_frcset_check() argument
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()
1045 static int aw88261_dev_init(struct aw88261 *aw88261, struct aw_container *aw_cfg) in aw88261_dev_init() argument
1047 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_dev_init()
1065 ret = aw88261_dev_fw_update(aw88261); in aw88261_dev_init()
1071 ret = aw88261_frcset_check(aw88261); in aw88261_dev_init()
1094 static int aw88261_request_firmware_file(struct aw88261 *aw88261) in aw88261_request_firmware_file() argument
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()
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()
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()
1137 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); in aw88261_codec_probe() local
1140 INIT_DELAYED_WORK(&aw88261->start_work, aw88261_startup_work); in aw88261_codec_probe()
1142 ret = aw88261_request_firmware_file(aw88261); in aw88261_codec_probe()
1144 return dev_err_probe(aw88261->aw_pa->dev, ret, in aw88261_codec_probe()
1167 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(aw_codec); in aw88261_codec_remove() local
1169 cancel_delayed_work_sync(&aw88261->start_work); in aw88261_codec_remove()
1177 static void aw88261_parse_channel_dt(struct aw88261 *aw88261) in aw88261_parse_channel_dt() argument
1179 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_parse_channel_dt()
1184 aw88261->phase_sync = of_property_read_bool(np, "awinic,sync-flag"); in aw88261_parse_channel_dt()
1189 static int aw88261_init(struct aw88261 **aw88261, struct i2c_client *i2c, struct regmap *regmap) in aw88261_init() argument
1212 (*aw88261)->aw_pa = aw_dev; in aw88261_init()
1226 aw88261_parse_channel_dt(*aw88261); in aw88261_init()
1233 struct aw88261 *aw88261; in aw88261_i2c_probe() local
1240 aw88261 = devm_kzalloc(&i2c->dev, sizeof(*aw88261), GFP_KERNEL); in aw88261_i2c_probe()
1241 if (!aw88261) in aw88261_i2c_probe()
1244 mutex_init(&aw88261->lock); in aw88261_i2c_probe()
1246 i2c_set_clientdata(i2c, aw88261); in aw88261_i2c_probe()
1248 aw88261->regmap = devm_regmap_init_i2c(i2c, &aw88261_remap_config); in aw88261_i2c_probe()
1249 if (IS_ERR(aw88261->regmap)) { in aw88261_i2c_probe()
1250 ret = PTR_ERR(aw88261->regmap); in aw88261_i2c_probe()
1255 ret = aw88261_init(&aw88261, i2c, aw88261->regmap); in aw88261_i2c_probe()