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.

Diff revision 3

This is not the most recent revision of the diff. The latest diff is revision 7. See what's changed.

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...
  2. linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/wctdm24xxp.h: Loading...
linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c
Revision 9867 New Change
[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))
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] 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

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

    
   
272

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

    
   
1439

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

    
   
1651

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

    
   
2038
			x = fxs->idletxhookstate;

    
   
2039
			break;
2016
		case DAHDI_SIG_FXOKS:
2040
		case DAHDI_SIG_FXOKS:
2017
		case DAHDI_SIG_FXOLS:
2041
		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
2018
			x = fxs->idletxhookstate;
2048
				x = fxs->idletxhookstate;

    
   
2049

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

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

    
   
2245

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

    
   
2247

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

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

    
   
2263

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

    
   
2266
							SLIC_LF_ACTIVE_REV :
2233
								    SLIC_LF_ACTIVE_FWD;
2267
							SLIC_LF_ACTIVE_FWD;
2234
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2268
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2235
			if (SLIC_LF_OHTRAN_FWD == fxs->lasttxhook) {
2269

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

    
   
2282

   
2248
				/* Data enqueued here */
2283
				/* Data enqueued here */
2249
				mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
2284
				mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
2250
				if (debug & DEBUG_CARD) {
2285
				if (debug & DEBUG_CARD) {
2251
					dev_info(&wc->vb.pdev->dev,
2286
					dev_info(&wc->vb.pdev->dev,
2252
						 "Channel %d OnHookTransfer "
2287
						 "Channel %d OnHookTransfer "
2253
						 "stop\n", mod->card);
2288
						 "stop\n", mod->card);
2254
				}
2289
				}
2255
			}
2290
			}
2256
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
2291
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
2257
		} else {
2292
		} else {
2258
			fxs->ohttimer = 0;
2293
			fxs->ohttimer = 0;
2259
			/* Switch to active */
2294
			/* Switch to active */
2260
			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;
2261
			if (debug & DEBUG_CARD) {
2298
			if (debug & DEBUG_CARD) {
2262
				dev_info(&wc->vb.pdev->dev,
2299
				dev_info(&wc->vb.pdev->dev,
2263
					 "Channel %d OnHookTransfer abort\n",
2300
					 "Channel %d OnHookTransfer abort\n",
2264
					 mod->card);
2301
					 mod->card);
2265
			}
2302
			}
2266
		}
2303
		}
2267

    
   

   
2268
	}
2304
	}
2269
}
2305
}
2270

    
   
2306

   
2271
/* 1ms interrupt */
2307
/* 1ms interrupt */
2272
static inline void wctdm_isr_misc(struct wctdm *wc)
2308
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)
2757
static int set_vmwi(struct wctdm *wc, struct wctdm_module *const mod)
2793
static int set_vmwi(struct wctdm *wc, struct wctdm_module *const mod)
2758
{
2794
{
2759
	int x;
2795
	int x;
2760
	struct fxs *const fxs = &mod->mod.fxs;
2796
	struct fxs *const fxs = &mod->mod.fxs;
2761

    
   
2797

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

    
   
2804
		fxs->vmwi_hvac = 0;

    
   
2805
	}
2768

    
   
2806

   

    
   
2807
	if (fxs->vmwi_hvac) {

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

    
   
2809
		if (!fxs->ohttimer) {
2769
	/* Set line polarity for new VMWI state */
2810
			/* Set line polarity for new VMWI state */
2770
	if (POLARITY_XOR(fxs)) {
2811
			if (POLARITY_XOR(fxs))
2771
		fxs->idletxhookstate |= SLIC_LF_OPPENDING | SLIC_LF_REVMASK;
2812
				fxs->idletxhookstate |= SLIC_LF_RINGING;
2772
		/* Do not set while currently ringing or open */
2813
			else
2773
		if (((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_RINGING)  &&
2814
				fxs->idletxhookstate &= ~SLIC_LF_RINGING;
2774
		    ((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_OPEN)) {
2815

   
2775
			x = fxs->lasttxhook;
2816
			/* Set ring generator for neon */
2776
			x |= SLIC_LF_REVMASK;
2817
			wctdm_set_ring_generator_mode(wc, mod, 1);
2777
			set_lasttxhook_interruptible(fxs, x, &mod->sethook);
2818
			set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);
2778
		}
2819
		}
2779
	} else {
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
2780
		fxs->idletxhookstate &= ~SLIC_LF_REVMASK;
2834
					fxs->idletxhookstate &= ~SLIC_LF_REVMASK;
2781
		/* Do not set while currently ringing or open */
2835

   
2782
		if (((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_RINGING) &&
2836
				dev_info(&wc->vb.pdev->dev,
2783
		    ((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_OPEN)) {
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

   

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

    
   
2846
		if (POLARITY_XOR(fxs)) {

    
   
2847
			fxs->idletxhookstate |= SLIC_LF_REVMASK;

    
   
2848
			fxs->lasttxhook |= SLIC_LF_REVMASK;

    
   
2849
		} else {

    
   
2850
			fxs->idletxhookstate &= ~SLIC_LF_REVMASK;

    
   
2851

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

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

    
   
2866

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

    
   
3218

   
3150
	if (fastringer) {
3219
	if (wctdm_init_ring_generator_mode(wc, mod))
3151
		/* Speed up Ringer */

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

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

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

   
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))

   
3164
				return -1;
3220
			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
	}

   
3189

    
   
3221

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

    
   
3497

   
3466
		/* Active mode when idle */
3498
		/* Active mode when idle */
3467
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?
3499
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?
3468
						SLIC_LF_ACTIVE_REV :
3500
						SLIC_LF_ACTIVE_REV :
3469
						SLIC_LF_ACTIVE_FWD;
3501
						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 {
3470

    
   
3507

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

    
   
3510

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

    
   

   
3492
		}
3528
			}

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

    
   
3901

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

    
   
3904

   

    
   
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 */
Moved from 3154

    
   
3956
			/* Beef up Ringing voltage to 89V */
Moved from 3155

    
   
3957
			if (boostringer) {

    
   
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 */
Moved from 3154

    
   
3990
			/* Beef up Ringing voltage to 89V */
Moved from 3155

    
   
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

   
3868
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)
3869
{
4022
{
3870
	struct wctdm *wc = chan->pvt;
4023
	struct wctdm *wc = chan->pvt;
3871
	int reg = 0;
4024
	int reg = 0;
3872
	struct wctdm_module *const mod = &wc->mods[chan->chanpos - 1];
4025
	struct wctdm_module *const mod = &wc->mods[chan->chanpos - 1];
[+20] [20] 1802 lines
linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
Revision 9867 New Change
 
  1. linux/team/sruffell/wctdm24xxp-cmdlist/drivers/dahdi/wctdm24xxp/base.c: Loading...
  2. linux/team/sruffell/wctdm24xxp-cmdlist/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.