Commit ec047457 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] ce6230: various small changes

Small changes like log writings. No functionality changes.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ab84f182
/* /*
* DVB USB Linux driver for Intel CE6230 DVB-T USB2.0 receiver * Intel CE6230 DVB USB driver
* *
* Copyright (C) 2009 Antti Palosaari <crope@iki.fi> * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
* *
...@@ -20,18 +20,10 @@ ...@@ -20,18 +20,10 @@
*/ */
#include "ce6230.h" #include "ce6230.h"
#include "zl10353.h"
#include "mxl5005s.h"
/* debug */
static int dvb_usb_ce6230_debug;
module_param_named(debug, dvb_usb_ce6230_debug, int, 0644);
MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS);
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
static struct zl10353_config ce6230_zl10353_config; static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct usb_req *req)
static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
{ {
int ret; int ret;
unsigned int pipe; unsigned int pipe;
...@@ -57,8 +49,8 @@ static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct req_t *req) ...@@ -57,8 +49,8 @@ static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
requesttype = (USB_TYPE_VENDOR | USB_DIR_OUT); requesttype = (USB_TYPE_VENDOR | USB_DIR_OUT);
break; break;
default: default:
err("unknown command:%02x", req->cmd); pr_debug("%s: unknown command=%02x\n", __func__, req->cmd);
ret = -EPERM; ret = -EINVAL;
goto error; goto error;
} }
...@@ -83,10 +75,11 @@ static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct req_t *req) ...@@ -83,10 +75,11 @@ static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
buf, req->data_len, CE6230_USB_TIMEOUT); buf, req->data_len, CE6230_USB_TIMEOUT);
ce6230_debug_dump(request, requesttype, value, index, buf, ce6230_debug_dump(request, requesttype, value, index, buf,
req->data_len, deb_xfer); req->data_len);
if (ret < 0) if (ret < 0)
deb_info("%s: usb_control_msg failed:%d\n", __func__, ret); pr_err("%s: usb_control_msg() failed=%d\n", KBUILD_MODNAME,
ret);
else else
ret = 0; ret = 0;
...@@ -100,17 +93,19 @@ static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct req_t *req) ...@@ -100,17 +93,19 @@ static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
} }
/* I2C */ /* I2C */
static int ce6230_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], static struct zl10353_config ce6230_zl10353_config;
int num)
static int ce6230_i2c_master_xfer(struct i2c_adapter *adap,
struct i2c_msg msg[], int num)
{ {
struct dvb_usb_device *d = i2c_get_adapdata(adap); struct dvb_usb_device *d = i2c_get_adapdata(adap);
int i = 0; int ret = 0, i = 0;
struct req_t req; struct usb_req req;
int ret = 0;
memset(&req, 0, sizeof(req));
if (num > 2) if (num > 2)
return -EINVAL; return -EOPNOTSUPP;
memset(&req, 0, sizeof(req));
if (mutex_lock_interruptible(&d->i2c_mutex) < 0) if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
return -EAGAIN; return -EAGAIN;
...@@ -126,8 +121,9 @@ static int ce6230_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], ...@@ -126,8 +121,9 @@ static int ce6230_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
req.data = &msg[i+1].buf[0]; req.data = &msg[i+1].buf[0];
ret = ce6230_ctrl_msg(d, &req); ret = ce6230_ctrl_msg(d, &req);
} else { } else {
err("i2c read not implemented"); pr_err("%s: I2C read not implemented\n",
ret = -EPERM; KBUILD_MODNAME);
ret = -EOPNOTSUPP;
} }
i += 2; i += 2;
} else { } else {
...@@ -157,14 +153,14 @@ static int ce6230_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], ...@@ -157,14 +153,14 @@ static int ce6230_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
return ret ? ret : i; return ret ? ret : i;
} }
static u32 ce6230_i2c_func(struct i2c_adapter *adapter) static u32 ce6230_i2c_functionality(struct i2c_adapter *adapter)
{ {
return I2C_FUNC_I2C; return I2C_FUNC_I2C;
} }
static struct i2c_algorithm ce6230_i2c_algo = { static struct i2c_algorithm ce6230_i2c_algorithm = {
.master_xfer = ce6230_i2c_xfer, .master_xfer = ce6230_i2c_master_xfer,
.functionality = ce6230_i2c_func, .functionality = ce6230_i2c_functionality,
}; };
/* Callbacks for DVB USB */ /* Callbacks for DVB USB */
...@@ -180,11 +176,13 @@ static struct zl10353_config ce6230_zl10353_config = { ...@@ -180,11 +176,13 @@ static struct zl10353_config ce6230_zl10353_config = {
static int ce6230_zl10353_frontend_attach(struct dvb_usb_adapter *adap) static int ce6230_zl10353_frontend_attach(struct dvb_usb_adapter *adap)
{ {
deb_info("%s:\n", __func__); pr_debug("%s:\n", __func__);
adap->fe[0] = dvb_attach(zl10353_attach, &ce6230_zl10353_config, adap->fe[0] = dvb_attach(zl10353_attach, &ce6230_zl10353_config,
&adap->dev->i2c_adap); &adap->dev->i2c_adap);
if (adap->fe[0] == NULL) if (adap->fe[0] == NULL)
return -ENODEV; return -ENODEV;
return 0; return 0;
} }
...@@ -208,7 +206,9 @@ static struct mxl5005s_config ce6230_mxl5003s_config = { ...@@ -208,7 +206,9 @@ static struct mxl5005s_config ce6230_mxl5003s_config = {
static int ce6230_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap) static int ce6230_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap)
{ {
int ret; int ret;
deb_info("%s:\n", __func__);
pr_debug("%s:\n", __func__);
ret = dvb_attach(mxl5005s_attach, adap->fe[0], &adap->dev->i2c_adap, ret = dvb_attach(mxl5005s_attach, adap->fe[0], &adap->dev->i2c_adap,
&ce6230_mxl5003s_config) == NULL ? -ENODEV : 0; &ce6230_mxl5003s_config) == NULL ? -ENODEV : 0;
return ret; return ret;
...@@ -217,13 +217,15 @@ static int ce6230_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap) ...@@ -217,13 +217,15 @@ static int ce6230_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap)
static int ce6230_power_ctrl(struct dvb_usb_device *d, int onoff) static int ce6230_power_ctrl(struct dvb_usb_device *d, int onoff)
{ {
int ret; int ret;
deb_info("%s: onoff:%d\n", __func__, onoff);
pr_debug("%s: onoff=%d\n", __func__, onoff);
/* InterfaceNumber 1 / AlternateSetting 0 idle /* InterfaceNumber 1 / AlternateSetting 0 idle
InterfaceNumber 1 / AlternateSetting 1 streaming */ InterfaceNumber 1 / AlternateSetting 1 streaming */
ret = usb_set_interface(d->udev, 1, onoff); ret = usb_set_interface(d->udev, 1, onoff);
if (ret) if (ret)
err("usb_set_interface failed with error:%d", ret); pr_err("%s: usb_set_interface() failed=%d\n", KBUILD_MODNAME,
ret);
return ret; return ret;
} }
...@@ -235,7 +237,7 @@ static struct dvb_usb_device_properties ce6230_props = { ...@@ -235,7 +237,7 @@ static struct dvb_usb_device_properties ce6230_props = {
.adapter_nr = adapter_nr, .adapter_nr = adapter_nr,
.bInterfaceNumber = 1, .bInterfaceNumber = 1,
.i2c_algo = &ce6230_i2c_algo, .i2c_algo = &ce6230_i2c_algorithm,
.power_ctrl = ce6230_power_ctrl, .power_ctrl = ce6230_power_ctrl,
.frontend_attach = ce6230_zl10353_frontend_attach, .frontend_attach = ce6230_zl10353_frontend_attach,
.tuner_attach = ce6230_mxl5003s_tuner_attach, .tuner_attach = ce6230_mxl5003s_tuner_attach,
...@@ -280,5 +282,5 @@ static struct usb_driver ce6230_usb_driver = { ...@@ -280,5 +282,5 @@ static struct usb_driver ce6230_usb_driver = {
module_usb_driver(ce6230_usb_driver); module_usb_driver(ce6230_usb_driver);
MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
MODULE_DESCRIPTION("Driver for Intel CE6230 DVB-T USB2.0"); MODULE_DESCRIPTION("Intel CE6230 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/* /*
* DVB USB Linux driver for Intel CE6230 DVB-T USB2.0 receiver * Intel CE6230 DVB USB driver
* *
* Copyright (C) 2009 Antti Palosaari <crope@iki.fi> * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
* *
...@@ -19,51 +19,27 @@ ...@@ -19,51 +19,27 @@
* *
*/ */
#ifndef _DVB_USB_CE6230_H_ #ifndef CE6230_H
#define _DVB_USB_CE6230_H_ #define CE6230_H
#define DVB_USB_LOG_PREFIX "ce6230"
#include "dvb_usb.h" #include "dvb_usb.h"
#include "zl10353.h"
#include "mxl5005s.h"
#ifdef CONFIG_DVB_USB_DEBUG #define ce6230_debug_dump(r, t, v, i, b, l) { \
#define dprintk(var, level, args...) \ char *direction; \
do { if ((var & level)) printk(args); } while (0)
#define DVB_USB_DEBUG_STATUS
#else
#define dprintk(args...)
#define DVB_USB_DEBUG_STATUS " (debugging is not enabled)"
#endif
#undef err
#define err(format, arg...) printk(KERN_ERR DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
#undef info
#define info(format, arg...) printk(KERN_INFO DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
#undef warn
#define warn(format, arg...) printk(KERN_WARNING DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
#define deb_info(args...) dprintk(dvb_usb_ce6230_debug, 0x01, args)
#define deb_rc(args...) dprintk(dvb_usb_ce6230_debug, 0x02, args)
#define deb_xfer(args...) dprintk(dvb_usb_ce6230_debug, 0x04, args)
#define deb_reg(args...) dprintk(dvb_usb_ce6230_debug, 0x08, args)
#define deb_i2c(args...) dprintk(dvb_usb_ce6230_debug, 0x10, args)
#define deb_fw(args...) dprintk(dvb_usb_ce6230_debug, 0x20, args)
#define ce6230_debug_dump(r, t, v, i, b, l, func) { \
int loop_; \
func("%02x %02x %02x %02x %02x %02x %02x %02x", \
t, r, v & 0xff, v >> 8, i & 0xff, i >> 8, l & 0xff, l >> 8); \
if (t == (USB_TYPE_VENDOR | USB_DIR_OUT)) \ if (t == (USB_TYPE_VENDOR | USB_DIR_OUT)) \
func(" >>> "); \ direction = ">>>"; \
else \ else \
func(" <<< "); \ direction = "<<<"; \
for (loop_ = 0; loop_ < l; loop_++) \ pr_debug("%s: %02x %02x %02x %02x %02x %02x %02x %02x %s [%d bytes]\n", \
func("%02x ", b[loop_]); \ __func__, t, r, v & 0xff, v >> 8, i & 0xff, i >> 8, \
func("\n");\ l & 0xff, l >> 8, direction, l); \
} }
#define CE6230_USB_TIMEOUT 1000 #define CE6230_USB_TIMEOUT 1000
struct req_t { struct usb_req {
u8 cmd; /* [1] */ u8 cmd; /* [1] */
u16 value; /* [2|3] */ u16 value; /* [2|3] */
u16 index; /* [4|5] */ u16 index; /* [4|5] */
......
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