Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 136531da authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (7763): ivtv: add tuner support for the AverMedia M116

parent a0bdd273
Loading
Loading
Loading
Loading
+14 −6
Original line number Original line Diff line number Diff line
@@ -924,6 +924,7 @@ static const struct ivtv_card ivtv_card_club3d = {
	},
	},
	.radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5 },
	.radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5 },
	.gpio_init = { .direction = 0x1000, .initial_value = 0x1000 }, /* tuner reset */
	.gpio_init = { .direction = 0x1000, .initial_value = 0x1000 }, /* tuner reset */
	.xceive_pin = 12,
	.tuners = {
	.tuners = {
		{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
		{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
	},
	},
@@ -943,20 +944,26 @@ static const struct ivtv_card_pci_info ivtv_pci_avertv_mce116[] = {
static const struct ivtv_card ivtv_card_avertv_mce116 = {
static const struct ivtv_card ivtv_card_avertv_mce116 = {
	.type = IVTV_CARD_AVERTV_MCE116,
	.type = IVTV_CARD_AVERTV_MCE116,
	.name = "AVerTV MCE 116 Plus",
	.name = "AVerTV MCE 116 Plus",
	.comment = "only Composite and S-Video inputs are supported, not the tuner\n",
	.v4l2_capabilities = IVTV_CAP_ENCODER,
	.v4l2_capabilities = IVTV_CAP_ENCODER,
	.hw_video = IVTV_HW_CX25840,
	.hw_video = IVTV_HW_CX25840,
	.hw_audio = IVTV_HW_CX25840,
	.hw_audio = IVTV_HW_CX25840,
	.hw_audio_ctrl = IVTV_HW_CX25840,
	.hw_audio_ctrl = IVTV_HW_CX25840,
	.hw_all = IVTV_HW_CX25840 | IVTV_HW_WM8739,
	.hw_all = IVTV_HW_CX25840 | IVTV_HW_TUNER | IVTV_HW_WM8739,
	.video_inputs = {
	.video_inputs = {
		{ IVTV_CARD_INPUT_SVIDEO1,    0, CX25840_SVIDEO3    },
		{ IVTV_CARD_INPUT_VID_TUNER,  0, CX25840_COMPOSITE2 },
		{ IVTV_CARD_INPUT_COMPOSITE1, 0, CX25840_COMPOSITE1 },
		{ IVTV_CARD_INPUT_SVIDEO1,    1, CX25840_SVIDEO3    },
		{ IVTV_CARD_INPUT_COMPOSITE1, 1, CX25840_COMPOSITE1 },
	},
	},
	.audio_inputs = {
	.audio_inputs = {
		{ IVTV_CARD_INPUT_AUD_TUNER,  CX25840_AUDIO5       },
		{ IVTV_CARD_INPUT_LINE_IN1,   CX25840_AUDIO_SERIAL, 1 },
		{ IVTV_CARD_INPUT_LINE_IN1,   CX25840_AUDIO_SERIAL, 1 },
	},
	},
	.gpio_init = { .direction = 0xe000, .initial_value = 0x4000 }, /* enable line-in */
	/* enable line-in */
	.gpio_init = { .direction = 0xe400, .initial_value = 0x4400 },
	.xceive_pin = 10,
	.tuners = {
		{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
	},
	.pci_list = ivtv_pci_avertv_mce116,
	.pci_list = ivtv_pci_avertv_mce116,
	.i2c = &ivtv_i2c_std,
	.i2c = &ivtv_i2c_std,
};
};
@@ -1095,7 +1102,8 @@ static const struct ivtv_card ivtv_card_aver_m104 = {
	},
	},
	.radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO_SERIAL, 2 },
	.radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO_SERIAL, 2 },
	/* enable line-in + reset tuner */
	/* enable line-in + reset tuner */
	.gpio_init = { .direction = 0xf000, .initial_value = 0x5000 },
	.gpio_init = { .direction = 0xe400, .initial_value = 0x4000 },
	.xceive_pin = 10,
	.tuners = {
	.tuners = {
		{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
		{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
	},
	},
+1 −0
Original line number Original line Diff line number Diff line
@@ -258,6 +258,7 @@ struct ivtv_card {
	int nof_outputs;
	int nof_outputs;
	const struct ivtv_card_output *video_outputs;
	const struct ivtv_card_output *video_outputs;
	u8 gr_config; 		/* config byte for the ghost reduction device */
	u8 gr_config; 		/* config byte for the ghost reduction device */
	u8 xceive_pin; 		/* XCeive tuner GPIO reset pin */


	/* GPIO card-specific settings */
	/* GPIO card-specific settings */
	struct ivtv_gpio_init 		gpio_init;
	struct ivtv_gpio_init 		gpio_init;
+3 −6
Original line number Original line Diff line number Diff line
@@ -128,20 +128,17 @@ int ivtv_reset_tuner_gpio(void *dev, int cmd, int value)
{
{
	struct i2c_algo_bit_data *algo = dev;
	struct i2c_algo_bit_data *algo = dev;
	struct ivtv *itv = algo->data;
	struct ivtv *itv = algo->data;
	int curdir, curout;
	u32 curout;


	if (cmd != XC2028_TUNER_RESET)
	if (cmd != XC2028_TUNER_RESET)
		return 0;
		return 0;
	IVTV_DEBUG_INFO("Resetting tuner\n");
	IVTV_DEBUG_INFO("Resetting tuner\n");
	curout = read_reg(IVTV_REG_GPIO_OUT);
	curout = read_reg(IVTV_REG_GPIO_OUT);
	curdir = read_reg(IVTV_REG_GPIO_DIR);
	curout &= ~(1 << itv->card->xceive_pin);
	curdir |= (1 << 12);  /* GPIO bit 12 */

	curout &= ~(1 << 12);
	write_reg(curout, IVTV_REG_GPIO_OUT);
	write_reg(curout, IVTV_REG_GPIO_OUT);
	schedule_timeout_interruptible(msecs_to_jiffies(1));
	schedule_timeout_interruptible(msecs_to_jiffies(1));


	curout |= (1 << 12);
	curout |= 1 << itv->card->xceive_pin;
	write_reg(curout, IVTV_REG_GPIO_OUT);
	write_reg(curout, IVTV_REG_GPIO_OUT);
	schedule_timeout_interruptible(msecs_to_jiffies(1));
	schedule_timeout_interruptible(msecs_to_jiffies(1));
	return 0;
	return 0;