aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorYeasah Pell <yeasah@schwide.com>2006-04-13 10:40:59 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-05-12 18:55:05 -0400
commitdce1dfc2a5736bfc82df5d3fd6396022c7bbbbd8 (patch)
treed849c602c78f49b91ef051a14e2b0e9da2fe7a04 /drivers/media/dvb
parentcaf970e09c42843eb3b8456fc0e815f9b5385873 (diff)
V4L/DVB (3797): Always wait for diseqc queue to become ready before transmitting a diseqc message
The previous DISEQC code didn't wait, so it was unreliable Signed-off-by: Yeasah Pell <yeasah at schwide.net> Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/frontends/cx24123.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c
index 115ec169b641..fa6cdba08d25 100644
--- a/drivers/media/dvb/frontends/cx24123.c
+++ b/drivers/media/dvb/frontends/cx24123.c
@@ -687,15 +687,27 @@ static int cx24123_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage
687 return 0; 687 return 0;
688} 688}
689 689
690/* wait for diseqc queue to become ready (or timeout) */
691static void cx24123_wait_for_diseqc(struct cx24123_state *state)
692{
693 unsigned long timeout = jiffies + msecs_to_jiffies(200);
694 while (!(cx24123_readreg(state, 0x29) & 0x40)) {
695 if(time_after(jiffies, timeout)) {
696 printk("%s: diseqc queue not ready, command may be lost.\n", __FUNCTION__);
697 break;
698 }
699 msleep(10);
700 }
701}
702
690static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd) 703static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd)
691{ 704{
692 struct cx24123_state *state = fe->demodulator_priv; 705 struct cx24123_state *state = fe->demodulator_priv;
693 int i, val; 706 int i, val;
694 unsigned long timeout;
695 707
696 dprintk("%s:\n",__FUNCTION__); 708 dprintk("%s:\n",__FUNCTION__);
697 709
698 /* check if continuous tone has been stoped */ 710 /* check if continuous tone has been stopped */
699 if (state->config->use_isl6421) 711 if (state->config->use_isl6421)
700 val = cx24123_readlnbreg(state, 0x00) & 0x10; 712 val = cx24123_readlnbreg(state, 0x00) & 0x10;
701 else 713 else
@@ -707,6 +719,9 @@ static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma
707 return -ENOTSUPP; 719 return -ENOTSUPP;
708 } 720 }
709 721
722 /* wait for diseqc queue ready */
723 cx24123_wait_for_diseqc(state);
724
710 /* select tone mode */ 725 /* select tone mode */
711 cx24123_writereg(state, 0x2a, cx24123_readreg(state, 0x2a) & 0xf8); 726 cx24123_writereg(state, 0x2a, cx24123_readreg(state, 0x2a) & 0xf8);
712 727
@@ -716,9 +731,8 @@ static int cx24123_send_diseqc_msg(struct dvb_frontend* fe, struct dvb_diseqc_ma
716 val = cx24123_readreg(state, 0x29); 731 val = cx24123_readreg(state, 0x29);
717 cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40) | ((cmd->msg_len-3) & 3)); 732 cx24123_writereg(state, 0x29, ((val & 0x90) | 0x40) | ((cmd->msg_len-3) & 3));
718 733
719 timeout = jiffies + msecs_to_jiffies(100); 734 /* wait for diseqc message to finish sending */
720 while (!time_after(jiffies, timeout) && !(cx24123_readreg(state, 0x29) & 0x40)) 735 cx24123_wait_for_diseqc(state);
721 ; // wait for LNB ready
722 736
723 return 0; 737 return 0;
724} 738}
@@ -727,7 +741,6 @@ static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t
727{ 741{
728 struct cx24123_state *state = fe->demodulator_priv; 742 struct cx24123_state *state = fe->demodulator_priv;
729 int val; 743 int val;
730 unsigned long timeout;
731 744
732 dprintk("%s:\n", __FUNCTION__); 745 dprintk("%s:\n", __FUNCTION__);
733 746
@@ -743,6 +756,8 @@ static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t
743 return -ENOTSUPP; 756 return -ENOTSUPP;
744 } 757 }
745 758
759 cx24123_wait_for_diseqc(state);
760
746 /* select tone mode */ 761 /* select tone mode */
747 val = cx24123_readreg(state, 0x2a) & 0xf8; 762 val = cx24123_readreg(state, 0x2a) & 0xf8;
748 cx24123_writereg(state, 0x2a, val | 0x04); 763 cx24123_writereg(state, 0x2a, val | 0x04);
@@ -756,10 +771,7 @@ static int cx24123_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_cmd_t
756 else 771 else
757 return -EINVAL; 772 return -EINVAL;
758 773
759 774 cx24123_wait_for_diseqc(state);
760 timeout = jiffies + msecs_to_jiffies(100);
761 while (!time_after(jiffies, timeout) && !(cx24123_readreg(state, 0x29) & 0x40))
762 ; // wait for LNB ready
763 775
764 return 0; 776 return 0;
765} 777}