Skip to content
Merged
2 changes: 1 addition & 1 deletion src/platform/mtk/dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct afe_cfg {
*/
static void cfg_convert(const struct afe_cfg *src, struct mtk_base_memif_data *dst)
{
#define REGCVT(R) (((R) > 0) ? ((R) - MTK_AFE_BASE) : -1)
#define REGCVT(R) (((R) > 0) ? ((R) - MTK_AFE_BASE) : 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW: this isn't the AFE driver's struct though, it's the Zephyr-side intermediate. I chose -1 because in a few spots it looked like a zero had valid semantic meaning. But I was doing the port blind.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andyross , I've tried to avoid AFE refactoring that were crashing with a memory violation exception when reg_ofs_base_msb and reg_ofs_end_msb were set to -1

dst->reg_ofs_base_msb = REGCVT(src->base.hi);
dst->reg_ofs_cur_msb = REGCVT(src->cur.hi);
dst->reg_ofs_end_msb = REGCVT(src->end.hi);

/* set start, end, upper 32 bits */
if (memif->data->reg_ofs_base_msb) {
afe_reg_write(afe, memif->data->reg_ofs_base_msb, phys_buf_addr_upper_32);
afe_reg_write(afe, memif->data->reg_ofs_end_msb, phys_buf_addr_upper_32);
}


#define COPYBIT(S, Dr, Ds) do { \
dst->Dr = REGCVT(src->S.reg); \
Expand Down