The patch number 9435 was added via Manu Abraham <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Manu Abraham  <[EMAIL PROTECTED]>
Add post process interfaces


Signed-off-by: Manu Abraham <[EMAIL PROTECTED]>


---

 linux/drivers/media/dvb/frontends/stb0899_drv.c |   34 ++++++++++++
 linux/drivers/media/dvb/frontends/stb0899_drv.h |   43 ++++++++++++++++
 2 files changed, 77 insertions(+)

diff -r edb9724a6baf -r 697f969b10c4 
linux/drivers/media/dvb/frontends/stb0899_drv.c
--- a/linux/drivers/media/dvb/frontends/stb0899_drv.c   Tue Oct 30 17:25:26 
2007 +0400
+++ b/linux/drivers/media/dvb/frontends/stb0899_drv.c   Wed Oct 31 02:46:49 
2007 +0400
@@ -580,11 +580,35 @@ static void stb0899_set_mclk(struct stb0
        dprintk(verbose, FE_DEBUG, 1, "MasterCLOCK=%d", internal->master_clk);
 }
 
+static int stb0899_postproc(struct stb0899_state *state, u8 ctl, int enable)
+{
+       struct stb0899_config *config           = state->config;
+       struct stb0899_postproc *postproc       = config->postproc;
+
+       /* post process event */
+       if (postproc) {
+               if (enable) {
+                       if (postproc[STB0899_POSTPROC_GPIO_POWER].level == 
STB0899_GPIOPULLUP)
+                               stb0899_write_reg(state, postproc[ctl].gpio, 
0x02);
+                       else
+                               stb0899_write_reg(state, postproc[ctl].gpio, 
0x82);
+               } else {
+                       if (postproc[STB0899_POSTPROC_GPIO_POWER].level == 
STB0899_GPIOPULLUP)
+                               stb0899_write_reg(state, postproc[ctl].gpio, 
0x82);
+                       else
+                               stb0899_write_reg(state, postproc[ctl].gpio, 
0x02);
+               }
+       }
+       return 0;
+}
+
 static void stb0899_release(struct dvb_frontend *fe)
 {
        struct stb0899_state *state = fe->demodulator_priv;
 
        dprintk(verbose, FE_DEBUG, 1, "Release Frontend");
+       /* post process event */
+       stb0899_postproc(state, STB0899_POSTPROC_GPIO_POWER, 0);
        kfree(state);
 }
 
@@ -880,6 +904,9 @@ static int stb0899_sleep(struct dvb_fron
        STB0899_SETFIELD_VAL(STANDBY, reg, 1);
        stb0899_write_reg(state, STB0899_SYNTCTRL, reg);
 #endif
+       /* post process event */
+       stb0899_postproc(state, STB0899_POSTPROC_GPIO_POWER, 0);
+
        return 0;
 }
 
@@ -895,6 +922,9 @@ static int stb0899_wakeup(struct dvb_fro
                return rc;
        if ((rc = stb0899_write_reg(state, STB0899_STOPCLK2, 0x00)))
                return rc;
+
+       /* post process event */
+       stb0899_postproc(state, STB0899_POSTPROC_GPIO_POWER, 1);
 
        return 0;
 }
@@ -1091,6 +1121,8 @@ static int stb0899_read_status(struct dv
                                if (STB0899_GETFIELD(VITCURPUN, reg)) {
                                        dprintk(state->verbose, FE_DEBUG, 1, 
"--------> FE_HAS_VITERBI | FE_HAS_SYNC");
                                        *status |= FE_HAS_VITERBI | FE_HAS_SYNC;
+                                       /* post process event */
+                                       stb0899_postproc(state, 
STB0899_POSTPROC_GPIO_LOCK, 1);
                                }
                        }
                }
@@ -1120,6 +1152,8 @@ static int stb0899_read_status(struct dv
                                        *status |= FE_HAS_SYNC;
                                        dprintk(state->verbose, FE_DEBUG, 1,
                                                "Packet Delineator found SYNC ! 
-----> DVB-S2 FE_HAS_SYNC");
+                                       /* post process event */
+                                       stb0899_postproc(state, 
STB0899_POSTPROC_GPIO_LOCK, 1);
                                }
                        }
                }
diff -r edb9724a6baf -r 697f969b10c4 
linux/drivers/media/dvb/frontends/stb0899_drv.h
--- a/linux/drivers/media/dvb/frontends/stb0899_drv.h   Tue Oct 30 17:25:26 
2007 +0400
+++ b/linux/drivers/media/dvb/frontends/stb0899_drv.h   Wed Oct 31 02:46:49 
2007 +0400
@@ -50,12 +50,55 @@ enum stb0899_inversion {
        IQ_SWAP_AUTO
 };
 
+#define STB0899_GPIO00                         0xf140
+#define STB0899_GPIO01                         0xf141
+#define STB0899_GPIO02                         0xf142
+#define STB0899_GPIO03                         0xf143
+#define STB0899_GPIO04                         0xf144
+#define STB0899_GPIO05                         0xf145
+#define STB0899_GPIO06                         0xf146
+#define STB0899_GPIO07                         0xf147
+#define STB0899_GPIO08                         0xf148
+#define STB0899_GPIO09                         0xf149
+#define STB0899_GPIO10                         0xf14a
+#define STB0899_GPIO11                         0xf14b
+#define STB0899_GPIO12                         0xf14c
+#define STB0899_GPIO13                         0xf14d
+#define STB0899_GPIO14                         0xf14e
+#define STB0899_GPIO15                         0xf14f
+#define STB0899_GPIO16                         0xf150
+#define STB0899_GPIO17                         0xf151
+#define STB0899_GPIO18                         0xf152
+#define STB0899_GPIO19                         0xf153
+#define STB0899_GPIO20                         0xf154
+
+#define STB0899_GPIOPULLUP                     0x01 /* Output device is 
connected to Vdd */
+#define STB0899_GPIOPULLDN                     0x00 /* Output device is 
connected to Vss */
+
+#define STB0899_POSTPROC_GPIO_POWER            0x00
+#define STB0899_POSTPROC_GPIO_LOCK             0x01
+
+/*
+ * Post process output configuration control
+ * 1. POWER ON/OFF             (index 0)
+ * 2. FE_HAS_LOCK/LOCK_LOSS    (index 1)
+ *
+ * @gpio       = one of the above listed GPIO's
+ * @level      = output state: pulled up or low
+ */
+struct stb0899_postproc {
+       u16     gpio;
+       u8      level;
+};
+
 struct stb0899_config {
        const struct stb0899_s1_reg     *init_dev;
        const struct stb0899_s2_reg     *init_s2_demod;
        const struct stb0899_s1_reg     *init_s1_demod;
        const struct stb0899_s2_reg     *init_s2_fec;
        const struct stb0899_s1_reg     *init_tst;
+
+       const struct stb0899_postproc   *postproc;
 
        enum stb0899_inversion          inversion;
 


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/697f969b10c4ba9e4c907260386229914f7af257

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to