Lines Matching refs:aw_dev

17 static int aw_dev_dsp_write_16bit(struct aw_device *aw_dev,  in aw_dev_dsp_write_16bit()  argument
22 ret = regmap_write(aw_dev->regmap, AW88395_DSPMADD_REG, dsp_addr); in aw_dev_dsp_write_16bit()
24 dev_err(aw_dev->dev, "%s write addr error, ret=%d", __func__, ret); in aw_dev_dsp_write_16bit()
28 ret = regmap_write(aw_dev->regmap, AW88395_DSPMDAT_REG, (u16)dsp_data); in aw_dev_dsp_write_16bit()
30 dev_err(aw_dev->dev, "%s write data error, ret=%d", __func__, ret); in aw_dev_dsp_write_16bit()
37 static int aw_dev_dsp_write_32bit(struct aw_device *aw_dev, in aw_dev_dsp_write_32bit() argument
43 ret = regmap_write(aw_dev->regmap, AW88395_DSPMADD_REG, dsp_addr); in aw_dev_dsp_write_32bit()
45 dev_err(aw_dev->dev, "%s write addr error, ret=%d", __func__, ret); in aw_dev_dsp_write_32bit()
50 ret = regmap_write(aw_dev->regmap, AW88395_DSPMDAT_REG, (u16)temp_data); in aw_dev_dsp_write_32bit()
52 dev_err(aw_dev->dev, "%s write datal error, ret=%d", __func__, ret); in aw_dev_dsp_write_32bit()
57 ret = regmap_write(aw_dev->regmap, AW88395_DSPMDAT_REG, (u16)temp_data); in aw_dev_dsp_write_32bit()
59 dev_err(aw_dev->dev, "%s write datah error, ret=%d", __func__, ret); in aw_dev_dsp_write_32bit()
66 static int aw_dev_dsp_write(struct aw_device *aw_dev, in aw_dev_dsp_write() argument
72 mutex_lock(&aw_dev->dsp_lock); in aw_dev_dsp_write()
75 ret = aw_dev_dsp_write_16bit(aw_dev, dsp_addr, dsp_data); in aw_dev_dsp_write()
77 dev_err(aw_dev->dev, "write dsp_addr[0x%x] 16-bit dsp_data[0x%x] failed", in aw_dev_dsp_write()
81 ret = aw_dev_dsp_write_32bit(aw_dev, dsp_addr, dsp_data); in aw_dev_dsp_write()
83 dev_err(aw_dev->dev, "write dsp_addr[0x%x] 32-bit dsp_data[0x%x] failed", in aw_dev_dsp_write()
87 dev_err(aw_dev->dev, "data type[%d] unsupported", data_type); in aw_dev_dsp_write()
93 if (regmap_read(aw_dev->regmap, AW88395_ID_REG, &reg_value)) in aw_dev_dsp_write()
94 dev_err(aw_dev->dev, "%s fail to clear chip state. Err=%d\n", __func__, ret); in aw_dev_dsp_write()
95 mutex_unlock(&aw_dev->dsp_lock); in aw_dev_dsp_write()
100 static int aw_dev_dsp_read_16bit(struct aw_device *aw_dev, in aw_dev_dsp_read_16bit() argument
106 ret = regmap_write(aw_dev->regmap, AW88395_DSPMADD_REG, dsp_addr); in aw_dev_dsp_read_16bit()
108 dev_err(aw_dev->dev, "%s write error, ret=%d", __func__, ret); in aw_dev_dsp_read_16bit()
112 ret = regmap_read(aw_dev->regmap, AW88395_DSPMDAT_REG, &temp_data); in aw_dev_dsp_read_16bit()
114 dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret); in aw_dev_dsp_read_16bit()
122 static int aw_dev_dsp_read_32bit(struct aw_device *aw_dev, in aw_dev_dsp_read_32bit() argument
128 ret = regmap_write(aw_dev->regmap, AW88395_DSPMADD_REG, dsp_addr); in aw_dev_dsp_read_32bit()
130 dev_err(aw_dev->dev, "%s write error, ret=%d", __func__, ret); in aw_dev_dsp_read_32bit()
134 ret = regmap_read(aw_dev->regmap, AW88395_DSPMDAT_REG, &temp_data); in aw_dev_dsp_read_32bit()
136 dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret); in aw_dev_dsp_read_32bit()
141 ret = regmap_read(aw_dev->regmap, AW88395_DSPMDAT_REG, &temp_data); in aw_dev_dsp_read_32bit()
143 dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret); in aw_dev_dsp_read_32bit()
151 static int aw_dev_dsp_read(struct aw_device *aw_dev, in aw_dev_dsp_read() argument
157 mutex_lock(&aw_dev->dsp_lock); in aw_dev_dsp_read()
160 ret = aw_dev_dsp_read_16bit(aw_dev, dsp_addr, dsp_data); in aw_dev_dsp_read()
162 dev_err(aw_dev->dev, "read dsp_addr[0x%x] 16-bit dsp_data[0x%x] failed", in aw_dev_dsp_read()
166 ret = aw_dev_dsp_read_32bit(aw_dev, dsp_addr, dsp_data); in aw_dev_dsp_read()
168 dev_err(aw_dev->dev, "read dsp_addr[0x%x] 32r-bit dsp_data[0x%x] failed", in aw_dev_dsp_read()
172 dev_err(aw_dev->dev, "data type[%d] unsupported", data_type); in aw_dev_dsp_read()
178 if (regmap_read(aw_dev->regmap, AW88395_ID_REG, &reg_value)) in aw_dev_dsp_read()
179 dev_err(aw_dev->dev, "%s fail to clear chip state. Err=%d\n", __func__, ret); in aw_dev_dsp_read()
180 mutex_unlock(&aw_dev->dsp_lock); in aw_dev_dsp_read()
186 static int aw_dev_read_chipid(struct aw_device *aw_dev, u16 *chip_id) in aw_dev_read_chipid() argument
191 ret = regmap_read(aw_dev->regmap, AW88395_CHIP_ID_REG, &reg_val); in aw_dev_read_chipid()
193 dev_err(aw_dev->dev, "%s read chipid error. ret = %d", __func__, ret); in aw_dev_read_chipid()
197 dev_info(aw_dev->dev, "chip id = %x\n", reg_val); in aw_dev_read_chipid()
215 static int aw_dev_dsp_fw_check(struct aw_device *aw_dev) in aw_dev_dsp_fw_check() argument
225 ret = aw88395_dev_get_prof_data(aw_dev, aw_dev->prof_cur, &set_prof_desc); in aw_dev_dsp_fw_check()
233 ret = aw_dev_dsp_read(aw_dev, addr, &dsp_val, AW88395_DSP_16_DATA); in aw_dev_dsp_fw_check()
235 dev_err(aw_dev->dev, "dsp read failed"); in aw_dev_dsp_fw_check()
242 dev_err(aw_dev->dev, "fw check failed, addr[0x%x], read[0x%x] != bindata[0x%x]", in aw_dev_dsp_fw_check()
249 dev_err(aw_dev->dev, "fw check failed, addr[0x%x] too large", addr); in aw_dev_dsp_fw_check()
257 static int aw_dev_set_volume(struct aw_device *aw_dev, unsigned int value) in aw_dev_set_volume() argument
259 struct aw_volume_desc *vol_desc = &aw_dev->volume_desc; in aw_dev_set_volume()
268 ret = regmap_read(aw_dev->regmap, AW88395_SYSCTRL2_REG, &reg_value); in aw_dev_set_volume()
272 dev_dbg(aw_dev->dev, "value 0x%x , reg:0x%x", value, real_value); in aw_dev_set_volume()
278 ret = regmap_write(aw_dev->regmap, AW88395_SYSCTRL2_REG, real_value); in aw_dev_set_volume()
283 void aw88395_dev_set_volume(struct aw_device *aw_dev, unsigned short set_vol) in aw88395_dev_set_volume() argument
287 ret = aw_dev_set_volume(aw_dev, set_vol); in aw88395_dev_set_volume()
289 dev_dbg(aw_dev->dev, "set volume failed"); in aw88395_dev_set_volume()
293 static void aw_dev_fade_in(struct aw_device *aw_dev) in aw_dev_fade_in() argument
295 struct aw_volume_desc *desc = &aw_dev->volume_desc; in aw_dev_fade_in()
297 int fade_step = aw_dev->fade_step; in aw_dev_fade_in()
300 if (fade_step == 0 || aw_dev->fade_in_time == 0) { in aw_dev_fade_in()
301 aw_dev_set_volume(aw_dev, fade_in_vol); in aw_dev_fade_in()
306 aw_dev_set_volume(aw_dev, i); in aw_dev_fade_in()
307 usleep_range(aw_dev->fade_in_time, aw_dev->fade_in_time + 10); in aw_dev_fade_in()
311 aw_dev_set_volume(aw_dev, fade_in_vol); in aw_dev_fade_in()
314 static void aw_dev_fade_out(struct aw_device *aw_dev) in aw_dev_fade_out() argument
316 struct aw_volume_desc *desc = &aw_dev->volume_desc; in aw_dev_fade_out()
317 int fade_step = aw_dev->fade_step; in aw_dev_fade_out()
320 if (fade_step == 0 || aw_dev->fade_out_time == 0) { in aw_dev_fade_out()
321 aw_dev_set_volume(aw_dev, AW88395_MUTE_VOL); in aw_dev_fade_out()
326 aw_dev_set_volume(aw_dev, i); in aw_dev_fade_out()
327 usleep_range(aw_dev->fade_out_time, aw_dev->fade_out_time + 10); in aw_dev_fade_out()
331 aw_dev_set_volume(aw_dev, AW88395_MUTE_VOL); in aw_dev_fade_out()
332 usleep_range(aw_dev->fade_out_time, aw_dev->fade_out_time + 10); in aw_dev_fade_out()
336 static int aw_dev_modify_dsp_cfg(struct aw_device *aw_dev, in aw_dev_modify_dsp_cfg() argument
339 struct aw_sec_data_desc *crc_dsp_cfg = &aw_dev->crc_dsp_cfg; in aw_dev_modify_dsp_cfg()
344 dev_dbg(aw_dev->dev, "addr:0x%x, dsp_data:0x%x", addr, dsp_data); in aw_dev_modify_dsp_cfg()
348 dev_err(aw_dev->dev, "addr_offset[%d] > crc_dsp_cfg->len[%d]", in aw_dev_modify_dsp_cfg()
362 dev_err(aw_dev->dev, "data type[%d] unsupported", data_type); in aw_dev_modify_dsp_cfg()
369 static int aw_dev_dsp_set_cali_re(struct aw_device *aw_dev) in aw_dev_dsp_set_cali_re() argument
374 cali_re = AW88395_SHOW_RE_TO_DSP_RE((aw_dev->cali_desc.cali_re + in aw_dev_dsp_set_cali_re()
375 aw_dev->cali_desc.ra), AW88395_DSP_RE_SHIFT); in aw_dev_dsp_set_cali_re()
378 ret = aw_dev_dsp_write(aw_dev, in aw_dev_dsp_set_cali_re()
381 dev_err(aw_dev->dev, "set cali re error"); in aw_dev_dsp_set_cali_re()
385 ret = aw_dev_modify_dsp_cfg(aw_dev, AW88395_DSP_REG_CFG_ADPZ_RE, in aw_dev_dsp_set_cali_re()
388 dev_err(aw_dev->dev, "modify dsp cfg failed"); in aw_dev_dsp_set_cali_re()
393 static void aw_dev_i2s_tx_enable(struct aw_device *aw_dev, bool flag) in aw_dev_i2s_tx_enable() argument
398 ret = regmap_update_bits(aw_dev->regmap, AW88395_I2SCFG1_REG, in aw_dev_i2s_tx_enable()
401 ret = regmap_update_bits(aw_dev->regmap, AW88395_I2SCFG1_REG, in aw_dev_i2s_tx_enable()
406 dev_dbg(aw_dev->dev, "%s failed", __func__); in aw_dev_i2s_tx_enable()
409 static int aw_dev_dsp_set_crc32(struct aw_device *aw_dev) in aw_dev_dsp_set_crc32() argument
411 struct aw_sec_data_desc *crc_dsp_cfg = &aw_dev->crc_dsp_cfg; in aw_dev_dsp_set_crc32()
417 dev_err(aw_dev->dev, "crc data len :%d > cfg_data len:%d", in aw_dev_dsp_set_crc32()
423 dev_err(aw_dev->dev, "The crc data len :%d unsupport", crc_data_len); in aw_dev_dsp_set_crc32()
429 return aw_dev_dsp_write(aw_dev, AW88395_DSP_REG_CRC_ADDR, crc_value, in aw_dev_dsp_set_crc32()
433 static void aw_dev_dsp_check_crc_enable(struct aw_device *aw_dev, bool flag) in aw_dev_dsp_check_crc_enable() argument
438 ret = regmap_update_bits(aw_dev->regmap, AW88395_HAGCCFG7_REG, in aw_dev_dsp_check_crc_enable()
441 ret = regmap_update_bits(aw_dev->regmap, AW88395_HAGCCFG7_REG, in aw_dev_dsp_check_crc_enable()
445 dev_dbg(aw_dev->dev, "%s failed", __func__); in aw_dev_dsp_check_crc_enable()
448 static int aw_dev_dsp_check_st(struct aw_device *aw_dev) in aw_dev_dsp_check_st() argument
455 ret = regmap_read(aw_dev->regmap, AW88395_SYSST_REG, &reg_val); in aw_dev_dsp_check_st()
457 dev_err(aw_dev->dev, "read reg0x%x failed", AW88395_SYSST_REG); in aw_dev_dsp_check_st()
462 dev_err(aw_dev->dev, "check dsp st fail,reg_val:0x%04x", reg_val); in aw_dev_dsp_check_st()
466 dev_dbg(aw_dev->dev, "dsp st check ok, reg_val:0x%04x", reg_val); in aw_dev_dsp_check_st()
474 static void aw_dev_dsp_enable(struct aw_device *aw_dev, bool is_enable) in aw_dev_dsp_enable() argument
479 ret = regmap_update_bits(aw_dev->regmap, AW88395_SYSCTRL_REG, in aw_dev_dsp_enable()
482 dev_dbg(aw_dev->dev, "enable dsp failed"); in aw_dev_dsp_enable()
484 ret = regmap_update_bits(aw_dev->regmap, AW88395_SYSCTRL_REG, in aw_dev_dsp_enable()
487 dev_dbg(aw_dev->dev, "disable dsp failed"); in aw_dev_dsp_enable()
491 static int aw_dev_dsp_check_crc32(struct aw_device *aw_dev) in aw_dev_dsp_check_crc32() argument
495 if (aw_dev->dsp_cfg == AW88395_DEV_DSP_BYPASS) { in aw_dev_dsp_check_crc32()
496 dev_info(aw_dev->dev, "dsp bypass"); in aw_dev_dsp_check_crc32()
500 ret = aw_dev_dsp_set_crc32(aw_dev); in aw_dev_dsp_check_crc32()
502 dev_err(aw_dev->dev, "set dsp crc32 failed"); in aw_dev_dsp_check_crc32()
506 aw_dev_dsp_check_crc_enable(aw_dev, true); in aw_dev_dsp_check_crc32()
509 aw_dev_dsp_enable(aw_dev, true); in aw_dev_dsp_check_crc32()
512 ret = aw_dev_dsp_check_st(aw_dev); in aw_dev_dsp_check_crc32()
514 dev_err(aw_dev->dev, "check crc32 fail"); in aw_dev_dsp_check_crc32()
516 aw_dev_dsp_check_crc_enable(aw_dev, false); in aw_dev_dsp_check_crc32()
517 aw_dev->dsp_crc_st = AW88395_DSP_CRC_OK; in aw_dev_dsp_check_crc32()
523 static void aw_dev_pwd(struct aw_device *aw_dev, bool pwd) in aw_dev_pwd() argument
528 ret = regmap_update_bits(aw_dev->regmap, AW88395_SYSCTRL_REG, in aw_dev_pwd()
531 ret = regmap_update_bits(aw_dev->regmap, AW88395_SYSCTRL_REG, in aw_dev_pwd()
535 dev_dbg(aw_dev->dev, "%s failed", __func__); in aw_dev_pwd()
538 static void aw_dev_amppd(struct aw_device *aw_dev, bool amppd) in aw_dev_amppd() argument
543 ret = regmap_update_bits(aw_dev->regmap, AW88395_SYSCTRL_REG, in aw_dev_amppd()
546 ret = regmap_update_bits(aw_dev->regmap, AW88395_SYSCTRL_REG, in aw_dev_amppd()
550 dev_dbg(aw_dev->dev, "%s failed", __func__); in aw_dev_amppd()
553 void aw88395_dev_mute(struct aw_device *aw_dev, bool is_mute) in aw88395_dev_mute() argument
558 aw_dev_fade_out(aw_dev); in aw88395_dev_mute()
559 ret = regmap_update_bits(aw_dev->regmap, AW88395_SYSCTRL_REG, in aw88395_dev_mute()
562 ret = regmap_update_bits(aw_dev->regmap, AW88395_SYSCTRL_REG, in aw88395_dev_mute()
564 aw_dev_fade_in(aw_dev); in aw88395_dev_mute()
568 dev_dbg(aw_dev->dev, "%s failed", __func__); in aw88395_dev_mute()
572 static int aw_dev_get_icalk(struct aw_device *aw_dev, int16_t *icalk) in aw_dev_get_icalk() argument
578 ret = regmap_read(aw_dev->regmap, AW88395_EFRM2_REG, &reg_val); in aw_dev_get_icalk()
592 static int aw_dev_get_vcalk(struct aw_device *aw_dev, int16_t *vcalk) in aw_dev_get_vcalk() argument
598 ret = regmap_read(aw_dev->regmap, AW88395_EFRH_REG, &reg_val); in aw_dev_get_vcalk()
614 static int aw_dev_get_vcalk_dac(struct aw_device *aw_dev, int16_t *vcalk) in aw_dev_get_vcalk_dac() argument
620 ret = regmap_read(aw_dev->regmap, AW88395_EFRM2_REG, &reg_val); in aw_dev_get_vcalk_dac()
634 static int aw_dev_vsense_select(struct aw_device *aw_dev, int *vsense_select) in aw_dev_vsense_select() argument
639 ret = regmap_read(aw_dev->regmap, AW88395_I2SCFG3_REG, &vsense_reg_val); in aw_dev_vsense_select()
641 dev_err(aw_dev->dev, "read vsense_reg_val failed"); in aw_dev_vsense_select()
644 dev_dbg(aw_dev->dev, "vsense_reg = 0x%x", vsense_reg_val); in aw_dev_vsense_select()
648 dev_dbg(aw_dev->dev, "vsense outside"); in aw_dev_vsense_select()
651 dev_dbg(aw_dev->dev, "vsense inside"); in aw_dev_vsense_select()
657 static int aw_dev_set_vcalb(struct aw_device *aw_dev) in aw_dev_set_vcalb() argument
665 ret = aw_dev_dsp_read(aw_dev, AW88395_DSP_REG_VCALB, &vcalb_adj, AW88395_DSP_16_DATA); in aw_dev_set_vcalb()
667 dev_err(aw_dev->dev, "read vcalb_adj failed"); in aw_dev_set_vcalb()
671 ret = aw_dev_vsense_select(aw_dev, &vsense_select); in aw_dev_set_vcalb()
674 dev_dbg(aw_dev->dev, "vsense_select = %d", vsense_select); in aw_dev_set_vcalb()
676 ret = aw_dev_get_icalk(aw_dev, &icalk_val); in aw_dev_set_vcalb()
683 ret = aw_dev_get_vcalk(aw_dev, &vcalk_val); in aw_dev_set_vcalb()
690 dev_dbg(aw_dev->dev, "vcalk_factor=%d, vscal_factor=%d, icalk=%d, vcalk=%d", in aw_dev_set_vcalb()
694 ret = aw_dev_get_vcalk_dac(aw_dev, &vcalk_val); in aw_dev_set_vcalb()
701 dev_dbg(aw_dev->dev, "vcalk_dac_factor=%d, vscal_dac_factor=%d, icalk=%d, vcalk=%d", in aw_dev_set_vcalb()
706 dev_err(aw_dev->dev, "unsupport vsense status"); in aw_dev_set_vcalb()
711 dev_err(aw_dev->dev, "vcalk:%d or desc->iscal_factor:%d unsupported", in aw_dev_set_vcalb()
719 dev_dbg(aw_dev->dev, "vcalb=%d, reg_val=0x%x, vcalb_adj =0x%x", in aw_dev_set_vcalb()
722 ret = aw_dev_dsp_write(aw_dev, AW88395_DSP_REG_VCALB, reg_val, AW88395_DSP_16_DATA); in aw_dev_set_vcalb()
724 dev_err(aw_dev->dev, "write vcalb failed"); in aw_dev_set_vcalb()
728 ret = aw_dev_modify_dsp_cfg(aw_dev, AW88395_DSP_REG_VCALB, in aw_dev_set_vcalb()
731 dev_err(aw_dev->dev, "modify dsp cfg failed"); in aw_dev_set_vcalb()
736 static int aw_dev_get_cali_f0_delay(struct aw_device *aw_dev) in aw_dev_get_cali_f0_delay() argument
738 struct aw_cali_delay_desc *desc = &aw_dev->cali_delay_desc; in aw_dev_get_cali_f0_delay()
742 ret = aw_dev_dsp_read(aw_dev, in aw_dev_get_cali_f0_delay()
745 dev_err(aw_dev->dev, "read cali delay failed, ret=%d", ret); in aw_dev_get_cali_f0_delay()
749 dev_dbg(aw_dev->dev, "read cali delay: %d ms", desc->delay); in aw_dev_get_cali_f0_delay()
754 static void aw_dev_get_int_status(struct aw_device *aw_dev, unsigned short *int_status) in aw_dev_get_int_status() argument
759 ret = regmap_read(aw_dev->regmap, AW88395_SYSINT_REG, &reg_val); in aw_dev_get_int_status()
761 dev_err(aw_dev->dev, "read interrupt reg fail, ret=%d", ret); in aw_dev_get_int_status()
765 dev_dbg(aw_dev->dev, "read interrupt reg = 0x%04x", *int_status); in aw_dev_get_int_status()
768 static void aw_dev_clear_int_status(struct aw_device *aw_dev) in aw_dev_clear_int_status() argument
773 aw_dev_get_int_status(aw_dev, &int_status); in aw_dev_clear_int_status()
775 aw_dev_get_int_status(aw_dev, &int_status); in aw_dev_clear_int_status()
777 dev_info(aw_dev->dev, "int status(%d) is not cleaned.\n", int_status); in aw_dev_clear_int_status()
780 static int aw_dev_get_iis_status(struct aw_device *aw_dev) in aw_dev_get_iis_status() argument
785 ret = regmap_read(aw_dev->regmap, AW88395_SYSST_REG, &reg_val); in aw_dev_get_iis_status()
789 dev_err(aw_dev->dev, "check pll lock fail,reg_val:0x%04x", reg_val); in aw_dev_get_iis_status()
796 static int aw_dev_check_mode1_pll(struct aw_device *aw_dev) in aw_dev_check_mode1_pll() argument
801 ret = aw_dev_get_iis_status(aw_dev); in aw_dev_check_mode1_pll()
803 dev_err(aw_dev->dev, "mode1 iis signal check error"); in aw_dev_check_mode1_pll()
813 static int aw_dev_check_mode2_pll(struct aw_device *aw_dev) in aw_dev_check_mode2_pll() argument
818 ret = regmap_read(aw_dev->regmap, AW88395_PLLCTRL1_REG, &reg_val); in aw_dev_check_mode2_pll()
824 dev_dbg(aw_dev->dev, "CCO_MUX is already divider"); in aw_dev_check_mode2_pll()
829 ret = regmap_update_bits(aw_dev->regmap, AW88395_PLLCTRL1_REG, in aw_dev_check_mode2_pll()
835 ret = aw_dev_get_iis_status(aw_dev); in aw_dev_check_mode2_pll()
837 dev_err(aw_dev->dev, "mode2 iis signal check error"); in aw_dev_check_mode2_pll()
845 ret = regmap_update_bits(aw_dev->regmap, AW88395_PLLCTRL1_REG, in aw_dev_check_mode2_pll()
850 ret = aw_dev_check_mode1_pll(aw_dev); in aw_dev_check_mode2_pll()
852 dev_err(aw_dev->dev, "mode2 switch to mode1, iis signal check error"); in aw_dev_check_mode2_pll()
863 static int aw_dev_check_syspll(struct aw_device *aw_dev) in aw_dev_check_syspll() argument
867 ret = aw_dev_check_mode1_pll(aw_dev); in aw_dev_check_syspll()
869 dev_dbg(aw_dev->dev, "mode1 check iis failed try switch to mode2 check"); in aw_dev_check_syspll()
870 ret = aw_dev_check_mode2_pll(aw_dev); in aw_dev_check_syspll()
872 dev_err(aw_dev->dev, "mode2 check iis failed"); in aw_dev_check_syspll()
880 static int aw_dev_check_sysst(struct aw_device *aw_dev) in aw_dev_check_sysst() argument
887 ret = regmap_read(aw_dev->regmap, AW88395_SYSST_REG, &reg_val); in aw_dev_check_sysst()
894 dev_err(aw_dev->dev, "check sysst fail, cnt=%d, reg_val=0x%04x, check:0x%x", in aw_dev_check_sysst()
905 static int aw_dev_check_sysint(struct aw_device *aw_dev) in aw_dev_check_sysint() argument
909 aw_dev_get_int_status(aw_dev, &reg_val); in aw_dev_check_sysint()
912 dev_err(aw_dev->dev, "pa stop check fail:0x%04x", reg_val); in aw_dev_check_sysint()
919 static void aw_dev_get_cur_mode_st(struct aw_device *aw_dev) in aw_dev_get_cur_mode_st() argument
921 struct aw_profctrl_desc *profctrl_desc = &aw_dev->profctrl_desc; in aw_dev_get_cur_mode_st()
925 ret = regmap_read(aw_dev->regmap, AW88395_SYSCTRL_REG, &reg_val); in aw_dev_get_cur_mode_st()
927 dev_dbg(aw_dev->dev, "%s failed", __func__); in aw_dev_get_cur_mode_st()
936 static void aw_dev_get_dsp_config(struct aw_device *aw_dev, unsigned char *dsp_cfg) in aw_dev_get_dsp_config() argument
941 ret = regmap_read(aw_dev->regmap, AW88395_SYSCTRL_REG, &reg_val); in aw_dev_get_dsp_config()
943 dev_dbg(aw_dev->dev, "%s failed", __func__); in aw_dev_get_dsp_config()
952 static void aw_dev_select_memclk(struct aw_device *aw_dev, unsigned char flag) in aw_dev_select_memclk() argument
958 ret = regmap_update_bits(aw_dev->regmap, AW88395_DBGCTRL_REG, in aw_dev_select_memclk()
962 dev_err(aw_dev->dev, "memclk select pll failed"); in aw_dev_select_memclk()
965 ret = regmap_update_bits(aw_dev->regmap, AW88395_DBGCTRL_REG, in aw_dev_select_memclk()
969 dev_err(aw_dev->dev, "memclk select OSC failed"); in aw_dev_select_memclk()
972 dev_err(aw_dev->dev, "unknown memclk config, flag=0x%x", flag); in aw_dev_select_memclk()
977 static int aw_dev_get_dsp_status(struct aw_device *aw_dev) in aw_dev_get_dsp_status() argument
982 ret = regmap_read(aw_dev->regmap, AW88395_WDT_REG, &reg_val); in aw_dev_get_dsp_status()
991 static int aw_dev_get_vmax(struct aw_device *aw_dev, unsigned int *vmax) in aw_dev_get_vmax() argument
993 return aw_dev_dsp_read(aw_dev, AW88395_DSP_REG_VMAX, vmax, AW88395_DSP_16_DATA); in aw_dev_get_vmax()
996 static int aw_dev_update_reg_container(struct aw_device *aw_dev, in aw_dev_update_reg_container() argument
999 struct aw_volume_desc *vol_desc = &aw_dev->volume_desc; in aw_dev_update_reg_container()
1012 dev_err(aw_dev->dev, "data len:%d unsupported", data_len); in aw_dev_update_reg_container()
1021 ret = regmap_read(aw_dev->regmap, reg_addr, &read_val); in aw_dev_update_reg_container()
1040 aw_dev->volume_desc.init_volume = in aw_dev_update_reg_container()
1043 ret = regmap_write(aw_dev->regmap, reg_addr, reg_val); in aw_dev_update_reg_container()
1049 aw_dev_get_cur_mode_st(aw_dev); in aw_dev_update_reg_container()
1051 if (aw_dev->prof_cur != aw_dev->prof_index) { in aw_dev_update_reg_container()
1056 aw_dev_set_volume(aw_dev, vol_desc->ctl_volume); in aw_dev_update_reg_container()
1059 aw_dev_get_dsp_config(aw_dev, &aw_dev->dsp_cfg); in aw_dev_update_reg_container()
1064 static int aw_dev_reg_update(struct aw_device *aw_dev, in aw_dev_reg_update() argument
1070 dev_err(aw_dev->dev, "reg data is null or len is 0"); in aw_dev_reg_update()
1074 ret = aw_dev_update_reg_container(aw_dev, data, len); in aw_dev_reg_update()
1076 dev_err(aw_dev->dev, "reg update failed"); in aw_dev_reg_update()
1085 struct aw_device *aw_dev = in aw_dev_get_ra() local
1090 ret = aw_dev_dsp_read(aw_dev, AW88395_DSP_REG_CFG_ADPZ_RA, in aw_dev_get_ra()
1093 dev_err(aw_dev->dev, "read ra error"); in aw_dev_get_ra()
1103 static int aw_dev_dsp_update_container(struct aw_device *aw_dev, in aw_dev_dsp_update_container() argument
1111 mutex_lock(&aw_dev->dsp_lock); in aw_dev_dsp_update_container()
1112 ret = regmap_write(aw_dev->regmap, AW88395_DSPMADD_REG, base); in aw_dev_dsp_update_container()
1122 ret = regmap_raw_write(aw_dev->regmap, AW88395_DSPMDAT_REG, in aw_dev_dsp_update_container()
1127 mutex_unlock(&aw_dev->dsp_lock); in aw_dev_dsp_update_container()
1131 mutex_lock(&aw_dev->dsp_lock); in aw_dev_dsp_update_container()
1133 ret = regmap_write(aw_dev->regmap, AW88395_DSPMADD_REG, base); in aw_dev_dsp_update_container()
1138 ret = regmap_write(aw_dev->regmap, AW88395_DSPMDAT_REG, in aw_dev_dsp_update_container()
1143 mutex_unlock(&aw_dev->dsp_lock); in aw_dev_dsp_update_container()
1149 mutex_unlock(&aw_dev->dsp_lock); in aw_dev_dsp_update_container()
1153 static int aw_dev_dsp_update_fw(struct aw_device *aw_dev, in aw_dev_dsp_update_fw() argument
1157 dev_dbg(aw_dev->dev, "dsp firmware len:%d", len); in aw_dev_dsp_update_fw()
1160 dev_err(aw_dev->dev, "dsp firmware data is null or len is 0"); in aw_dev_dsp_update_fw()
1163 aw_dev_dsp_update_container(aw_dev, data, len, AW88395_DSP_FW_ADDR); in aw_dev_dsp_update_fw()
1164 aw_dev->dsp_fw_len = len; in aw_dev_dsp_update_fw()
1169 static int aw_dev_copy_to_crc_dsp_cfg(struct aw_device *aw_dev, in aw_dev_copy_to_crc_dsp_cfg() argument
1172 struct aw_sec_data_desc *crc_dsp_cfg = &aw_dev->crc_dsp_cfg; in aw_dev_copy_to_crc_dsp_cfg()
1175 crc_dsp_cfg->data = devm_kzalloc(aw_dev->dev, size, GFP_KERNEL); in aw_dev_copy_to_crc_dsp_cfg()
1180 devm_kfree(aw_dev->dev, crc_dsp_cfg->data); in aw_dev_copy_to_crc_dsp_cfg()
1181 crc_dsp_cfg->data = devm_kzalloc(aw_dev->dev, size, GFP_KERNEL); in aw_dev_copy_to_crc_dsp_cfg()
1192 static int aw_dev_dsp_update_cfg(struct aw_device *aw_dev, in aw_dev_dsp_update_cfg() argument
1197 dev_dbg(aw_dev->dev, "dsp config len:%d", len); in aw_dev_dsp_update_cfg()
1200 dev_err(aw_dev->dev, "dsp config data is null or len is 0"); in aw_dev_dsp_update_cfg()
1204 aw_dev_dsp_update_container(aw_dev, data, len, AW88395_DSP_CFG_ADDR); in aw_dev_dsp_update_cfg()
1205 aw_dev->dsp_cfg_len = len; in aw_dev_dsp_update_cfg()
1207 ret = aw_dev_copy_to_crc_dsp_cfg(aw_dev, data, len); in aw_dev_dsp_update_cfg()
1211 ret = aw_dev_set_vcalb(aw_dev); in aw_dev_dsp_update_cfg()
1214 ret = aw_dev_get_ra(&aw_dev->cali_desc); in aw_dev_dsp_update_cfg()
1217 ret = aw_dev_get_cali_f0_delay(aw_dev); in aw_dev_dsp_update_cfg()
1221 ret = aw_dev_get_vmax(aw_dev, &aw_dev->vmax_desc.init_vmax); in aw_dev_dsp_update_cfg()
1223 dev_err(aw_dev->dev, "get vmax failed"); in aw_dev_dsp_update_cfg()
1226 dev_dbg(aw_dev->dev, "get init vmax:0x%x", aw_dev->vmax_desc.init_vmax); in aw_dev_dsp_update_cfg()
1227 aw_dev->dsp_crc_st = AW88395_DSP_CRC_NA; in aw_dev_dsp_update_cfg()
1232 static int aw_dev_check_sram(struct aw_device *aw_dev) in aw_dev_check_sram() argument
1236 mutex_lock(&aw_dev->dsp_lock); in aw_dev_check_sram()
1238 regmap_write(aw_dev->regmap, AW88395_DSPMADD_REG, AW88395_DSP_ODD_NUM_BIT_TEST); in aw_dev_check_sram()
1239 regmap_read(aw_dev->regmap, AW88395_DSPMADD_REG, &reg_val); in aw_dev_check_sram()
1241 dev_err(aw_dev->dev, "check reg 0x40 odd bit failed, read[0x%x] != write[0x%x]", in aw_dev_check_sram()
1247 regmap_write(aw_dev->regmap, AW88395_DSPMADD_REG, AW88395_DSP_EVEN_NUM_BIT_TEST); in aw_dev_check_sram()
1248 regmap_read(aw_dev->regmap, AW88395_DSPMADD_REG, &reg_val); in aw_dev_check_sram()
1250 dev_err(aw_dev->dev, "check reg 0x40 even bit failed, read[0x%x] != write[0x%x]", in aw_dev_check_sram()
1256 aw_dev_dsp_write_16bit(aw_dev, AW88395_DSP_FW_ADDR, AW88395_DSP_EVEN_NUM_BIT_TEST); in aw_dev_check_sram()
1257 aw_dev_dsp_read_16bit(aw_dev, AW88395_DSP_FW_ADDR, &reg_val); in aw_dev_check_sram()
1259 dev_err(aw_dev->dev, "check dsp fw addr failed, read[0x%x] != write[0x%x]", in aw_dev_check_sram()
1265 aw_dev_dsp_write_16bit(aw_dev, AW88395_DSP_CFG_ADDR, AW88395_DSP_ODD_NUM_BIT_TEST); in aw_dev_check_sram()
1266 aw_dev_dsp_read_16bit(aw_dev, AW88395_DSP_CFG_ADDR, &reg_val); in aw_dev_check_sram()
1268 dev_err(aw_dev->dev, "check dsp cfg failed, read[0x%x] != write[0x%x]", in aw_dev_check_sram()
1272 mutex_unlock(&aw_dev->dsp_lock); in aw_dev_check_sram()
1277 mutex_unlock(&aw_dev->dsp_lock); in aw_dev_check_sram()
1281 int aw88395_dev_fw_update(struct aw_device *aw_dev, bool up_dsp_fw_en, bool force_up_en) in aw88395_dev_fw_update() argument
1288 if ((aw_dev->prof_cur == aw_dev->prof_index) && in aw88395_dev_fw_update()
1290 dev_dbg(aw_dev->dev, "scene no change, not update"); in aw88395_dev_fw_update()
1294 if (aw_dev->fw_status == AW88395_DEV_FW_FAILED) { in aw88395_dev_fw_update()
1295 dev_err(aw_dev->dev, "fw status[%d] error", aw_dev->fw_status); in aw88395_dev_fw_update()
1299 ret = aw88395_dev_get_prof_name(aw_dev, aw_dev->prof_index, &prof_name); in aw88395_dev_fw_update()
1303 dev_dbg(aw_dev->dev, "start update %s", prof_name); in aw88395_dev_fw_update()
1305 ret = aw88395_dev_get_prof_data(aw_dev, aw_dev->prof_index, &prof_index_desc); in aw88395_dev_fw_update()
1311 ret = aw_dev_reg_update(aw_dev, sec_desc[AW88395_DATA_TYPE_REG].data, in aw88395_dev_fw_update()
1314 dev_err(aw_dev->dev, "update reg failed"); in aw88395_dev_fw_update()
1318 aw88395_dev_mute(aw_dev, true); in aw88395_dev_fw_update()
1320 if (aw_dev->dsp_cfg == AW88395_DEV_DSP_WORK) in aw88395_dev_fw_update()
1321 aw_dev_dsp_enable(aw_dev, false); in aw88395_dev_fw_update()
1323 aw_dev_select_memclk(aw_dev, AW88395_DEV_MEMCLK_OSC); in aw88395_dev_fw_update()
1326 ret = aw_dev_check_sram(aw_dev); in aw88395_dev_fw_update()
1328 dev_err(aw_dev->dev, "check sram failed"); in aw88395_dev_fw_update()
1333 dev_dbg(aw_dev->dev, "fw_ver: [%x]", prof_index_desc->fw_ver); in aw88395_dev_fw_update()
1334 ret = aw_dev_dsp_update_fw(aw_dev, sec_desc[AW88395_DATA_TYPE_DSP_FW].data, in aw88395_dev_fw_update()
1337 dev_err(aw_dev->dev, "update dsp fw failed"); in aw88395_dev_fw_update()
1343 ret = aw_dev_dsp_update_cfg(aw_dev, sec_desc[AW88395_DATA_TYPE_DSP_CFG].data, in aw88395_dev_fw_update()
1346 dev_err(aw_dev->dev, "update dsp cfg failed"); in aw88395_dev_fw_update()
1350 aw_dev_select_memclk(aw_dev, AW88395_DEV_MEMCLK_PLL); in aw88395_dev_fw_update()
1352 aw_dev->prof_cur = aw_dev->prof_index; in aw88395_dev_fw_update()
1357 aw_dev_select_memclk(aw_dev, AW88395_DEV_MEMCLK_PLL); in aw88395_dev_fw_update()
1362 static int aw_dev_dsp_check(struct aw_device *aw_dev) in aw_dev_dsp_check() argument
1366 switch (aw_dev->dsp_cfg) { in aw_dev_dsp_check()
1368 dev_dbg(aw_dev->dev, "dsp bypass"); in aw_dev_dsp_check()
1372 aw_dev_dsp_enable(aw_dev, false); in aw_dev_dsp_check()
1373 aw_dev_dsp_enable(aw_dev, true); in aw_dev_dsp_check()
1376 ret = aw_dev_get_dsp_status(aw_dev); in aw_dev_dsp_check()
1378 dev_err(aw_dev->dev, "dsp wdt status error=%d", ret); in aw_dev_dsp_check()
1384 dev_err(aw_dev->dev, "unknown dsp cfg=%d", aw_dev->dsp_cfg); in aw_dev_dsp_check()
1394 struct aw_device *aw_dev = in aw_dev_update_cali_re() local
1398 if ((aw_dev->cali_desc.cali_re < AW88395_CALI_RE_MAX) && in aw_dev_update_cali_re()
1399 (aw_dev->cali_desc.cali_re > AW88395_CALI_RE_MIN)) { in aw_dev_update_cali_re()
1401 ret = aw_dev_dsp_set_cali_re(aw_dev); in aw_dev_update_cali_re()
1403 dev_err(aw_dev->dev, "set cali re failed"); in aw_dev_update_cali_re()
1407 int aw88395_dev_start(struct aw_device *aw_dev) in aw88395_dev_start() argument
1411 if (aw_dev->status == AW88395_DEV_PW_ON) { in aw88395_dev_start()
1412 dev_info(aw_dev->dev, "already power on"); in aw88395_dev_start()
1416 aw_dev_pwd(aw_dev, false); in aw88395_dev_start()
1419 ret = aw_dev_check_syspll(aw_dev); in aw88395_dev_start()
1421 dev_err(aw_dev->dev, "pll check failed cannot start"); in aw88395_dev_start()
1426 aw_dev_amppd(aw_dev, false); in aw88395_dev_start()
1430 ret = aw_dev_check_sysst(aw_dev); in aw88395_dev_start()
1432 dev_err(aw_dev->dev, "sysst check failed"); in aw88395_dev_start()
1436 if (aw_dev->dsp_cfg == AW88395_DEV_DSP_WORK) { in aw88395_dev_start()
1438 aw_dev_dsp_enable(aw_dev, false); in aw88395_dev_start()
1439 ret = aw_dev_dsp_fw_check(aw_dev); in aw88395_dev_start()
1443 aw_dev_update_cali_re(&aw_dev->cali_desc); in aw88395_dev_start()
1445 if (aw_dev->dsp_crc_st != AW88395_DSP_CRC_OK) { in aw88395_dev_start()
1446 ret = aw_dev_dsp_check_crc32(aw_dev); in aw88395_dev_start()
1448 dev_err(aw_dev->dev, "dsp crc check failed"); in aw88395_dev_start()
1453 ret = aw_dev_dsp_check(aw_dev); in aw88395_dev_start()
1455 dev_err(aw_dev->dev, "dsp status check failed"); in aw88395_dev_start()
1459 dev_dbg(aw_dev->dev, "start pa with dsp bypass"); in aw88395_dev_start()
1463 aw_dev_i2s_tx_enable(aw_dev, true); in aw88395_dev_start()
1466 aw88395_dev_mute(aw_dev, false); in aw88395_dev_start()
1468 aw_dev_clear_int_status(aw_dev); in aw88395_dev_start()
1469 aw_dev->status = AW88395_DEV_PW_ON; in aw88395_dev_start()
1475 aw_dev_dsp_enable(aw_dev, false); in aw88395_dev_start()
1478 aw_dev_clear_int_status(aw_dev); in aw88395_dev_start()
1479 aw_dev_amppd(aw_dev, true); in aw88395_dev_start()
1481 aw_dev_pwd(aw_dev, true); in aw88395_dev_start()
1482 aw_dev->status = AW88395_DEV_PW_OFF; in aw88395_dev_start()
1488 int aw88395_dev_stop(struct aw_device *aw_dev) in aw88395_dev_stop() argument
1491 &aw_dev->prof_info.prof_desc[aw_dev->prof_cur].sec_desc[AW88395_DATA_TYPE_DSP_CFG]; in aw88395_dev_stop()
1493 &aw_dev->prof_info.prof_desc[aw_dev->prof_cur].sec_desc[AW88395_DATA_TYPE_DSP_FW]; in aw88395_dev_stop()
1497 if (aw_dev->status == AW88395_DEV_PW_OFF) { in aw88395_dev_stop()
1498 dev_info(aw_dev->dev, "already power off"); in aw88395_dev_stop()
1502 aw_dev->status = AW88395_DEV_PW_OFF; in aw88395_dev_stop()
1505 aw88395_dev_mute(aw_dev, true); in aw88395_dev_stop()
1509 aw_dev_i2s_tx_enable(aw_dev, false); in aw88395_dev_stop()
1513 int_st = aw_dev_check_sysint(aw_dev); in aw88395_dev_stop()
1516 aw_dev_dsp_enable(aw_dev, false); in aw88395_dev_stop()
1519 aw_dev_amppd(aw_dev, true); in aw88395_dev_stop()
1523 aw_dev_select_memclk(aw_dev, AW88395_DEV_MEMCLK_OSC); in aw88395_dev_stop()
1524 ret = aw_dev_dsp_update_fw(aw_dev, dsp_fw->data, dsp_fw->len); in aw88395_dev_stop()
1526 dev_err(aw_dev->dev, "update dsp fw failed"); in aw88395_dev_stop()
1527 ret = aw_dev_dsp_update_cfg(aw_dev, dsp_cfg->data, dsp_cfg->len); in aw88395_dev_stop()
1529 dev_err(aw_dev->dev, "update dsp cfg failed"); in aw88395_dev_stop()
1530 aw_dev_select_memclk(aw_dev, AW88395_DEV_MEMCLK_PLL); in aw88395_dev_stop()
1534 aw_dev_pwd(aw_dev, true); in aw88395_dev_stop()
1540 int aw88395_dev_init(struct aw_device *aw_dev, struct aw_container *aw_cfg) in aw88395_dev_init() argument
1544 if ((!aw_dev) || (!aw_cfg)) { in aw88395_dev_init()
1548 ret = aw88395_dev_cfg_load(aw_dev, aw_cfg); in aw88395_dev_init()
1550 dev_err(aw_dev->dev, "aw_dev acf parse failed"); in aw88395_dev_init()
1553 aw_dev->fade_in_time = AW88395_1000_US / 10; in aw88395_dev_init()
1554 aw_dev->fade_out_time = AW88395_1000_US >> 1; in aw88395_dev_init()
1555 aw_dev->prof_cur = aw_dev->prof_info.prof_desc[0].id; in aw88395_dev_init()
1556 aw_dev->prof_index = aw_dev->prof_info.prof_desc[0].id; in aw88395_dev_init()
1558 ret = aw88395_dev_fw_update(aw_dev, AW88395_FORCE_UPDATE_ON, AW88395_DSP_FW_UPDATE_ON); in aw88395_dev_init()
1560 dev_err(aw_dev->dev, "fw update failed ret = %d\n", ret); in aw88395_dev_init()
1565 aw88395_dev_mute(aw_dev, true); in aw88395_dev_init()
1569 aw_dev_i2s_tx_enable(aw_dev, false); in aw88395_dev_init()
1573 aw_dev_dsp_enable(aw_dev, false); in aw88395_dev_init()
1575 aw_dev_amppd(aw_dev, true); in aw88395_dev_init()
1577 aw_dev_pwd(aw_dev, true); in aw88395_dev_init()
1583 static void aw88395_parse_channel_dt(struct aw_device *aw_dev) in aw88395_parse_channel_dt() argument
1585 struct device_node *np = aw_dev->dev->of_node; in aw88395_parse_channel_dt()
1591 dev_dbg(aw_dev->dev, in aw88395_parse_channel_dt()
1593 aw_dev->channel = AW88395_DEV_DEFAULT_CH; in aw88395_parse_channel_dt()
1597 dev_dbg(aw_dev->dev, "read audio-channel value is: %d", in aw88395_parse_channel_dt()
1599 aw_dev->channel = channel_value; in aw88395_parse_channel_dt()
1602 static int aw_dev_init(struct aw_device *aw_dev) in aw_dev_init() argument
1604 aw_dev->chip_id = AW88395_CHIP_ID; in aw_dev_init()
1606 aw_dev->acf = NULL; in aw_dev_init()
1607 aw_dev->prof_info.prof_desc = NULL; in aw_dev_init()
1608 aw_dev->prof_info.count = 0; in aw_dev_init()
1609 aw_dev->prof_info.prof_type = AW88395_DEV_NONE_TYPE_ID; in aw_dev_init()
1610 aw_dev->channel = 0; in aw_dev_init()
1611 aw_dev->fw_status = AW88395_DEV_FW_FAILED; in aw_dev_init()
1613 aw_dev->fade_step = AW88395_VOLUME_STEP_DB; in aw_dev_init()
1614 aw_dev->volume_desc.ctl_volume = AW88395_VOL_DEFAULT_VALUE; in aw_dev_init()
1615 aw88395_parse_channel_dt(aw_dev); in aw_dev_init()
1620 int aw88395_dev_get_profile_count(struct aw_device *aw_dev) in aw88395_dev_get_profile_count() argument
1622 return aw_dev->prof_info.count; in aw88395_dev_get_profile_count()
1626 int aw88395_dev_get_profile_index(struct aw_device *aw_dev) in aw88395_dev_get_profile_index() argument
1628 return aw_dev->prof_index; in aw88395_dev_get_profile_index()
1632 int aw88395_dev_set_profile_index(struct aw_device *aw_dev, int index) in aw88395_dev_set_profile_index() argument
1635 if ((index >= aw_dev->prof_info.count) || (index < 0)) in aw88395_dev_set_profile_index()
1638 if (aw_dev->prof_index == index) in aw88395_dev_set_profile_index()
1641 aw_dev->prof_index = index; in aw88395_dev_set_profile_index()
1642 dev_dbg(aw_dev->dev, "set prof[%s]", in aw88395_dev_set_profile_index()
1643 aw_dev->prof_info.prof_name_list[aw_dev->prof_info.prof_desc[index].id]); in aw88395_dev_set_profile_index()
1649 int aw88395_dev_get_prof_name(struct aw_device *aw_dev, int index, char **prof_name) in aw88395_dev_get_prof_name() argument
1651 struct aw_prof_info *prof_info = &aw_dev->prof_info; in aw88395_dev_get_prof_name()
1654 if ((index >= aw_dev->prof_info.count) || (index < 0)) { in aw88395_dev_get_prof_name()
1655 dev_err(aw_dev->dev, "index[%d] overflow count[%d]", in aw88395_dev_get_prof_name()
1656 index, aw_dev->prof_info.count); in aw88395_dev_get_prof_name()
1660 prof_desc = &aw_dev->prof_info.prof_desc[index]; in aw88395_dev_get_prof_name()
1668 int aw88395_dev_get_prof_data(struct aw_device *aw_dev, int index, in aw88395_dev_get_prof_data() argument
1671 if ((index >= aw_dev->prof_info.count) || (index < 0)) { in aw88395_dev_get_prof_data()
1672 dev_err(aw_dev->dev, "%s: index[%d] overflow count[%d]\n", in aw88395_dev_get_prof_data()
1673 __func__, index, aw_dev->prof_info.count); in aw88395_dev_get_prof_data()
1677 *prof_desc = &aw_dev->prof_info.prof_desc[index]; in aw88395_dev_get_prof_data()
1683 int aw88395_init(struct aw_device **aw_dev, struct i2c_client *i2c, struct regmap *regmap) in aw88395_init() argument
1688 if (*aw_dev) { in aw88395_init()
1691 *aw_dev = devm_kzalloc(&i2c->dev, sizeof(struct aw_device), GFP_KERNEL); in aw88395_init()
1692 if (!(*aw_dev)) in aw88395_init()
1696 (*aw_dev)->i2c = i2c; in aw88395_init()
1697 (*aw_dev)->dev = &i2c->dev; in aw88395_init()
1698 (*aw_dev)->regmap = regmap; in aw88395_init()
1699 mutex_init(&(*aw_dev)->dsp_lock); in aw88395_init()
1702 ret = aw_dev_read_chipid((*aw_dev), &chip_id); in aw88395_init()
1710 ret = aw_dev_init((*aw_dev)); in aw88395_init()
1714 dev_err((*aw_dev)->dev, "unsupported device"); in aw88395_init()