Lines Matching refs:aw_dev
25 static int aw_parse_bin_header(struct aw_device *aw_dev, struct aw_bin *bin);
27 static int aw_check_sum(struct aw_device *aw_dev, struct aw_bin *bin, int bin_num) in aw_check_sum() argument
42 dev_dbg(aw_dev->dev, "%s -- check_sum = %p, check_sum = 0x%x, sum_data = 0x%x", in aw_check_sum()
45 dev_err(aw_dev->dev, "%s. CheckSum Fail.bin_num=%d, CheckSum:0x%x, SumData:0x%x", in aw_check_sum()
53 static int aw_check_data_version(struct aw_device *aw_dev, struct aw_bin *bin, int bin_num) in aw_check_data_version() argument
57 dev_err(aw_dev->dev, "aw_bin_parse Unrecognized this bin data version\n"); in aw_check_data_version()
64 static int aw_check_register_num(struct aw_device *aw_dev, struct aw_bin *bin, int bin_num) in aw_check_register_num() argument
76 dev_dbg(aw_dev->dev, "%s,parse_register_num = 0x%x,check_register_num = 0x%x\n", in aw_check_register_num()
79 dev_err(aw_dev->dev, "%s parse_register_num = 0x%x,check_register_num = 0x%x\n", in aw_check_register_num()
91 static int aw_check_dsp_reg_num(struct aw_device *aw_dev, struct aw_bin *bin, int bin_num) in aw_check_dsp_reg_num() argument
104 dev_dbg(aw_dev->dev, "%s bin_num = %d, parse_dsp_reg_num = 0x%x, check_dsp_reg_num = 0x%x", in aw_check_dsp_reg_num()
107 dev_err(aw_dev->dev, "aw_bin_parse check dsp reg num error\n"); in aw_check_dsp_reg_num()
108 dev_err(aw_dev->dev, "%s parse_dsp_reg_num = 0x%x, check_dsp_reg_num = 0x%x", in aw_check_dsp_reg_num()
122 static int aw_check_soc_app_num(struct aw_device *aw_dev, struct aw_bin *bin, int bin_num) in aw_check_soc_app_num() argument
133 dev_dbg(aw_dev->dev, "%s bin_num = %d, parse_soc_app_num=0x%x, check_soc_app_num = 0x%x\n", in aw_check_soc_app_num()
136 dev_err(aw_dev->dev, "%s parse_soc_app_num=0x%x, check_soc_app_num = 0x%x\n", in aw_check_soc_app_num()
159 static int aw_parse_one_of_multi_bins(struct aw_device *aw_dev, unsigned int bin_num, in aw_parse_one_of_multi_bins() argument
167 dev_err(aw_dev->dev, "bin_header_info size[%d] overflow file size[%d]\n", in aw_parse_one_of_multi_bins()
187 return aw_parse_bin_header(aw_dev, bin); in aw_parse_one_of_multi_bins()
190 static int aw_get_multi_bin_header(struct aw_device *aw_dev, struct aw_bin *bin) in aw_get_multi_bin_header() argument
203 dev_dbg(aw_dev->dev, "aw_bin_parse enter multi bin for is %d\n", i); in aw_get_multi_bin_header()
204 ret = aw_parse_one_of_multi_bins(aw_dev, bin_num, i, bin); in aw_get_multi_bin_header()
212 static int aw_parse_bin_header(struct aw_device *aw_dev, struct aw_bin *bin) in aw_parse_bin_header() argument
217 dev_err(aw_dev->dev, "bin_header_info size[%d] overflow file size[%d]\n", in aw_parse_bin_header()
223 dev_dbg(aw_dev->dev, "aw_bin_parse bin_data_type 0x%x\n", bin_data_type); in aw_parse_bin_header()
229 dev_dbg(aw_dev->dev, "%s bin->single_bin_parse_num is %d\n", __func__, in aw_parse_bin_header()
238 dev_dbg(aw_dev->dev, "%s bin->multi_bin_parse_num is %d\n", __func__, in aw_parse_bin_header()
240 return aw_get_multi_bin_header(aw_dev, bin); in aw_parse_bin_header()
242 dev_dbg(aw_dev->dev, "%s There is no corresponding type\n", __func__); in aw_parse_bin_header()
247 static int aw_check_bin_header_version(struct aw_device *aw_dev, struct aw_bin *bin) in aw_check_bin_header_version() argument
252 dev_dbg(aw_dev->dev, "aw_bin_parse header_version 0x%x\n", header_version); in aw_check_bin_header_version()
256 return aw_parse_bin_header(aw_dev, bin); in aw_check_bin_header_version()
258 dev_err(aw_dev->dev, "aw_bin_parse Unrecognized this bin header version\n"); in aw_check_bin_header_version()
263 static int aw_parsing_bin_file(struct aw_device *aw_dev, struct aw_bin *bin) in aw_parsing_bin_file() argument
269 dev_err(aw_dev->dev, "aw_bin_parse bin is NULL\n"); in aw_parsing_bin_file()
277 ret = aw_check_bin_header_version(aw_dev, bin); in aw_parsing_bin_file()
279 dev_err(aw_dev->dev, "aw_bin_parse check bin header version error\n"); in aw_parsing_bin_file()
284 ret = aw_check_sum(aw_dev, bin, i); in aw_parsing_bin_file()
286 dev_err(aw_dev->dev, "aw_bin_parse check sum data error\n"); in aw_parsing_bin_file()
289 ret = aw_check_data_version(aw_dev, bin, i); in aw_parsing_bin_file()
291 dev_err(aw_dev->dev, "aw_bin_parse check data version error\n"); in aw_parsing_bin_file()
297 ret = aw_check_register_num(aw_dev, bin, i); in aw_parsing_bin_file()
300 ret = aw_check_dsp_reg_num(aw_dev, bin, i); in aw_parsing_bin_file()
303 ret = aw_check_soc_app_num(aw_dev, bin, i); in aw_parsing_bin_file()
362 static int aw_dev_prof_parse_multi_bin(struct aw_device *aw_dev, unsigned char *data, in aw_dev_prof_parse_multi_bin() argument
376 ret = aw_parsing_bin_file(aw_dev, aw_bin); in aw_dev_prof_parse_multi_bin()
378 dev_err(aw_dev->dev, "parse bin failed"); in aw_dev_prof_parse_multi_bin()
417 dev_dbg(aw_dev->dev, "bin_data_type not found"); in aw_dev_prof_parse_multi_bin()
426 static int aw_dev_parse_reg_bin_with_hdr(struct aw_device *aw_dev, in aw_dev_parse_reg_bin_with_hdr() argument
439 ret = aw_parsing_bin_file(aw_dev, aw_bin); in aw_dev_parse_reg_bin_with_hdr()
441 dev_err(aw_dev->dev, "parse bin failed"); in aw_dev_parse_reg_bin_with_hdr()
447 dev_err(aw_dev->dev, "bin num or type error"); in aw_dev_parse_reg_bin_with_hdr()
460 static int aw_dev_parse_data_by_sec_type(struct aw_device *aw_dev, struct aw_cfg_hdr *cfg_hdr, in aw_dev_parse_data_by_sec_type() argument
476 aw_dev, (u8 *)cfg_hdr + cfg_dde->data_offset, in aw_dev_parse_data_by_sec_type()
479 return aw_dev_parse_reg_bin_with_hdr(aw_dev, (u8 *)cfg_hdr + cfg_dde->data_offset, in aw_dev_parse_data_by_sec_type()
482 dev_err(aw_dev->dev, "%s cfg_dde->data_type = %d\n", __func__, cfg_dde->data_type); in aw_dev_parse_data_by_sec_type()
489 static int aw_dev_parse_dev_type(struct aw_device *aw_dev, in aw_dev_parse_dev_type() argument
498 if ((aw_dev->i2c->adapter->nr == cfg_dde[i].dev_bus) && in aw_dev_parse_dev_type()
499 (aw_dev->i2c->addr == cfg_dde[i].dev_addr) && in aw_dev_parse_dev_type()
503 dev_err(aw_dev->dev, "dev_profile [%d] overflow", in aw_dev_parse_dev_type()
507 aw_dev->prof_data_type = cfg_dde[i].data_type; in aw_dev_parse_dev_type()
508 ret = aw_dev_parse_data_by_sec_type(aw_dev, prof_hdr, &cfg_dde[i], in aw_dev_parse_dev_type()
511 dev_err(aw_dev->dev, "parse failed"); in aw_dev_parse_dev_type()
519 dev_dbg(aw_dev->dev, "get dev type num is %d, please use default", sec_num); in aw_dev_parse_dev_type()
526 static int aw_dev_parse_dev_default_type(struct aw_device *aw_dev, in aw_dev_parse_dev_default_type() argument
535 if ((aw_dev->channel == cfg_dde[i].dev_index) && in aw_dev_parse_dev_default_type()
539 dev_err(aw_dev->dev, "dev_profile [%d] overflow", in aw_dev_parse_dev_default_type()
543 aw_dev->prof_data_type = cfg_dde[i].data_type; in aw_dev_parse_dev_default_type()
544 ret = aw_dev_parse_data_by_sec_type(aw_dev, prof_hdr, &cfg_dde[i], in aw_dev_parse_dev_default_type()
547 dev_err(aw_dev->dev, "parse failed"); in aw_dev_parse_dev_default_type()
555 dev_err(aw_dev->dev, "get dev default type failed, get num[%d]", sec_num); in aw_dev_parse_dev_default_type()
562 static int aw_dev_cfg_get_reg_valid_prof(struct aw_device *aw_dev, in aw_dev_cfg_get_reg_valid_prof() argument
566 struct aw_prof_info *prof_info = &aw_dev->prof_info; in aw_dev_cfg_get_reg_valid_prof()
575 dev_dbg(aw_dev->dev, "get valid profile:%d", aw_dev->prof_info.count); in aw_dev_cfg_get_reg_valid_prof()
578 dev_err(aw_dev->dev, "no profile data"); in aw_dev_cfg_get_reg_valid_prof()
582 prof_info->prof_desc = devm_kcalloc(aw_dev->dev, in aw_dev_cfg_get_reg_valid_prof()
591 dev_err(aw_dev->dev, "overflow count[%d]", in aw_dev_cfg_get_reg_valid_prof()
604 static int aw_dev_cfg_get_multiple_valid_prof(struct aw_device *aw_dev, in aw_dev_cfg_get_multiple_valid_prof() argument
608 struct aw_prof_info *prof_info = &aw_dev->prof_info; in aw_dev_cfg_get_multiple_valid_prof()
626 dev_dbg(aw_dev->dev, "get valid profile:%d", aw_dev->prof_info.count); in aw_dev_cfg_get_multiple_valid_prof()
629 dev_err(aw_dev->dev, "no profile data"); in aw_dev_cfg_get_multiple_valid_prof()
633 prof_info->prof_desc = devm_kcalloc(aw_dev->dev, in aw_dev_cfg_get_multiple_valid_prof()
649 dev_err(aw_dev->dev, "overflow count[%d]", in aw_dev_cfg_get_multiple_valid_prof()
663 static int aw_dev_load_cfg_by_hdr(struct aw_device *aw_dev, in aw_dev_load_cfg_by_hdr() argument
673 ret = aw_dev_parse_dev_type(aw_dev, prof_hdr, all_prof_info); in aw_dev_load_cfg_by_hdr()
677 dev_dbg(aw_dev->dev, "get dev type num is 0, parse default dev"); in aw_dev_load_cfg_by_hdr()
678 ret = aw_dev_parse_dev_default_type(aw_dev, prof_hdr, all_prof_info); in aw_dev_load_cfg_by_hdr()
683 switch (aw_dev->prof_data_type) { in aw_dev_load_cfg_by_hdr()
685 ret = aw_dev_cfg_get_multiple_valid_prof(aw_dev, all_prof_info); in aw_dev_load_cfg_by_hdr()
688 ret = aw_dev_cfg_get_reg_valid_prof(aw_dev, all_prof_info); in aw_dev_load_cfg_by_hdr()
691 dev_err(aw_dev->dev, "unsupport data type\n"); in aw_dev_load_cfg_by_hdr()
696 aw_dev->prof_info.prof_name_list = profile_name; in aw_dev_load_cfg_by_hdr()
701 static int aw_dev_create_prof_name_list_v1(struct aw_device *aw_dev) in aw_dev_create_prof_name_list_v1() argument
703 struct aw_prof_info *prof_info = &aw_dev->prof_info; in aw_dev_create_prof_name_list_v1()
708 dev_err(aw_dev->dev, "prof_desc is NULL"); in aw_dev_create_prof_name_list_v1()
712 prof_info->prof_name_list = devm_kzalloc(aw_dev->dev, in aw_dev_create_prof_name_list_v1()
721 dev_dbg(aw_dev->dev, "prof name is %s", prof_info->prof_name_list[i]); in aw_dev_create_prof_name_list_v1()
727 static int aw_get_dde_type_info(struct aw_device *aw_dev, struct aw_container *aw_cfg) in aw_get_dde_type_info() argument
745 aw_dev->prof_info.prof_type = AW88395_DEV_TYPE_ID; in aw_get_dde_type_info()
747 aw_dev->prof_info.prof_type = AW88395_DEV_DEFAULT_TYPE_ID; in aw_get_dde_type_info()
749 dev_err(aw_dev->dev, "can't find scene"); in aw_get_dde_type_info()
756 static int aw_get_dev_scene_count_v1(struct aw_device *aw_dev, struct aw_container *aw_cfg, in aw_get_dev_scene_count_v1() argument
768 (aw_dev->chip_id == cfg_dde[i].chip_id) && in aw_get_dev_scene_count_v1()
769 (aw_dev->i2c->adapter->nr == cfg_dde[i].dev_bus) && in aw_get_dev_scene_count_v1()
770 (aw_dev->i2c->addr == cfg_dde[i].dev_addr)) in aw_get_dev_scene_count_v1()
775 dev_err(aw_dev->dev, "failed to obtain scene, scenu_num = %d\n", (*scene_num)); in aw_get_dev_scene_count_v1()
782 static int aw_get_default_scene_count_v1(struct aw_device *aw_dev, in aw_get_default_scene_count_v1() argument
796 (aw_dev->chip_id == cfg_dde[i].chip_id) && in aw_get_default_scene_count_v1()
797 (aw_dev->channel == cfg_dde[i].dev_index)) in aw_get_default_scene_count_v1()
802 dev_err(aw_dev->dev, "failed to obtain scene, scenu_num = %d\n", (*scene_num)); in aw_get_default_scene_count_v1()
809 static int aw_dev_parse_scene_count_v1(struct aw_device *aw_dev, in aw_dev_parse_scene_count_v1() argument
815 ret = aw_get_dde_type_info(aw_dev, aw_cfg); in aw_dev_parse_scene_count_v1()
819 switch (aw_dev->prof_info.prof_type) { in aw_dev_parse_scene_count_v1()
821 ret = aw_get_dev_scene_count_v1(aw_dev, aw_cfg, count); in aw_dev_parse_scene_count_v1()
824 ret = aw_get_default_scene_count_v1(aw_dev, aw_cfg, count); in aw_dev_parse_scene_count_v1()
827 dev_err(aw_dev->dev, "unsupported prof_type[%x]", aw_dev->prof_info.prof_type); in aw_dev_parse_scene_count_v1()
835 static int aw_dev_parse_data_by_sec_type_v1(struct aw_device *aw_dev, in aw_dev_parse_data_by_sec_type_v1() argument
840 struct aw_prof_info *prof_info = &aw_dev->prof_info; in aw_dev_parse_data_by_sec_type_v1()
845 ret = aw_dev_prof_parse_multi_bin(aw_dev, (u8 *)prof_hdr + cfg_dde->data_offset, in aw_dev_parse_data_by_sec_type_v1()
848 dev_err(aw_dev->dev, "parse multi bin failed"); in aw_dev_parse_data_by_sec_type_v1()
856 ret = aw_dev_parse_reg_bin_with_hdr(aw_dev, in aw_dev_parse_data_by_sec_type_v1()
860 dev_err(aw_dev->dev, "parse reg bin with hdr failed"); in aw_dev_parse_data_by_sec_type_v1()
868 dev_err(aw_dev->dev, "unsupported SEC_TYPE [%d]", cfg_dde->data_type); in aw_dev_parse_data_by_sec_type_v1()
875 static int aw_dev_parse_dev_type_v1(struct aw_device *aw_dev, in aw_dev_parse_dev_type_v1() argument
885 if ((aw_dev->i2c->adapter->nr == cfg_dde[i].dev_bus) && in aw_dev_parse_dev_type_v1()
886 (aw_dev->i2c->addr == cfg_dde[i].dev_addr) && in aw_dev_parse_dev_type_v1()
887 (aw_dev->chip_id == cfg_dde[i].chip_id)) { in aw_dev_parse_dev_type_v1()
888 ret = aw_dev_parse_data_by_sec_type_v1(aw_dev, prof_hdr, in aw_dev_parse_dev_type_v1()
891 dev_err(aw_dev->dev, "parse failed"); in aw_dev_parse_dev_type_v1()
898 dev_err(aw_dev->dev, "get dev type failed, get num [%d]", cur_scene_id); in aw_dev_parse_dev_type_v1()
905 static int aw_dev_parse_default_type_v1(struct aw_device *aw_dev, in aw_dev_parse_default_type_v1() argument
915 if ((aw_dev->channel == cfg_dde[i].dev_index) && in aw_dev_parse_default_type_v1()
916 (aw_dev->chip_id == cfg_dde[i].chip_id)) { in aw_dev_parse_default_type_v1()
917 ret = aw_dev_parse_data_by_sec_type_v1(aw_dev, prof_hdr, in aw_dev_parse_default_type_v1()
920 dev_err(aw_dev->dev, "parse failed"); in aw_dev_parse_default_type_v1()
927 dev_err(aw_dev->dev, "get dev default type failed, get num[%d]", cur_scene_id); in aw_dev_parse_default_type_v1()
934 static int aw_dev_parse_by_hdr_v1(struct aw_device *aw_dev, in aw_dev_parse_by_hdr_v1() argument
939 switch (aw_dev->prof_info.prof_type) { in aw_dev_parse_by_hdr_v1()
941 ret = aw_dev_parse_dev_type_v1(aw_dev, cfg_hdr); in aw_dev_parse_by_hdr_v1()
944 ret = aw_dev_parse_default_type_v1(aw_dev, cfg_hdr); in aw_dev_parse_by_hdr_v1()
947 dev_err(aw_dev->dev, "prof type matched failed, get num[%d]", in aw_dev_parse_by_hdr_v1()
948 aw_dev->prof_info.prof_type); in aw_dev_parse_by_hdr_v1()
956 static int aw_dev_load_cfg_by_hdr_v1(struct aw_device *aw_dev, in aw_dev_load_cfg_by_hdr_v1() argument
960 struct aw_prof_info *prof_info = &aw_dev->prof_info; in aw_dev_load_cfg_by_hdr_v1()
963 ret = aw_dev_parse_scene_count_v1(aw_dev, aw_cfg, &prof_info->count); in aw_dev_load_cfg_by_hdr_v1()
965 dev_err(aw_dev->dev, "get scene count failed"); in aw_dev_load_cfg_by_hdr_v1()
969 prof_info->prof_desc = devm_kcalloc(aw_dev->dev, in aw_dev_load_cfg_by_hdr_v1()
975 ret = aw_dev_parse_by_hdr_v1(aw_dev, cfg_hdr); in aw_dev_load_cfg_by_hdr_v1()
977 dev_err(aw_dev->dev, "parse hdr failed"); in aw_dev_load_cfg_by_hdr_v1()
981 ret = aw_dev_create_prof_name_list_v1(aw_dev); in aw_dev_load_cfg_by_hdr_v1()
983 dev_err(aw_dev->dev, "create prof name list failed"); in aw_dev_load_cfg_by_hdr_v1()
990 int aw88395_dev_cfg_load(struct aw_device *aw_dev, struct aw_container *aw_cfg) in aw88395_dev_cfg_load() argument
999 ret = aw_dev_load_cfg_by_hdr(aw_dev, cfg_hdr); in aw88395_dev_cfg_load()
1001 dev_err(aw_dev->dev, "hdr_version[0x%x] parse failed", in aw88395_dev_cfg_load()
1007 ret = aw_dev_load_cfg_by_hdr_v1(aw_dev, aw_cfg); in aw88395_dev_cfg_load()
1009 dev_err(aw_dev->dev, "hdr_version[0x%x] parse failed", in aw88395_dev_cfg_load()
1015 dev_err(aw_dev->dev, "unsupported hdr_version [0x%x]", cfg_hdr->hdr_version); in aw88395_dev_cfg_load()
1018 aw_dev->fw_status = AW88395_DEV_FW_OK; in aw88395_dev_cfg_load()
1024 static int aw_dev_check_cfg_by_hdr(struct aw_device *aw_dev, struct aw_container *aw_cfg) in aw_dev_check_cfg_by_hdr() argument
1037 dev_err(aw_dev->dev, "not acf type file"); in aw_dev_check_cfg_by_hdr()
1043 dev_err(aw_dev->dev, "hdr_len with ddt_len [%d] overflow file size[%d]", in aw_dev_check_cfg_by_hdr()
1055 dev_err(aw_dev->dev, "act_data[%d] not equal to file size[%d]!", in aw_dev_check_cfg_by_hdr()
1064 dev_err(aw_dev->dev, "ddt_num[%d] end_data_offset[%d] overflow size[%d]", in aw_dev_check_cfg_by_hdr()
1073 dev_err(aw_dev->dev, "ddt_num[%d] act_crc8:0x%x != data_crc:0x%x", in aw_dev_check_cfg_by_hdr()
1082 static int aw_dev_check_acf_by_hdr_v1(struct aw_device *aw_dev, struct aw_container *aw_cfg) in aw_dev_check_acf_by_hdr_v1() argument
1096 dev_err(aw_dev->dev, "not acf type file"); in aw_dev_check_acf_by_hdr_v1()
1102 dev_err(aw_dev->dev, "hdrlen with ddt_len [%d] overflow file size[%d]", in aw_dev_check_acf_by_hdr_v1()
1114 dev_err(aw_dev->dev, "act_data[%d] not equal to file size[%d]!", in aw_dev_check_acf_by_hdr_v1()
1123 dev_err(aw_dev->dev, "ddt_num[%d] end_data_offset[%d] overflow size[%d]", in aw_dev_check_acf_by_hdr_v1()
1132 dev_err(aw_dev->dev, "ddt_num[%d] act_crc8:0x%x != data_crc 0x%x", in aw_dev_check_acf_by_hdr_v1()
1141 int aw88395_dev_load_acf_check(struct aw_device *aw_dev, struct aw_container *aw_cfg) in aw88395_dev_load_acf_check() argument
1146 dev_err(aw_dev->dev, "aw_prof is NULL"); in aw88395_dev_load_acf_check()
1151 dev_err(aw_dev->dev, "cfg hdr size[%d] overflow file size[%d]", in aw88395_dev_load_acf_check()
1161 return aw_dev_check_cfg_by_hdr(aw_dev, aw_cfg); in aw88395_dev_load_acf_check()
1163 return aw_dev_check_acf_by_hdr_v1(aw_dev, aw_cfg); in aw88395_dev_load_acf_check()
1165 dev_err(aw_dev->dev, "unsupported hdr_version [0x%x]", cfg_hdr->hdr_version); in aw88395_dev_load_acf_check()