Commit f3d6f633 authored by Steven Toth's avatar Steven Toth Committed by Mauro Carvalho Chehab

V4L/DVB (12347): cx25840: Bugfix for no DVB-T on the Hauppauge HVR-1700

After the i2c subdev changes the ordering of initialization changed,
causing a total loss of previous GPIO settings and a loss of DTV.
The generic firmware loading routine has now changed to preserve
GPIO values if the device is cx23885 based (safety) and I've
moved the GPIO configuration from probe() into the cx23885 init
func which is a little clearer and fixes the bug.
Tested-by: default avatarSohail Syyed <linuxtv@hubstar.net>
Reviewed-by: default avatarMichael Krufky <mkrufky@kernellabs.com>
Signed-off-by: default avatarSteven Toth <stoth@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 73c6f462
...@@ -321,6 +321,15 @@ static void cx23885_initialize(struct i2c_client *client) ...@@ -321,6 +321,15 @@ static void cx23885_initialize(struct i2c_client *client)
/* Select AFE clock pad output source */ /* Select AFE clock pad output source */
cx25840_write(client, 0x144, 0x05); cx25840_write(client, 0x144, 0x05);
/* Drive GPIO2 direction and values for HVR1700
* where an onboard mux selects the output of demodulator
* vs the 417. Failure to set this results in no DTV.
* It's safe to set this across all Hauppauge boards
* currently, regardless of the board type.
*/
cx25840_write(client, 0x160, 0x1d);
cx25840_write(client, 0x164, 0x00);
/* Do the firmware load in a work handler to prevent. /* Do the firmware load in a work handler to prevent.
Otherwise the kernel is blocked waiting for the Otherwise the kernel is blocked waiting for the
bit-banging i2c interface to finish uploading the bit-banging i2c interface to finish uploading the
...@@ -1578,12 +1587,6 @@ static int cx25840_probe(struct i2c_client *client, ...@@ -1578,12 +1587,6 @@ static int cx25840_probe(struct i2c_client *client,
state->id = id; state->id = id;
state->rev = device_id; state->rev = device_id;
if (state->is_cx23885) {
/* Drive GPIO2 direction and values */
cx25840_write(client, 0x160, 0x1d);
cx25840_write(client, 0x164, 0x00);
}
return 0; return 0;
} }
......
...@@ -98,9 +98,14 @@ int cx25840_loadfw(struct i2c_client *client) ...@@ -98,9 +98,14 @@ int cx25840_loadfw(struct i2c_client *client)
const u8 *ptr; const u8 *ptr;
int size, retval; int size, retval;
int MAX_BUF_SIZE = FWSEND; int MAX_BUF_SIZE = FWSEND;
u32 gpio_oe = 0, gpio_da = 0;
if (state->is_cx23885) if (state->is_cx23885) {
firmware = FWFILE_CX23885; firmware = FWFILE_CX23885;
/* Preserve the GPIO OE and output bits */
gpio_oe = cx25840_read(client, 0x160);
gpio_da = cx25840_read(client, 0x164);
}
else if (state->is_cx231xx) else if (state->is_cx231xx)
firmware = FWFILE_CX231XX; firmware = FWFILE_CX231XX;
...@@ -142,5 +147,11 @@ int cx25840_loadfw(struct i2c_client *client) ...@@ -142,5 +147,11 @@ int cx25840_loadfw(struct i2c_client *client)
size = fw->size; size = fw->size;
release_firmware(fw); release_firmware(fw);
if (state->is_cx23885) {
/* Restore GPIO configuration after f/w load */
cx25840_write(client, 0x160, gpio_oe);
cx25840_write(client, 0x164, gpio_da);
}
return check_fw_load(client, size); return check_fw_load(client, size);
} }
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