aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-06-13 22:33:16 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-04 06:56:32 -0400
commitec04745790f47f23f558f07398fe69e963744f11 (patch)
tree9698c5f44523e1b373bd246788b747eed5719be8 /drivers/media/dvb/dvb-usb
parentab84f182f0cd49f9fe3fda90eb19d98d9e226933 (diff)
[media] ce6230: various small changes
Small changes like log writings. No functionality changes. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r--drivers/media/dvb/dvb-usb/ce6230.c70
-rw-r--r--drivers/media/dvb/dvb-usb/ce6230.h50
2 files changed, 49 insertions, 71 deletions
diff --git a/drivers/media/dvb/dvb-usb/ce6230.c b/drivers/media/dvb/dvb-usb/ce6230.c
index ee6a4019dd8..b9197a58ba2 100644
--- a/drivers/media/dvb/dvb-usb/ce6230.c
+++ b/drivers/media/dvb/dvb-usb/ce6230.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * DVB USB Linux driver for Intel CE6230 DVB-T USB2.0 receiver 2 * Intel CE6230 DVB USB driver
3 * 3 *
4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi> 4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
5 * 5 *
@@ -20,18 +20,10 @@
20 */ 20 */
21 21
22#include "ce6230.h" 22#include "ce6230.h"
23#include "zl10353.h"
24#include "mxl5005s.h"
25 23
26/* debug */
27static int dvb_usb_ce6230_debug;
28module_param_named(debug, dvb_usb_ce6230_debug, int, 0644);
29MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS);
30DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 24DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
31 25
32static struct zl10353_config ce6230_zl10353_config; 26static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct usb_req *req)
33
34static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
35{ 27{
36 int ret; 28 int ret;
37 unsigned int pipe; 29 unsigned int pipe;
@@ -57,8 +49,8 @@ static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
57 requesttype = (USB_TYPE_VENDOR | USB_DIR_OUT); 49 requesttype = (USB_TYPE_VENDOR | USB_DIR_OUT);
58 break; 50 break;
59 default: 51 default:
60 err("unknown command:%02x", req->cmd); 52 pr_debug("%s: unknown command=%02x\n", __func__, req->cmd);
61 ret = -EPERM; 53 ret = -EINVAL;
62 goto error; 54 goto error;
63 } 55 }
64 56
@@ -80,13 +72,14 @@ static int ce6230_ctrl_msg(struct dvb_usb_device *d, struct req_t *req)
80 msleep(1); /* avoid I2C errors */ 72 msleep(1); /* avoid I2C errors */
81 73
82 ret = usb_control_msg(d->udev, pipe, request, requesttype, value, index, 74 ret = usb_control_msg(d->udev, pipe, request, requesttype, value, index,
83 buf, req->data_len, CE6230_USB_TIMEOUT); 75 buf, req->data_len, CE6230_USB_TIMEOUT);
84 76
85 ce6230_debug_dump(request, requesttype, value, index, buf, 77 ce6230_debug_dump(request, requesttype, value, index, buf,
86 req->data_len, deb_xfer); 78 req->data_len);
87 79
88 if (ret < 0) 80 if (ret < 0)
89 deb_info("%s: usb_control_msg failed:%d\n", __func__, ret); 81 pr_err("%s: usb_control_msg() failed=%d\n", KBUILD_MODNAME,
82 ret);
90 else 83 else
91 ret = 0; 84 ret = 0;
92 85
@@ -100,17 +93,19 @@ error:
100} 93}
101 94
102/* I2C */ 95/* I2C */
103static int ce6230_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], 96static struct zl10353_config ce6230_zl10353_config;
104 int num) 97
98static int ce6230_i2c_master_xfer(struct i2c_adapter *adap,
99 struct i2c_msg msg[], int num)
105{ 100{
106 struct dvb_usb_device *d = i2c_get_adapdata(adap); 101 struct dvb_usb_device *d = i2c_get_adapdata(adap);
107 int i = 0; 102 int ret = 0, i = 0;
108 struct req_t req; 103 struct usb_req req;
109 int ret = 0;
110 memset(&req, 0, sizeof(req));
111 104
112 if (num > 2) 105 if (num > 2)
113 return -EINVAL; 106 return -EOPNOTSUPP;
107
108 memset(&req, 0, sizeof(req));
114 109
115 if (mutex_lock_interruptible(&d->i2c_mutex) < 0) 110 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
116 return -EAGAIN; 111 return -EAGAIN;
@@ -126,8 +121,9 @@ static int ce6230_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
126 req.data = &msg[i+1].buf[0]; 121 req.data = &msg[i+1].buf[0];
127 ret = ce6230_ctrl_msg(d, &req); 122 ret = ce6230_ctrl_msg(d, &req);
128 } else { 123 } else {
129 err("i2c read not implemented"); 124 pr_err("%s: I2C read not implemented\n",
130 ret = -EPERM; 125 KBUILD_MODNAME);
126 ret = -EOPNOTSUPP;
131 } 127 }
132 i += 2; 128 i += 2;
133 } else { 129 } else {
@@ -157,14 +153,14 @@ static int ce6230_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
157 return ret ? ret : i; 153 return ret ? ret : i;
158} 154}
159 155
160static u32 ce6230_i2c_func(struct i2c_adapter *adapter) 156static u32 ce6230_i2c_functionality(struct i2c_adapter *adapter)
161{ 157{
162 return I2C_FUNC_I2C; 158 return I2C_FUNC_I2C;
163} 159}
164 160
165static struct i2c_algorithm ce6230_i2c_algo = { 161static struct i2c_algorithm ce6230_i2c_algorithm = {
166 .master_xfer = ce6230_i2c_xfer, 162 .master_xfer = ce6230_i2c_master_xfer,
167 .functionality = ce6230_i2c_func, 163 .functionality = ce6230_i2c_functionality,
168}; 164};
169 165
170/* Callbacks for DVB USB */ 166/* Callbacks for DVB USB */
@@ -180,11 +176,13 @@ static struct zl10353_config ce6230_zl10353_config = {
180 176
181static int ce6230_zl10353_frontend_attach(struct dvb_usb_adapter *adap) 177static int ce6230_zl10353_frontend_attach(struct dvb_usb_adapter *adap)
182{ 178{
183 deb_info("%s:\n", __func__); 179 pr_debug("%s:\n", __func__);
180
184 adap->fe[0] = dvb_attach(zl10353_attach, &ce6230_zl10353_config, 181 adap->fe[0] = dvb_attach(zl10353_attach, &ce6230_zl10353_config,
185 &adap->dev->i2c_adap); 182 &adap->dev->i2c_adap);
186 if (adap->fe[0] == NULL) 183 if (adap->fe[0] == NULL)
187 return -ENODEV; 184 return -ENODEV;
185
188 return 0; 186 return 0;
189} 187}
190 188
@@ -208,7 +206,9 @@ static struct mxl5005s_config ce6230_mxl5003s_config = {
208static int ce6230_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap) 206static int ce6230_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap)
209{ 207{
210 int ret; 208 int ret;
211 deb_info("%s:\n", __func__); 209
210 pr_debug("%s:\n", __func__);
211
212 ret = dvb_attach(mxl5005s_attach, adap->fe[0], &adap->dev->i2c_adap, 212 ret = dvb_attach(mxl5005s_attach, adap->fe[0], &adap->dev->i2c_adap,
213 &ce6230_mxl5003s_config) == NULL ? -ENODEV : 0; 213 &ce6230_mxl5003s_config) == NULL ? -ENODEV : 0;
214 return ret; 214 return ret;
@@ -217,13 +217,15 @@ static int ce6230_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap)
217static int ce6230_power_ctrl(struct dvb_usb_device *d, int onoff) 217static int ce6230_power_ctrl(struct dvb_usb_device *d, int onoff)
218{ 218{
219 int ret; 219 int ret;
220 deb_info("%s: onoff:%d\n", __func__, onoff); 220
221 pr_debug("%s: onoff=%d\n", __func__, onoff);
221 222
222 /* InterfaceNumber 1 / AlternateSetting 0 idle 223 /* InterfaceNumber 1 / AlternateSetting 0 idle
223 InterfaceNumber 1 / AlternateSetting 1 streaming */ 224 InterfaceNumber 1 / AlternateSetting 1 streaming */
224 ret = usb_set_interface(d->udev, 1, onoff); 225 ret = usb_set_interface(d->udev, 1, onoff);
225 if (ret) 226 if (ret)
226 err("usb_set_interface failed with error:%d", ret); 227 pr_err("%s: usb_set_interface() failed=%d\n", KBUILD_MODNAME,
228 ret);
227 229
228 return ret; 230 return ret;
229} 231}
@@ -235,7 +237,7 @@ static struct dvb_usb_device_properties ce6230_props = {
235 .adapter_nr = adapter_nr, 237 .adapter_nr = adapter_nr,
236 .bInterfaceNumber = 1, 238 .bInterfaceNumber = 1,
237 239
238 .i2c_algo = &ce6230_i2c_algo, 240 .i2c_algo = &ce6230_i2c_algorithm,
239 .power_ctrl = ce6230_power_ctrl, 241 .power_ctrl = ce6230_power_ctrl,
240 .frontend_attach = ce6230_zl10353_frontend_attach, 242 .frontend_attach = ce6230_zl10353_frontend_attach,
241 .tuner_attach = ce6230_mxl5003s_tuner_attach, 243 .tuner_attach = ce6230_mxl5003s_tuner_attach,
@@ -280,5 +282,5 @@ static struct usb_driver ce6230_usb_driver = {
280module_usb_driver(ce6230_usb_driver); 282module_usb_driver(ce6230_usb_driver);
281 283
282MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>"); 284MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
283MODULE_DESCRIPTION("Driver for Intel CE6230 DVB-T USB2.0"); 285MODULE_DESCRIPTION("Intel CE6230 driver");
284MODULE_LICENSE("GPL"); 286MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/ce6230.h b/drivers/media/dvb/dvb-usb/ce6230.h
index 7c219539fbd..42d754494a3 100644
--- a/drivers/media/dvb/dvb-usb/ce6230.h
+++ b/drivers/media/dvb/dvb-usb/ce6230.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * DVB USB Linux driver for Intel CE6230 DVB-T USB2.0 receiver 2 * Intel CE6230 DVB USB driver
3 * 3 *
4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi> 4 * Copyright (C) 2009 Antti Palosaari <crope@iki.fi>
5 * 5 *
@@ -19,51 +19,27 @@
19 * 19 *
20 */ 20 */
21 21
22#ifndef _DVB_USB_CE6230_H_ 22#ifndef CE6230_H
23#define _DVB_USB_CE6230_H_ 23#define CE6230_H
24 24
25#define DVB_USB_LOG_PREFIX "ce6230"
26#include "dvb_usb.h" 25#include "dvb_usb.h"
26#include "zl10353.h"
27#include "mxl5005s.h"
27 28
28#ifdef CONFIG_DVB_USB_DEBUG 29#define ce6230_debug_dump(r, t, v, i, b, l) { \
29#define dprintk(var, level, args...) \ 30 char *direction; \
30 do { if ((var & level)) printk(args); } while (0)
31#define DVB_USB_DEBUG_STATUS
32#else
33#define dprintk(args...)
34#define DVB_USB_DEBUG_STATUS " (debugging is not enabled)"
35#endif
36
37#undef err
38#define err(format, arg...) printk(KERN_ERR DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
39#undef info
40#define info(format, arg...) printk(KERN_INFO DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
41#undef warn
42#define warn(format, arg...) printk(KERN_WARNING DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
43
44#define deb_info(args...) dprintk(dvb_usb_ce6230_debug, 0x01, args)
45#define deb_rc(args...) dprintk(dvb_usb_ce6230_debug, 0x02, args)
46#define deb_xfer(args...) dprintk(dvb_usb_ce6230_debug, 0x04, args)
47#define deb_reg(args...) dprintk(dvb_usb_ce6230_debug, 0x08, args)
48#define deb_i2c(args...) dprintk(dvb_usb_ce6230_debug, 0x10, args)
49#define deb_fw(args...) dprintk(dvb_usb_ce6230_debug, 0x20, args)
50
51#define ce6230_debug_dump(r, t, v, i, b, l, func) { \
52 int loop_; \
53 func("%02x %02x %02x %02x %02x %02x %02x %02x", \
54 t, r, v & 0xff, v >> 8, i & 0xff, i >> 8, l & 0xff, l >> 8); \
55 if (t == (USB_TYPE_VENDOR | USB_DIR_OUT)) \ 31 if (t == (USB_TYPE_VENDOR | USB_DIR_OUT)) \
56 func(" >>> "); \ 32 direction = ">>>"; \
57 else \ 33 else \
58 func(" <<< "); \ 34 direction = "<<<"; \
59 for (loop_ = 0; loop_ < l; loop_++) \ 35 pr_debug("%s: %02x %02x %02x %02x %02x %02x %02x %02x %s [%d bytes]\n", \
60 func("%02x ", b[loop_]); \ 36 __func__, t, r, v & 0xff, v >> 8, i & 0xff, i >> 8, \
61 func("\n");\ 37 l & 0xff, l >> 8, direction, l); \
62} 38}
63 39
64#define CE6230_USB_TIMEOUT 1000 40#define CE6230_USB_TIMEOUT 1000
65 41
66struct req_t { 42struct usb_req {
67 u8 cmd; /* [1] */ 43 u8 cmd; /* [1] */
68 u16 value; /* [2|3] */ 44 u16 value; /* [2|3] */
69 u16 index; /* [4|5] */ 45 u16 index; /* [4|5] */