aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/telephony/ixj.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/telephony/ixj.c')
-rw-r--r--drivers/telephony/ixj.c116
1 files changed, 28 insertions, 88 deletions
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index f2c9fa423d40..f6704688ee8c 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -774,10 +774,7 @@ static int ixj_wink(IXJ *j)
774 j->pots_winkstart = jiffies; 774 j->pots_winkstart = jiffies;
775 SLIC_SetState(PLD_SLIC_STATE_OC, j); 775 SLIC_SetState(PLD_SLIC_STATE_OC, j);
776 776
777 while (time_before(jiffies, j->pots_winkstart + j->winktime)) { 777 msleep(jiffies_to_msecs(j->winktime));
778 set_current_state(TASK_INTERRUPTIBLE);
779 schedule_timeout(1);
780 }
781 778
782 SLIC_SetState(slicnow, j); 779 SLIC_SetState(slicnow, j);
783 return 0; 780 return 0;
@@ -1912,7 +1909,6 @@ static int ixj_pcmcia_cable_check(IXJ *j)
1912 1909
1913static int ixj_hookstate(IXJ *j) 1910static int ixj_hookstate(IXJ *j)
1914{ 1911{
1915 unsigned long det;
1916 int fOffHook = 0; 1912 int fOffHook = 0;
1917 1913
1918 switch (j->cardtype) { 1914 switch (j->cardtype) {
@@ -1943,11 +1939,7 @@ static int ixj_hookstate(IXJ *j)
1943 j->pld_slicr.bits.state == PLD_SLIC_STATE_STANDBY) { 1939 j->pld_slicr.bits.state == PLD_SLIC_STATE_STANDBY) {
1944 if (j->flags.ringing || j->flags.cringing) { 1940 if (j->flags.ringing || j->flags.cringing) {
1945 if (!in_interrupt()) { 1941 if (!in_interrupt()) {
1946 det = jiffies + (hertz / 50); 1942 msleep(20);
1947 while (time_before(jiffies, det)) {
1948 set_current_state(TASK_INTERRUPTIBLE);
1949 schedule_timeout(1);
1950 }
1951 } 1943 }
1952 SLIC_GetState(j); 1944 SLIC_GetState(j);
1953 if (j->pld_slicr.bits.state == PLD_SLIC_STATE_RINGING) { 1945 if (j->pld_slicr.bits.state == PLD_SLIC_STATE_RINGING) {
@@ -2062,7 +2054,7 @@ static void ixj_ring_start(IXJ *j)
2062static int ixj_ring(IXJ *j) 2054static int ixj_ring(IXJ *j)
2063{ 2055{
2064 char cntr; 2056 char cntr;
2065 unsigned long jif, det; 2057 unsigned long jif;
2066 2058
2067 j->flags.ringing = 1; 2059 j->flags.ringing = 1;
2068 if (ixj_hookstate(j) & 1) { 2060 if (ixj_hookstate(j) & 1) {
@@ -2070,7 +2062,6 @@ static int ixj_ring(IXJ *j)
2070 j->flags.ringing = 0; 2062 j->flags.ringing = 0;
2071 return 1; 2063 return 1;
2072 } 2064 }
2073 det = 0;
2074 for (cntr = 0; cntr < j->maxrings; cntr++) { 2065 for (cntr = 0; cntr < j->maxrings; cntr++) {
2075 jif = jiffies + (1 * hertz); 2066 jif = jiffies + (1 * hertz);
2076 ixj_ring_on(j); 2067 ixj_ring_on(j);
@@ -2080,8 +2071,7 @@ static int ixj_ring(IXJ *j)
2080 j->flags.ringing = 0; 2071 j->flags.ringing = 0;
2081 return 1; 2072 return 1;
2082 } 2073 }
2083 set_current_state(TASK_INTERRUPTIBLE); 2074 schedule_timeout_interruptible(1);
2084 schedule_timeout(1);
2085 if (signal_pending(current)) 2075 if (signal_pending(current))
2086 break; 2076 break;
2087 } 2077 }
@@ -2089,20 +2079,13 @@ static int ixj_ring(IXJ *j)
2089 ixj_ring_off(j); 2079 ixj_ring_off(j);
2090 while (time_before(jiffies, jif)) { 2080 while (time_before(jiffies, jif)) {
2091 if (ixj_hookstate(j) & 1) { 2081 if (ixj_hookstate(j) & 1) {
2092 det = jiffies + (hertz / 100); 2082 msleep(10);
2093 while (time_before(jiffies, det)) {
2094 set_current_state(TASK_INTERRUPTIBLE);
2095 schedule_timeout(1);
2096 if (signal_pending(current))
2097 break;
2098 }
2099 if (ixj_hookstate(j) & 1) { 2083 if (ixj_hookstate(j) & 1) {
2100 j->flags.ringing = 0; 2084 j->flags.ringing = 0;
2101 return 1; 2085 return 1;
2102 } 2086 }
2103 } 2087 }
2104 set_current_state(TASK_INTERRUPTIBLE); 2088 schedule_timeout_interruptible(1);
2105 schedule_timeout(1);
2106 if (signal_pending(current)) 2089 if (signal_pending(current))
2107 break; 2090 break;
2108 } 2091 }
@@ -2168,10 +2151,8 @@ static int ixj_release(struct inode *inode, struct file *file_p)
2168 * Set up locks to ensure that only one process is talking to the DSP at a time. 2151 * Set up locks to ensure that only one process is talking to the DSP at a time.
2169 * This is necessary to keep the DSP from locking up. 2152 * This is necessary to keep the DSP from locking up.
2170 */ 2153 */
2171 while(test_and_set_bit(board, (void *)&j->busyflags) != 0) { 2154 while(test_and_set_bit(board, (void *)&j->busyflags) != 0)
2172 set_current_state(TASK_INTERRUPTIBLE); 2155 schedule_timeout_interruptible(1);
2173 schedule_timeout(1);
2174 }
2175 if (ixjdebug & 0x0002) 2156 if (ixjdebug & 0x0002)
2176 printk(KERN_INFO "Closing board %d\n", NUM(inode)); 2157 printk(KERN_INFO "Closing board %d\n", NUM(inode));
2177 2158
@@ -3301,14 +3282,10 @@ static void ixj_write_cidcw(IXJ *j)
3301 ixj_play_tone(j, 23); 3282 ixj_play_tone(j, 23);
3302 3283
3303 clear_bit(j->board, &j->busyflags); 3284 clear_bit(j->board, &j->busyflags);
3304 while(j->tone_state) { 3285 while(j->tone_state)
3305 set_current_state(TASK_INTERRUPTIBLE); 3286 schedule_timeout_interruptible(1);
3306 schedule_timeout(1); 3287 while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0)
3307 } 3288 schedule_timeout_interruptible(1);
3308 while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0) {
3309 set_current_state(TASK_INTERRUPTIBLE);
3310 schedule_timeout(1);
3311 }
3312 if(ixjdebug & 0x0200) { 3289 if(ixjdebug & 0x0200) {
3313 printk("IXJ cidcw phone%d first tone end at %ld\n", j->board, jiffies); 3290 printk("IXJ cidcw phone%d first tone end at %ld\n", j->board, jiffies);
3314 } 3291 }
@@ -3328,14 +3305,10 @@ static void ixj_write_cidcw(IXJ *j)
3328 ixj_play_tone(j, 24); 3305 ixj_play_tone(j, 24);
3329 3306
3330 clear_bit(j->board, &j->busyflags); 3307 clear_bit(j->board, &j->busyflags);
3331 while(j->tone_state) { 3308 while(j->tone_state)
3332 set_current_state(TASK_INTERRUPTIBLE); 3309 schedule_timeout_interruptible(1);
3333 schedule_timeout(1); 3310 while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0)
3334 } 3311 schedule_timeout_interruptible(1);
3335 while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0) {
3336 set_current_state(TASK_INTERRUPTIBLE);
3337 schedule_timeout(1);
3338 }
3339 if(ixjdebug & 0x0200) { 3312 if(ixjdebug & 0x0200) {
3340 printk("IXJ cidcw phone%d sent second tone at %ld\n", j->board, jiffies); 3313 printk("IXJ cidcw phone%d sent second tone at %ld\n", j->board, jiffies);
3341 } 3314 }
@@ -3343,14 +3316,10 @@ static void ixj_write_cidcw(IXJ *j)
3343 j->cidcw_wait = jiffies + ((50 * hertz) / 100); 3316 j->cidcw_wait = jiffies + ((50 * hertz) / 100);
3344 3317
3345 clear_bit(j->board, &j->busyflags); 3318 clear_bit(j->board, &j->busyflags);
3346 while(!j->flags.cidcw_ack && time_before(jiffies, j->cidcw_wait)) { 3319 while(!j->flags.cidcw_ack && time_before(jiffies, j->cidcw_wait))
3347 set_current_state(TASK_INTERRUPTIBLE); 3320 schedule_timeout_interruptible(1);
3348 schedule_timeout(1); 3321 while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0)
3349 } 3322 schedule_timeout_interruptible(1);
3350 while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0) {
3351 set_current_state(TASK_INTERRUPTIBLE);
3352 schedule_timeout(1);
3353 }
3354 j->cidcw_wait = 0; 3323 j->cidcw_wait = 0;
3355 if(!j->flags.cidcw_ack) { 3324 if(!j->flags.cidcw_ack) {
3356 if(ixjdebug & 0x0200) { 3325 if(ixjdebug & 0x0200) {
@@ -6125,10 +6094,8 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd,
6125 * Set up locks to ensure that only one process is talking to the DSP at a time. 6094 * Set up locks to ensure that only one process is talking to the DSP at a time.
6126 * This is necessary to keep the DSP from locking up. 6095 * This is necessary to keep the DSP from locking up.
6127 */ 6096 */
6128 while(test_and_set_bit(board, (void *)&j->busyflags) != 0) { 6097 while(test_and_set_bit(board, (void *)&j->busyflags) != 0)
6129 set_current_state(TASK_INTERRUPTIBLE); 6098 schedule_timeout_interruptible(1);
6130 schedule_timeout(1);
6131 }
6132 if (ixjdebug & 0x0040) 6099 if (ixjdebug & 0x0040)
6133 printk("phone%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg); 6100 printk("phone%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg);
6134 if (minor >= IXJMAX) { 6101 if (minor >= IXJMAX) {
@@ -6694,8 +6661,6 @@ static struct file_operations ixj_fops =
6694 6661
6695static int ixj_linetest(IXJ *j) 6662static int ixj_linetest(IXJ *j)
6696{ 6663{
6697 unsigned long jifwait;
6698
6699 j->flags.pstncheck = 1; /* Testing */ 6664 j->flags.pstncheck = 1; /* Testing */
6700 j->flags.pstn_present = 0; /* Assume the line is not there */ 6665 j->flags.pstn_present = 0; /* Assume the line is not there */
6701 6666
@@ -6726,11 +6691,7 @@ static int ixj_linetest(IXJ *j)
6726 6691
6727 outb_p(j->pld_scrw.byte, j->XILINXbase); 6692 outb_p(j->pld_scrw.byte, j->XILINXbase);
6728 daa_set_mode(j, SOP_PU_CONVERSATION); 6693 daa_set_mode(j, SOP_PU_CONVERSATION);
6729 jifwait = jiffies + hertz; 6694 msleep(1000);
6730 while (time_before(jiffies, jifwait)) {
6731 set_current_state(TASK_INTERRUPTIBLE);
6732 schedule_timeout(1);
6733 }
6734 daa_int_read(j); 6695 daa_int_read(j);
6735 daa_set_mode(j, SOP_PU_RESET); 6696 daa_set_mode(j, SOP_PU_RESET);
6736 if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) { 6697 if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) {
@@ -6750,11 +6711,7 @@ static int ixj_linetest(IXJ *j)
6750 j->pld_slicw.bits.rly3 = 0; 6711 j->pld_slicw.bits.rly3 = 0;
6751 outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); 6712 outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01);
6752 daa_set_mode(j, SOP_PU_CONVERSATION); 6713 daa_set_mode(j, SOP_PU_CONVERSATION);
6753 jifwait = jiffies + hertz; 6714 msleep(1000);
6754 while (time_before(jiffies, jifwait)) {
6755 set_current_state(TASK_INTERRUPTIBLE);
6756 schedule_timeout(1);
6757 }
6758 daa_int_read(j); 6715 daa_int_read(j);
6759 daa_set_mode(j, SOP_PU_RESET); 6716 daa_set_mode(j, SOP_PU_RESET);
6760 if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) { 6717 if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) {
@@ -6783,7 +6740,6 @@ static int ixj_linetest(IXJ *j)
6783static int ixj_selfprobe(IXJ *j) 6740static int ixj_selfprobe(IXJ *j)
6784{ 6741{
6785 unsigned short cmd; 6742 unsigned short cmd;
6786 unsigned long jif;
6787 int cnt; 6743 int cnt;
6788 BYTES bytes; 6744 BYTES bytes;
6789 6745
@@ -6933,29 +6889,13 @@ static int ixj_selfprobe(IXJ *j)
6933 } else { 6889 } else {
6934 if (j->cardtype == QTI_LINEJACK) { 6890 if (j->cardtype == QTI_LINEJACK) {
6935 LED_SetState(0x1, j); 6891 LED_SetState(0x1, j);
6936 jif = jiffies + (hertz / 10); 6892 msleep(100);
6937 while (time_before(jiffies, jif)) {
6938 set_current_state(TASK_INTERRUPTIBLE);
6939 schedule_timeout(1);
6940 }
6941 LED_SetState(0x2, j); 6893 LED_SetState(0x2, j);
6942 jif = jiffies + (hertz / 10); 6894 msleep(100);
6943 while (time_before(jiffies, jif)) {
6944 set_current_state(TASK_INTERRUPTIBLE);
6945 schedule_timeout(1);
6946 }
6947 LED_SetState(0x4, j); 6895 LED_SetState(0x4, j);
6948 jif = jiffies + (hertz / 10); 6896 msleep(100);
6949 while (time_before(jiffies, jif)) {
6950 set_current_state(TASK_INTERRUPTIBLE);
6951 schedule_timeout(1);
6952 }
6953 LED_SetState(0x8, j); 6897 LED_SetState(0x8, j);
6954 jif = jiffies + (hertz / 10); 6898 msleep(100);
6955 while (time_before(jiffies, jif)) {
6956 set_current_state(TASK_INTERRUPTIBLE);
6957 schedule_timeout(1);
6958 }
6959 LED_SetState(0x0, j); 6899 LED_SetState(0x0, j);
6960 daa_get_version(j); 6900 daa_get_version(j);
6961 if (ixjdebug & 0x0002) 6901 if (ixjdebug & 0x0002)