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.
linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c
Diff Revision 3 Diff Revision 6 - File Reverted
[20] 106 lines
[+20] [+] static int loopcurrent = 20;
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))
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] 142 lines
[+20] [+] static const struct dahdi_echocan_ops vpm_ec_ops = {
260

    
   
260

   
261
static int
261
static int
262
wctdm_init_proslic(struct wctdm *wc, struct wctdm_module *const mod, int fast,
262
wctdm_init_proslic(struct wctdm *wc, struct wctdm_module *const mod, int fast,
263
		   int manual, int sane);
263
		   int manual, int sane);
264

    
   
264

   
265
static int wctdm_init_ring_generator_mode(struct wctdm *wc, struct wctdm_module *const mod);

   
266
static int wctdm_set_ring_generator_mode(struct wctdm *wc, struct wctdm_module *const mod, int mode);

   
267

    
   

   
268
static void set_offsets(struct wctdm_module *const mod, int altcs)
265
static void set_offsets(struct wctdm_module *const mod, int altcs)
269
{
266
{
270
	int card = mod->card;
267
	int card = mod->card;
271
	int bit;
268
	int bit;
272

    
   
269

   
[+20] [20] 1163 lines
[+20] [+] wctdm_proslic_setreg_indirect(struct wctdm *wc, struct wctdm_module *const mod,
1436
	};
1433
	};
1437
	return res;
1434
	return res;
1438
}
1435
}
1439

    
   
1436

   
1440
static int
1437
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

   
1460
wctdm_proslic_getreg_indirect(struct wctdm *wc, struct wctdm_module *const mod,
1438
wctdm_proslic_getreg_indirect(struct wctdm *wc, struct wctdm_module *const mod,
1461
			      unsigned char address)
1439
			      unsigned char address)
1462
{ 
1440
{ 
1463
	int res = -1;
1441
	int res = -1;
1464
	char *p=NULL;
1442
	char *p=NULL;
[+20] [20] 176 lines
[+20] [+] wctdm_proslic_recheck_sanity(struct wctdm *wc, struct wctdm_module *const mod)
1641
				   mod->card + 1);
1619
				   mod->card + 1);
1642
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
1620
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
1643
			if (fxs->lasttxhook == SLIC_LF_RINGING) {
1621
			if (fxs->lasttxhook == SLIC_LF_RINGING) {
1644
				fxs->lasttxhook = POLARITY_XOR(fxs) ?
1622
				fxs->lasttxhook = POLARITY_XOR(fxs) ?
1645
							SLIC_LF_ACTIVE_REV :
1623
							SLIC_LF_ACTIVE_REV :
1646
							SLIC_LF_ACTIVE_FWD;
1624
							SLIC_LF_ACTIVE_FWD;;
1647
			}
1625
			}
1648
			fxs->lasttxhook |= SLIC_LF_OPPENDING;
1626
			fxs->lasttxhook |= SLIC_LF_OPPENDING;
1649
			mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
1627
			mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
1650
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
1628
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
1651

    
   
1629

   
[+20] [20] 381 lines
[+20] [+] wctdm_fxs_hooksig(struct wctdm *wc, struct wctdm_module *const mod,
2033
	spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2011
	spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2034
	switch (txsig) {
2012
	switch (txsig) {
2035
	case DAHDI_TXSIG_ONHOOK:
2013
	case DAHDI_TXSIG_ONHOOK:
2036
		switch (mod->chan->chan.sig) {
2014
		switch (mod->chan->chan.sig) {
2037
		case DAHDI_SIG_EM:
2015
		case DAHDI_SIG_EM:
2038
			x = fxs->idletxhookstate;

   
2039
			break;

   
2040
		case DAHDI_SIG_FXOKS:
2016
		case DAHDI_SIG_FXOKS:
2041
		case DAHDI_SIG_FXOLS:
2017
		case DAHDI_SIG_FXOLS:
2042
			/* Can't change Ring Generator during OHT */

   
2043
			if (!fxs->ohttimer){

   
2044
				wctdm_set_ring_generator_mode(wc, mod, fxs->vmwi_hvac);

   
2045
				x = fxs->vmwi_hvac ?

   
2046
					SLIC_LF_RINGING : fxs->idletxhookstate;

   
2047
			} else

   
2048
				x = fxs->idletxhookstate;
2018
			x = fxs->idletxhookstate;
2049

    
   

   
2050
			break;
2019
			break;
2051
		case DAHDI_SIG_FXOGS:
2020
		case DAHDI_SIG_FXOGS:
2052
			x = POLARITY_XOR(fxs) ?
2021
			x = (POLARITY_XOR(fxs)) ?
2053
					SLIC_LF_RING_OPEN :
2022
					SLIC_LF_RING_OPEN :
2054
					SLIC_LF_TIP_OPEN;
2023
					SLIC_LF_TIP_OPEN;
2055
			break;
2024
			break;
2056
		}
2025
		}
2057
		break;
2026
		break;
2058
	case DAHDI_TXSIG_OFFHOOK:
2027
	case DAHDI_TXSIG_OFFHOOK:
2059
		switch (mod->chan->chan.sig) {
2028
		switch (mod->chan->chan.sig) {
2060
		case DAHDI_SIG_EM:
2029
		case DAHDI_SIG_EM:
2061
			x = POLARITY_XOR(fxs) ?
2030
			x = (POLARITY_XOR(fxs)) ?
2062
					SLIC_LF_ACTIVE_FWD :
2031
					SLIC_LF_ACTIVE_FWD :
2063
					SLIC_LF_ACTIVE_REV;
2032
					SLIC_LF_ACTIVE_REV;
2064
			break;
2033
			break;
2065
		default:
2034
		default:
2066
			x = fxs->idletxhookstate;
2035
			x = fxs->idletxhookstate;
2067
			break;
2036
			break;
2068
		}
2037
		}
2069
		break;
2038
		break;
2070
	case DAHDI_TXSIG_START:
2039
	case DAHDI_TXSIG_START:
2071
		wctdm_set_ring_generator_mode(wc, mod, 0); /* Set ringer mode */

   
2072
		x = SLIC_LF_RINGING;
2040
		x = SLIC_LF_RINGING;
2073
		break;
2041
		break;
2074
	case DAHDI_TXSIG_KEWL:
2042
	case DAHDI_TXSIG_KEWL:
2075
		x = SLIC_LF_OPEN;
2043
		x = SLIC_LF_OPEN;
2076
		break;
2044
		break;
[+20] [20] 168 lines
[+20] [+] static void wctdm_isr_misc_fxs(struct wctdm *wc, struct wctdm_module *const mod)
2245

    
   
2213

   
2246
	wctdm_proslic_check_oppending(wc, mod);
2214
	wctdm_proslic_check_oppending(wc, mod);
2247

    
   
2215

   
2248
	if (!(wc->intcount & 0xfc))	/* every 256ms */
2216
	if (!(wc->intcount & 0xfc))	/* every 256ms */
2249
		wctdm_proslic_recheck_sanity(wc, mod);
2217
		wctdm_proslic_recheck_sanity(wc, mod);
2250
	if ((SLIC_LF_RINGING == fxs->lasttxhook) && fxs->neonringing) {
2218
	if (SLIC_LF_RINGING == fxs->lasttxhook) {
2251
		/* RINGing, prepare for OHT */
2219
		/* RINGing, prepare for OHT */
2252
		fxs->ohttimer = OHT_TIMER << 3;
2220
		fxs->ohttimer = OHT_TIMER << 3;
2253
		/* OHT mode when idle */
2221
		/* OHT mode when idle */
2254
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?
2222
		fxs->idletxhookstate = POLARITY_XOR(fxs) ? SLIC_LF_OHTRAN_REV :
2255
						SLIC_LF_OHTRAN_REV :

   
2256
						SLIC_LF_OHTRAN_FWD;
2223
							    SLIC_LF_OHTRAN_FWD;
2257
	} else if (fxs->ohttimer) {
2224
	} else if (fxs->ohttimer) {
2258
		 /* check if still OnHook */
2225
		 /* check if still OnHook */
2259
		if (!fxs->oldrxhook) {
2226
		if (!fxs->oldrxhook) {
2260
			fxs->ohttimer -= DAHDI_CHUNKSIZE;
2227
			fxs->ohttimer -= DAHDI_CHUNKSIZE;
2261
			if (fxs->ohttimer)
2228
			if (fxs->ohttimer)
2262
				return;
2229
				return;
2263

    
   
2230

   
2264
			/* Switch to active */
2231
			/* Switch to active */
2265
			fxs->idletxhookstate = POLARITY_XOR(fxs) ?
2232
			fxs->idletxhookstate = POLARITY_XOR(fxs) ? SLIC_LF_ACTIVE_REV :
2266
							SLIC_LF_ACTIVE_REV :

   
2267
							SLIC_LF_ACTIVE_FWD;
2233
								    SLIC_LF_ACTIVE_FWD;
2268
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2234
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2269

    
   
2235
			if (SLIC_LF_OHTRAN_FWD == fxs->lasttxhook) {
2270
			if ((SLIC_LF_OHTRAN_FWD == fxs->lasttxhook) ||
2236
				/* Apply the change if appropriate */
2271
				(SLIC_LF_OHTRAN_REV == fxs->lasttxhook)) {
2237
				fxs->lasttxhook = SLIC_LF_OPPENDING | SLIC_LF_ACTIVE_FWD;
2272
				if (fxs->vmwi_hvac){
2238
				/* Data enqueued here */
2273
					/* force idle polarity Forward if ringing */
2239
				mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
2274
					fxs->idletxhookstate = SLIC_LF_ACTIVE_FWD;
2240
				if (debug & DEBUG_CARD) {
2275
					/* Set ring generator for neon */
2241
					dev_info(&wc->vb.pdev->dev,
2276
					wctdm_set_ring_generator_mode(wc, mod, 1);
2242
						 "Channel %d OnHookTransfer "
2277
					fxs->lasttxhook = (SLIC_LF_OPPENDING |
2243
						 "stop\n", mod->card);
2278
							SLIC_LF_RINGING);
2244
				}
2279
				} else
2245
			} else if (SLIC_LF_OHTRAN_REV == fxs->lasttxhook) {
2280
					fxs->lasttxhook = (SLIC_LF_OPPENDING |
2246
				/* Apply the change if appropriate */
2281
							fxs->idletxhookstate);
2247
				fxs->lasttxhook = SLIC_LF_OPPENDING | SLIC_LF_ACTIVE_REV;
2282

    
   

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

   
2297
							SLIC_LF_ACTIVE_FWD;

   
2298
			if (debug & DEBUG_CARD) {
2261
			if (debug & DEBUG_CARD) {
2299
				dev_info(&wc->vb.pdev->dev,
2262
				dev_info(&wc->vb.pdev->dev,
2300
					 "Channel %d OnHookTransfer abort\n",
2263
					 "Channel %d OnHookTransfer abort\n",
2301
					 mod->card);
2264
					 mod->card);
2302
			}
2265
			}
2303
		}
2266
		}

    
   
2267

   
2304
	}
2268
	}
2305
}
2269
}
2306

    
   
2270

   
2307
/* 1ms interrupt */
2271
/* 1ms interrupt */
2308
static inline void wctdm_isr_misc(struct wctdm *wc)
2272
static inline void wctdm_isr_misc(struct wctdm *wc)
[+20] [20] 484 lines
[+20] [+] static int set_lasttxhook_interruptible(struct fxs *fxs, unsigned newval, int * psethook)
2793
static int set_vmwi(struct wctdm *wc, struct wctdm_module *const mod)
2757
static int set_vmwi(struct wctdm *wc, struct wctdm_module *const mod)
2794
{
2758
{
2795
	int x;
2759
	int x;
2796
	struct fxs *const fxs = &mod->mod.fxs;
2760
	struct fxs *const fxs = &mod->mod.fxs;
2797

    
   
2761

   
2798
	/* Presently supports line reversal MWI and NEON dc pulses */
2762
	/* Presently only supports line reversal MWI */
2799
	if (fxs->vmwi_active_messages) {
2763
	if ((fxs->vmwi_active_messages) &&
2800
		fxs->vmwi_linereverse = (fxs->vmwisetting.vmwi_type & DAHDI_VMWI_LREV)?1:0;
2764
	    (fxs->vmwisetting.vmwi_type & DAHDI_VMWI_LREV))
2801
		fxs->vmwi_hvac = (fxs->vmwisetting.vmwi_type & DAHDI_VMWI_HVAC)?1:0;
2765
		fxs->vmwi_linereverse = 1;
2802
	} else {

   
2803
		fxs->vmwi_linereverse = 0;

   
2804
		fxs->vmwi_hvac = 0;

   
2805
	}

   
2806

    
   

   
2807
	if (fxs->vmwi_hvac) {

   
2808
		/* Can't change ring generator while On Hook Transfer might be happening */

   
2809
		if (!fxs->ohttimer) {

   
2810
			/* Set line polarity for new VMWI state */

   
2811
			if (POLARITY_XOR(fxs))

   
2812
				fxs->idletxhookstate |= SLIC_LF_RINGING;

   
2813
			else

   
2814
				fxs->idletxhookstate &= ~SLIC_LF_RINGING;

   
2815

    
   

   
2816
			/* Set ring generator for neon */

   
2817
			wctdm_set_ring_generator_mode(wc, mod, 1);

   
2818
			set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);

   
2819
		}

   
2820
	} else {

   
2821
		if (fxs->neonringing){

   
2822
			/* Set ring generator for normal ringer */

   
2823
			wctdm_set_ring_generator_mode(wc, mod, 0);

   
2824
			/* ACTIVE, polarity determined later */

   
2825
			fxs->lasttxhook = SLIC_LF_ACTIVE_FWD;

   
2826
		} else {

   
2827
			/* Can't change polarity while ringing or when open */

   
2828
			if ((fxs->lasttxhook == SLIC_LF_RINGING) ||

   
2829
				(fxs->lasttxhook == SLIC_LF_OPEN)) {

   
2830
				/* Set line polarity for new VMWI state */

   
2831
				if (POLARITY_XOR(fxs))

   
2832
					fxs->idletxhookstate |= SLIC_LF_REVMASK;

   
2833
				else
2766
	else
2834
					fxs->idletxhookstate &= ~SLIC_LF_REVMASK;
2767
		fxs->vmwi_linereverse = 0;
2835

    
   

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

   
2837
					"Unable to change polarity on channel %d, lasttxhook=0x%X\n",

   
2838
					mod->card,

   
2839
					fxs->lasttxhook

   
2840
					);

   
2841
				return 0;

   
2842
			}

   
2843
		}

   
2844

    
   
2768

   
2845
		/* Set line polarity for new VMWI state */
2769
	/* Set line polarity for new VMWI state */
2846
		if (POLARITY_XOR(fxs)) {
2770
	if (POLARITY_XOR(fxs)) {
2847
			fxs->idletxhookstate |= SLIC_LF_REVMASK;
2771
		fxs->idletxhookstate |= SLIC_LF_OPPENDING | SLIC_LF_REVMASK;
2848
			fxs->lasttxhook |= SLIC_LF_REVMASK;
2772
		/* Do not set while currently ringing or open */

    
   
2773
		if (((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_RINGING)  &&

    
   
2774
		    ((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_OPEN)) {

    
   
2775
			x = fxs->lasttxhook;

    
   
2776
			x |= SLIC_LF_REVMASK;

    
   
2777
			set_lasttxhook_interruptible(fxs, x, &mod->sethook);

    
   
2778
		}
2849
		} else {
2779
	} else {
2850
			fxs->idletxhookstate &= ~SLIC_LF_REVMASK;
2780
		fxs->idletxhookstate &= ~SLIC_LF_REVMASK;
2851

    
   
2781
		/* Do not set while currently ringing or open */

    
   
2782
		if (((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_RINGING) &&

    
   
2783
		    ((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_OPEN)) {
2852
			x = fxs->lasttxhook;
2784
			x = fxs->lasttxhook;
2853
			x &= ~SLIC_LF_REVMASK;
2785
			x &= ~SLIC_LF_REVMASK;
2854
			fxs->lasttxhook = x;
2786
			set_lasttxhook_interruptible(fxs, x, &mod->sethook);
2855
		}
2787
		}
2856
		set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);

   
2857
	}
2788
	}
2858
	if (debug) {
2789
	if (debug) {
2859
		dev_info(&wc->vb.pdev->dev,
2790
		dev_info(&wc->vb.pdev->dev,
2860
			 "Setting VMWI on channel %d, messages=%d, lrev=%d hvac=%d\n",
2791
			 "Setting VMWI on channel %d, messages=%d, lrev=%d\n",
2861
			 mod->card, fxs->vmwi_active_messages,
2792
			 mod->card, fxs->vmwi_active_messages,
2862
			 fxs->vmwi_linereverse, fxs->vmwi_hvac);
2793
			 fxs->vmwi_linereverse);
2863
	}
2794
	}
2864
	return 0;
2795
	return 0;
2865
}
2796
}
2866

    
   
2797

   
2867
static void
2798
static void
[+20] [20] 346 lines
[+20] [+] wctdm_init_proslic(struct wctdm *wc, struct wctdm_module *const mod,
3214
    wctdm_setreg(wc, card, 14, 0x0);
3145
    wctdm_setreg(wc, card, 14, 0x0);
3215
    wctdm_setreg(wc, card, 64, 0x0);
3146
    wctdm_setreg(wc, card, 64, 0x0);
3216
    wctdm_setreg(wc, card, 1, 0x08);
3147
    wctdm_setreg(wc, card, 1, 0x08);
3217
#endif
3148
#endif
3218

    
   
3149

   
3219
	if (wctdm_init_ring_generator_mode(wc, mod))
3150
	if (fastringer) {

    
   
3151
		/* Speed up Ringer */

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

    
   
3153
		wctdm_proslic_setreg_indirect(wc, mod, 21, 0x01b9);
Moved from 3956

    
   
3154
		/* Beef up Ringing voltage to 89V */
Moved from 3957

    
   
3155
		if (boostringer) {

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

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

    
   
3158
				return -1;

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

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

    
   
3161
				 mod->card + 1);

    
   
3162
		} else if (lowpower) {

    
   
3163
			if (wctdm_proslic_setreg_indirect(wc, mod, 21, 0x14b))
3220
			return -1;
3164
				return -1;

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

    
   
3166
				 "Reducing fast ring power on slot %d "

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

    
   
3168
		} else

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

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

    
   
3171
				 mod->card + 1);

    
   
3172
	} else {

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

    
   
3174
		if (boostringer) {

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

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

    
   
3177
				return -1;

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

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

    
   
3180
				 mod->card + 1);

    
   
3181
		} else if (lowpower) {

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

    
   
3183
				return -1;

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

    
   
3185
				 "Reducing ring power on slot %d "

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

    
   
3187
		}

    
   
3188
	}
3221

    
   
3189

   
3222
	if (fxstxgain || fxsrxgain) {
3190
	if (fxstxgain || fxsrxgain) {
3223
		r9 = wctdm_getreg(wc, mod, 9);
3191
		r9 = wctdm_getreg(wc, mod, 9);
3224
		switch (fxstxgain) {
3192
		switch (fxstxgain) {
3225
		
3193
		
[+20] [20] 271 lines
[+20] [+] static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data)
3497

    
   
3465

   
3498
		/* Active mode when idle */
3466
		/* Active mode when idle */
3499
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?
3467
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?
3500
						SLIC_LF_ACTIVE_REV :
3468
						SLIC_LF_ACTIVE_REV :
3501
						SLIC_LF_ACTIVE_FWD;
3469
						SLIC_LF_ACTIVE_FWD;
3502
		if (fxs->neonringing) {

   
3503
			/* keep same Forward polarity */

   
3504
			fxs->lasttxhook = SLIC_LF_OHTRAN_FWD;

   
3505
			set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);

   
3506
		} else {

   
3507

    
   
3470

   
3508
			if (((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_FWD) ||
3471
		if (((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_FWD) ||
3509
			    ((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_REV)) {
3472
		    ((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_REV)) {
3510

    
   
3473

   
3511
				x = set_lasttxhook_interruptible(fxs,
3474
			x = set_lasttxhook_interruptible(fxs,
[+20] [20] 11 lines
[+20] static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data)
3523
						dev_info(&wc->vb.pdev->dev,
3486
					dev_info(&wc->vb.pdev->dev,
3524
							 "Channel %d OnHookTransfer "
3487
						 "Channel %d OnHookTransfer "
3525
							 "start\n", chan->chanpos - 1);
3488
						 "start\n", chan->chanpos - 1);
3526
					}
3489
				}
3527
				}
3490
			}

    
   
3491

   
3528
			}
3492
		}
3529
		}

   
3530
		break;
3493
		break;
3531
	case DAHDI_VMWI_CONFIG:
3494
	case DAHDI_VMWI_CONFIG:
3532
		if (mod->type != FXS)
3495
		if (mod->type != FXS)
3533
			return -EINVAL;
3496
			return -EINVAL;
3534
		if (copy_from_user(&(fxs->vmwisetting),
3497
		if (copy_from_user(&(fxs->vmwisetting),
[+20] [20] 365 lines
[+20] [+] static int wctdm_close(struct dahdi_chan *chan)
3900
	}
3863
	}
3901

    
   
3864

   
3902
	return 0;
3865
	return 0;
3903
}
3866
}
3904

    
   
3867

   
3905
static int wctdm_init_ring_generator_mode(struct wctdm *wc, struct wctdm_module *const mod)

   
3906
{

   
3907
	wctdm_setreg(wc, mod, 34, 0x00);			/* Ringing Osc. Control */

   
3908

    
   

   
3909
								/* neon trapezoid timers */

   
3910
	wctdm_setreg(wc, mod, 48, 0xe0);			/* Active Timer low byte */

   
3911
	wctdm_setreg(wc, mod, 49, 0x01);			/* Active Timer high byte */

   
3912
	wctdm_setreg(wc, mod, 50, 0xf0);			/* Inactive Timer low byte */

   
3913
	wctdm_setreg(wc, mod, 51, 0x05);			/* Inactive Timer high byte */

   
3914

    
   

   
3915
	wctdm_set_ring_generator_mode(wc, mod, 0);

   
3916

    
   

   
3917
	return 0;

   
3918
}

   
3919

    
   

   
3920
static int wctdm_set_ring_generator_mode(struct wctdm *wc, struct wctdm_module *const mod, int mode)

   
3921
{

   
3922
	struct fxs *const fxs = &mod->mod.fxs;

   
3923
	int reg20,reg21,reg74; /* RCO, RNGX, VBATH */

   
3924
#if 1

   
3925
	fxs->neonringing = mode;   /* track ring generator mode */

   
3926

    
   

   
3927
	if (mode) { /* Neon */

   
3928
		if (debug)

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

   
3930
		fxs->lasttxhook = SLIC_LF_ACTIVE_FWD;			/* Must be in FORWARD ACTIVE before setting ringer */

   
3931
		wctdm_setreg_intr(wc, mod, 64, fxs->lasttxhook);

   
3932

    
   

   
3933
		wctdm_proslic_setreg_indirect_intr(wc, mod, 22, 0x03e8);	/* RNGY (4 HZ) */

   
3934
		wctdm_proslic_setreg_indirect_intr(wc, mod, 21, 0x7bef);	/* RNGX (91.5Vpk) */

   
3935
		wctdm_proslic_setreg_indirect_intr(wc, mod, 20, 0x009f);	/* RCO (RNGX, t rise) */

   
3936

    
   

   
3937
		wctdm_setreg_intr(wc, mod, 34, 0x19);			/* Ringing Osc. Control */

   
3938
		wctdm_setreg_intr(wc, mod, 74, 0x3f);			/* VBATH 94.5V */

   
3939
		wctdm_proslic_setreg_indirect_intr(wc, mod, 29, 0x4600);	/* RPTP */

   
3940
		/* A write of 0x04 to register 64 will turn on the VM led */

   
3941
	} else {

   
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 */

   
3946

    
   

   
3947
		wctdm_proslic_setreg_indirect_intr(wc, mod, 22, 0x0000);	/* RNGY Initial Phase */

   
3948
		wctdm_proslic_setreg_indirect_intr(wc, mod, 29, 0x3600);	/* RPTP */

   
3949
		/* A write of 0x04 to register 64 will turn on the ringer */

   
3950

    
   

   
3951
		if (fastringer) {

   
3952
			/* Speed up Ringer */

   
3953
			reg20 =  0x7e6d;

   
3954

    
   

   
3955
			reg74 = 0x32;	/* Default */

   
3956
			/* Beef up Ringing voltage to 89V */
Moved to 3154

   
3957
			if (boostringer) {
Moved to 3155

   
3958
				reg74 = 0x3f;

   
3959
				reg21 = 0x0247; /* RNGX */

   
3960
				if (debug)

   
3961
					printk(KERN_DEBUG "Boosting fast ringer on channel %d (89V peak)\n", mod->card);

   
3962
			} else if (lowpower) {

   
3963
				reg21 = 0x014b; /* RNGX */

   
3964
				if (debug)

   
3965
					printk(KERN_DEBUG "Reducing fast ring power on channel %d (50V peak)\n", mod->card);

   
3966
			} else if (fxshonormode && fxo_modes[_opermode].ring_x) {

   
3967
				reg21 = fxo_modes[_opermode].ring_x;

   
3968
				if (debug)

   
3969
					printk(KERN_DEBUG "fxshonormode: fast ring_x power on channel %d\n", mod->card);

   
3970
			} else {

   
3971
				reg21 = 0x01b9;

   
3972
				if (debug)

   
3973
					printk(KERN_DEBUG "Speeding up ringer on channel %d (25Hz)\n", mod->card);

   
3974
			}

   
3975
			wctdm_setreg_intr(wc, mod, 74, reg74);			/* VBATH */

   
3976
			wctdm_proslic_setreg_indirect_intr(wc, mod, 20, reg20);	/* RCO */

   
3977
			wctdm_proslic_setreg_indirect_intr(wc, mod, 21, reg21);	/* RNGX */

   
3978

    
   

   
3979
		} else {

   
3980
			/* Ringer Speed */

   
3981
			if (fxshonormode && fxo_modes[_opermode].ring_osc){

   
3982
				reg20 = fxo_modes[_opermode].ring_osc;

   
3983
				if (debug)

   
3984
					printk(KERN_DEBUG "fxshonormode: ring_osc speed on channel %d\n", mod->card);

   
3985
			} else {

   
3986
				reg20 = 0x7ef0; /* Default */

   
3987
			}

   
3988

    
   

   
3989
			reg74 = 0x32;   /* Default */

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

   
3991
			if (boostringer) {

   
3992
				reg74 = 0x3f;

   
3993
				reg21 = 0x1d1;

   
3994
				if (debug)

   
3995
					printk(KERN_DEBUG "Boosting ringer on channel %d (89V peak)\n", mod->card);

   
3996
			} else if (lowpower) {

   
3997
				reg21 = 0x108;

   
3998
				if (debug)

   
3999
					printk(KERN_DEBUG "Reducing ring power on channel %d (50V peak)\n", mod->card);

   
4000
			} else if (fxshonormode && fxo_modes[_opermode].ring_x) {

   
4001
				reg21 = fxo_modes[_opermode].ring_x;

   
4002
				if (debug)

   
4003
					printk(KERN_DEBUG "fxshonormode: ring_x power on channel %d\n", mod->card);

   
4004
			} else {

   
4005
				reg21 = 0x160;

   
4006
				if (debug)

   
4007
					printk(KERN_DEBUG "Normal ring power on channel %d\n", mod->card);

   
4008
			}

   
4009
			wctdm_setreg_intr(wc, mod, 74, reg74);			/* VBATH */

   
4010
			wctdm_proslic_setreg_indirect_intr(wc, mod, 20, reg20);	/* RCO */

   
4011
			wctdm_proslic_setreg_indirect_intr(wc, mod, 21, reg21);	/* RNGX */

   
4012
		}

   
4013
	}

   
4014
#endif

   
4015
	if (debug)

   
4016
		printk(KERN_DEBUG "DONE ringgen on channel %d\n", mod->card);

   
4017
	return 0;

   
4018
}

   
4019

    
   

   
4020

    
   

   
4021
static int wctdm_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
3868
static int wctdm_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
4022
{
3869
{
4023
	struct wctdm *wc = chan->pvt;
3870
	struct wctdm *wc = chan->pvt;
4024
	int reg = 0;
3871
	int reg = 0;
4025
	struct wctdm_module *const mod = &wc->mods[chan->chanpos - 1];
3872
	struct wctdm_module *const mod = &wc->mods[chan->chanpos - 1];
[+20] [20] 1802 lines
linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
Diff Revision 3 Diff Revision 7 - File Reverted
 
linux/trunk/drivers/dahdi/wctdm24xxp/base.c
Diff Revision 3 Diff Revision 7
 
linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
Diff Revision 3 Diff Revision 7
 
  1. linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c: Loading...
  2. linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/wctdm24xxp.h: Loading...
  3. linux/trunk/drivers/dahdi/wctdm24xxp/base.c: Loading...
  4. linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h: 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.