V4L/DVB (7625): au0828: Cleanup
Signed-off-by: Steven Toth <stoth@hauppauge.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
parent
9c26de555d
commit
bc3c613cef
|
@ -22,12 +22,6 @@
|
||||||
#include "au0828.h"
|
#include "au0828.h"
|
||||||
#include "au0828-cards.h"
|
#include "au0828-cards.h"
|
||||||
|
|
||||||
#define _dbg(level, fmt, arg...)\
|
|
||||||
do {\
|
|
||||||
if (debug >= level) \
|
|
||||||
printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
struct au0828_board au0828_boards[] = {
|
struct au0828_board au0828_boards[] = {
|
||||||
[AU0828_BOARD_UNKNOWN] = {
|
[AU0828_BOARD_UNKNOWN] = {
|
||||||
.name = "Unknown board",
|
.name = "Unknown board",
|
||||||
|
@ -51,6 +45,8 @@ int au0828_tuner_callback(void *priv, int command, int arg)
|
||||||
{
|
{
|
||||||
struct au0828_dev *dev = priv;
|
struct au0828_dev *dev = priv;
|
||||||
|
|
||||||
|
dprintk(1, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
switch(dev->board) {
|
switch(dev->board) {
|
||||||
case AU0828_BOARD_HAUPPAUGE_HVR850:
|
case AU0828_BOARD_HAUPPAUGE_HVR850:
|
||||||
case AU0828_BOARD_HAUPPAUGE_HVR950Q:
|
case AU0828_BOARD_HAUPPAUGE_HVR950Q:
|
||||||
|
@ -97,9 +93,10 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data)
|
||||||
|
|
||||||
void au0828_card_setup(struct au0828_dev *dev)
|
void au0828_card_setup(struct au0828_dev *dev)
|
||||||
{
|
{
|
||||||
|
|
||||||
static u8 eeprom[256];
|
static u8 eeprom[256];
|
||||||
|
|
||||||
|
dprintk(1, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
if (dev->i2c_rc == 0) {
|
if (dev->i2c_rc == 0) {
|
||||||
dev->i2c_client.addr = 0xa0 >> 1;
|
dev->i2c_client.addr = 0xa0 >> 1;
|
||||||
tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom));
|
tveeprom_read(&dev->i2c_client, eeprom, sizeof(eeprom));
|
||||||
|
@ -121,6 +118,8 @@ void au0828_card_setup(struct au0828_dev *dev)
|
||||||
*/
|
*/
|
||||||
void au0828_gpio_setup(struct au0828_dev *dev)
|
void au0828_gpio_setup(struct au0828_dev *dev)
|
||||||
{
|
{
|
||||||
|
dprintk(1, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
switch(dev->board) {
|
switch(dev->board) {
|
||||||
case AU0828_BOARD_HAUPPAUGE_HVR850:
|
case AU0828_BOARD_HAUPPAUGE_HVR850:
|
||||||
case AU0828_BOARD_HAUPPAUGE_HVR950Q:
|
case AU0828_BOARD_HAUPPAUGE_HVR950Q:
|
||||||
|
|
|
@ -26,25 +26,23 @@
|
||||||
|
|
||||||
#include "au0828.h"
|
#include "au0828.h"
|
||||||
|
|
||||||
static unsigned int debug;
|
/*
|
||||||
|
* 1 = General debug messages
|
||||||
|
* 2 = USB handling
|
||||||
|
* 4 = I2C related
|
||||||
|
* 8 = Bridge related
|
||||||
|
*/
|
||||||
|
unsigned int debug = 0;
|
||||||
module_param(debug, int, 0644);
|
module_param(debug, int, 0644);
|
||||||
MODULE_PARM_DESC(debug, "enable debug messages");
|
MODULE_PARM_DESC(debug, "enable debug messages");
|
||||||
|
|
||||||
#define _err(fmt, arg...)\
|
unsigned int usb_debug = 0;
|
||||||
do {\
|
module_param(usb_debug, int, 0644);
|
||||||
printk(KERN_ERR DRIVER_NAME "/0: " fmt, ## arg);\
|
MODULE_PARM_DESC(usb_debug, "enable usb debug messages");
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define _info(fmt, arg...)\
|
unsigned int bridge_debug = 0;
|
||||||
do {\
|
module_param(bridge_debug, int, 0644);
|
||||||
printk(KERN_INFO DRIVER_NAME "/0: " fmt, ## arg);\
|
MODULE_PARM_DESC(bridge_debug, "enable bridge debug messages");
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define _dbg(level, fmt, arg...)\
|
|
||||||
do {\
|
|
||||||
if (debug >= level) \
|
|
||||||
printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define _AU0828_BULKPIPE 0x03
|
#define _AU0828_BULKPIPE 0x03
|
||||||
#define _BULKPIPESIZE 0xffff
|
#define _BULKPIPESIZE 0xffff
|
||||||
|
@ -61,13 +59,13 @@ static int recv_control_msg(struct au0828_dev *dev, u16 request, u32 value,
|
||||||
u32 au0828_readreg(struct au0828_dev *dev, u16 reg)
|
u32 au0828_readreg(struct au0828_dev *dev, u16 reg)
|
||||||
{
|
{
|
||||||
recv_control_msg(dev, CMD_REQUEST_IN, 0, reg, dev->ctrlmsg, 1);
|
recv_control_msg(dev, CMD_REQUEST_IN, 0, reg, dev->ctrlmsg, 1);
|
||||||
_dbg(3,"%s(0x%x) = 0x%x\n", __FUNCTION__, reg, dev->ctrlmsg[0]);
|
dprintk(8, "%s(0x%x) = 0x%x\n", __FUNCTION__, reg, dev->ctrlmsg[0]);
|
||||||
return dev->ctrlmsg[0];
|
return dev->ctrlmsg[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 au0828_writereg(struct au0828_dev *dev, u16 reg, u32 val)
|
u32 au0828_writereg(struct au0828_dev *dev, u16 reg, u32 val)
|
||||||
{
|
{
|
||||||
_dbg(3,"%s(0x%x, 0x%x)\n", __FUNCTION__, reg, val);
|
dprintk(8, "%s(0x%x, 0x%x)\n", __FUNCTION__, reg, val);
|
||||||
return send_control_msg(dev, CMD_REQUEST_OUT, val, reg, dev->ctrlmsg, 0);
|
return send_control_msg(dev, CMD_REQUEST_OUT, val, reg, dev->ctrlmsg, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +74,7 @@ static void cmd_msg_dump(struct au0828_dev *dev)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0;i < sizeof(dev->ctrlmsg); i+=16)
|
for (i = 0;i < sizeof(dev->ctrlmsg); i+=16)
|
||||||
_dbg(1,"%s() %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x "
|
dprintk(2,"%s() %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x "
|
||||||
"%02x %02x %02x %02x %02x %02x\n",
|
"%02x %02x %02x %02x %02x %02x\n",
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
dev->ctrlmsg[i+0], dev->ctrlmsg[i+1],
|
dev->ctrlmsg[i+0], dev->ctrlmsg[i+1],
|
||||||
|
@ -107,7 +105,7 @@ static int send_control_msg(struct au0828_dev *dev, u16 request, u32 value,
|
||||||
status = min(status, 0);
|
status = min(status, 0);
|
||||||
|
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
_err("%s() Failed sending control message, error %d.\n",
|
printk(KERN_ERR "%s() Failed sending control message, error %d.\n",
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
status);
|
status);
|
||||||
}
|
}
|
||||||
|
@ -137,13 +135,12 @@ static int recv_control_msg(struct au0828_dev *dev, u16 request, u32 value,
|
||||||
status = min(status, 0);
|
status = min(status, 0);
|
||||||
|
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
_err("%s() Failed receiving ctrl msg, error %d.\n",
|
printk(KERN_ERR "%s() Failed receiving control message, error %d.\n",
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
status);
|
status);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (debug > 4)
|
cmd_msg_dump(dev);
|
||||||
cmd_msg_dump(dev);
|
|
||||||
}
|
}
|
||||||
mutex_unlock(&dev->mutex);
|
mutex_unlock(&dev->mutex);
|
||||||
return status;
|
return status;
|
||||||
|
@ -152,7 +149,7 @@ static void au0828_usb_disconnect(struct usb_interface *interface)
|
||||||
{
|
{
|
||||||
struct au0828_dev *dev = usb_get_intfdata(interface);
|
struct au0828_dev *dev = usb_get_intfdata(interface);
|
||||||
|
|
||||||
_dbg(1,"%s()\n", __FUNCTION__);
|
dprintk(1,"%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
/* Digital TV */
|
/* Digital TV */
|
||||||
au0828_dvb_unregister(dev);
|
au0828_dvb_unregister(dev);
|
||||||
|
@ -182,7 +179,7 @@ static int au0828_usb_probe (struct usb_interface *interface,
|
||||||
if (ifnum != 0)
|
if (ifnum != 0)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
_dbg(1,"%s() vendor id 0x%x device id 0x%x ifnum:%d\n",
|
dprintk(1,"%s() vendor id 0x%x device id 0x%x ifnum:%d\n",
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
le16_to_cpu(usbdev->descriptor.idVendor),
|
le16_to_cpu(usbdev->descriptor.idVendor),
|
||||||
le16_to_cpu(usbdev->descriptor.idProduct),
|
le16_to_cpu(usbdev->descriptor.idProduct),
|
||||||
|
@ -190,7 +187,7 @@ static int au0828_usb_probe (struct usb_interface *interface,
|
||||||
|
|
||||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
_err("Unable to allocate memory\n");
|
printk(KERN_ERR "%s() Unable to allocate memory\n", __FUNCTION__);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +213,7 @@ static int au0828_usb_probe (struct usb_interface *interface,
|
||||||
/* Digital TV */
|
/* Digital TV */
|
||||||
au0828_dvb_register(dev);
|
au0828_dvb_register(dev);
|
||||||
|
|
||||||
_info("Registered device AU0828 [%s]\n",
|
printk(KERN_INFO "Registered device AU0828 [%s]\n",
|
||||||
au0828_boards[dev->board].name == NULL ? "Unset" :
|
au0828_boards[dev->board].name == NULL ? "Unset" :
|
||||||
au0828_boards[dev->board].name);
|
au0828_boards[dev->board].name);
|
||||||
|
|
||||||
|
@ -234,11 +231,29 @@ static int __init au0828_init(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
_info("au0828 driver loaded\n");
|
if(debug)
|
||||||
|
printk(KERN_INFO "%s() Debugging is enabled\n", __FUNCTION__);
|
||||||
|
|
||||||
|
if(usb_debug) {
|
||||||
|
printk(KERN_INFO "%s() USB Debugging is enabled\n", __FUNCTION__);
|
||||||
|
debug |= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i2c_debug) {
|
||||||
|
printk(KERN_INFO "%s() I2C Debugging is enabled\n", __FUNCTION__);
|
||||||
|
debug |= 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bridge_debug) {
|
||||||
|
printk(KERN_INFO "%s() Bridge Debugging is enabled\n", __FUNCTION__);
|
||||||
|
debug |= 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
printk(KERN_INFO "au0828 driver loaded\n");
|
||||||
|
|
||||||
ret = usb_register(&au0828_usb_driver);
|
ret = usb_register(&au0828_usb_driver);
|
||||||
if (ret)
|
if (ret)
|
||||||
_err("usb_register failed, error = %d\n", ret);
|
printk(KERN_ERR "usb_register failed, error = %d\n", ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,19 +26,11 @@
|
||||||
#include <media/v4l2-common.h>
|
#include <media/v4l2-common.h>
|
||||||
|
|
||||||
#include "au0828.h"
|
#include "au0828.h"
|
||||||
|
|
||||||
#include "au8522.h"
|
#include "au8522.h"
|
||||||
#include "xc5000.h"
|
#include "xc5000.h"
|
||||||
|
|
||||||
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
||||||
|
|
||||||
unsigned int dvb_debug = 1;
|
|
||||||
|
|
||||||
#define _dbg(level, fmt, arg...)\
|
|
||||||
do { if (dvb_debug >= level)\
|
|
||||||
printk(KERN_DEBUG "%s/0: " fmt, DRIVER_NAME, ## arg);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
static struct au8522_config hauppauge_hvr950q_config = {
|
static struct au8522_config hauppauge_hvr950q_config = {
|
||||||
.demod_address = 0x8e >> 1,
|
.demod_address = 0x8e >> 1,
|
||||||
.status_mode = AU8522_DEMODLOCKING,
|
.status_mode = AU8522_DEMODLOCKING,
|
||||||
|
@ -57,6 +49,8 @@ static void urb_completion(struct urb *purb)
|
||||||
struct au0828_dev *dev = purb->context;
|
struct au0828_dev *dev = purb->context;
|
||||||
int ptype = usb_pipetype(purb->pipe);
|
int ptype = usb_pipetype(purb->pipe);
|
||||||
|
|
||||||
|
dprintk(2, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -84,7 +78,7 @@ static int stop_urb_transfer(struct au0828_dev *dev)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
printk(KERN_INFO "%s()\n", __FUNCTION__);
|
dprintk(2, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
/* FIXME: Do we need to free the transfer_buffers? */
|
/* FIXME: Do we need to free the transfer_buffers? */
|
||||||
for (i = 0; i < URB_COUNT; i++) {
|
for (i = 0; i < URB_COUNT; i++) {
|
||||||
|
@ -105,15 +99,11 @@ static int start_urb_transfer(struct au0828_dev *dev)
|
||||||
{
|
{
|
||||||
struct urb *purb;
|
struct urb *purb;
|
||||||
int i, ret = -ENOMEM;
|
int i, ret = -ENOMEM;
|
||||||
unsigned int pipe = usb_rcvbulkpipe(dev->usbdev, _AU0828_BULKPIPE);
|
|
||||||
int pipesize = usb_maxpacket(dev->usbdev, pipe, usb_pipeout(pipe));
|
|
||||||
int packets = _BULKPIPESIZE / pipesize;
|
|
||||||
int transfer_buflen = packets * pipesize;
|
|
||||||
|
|
||||||
printk(KERN_INFO "%s() transfer_buflen = %d\n", __FUNCTION__, transfer_buflen);
|
dprintk(2, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
if (dev->urb_streaming) {
|
if (dev->urb_streaming) {
|
||||||
printk("%s: iso xfer already running!\n", __FUNCTION__);
|
dprintk(2, "%s: iso xfer already running!\n", __FUNCTION__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,17 +157,15 @@ static int au0828_dvb_start_feed(struct dvb_demux_feed *feed)
|
||||||
struct au0828_dvb *dvb = &dev->dvb;
|
struct au0828_dvb *dvb = &dev->dvb;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
printk(KERN_INFO "%s() pid = 0x%x index = %d\n", __FUNCTION__, feed->pid, feed->index);
|
dprintk(1, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
if (!demux->dmx.frontend)
|
if (!demux->dmx.frontend)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
printk(KERN_INFO "%s() Preparing, feeding = %d\n", __FUNCTION__, dvb->feeding);
|
|
||||||
if (dvb) {
|
if (dvb) {
|
||||||
mutex_lock(&dvb->lock);
|
mutex_lock(&dvb->lock);
|
||||||
if (dvb->feeding++ == 0) {
|
if (dvb->feeding++ == 0) {
|
||||||
printk(KERN_INFO "%s() Starting Transport DMA\n",
|
/* Start transport */
|
||||||
__FUNCTION__);
|
|
||||||
au0828_write(dev, 0x608, 0x90);
|
au0828_write(dev, 0x608, 0x90);
|
||||||
au0828_write(dev, 0x609, 0x72);
|
au0828_write(dev, 0x609, 0x72);
|
||||||
au0828_write(dev, 0x60a, 0x71);
|
au0828_write(dev, 0x60a, 0x71);
|
||||||
|
@ -197,13 +185,12 @@ static int au0828_dvb_stop_feed(struct dvb_demux_feed *feed)
|
||||||
struct au0828_dvb *dvb = &dev->dvb;
|
struct au0828_dvb *dvb = &dev->dvb;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
printk(KERN_INFO "%s() pid = 0x%x index = %d\n", __FUNCTION__, feed->pid, feed->index);
|
dprintk(1, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
if (dvb) {
|
if (dvb) {
|
||||||
mutex_lock(&dvb->lock);
|
mutex_lock(&dvb->lock);
|
||||||
if (--dvb->feeding == 0) {
|
if (--dvb->feeding == 0) {
|
||||||
printk(KERN_INFO "%s() Stopping Transport DMA\n",
|
/* Stop transport */
|
||||||
__FUNCTION__);
|
|
||||||
au0828_write(dev, 0x608, 0x00);
|
au0828_write(dev, 0x608, 0x00);
|
||||||
au0828_write(dev, 0x609, 0x00);
|
au0828_write(dev, 0x609, 0x00);
|
||||||
au0828_write(dev, 0x60a, 0x00);
|
au0828_write(dev, 0x60a, 0x00);
|
||||||
|
@ -221,11 +208,13 @@ int dvb_register(struct au0828_dev *dev)
|
||||||
struct au0828_dvb *dvb = &dev->dvb;
|
struct au0828_dvb *dvb = &dev->dvb;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
dprintk(1, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
/* register adapter */
|
/* register adapter */
|
||||||
result = dvb_register_adapter(&dvb->adapter, DRIVER_NAME, THIS_MODULE,
|
result = dvb_register_adapter(&dvb->adapter, DRIVER_NAME, THIS_MODULE,
|
||||||
&dev->usbdev->dev, adapter_nr);
|
&dev->usbdev->dev, adapter_nr);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printk(KERN_WARNING "%s: dvb_register_adapter failed (errno = %d)\n",
|
printk(KERN_ERROR "%s: dvb_register_adapter failed (errno = %d)\n",
|
||||||
DRIVER_NAME, result);
|
DRIVER_NAME, result);
|
||||||
goto fail_adapter;
|
goto fail_adapter;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +223,7 @@ int dvb_register(struct au0828_dev *dev)
|
||||||
/* register frontend */
|
/* register frontend */
|
||||||
result = dvb_register_frontend(&dvb->adapter, dvb->frontend);
|
result = dvb_register_frontend(&dvb->adapter, dvb->frontend);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printk(KERN_WARNING "%s: dvb_register_frontend failed (errno = %d)\n",
|
printk(KERN_ERR "%s: dvb_register_frontend failed (errno = %d)\n",
|
||||||
DRIVER_NAME, result);
|
DRIVER_NAME, result);
|
||||||
goto fail_frontend;
|
goto fail_frontend;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +239,7 @@ int dvb_register(struct au0828_dev *dev)
|
||||||
dvb->demux.stop_feed = au0828_dvb_stop_feed;
|
dvb->demux.stop_feed = au0828_dvb_stop_feed;
|
||||||
result = dvb_dmx_init(&dvb->demux);
|
result = dvb_dmx_init(&dvb->demux);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printk(KERN_WARNING "%s: dvb_dmx_init failed (errno = %d)\n",
|
printk(KERN_ERR "%s: dvb_dmx_init failed (errno = %d)\n",
|
||||||
DRIVER_NAME, result);
|
DRIVER_NAME, result);
|
||||||
goto fail_dmx;
|
goto fail_dmx;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +249,7 @@ int dvb_register(struct au0828_dev *dev)
|
||||||
dvb->dmxdev.capabilities = 0;
|
dvb->dmxdev.capabilities = 0;
|
||||||
result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
|
result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printk(KERN_WARNING "%s: dvb_dmxdev_init failed (errno = %d)\n",
|
printk(KERN_ERR "%s: dvb_dmxdev_init failed (errno = %d)\n",
|
||||||
DRIVER_NAME, result);
|
DRIVER_NAME, result);
|
||||||
goto fail_dmxdev;
|
goto fail_dmxdev;
|
||||||
}
|
}
|
||||||
|
@ -268,7 +257,7 @@ int dvb_register(struct au0828_dev *dev)
|
||||||
dvb->fe_hw.source = DMX_FRONTEND_0;
|
dvb->fe_hw.source = DMX_FRONTEND_0;
|
||||||
result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw);
|
result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_hw);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printk(KERN_WARNING "%s: add_frontend failed (DMX_FRONTEND_0, errno = %d)\n",
|
printk(KERN_ERR "%s: add_frontend failed (DMX_FRONTEND_0, errno = %d)\n",
|
||||||
DRIVER_NAME, result);
|
DRIVER_NAME, result);
|
||||||
goto fail_fe_hw;
|
goto fail_fe_hw;
|
||||||
}
|
}
|
||||||
|
@ -276,14 +265,14 @@ int dvb_register(struct au0828_dev *dev)
|
||||||
dvb->fe_mem.source = DMX_MEMORY_FE;
|
dvb->fe_mem.source = DMX_MEMORY_FE;
|
||||||
result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem);
|
result = dvb->demux.dmx.add_frontend(&dvb->demux.dmx, &dvb->fe_mem);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printk(KERN_WARNING "%s: add_frontend failed (DMX_MEMORY_FE, errno = %d)\n",
|
printk(KERN_ERR "%s: add_frontend failed (DMX_MEMORY_FE, errno = %d)\n",
|
||||||
DRIVER_NAME, result);
|
DRIVER_NAME, result);
|
||||||
goto fail_fe_mem;
|
goto fail_fe_mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw);
|
result = dvb->demux.dmx.connect_frontend(&dvb->demux.dmx, &dvb->fe_hw);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
printk(KERN_WARNING "%s: connect_frontend failed (errno = %d)\n",
|
printk(KERN_ERR "%s: connect_frontend failed (errno = %d)\n",
|
||||||
DRIVER_NAME, result);
|
DRIVER_NAME, result);
|
||||||
goto fail_fe_conn;
|
goto fail_fe_conn;
|
||||||
}
|
}
|
||||||
|
@ -313,6 +302,8 @@ void au0828_dvb_unregister(struct au0828_dev *dev)
|
||||||
{
|
{
|
||||||
struct au0828_dvb *dvb = &dev->dvb;
|
struct au0828_dvb *dvb = &dev->dvb;
|
||||||
|
|
||||||
|
dprintk(1, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
if(dvb->frontend == NULL)
|
if(dvb->frontend == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -335,6 +326,8 @@ int au0828_dvb_register(struct au0828_dev *dev)
|
||||||
struct au0828_dvb *dvb = &dev->dvb;
|
struct au0828_dvb *dvb = &dev->dvb;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
dprintk(1, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
/* init frontend */
|
/* init frontend */
|
||||||
switch (dev->board) {
|
switch (dev->board) {
|
||||||
case AU0828_BOARD_HAUPPAUGE_HVR850:
|
case AU0828_BOARD_HAUPPAUGE_HVR850:
|
||||||
|
@ -355,7 +348,7 @@ int au0828_dvb_register(struct au0828_dev *dev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (NULL == dvb->frontend) {
|
if (NULL == dvb->frontend) {
|
||||||
printk("Frontend initialization failed\n");
|
printk(KERN_ERR "%s() Frontend initialization failed\n", __FUNCTION__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,19 +29,14 @@
|
||||||
|
|
||||||
#include <media/v4l2-common.h>
|
#include <media/v4l2-common.h>
|
||||||
|
|
||||||
static unsigned int i2c_debug;
|
unsigned int i2c_debug = 0;
|
||||||
module_param(i2c_debug, int, 0644);
|
module_param(i2c_debug, int, 0444);
|
||||||
MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
|
MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
|
||||||
|
|
||||||
static unsigned int i2c_scan = 0;
|
unsigned int i2c_scan = 0;
|
||||||
module_param(i2c_scan, int, 0444);
|
module_param(i2c_scan, int, 0444);
|
||||||
MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time");
|
MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time");
|
||||||
|
|
||||||
#define dprintk(level, fmt, arg...)\
|
|
||||||
do { if (i2c_debug >= level)\
|
|
||||||
printk(KERN_DEBUG "%s/0: " fmt, DRIVER_NAME, ## arg);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define I2C_WAIT_DELAY 512
|
#define I2C_WAIT_DELAY 512
|
||||||
#define I2C_WAIT_RETRY 64
|
#define I2C_WAIT_RETRY 64
|
||||||
|
|
||||||
|
@ -146,7 +141,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
|
||||||
int i, strobe = 0;
|
int i, strobe = 0;
|
||||||
struct au0828_dev *dev = i2c_adap->algo_data;
|
struct au0828_dev *dev = i2c_adap->algo_data;
|
||||||
|
|
||||||
dprintk(1, "%s()\n", __FUNCTION__);
|
dprintk(4, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
au0828_write(dev, REG_2FF, 0x01);
|
au0828_write(dev, REG_2FF, 0x01);
|
||||||
au0828_write(dev, REG_202, 0x07);
|
au0828_write(dev, REG_202, 0x07);
|
||||||
|
@ -154,13 +149,11 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
|
||||||
/* Hardware needs 8 bit addresses */
|
/* Hardware needs 8 bit addresses */
|
||||||
au0828_write(dev, REG_203, msg->addr << 1);
|
au0828_write(dev, REG_203, msg->addr << 1);
|
||||||
|
|
||||||
if (i2c_debug)
|
dprintk(4, "SEND: %02x\n", msg->addr);
|
||||||
dprintk(1, "SEND: %02x\n", msg->addr);
|
|
||||||
|
|
||||||
for (i=0; i < msg->len;) {
|
for (i=0; i < msg->len;) {
|
||||||
|
|
||||||
if (i2c_debug)
|
dprintk(4, " %02x\n", msg->buf[i]);
|
||||||
dprintk(1, " %02x\n", msg->buf[i]);
|
|
||||||
|
|
||||||
au0828_write(dev, REG_205, msg->buf[i]);
|
au0828_write(dev, REG_205, msg->buf[i]);
|
||||||
|
|
||||||
|
@ -187,8 +180,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap,
|
||||||
if (!i2c_wait_done(i2c_adap))
|
if (!i2c_wait_done(i2c_adap))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if (i2c_debug)
|
dprintk(4, "\n");
|
||||||
dprintk(1, "\n");
|
|
||||||
|
|
||||||
return msg->len;
|
return msg->len;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +192,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
|
||||||
struct au0828_dev *dev = i2c_adap->algo_data;
|
struct au0828_dev *dev = i2c_adap->algo_data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
dprintk(1, "%s()\n", __FUNCTION__);
|
dprintk(4, "%s()\n", __FUNCTION__);
|
||||||
|
|
||||||
au0828_write(dev, REG_2FF, 0x01);
|
au0828_write(dev, REG_2FF, 0x01);
|
||||||
au0828_write(dev, REG_202, 0x07);
|
au0828_write(dev, REG_202, 0x07);
|
||||||
|
@ -208,8 +200,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
|
||||||
/* Hardware needs 8 bit addresses */
|
/* Hardware needs 8 bit addresses */
|
||||||
au0828_write(dev, REG_203, msg->addr << 1);
|
au0828_write(dev, REG_203, msg->addr << 1);
|
||||||
|
|
||||||
if (i2c_debug)
|
dprintk(4, " RECV:\n");
|
||||||
dprintk(1, " RECV:\n");
|
|
||||||
|
|
||||||
/* Deal with i2c_scan */
|
/* Deal with i2c_scan */
|
||||||
if (msg->len == 0) {
|
if (msg->len == 0) {
|
||||||
|
@ -233,14 +224,12 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap,
|
||||||
|
|
||||||
msg->buf[i-1] = au0828_read(dev, REG_209) & 0xff;
|
msg->buf[i-1] = au0828_read(dev, REG_209) & 0xff;
|
||||||
|
|
||||||
if (i2c_debug)
|
dprintk(4, " %02x\n", msg->buf[i-1]);
|
||||||
dprintk(1, " %02x\n", msg->buf[i-1]);
|
|
||||||
}
|
}
|
||||||
if (!i2c_wait_done(i2c_adap))
|
if (!i2c_wait_done(i2c_adap))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if (i2c_debug)
|
dprintk(4, "\n");
|
||||||
dprintk(1, "\n");
|
|
||||||
|
|
||||||
return msg->len;
|
return msg->len;
|
||||||
}
|
}
|
||||||
|
@ -250,10 +239,10 @@ static int i2c_xfer(struct i2c_adapter *i2c_adap,
|
||||||
{
|
{
|
||||||
int i, retval = 0;
|
int i, retval = 0;
|
||||||
|
|
||||||
dprintk(1, "%s(num = %d)\n", __FUNCTION__, num);
|
dprintk(4, "%s(num = %d)\n", __FUNCTION__, num);
|
||||||
|
|
||||||
for (i = 0 ; i < num; i++) {
|
for (i = 0 ; i < num; i++) {
|
||||||
dprintk(1, "%s(num = %d) addr = 0x%02x len = 0x%x\n",
|
dprintk(4, "%s(num = %d) addr = 0x%02x len = 0x%x\n",
|
||||||
__FUNCTION__, num, msgs[i].addr, msgs[i].len);
|
__FUNCTION__, num, msgs[i].addr, msgs[i].len);
|
||||||
if (msgs[i].flags & I2C_M_RD) {
|
if (msgs[i].flags & I2C_M_RD) {
|
||||||
/* read */
|
/* read */
|
||||||
|
@ -384,6 +373,7 @@ int au0828_i2c_register(struct au0828_dev *dev)
|
||||||
do_i2c_scan(DRIVER_NAME, &dev->i2c_client);
|
do_i2c_scan(DRIVER_NAME, &dev->i2c_client);
|
||||||
} else
|
} else
|
||||||
printk("%s: i2c bus register FAILED\n", DRIVER_NAME);
|
printk("%s: i2c bus register FAILED\n", DRIVER_NAME);
|
||||||
|
|
||||||
return dev->i2c_rc;
|
return dev->i2c_rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,10 +383,3 @@ int au0828_i2c_unregister(struct au0828_dev *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Local variables:
|
|
||||||
* c-basic-offset: 8
|
|
||||||
* End:
|
|
||||||
*/
|
|
||||||
|
|
|
@ -96,6 +96,9 @@ struct au0828_buff {
|
||||||
/* au0828-core.c */
|
/* au0828-core.c */
|
||||||
extern u32 au0828_read(struct au0828_dev *dev, u16 reg);
|
extern u32 au0828_read(struct au0828_dev *dev, u16 reg);
|
||||||
extern u32 au0828_write(struct au0828_dev *dev, u16 reg, u32 val);
|
extern u32 au0828_write(struct au0828_dev *dev, u16 reg, u32 val);
|
||||||
|
extern unsigned int debug;
|
||||||
|
extern unsigned int usb_debug;
|
||||||
|
extern unsigned int bridge_debug;
|
||||||
|
|
||||||
/* ----------------------------------------------------------- */
|
/* ----------------------------------------------------------- */
|
||||||
/* au0828-cards.c */
|
/* au0828-cards.c */
|
||||||
|
@ -112,8 +115,14 @@ extern int au0828_i2c_register(struct au0828_dev *dev);
|
||||||
extern int au0828_i2c_unregister(struct au0828_dev *dev);
|
extern int au0828_i2c_unregister(struct au0828_dev *dev);
|
||||||
extern void au0828_call_i2c_clients(struct au0828_dev *dev,
|
extern void au0828_call_i2c_clients(struct au0828_dev *dev,
|
||||||
unsigned int cmd, void *arg);
|
unsigned int cmd, void *arg);
|
||||||
|
extern unsigned int i2c_debug;
|
||||||
|
|
||||||
/* ----------------------------------------------------------- */
|
/* ----------------------------------------------------------- */
|
||||||
/* au0828-dvb.c */
|
/* au0828-dvb.c */
|
||||||
extern int au0828_dvb_register(struct au0828_dev *dev);
|
extern int au0828_dvb_register(struct au0828_dev *dev);
|
||||||
extern void au0828_dvb_unregister(struct au0828_dev *dev);
|
extern void au0828_dvb_unregister(struct au0828_dev *dev);
|
||||||
|
|
||||||
|
#define dprintk(level, fmt, arg...)\
|
||||||
|
do { if (debug & level)\
|
||||||
|
printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\
|
||||||
|
} while (0)
|
||||||
|
|
Loading…
Reference in New Issue