Lines Matching refs:aw88261
282 static void aw88261_reg_force_set(struct aw88261 *aw88261) in aw88261_reg_force_set() argument
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()
393 static int aw88261_dev_reg_update(struct aw88261 *aw88261, in aw88261_dev_reg_update() argument
396 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_dev_reg_update()
422 aw88261->amppd_st = reg_val & (~AW88261_AMPPD_MASK); 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()
510 static int aw88261_dev_fw_update(struct aw88261 *aw88261) in aw88261_dev_fw_update() argument
512 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_dev_fw_update()
532 ret = aw88261_dev_reg_update(aw88261, sec_desc[AW88395_DATA_TYPE_REG].data, in aw88261_dev_fw_update()
544 static int aw88261_dev_start(struct aw88261 *aw88261) in aw88261_dev_start() argument
546 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_dev_start()
578 if (aw88261->amppd_st) in aw88261_dev_start()
581 aw88261_reg_force_set(aw88261); in aw88261_dev_start()
587 if (!aw88261->mute_st) in aw88261_dev_start()
636 static int aw88261_reg_update(struct aw88261 *aw88261, bool force) in aw88261_reg_update() argument
638 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_reg_update()
647 ret = aw88261_dev_fw_update(aw88261); in aw88261_reg_update()
652 ret = aw88261_dev_fw_update(aw88261); in aw88261_reg_update()
665 static void aw88261_start_pa(struct aw88261 *aw88261) in aw88261_start_pa() argument
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()
675 ret = aw88261_dev_start(aw88261); 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()
688 struct aw88261 *aw88261 = in aw88261_startup_work() local
689 container_of(work, struct aw88261, start_work.work); in aw88261_startup_work()
691 mutex_lock(&aw88261->lock); in aw88261_startup_work()
692 aw88261_start_pa(aw88261); in aw88261_startup_work()
693 mutex_unlock(&aw88261->lock); in aw88261_startup_work()
696 static void aw88261_start(struct aw88261 *aw88261, bool sync_start) in aw88261_start() argument
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()
705 aw88261_start_pa(aw88261); in aw88261_start()
708 &aw88261->start_work, in aw88261_start()
737 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); in aw88261_get_fade_in_time() local
738 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_get_fade_in_time()
749 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); in aw88261_set_fade_in_time() local
752 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_set_fade_in_time()
772 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); in aw88261_get_fade_out_time() local
773 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_get_fade_out_time()
784 struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); in aw88261_set_fade_out_time() local
787 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_set_fade_out_time()
820 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 prof_name = aw88261_dev_get_prof_name(aw88261->aw_pa, count); 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_hw_reset(struct aw88261 *aw88261) in aw88261_hw_reset() argument
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()
1185 static void aw88261_parse_channel_dt(struct aw88261 *aw88261) in aw88261_parse_channel_dt() argument
1187 struct aw_device *aw_dev = aw88261->aw_pa; in aw88261_parse_channel_dt()
1196 aw88261->phase_sync = sync_enable; in aw88261_parse_channel_dt()
1199 static int aw88261_init(struct aw88261 **aw88261, struct i2c_client *i2c, struct regmap *regmap) in aw88261_init() argument
1222 (*aw88261)->aw_pa = aw_dev; in aw88261_init()
1236 aw88261_parse_channel_dt(*aw88261); in aw88261_init()
1243 struct aw88261 *aw88261; in aw88261_i2c_probe() local
1250 aw88261 = devm_kzalloc(&i2c->dev, sizeof(*aw88261), GFP_KERNEL); in aw88261_i2c_probe()
1251 if (!aw88261) in aw88261_i2c_probe()
1254 mutex_init(&aw88261->lock); in aw88261_i2c_probe()
1256 i2c_set_clientdata(i2c, aw88261); 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()
1262 aw88261_hw_reset(aw88261); 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()
1271 ret = aw88261_init(&aw88261, i2c, aw88261->regmap); in aw88261_i2c_probe()