A long time ago I developed some code to open the radio using the original 2.4 kernel on an e680i, I did a fast read of your code and saw that you are not activating the mixer output path, so, even if the your code were working, it would not produce any sound output. All radio control, with exception of mixer control, is made via read/write to /dev/fmradio.

You can get my code at http://www.inf.ufsc.br/~alebm/ezx/radio.cpp , I did it before getting the chip datasheet, but most calls are correct, also, the code is a mess as it was done for test purposes only hehehe.
Hope the code will be useful to you.

Alessandro

On Fri, 27 Nov 2009, Ben Kibbey wrote:

hello,

I'm not sure if this is the right place to ask since I'm still using the
EZX 2.4 kernel and not OpenEZX (yet). Anyway I'm trying to get
/dev/fmradio to work by using ioctl()'s on the device. After opening
/dev/fmradio I send the following ioctls (autodetection code borrowed
from tea5767.c):

       unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
       int rc;

       if ((rc = read(dev, buffer, 7))< 5) {
               tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc);
               return -1;
       }

       if (TEA5767_READY_FLAG_MASK & buffer[0])
               printk(PREFIX "Ready Flag ON\n");
       else
               printk(PREFIX "Ready Flag OFF\n");

The ready flag is OFF here.

       /* If all bytes are the same then it's a TV tuner and not a tea5767 */
       if (buffer[0] == buffer[1] && buffer[0] == buffer[2] &&
           buffer[0] == buffer[3] && buffer[0] == buffer[4]) {
               tuner_warn("All bytes are equal. It is not a TEA5767\n");
               return -1;
       }

       /*  Status bytes:
        *  Byte 4: bit 3:1 : CI (Chip Identification) == 0
        *          bit 0   : internally set to 0
        *  Byte 5: bit 7:0 : == 0
        */
       if (((buffer[3] & 0x0f) != 0x00) || (buffer[4] != 0x00)) {
            fprintf(stderr, "ACK: 0x%2x\n", buffer[3]&0x0f);
               tuner_warn("Chip ID is not zero. It is not a TEA5767\n");
               return -1;
       }

       /* It seems that tea5767 returns 0xff after the 5th byte */
       if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) { //FIXME

Fails here since buffer[6] != 0xff. The others are fine.

Is this how access to the fmradio is supposed to be done, via ioctls? Or
maybe I'm supposed to access the I2C bus directly (after opening and
closing the device, I get this printk(): adapter PXA-I2C-Adapter)? Maybe
EZX is keeping the fmradio in a bad state (ready flag)?

I'm new to kernel land and would appreciate any help or maybe sources of
information that someone could lead me to.

Thanks,

--
Ben Kibbey (bjk) @ FreeNode/OFTC


  • /dev/fmradio Ben Kibbey
    • Re: /dev/fmradio Alessandro Barreiros Maurici

Reply via email to