Sorry for the late response. :)

Antonio Ospite wrote:
I'm almost done with transition to linux-2.6.25, but I can't find a
way to convert this snippet from sound/soc/pxa/ezx.c:
   if (codec_dai->id == PCAP2_STEREO_DAI) {
     /* override pxa2xx-ssp sample size for stereo/network mode */
     SSCR0_P(cpu_dai->id+1) &= ~(SSCR0_DSS | SSCR0_EDSS);
     SSCR0_P(cpu_dai->id+1) |= (SSCR0_EDSS | SSCR0_DataSize (16));
This was needed to override the sample size. PCAP only supports PCM_FORMAT_S16_LE, but when using the ST_DAC it expects to talk with the PXA with PCM_FORMAT_S32_LE(SSCR0_EDSS | SSCR0_DataSize(16)). PCAP expects 32 bits for each assertion of SFRM(PCAP master), im not sure if the other 16 bits are used for the other audio channel or if they are just ignored. Anyway, i tried a lot of configurations to use 16 bit SSP frames for 16 bit stereo audio (the above hack would not be needed), and tried feeding 32 bit stereo audio through the 32 bit SSP frames, in the end all i got was (IIRC) noise, or mono audio. I am not really sure of how the pcap <-> pxa-ssp communication is made, maybe it is 16 bit stereo audio sent with 32bit i2s emulation (8.4.11 of pxa manual) with PXA as slave, maybe it is not... All i know is that it does not work unless we use 32 bit ssp frames for 16 bit audio data. Back on the above hack.. I couldnt find an easier way to configure the SSP port for 32 bits, the best place for such a hack would be on machine->hw_params(), but as cpu->hw_params() is executed _after_ machine->hw_params() by soc-core.c i had to delay the override to the machine->prepare() invocation. A proper fix would be some way on soc-core.c to set PCM_FORMAT_S32_LE for cpu->hw_params() even if PCM_FORMAT_S16_LE audio is feed by userspace, or some magical PCAP register mangling to read the audio data from the SSP port in a sane way.

PS: I also remember that the 16 bit limit defined by soc-core on registers accessed by the mixer controls was a pain, there is an ugly hack on the code to "emulate" the 16 bit registers expected by soc-core from the 25 bit PCAP registers. :/


Philipp Zabel told me that SSCR0 changes should happen only in
pxa2xx-ssp.c but I can't find a way to invoke changes to cpu_dai
hw_params from a machine file.
        He is right! But pxa2xx-ssp.c doesnt cover all the possibilities yet.

Does it have any sense to call cpu_dai->ops.hw_params() directly from
ezx_machine_prepare? I expect this call to invoke pxa2xx_ssp_hw_params
in our case, which should do the initialization we want if it finds
SNDRV_PCM_FORMAT_S32_LE in the params argument. But how to setup the
params argument?
I guess that *->hw_params() is only meant to be called from inside soc-core's soc_pcm_hw_params().

--
Daniel Ribeiro

Reply via email to