[Gta04-owner] fm-tuner - was Re: hw routing audio patch removed in 3.7?
Dr. H. Nikolaus Schaller
hns at goldelico.com
Wed Jun 12 15:58:13 CEST 2013
Hi,
maybe someone has an idea how to pass I2C config from the board file to the codec.
Am 12.06.2013 um 11:06 schrieb Dr. H. Nikolaus Schaller:
>>
>> Well, i2c tools are not able to read the multi-byte response.
>>
>> But I have found the issue. It is the way the code writes a command and
>> reads back the response. There is no time delay in between.
>>
>> To explain what happens:
>> * there appears to be some MCU inside the Si4721 with ROM firmware
>> * the chip has an autonomous I2C slave controller
>> * when the OMAP sends a command this wakes up the MCU to handle
>> the command
>> * the MCU code e.g. "tunes" and writes back its status to the I2C slave
>> controller response registers
>> * and it issues an interrupt (on line GPO2/INT
>> * the OMAP should then read back from the I2C response registers
>>
>> But by using ioctl(fd,I2C_RDWR,&iod) the OMAP immediately reads
>> the I2C-slave response registers before the MCU has completed its
>> tasks. This appears to return all the 00 values we see. So if the OMAP
>> I2C driver is too fast, communication will not work.
>>
>> I have changed the code to separate the write and read command
>> and - voilà - it works.
>>
>> Here is the patch (I have also added some -d for debugging mode
>> and -s for initiating the status loop):
>>
>> <http://git.goldelico.com/?p=gta04-rootfs.git;a=commit;h=7bbf278ec168bdf14dbdfa940f82ae3831b4a691>
>>
>> Next I will check if I can see any PCM...
>
> Interesting note from the data sheet:
>
> Failure to provide DCLK and DFS prior to setting the sample rate property may cause the chip to go into an unknown
> state and user must reset the chip.
>
> This means the arecord command must be run before ./si4721 or we need a separate command to set the sample
> rate to 0 before turning on/off arecord.
What I have now done is to fix the sound/soc/codecs/si47xx.c and sound/soc/omap/gta04-fm.c drivers to compile cleanly (diff attached).
One issue is open, because I don't understand all the data structures that have changed. Maybe someone knows and
can give a hint.
the question is how the I2C bus and address are configured in the 3.7 ALSA soc system. In 2.6 it was part of the
omap/gta04-fm.c driver. Now it appears that we have a struct platform_device in the board file and a - currently
unused - .platform_data link. At least that is what I deduce from the stub code in the board file.
Here is the code fragment:
#if defined(CONFIG_SND_SOC_GTM601)
static struct platform_device gta04_gtm601_codec_audio_device = {
.name = "gtm601_codec_audio",
.id = -1,
.dev = {
.platform_data = NULL,
},
};
#endif
#if defined(CONFIG_SND_SOC_SI47XX)
#if 0 // this is what I assume should be in the .platform data - but in a different format
static struct si47xx_setup_data gta04_fm_soc_data = {
.i2c_bus = 2,
.i2c_address = 0x11,
};
#endif
static struct platform_device gta04_si47xx_codec_audio_device = {
.name = "si47xx_codec_audio",
.id = -1,
.dev = {
.platform_data = NULL,
// .platform_data = gta04_fm_soc_data,
},
};
#endif
#if defined(CONFIG_SND_SOC_W2CBW003)
static struct platform_device gta04_w2cbw003_codec_audio_device = {
.name = "w2cbw003_codec_audio",
.id = -1,
.dev = {
.platform_data = NULL,
},
};
#endif
The .platform_data = gta04_fm_soc_data is the location where I suspect that we should provide the bus number
and I2C chip address. But I have no idea how.
A pointer to some 3.7 kernel source for a device/board where an I2C codec is used and configured in the board
file would also help.
I already found one potential issue in the DAI link configuration. It was configured for the Si47xx being the master
and providing clocks - which it does not. I have changed that and added system clock intialization so that I should
be able to see PCM receive clock with the scope. As soon as the drivers works :)
-- hns
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fm-soc.diff
Type: application/octet-stream
Size: 20356 bytes
Desc: not available
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20130612/87d7591b/attachment-0001.obj>
More information about the Gta04-owner
mailing list