aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx23885
diff options
context:
space:
mode:
authorAbylay Ospan <aospan@netup.ru>2009-09-16 12:08:06 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:15:48 -0400
commit8386c27f4786482c569a0f53f78ca6624068ba10 (patch)
tree9855b50f70ca1ef46e1e3cef0bd7c218f77e0731 /drivers/media/video/cx23885
parent4f7cb8837cec65ade18b0e2655292fd98040234e (diff)
V4L/DVB (12956): Fix gpio mutex in NetUP Dual DVB-S2 CI card.
The card uses the same cx23885 gpio lines for two adapters. In case of there is several cards in system we must implement gpio mutex per cx23885 chip. Signed-off-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx23885')
-rw-r--r--drivers/media/video/cx23885/cimax2.c12
-rw-r--r--drivers/media/video/cx23885/cx23885-core.c1
-rw-r--r--drivers/media/video/cx23885/cx23885.h1
3 files changed, 8 insertions, 6 deletions
diff --git a/drivers/media/video/cx23885/cimax2.c b/drivers/media/video/cx23885/cimax2.c
index 0316257b7345..c04222ffb286 100644
--- a/drivers/media/video/cx23885/cimax2.c
+++ b/drivers/media/video/cx23885/cimax2.c
@@ -75,7 +75,6 @@ struct netup_ci_state {
75 void *priv; 75 void *priv;
76}; 76};
77 77
78struct mutex gpio_mutex;/* Two CiMax's uses same GPIO lines */
79 78
80int netup_read_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg, 79int netup_read_i2c(struct i2c_adapter *i2c_adap, u8 addr, u8 reg,
81 u8 *buf, int len) 80 u8 *buf, int len)
@@ -183,10 +182,11 @@ int netup_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot,
183 if (ret != 0) 182 if (ret != 0)
184 return ret; 183 return ret;
185 184
186 mutex_lock(&gpio_mutex); 185 mutex_lock(&dev->gpio_lock);
187 186
188 /* write addr */ 187 /* write addr */
189 cx_write(MC417_OEN, NETUP_EN_ALL); 188 cx_write(MC417_OEN, NETUP_EN_ALL);
189 msleep(2);
190 cx_write(MC417_RWD, NETUP_CTRL_OFF | 190 cx_write(MC417_RWD, NETUP_CTRL_OFF |
191 NETUP_ADLO | (0xff & addr)); 191 NETUP_ADLO | (0xff & addr));
192 cx_clear(MC417_RWD, NETUP_ADLO); 192 cx_clear(MC417_RWD, NETUP_ADLO);
@@ -194,9 +194,10 @@ int netup_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot,
194 NETUP_ADHI | (0xff & (addr >> 8))); 194 NETUP_ADHI | (0xff & (addr >> 8)));
195 cx_clear(MC417_RWD, NETUP_ADHI); 195 cx_clear(MC417_RWD, NETUP_ADHI);
196 196
197 if (read) /* data in */ 197 if (read) { /* data in */
198 cx_write(MC417_OEN, NETUP_EN_ALL | NETUP_DATA); 198 cx_write(MC417_OEN, NETUP_EN_ALL | NETUP_DATA);
199 else /* data out */ 199 msleep(2);
200 } else /* data out */
200 cx_write(MC417_RWD, NETUP_CTRL_OFF | data); 201 cx_write(MC417_RWD, NETUP_CTRL_OFF | data);
201 202
202 /* choose chip */ 203 /* choose chip */
@@ -206,7 +207,7 @@ int netup_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot,
206 cx_clear(MC417_RWD, (read) ? NETUP_RD : NETUP_WR); 207 cx_clear(MC417_RWD, (read) ? NETUP_RD : NETUP_WR);
207 mem = netup_ci_get_mem(dev); 208 mem = netup_ci_get_mem(dev);
208 209
209 mutex_unlock(&gpio_mutex); 210 mutex_unlock(&dev->gpio_lock);
210 211
211 if (!read) 212 if (!read)
212 if (mem < 0) 213 if (mem < 0)
@@ -403,7 +404,6 @@ int netup_ci_init(struct cx23885_tsport *port)
403 switch (port->nr) { 404 switch (port->nr) {
404 case 1: 405 case 1:
405 state->ci_i2c_addr = 0x40; 406 state->ci_i2c_addr = 0x40;
406 mutex_init(&gpio_mutex);
407 break; 407 break;
408 case 2: 408 case 2:
409 state->ci_i2c_addr = 0x41; 409 state->ci_i2c_addr = 0x41;
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c
index 40d438d7234d..c31284ba19dd 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -758,6 +758,7 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
758 int i; 758 int i;
759 759
760 mutex_init(&dev->lock); 760 mutex_init(&dev->lock);
761 mutex_init(&dev->gpio_lock);
761 762
762 atomic_inc(&dev->refcount); 763 atomic_inc(&dev->refcount);
763 764
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h
index 86f26947bb78..bee689104a20 100644
--- a/drivers/media/video/cx23885/cx23885.h
+++ b/drivers/media/video/cx23885/cx23885.h
@@ -325,6 +325,7 @@ struct cx23885_dev {
325 325
326 int nr; 326 int nr;
327 struct mutex lock; 327 struct mutex lock;
328 struct mutex gpio_lock;
328 329
329 /* board details */ 330 /* board details */
330 unsigned int board; 331 unsigned int board;