diff options
author | Mike Isely <isely@pobox.com> | 2006-02-22 23:38:12 -0600 |
---|---|---|
committer | Mike Isely <isely@pobox.com> | 2006-02-22 23:38:12 -0600 |
commit | f48560d691ad084882dcee76c279efaef43a445c (patch) | |
tree | 9e710a9e2840cdfaded87375f56ef5c7de49a4fc /v4l_experimental/pvrusb2 | |
parent | b14f71c46ef88934d27e315739528fb38dfaf238 (diff) | |
download | mediapointer-dvb-s2-f48560d691ad084882dcee76c279efaef43a445c.tar.gz mediapointer-dvb-s2-f48560d691ad084882dcee76c279efaef43a445c.tar.bz2 |
Implement pvrusb2 driver function to discover eeprom address
From: Mike Isely <isely@pobox.com>
The FX2 firmware in the PVR USB2 device can report the I2C address of
the resident eeprom device. Implement code to retrieve this information.
Signed-off-by: Mike Isely <isely@pobox.com>
Diffstat (limited to 'v4l_experimental/pvrusb2')
-rw-r--r-- | v4l_experimental/pvrusb2/pvrusb2-hdw-internal.h | 3 | ||||
-rw-r--r-- | v4l_experimental/pvrusb2/pvrusb2-hdw.c | 27 | ||||
-rw-r--r-- | v4l_experimental/pvrusb2/pvrusb2-hdw.h | 3 |
3 files changed, 32 insertions, 1 deletions
diff --git a/v4l_experimental/pvrusb2/pvrusb2-hdw-internal.h b/v4l_experimental/pvrusb2/pvrusb2-hdw-internal.h index 786cc9832..9543414e5 100644 --- a/v4l_experimental/pvrusb2/pvrusb2-hdw-internal.h +++ b/v4l_experimental/pvrusb2/pvrusb2-hdw-internal.h @@ -188,6 +188,9 @@ struct pvr2_hdw { be no v4l junk here). Probably a better way to do this. */ int v4l_minor_number; + /* Location of eeprom or a negative number if none */ + int eeprom_addr; + enum pvr2_config config; /* Information about what audio signal we're hearing */ diff --git a/v4l_experimental/pvrusb2/pvrusb2-hdw.c b/v4l_experimental/pvrusb2/pvrusb2-hdw.c index 48e9ada28..940f105c2 100644 --- a/v4l_experimental/pvrusb2/pvrusb2-hdw.c +++ b/v4l_experimental/pvrusb2/pvrusb2-hdw.c @@ -954,6 +954,7 @@ static unsigned int get_default_error_tolerance(struct pvr2_hdw *hdw) static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) { + int ret; unsigned int idx; if (hdw->usb_intf->cur_altsetting->desc.bNumEndpoints == 0) { if (pvr2_upload_firmware1(hdw) != 0) { @@ -987,8 +988,16 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) pvr2_reset_ctl_endpoints(hdw); if (!pvr2_hdw_dev_ok(hdw)) return; - pvr2_eeprom_analyze(hdw); + ret = pvr2_hdw_get_eeprom_addr(hdw); if (!pvr2_hdw_dev_ok(hdw)) return; + if (ret < 0) { + pvr2_trace(PVR2_TRACE_ERROR_LEGS, + "Unable to determine location of eeprom, skipping"); + } else { + hdw->eeprom_addr = ret; + pvr2_eeprom_analyze(hdw); + if (!pvr2_hdw_dev_ok(hdw)) return; + } if (!get_default_tuner_type(hdw)) { pvr2_trace(PVR2_TRACE_INIT, @@ -1115,6 +1124,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf) pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_create: hdw=%p",hdw); if (!hdw) goto fail; memset(hdw,0,sizeof(*hdw)); + hdw->eeprom_addr = -1; hdw->unit_number = -1; hdw->v4l_minor_number = -1; hdw->ctl_write_buffer = kmalloc(PVR2_CTL_BUFFSIZE,GFP_KERNEL); @@ -2327,6 +2337,21 @@ int pvr2_hdw_gpio_chg_out(struct pvr2_hdw *hdw,u32 msk,u32 val) } +int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw) +{ + int result; + LOCK_TAKE(hdw->ctl_lock); do { + hdw->cmd_buffer[0] = 0xeb; + result = pvr2_send_request(hdw, + hdw->cmd_buffer,1, + hdw->cmd_buffer,1); + if (result < 0) break; + result = hdw->cmd_buffer[0]; + } while(0); LOCK_GIVE(hdw->ctl_lock); + return result; +} + + /* Stuff for Emacs to see, in order to encourage consistent editing style: *** Local Variables: *** diff --git a/v4l_experimental/pvrusb2/pvrusb2-hdw.h b/v4l_experimental/pvrusb2/pvrusb2-hdw.h index 8d5f5620e..9683d8d7c 100644 --- a/v4l_experimental/pvrusb2/pvrusb2-hdw.h +++ b/v4l_experimental/pvrusb2/pvrusb2-hdw.h @@ -353,6 +353,9 @@ int pvr2_hdw_cmd_soft_reset(struct pvr2_hdw *); /* Stop / start video stream transport */ int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl); +/* Find I2C address of eeprom */ +int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *); + /* Direct manipulation of GPIO bits */ int pvr2_hdw_gpio_get_dir(struct pvr2_hdw *hdw,u32 *); int pvr2_hdw_gpio_get_out(struct pvr2_hdw *hdw,u32 *); |