aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2/pvrusb2-tuner.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-tuner.c')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-tuner.c121
1 files changed, 0 insertions, 121 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-tuner.c b/drivers/media/video/pvrusb2/pvrusb2-tuner.c
deleted file mode 100644
index ee9c9c139a8..00000000000
--- a/drivers/media/video/pvrusb2/pvrusb2-tuner.c
+++ /dev/null
@@ -1,121 +0,0 @@
1/*
2 *
3 *
4 * Copyright (C) 2005 Mike Isely <isely@pobox.com>
5 * Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#include "pvrusb2.h"
23#include "pvrusb2-util.h"
24#include "pvrusb2-tuner.h"
25#include "pvrusb2-hdw-internal.h"
26#include "pvrusb2-debug.h"
27#include <linux/videodev2.h>
28#include <media/tuner.h>
29#include <media/v4l2-common.h>
30
31
32struct pvr2_tuner_handler {
33 struct pvr2_hdw *hdw;
34 struct pvr2_i2c_client *client;
35 struct pvr2_i2c_handler i2c_handler;
36 int type_update_fl;
37};
38
39
40static void set_type(struct pvr2_tuner_handler *ctxt)
41{
42 struct pvr2_hdw *hdw = ctxt->hdw;
43 struct tuner_setup setup;
44 pvr2_trace(PVR2_TRACE_CHIPS,"i2c tuner set_type(%d)",hdw->tuner_type);
45 if (((int)(hdw->tuner_type)) < 0) return;
46
47 setup.addr = ADDR_UNSET;
48 setup.type = hdw->tuner_type;
49 setup.mode_mask = T_RADIO | T_ANALOG_TV;
50 /* We may really want mode_mask to be T_ANALOG_TV for now */
51 pvr2_i2c_client_cmd(ctxt->client,TUNER_SET_TYPE_ADDR,&setup);
52 ctxt->type_update_fl = 0;
53}
54
55
56static int tuner_check(struct pvr2_tuner_handler *ctxt)
57{
58 struct pvr2_hdw *hdw = ctxt->hdw;
59 if (hdw->tuner_updated) ctxt->type_update_fl = !0;
60 return ctxt->type_update_fl != 0;
61}
62
63
64static void tuner_update(struct pvr2_tuner_handler *ctxt)
65{
66 if (ctxt->type_update_fl) set_type(ctxt);
67}
68
69
70static void pvr2_tuner_detach(struct pvr2_tuner_handler *ctxt)
71{
72 ctxt->client->handler = NULL;
73 kfree(ctxt);
74}
75
76
77static unsigned int pvr2_tuner_describe(struct pvr2_tuner_handler *ctxt,char *buf,unsigned int cnt)
78{
79 return scnprintf(buf,cnt,"handler: pvrusb2-tuner");
80}
81
82
83static const struct pvr2_i2c_handler_functions tuner_funcs = {
84 .detach = (void (*)(void *))pvr2_tuner_detach,
85 .check = (int (*)(void *))tuner_check,
86 .update = (void (*)(void *))tuner_update,
87 .describe = (unsigned int (*)(void *,char *,unsigned int))pvr2_tuner_describe,
88};
89
90
91int pvr2_i2c_tuner_setup(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
92{
93 struct pvr2_tuner_handler *ctxt;
94 if (cp->handler) return 0;
95
96 ctxt = kzalloc(sizeof(*ctxt),GFP_KERNEL);
97 if (!ctxt) return 0;
98
99 ctxt->i2c_handler.func_data = ctxt;
100 ctxt->i2c_handler.func_table = &tuner_funcs;
101 ctxt->type_update_fl = !0;
102 ctxt->client = cp;
103 ctxt->hdw = hdw;
104 cp->handler = &ctxt->i2c_handler;
105 pvr2_trace(PVR2_TRACE_CHIPS,"i2c 0x%x tuner handler set up",
106 cp->client->addr);
107 return !0;
108}
109
110
111
112
113/*
114 Stuff for Emacs to see, in order to encourage consistent editing style:
115 *** Local Variables: ***
116 *** mode: c ***
117 *** fill-column: 70 ***
118 *** tab-width: 8 ***
119 *** c-basic-offset: 8 ***
120 *** End: ***
121 */