Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] Re: new fidbirq and hsync interrupt edge
On Sun, Jan 26, 2003 at 02:53:26AM +0100, Emard wrote:
> HI
>
> Better results are obtained in new fidbirq when triggering only
> on falling 0x*0680 (or rising) edge of the hsync (tested on tt13+budget
> patch).
As I have seen something is already applied (dmainit.patch.gz),
I took the opportunity to cosmetically shorten diseqc code.
These patches stand my frontend stability test and +-promisc test.
(please apply)
Best regards, Emard
diff -pur orig/dvb-kernel/linux/drivers/media/dvb/ttpci-budget/budget-core.c dvb-kernel/linux/drivers/media/dvb/ttpci-budget/budget-core.c
--- orig/dvb-kernel/linux/drivers/media/dvb/ttpci-budget/budget-core.c Thu Jan 23 20:00:03 2003
+++ dvb-kernel/linux/drivers/media/dvb/ttpci-budget/budget-core.c Sun Jan 26 10:07:15 2003
@@ -277,6 +277,160 @@ int budget_diseqc_ioctl (struct dvb_fron
return 0;
}
+/* Start of budget patch diseqc commands (EMARD)
+*/
+#define COMMAND (DPRAM_BASE + 0x0FC)
+#define DPRAM_BASE 0x4000
+#define DEBINOSWAP 0x000e0000
+
+typedef enum {
+ AudioDAC,
+ CabADAC,
+ ON22K,
+ OFF22K,
+ MainSwitch,
+ ADSwitch,
+ SendDiSEqC,
+ SetRegister
+} AUDCOM;
+
+typedef enum {
+ COMTYPE_NOCOM,
+ COMTYPE_PIDFILTER,
+ COMTYPE_MPEGDECODER,
+ COMTYPE_OSD,
+ COMTYPE_BMP,
+ COMTYPE_ENCODER,
+ COMTYPE_AUDIODAC,
+ COMTYPE_REQUEST,
+ COMTYPE_SYSTEM,
+ COMTYPE_REC_PLAY,
+ COMTYPE_COMMON_IF,
+ COMTYPE_PID_FILTER,
+ COMTYPE_PES,
+ COMTYPE_TS,
+ COMTYPE_VIDEO,
+ COMTYPE_AUDIO,
+ COMTYPE_CI_LL,
+} COMTYPE;
+
+static int wdebi(struct budget_s *budget,
+ u32 config, int addr, u32 val, int count)
+{
+ struct saa7146_dev *dev=budget->dev;
+
+ DEB_EE(("budget: %p\n", budget));
+
+ if (count <= 0 || count > 4)
+ return -1;
+
+ saa7146_write(dev, DEBI_CONFIG, config);
+
+ saa7146_write(dev, DEBI_AD, val );
+ saa7146_write(dev, DEBI_COMMAND, (count << 17) | (addr & 0xffff));
+ saa7146_write(dev, MC2, (2 << 16) | 2);
+ mdelay(5);
+
+ return 0;
+}
+
+static int SOutCommand(struct budget_s *budget, u16* buf, int length)
+{
+ int i;
+
+ DEB_EE(("budget: %p\n",budget));
+
+ for (i = 2; i < length; i++)
+ wdebi(budget, DEBINOSWAP, COMMAND + 2*i, (u32) buf[i], 2);
+
+ if (length)
+ wdebi(budget, DEBINOSWAP, COMMAND + 2, (u32) buf[1], 2);
+ else
+ wdebi(budget, DEBINOSWAP, COMMAND + 2, 0, 2);
+
+ wdebi(budget, DEBINOSWAP, COMMAND, (u32) buf[0], 2);
+ return 0;
+}
+
+static void
+av7110_Set22K(struct budget_s *budget, int state)
+{
+ u16 buf[2] = {( COMTYPE_AUDIODAC << 8) | (state ? ON22K : OFF22K), 0};
+
+ DEB_EE(("budget: %p\n", budget));
+ SOutCommand(budget, buf, 2);
+}
+
+static int
+av7110_SendDiSEqCMsg(struct budget_s *budget, int len, u8 *msg, int burst)
+{
+ int i;
+ u16 buf[18] = { ((COMTYPE_AUDIODAC << 8) | SendDiSEqC),
+ 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+ DEB_EE(("budget: %p\n", budget));
+
+ if (len>10)
+ len=10;
+
+ buf[1] = len+2;
+ buf[2] = len;
+
+ if (burst != -1)
+ buf[3]=burst ? 0x01 : 0x00;
+ else
+ buf[3]=0xffff;
+
+ for (i=0; i<len; i++)
+ buf[i+4]=msg[i];
+
+ SOutCommand(budget, buf, 18);
+ return 0;
+}
+
+static
+int av7110_diseqc_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg)
+{
+ struct budget_s *budget = fe->before_after_data;
+
+ DEB_EE(("budget: %p\n", budget));
+
+ switch (cmd) {
+ case FE_SET_TONE:
+ switch ((fe_sec_tone_mode_t) arg) {
+ case SEC_TONE_ON:
+ av7110_Set22K (budget, 1);
+ break;
+ case SEC_TONE_OFF:
+ av7110_Set22K (budget, 0);
+ break;
+ default:
+ return -EINVAL;
+ }
+ break;
+
+ case FE_DISEQC_SEND_MASTER_CMD:
+ {
+ struct dvb_diseqc_master_cmd *cmd = arg;
+
+ av7110_SendDiSEqCMsg (budget, cmd->msg_len, cmd->msg, 0);
+ break;
+ }
+
+ case FE_DISEQC_SEND_BURST:
+ av7110_SendDiSEqCMsg (budget, 0, NULL, (int) arg);
+ break;
+
+ default:
+ return -EOPNOTSUPP;
+ }
+
+ return 0;
+}
+/* End of budget patch diseqc commands (EMARD)
+*/
+
+
int budget_register(struct budget_s *budget)
{
int ret;
@@ -293,6 +447,9 @@ int budget_register(struct budget_s *bud
/* init DiSEqC stuff if necessary */
if(budget->card->type == BUDGET_TT)
dvb_add_frontend_ioctls (budget->dvb_adapter, budget_diseqc_ioctl, NULL, budget);
+
+ if(budget->card->type == BUDGET_PATCH)
+ dvb_add_frontend_ioctls (budget->dvb_adapter, av7110_diseqc_ioctl, NULL, budget);
memcpy(budget->demux_id, "demux0_0", 9);
budget->demux_id[5] = budget->dvb_adapter->num + '0';
diff -pur orig/dvb-kernel/linux/drivers/media/dvb/ttpci-budget/budget-core.c dvb-kernel/linux/drivers/media/dvb/ttpci-budget/budget-core.c
--- orig/dvb-kernel/linux/drivers/media/dvb/ttpci-budget/budget-core.c Thu Jan 23 20:00:03 2003
+++ dvb-kernel/linux/drivers/media/dvb/ttpci-budget/budget-core.c Sun Jan 26 02:09:32 2003
@@ -81,7 +81,10 @@ TTBStart(struct budget_s *budget)
budget->tsf=0xff;
budget->ttbp=0;
- saa7146_write(dev, DD1_INIT, 0x020006c0);
+ if (budget->card->type == BUDGET_PATCH)
+ saa7146_write(dev, DD1_INIT, 0x02000680);
+ else
+ saa7146_write(dev, DD1_INIT, 0x020006c0);
saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
saa7146_write(dev, BRS_CTRL, 0x60000000);
Home |
Main Index |
Thread Index