Skip to content

Commit

Permalink
V4L/DVB (8474): pvrusb2: Enable IR chip on HVR-1900 class devices
Browse files Browse the repository at this point in the history
The Zilog IR chip on HVR-1900 devices is held in reset when the device
initializes.  We have to bring this chip out of reset before LIRC has
any chance of operating the chip.  So do it.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
  • Loading branch information
Mike Isely authored and Mauro Carvalho Chehab committed Jul 26, 2008
1 parent 7e99430 commit 31335b1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 11 deletions.
5 changes: 4 additions & 1 deletion drivers/media/video/pvrusb2/pvrusb2-devattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ static const struct pvr2_device_desc pvr2_device_24xxx = {
.flag_has_cx25840 = !0,
.flag_has_wm8775 = !0,
.flag_has_hauppauge_rom = !0,
.flag_has_hauppauge_custom_ir = !0,
.flag_has_analogtuner = !0,
.flag_has_fmradio = !0,
.flag_has_composite = !0,
.flag_has_svideo = !0,
.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
.ir_scheme = PVR2_IR_SCHEME_24XXX,
};


Expand Down Expand Up @@ -344,6 +344,7 @@ static const struct pvr2_device_desc pvr2_device_73xxx = {
.signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
.ir_scheme = PVR2_IR_SCHEME_ZILOG,
#ifdef CONFIG_VIDEO_PVRUSB2_DVB
.dvb_props = &pvr2_73xxx_dvb_props,
#endif
Expand Down Expand Up @@ -453,6 +454,7 @@ static const struct pvr2_device_desc pvr2_device_750xx = {
.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
.default_std_mask = V4L2_STD_NTSC_M,
.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
.ir_scheme = PVR2_IR_SCHEME_ZILOG,
#ifdef CONFIG_VIDEO_PVRUSB2_DVB
.dvb_props = &pvr2_750xx_dvb_props,
#endif
Expand All @@ -474,6 +476,7 @@ static const struct pvr2_device_desc pvr2_device_751xx = {
.digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
.default_std_mask = V4L2_STD_NTSC_M,
.led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
.ir_scheme = PVR2_IR_SCHEME_ZILOG,
#ifdef CONFIG_VIDEO_PVRUSB2_DVB
.dvb_props = &pvr2_751xx_dvb_props,
#endif
Expand Down
26 changes: 17 additions & 9 deletions drivers/media/video/pvrusb2/pvrusb2-devattr.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ struct pvr2_string_table {
#define PVR2_LED_SCHEME_NONE 0
#define PVR2_LED_SCHEME_HAUPPAUGE 1

#define PVR2_IR_SCHEME_NONE 0
#define PVR2_IR_SCHEME_24XXX 1
#define PVR2_IR_SCHEME_ZILOG 2

/* This describes a particular hardware type (except for the USB device ID
which must live in a separate structure due to environmental
constraints). See the top of pvrusb2-hdw.c for where this is
Expand Down Expand Up @@ -126,15 +130,19 @@ struct pvr2_device_desc {
ensure that it is found. */
unsigned int flag_has_wm8775:1;

/* Device has IR hardware that can be faked into looking like a
normal Hauppauge i2c IR receiver. This is currently very
specific to the 24xxx device, where Hauppauge had replaced their
'standard' I2C IR receiver with a bunch of FPGA logic controlled
directly via the FX2. Turning this on tells the pvrusb2 driver
to virtualize the presence of the non-existant IR receiver chip and
implement the virtual receiver in terms of appropriate FX2
commands. */
unsigned int flag_has_hauppauge_custom_ir:1;
/* Indicate any specialized IR scheme that might need to be
supported by this driver. If not set, then it is assumed that
IR can work without help from the driver (which is frequently
the case). This is otherwise set to one of
PVR2_IR_SCHEME_xxxx. For "xxxx", the value "24XXX" indicates a
Hauppauge 24xxx class device which has an FPGA-hosted IR
receiver that can only be reached via FX2 command codes. In
that case the pvrusb2 driver will emulate the behavior of the
older 29xxx device's IR receiver (a "virtual" I2C chip) in terms
of those command codes. For the value "ZILOG", we're dealing
with an IR chip that must be taken out of reset via another FX2
command code (which is the case for HVR-1950 devices). */
unsigned int ir_scheme:2;

/* These bits define which kinds of sources the device can handle.
Note: Digital tuner presence is inferred by the
Expand Down
2 changes: 2 additions & 0 deletions drivers/media/video/pvrusb2/pvrusb2-fx2-cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#define FX2CMD_MEM_WRITE_DWORD 0x01u
#define FX2CMD_MEM_READ_DWORD 0x02u

#define FX2CMD_HCW_ZILOG_RESET 0x10u /* 1=reset 0=release */

#define FX2CMD_MEM_READ_64BYTES 0x28u

#define FX2CMD_REG_WRITE 0x04u
Expand Down
9 changes: 9 additions & 0 deletions drivers/media/video/pvrusb2/pvrusb2-hdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ struct pvr2_fx2cmd_descdef {
static const struct pvr2_fx2cmd_descdef pvr2_fx2cmd_desc[] = {
{FX2CMD_MEM_WRITE_DWORD, "write encoder dword"},
{FX2CMD_MEM_READ_DWORD, "read encoder dword"},
{FX2CMD_HCW_ZILOG_RESET, "zilog IR reset control"},
{FX2CMD_MEM_READ_64BYTES, "read encoder 64bytes"},
{FX2CMD_REG_WRITE, "write encoder register"},
{FX2CMD_REG_READ, "read encoder register"},
Expand Down Expand Up @@ -1711,6 +1712,14 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
if (!pvr2_hdw_dev_ok(hdw)) return;
}

/* Take the IR chip out of reset, if appropriate */
if (hdw->hdw_desc->ir_scheme == PVR2_IR_SCHEME_ZILOG) {
pvr2_issue_simple_cmd(hdw,
FX2CMD_HCW_ZILOG_RESET |
(1 << 8) |
((0) << 16));
}

// This step MUST happen after the earlier powerup step.
pvr2_i2c_core_init(hdw);
if (!pvr2_hdw_dev_ok(hdw)) return;
Expand Down
4 changes: 3 additions & 1 deletion drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,9 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw)
printk(KERN_INFO "%s: IR disabled\n",hdw->name);
hdw->i2c_func[0x18] = i2c_black_hole;
} else if (ir_mode[hdw->unit_number] == 1) {
if (hdw->hdw_desc->flag_has_hauppauge_custom_ir) {
if (hdw->hdw_desc->ir_scheme == PVR2_IR_SCHEME_24XXX) {
/* This comment is present PURELY to get
checkpatch.pl to STFU. Lovely, eh? */
hdw->i2c_func[0x18] = i2c_24xxx_ir;
}
}
Expand Down

0 comments on commit 31335b1

Please sign in to comment.