提交 9dcbf35a 编写于 作者: H Hans Verkuil 提交者: Mauro Carvalho Chehab

V4L/DVB (7887): cx18: fix Compro H900 analog support.

Tuner, S-Video and Composite are all working for the Compro H900.
Signed-off-by: NHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: NMauro Carvalho Chehab <mchehab@infradead.org>
上级 6db6ae21
...@@ -135,14 +135,15 @@ static const struct cx18_card_pci_info cx18_pci_h900[] = { ...@@ -135,14 +135,15 @@ static const struct cx18_card_pci_info cx18_pci_h900[] = {
static const struct cx18_card cx18_card_h900 = { static const struct cx18_card cx18_card_h900 = {
.type = CX18_CARD_COMPRO_H900, .type = CX18_CARD_COMPRO_H900,
.name = "Compro VideoMate H900", .name = "Compro VideoMate H900",
.comment = "Not yet supported!\n", .comment = "DVB & VBI are not yet supported\n",
.v4l2_capabilities = 0, .v4l2_capabilities = CX18_CAP_ENCODER,
.hw_audio_ctrl = CX18_HW_CX23418, .hw_audio_ctrl = CX18_HW_CX23418,
.hw_all = CX18_HW_TUNER, .hw_all = CX18_HW_TUNER,
.video_inputs = { .video_inputs = {
{ CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE7 }, { CX18_CARD_INPUT_VID_TUNER, 0, CX23418_COMPOSITE2 },
{ CX18_CARD_INPUT_SVIDEO1, 1, CX23418_SVIDEO1 }, { CX18_CARD_INPUT_SVIDEO1, 1,
{ CX18_CARD_INPUT_COMPOSITE1, 1, CX23418_COMPOSITE3 }, CX23418_SVIDEO_LUMA3 | CX23418_SVIDEO_CHROMA4 },
{ CX18_CARD_INPUT_COMPOSITE1, 1, CX23418_COMPOSITE1 },
}, },
.audio_inputs = { .audio_inputs = {
{ CX18_CARD_INPUT_AUD_TUNER, { CX18_CARD_INPUT_AUD_TUNER,
...@@ -164,6 +165,7 @@ static const struct cx18_card cx18_card_h900 = { ...@@ -164,6 +165,7 @@ static const struct cx18_card cx18_card_h900 = {
.tune_lane = 0, .tune_lane = 0,
.initial_emrs = 0, .initial_emrs = 0,
}, },
.xceive_pin = 15,
.pci_list = cx18_pci_h900, .pci_list = cx18_pci_h900,
.i2c = &cx18_i2c_std, .i2c = &cx18_i2c_std,
}; };
......
...@@ -114,8 +114,8 @@ struct cx18_card_pci_info { ...@@ -114,8 +114,8 @@ struct cx18_card_pci_info {
/* The mask is the set of bits used by the operation */ /* The mask is the set of bits used by the operation */
struct cx18_gpio_init { /* set initial GPIO DIR and OUT values */ struct cx18_gpio_init { /* set initial GPIO DIR and OUT values */
u16 direction; /* DIR setting. Leave to 0 if no init is needed */ u32 direction; /* DIR setting. Leave to 0 if no init is needed */
u16 initial_value; u32 initial_value;
}; };
struct cx18_card_tuner { struct cx18_card_tuner {
...@@ -153,6 +153,7 @@ struct cx18_card { ...@@ -153,6 +153,7 @@ struct cx18_card {
struct cx18_card_audio_input radio_input; struct cx18_card_audio_input radio_input;
/* GPIO card-specific settings */ /* GPIO card-specific settings */
u8 xceive_pin; /* XCeive tuner GPIO reset pin */
struct cx18_gpio_init gpio_init; struct cx18_gpio_init gpio_init;
struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS]; struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS];
......
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
#define CX18_REG_GPIO_OUT2 0xc78104 #define CX18_REG_GPIO_OUT2 0xc78104
#define CX18_REG_GPIO_DIR2 0xc7810c #define CX18_REG_GPIO_DIR2 0xc7810c
static u32 gpio_dir;
static u32 gpio_val;
/* /*
* HVR-1600 GPIO pins, courtesy of Hauppauge: * HVR-1600 GPIO pins, courtesy of Hauppauge:
* *
...@@ -44,31 +47,53 @@ ...@@ -44,31 +47,53 @@
* gpio13: cs5345 reset pin * gpio13: cs5345 reset pin
*/ */
static void gpio_write(struct cx18 *cx)
{
write_reg((gpio_dir & 0xffff) << 16, CX18_REG_GPIO_DIR1);
write_reg(((gpio_dir & 0xffff) << 16) | (gpio_val & 0xffff),
CX18_REG_GPIO_OUT1);
write_reg(gpio_dir & 0xffff0000, CX18_REG_GPIO_DIR2);
write_reg((gpio_dir & 0xffff0000) | ((gpio_val & 0xffff0000) >> 16),
CX18_REG_GPIO_OUT2);
}
void cx18_gpio_init(struct cx18 *cx) void cx18_gpio_init(struct cx18 *cx)
{ {
if (cx->card->gpio_init.direction == 0) gpio_dir = cx->card->gpio_init.direction;
gpio_val = cx->card->gpio_init.initial_value;
if (gpio_dir == 0)
return; return;
CX18_DEBUG_INFO("GPIO initial dir: %08x out: %08x\n", gpio_dir |= 1 << cx->card->xceive_pin;
read_reg(CX18_REG_GPIO_DIR1), read_reg(CX18_REG_GPIO_OUT1)); gpio_val |= 1 << cx->card->xceive_pin;
/* init output data then direction */ CX18_DEBUG_INFO("GPIO initial dir: %08x/%08x out: %08x/%08x\n",
write_reg(cx->card->gpio_init.direction << 16, CX18_REG_GPIO_DIR1); read_reg(CX18_REG_GPIO_DIR1), read_reg(CX18_REG_GPIO_DIR2),
write_reg(0, CX18_REG_GPIO_DIR2); read_reg(CX18_REG_GPIO_OUT1), read_reg(CX18_REG_GPIO_OUT2));
write_reg((cx->card->gpio_init.direction << 16) |
cx->card->gpio_init.initial_value, CX18_REG_GPIO_OUT1); gpio_write(cx);
write_reg(0, CX18_REG_GPIO_OUT2);
} }
/* Xceive tuner reset function */ /* Xceive tuner reset function */
int cx18_reset_tuner_gpio(void *dev, int cmd, int value) int cx18_reset_tuner_gpio(void *dev, int cmd, int value)
{ {
struct i2c_algo_bit_data *algo = dev; struct i2c_algo_bit_data *algo = dev;
struct cx18 *cx = algo->data; struct cx18_i2c_algo_callback_data *cb_data = algo->data;
/* int curdir, curout;*/ struct cx18 *cx = cb_data->cx;
if (cmd != XC2028_TUNER_RESET) if (cmd != XC2028_TUNER_RESET)
return 0; return 0;
CX18_DEBUG_INFO("Resetting tuner\n"); CX18_DEBUG_INFO("Resetting tuner\n");
gpio_dir |= 1 << cx->card->xceive_pin;
gpio_val &= ~(1 << cx->card->xceive_pin);
gpio_write(cx);
schedule_timeout_interruptible(msecs_to_jiffies(1));
gpio_val |= 1 << cx->card->xceive_pin;
gpio_write(cx);
schedule_timeout_interruptible(msecs_to_jiffies(1));
return 0; return 0;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册