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 2

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] 1349 lines
[+20] [+] wctdm_proslic_recheck_sanity(struct wctdm *wc, struct wctdm_module *const mod)
1619
				   mod->card + 1);
1622
				   mod->card + 1);
1620
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
1623
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
1621
			if (fxs->lasttxhook == SLIC_LF_RINGING) {
1624
			if (fxs->lasttxhook == SLIC_LF_RINGING) {
1622
				fxs->lasttxhook = POLARITY_XOR(fxs) ?
1625
				fxs->lasttxhook = POLARITY_XOR(fxs) ?
1623
							SLIC_LF_ACTIVE_REV :
1626
							SLIC_LF_ACTIVE_REV :
1624
							SLIC_LF_ACTIVE_FWD;;
1627
							SLIC_LF_ACTIVE_FWD;
1625
			}
1628
			}
1626
			fxs->lasttxhook |= SLIC_LF_OPPENDING;
1629
			fxs->lasttxhook |= SLIC_LF_OPPENDING;
1627
			mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
1630
			mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
1628
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
1631
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
1629

    
   
1632

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

    
   
2019
			x = fxs->idletxhookstate;

    
   
2020
			break;
2016
		case DAHDI_SIG_FXOKS:
2021
		case DAHDI_SIG_FXOKS:
2017
		case DAHDI_SIG_FXOLS:
2022
		case DAHDI_SIG_FXOLS:

    
   
2023
			/* Can't change Ring Generator during OHT */

    
   
2024
			if (!fxs->ohttimer){

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

    
   
2026
				x = fxs->vmwi_hvac ?

    
   
2027
					SLIC_LF_RINGING : fxs->idletxhookstate;

    
   
2028
			} else
2018
			x = fxs->idletxhookstate;
2029
				x = fxs->idletxhookstate;

    
   
2030

   
2019
			break;
2031
			break;
2020
		case DAHDI_SIG_FXOGS:
2032
		case DAHDI_SIG_FXOGS:
2021
			x = (POLARITY_XOR(fxs)) ?
2033
			x = POLARITY_XOR(fxs) ?
2022
					SLIC_LF_RING_OPEN :
2034
					SLIC_LF_RING_OPEN :
2023
					SLIC_LF_TIP_OPEN;
2035
					SLIC_LF_TIP_OPEN;
2024
			break;
2036
			break;
2025
		}
2037
		}
2026
		break;
2038
		break;
2027
	case DAHDI_TXSIG_OFFHOOK:
2039
	case DAHDI_TXSIG_OFFHOOK:
2028
		switch (mod->chan->chan.sig) {
2040
		switch (mod->chan->chan.sig) {
2029
		case DAHDI_SIG_EM:
2041
		case DAHDI_SIG_EM:
2030
			x = (POLARITY_XOR(fxs)) ?
2042
			x = POLARITY_XOR(fxs) ?
2031
					SLIC_LF_ACTIVE_FWD :
2043
					SLIC_LF_ACTIVE_FWD :
2032
					SLIC_LF_ACTIVE_REV;
2044
					SLIC_LF_ACTIVE_REV;
2033
			break;
2045
			break;
2034
		default:
2046
		default:
2035
			x = fxs->idletxhookstate;
2047
			x = fxs->idletxhookstate;
2036
			break;
2048
			break;
2037
		}
2049
		}
2038
		break;
2050
		break;
2039
	case DAHDI_TXSIG_START:
2051
	case DAHDI_TXSIG_START:

    
   
2052
		wctdm_set_ring_generator_mode(wc, mod, 0); /* Set ringer mode */
2040
		x = SLIC_LF_RINGING;
2053
		x = SLIC_LF_RINGING;
2041
		break;
2054
		break;
2042
	case DAHDI_TXSIG_KEWL:
2055
	case DAHDI_TXSIG_KEWL:
2043
		x = SLIC_LF_OPEN;
2056
		x = SLIC_LF_OPEN;
2044
		break;
2057
		break;
[+20] [20] 168 lines
[+20] [+] static void wctdm_isr_misc_fxs(struct wctdm *wc, struct wctdm_module *const mod)
2213

    
   
2226

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

    
   
2228

   
2216
	if (!(wc->intcount & 0xfc))	/* every 256ms */
2229
	if (!(wc->intcount & 0xfc))	/* every 256ms */
2217
		wctdm_proslic_recheck_sanity(wc, mod);
2230
		wctdm_proslic_recheck_sanity(wc, mod);
2218
	if (SLIC_LF_RINGING == fxs->lasttxhook) {
2231
	if ((SLIC_LF_RINGING == fxs->lasttxhook) && fxs->neonringing) {
2219
		/* RINGing, prepare for OHT */
2232
		/* RINGing, prepare for OHT */
2220
		fxs->ohttimer = OHT_TIMER << 3;
2233
		fxs->ohttimer = OHT_TIMER << 3;
2221
		/* OHT mode when idle */
2234
		/* OHT mode when idle */
2222
		fxs->idletxhookstate = POLARITY_XOR(fxs) ? SLIC_LF_OHTRAN_REV :
2235
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?

    
   
2236
						SLIC_LF_OHTRAN_REV :
2223
							    SLIC_LF_OHTRAN_FWD;
2237
						SLIC_LF_OHTRAN_FWD;
2224
	} else if (fxs->ohttimer) {
2238
	} else if (fxs->ohttimer) {
2225
		 /* check if still OnHook */
2239
		 /* check if still OnHook */
2226
		if (!fxs->oldrxhook) {
2240
		if (!fxs->oldrxhook) {
2227
			fxs->ohttimer -= DAHDI_CHUNKSIZE;
2241
			fxs->ohttimer -= DAHDI_CHUNKSIZE;
2228
			if (fxs->ohttimer)
2242
			if (fxs->ohttimer)
2229
				return;
2243
				return;
2230

    
   
2244

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

    
   
2247
							SLIC_LF_ACTIVE_REV :
2233
								    SLIC_LF_ACTIVE_FWD;
2248
							SLIC_LF_ACTIVE_FWD;
2234
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2249
			spin_lock_irqsave(&fxs->lasttxhooklock, flags);
2235
			if (SLIC_LF_OHTRAN_FWD == fxs->lasttxhook) {
2250

   
2236
				/* Apply the change if appropriate */
2251
			if ((SLIC_LF_OHTRAN_FWD == fxs->lasttxhook) ||
2237
				fxs->lasttxhook = SLIC_LF_OPPENDING | SLIC_LF_ACTIVE_FWD;
2252
				(SLIC_LF_OHTRAN_REV == fxs->lasttxhook)) {
2238
				/* Data enqueued here */
2253
				if (fxs->vmwi_hvac){
2239
				mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
2254
					/* force idle polarity Forward if ringing */
2240
				if (debug & DEBUG_CARD) {
2255
					fxs->idletxhookstate = SLIC_LF_ACTIVE_FWD;
2241
					dev_info(&wc->vb.pdev->dev,
2256
					/* Set ring generator for neon */
2242
						 "Channel %d OnHookTransfer "
2257
					wctdm_set_ring_generator_mode(wc, mod, 1);
2243
						 "stop\n", mod->card);
2258
					fxs->lasttxhook = (SLIC_LF_OPPENDING |
2244
				}
2259
							SLIC_LF_RINGING);
2245
			} else if (SLIC_LF_OHTRAN_REV == fxs->lasttxhook) {
2260
				} else
2246
				/* Apply the change if appropriate */
2261
					fxs->lasttxhook = (SLIC_LF_OPPENDING |
2247
				fxs->lasttxhook = SLIC_LF_OPPENDING | SLIC_LF_ACTIVE_REV;
2262
							fxs->idletxhookstate);

    
   
2263

   
2248
				/* Data enqueued here */
2264
				/* Data enqueued here */
2249
				mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
2265
				mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
2250
				if (debug & DEBUG_CARD) {
2266
				if (debug & DEBUG_CARD) {
2251
					dev_info(&wc->vb.pdev->dev,
2267
					dev_info(&wc->vb.pdev->dev,
2252
						 "Channel %d OnHookTransfer "
2268
						 "Channel %d OnHookTransfer "
2253
						 "stop\n", mod->card);
2269
						 "stop\n", mod->card);
2254
				}
2270
				}
2255
			}
2271
			}
2256
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
2272
			spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
2257
		} else {
2273
		} else {
2258
			fxs->ohttimer = 0;
2274
			fxs->ohttimer = 0;
2259
			/* Switch to active */
2275
			/* Switch to active */
2260
			fxs->idletxhookstate = POLARITY_XOR(fxs) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD;
2276
			fxs->idletxhookstate = POLARITY_XOR(fxs) ?

    
   
2277
							SLIC_LF_ACTIVE_REV :

    
   
2278
							SLIC_LF_ACTIVE_FWD;
2261
			if (debug & DEBUG_CARD) {
2279
			if (debug & DEBUG_CARD) {
2262
				dev_info(&wc->vb.pdev->dev,
2280
				dev_info(&wc->vb.pdev->dev,
2263
					 "Channel %d OnHookTransfer abort\n",
2281
					 "Channel %d OnHookTransfer abort\n",
2264
					 mod->card);
2282
					 mod->card);
2265
			}
2283
			}
2266
		}
2284
		}
2267

    
   

   
2268
	}
2285
	}
2269
}
2286
}
2270

    
   
2287

   
2271
/* 1ms interrupt */
2288
/* 1ms interrupt */
2272
static inline void wctdm_isr_misc(struct wctdm *wc)
2289
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)
2774
static int set_vmwi(struct wctdm *wc, struct wctdm_module *const mod)
2758
{
2775
{
2759
	int x;
2776
	int x;
2760
	struct fxs *const fxs = &mod->mod.fxs;
2777
	struct fxs *const fxs = &mod->mod.fxs;
2761

    
   
2778

   
2762
	/* Presently only supports line reversal MWI */
2779
	/* Presently supports line reversal MWI and NEON dc pulses */
2763
	if ((fxs->vmwi_active_messages) &&
2780
	if (fxs->vmwi_active_messages) {
2764
	    (fxs->vmwisetting.vmwi_type & DAHDI_VMWI_LREV))
2781
		fxs->vmwi_linereverse = (fxs->vmwisetting.vmwi_type & DAHDI_VMWI_LREV)?1:0;
2765
		fxs->vmwi_linereverse = 1;
2782
		fxs->vmwi_hvac = (fxs->vmwisetting.vmwi_type & DAHDI_VMWI_HVAC)?1:0;
2766
	else
2783
	} else {
2767
		fxs->vmwi_linereverse = 0;
2784
		fxs->vmwi_linereverse = 0;

    
   
2785
		fxs->vmwi_hvac = 0;

    
   
2786
	}
2768

    
   
2787

   

    
   
2788
	if (fxs->vmwi_hvac) {

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

    
   
2790
		if (!fxs->ohttimer) {
2769
	/* Set line polarity for new VMWI state */
2791
			/* Set line polarity for new VMWI state */
2770
	if (POLARITY_XOR(fxs)) {
2792
			if (POLARITY_XOR(fxs))
2771
		fxs->idletxhookstate |= SLIC_LF_OPPENDING | SLIC_LF_REVMASK;
2793
				fxs->idletxhookstate |= SLIC_LF_RINGING;
2772
		/* Do not set while currently ringing or open */
2794
			else
2773
		if (((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_RINGING)  &&
2795
				fxs->idletxhookstate &= ~SLIC_LF_RINGING;
2774
		    ((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_OPEN)) {
2796

   
2775
			x = fxs->lasttxhook;
2797
			/* Set ring generator for neon */
2776
			x |= SLIC_LF_REVMASK;
2798
			wctdm_set_ring_generator_mode(wc, mod, 1);
2777
			set_lasttxhook_interruptible(fxs, x, &mod->sethook);
2799
			set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);
2778
		}
2800
		}
2779
	} else {
2801
	} else {
2780
		fxs->idletxhookstate &= ~SLIC_LF_REVMASK;
2802
		if (fxs->neonringing){
2781
		/* Do not set while currently ringing or open */
2803
			/* Set ring generator for normal ringer */
2782
		if (((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_RINGING) &&
2804
			wctdm_set_ring_generator_mode(wc, mod, 0);
2783
		    ((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_OPEN)) {
2805
			/* ACTIVE, polarity determined later */

    
   
2806
			fxs->lasttxhook = SLIC_LF_ACTIVE_FWD;

    
   
2807
		} else {

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

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

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

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

    
   
2812
				if (POLARITY_XOR(fxs))

    
   
2813
					fxs->idletxhookstate |= SLIC_LF_RINGING;

    
   
2814
				else

    
   
2815
					fxs->idletxhookstate &= ~SLIC_LF_RINGING;

    
   
2816

   

    
   
2817
				printk(KERN_DEBUG\

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

    
   
2819
					mod->card,

    
   
2820
					fxs->lasttxhook

    
   
2821
					);

    
   
2822
				return 0;

    
   
2823
			}

    
   
2824
		}

    
   
2825

   

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

    
   
2827
		if (POLARITY_XOR(fxs)) {

    
   
2828
			fxs->idletxhookstate |= SLIC_LF_RINGING;

    
   
2829
			fxs->lasttxhook = SLIC_LF_RINGING;

    
   
2830
		} else {

    
   
2831
			fxs->idletxhookstate &= ~SLIC_LF_RINGING;

    
   
2832

   
2784
			x = fxs->lasttxhook;
2833
			x = fxs->lasttxhook;
2785
			x &= ~SLIC_LF_REVMASK;
2834
			x &= ~SLIC_LF_RINGING;
2786
			set_lasttxhook_interruptible(fxs, x, &mod->sethook);
2835
			fxs->lasttxhook = x;
2787
		}
2836
		}

    
   
2837
		set_lasttxhook_interruptible(fxs, fxs->lasttxhook, &mod->sethook);
2788
	}
2838
	}
2789
	if (debug) {
2839
	if (debug) {
2790
		dev_info(&wc->vb.pdev->dev,
2840
		dev_info(&wc->vb.pdev->dev,
2791
			 "Setting VMWI on channel %d, messages=%d, lrev=%d\n",
2841
			 "Setting VMWI on channel %d, messages=%d, lrev=%d\n",
2792
			 mod->card, fxs->vmwi_active_messages,
2842
			 mod->card, fxs->vmwi_active_messages,
[+20] [20] 352 lines
[+20] [+] wctdm_init_proslic(struct wctdm *wc, struct wctdm_module *const mod,
3145
    wctdm_setreg(wc, card, 14, 0x0);
3195
    wctdm_setreg(wc, card, 14, 0x0);
3146
    wctdm_setreg(wc, card, 64, 0x0);
3196
    wctdm_setreg(wc, card, 64, 0x0);
3147
    wctdm_setreg(wc, card, 1, 0x08);
3197
    wctdm_setreg(wc, card, 1, 0x08);
3148
#endif
3198
#endif
3149

    
   
3199

   
3150
	if (fastringer) {
3200
	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 */
Moved to 3971

   
3155
		if (boostringer) {
Moved to 3972

   
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;

   
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;
3201
			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

    
   
3202

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

    
   
3478

   
3466
		/* Active mode when idle */
3479
		/* Active mode when idle */
3467
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?
3480
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?
3468
						SLIC_LF_ACTIVE_REV :
3481
						SLIC_LF_ACTIVE_REV :
3469
						SLIC_LF_ACTIVE_FWD;
3482
						SLIC_LF_ACTIVE_FWD;

    
   
3483
		if (fxs->neonringing) {

    
   
3484
			/* keep same Forward polarity */

    
   
3485
			fxs->lasttxhook = SLIC_LF_OHTRAN_FWD;

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

    
   
3487
		} else {
3470

    
   
3488

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

    
   
3491

   
3474
			x = set_lasttxhook_interruptible(fxs,
3492
				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,
3504
						dev_info(&wc->vb.pdev->dev,
3487
						 "Channel %d OnHookTransfer "
3505
							 "Channel %d OnHookTransfer "
3488
						 "start\n", chan->chanpos - 1);
3506
							 "start\n", chan->chanpos - 1);
3489
				}
3507
					}
3490
			}
3508
				}
3491

    
   

   
3492
		}
3509
			}

    
   
3510
		}
3493
		break;
3511
		break;
3494
	case DAHDI_VMWI_CONFIG:
3512
	case DAHDI_VMWI_CONFIG:
3495
		if (mod->type != FXS)
3513
		if (mod->type != FXS)
3496
			return -EINVAL;
3514
			return -EINVAL;
3497
		if (copy_from_user(&(fxs->vmwisetting),
3515
		if (copy_from_user(&(fxs->vmwisetting),
[+20] [20] 365 lines
[+20] [+] static int wctdm_close(struct dahdi_chan *chan)
3863
	}
3881
	}
3864

    
   
3882

   
3865
	return 0;
3883
	return 0;
3866
}
3884
}
3867

    
   
3885

   

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

    
   
3887
{

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

    
   
3889

   

    
   
3890
								/* neon trapezoid timers */

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

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

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

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

    
   
3895

   

    
   
3896
	wctdm_set_ring_generator_mode(wc, mod, 0);

    
   
3897

   

    
   
3898
	return 0;

    
   
3899
}

    
   
3900

   

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

    
   
3902
{

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

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

    
   
3905
#if 0

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

    
   
3907

   

    
   
3908
	if (mode) { /* Neon */

    
   
3909
		if (debug)

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

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

    
   
3912
		wctdm_setreg(wc, mod, 64, fxs->lasttxhook);

    
   
3913

   

    
   
3914
		wctdm_proslic_setreg_indirect(wc, mod, 22, 0x03e8);	/* RNGY (4 HZ) */

    
   
3915
		wctdm_proslic_setreg_indirect(wc, mod, 21, 0x7bef);	/* RNGX (91.5Vpk) */

    
   
3916
		wctdm_proslic_setreg_indirect(wc, mod, 20, 0x009f);	/* RCO (RNGX, t rise) */

    
   
3917

   

    
   
3918
		wctdm_setreg(wc, mod, 34, 0x19);			/* Ringing Osc. Control */

    
   
3919
		wctdm_setreg(wc, mod, 74, 0x3f);			/* VBATH 94.5V */

    
   
3920
		wctdm_proslic_setreg_indirect(wc, mod, 29, 0x4600);	/* RPTP */

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

    
   
3922
	} else {

    
   
3923
		if (debug)

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

    
   
3925

   

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

    
   
3927

   

    
   
3928
		wctdm_proslic_setreg_indirect(wc, mod, 22, 0x0000);	/* RNGY Initial Phase */

    
   
3929
		wctdm_proslic_setreg_indirect(wc, mod, 29, 0x3600);	/* RPTP */

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

    
   
3931

   

    
   
3932
		if (fastringer) {

    
   
3933
			/* Speed up Ringer */

    
   
3934
			reg20 =  0x7e6d;

    
   
3935

   

    
   
3936
			reg74 = 0x32;	/* Default */
Moved from 3154

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

    
   
3938
			if (boostringer) {

    
   
3939
				reg74 = 0x3f;

    
   
3940
				reg21 = 0x0247; /* RNGX */

    
   
3941
				if (debug)

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

    
   
3943
			} else if (lowpower) {

    
   
3944
				reg21 = 0x014b; /* RNGX */

    
   
3945
				if (debug)

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

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

    
   
3948
				reg21 = fxo_modes[_opermode].ring_x;

    
   
3949
				if (debug)

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

    
   
3951
			} else {

    
   
3952
				reg21 = 0x01b9;

    
   
3953
				if (debug)

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

    
   
3955
			}

    
   
3956
			wctdm_setreg(wc, mod, 74, reg74);			/* VBATH */

    
   
3957
			wctdm_proslic_setreg_indirect(wc, mod, 20, reg20);	/* RCO */

    
   
3958
			wctdm_proslic_setreg_indirect(wc, mod, 21, reg21);	/* RNGX */

    
   
3959

   

    
   
3960
		} else {

    
   
3961
			/* Ringer Speed */

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

    
   
3963
				reg20 = fxo_modes[_opermode].ring_osc;

    
   
3964
				if (debug)

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

    
   
3966
			} else {

    
   
3967
				reg20 = 0x7ef0; /* Default */

    
   
3968
			}

    
   
3969

   

    
   
3970
			reg74 = 0x32;   /* Default */
Moved from 3154

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

    
   
3972
			if (boostringer) {

    
   
3973
				reg74 = 0x3f;

    
   
3974
				reg21 = 0x1d1;

    
   
3975
				if (debug)

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

    
   
3977
			} else if (lowpower) {

    
   
3978
				reg21 = 0x108;

    
   
3979
				if (debug)

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

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

    
   
3982
				reg21 = fxo_modes[_opermode].ring_x;

    
   
3983
				if (debug)

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

    
   
3985
			} else {

    
   
3986
				reg21 = 0x160;

    
   
3987
				if (debug)

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

    
   
3989
			}

    
   
3990
			wctdm_setreg(wc, mod, 74, reg74);			/* VBATH */

    
   
3991
			wctdm_proslic_setreg_indirect(wc, mod, 20, reg20);	/* RCO */

    
   
3992
			wctdm_proslic_setreg_indirect(wc, mod, 21, reg21);	/* RNGX */

    
   
3993
		}

    
   
3994
	}

    
   
3995
#endif

    
   
3996
	if (debug)

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

    
   
3998
	return 0;

    
   
3999
}

    
   
4000

   

    
   
4001

   
3868
static int wctdm_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
4002
static int wctdm_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
3869
{
4003
{
3870
	struct wctdm *wc = chan->pvt;
4004
	struct wctdm *wc = chan->pvt;
3871
	int reg = 0;
4005
	int reg = 0;
3872
	struct wctdm_module *const mod = &wc->mods[chan->chanpos - 1];
4006
	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.