AD1848: Fix additional data format unlocking which has been wrong this whole time

This commit is contained in:
RichardG867 2025-01-20 12:51:27 -03:00
parent 44205ff218
commit 0be045b3cf

View file

@ -273,20 +273,21 @@ ad1848_write(uint16_t addr, uint8_t val, void *priv)
return; return;
case 12: case 12:
if (ad1848->type != AD1848_TYPE_DEFAULT) if (ad1848->type >= AD1848_TYPE_CS4248) {
ad1848->regs[12] = ((ad1848->regs[12] & 0x0f) + (val & 0xf0)) | 0x80; ad1848->regs[12] = 0x80 | (val & 0x70) | (ad1848->regs[12] & 0x0f);
if ((ad1848->type >= AD1848_TYPE_CS4231) && (ad1848->type < AD1848_TYPE_CS4235)) {
if (val & 0x40)
ad1848->fmt_mask |= 0x80;
else
ad1848->fmt_mask &= ~0x80;
}
}
return; return;
case 14: case 14:
ad1848->count = ad1848->regs[15] | (val << 8); ad1848->count = ad1848->regs[15] | (val << 8);
break; break;
case 17:
/* Enable additional data formats on modes 2 and 3 where supported. */
if ((ad1848->type == AD1848_TYPE_CS4231) || (ad1848->type == AD1848_TYPE_CS4236B))
ad1848->fmt_mask = (val & 0x40) ? 0xf0 : 0x70;
break;
case 18: case 18:
case 19: case 19:
if (ad1848->type >= AD1848_TYPE_CS4236B) { if (ad1848->type >= AD1848_TYPE_CS4236B) {