#define TUNER_PLL_LOCKED 0x40
#define TUNER_STEREO_MK3 0x04
-#define TUNER_PARAM_ANALOG 0 /* to be removed */
-/* FIXME:
- * Right now, all tuners are using the first tuner_params[] array element
- * for analog mode. In the future, we will be merging similar tuner
- * definitions together, such that each tuner definition will have a
- * tuner_params struct for each available video standard. At that point,
- * TUNER_PARAM_ANALOG will be removed, and the tuner_params[] array
- * element will be chosen based on the video standard in use.
- *
- */
-
/* ---------------------------------------------------------------------- */
static int tuner_getstatus(struct i2c_client *c)
struct tunertype *tun;
u8 buffer[4];
int rc, IFPCoff, i, j;
+ enum param_type desired_type;
tun = &tuners[t->type];
- j = TUNER_PARAM_ANALOG;
/* IFPCoff = Video Intermediate Frequency - Vif:
940 =16*58.75 NTSC/J (Japan)
*/
if (t->std == V4L2_STD_NTSC_M_JP) {
- IFPCoff = 940;
+ IFPCoff = 940;
+ desired_type = TUNER_PARAM_TYPE_NTSC;
} else if ((t->std & V4L2_STD_MN) &&
!(t->std & ~V4L2_STD_MN)) {
- IFPCoff = 732;
+ IFPCoff = 732;
+ desired_type = TUNER_PARAM_TYPE_NTSC;
} else if (t->std == V4L2_STD_SECAM_LC) {
- IFPCoff = 543;
+ IFPCoff = 543;
+ desired_type = TUNER_PARAM_TYPE_SECAM;
} else {
- IFPCoff = 623;
+ IFPCoff = 623;
+ desired_type = TUNER_PARAM_TYPE_PAL;
+ }
+
+ for (j = 0; j < tun->count-1; j++) {
+ if (desired_type != tun->params[j].type)
+ continue;
+ break;
+ }
+ /* use default tuner_params if desired_type not available */
+ if (desired_type != tun->params[j].type) {
+ tuner_dbg("IFPCoff = %d: tuner_params undefined for tuner %d\n",
+ IFPCoff,t->type);
+ j = 0;
}
for (i = 0; i < tun->params[j].count; i++) {
/* i == 0 -> VHF_LO
* i == 1 -> VHF_HI
* i == 2 -> UHF */
- tuner_dbg("tv: range %d\n",i);
+ tuner_dbg("tv: param %d, range %d\n",j,i);
div=freq + IFPCoff + offset;
u8 buffer[4];
u16 div;
int rc, j;
+ enum param_type desired_type = TUNER_PARAM_TYPE_RADIO;
tun = &tuners[t->type];
- j = TUNER_PARAM_ANALOG;
+
+ for (j = 0; j < tun->count-1; j++) {
+ if (desired_type != tun->params[j].type)
+ continue;
+ break;
+ }
+ /* use default tuner_params if desired_type not available */
+ if (desired_type != tun->params[j].type)
+ j = 0;
div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */
buffer[2] = (tun->params[j].ranges[0].config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */
case TUNER_PHILIPS_FMD1216ME_MK3:
buffer[3] = 0x19;
break;
+ case TUNER_TNF_5335MF:
+ buffer[3] = 0x11;
+ break;
case TUNER_PHILIPS_FM1256_IH3:
div = (20 * freq) / 16000 + (int)(33.3 * 20); /* IF 33.3 MHz */
buffer[3] = 0x19;