aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2/pvrusb2-dvb.c
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2008-04-21 02:47:43 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:09:49 -0400
commit1cb03b76d09d20accfa5c1664c16ba6566f539a0 (patch)
tree8c58f23151ab54f71472b80f6d0d29df25ddbb9f /drivers/media/video/pvrusb2/pvrusb2-dvb.c
parentd3f8d8fb304a8b9a81eae16ff7b50f5379f2437e (diff)
V4L/DVB (7719): pvrusb2: Implement input selection enforcement
In the pvrusb2 driver, different interfaces (e.g. V4L, DVB) have Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-dvb.c')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-dvb.c47
1 files changed, 21 insertions, 26 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-dvb.c b/drivers/media/video/pvrusb2/pvrusb2-dvb.c
index c20eef0f077..2e64f98d124 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-dvb.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-dvb.c
@@ -244,13 +244,10 @@ static int pvr2_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
244 244
245static int pvr2_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire) 245static int pvr2_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire)
246{ 246{
247 /* TO DO: This function will call into the core and request for 247 struct pvr2_dvb_adapter *adap = fe->dvb->priv;
248 * input to be set to 'dtv' if (acquire) and if it isn't set already. 248 return pvr2_channel_limit_inputs(
249 * 249 &adap->channel,
250 * If (!acquire) then we should do nothing -- don't switch inputs 250 (acquire ? (1 << PVR2_CVAL_INPUT_DTV) : 0));
251 * again unless the analog side of the driver requests the bus.
252 */
253 return 0;
254} 251}
255 252
256static int pvr2_dvb_adapter_init(struct pvr2_dvb_adapter *adap) 253static int pvr2_dvb_adapter_init(struct pvr2_dvb_adapter *adap)
@@ -320,32 +317,26 @@ static int pvr2_dvb_frontend_init(struct pvr2_dvb_adapter *adap)
320{ 317{
321 struct pvr2_hdw *hdw = adap->channel.hdw; 318 struct pvr2_hdw *hdw = adap->channel.hdw;
322 struct pvr2_dvb_props *dvb_props = hdw->hdw_desc->dvb_props; 319 struct pvr2_dvb_props *dvb_props = hdw->hdw_desc->dvb_props;
323 int ret; 320 int ret = 0;
324 321
325 if (dvb_props == NULL) { 322 if (dvb_props == NULL) {
326 err("fe_props not defined!"); 323 err("fe_props not defined!");
327 return -EINVAL; 324 return -EINVAL;
328 } 325 }
329 326
330 /* FIXME: This code should be moved into the core, 327 ret = pvr2_channel_limit_inputs(
331 * and should only be called if we don't already have 328 &adap->channel,
332 * control of the bus. 329 (1 << PVR2_CVAL_INPUT_DTV));
333 * 330 if (ret) {
334 * We can't call "pvr2_dvb_bus_ctrl(adap->fe, 1)" from here, 331 err("failed to grab control of dtv input (code=%d)",
335 * because adap->fe isn't defined yet. 332 ret);
336 */
337 ret = pvr2_ctrl_set_value(pvr2_hdw_get_ctrl_by_id(hdw,
338 PVR2_CID_INPUT),
339 PVR2_CVAL_INPUT_DTV);
340 if (ret != 0)
341 return ret; 333 return ret;
342 334 }
343 pvr2_hdw_commit_ctl(hdw);
344
345 335
346 if (dvb_props->frontend_attach == NULL) { 336 if (dvb_props->frontend_attach == NULL) {
347 err("frontend_attach not defined!"); 337 err("frontend_attach not defined!");
348 return -EINVAL; 338 ret = -EINVAL;
339 goto done;
349 } 340 }
350 341
351 if ((dvb_props->frontend_attach(adap) == 0) && (adap->fe)) { 342 if ((dvb_props->frontend_attach(adap) == 0) && (adap->fe)) {
@@ -354,7 +345,8 @@ static int pvr2_dvb_frontend_init(struct pvr2_dvb_adapter *adap)
354 err("frontend registration failed!"); 345 err("frontend registration failed!");
355 dvb_frontend_detach(adap->fe); 346 dvb_frontend_detach(adap->fe);
356 adap->fe = NULL; 347 adap->fe = NULL;
357 return -ENODEV; 348 ret = -ENODEV;
349 goto done;
358 } 350 }
359 351
360 if (dvb_props->tuner_attach) 352 if (dvb_props->tuner_attach)
@@ -368,10 +360,13 @@ static int pvr2_dvb_frontend_init(struct pvr2_dvb_adapter *adap)
368 360
369 } else { 361 } else {
370 err("no frontend was attached!"); 362 err("no frontend was attached!");
371 return -ENODEV; 363 ret = -ENODEV;
364 return ret;
372 } 365 }
373 366
374 return 0; 367 done:
368 pvr2_channel_limit_inputs(&adap->channel, 0);
369 return ret;
375} 370}
376 371
377static int pvr2_dvb_frontend_exit(struct pvr2_dvb_adapter *adap) 372static int pvr2_dvb_frontend_exit(struct pvr2_dvb_adapter *adap)