Exemplo n.º 1
0
static int pcm20_getflags(struct pcm20_device *dev, __u32 *flags, __u16 *signal)
{
    /* okay, check for signal, stereo and rds here... */
    int i;
    unsigned char buf;

    if ((i=aci_rw_cmd(ACI_READ_TUNERSTATION, -1, -1))<0)
        return i;
#ifdef DEBUG
    printk("check_sig: 0x%x\n", i);
#endif
    if (i & 0x80) {
        /* no signal from tuner */
        *flags=0;
        *signal=0;
        return 0;
    } else
        *signal=0xffff;

    if ((i=aci_rw_cmd(ACI_READ_TUNERSTEREO, -1, -1))<0)
        return i;
    if (i & 0x40) {
        *flags=0;
    } else {
        /* stereo */
        *flags=VIDEO_TUNER_STEREO_ON;
        /* I can't see stereo, when forced to mono */
        dev->stereo=1;
    }

    if ((i=aci_rds_cmd(RDS_STATUS, &buf, 1))<0)
        return i;
    if (buf & 1)
        /* RDS available */
        *flags|=VIDEO_TUNER_RDS_ON;
    else
        return 0;

    if ((i=aci_rds_cmd(RDS_RXVALUE, &buf, 1))<0)
        return i;
#ifdef DEBUG
    printk("rds-signal: %d\n", buf);
#endif
    if (buf > 15) {
        printk("miropcm20-radio: RX strengths unexpected high...\n");
        buf=15;
    }
    /* refine signal */
    if ((*signal=SCALE(15, 0xffff, buf))==0)
        *signal = 1;

    return 0;
}
Exemplo n.º 2
0
static int pcm20_setfreq(struct pcm20_device *dev, unsigned long freq)
{
	unsigned char freql;
	unsigned char freqh;

	dev->freq=freq;

	freq /= 160;
	if (!(aci_version==0x07 || aci_version>=0xb0))
		freq /= 10;  /* I don't know exactly which version
			      * needs this hack */
	freql = freq & 0xff;
	freqh = freq >> 8;

	aci_rds_cmd(RDS_RESET, NULL, 0);
	pcm20_stereo(dev, 1);

	return aci_rw_cmd(ACI_WRITE_TUNE, freql, freqh);
}