aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@linuxtv.org>2009-03-11 01:59:56 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:24 -0400
commit0c44bf362fc1f0dc927b814184d9b877a2f507cf (patch)
treee51f6fdaf033e98f3207489e85c68816ff74f818
parentf56738cd81690dcaec92307b1a7f9f5f69af15b1 (diff)
V4L/DVB (11061): au8522: move shared state and common functions into a separate header files
Move the au8522 state structure, as well as exposing functions needed by the analog side of the demodulator into a common header file. Thanks to Michael Krufky <mkrufky@linuxtv.org> and Steven Toth <stoth@linuxtv.org> for providing sample hardware, engineering level support, and testing. Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/dvb/frontends/au8522_dig.c25
-rw-r--r--drivers/media/dvb/frontends/au8522_priv.h57
2 files changed, 62 insertions, 20 deletions
diff --git a/drivers/media/dvb/frontends/au8522_dig.c b/drivers/media/dvb/frontends/au8522_dig.c
index eabf9a68e7ec..8082547c73e2 100644
--- a/drivers/media/dvb/frontends/au8522_dig.c
+++ b/drivers/media/dvb/frontends/au8522_dig.c
@@ -27,22 +27,7 @@
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include "dvb_frontend.h" 28#include "dvb_frontend.h"
29#include "au8522.h" 29#include "au8522.h"
30 30#include "au8522_priv.h"
31struct au8522_state {
32
33 struct i2c_adapter *i2c;
34
35 /* configuration settings */
36 const struct au8522_config *config;
37
38 struct dvb_frontend frontend;
39
40 u32 current_frequency;
41 fe_modulation_t current_modulation;
42
43 u32 fe_status;
44 unsigned int led_state;
45};
46 31
47static int debug; 32static int debug;
48 33
@@ -52,7 +37,7 @@ static int debug;
52 } while (0) 37 } while (0)
53 38
54/* 16 bit registers, 8 bit values */ 39/* 16 bit registers, 8 bit values */
55static int au8522_writereg(struct au8522_state *state, u16 reg, u8 data) 40int au8522_writereg(struct au8522_state *state, u16 reg, u8 data)
56{ 41{
57 int ret; 42 int ret;
58 u8 buf [] = { reg >> 8, reg & 0xff, data }; 43 u8 buf [] = { reg >> 8, reg & 0xff, data };
@@ -69,7 +54,7 @@ static int au8522_writereg(struct au8522_state *state, u16 reg, u8 data)
69 return (ret != 1) ? -1 : 0; 54 return (ret != 1) ? -1 : 0;
70} 55}
71 56
72static u8 au8522_readreg(struct au8522_state *state, u16 reg) 57u8 au8522_readreg(struct au8522_state *state, u16 reg)
73{ 58{
74 int ret; 59 int ret;
75 u8 b0 [] = { reg >> 8, reg & 0xff }; 60 u8 b0 [] = { reg >> 8, reg & 0xff };
@@ -528,7 +513,7 @@ static int au8522_set_frontend(struct dvb_frontend *fe,
528 513
529/* Reset the demod hardware and reset all of the configuration registers 514/* Reset the demod hardware and reset all of the configuration registers
530 to a default state. */ 515 to a default state. */
531static int au8522_init(struct dvb_frontend *fe) 516int au8522_init(struct dvb_frontend *fe)
532{ 517{
533 struct au8522_state *state = fe->demodulator_priv; 518 struct au8522_state *state = fe->demodulator_priv;
534 dprintk("%s()\n", __func__); 519 dprintk("%s()\n", __func__);
@@ -624,7 +609,7 @@ static int au8522_led_ctrl(struct au8522_state *state, int led)
624 return 0; 609 return 0;
625} 610}
626 611
627static int au8522_sleep(struct dvb_frontend *fe) 612int au8522_sleep(struct dvb_frontend *fe)
628{ 613{
629 struct au8522_state *state = fe->demodulator_priv; 614 struct au8522_state *state = fe->demodulator_priv;
630 dprintk("%s()\n", __func__); 615 dprintk("%s()\n", __func__);
diff --git a/drivers/media/dvb/frontends/au8522_priv.h b/drivers/media/dvb/frontends/au8522_priv.h
new file mode 100644
index 000000000000..569675d295d5
--- /dev/null
+++ b/drivers/media/dvb/frontends/au8522_priv.h
@@ -0,0 +1,57 @@
1/*
2 Auvitek AU8522 QAM/8VSB demodulator driver
3
4 Copyright (C) 2008 Steven Toth <stoth@linuxtv.org>
5 Copyright (C) 2008 Devin Heitmueller <dheitmueller@linuxtv.org>
6 Copyright (C) 2005-2008 Auvitek International, Ltd.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
22*/
23
24#include <linux/kernel.h>
25#include <linux/init.h>
26#include <linux/module.h>
27#include <linux/string.h>
28#include <linux/slab.h>
29#include <linux/delay.h>
30#include <linux/videodev2.h>
31#include <media/v4l2-device.h>
32#include <linux/i2c.h>
33#include "dvb_frontend.h"
34#include "au8522.h"
35#include "tuner-i2c.h"
36
37struct au8522_state {
38 struct i2c_adapter *i2c;
39
40 /* configuration settings */
41 const struct au8522_config *config;
42
43 struct dvb_frontend frontend;
44
45 u32 current_frequency;
46 fe_modulation_t current_modulation;
47
48 u32 fe_status;
49 unsigned int led_state;
50};
51
52/* These are routines shared by both the VSB/QAM demodulator and the analog
53 decoder */
54int au8522_writereg(struct au8522_state *state, u16 reg, u8 data);
55u8 au8522_readreg(struct au8522_state *state, u16 reg);
56int au8522_init(struct dvb_frontend *fe);
57int au8522_sleep(struct dvb_frontend *fe);