int saa7134_tuner_callback(void *ptr, int command, int arg)
{
	u8 sync_control;
	struct saa7134_dev *dev = ptr;

	switch (dev->tuner_type) {
	case TUNER_PHILIPS_TDA8290:
		switch (command) {
		case 0: /* switch LNA gain through GPIO 22*/
			saa7134_set_gpio(dev, 22, arg) ;
			break;
		case 1: /* vsync output at GPIO22. 50 / 60Hz */
			dprintk("setting GPIO22 to vsync %d\n", arg);
			saa_andorb(SAA7134_VIDEO_PORT_CTRL3, 0x80, 0x80);
			saa_andorb(SAA7134_VIDEO_PORT_CTRL6, 0x0f, 0x03);
			if (arg == 1)
				sync_control = 11;
			else
				sync_control = 17;
			saa_writeb(SAA7134_VGATE_START, sync_control);
			saa_writeb(SAA7134_VGATE_STOP, sync_control + 1);
			saa_andorb(SAA7134_MISC_VGATE_MSB, 0x03, 0x00);
			break;
		default:
			return -EINVAL;
		}
		break;
	default:
		return -ENODEV;
	}
	return 0;
}
Esempio n. 2
0
void saa7134_track_gpio(struct saa7134_dev *dev, char *msg)
{
	unsigned long mode,status;

	if (!gpio_tracking)
		return;
	/* rising SAA7134_GPIO_GPRESCAN reads the status */
	saa_andorb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN,0);
	saa_andorb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN,SAA7134_GPIO_GPRESCAN);
	mode   = saa_readl(SAA7134_GPIO_GPMODE0   >> 2) & 0xfffffff;
	status = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & 0xfffffff;
	core_dbg("%s: gpio: mode=0x%07lx in=0x%07lx out=0x%07lx [%s]\n",
	       dev->name, mode, (~mode) & status, mode & status, msg);
}
Esempio n. 3
0
static inline void i2c_set_status(struct saa7134_dev *dev,
				  enum i2c_status status)
{
	d2printk(KERN_DEBUG "%s: i2c stat => %s\n",dev->name,
		 str_i2c_status[status]);
	saa_andorb(SAA7134_I2C_ATTR_STATUS,0x0f,status);
}
Esempio n. 4
0
void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value)
{
	u32 index, bitval;

	index = 1 << bit_no;
	switch (value) {
	case 0: /* static value */
	case 1:
		core_dbg("setting GPIO%d to static %d\n", bit_no, value);
		/* turn sync mode off if necessary */
		if (index & 0x00c00000)
			saa_andorb(SAA7134_VIDEO_PORT_CTRL6, 0x0f, 0x00);
		if (value)
			bitval = index;
		else
			bitval = 0;
		saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, index, index);
		saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, index, bitval);
		break;
	case 3:	/* tristate */
		core_dbg("setting GPIO%d to tristate\n", bit_no);
		saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, index, 0);
		break;
	}
}
Esempio n. 5
0
static inline void i2c_set_attr(struct saa7134_dev *dev, enum i2c_attr attr)
{
	d2printk(KERN_DEBUG "%s: i2c attr => %s\n",dev->name,
		 str_i2c_attr[attr]);
	saa_andorb(SAA7134_I2C_ATTR_STATUS,0xc0,attr << 6);
}
Esempio n. 6
0
static inline void i2c_set_attr(struct saa7134_dev *dev, enum i2c_attr attr)
{
	i2c_dbg(2, "i2c attr => %s\n", str_i2c_attr[attr]);
	saa_andorb(SAA7134_I2C_ATTR_STATUS,0xc0,attr << 6);
}
Esempio n. 7
0
static inline void i2c_set_status(struct saa7134_dev *dev,
				  enum i2c_status status)
{
	i2c_dbg(2, "i2c stat => %s\n", str_i2c_status[status]);
	saa_andorb(SAA7134_I2C_ATTR_STATUS,0x0f,status);
}