Commit 4451342d authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB (7927): ivtv: simplify gpio initialization for XCeive tuners.

Separate gpio_init field and xceive_pin and combine the two when
the gpio is initialized. So there is no longer any need to set the
xceive pin in the gpio_init values, simplifying the creation of a
new card definition.
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent d56eebfb
...@@ -923,7 +923,6 @@ static const struct ivtv_card ivtv_card_club3d = { ...@@ -923,7 +923,6 @@ static const struct ivtv_card ivtv_card_club3d = {
{ IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL }, { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL },
}, },
.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 */
.xceive_pin = 12, .xceive_pin = 12,
.tuners = { .tuners = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
...@@ -959,7 +958,7 @@ static const struct ivtv_card ivtv_card_avertv_mce116 = { ...@@ -959,7 +958,7 @@ static const struct ivtv_card ivtv_card_avertv_mce116 = {
{ IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL, 1 }, { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL, 1 },
}, },
/* enable line-in */ /* enable line-in */
.gpio_init = { .direction = 0xe400, .initial_value = 0x4400 }, .gpio_init = { .direction = 0xe000, .initial_value = 0x4000 },
.xceive_pin = 10, .xceive_pin = 10,
.tuners = { .tuners = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
...@@ -1102,7 +1101,7 @@ static const struct ivtv_card ivtv_card_aver_m104 = { ...@@ -1102,7 +1101,7 @@ 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 = 0xe400, .initial_value = 0x4000 }, .gpio_init = { .direction = 0xe000, .initial_value = 0x4000 },
.xceive_pin = 10, .xceive_pin = 10,
.tuners = { .tuners = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
...@@ -1138,7 +1137,6 @@ static const struct ivtv_card ivtv_card_buffalo = { ...@@ -1138,7 +1137,6 @@ static const struct ivtv_card ivtv_card_buffalo = {
{ IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5 }, { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5 },
{ IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL }, { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL },
}, },
.gpio_init = { .direction = 0x1000, .initial_value = 0x1000 },
.xceive_pin = 12, .xceive_pin = 12,
.tuners = { .tuners = {
{ .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
......
...@@ -146,15 +146,20 @@ int ivtv_reset_tuner_gpio(void *dev, int cmd, int value) ...@@ -146,15 +146,20 @@ int ivtv_reset_tuner_gpio(void *dev, int cmd, int value)
void ivtv_gpio_init(struct ivtv *itv) void ivtv_gpio_init(struct ivtv *itv)
{ {
if (itv->card->gpio_init.direction == 0) u16 pin = 0;
if (itv->card->xceive_pin)
pin = 1 << itv->card->xceive_pin;
if ((itv->card->gpio_init.direction | pin) == 0)
return; return;
IVTV_DEBUG_INFO("GPIO initial dir: %08x out: %08x\n", IVTV_DEBUG_INFO("GPIO initial dir: %08x out: %08x\n",
read_reg(IVTV_REG_GPIO_DIR), read_reg(IVTV_REG_GPIO_OUT)); read_reg(IVTV_REG_GPIO_DIR), read_reg(IVTV_REG_GPIO_OUT));
/* init output data then direction */ /* init output data then direction */
write_reg(itv->card->gpio_init.initial_value, IVTV_REG_GPIO_OUT); write_reg(itv->card->gpio_init.initial_value | pin, IVTV_REG_GPIO_OUT);
write_reg(itv->card->gpio_init.direction, IVTV_REG_GPIO_DIR); write_reg(itv->card->gpio_init.direction | pin, IVTV_REG_GPIO_DIR);
} }
static struct v4l2_queryctrl gpio_ctrl_mute = { static struct v4l2_queryctrl gpio_ctrl_mute = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment