On Thu, Jun 12, 2014 at 6:35 PM, Emilio López <emi...@elopez.com.ar> wrote:
> El 12/06/14 19:11, jonsm...@gmail.com escribió:
>
>> What has replaced sw_get_ic_ver() on 3.15?
>>
>> Codec code varies on every chip revision A,B,C and A10/20.
>
>
> A10/A20 can be determined by the compatible string. Chip revision is going
> to be trickier though, there is no direct replacement of sw_get_ic_ver()
> that I'm aware of. sw_get_ic_ver() seems to poke a timer register in the
> sun4i case, and SID (for which we do have a driver[1]) on the sun5i case.
>
> [1] drivers/misc/eeprom/sunxi_sid.c

We may have to reimplement it. Codec driver has stuff like this in it.

I only have to know 4i, 5i or 7i. And then if it is an A version of a
4i. Looks like they have made some mistakes in 4i version A and fixed
it later revisions.

One mistake is the volume control is flipped between A10A and A10B/C.

if (sunxi_is_sun4i()) {
int rc;
int device_lr_change = 0;
if (codec_chip_ver == SUNXI_VER_A10A)
codec_wr_control(SUNXI_DAC_ACTL, 0x6, VOLUME, 0x01);
else if (codec_chip_ver == SUNXI_VER_A10B ||
codec_chip_ver == SUNXI_VER_A10C)
codec_wr_control(SUNXI_DAC_ACTL, 0x6, VOLUME, 0x3b);
else {
printk("[audio codec] chip version is unknown!\n");
return -1;
}

if (codec_chip_ver == SUNXI_VER_A10A) {
if (has_playback)
for (idx = 0; idx < ARRAY_SIZE(sunxia_dac); idx++)
if ((err = snd_ctl_add(card, snd_ctl_new1(&sunxia_dac[idx], clnt))) < 0)
return err;
if (has_capture)
for (idx = 0; idx < ARRAY_SIZE(codec_adc_controls); idx++)
if ((err = snd_ctl_add(card, snd_ctl_new1(&codec_adc_controls[idx], clnt))) < 0)
return err;
} else if (sunxi_is_sun5i() ||
  codec_chip_ver == SUNXI_VER_A10B ||
  codec_chip_ver == SUNXI_VER_A10C) {
if (has_playback)
for (idx = 0; idx < ARRAY_SIZE(sunxibc_dac); idx++)
if ((err = snd_ctl_add(card, snd_ctl_new1(&sunxibc_dac[idx], clnt))) < 0)
return err;
if (has_capture)
for (idx = 0; idx < ARRAY_SIZE(codec_adc_controls); idx++)
if ((err = snd_ctl_add(card, snd_ctl_new1(&codec_adc_controls[idx], clnt))) < 0)
return err;
} else if (sunxi_is_sun7i()) {
if (has_playback)
for (idx = 0; idx < ARRAY_SIZE(sun7i_dac_ctls); idx++)
if ((err = snd_ctl_add(card, snd_ctl_new1(&sun7i_dac_ctls[idx], clnt))) < 0)
return err;
if (has_capture)
for (idx = 0; idx < ARRAY_SIZE(sun7i_adc_ctls); idx++)
if ((err = snd_ctl_add(card, snd_ctl_new1(&sun7i_adc_ctls[idx], clnt))) < 0)
return err;
} else {
printk("[audio codec] chip version is unknown!\n");
return -1;
}



-- 
Jon Smirl
jonsm...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to