Review Board 1.7.16


Generate VMWI neon pulses from FXS module to light NEON lamp on older 'non intellegent phones'

Review Request #1144 - Created March 16, 2011 and updated

Alec Davis
dahdi/linux
14261
Reviewers
asterisk-dev
sruffell
DAHDI
Implement same code as for wcdtm
13/04/12
Tested with mwisendtype=lrev,hvac
at 2 different phones on same FXS port, one a real neon phone, and another a led+zener phone.
Left messages, and neon would flash as expected.

Changes between revision 1 and 3

1 2 3 4 5 6 7
1 2 3 4 5 6 7

  1. linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c: Loading...
linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c
Diff Revision 1 Diff Revision 3
[20] 105 lines
[+20] [+] static int loopcurrent = 20;
106
 * 	overall polarity reversal for the module,
106
 * 	overall polarity reversal for the module,
107
 * 	polarity reversal for the port,
107
 * 	polarity reversal for the port,
108
 * 	and the state of the line reversal MWI indicator
108
 * 	and the state of the line reversal MWI indicator
109
 */
109
 */
110
#define POLARITY_XOR(fxs) \
110
#define POLARITY_XOR(fxs) \
111
	( (reversepolarity != 0) ^ ((fxs)->reversepolarity != 0) ^ \
111
	((reversepolarity != 0) ^ ((fxs)->reversepolarity != 0) ^ \
112
	((fxs)->vmwi_linereverse != 0) ^ (((fxs)->vmwisetting.vmwi_type & DAHDI_VMWI_HVAC) != 0) )
112
	((fxs)->vmwi_linereverse != 0) ^ (((fxs)->vmwisetting.vmwi_type & DAHDI_VMWI_HVAC) != 0))
113

    
   
113

   
114
static int reversepolarity = 0;
114
static int reversepolarity = 0;
115

    
   
115

   
116
static alpha  indirect_regs[] =
116
static alpha  indirect_regs[] =
117
{
117
{
[+20] [20] 1318 lines
[+20] [+] wctdm_proslic_setreg_indirect(struct wctdm *wc, struct wctdm_module *const mod,
1436
	};
1436
	};
1437
	return res;
1437
	return res;
1438
}
1438
}
1439

    
   
1439

   
1440
static int
1440
static int

    
   
1441
wctdm_proslic_setreg_indirect_intr(struct wctdm *wc, struct wctdm_module *const mod,

    
   
1442
			      unsigned char address, unsigned short data)

    
   
1443
{

    
   
1444
	int res = -1;

    
   
1445

   

    
   
1446
	address = translate_3215(address);

    
   
1447
	if (address == 255)

    
   
1448
		return 0;

    
   
1449

   

    
   
1450
//	if (!wait_access(wc, mod)) {

    
   
1451
		wctdm_setreg_intr(wc, mod, IDA_LO, (u8)(data & 0xFF));

    
   
1452
		wctdm_setreg_intr(wc, mod, IDA_HI, (u8)((data & 0xFF00)>>8));

    
   
1453
		wctdm_setreg_intr(wc, mod, IAA, address);

    
   
1454
		res = 0;

    
   
1455
//	};

    
   
1456
	return res;

    
   
1457
}

    
   
1458

   

    
   
1459
static int
1441
wctdm_proslic_getreg_indirect(struct wctdm *wc, struct wctdm_module *const mod,
1460
wctdm_proslic_getreg_indirect(struct wctdm *wc, struct wctdm_module *const mod,
1442
			      unsigned char address)
1461
			      unsigned char address)
1443
{ 
1462
{ 
1444
	int res = -1;
1463
	int res = -1;
1445
	char *p=NULL;
1464
	char *p=NULL;
[+20] [20] 174 lines
[+20] [+] wctdm_proslic_recheck_sanity(struct wctdm *wc, struct wctdm_module *const mod)
1620
			dev_notice(&wc->vb.pdev->dev,
1639
			dev_notice(&wc->vb.pdev->dev,
1621
				   "Power alarm on module %d, resetting!\n",
1640
				   "Power alarm on module %d, resetting!\n",
1622
				   mod->card + 1);
1641
				   mod->card + 1);
1623
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
1642
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
1624
			if (fxs->lasttxhook == SLIC_LF_RINGING) {
1643
			if (fxs->lasttxhook == SLIC_LF_RINGING) {
1625
				fxs->lasttxhook = (POLARITY_XOR(fxs)) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;
1644
				fxs->lasttxhook = POLARITY_XOR(fxs) ?

    
   
1645
							SLIC_LF_ACTIVE_REV :

    
   
1646
							SLIC_LF_ACTIVE_FWD;
1626
			}
1647
			}
1627
			fxs->lasttxhook |= SLIC_LF_OPPENDING;
1648
			fxs->lasttxhook |= SLIC_LF_OPPENDING;
1628
			mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
1649
			mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
1629
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
1650
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
1630

    
   
1651

   
[+20] [20] 381 lines
[+20] [+] wctdm_fxs_hooksig(struct wctdm *wc, struct wctdm_module *const mod,
2012
	spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2033
	spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2013
	switch (txsig) {
2034
	switch (txsig) {
2014
	case DAHDI_TXSIG_ONHOOK:
2035
	case DAHDI_TXSIG_ONHOOK:
2015
		switch (mod->chan->chan.sig) {
2036
		switch (mod->chan->chan.sig) {
2016
		case DAHDI_SIG_EM:
2037
		case DAHDI_SIG_EM:
2017
			x =	fxs->idletxhookstate;
2038
			x = fxs->idletxhookstate;
2018
			break;
2039
			break;
2019
		case DAHDI_SIG_FXOKS:
2040
		case DAHDI_SIG_FXOKS:
2020
		case DAHDI_SIG_FXOLS:
2041
		case DAHDI_SIG_FXOLS:
2021
			/* Can't change Ring Generator during OHT */
2042
			/* Can't change Ring Generator during OHT */
2022
			if (!fxs->ohttimer){
2043
			if (!fxs->ohttimer){
2023
				wctdm_set_ring_generator_mode(wc, mod, fxs->vmwi_hvac);
2044
				wctdm_set_ring_generator_mode(wc, mod, fxs->vmwi_hvac);
2024
				x = fxs->vmwi_hvac ? SLIC_LF_RINGING : fxs->idletxhookstate;
2045
				x = fxs->vmwi_hvac ?
2025
			}else{
2046
					SLIC_LF_RINGING : fxs->idletxhookstate;
2026
				x =	fxs->idletxhookstate;
2047
			} else
2027
			}
2048
				x = fxs->idletxhookstate;

    
   
2049

   
2028
			break;
2050
			break;
2029
		case DAHDI_SIG_FXOGS:
2051
		case DAHDI_SIG_FXOGS:
2030
			x = (POLARITY_XOR(fxs)) ?
2052
			x = POLARITY_XOR(fxs) ?
2031
					SLIC_LF_RING_OPEN :
2053
					SLIC_LF_RING_OPEN :
2032
					SLIC_LF_TIP_OPEN;
2054
					SLIC_LF_TIP_OPEN;
2033
			break;
2055
			break;
2034
		}
2056
		}
2035
		break;
2057
		break;
2036
	case DAHDI_TXSIG_OFFHOOK:
2058
	case DAHDI_TXSIG_OFFHOOK:
2037
		switch (mod->chan->chan.sig) {
2059
		switch (mod->chan->chan.sig) {
2038
		case DAHDI_SIG_EM:
2060
		case DAHDI_SIG_EM:
2039
			x = (POLARITY_XOR(fxs)) ?
2061
			x = POLARITY_XOR(fxs) ?
2040
					SLIC_LF_ACTIVE_FWD :
2062
					SLIC_LF_ACTIVE_FWD :
2041
					SLIC_LF_ACTIVE_REV;
2063
					SLIC_LF_ACTIVE_REV;
2042
			break;
2064
			break;
2043
		default:
2065
		default:
2044
			x = fxs->idletxhookstate;
2066
			x = fxs->idletxhookstate;
[+20] [20] 39 lines
[+20] [+] static void wctdm_fxs_off_hook(struct wctdm *wc, struct wctdm_module *const mod)
2084
	switch (fxs->lasttxhook) {
2106
	switch (fxs->lasttxhook) {
2085
	case SLIC_LF_RINGING:		/* Ringing */
2107
	case SLIC_LF_RINGING:		/* Ringing */
2086
	case SLIC_LF_OHTRAN_FWD:	/* Forward On Hook Transfer */
2108
	case SLIC_LF_OHTRAN_FWD:	/* Forward On Hook Transfer */
2087
	case SLIC_LF_OHTRAN_REV:	/* Reverse On Hook Transfer */
2109
	case SLIC_LF_OHTRAN_REV:	/* Reverse On Hook Transfer */
2088
		/* just detected OffHook, during Ringing or OnHookTransfer */
2110
		/* just detected OffHook, during Ringing or OnHookTransfer */
2089
		fxs->idletxhookstate = (POLARITY_XOR(fxs)) ?
2111
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?
2090
						SLIC_LF_ACTIVE_REV :
2112
						SLIC_LF_ACTIVE_REV :
2091
						SLIC_LF_ACTIVE_FWD;
2113
						SLIC_LF_ACTIVE_FWD;
2092
		break;
2114
		break;
2093
	}
2115
	}
2094
	wctdm_fxs_hooksig(wc, mod, DAHDI_TXSIG_OFFHOOK);
2116
	wctdm_fxs_hooksig(wc, mod, DAHDI_TXSIG_OFFHOOK);
[+20] [20] 128 lines
[+20] [+] static void wctdm_isr_misc_fxs(struct wctdm *wc, struct wctdm_module *const mod)
2223

    
   
2245

   
2224
	wctdm_proslic_check_oppending(wc, mod);
2246
	wctdm_proslic_check_oppending(wc, mod);
2225

    
   
2247

   
2226
	if (!(wc->intcount & 0xfc))	/* every 256ms */
2248
	if (!(wc->intcount & 0xfc))	/* every 256ms */
2227
		wctdm_proslic_recheck_sanity(wc, mod);
2249
		wctdm_proslic_recheck_sanity(wc, mod);
2228
	if ((SLIC_LF_RINGING == fxs->lasttxhook) && fxs->neonringing ) {
2250
	if ((SLIC_LF_RINGING == fxs->lasttxhook) && fxs->neonringing) {
2229
		/* RINGing, prepare for OHT */
2251
		/* RINGing, prepare for OHT */
2230
		fxs->ohttimer = OHT_TIMER << 3;
2252
		fxs->ohttimer = OHT_TIMER << 3;
2231
		/* OHT mode when idle */
2253
		/* OHT mode when idle */
2232
		fxs->idletxhookstate = (POLARITY_XOR(fxs)) ? SLIC_LF_OHTRAN_REV :
2254
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?

    
   
2255
						SLIC_LF_OHTRAN_REV :
2233
							    SLIC_LF_OHTRAN_FWD;
2256
						SLIC_LF_OHTRAN_FWD;
2234
	} else if (fxs->ohttimer) {
2257
	} else if (fxs->ohttimer) {
2235
		 /* check if still OnHook */
2258
		 /* check if still OnHook */
2236
		if (!fxs->oldrxhook) {
2259
		if (!fxs->oldrxhook) {
2237
			fxs->ohttimer -= DAHDI_CHUNKSIZE;
2260
			fxs->ohttimer -= DAHDI_CHUNKSIZE;
2238
			if (fxs->ohttimer)
2261
			if (fxs->ohttimer)
2239
				return;
2262
				return;
2240

    
   
2263

   
2241
			/* Switch to active */
2264
			/* Switch to active */
2242
			fxs->idletxhookstate = (POLARITY_XOR(fxs)) ? SLIC_LF_ACTIVE_REV :
2265
			fxs->idletxhookstate = POLARITY_XOR(fxs) ?

    
   
2266
							SLIC_LF_ACTIVE_REV :
2243
								    SLIC_LF_ACTIVE_FWD;
2267
							SLIC_LF_ACTIVE_FWD;
2244
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2268
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2245

    
   
2269

   
2246
			if ((SLIC_LF_OHTRAN_FWD == fxs->lasttxhook) || (SLIC_LF_OHTRAN_REV == fxs->lasttxhook)) {
2270
			if ((SLIC_LF_OHTRAN_FWD == fxs->lasttxhook) ||

    
   
2271
				(SLIC_LF_OHTRAN_REV == fxs->lasttxhook)) {
2247
				if (fxs->vmwi_hvac){
2272
				if (fxs->vmwi_hvac){
2248
					/* force idle polarity Forward if ringing */
2273
					/* force idle polarity Forward if ringing */
2249
					fxs->idletxhookstate = SLIC_LF_ACTIVE_FWD;
2274
					fxs->idletxhookstate = SLIC_LF_ACTIVE_FWD;
2250
					/* Set ring generator for neon */
2275
					/* Set ring generator for neon */
2251
					wctdm_set_ring_generator_mode(wc, mod, 1);
2276
					wctdm_set_ring_generator_mode(wc, mod, 1);
2252
					fxs->lasttxhook = (SLIC_LF_OPPENDING | SLIC_LF_RINGING );
2277
					fxs->lasttxhook = (SLIC_LF_OPPENDING |
2253
				} else {
2278
							SLIC_LF_RINGING);
2254
					fxs->lasttxhook = (fxs->idletxhookstate | SLIC_LF_OPPENDING);
2279
				} else
2255
				}
2280
					fxs->lasttxhook = (SLIC_LF_OPPENDING |

    
   
2281
							fxs->idletxhookstate);

    
   
2282

   
2256
				/* Data enqueued here */
2283
				/* Data enqueued here */
2257
				mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
2284
				mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
2258
				if (debug & DEBUG_CARD) {
2285
				if (debug & DEBUG_CARD) {
2259
					dev_info(&wc->vb.pdev->dev,
2286
					dev_info(&wc->vb.pdev->dev,
2260
						 "Channel %d OnHookTransfer "
2287
						 "Channel %d OnHookTransfer "
2261
						 "stop\n", mod->card);
2288
						 "stop\n", mod->card);
2262
				}
2289
				}
2263
			}
2290
			}
2264
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
2291
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
2265
		} else {
2292
		} else {
2266
			fxs->ohttimer = 0;
2293
			fxs->ohttimer = 0;
2267
			/* Switch to active */
2294
			/* Switch to active */
2268
			fxs->idletxhookstate = (POLARITY_XOR(fxs)) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;
2295
			fxs->idletxhookstate = POLARITY_XOR(fxs) ?

    
   
2296
							SLIC_LF_ACTIVE_REV :

    
   
2297
							SLIC_LF_ACTIVE_FWD;
2269
			if (debug & DEBUG_CARD) {
2298
			if (debug & DEBUG_CARD) {
2270
				dev_info(&wc->vb.pdev->dev,
2299
				dev_info(&wc->vb.pdev->dev,
2271
					 "Channel %d OnHookTransfer abort\n",
2300
					 "Channel %d OnHookTransfer abort\n",
2272
					 mod->card);
2301
					 mod->card);
2273
			}
2302
			}
2274
		}
2303
		}
2275

    
   

   
2276
	}
2304
	}
2277
}
2305
}
2278

    
   
2306

   
2279
/* 1ms interrupt */
2307
/* 1ms interrupt */
2280
static inline void wctdm_isr_misc(struct wctdm *wc)
2308
static inline void wctdm_isr_misc(struct wctdm *wc)
[+20] [20] 493 lines
[+20] [+] static int set_vmwi(struct wctdm *wc, struct wctdm_module *const mod)
2774
	} else {
2802
	} else {
2775
		fxs->vmwi_linereverse = 0;
2803
		fxs->vmwi_linereverse = 0;
2776
		fxs->vmwi_hvac = 0;
2804
		fxs->vmwi_hvac = 0;
2777
	}
2805
	}
2778

    
   
2806

   
2779
	if (fxs->vmwi_hvac){
2807
	if (fxs->vmwi_hvac) {
2780
		/* Can't change ring generator while On Hook Transfer might be happening */
2808
		/* Can't change ring generator while On Hook Transfer might be happening */
2781
		if (!fxs->ohttimer) {
2809
		if (!fxs->ohttimer) {
2782
			/* Set line polarity for new VMWI state */
2810
			/* Set line polarity for new VMWI state */
2783
			if (POLARITY_XOR(fxs)) {
2811
			if (POLARITY_XOR(fxs))
2784
				fxs->idletxhookstate |= SLIC_LF_RINGING;
2812
				fxs->idletxhookstate |= SLIC_LF_RINGING;
2785
			} else {
2813
			else
2786
				fxs->idletxhookstate &= ~SLIC_LF_RINGING;
2814
				fxs->idletxhookstate &= ~SLIC_LF_RINGING;
2787
			}
2815

   
2788
			/* Set ring generator for neon */
2816
			/* Set ring generator for neon */
2789
			wctdm_set_ring_generator_mode(wc, mod, 1);
2817
			wctdm_set_ring_generator_mode(wc, mod, 1);
2790
			set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);
2818
			set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);
2791
		}
2819
		}
2792
	} else {
2820
	} else {
2793
		if (fxs->neonringing){
2821
		if (fxs->neonringing){
2794
			/* Set ring generator for normal ringer */
2822
			/* Set ring generator for normal ringer */
2795
			wctdm_set_ring_generator_mode(wc, mod, 0);
2823
			wctdm_set_ring_generator_mode(wc, mod, 0);
2796
			/* ACTIVE, polarity determined later */
2824
			/* ACTIVE, polarity determined later */
2797
			fxs->lasttxhook = SLIC_LF_ACTIVE_FWD;
2825
			fxs->lasttxhook = SLIC_LF_ACTIVE_FWD;
2798
		} else {
2826
		} else {
2799
			/* Can't change polarity while ringing or when open */
2827
			/* Can't change polarity while ringing or when open */
2800
			if ((fxs->lasttxhook == SLIC_LF_RINGING) || (fxs->lasttxhook == SLIC_LF_OPEN)){
2828
			if ((fxs->lasttxhook == SLIC_LF_RINGING) ||

    
   
2829
				(fxs->lasttxhook == SLIC_LF_OPEN)) {
2801
				/* Set line polarity for new VMWI state */
2830
				/* Set line polarity for new VMWI state */
2802
				if (POLARITY_XOR(fxs)) {
2831
				if (POLARITY_XOR(fxs))
2803
					fxs->idletxhookstate |= SLIC_LF_RINGING;
2832
					fxs->idletxhookstate |= SLIC_LF_REVMASK;
2804
				} else {
2833
				else
2805
					fxs->idletxhookstate &= ~SLIC_LF_RINGING;
2834
					fxs->idletxhookstate &= ~SLIC_LF_REVMASK;
2806
				}
2835

   
2807
				printk(KERN_DEBUG "Unable to change polarity on channel %d, lasttxhook=0x%X\n",
2836
				dev_info(&wc->vb.pdev->dev,

    
   
2837
					"Unable to change polarity on channel %d, lasttxhook=0x%X\n",
2808
					mod->card,
2838
					mod->card,
2809
					fxs->lasttxhook
2839
					fxs->lasttxhook
2810
				);
2840
					);
2811
				return 0;
2841
				return 0;
2812
			}
2842
			}
2813
		}
2843
		}
2814

    
   
2844

   
2815
		/* Set line polarity for new VMWI state */
2845
		/* Set line polarity for new VMWI state */
2816
		if (POLARITY_XOR(fxs)) {
2846
		if (POLARITY_XOR(fxs)) {
2817
			fxs->idletxhookstate |= SLIC_LF_RINGING;
2847
			fxs->idletxhookstate |= SLIC_LF_REVMASK;
2818
			fxs->lasttxhook = (SLIC_LF_OPPENDING | SLIC_LF_RINGING);
2848
			fxs->lasttxhook |= SLIC_LF_REVMASK;
2819
		} else {
2849
		} else {
2820
			fxs->idletxhookstate &= ~SLIC_LF_RINGING;
2850
			fxs->idletxhookstate &= ~SLIC_LF_REVMASK;
2821

    
   
2851

   
2822
			x = fxs->lasttxhook;
2852
			x = fxs->lasttxhook;
2823
			x &= ~SLIC_LF_RINGING;
2853
			x &= ~SLIC_LF_REVMASK;
2824
			x |= SLIC_LF_OPPENDING;

   
2825
			fxs->lasttxhook = x;
2854
			fxs->lasttxhook = x;
2826
		}
2855
		}
2827
		set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);
2856
		set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);
2828
	}
2857
	}
2829
	if (debug) {
2858
	if (debug) {
2830
		dev_info(&wc->vb.pdev->dev,
2859
		dev_info(&wc->vb.pdev->dev,
2831
			 "Setting VMWI on channel %d, messages=%d, lrev=%d\n",
2860
			 "Setting VMWI on channel %d, messages=%d, lrev=%d hvac=%d\n",
2832
			 mod->card, fxs->vmwi_active_messages,
2861
			 mod->card, fxs->vmwi_active_messages,
2833
			 fxs->vmwi_linereverse);
2862
			 fxs->vmwi_linereverse, fxs->vmwi_hvac);
2834
	}
2863
	}
2835
	return 0;
2864
	return 0;
2836
}
2865
}
2837

    
   
2866

   
2838
static void
2867
static void
[+20] [20] 346 lines
[+20] [+] wctdm_init_proslic(struct wctdm *wc, struct wctdm_module *const mod,
3185
    wctdm_setreg(wc, card, 14, 0x0);
3214
    wctdm_setreg(wc, card, 14, 0x0);
3186
    wctdm_setreg(wc, card, 64, 0x0);
3215
    wctdm_setreg(wc, card, 64, 0x0);
3187
    wctdm_setreg(wc, card, 1, 0x08);
3216
    wctdm_setreg(wc, card, 1, 0x08);
3188
#endif
3217
#endif
3189

    
   
3218

   
3190
	if (fastringer) {
3219
	if (wctdm_init_ring_generator_mode(wc, mod))
3191
		/* Speed up Ringer */

   
3192
		wctdm_proslic_setreg_indirect(wc, mod, 20, 0x7e6d);

   
3193
		wctdm_proslic_setreg_indirect(wc, mod, 21, 0x01b9);

   
3194
		/* Beef up Ringing voltage to 89V */

   
3195
		if (boostringer) {

   
3196
			wctdm_setreg(wc, mod, 74, 0x3f);

   
3197
			if (wctdm_proslic_setreg_indirect(wc, mod, 21, 0x247))

   
3198
				return -1;

   
3199
			dev_info(&wc->vb.pdev->dev,

   
3200
				 "Boosting fast ringer on slot %d (89V peak)\n",

   
3201
				 mod->card + 1);

   
3202
		} else if (lowpower) {

   
3203
			if (wctdm_proslic_setreg_indirect(wc, mod, 21, 0x14b))

   
3204
				return -1;
3220
			return -1;
3205
			dev_info(&wc->vb.pdev->dev,

   
3206
				 "Reducing fast ring power on slot %d "

   
3207
				 "(50V peak)\n", mod->card + 1);

   
3208
		} else

   
3209
			dev_info(&wc->vb.pdev->dev,

   
3210
				 "Speeding up ringer on slot %d (25Hz)\n",

   
3211
				 mod->card + 1);

   
3212
	} else {

   
3213
		/* Beef up Ringing voltage to 89V */

   
3214
		if (boostringer) {

   
3215
			wctdm_setreg(wc, mod, 74, 0x3f);

   
3216
			if (wctdm_proslic_setreg_indirect(wc, mod, 21, 0x1d1))

   
3217
				return -1;

   
3218
			dev_info(&wc->vb.pdev->dev,

   
3219
				 "Boosting ringer on slot %d (89V peak)\n",

   
3220
				 mod->card + 1);

   
3221
		} else if (lowpower) {

   
3222
			if (wctdm_proslic_setreg_indirect(wc, mod, 21, 0x108))

   
3223
				return -1;

   
3224
			dev_info(&wc->vb.pdev->dev,

   
3225
				 "Reducing ring power on slot %d "

   
3226
				 "(50V peak)\n", mod->card + 1);

   
3227
		}

   
3228
	}

   
3229

    
   

   
3230
	if (wctdm_init_ring_generator_mode(wc, mod->card)){

   
3231
			return -1;

   
3232
	}

   
3233

    
   
3221

   
3234
	if (fxstxgain || fxsrxgain) {
3222
	if (fxstxgain || fxsrxgain) {
3235
		r9 = wctdm_getreg(wc, mod, 9);
3223
		r9 = wctdm_getreg(wc, mod, 9);
3236
		switch (fxstxgain) {
3224
		switch (fxstxgain) {
3237
		
3225
		
[+20] [20] 268 lines
[+20] [+] static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data)
3506
		if (get_user(x, (__user int *) data))
3494
		if (get_user(x, (__user int *) data))
3507
			return -EFAULT;
3495
			return -EFAULT;
3508
		fxs->ohttimer = x << 3;
3496
		fxs->ohttimer = x << 3;
3509

    
   
3497

   
3510
		/* Active mode when idle */
3498
		/* Active mode when idle */
3511
		fxs->idletxhookstate = (POLARITY_XOR(fxs)) ?
3499
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?
3512
						SLIC_LF_ACTIVE_REV :
3500
						SLIC_LF_ACTIVE_REV :
3513
						SLIC_LF_ACTIVE_FWD;
3501
						SLIC_LF_ACTIVE_FWD;
3514
		if (fxs->neonringing) {
3502
		if (fxs->neonringing) {
3515
			/* keep same Forward polarity */
3503
			/* keep same Forward polarity */
3516
			fxs->lasttxhook = (SLIC_LF_OPPENDING|SLIC_LF_OHTRAN_FWD);
3504
			fxs->lasttxhook = SLIC_LF_OHTRAN_FWD;
3517
			set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);
3505
			set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);
3518
		} else {
3506
		} else {
3519

    
   
3507

   
3520
			if (((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_FWD) ||
3508
			if (((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_FWD) ||
3521
			    ((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_REV)) {
3509
			    ((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_REV)) {
3522

    
   
3510

   
3523
				x = set_lasttxhook_interruptible(fxs,
3511
				x = set_lasttxhook_interruptible(fxs,
3524
					((POLARITY_XOR(fxs)) ?
3512
					(POLARITY_XOR(fxs) ?
3525
					SLIC_LF_OHTRAN_REV : SLIC_LF_OHTRAN_FWD),
3513
					SLIC_LF_OHTRAN_REV : SLIC_LF_OHTRAN_FWD),
3526
					&mod->sethook);
3514
					&mod->sethook);
3527

    
   
3515

   
3528
				if (debug & DEBUG_CARD) {
3516
				if (debug & DEBUG_CARD) {
3529
					if (x) {
3517
					if (x) {
[+20] [20] 357 lines
[+20] [+] static int wctdm_close(struct dahdi_chan *chan)
3887
	wc = chan->pvt;
3875
	wc = chan->pvt;
3888
	for (x = 0; x < wc->mods_per_board; x++) {
3876
	for (x = 0; x < wc->mods_per_board; x++) {
3889
		struct wctdm_module *const mod = &wc->mods[x];
3877
		struct wctdm_module *const mod = &wc->mods[x];
3890
		if (FXS == mod->type) {
3878
		if (FXS == mod->type) {
3891
			mod->mod.fxs.idletxhookstate =
3879
			mod->mod.fxs.idletxhookstate =
3892
			    (POLARITY_XOR(&mod->mod.fxs)) ? SLIC_LF_ACTIVE_REV :
3880
			    POLARITY_XOR(&mod->mod.fxs) ? SLIC_LF_ACTIVE_REV :
3893
							  SLIC_LF_ACTIVE_FWD;
3881
							  SLIC_LF_ACTIVE_FWD;
3894
		} else if (QRV == mod->type) {
3882
		} else if (QRV == mod->type) {
3895
			int qrvcard = x & 0xfc;
3883
			int qrvcard = x & 0xfc;
3896

    
   
3884

   
3897
			mod->mod.qrv.hook = 0;
3885
			mod->mod.qrv.hook = 0;
[+20] [20] 33 lines
[+20] [+] static int wctdm_init_ring_generator_mode(struct wctdm *wc, struct wctdm_module *const mod)
3931

    
   
3919

   
3932
static int wctdm_set_ring_generator_mode(struct wctdm *wc, struct wctdm_module *const mod, int mode)
3920
static int wctdm_set_ring_generator_mode(struct wctdm *wc, struct wctdm_module *const mod, int mode)
3933
{
3921
{
3934
	struct fxs *const fxs = &mod->mod.fxs;
3922
	struct fxs *const fxs = &mod->mod.fxs;
3935
	int reg20,reg21,reg74; /* RCO, RNGX, VBATH */
3923
	int reg20,reg21,reg74; /* RCO, RNGX, VBATH */
3936

    
   
3924
#if 1
3937
	fxs->neonringing = mode;   /* track ring generator mode */
3925
	fxs->neonringing = mode;   /* track ring generator mode */
3938

    
   
3926

   
3939
	if (mode) { /* Neon */
3927
	if (mode) { /* Neon */
3940
		if (debug)
3928
		if (debug)
3941
			printk(KERN_DEBUG "NEON ring on channel %d, lasttxhook was 0x%x\n", mod->card, fxs->lasttxhook);
3929
			printk(KERN_DEBUG "NEON ring on channel %d, lasttxhook was 0x%x\n", mod->card, fxs->lasttxhook);
3942
		fxs->lasttxhook = SLIC_LF_ACTIVE_FWD;			/* Must be in FORWARD ACTIVE before setting ringer */
3930
		fxs->lasttxhook = SLIC_LF_ACTIVE_FWD;			/* Must be in FORWARD ACTIVE before setting ringer */
3943
		wctdm_setreg(wc, mod, 64, fxs->lasttxhook);
3931
		wctdm_setreg_intr(wc, mod, 64, fxs->lasttxhook);
3944

    
   
3932

   
3945
		wctdm_proslic_setreg_indirect(wc, mod, 22, 0x03e8);	/* RNGY (4 HZ) */
3933
		wctdm_proslic_setreg_indirect_intr(wc, mod, 22, 0x03e8);	/* RNGY (4 HZ) */
3946
		wctdm_proslic_setreg_indirect(wc, mod, 21, 0x7bef);	/* RNGX (91.5Vpk) */
3934
		wctdm_proslic_setreg_indirect_intr(wc, mod, 21, 0x7bef);	/* RNGX (91.5Vpk) */
3947
		wctdm_proslic_setreg_indirect(wc, mod, 20, 0x009f);	/* RCO (RNGX, t rise) */
3935
		wctdm_proslic_setreg_indirect_intr(wc, mod, 20, 0x009f);	/* RCO (RNGX, t rise) */
3948

    
   
3936

   
3949
		wctdm_setreg(wc, mod, 34, 0x19);			/* Ringing Osc. Control */
3937
		wctdm_setreg_intr(wc, mod, 34, 0x19);			/* Ringing Osc. Control */
3950
		wctdm_setreg(wc, mod, 74, 0x3f);			/* VBATH 94.5V */
3938
		wctdm_setreg_intr(wc, mod, 74, 0x3f);			/* VBATH 94.5V */
3951
		wctdm_proslic_setreg_indirect(wc, mod, 29, 0x4600);	/* RPTP */
3939
		wctdm_proslic_setreg_indirect_intr(wc, mod, 29, 0x4600);	/* RPTP */
3952
		/* A write of 0x04 to register 64 will turn on the VM led */
3940
		/* A write of 0x04 to register 64 will turn on the VM led */
3953
	} else {
3941
	} else {
3954
		wctdm_setreg(wc, mod, 34, 0x00);			/* Ringing Osc. Control */
3942
		if (debug)

    
   
3943
			printk(KERN_DEBUG "NORMAL ring on channel %d, lasttxhook was 0x%x\n", mod->card, fxs->lasttxhook);

    
   
3944

   

    
   
3945
		wctdm_setreg_intr(wc, mod, 34, 0x00);			/* Ringing Osc. Control */
3955

    
   
3946

   
3956
		wctdm_proslic_setreg_indirect(wc, mod, 22, 0x0000);	/* RNGY Initial Phase */
3947
		wctdm_proslic_setreg_indirect_intr(wc, mod, 22, 0x0000);	/* RNGY Initial Phase */
3957
		wctdm_proslic_setreg_indirect(wc, mod, 29, 0x3600);	/* RPTP */
3948
		wctdm_proslic_setreg_indirect_intr(wc, mod, 29, 0x3600);	/* RPTP */
3958
		/* A write of 0x04 to register 64 will turn on the ringer */
3949
		/* A write of 0x04 to register 64 will turn on the ringer */
3959

    
   
3950

   
3960
		if (fastringer) {
3951
		if (fastringer) {
3961
			/* Speed up Ringer */
3952
			/* Speed up Ringer */
3962
			reg20 =  0x7e6d;
3953
			reg20 =  0x7e6d;
[+20] [20] 16 lines
[+20] static int wctdm_set_ring_generator_mode(struct wctdm *wc, struct wctdm_module *const mod, int mode)
3979
			} else {
3970
			} else {
3980
				reg21 = 0x01b9;
3971
				reg21 = 0x01b9;
3981
				if (debug)
3972
				if (debug)
3982
					printk(KERN_DEBUG "Speeding up ringer on channel %d (25Hz)\n", mod->card);
3973
					printk(KERN_DEBUG "Speeding up ringer on channel %d (25Hz)\n", mod->card);
3983
			}
3974
			}
3984
			wctdm_setreg(wc, mod, 74, reg74);			/* VBATH */
3975
			wctdm_setreg_intr(wc, mod, 74, reg74);			/* VBATH */
3985
			wctdm_proslic_setreg_indirect(wc, mod, 20, reg20);	/* RCO */
3976
			wctdm_proslic_setreg_indirect_intr(wc, mod, 20, reg20);	/* RCO */
3986
			wctdm_proslic_setreg_indirect(wc, mod, 21, reg21);	/* RNGX */
3977
			wctdm_proslic_setreg_indirect_intr(wc, mod, 21, reg21);	/* RNGX */
3987

    
   
3978

   
3988
		} else {
3979
		} else {
3989
			/* Ringer Speed */
3980
			/* Ringer Speed */
3990
			if (fxshonormode && fxo_modes[_opermode].ring_osc){
3981
			if (fxshonormode && fxo_modes[_opermode].ring_osc){
3991
				reg20 = fxo_modes[_opermode].ring_osc;
3982
				reg20 = fxo_modes[_opermode].ring_osc;
[+20] [20] 21 lines
[+20] static int wctdm_set_ring_generator_mode(struct wctdm *wc, struct wctdm_module *const mod, int mode)
4013
			} else {
4004
			} else {
4014
				reg21 = 0x160;
4005
				reg21 = 0x160;
4015
				if (debug)
4006
				if (debug)
4016
					printk(KERN_DEBUG "Normal ring power on channel %d\n", mod->card);
4007
					printk(KERN_DEBUG "Normal ring power on channel %d\n", mod->card);
4017
			}
4008
			}
4018
			wctdm_setreg(wc, mod, 74, reg74);			/* VBATH */
4009
			wctdm_setreg_intr(wc, mod, 74, reg74);			/* VBATH */
4019
			wctdm_proslic_setreg_indirect(wc, mod, 20, reg20);	/* RCO */
4010
			wctdm_proslic_setreg_indirect_intr(wc, mod, 20, reg20);	/* RCO */
4020
			wctdm_proslic_setreg_indirect(wc, mod, 21, reg21);	/* RNGX */
4011
			wctdm_proslic_setreg_indirect_intr(wc, mod, 21, reg21);	/* RNGX */
4021
		}
4012
		}
4022
	}
4013
	}

    
   
4014
#endif

    
   
4015
	if (debug)

    
   
4016
		printk(KERN_DEBUG "DONE ringgen on channel %d\n", mod->card);
4023
	return 0;
4017
	return 0;
4024
}
4018
}
4025

    
   
4019

   
4026

    
   
4020

   
4027
static int wctdm_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
4021
static int wctdm_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
[+20] [20] 1806 lines
  1. linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.