aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorManu Abraham <abraham.manu@gmail.com>2007-10-30 18:46:49 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 14:53:20 -0500
commitb168e351a50086e582d3cb42eb4336387ce1ddab (patch)
treee5ac1d69611c5ec81fc122f32229302d3ced6d50 /drivers
parent947881a999e8bcde98c9cb637316cb8026af4f71 (diff)
V4L/DVB (9435): Add post process interfaces
Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/frontends/stb0899_drv.c34
-rw-r--r--drivers/media/dvb/frontends/stb0899_drv.h43
2 files changed, 77 insertions, 0 deletions
diff --git a/drivers/media/dvb/frontends/stb0899_drv.c b/drivers/media/dvb/frontends/stb0899_drv.c
index 9f5254aee39..0b1d9447663 100644
--- a/drivers/media/dvb/frontends/stb0899_drv.c
+++ b/drivers/media/dvb/frontends/stb0899_drv.c
@@ -580,11 +580,35 @@ static void stb0899_set_mclk(struct stb0899_state *state, u32 Mclk)
580 dprintk(verbose, FE_DEBUG, 1, "MasterCLOCK=%d", internal->master_clk); 580 dprintk(verbose, FE_DEBUG, 1, "MasterCLOCK=%d", internal->master_clk);
581} 581}
582 582
583static int stb0899_postproc(struct stb0899_state *state, u8 ctl, int enable)
584{
585 struct stb0899_config *config = state->config;
586 struct stb0899_postproc *postproc = config->postproc;
587
588 /* post process event */
589 if (postproc) {
590 if (enable) {
591 if (postproc[STB0899_POSTPROC_GPIO_POWER].level == STB0899_GPIOPULLUP)
592 stb0899_write_reg(state, postproc[ctl].gpio, 0x02);
593 else
594 stb0899_write_reg(state, postproc[ctl].gpio, 0x82);
595 } else {
596 if (postproc[STB0899_POSTPROC_GPIO_POWER].level == STB0899_GPIOPULLUP)
597 stb0899_write_reg(state, postproc[ctl].gpio, 0x82);
598 else
599 stb0899_write_reg(state, postproc[ctl].gpio, 0x02);
600 }
601 }
602 return 0;
603}
604
583static void stb0899_release(struct dvb_frontend *fe) 605static void stb0899_release(struct dvb_frontend *fe)
584{ 606{
585 struct stb0899_state *state = fe->demodulator_priv; 607 struct stb0899_state *state = fe->demodulator_priv;
586 608
587 dprintk(verbose, FE_DEBUG, 1, "Release Frontend"); 609 dprintk(verbose, FE_DEBUG, 1, "Release Frontend");
610 /* post process event */
611 stb0899_postproc(state, STB0899_POSTPROC_GPIO_POWER, 0);
588 kfree(state); 612 kfree(state);
589} 613}
590 614
@@ -839,6 +863,9 @@ static int stb0899_sleep(struct dvb_frontend *fe)
839 u8 reg; 863 u8 reg;
840 864
841 dprintk(verbose, FE_DEBUG, 1, "Going to Sleep .. (Really tired .. :-))"); 865 dprintk(verbose, FE_DEBUG, 1, "Going to Sleep .. (Really tired .. :-))");
866 /* post process event */
867 stb0899_postproc(state, STB0899_POSTPROC_GPIO_POWER, 0);
868
842 return 0; 869 return 0;
843} 870}
844 871
@@ -855,6 +882,9 @@ static int stb0899_wakeup(struct dvb_frontend *fe)
855 if ((rc = stb0899_write_reg(state, STB0899_STOPCLK2, 0x00))) 882 if ((rc = stb0899_write_reg(state, STB0899_STOPCLK2, 0x00)))
856 return rc; 883 return rc;
857 884
885 /* post process event */
886 stb0899_postproc(state, STB0899_POSTPROC_GPIO_POWER, 1);
887
858 return 0; 888 return 0;
859} 889}
860 890
@@ -1050,6 +1080,8 @@ static int stb0899_read_status(struct dvb_frontend *fe, enum fe_status *status)
1050 if (STB0899_GETFIELD(VITCURPUN, reg)) { 1080 if (STB0899_GETFIELD(VITCURPUN, reg)) {
1051 dprintk(state->verbose, FE_DEBUG, 1, "--------> FE_HAS_VITERBI | FE_HAS_SYNC"); 1081 dprintk(state->verbose, FE_DEBUG, 1, "--------> FE_HAS_VITERBI | FE_HAS_SYNC");
1052 *status |= FE_HAS_VITERBI | FE_HAS_SYNC; 1082 *status |= FE_HAS_VITERBI | FE_HAS_SYNC;
1083 /* post process event */
1084 stb0899_postproc(state, STB0899_POSTPROC_GPIO_LOCK, 1);
1053 } 1085 }
1054 } 1086 }
1055 } 1087 }
@@ -1079,6 +1111,8 @@ static int stb0899_read_status(struct dvb_frontend *fe, enum fe_status *status)
1079 *status |= FE_HAS_SYNC; 1111 *status |= FE_HAS_SYNC;
1080 dprintk(state->verbose, FE_DEBUG, 1, 1112 dprintk(state->verbose, FE_DEBUG, 1,
1081 "Packet Delineator found SYNC ! -----> DVB-S2 FE_HAS_SYNC"); 1113 "Packet Delineator found SYNC ! -----> DVB-S2 FE_HAS_SYNC");
1114 /* post process event */
1115 stb0899_postproc(state, STB0899_POSTPROC_GPIO_LOCK, 1);
1082 } 1116 }
1083 } 1117 }
1084 } 1118 }
diff --git a/drivers/media/dvb/frontends/stb0899_drv.h b/drivers/media/dvb/frontends/stb0899_drv.h
index 1e28114febf..45136d9aaeb 100644
--- a/drivers/media/dvb/frontends/stb0899_drv.h
+++ b/drivers/media/dvb/frontends/stb0899_drv.h
@@ -50,6 +50,47 @@ enum stb0899_inversion {
50 IQ_SWAP_AUTO 50 IQ_SWAP_AUTO
51}; 51};
52 52
53#define STB0899_GPIO00 0xf140
54#define STB0899_GPIO01 0xf141
55#define STB0899_GPIO02 0xf142
56#define STB0899_GPIO03 0xf143
57#define STB0899_GPIO04 0xf144
58#define STB0899_GPIO05 0xf145
59#define STB0899_GPIO06 0xf146
60#define STB0899_GPIO07 0xf147
61#define STB0899_GPIO08 0xf148
62#define STB0899_GPIO09 0xf149
63#define STB0899_GPIO10 0xf14a
64#define STB0899_GPIO11 0xf14b
65#define STB0899_GPIO12 0xf14c
66#define STB0899_GPIO13 0xf14d
67#define STB0899_GPIO14 0xf14e
68#define STB0899_GPIO15 0xf14f
69#define STB0899_GPIO16 0xf150
70#define STB0899_GPIO17 0xf151
71#define STB0899_GPIO18 0xf152
72#define STB0899_GPIO19 0xf153
73#define STB0899_GPIO20 0xf154
74
75#define STB0899_GPIOPULLUP 0x01 /* Output device is connected to Vdd */
76#define STB0899_GPIOPULLDN 0x00 /* Output device is connected to Vss */
77
78#define STB0899_POSTPROC_GPIO_POWER 0x00
79#define STB0899_POSTPROC_GPIO_LOCK 0x01
80
81/*
82 * Post process output configuration control
83 * 1. POWER ON/OFF (index 0)
84 * 2. FE_HAS_LOCK/LOCK_LOSS (index 1)
85 *
86 * @gpio = one of the above listed GPIO's
87 * @level = output state: pulled up or low
88 */
89struct stb0899_postproc {
90 u16 gpio;
91 u8 level;
92};
93
53struct stb0899_config { 94struct stb0899_config {
54 const struct stb0899_s1_reg *init_dev; 95 const struct stb0899_s1_reg *init_dev;
55 const struct stb0899_s2_reg *init_s2_demod; 96 const struct stb0899_s2_reg *init_s2_demod;
@@ -57,6 +98,8 @@ struct stb0899_config {
57 const struct stb0899_s2_reg *init_s2_fec; 98 const struct stb0899_s2_reg *init_s2_fec;
58 const struct stb0899_s1_reg *init_tst; 99 const struct stb0899_s1_reg *init_tst;
59 100
101 const struct stb0899_postproc *postproc;
102
60 enum stb0899_inversion inversion; 103 enum stb0899_inversion inversion;
61 104
62 u32 xtal_freq; 105 u32 xtal_freq;