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 5

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/trunk/drivers/dahdi/wctdm24xxp/base.c: Loading...
  2. linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h: Loading...
linux/trunk/drivers/dahdi/wctdm24xxp/base.c
Revision 10660 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] 159 lines
[+20] [+] static const struct dahdi_echocan_ops vpm_ec_ops = {
277

    
   
277

   
278
static int
278
static int
279
wctdm_init_proslic(struct wctdm *wc, struct wctdm_module *const mod, int fast,
279
wctdm_init_proslic(struct wctdm *wc, struct wctdm_module *const mod, int fast,
280
		   int manual, int sane);
280
		   int manual, int sane);
281

    
   
281

   

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

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

    
   
284

   
282
static void set_offsets(struct wctdm_module *const mod, int altcs)
285
static void set_offsets(struct wctdm_module *const mod, int altcs)
283
{
286
{
284
	int card = mod->card;
287
	int card = mod->card;
285
	int bit;
288
	int bit;
286

    
   
289

   
[+20] [20] 1452 lines
[+20] [+] wctdm_proslic_recheck_sanity(struct wctdm *wc, struct wctdm_module *const mod)
1739
				   "Power alarm on module %d, resetting!\n",
1742
				   "Power alarm on module %d, resetting!\n",
1740
				   mod->card + 1);
1743
				   mod->card + 1);
1741
			if (fxs->lasttxhook == SLIC_LF_RINGING) {
1744
			if (fxs->lasttxhook == SLIC_LF_RINGING) {
1742
				fxs->lasttxhook = POLARITY_XOR(fxs) ?
1745
				fxs->lasttxhook = POLARITY_XOR(fxs) ?
1743
							SLIC_LF_ACTIVE_REV :
1746
							SLIC_LF_ACTIVE_REV :
1744
							SLIC_LF_ACTIVE_FWD;;
1747
							SLIC_LF_ACTIVE_FWD;
1745
			}
1748
			}
1746
			fxs->lasttxhook |= SLIC_LF_OPPENDING;
1749
			fxs->lasttxhook |= SLIC_LF_OPPENDING;
1747
			mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
1750
			mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
1748
			fxs->oppending_timeout = wc->framecount + 100;
1751
			fxs->oppending_timeout = wc->framecount + 100;
1749

    
   
1752

   
[+20] [20] 511 lines
[+20] [+] wctdm_fxs_hooksig(struct wctdm *wc, struct wctdm_module *const mod,
2261
		case DAHDI_SIG_FXOGS:
2264
		case DAHDI_SIG_FXOGS:
2262
			x = (POLARITY_XOR(fxs)) ?
2265
			x = (POLARITY_XOR(fxs)) ?
2263
					SLIC_LF_RING_OPEN :
2266
					SLIC_LF_RING_OPEN :
2264
					SLIC_LF_TIP_OPEN;
2267
					SLIC_LF_TIP_OPEN;
2265
			break;
2268
			break;
2266
		case DAHDI_SIG_EM:

   
2267
		case DAHDI_SIG_FXOKS:
2269
		case DAHDI_SIG_FXOKS:
2268
		case DAHDI_SIG_FXOLS:
2270
		case DAHDI_SIG_FXOLS:

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

    
   
2272
			if (!fxs->ohttimer) {

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

    
   
2274
				x = fxs->vmwi_hvac ?

    
   
2275
					SLIC_LF_RINGING :

    
   
2276
					fxs->idletxhookstate;

    
   
2277
			} else

    
   
2278
				x = fxs->idletxhookstate;

    
   
2279
			break;

    
   
2280
		case DAHDI_SIG_EM:
2269
		default:
2281
		default:
2270
			x = fxs->idletxhookstate;
2282
			x = fxs->idletxhookstate;
2271
			break;
2283
			break;
2272
		}
2284
		}
2273
		break;
2285
		break;
2274
	case DAHDI_TXSIG_OFFHOOK:
2286
	case DAHDI_TXSIG_OFFHOOK:
2275
		switch (get_dahdi_chan(wc, mod)->sig) {
2287
		switch (get_dahdi_chan(wc, mod)->sig) {
2276
		case DAHDI_SIG_EM:
2288
		case DAHDI_SIG_EM:
2277
			x = (POLARITY_XOR(fxs)) ?
2289
			x = POLARITY_XOR(fxs) ?
2278
					SLIC_LF_ACTIVE_FWD :
2290
					SLIC_LF_ACTIVE_FWD :
2279
					SLIC_LF_ACTIVE_REV;
2291
					SLIC_LF_ACTIVE_REV;
2280
			break;
2292
			break;
2281
		default:
2293
		default:
2282
			x = fxs->idletxhookstate;
2294
			x = fxs->idletxhookstate;
2283
			break;
2295
			break;
2284
		}
2296
		}
2285
		break;
2297
		break;
2286
	case DAHDI_TXSIG_START:
2298
	case DAHDI_TXSIG_START:

    
   
2299
		wctdm_set_ring_generator_mode(wc, mod, 0); /* Set ringer mode */
2287
		x = SLIC_LF_RINGING;
2300
		x = SLIC_LF_RINGING;
2288
		break;
2301
		break;
2289
	case DAHDI_TXSIG_KEWL:
2302
	case DAHDI_TXSIG_KEWL:
2290
		x = SLIC_LF_OPEN;
2303
		x = SLIC_LF_OPEN;
2291
		break;
2304
		break;
[+20] [20] 163 lines
[+20] [+] static void wctdm_isr_misc_fxs(struct wctdm *wc, struct wctdm_module *const mod)
2455
	if (time_after(wc->framecount, fxs->check_proslic)) {
2468
	if (time_after(wc->framecount, fxs->check_proslic)) {
2456
		fxs->check_proslic = wc->framecount + 250; /* every 250ms */
2469
		fxs->check_proslic = wc->framecount + 250; /* every 250ms */
2457
		wctdm_proslic_recheck_sanity(wc, mod);
2470
		wctdm_proslic_recheck_sanity(wc, mod);
2458
	}
2471
	}
2459

    
   
2472

   
2460
	if (SLIC_LF_RINGING == fxs->lasttxhook) {
2473
	if ((SLIC_LF_RINGING == fxs->lasttxhook) && fxs->neonringing) {

    
   
2474

   
2461
		/* RINGing, prepare for OHT */
2475
		/* RINGing, prepare for OHT */
2462
		fxs->ohttimer = wc->framecount + OHT_TIMER;
2476
		fxs->ohttimer = wc->framecount + OHT_TIMER;
2463
		/* OHT mode when idle */
2477
		/* OHT mode when idle */
2464
		fxs->idletxhookstate = POLARITY_XOR(fxs) ? SLIC_LF_OHTRAN_REV :
2478
		fxs->idletxhookstate = POLARITY_XOR(fxs) ? SLIC_LF_OHTRAN_REV :
2465
							    SLIC_LF_OHTRAN_FWD;
2479
							    SLIC_LF_OHTRAN_FWD;
[+20] [20] 5 lines
[+20] static void wctdm_isr_misc_fxs(struct wctdm *wc, struct wctdm_module *const mod)
2471

    
   
2485

   
2472
			/* Switch to active */
2486
			/* Switch to active */
2473
			fxs->idletxhookstate = POLARITY_XOR(fxs) ? SLIC_LF_ACTIVE_REV :
2487
			fxs->idletxhookstate = POLARITY_XOR(fxs) ? SLIC_LF_ACTIVE_REV :
2474
								    SLIC_LF_ACTIVE_FWD;
2488
								    SLIC_LF_ACTIVE_FWD;
2475
			spin_lock(&wc->reglock);
2489
			spin_lock(&wc->reglock);
2476
			if (SLIC_LF_OHTRAN_FWD == fxs->lasttxhook) {
2490
			if ((SLIC_LF_OHTRAN_FWD == fxs->lasttxhook) ||
2477
				/* Apply the change if appropriate */
2491
				(SLIC_LF_OHTRAN_REV == fxs->lasttxhook)) {
2478
				fxs->lasttxhook = SLIC_LF_OPPENDING | SLIC_LF_ACTIVE_FWD;
2492
				if (fxs->vmwi_hvac) {
2479
				/* Data enqueued here */
2493
					/* force idle polarity Forward if ringing */
2480
				mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
2494
					fxs->idletxhookstate = SLIC_LF_ACTIVE_FWD;
2481
				if (debug & DEBUG_CARD) {
2495
					/* Set ring generator for neon */
2482
					dev_info(&wc->vb.pdev->dev,
2496
					wctdm_set_ring_generator_mode(wc, mod, 1);
2483
						 "Channel %d OnHookTransfer "
2497
					fxs->lasttxhook = (SLIC_LF_OPPENDING |
2484
						 "stop\n", mod->card);
2498
							SLIC_LF_RINGING);
2485
				}
2499
				} else
2486
			} else if (SLIC_LF_OHTRAN_REV == fxs->lasttxhook) {
2500
					fxs->lasttxhook = (SLIC_LF_OPPENDING |
2487
				/* Apply the change if appropriate */
2501
							fxs->idletxhookstate);
2488
				fxs->lasttxhook = SLIC_LF_OPPENDING | SLIC_LF_ACTIVE_REV;
2502

   
2489
				/* Data enqueued here */
2503
				/* Data enqueued here */
2490
				mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
2504
				mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
2491
				if (debug & DEBUG_CARD) {
2505
				if (debug & DEBUG_CARD) {
2492
					dev_info(&wc->vb.pdev->dev,
2506
					dev_info(&wc->vb.pdev->dev,
2493
						 "Channel %d OnHookTransfer "
2507
						 "Channel %d OnHookTransfer "
[+20] [20] 510 lines
[+20] [+] static int set_lasttxhook_interruptible(struct wctdm *wc, struct fxs *fxs,
3004
static int set_vmwi(struct wctdm *wc, struct wctdm_module *const mod)
3018
static int set_vmwi(struct wctdm *wc, struct wctdm_module *const mod)
3005
{
3019
{
3006
	int x;
3020
	int x;
3007
	struct fxs *const fxs = &mod->mod.fxs;
3021
	struct fxs *const fxs = &mod->mod.fxs;
3008

    
   
3022

   
3009
	/* Presently only supports line reversal MWI */
3023
	/* Presently supports line reversal MWI and NEON dc pulses */
3010
	if ((fxs->vmwi_active_messages) &&
3024
	if (fxs->vmwi_active_messages) {
3011
	    (fxs->vmwisetting.vmwi_type & DAHDI_VMWI_LREV))
3025
		fxs->vmwi_linereverse = (fxs->vmwisetting.vmwi_type & DAHDI_VMWI_LREV) ? 1 : 0;
3012
		fxs->vmwi_linereverse = 1;
3026
		fxs->vmwi_hvac = (fxs->vmwisetting.vmwi_type & DAHDI_VMWI_HVAC) ? 1 : 0;
3013
	else
3027
	} else {
3014
		fxs->vmwi_linereverse = 0;
3028
		fxs->vmwi_linereverse = 0;

    
   
3029
		fxs->vmwi_hvac = 0;

    
   
3030
	}
3015

    
   
3031

   

    
   
3032
	if (fxs->vmwi_hvac) {

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

    
   
3034
		if (!fxs->ohttimer) {
3016
	/* Set line polarity for new VMWI state */
3035
			/* Set line polarity for new VMWI state */
3017
	if (POLARITY_XOR(fxs)) {
3036
			if (POLARITY_XOR(fxs))
3018
		fxs->idletxhookstate |= SLIC_LF_REVMASK;
3037
				fxs->idletxhookstate |= SLIC_LF_REVMASK;
3019
		/* Do not set while currently ringing or open */
3038
			else
3020
		if (((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_RINGING)  &&
3039
				fxs->idletxhookstate &= ~SLIC_LF_REVMASK;
3021
		    ((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_OPEN)) {
3040

   
3022
			x = fxs->lasttxhook;
3041
			/* Set ring generator for neon */
3023
			x |= SLIC_LF_REVMASK;
3042
			wctdm_set_ring_generator_mode(wc, mod, 1);
3024
			set_lasttxhook_interruptible(wc, fxs, x, &mod->sethook);
3043
			set_lasttxhook_interruptible(wc, fxs, fxs->lasttxhook, &mod->sethook);
3025
		}
3044
		}
3026
	} else {
3045
	} else {

    
   
3046
		if (fxs->neonringing) {

    
   
3047
			/* Set ring generator for normal ringer */

    
   
3048
			wctdm_set_ring_generator_mode(wc, mod, 0);

    
   
3049
			/* ACTIVE, polarity determined later */

    
   
3050
			fxs->lasttxhook = SLIC_LF_ACTIVE_FWD;

    
   
3051
		} else {

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

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

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

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

    
   
3056
				if (POLARITY_XOR(fxs))

    
   
3057
					fxs->idletxhookstate |= SLIC_LF_REVMASK;

    
   
3058
				else
3027
		fxs->idletxhookstate &= ~SLIC_LF_REVMASK;
3059
					fxs->idletxhookstate &= ~SLIC_LF_REVMASK;
3028
		/* Do not set while currently ringing or open */
3060

   
3029
		if (((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_RINGING) &&
3061
				dev_info(&wc->vb.pdev->dev,
3030
		    ((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_OPEN)) {
3062
					"Unable to change polarity on channel %d, lasttxhook=0x%X\n",

    
   
3063
					mod->card,

    
   
3064
					fxs->lasttxhook

    
   
3065
					);

    
   
3066
				return 0;

    
   
3067
			}

    
   
3068
		}

    
   
3069

   

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

    
   
3071
		if (POLARITY_XOR(fxs)) {

    
   
3072
			fxs->idletxhookstate |= SLIC_LF_REVMASK;

    
   
3073
			fxs->lasttxhook |= SLIC_LF_REVMASK;

    
   
3074
		} else {

    
   
3075
			fxs->idletxhookstate &= ~SLIC_LF_REVMASK;

    
   
3076

   
3031
			x = fxs->lasttxhook;
3077
			x = fxs->lasttxhook;
3032
			x &= ~SLIC_LF_REVMASK;
3078
			x &= ~SLIC_LF_REVMASK;
3033
			set_lasttxhook_interruptible(wc, fxs, x, &mod->sethook);
3079
			fxs->lasttxhook = x;
3034
		}
3080
		}

    
   
3081
		set_lasttxhook_interruptible(wc, fxs, fxs->idletxhookstate, &mod->sethook);
3035
	}
3082
	}
3036
	if (debug) {
3083
	if (debug) {
3037
		dev_info(&wc->vb.pdev->dev,
3084
		dev_info(&wc->vb.pdev->dev,
3038
			 "Setting VMWI on channel %d, messages=%d, lrev=%d\n",
3085
			"Setting VMWI on channel %d, messages=%d, lrev=%d hvac=%d\n",
3039
			 mod->card, fxs->vmwi_active_messages,
3086
			mod->card, fxs->vmwi_active_messages,
3040
			 fxs->vmwi_linereverse);
3087
			fxs->vmwi_linereverse, fxs->vmwi_hvac);

    
   
3088

   
3041
	}
3089
	}
3042
	return 0;
3090
	return 0;
3043
}
3091
}
3044

    
   
3092

   
3045
static void
3093
static void
[+20] [20] 354 lines
[+20] [+] wctdm_init_proslic(struct wctdm *wc, struct wctdm_module *const mod,
3400
    wctdm_setreg(wc, card, 14, 0x0);
3448
    wctdm_setreg(wc, card, 14, 0x0);
3401
    wctdm_setreg(wc, card, 64, 0x0);
3449
    wctdm_setreg(wc, card, 64, 0x0);
3402
    wctdm_setreg(wc, card, 1, 0x08);
3450
    wctdm_setreg(wc, card, 1, 0x08);
3403
#endif
3451
#endif
3404

    
   
3452

   
3405
	if (fastringer) {
3453
	if (wctdm_init_ring_generator_mode(wc, mod))
3406
		/* Speed up Ringer */

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

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

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

   
3410
		if (boostringer) {

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

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

   
3413
				return -1;
3454
			return -1;
3414
			dev_info(&wc->vb.pdev->dev,

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

   
3416
				 mod->card + 1);

   
3417
		} else if (lowpower) {

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

   
3419
				return -1;

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

   
3421
				 "Reducing fast ring power on slot %d "

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

   
3423
		} else

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

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

   
3426
				 mod->card + 1);

   
3427
	} else {

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

   
3429
		if (boostringer) {

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

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

   
3432
				return -1;

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

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

   
3435
				 mod->card + 1);

   
3436
		} else if (lowpower) {

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

   
3438
				return -1;

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

   
3440
				 "Reducing ring power on slot %d "

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

   
3442
		}

   
3443
	}

   
3444

    
   
3455

   
3445
	if (fxstxgain || fxsrxgain) {
3456
	if (fxstxgain || fxsrxgain) {
3446
		r9 = wctdm_getreg(wc, mod, 9);
3457
		r9 = wctdm_getreg(wc, mod, 9);
3447
		switch (fxstxgain) {
3458
		switch (fxstxgain) {
3448
		
3459
		
[+20] [20] 276 lines
[+20] [+] static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data)
3725
		/* Active mode when idle */
3736
		/* Active mode when idle */
3726
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?
3737
		fxs->idletxhookstate = POLARITY_XOR(fxs) ?
3727
						SLIC_LF_ACTIVE_REV :
3738
						SLIC_LF_ACTIVE_REV :
3728
						SLIC_LF_ACTIVE_FWD;
3739
						SLIC_LF_ACTIVE_FWD;
3729

    
   
3740

   

    
   
3741
		if (fxs->neonringing) {

    
   
3742
			/* keep same Forward polarity */

    
   
3743
			fxs->lasttxhook = SLIC_LF_OHTRAN_FWD;

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

    
   
3745
		} else {
3730
		if (((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_FWD) ||
3746
			if (((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_FWD) ||
3731
		    ((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_REV)) {
3747
			    ((fxs->lasttxhook & SLIC_LF_SETMASK) == SLIC_LF_ACTIVE_REV)) {
3732
			int res;
3748
				int res;
3733

    
   
3749

   
3734
			res = set_lasttxhook_interruptible(wc, fxs,
3750
				res = set_lasttxhook_interruptible(wc, fxs,
[+20] [20] 11 lines
[+20] static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data)
3746
					dev_info(&wc->vb.pdev->dev,
3762
						dev_info(&wc->vb.pdev->dev,
3747
						 "Channel %d OnHookTransfer "
3763
							 "Channel %d OnHookTransfer "
3748
						 "start\n", chan->chanpos - 1);
3764
							 "start\n", chan->chanpos - 1);
3749
				}
3765
					}
3750
			}
3766
				}
3751

    
   

   
3752
		}
3767
			}

    
   
3768
		}
3753

    
   
3769

   
3754
		fxs->ohttimer = wc->framecount + x;
3770
		fxs->ohttimer = wc->framecount + x;
3755
		fxs->oht_active = 1;
3771
		fxs->oht_active = 1;
3756

    
   
3772

   
3757
		break;
3773
		break;
[+20] [20] 369 lines
[+20] [+] static int wctdm_close(struct dahdi_chan *chan)
4127
	}
4143
	}
4128

    
   
4144

   
4129
	return 0;
4145
	return 0;
4130
}
4146
}
4131

    
   
4147

   

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

    
   
4149
{

    
   
4150
	unsigned long flags;

    
   
4151

   

    
   
4152
	wctdm_setreg(wc, mod, RING_OSC_CTL, 0x00);		/* Ringing Osc. Control */

    
   
4153

   

    
   
4154
								/* neon trapezoid timers */

    
   
4155
	wctdm_setreg(wc, mod, RING_ON__LO, 0xe0);		/* Active Timer low byte */

    
   
4156
	wctdm_setreg(wc, mod, RING_ON_HI, 0x01);		/* Active Timer high byte */

    
   
4157
	wctdm_setreg(wc, mod, RING_OFF_LO, 0xf0);		/* Inactive Timer low byte */

    
   
4158
	wctdm_setreg(wc, mod, RING_OFF_HI, 0x05);		/* Inactive Timer high byte */

    
   
4159

   

    
   
4160
	spin_lock_irqsave(&wc->reglock, flags);

    
   
4161
	wctdm_set_ring_generator_mode(wc, mod, 0);

    
   
4162
	spin_unlock_irqrestore(&wc->reglock, flags);

    
   
4163

   

    
   
4164
	return 0;

    
   
4165
}

    
   
4166

   

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

    
   
4168
{

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

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

    
   
4171

   

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

    
   
4173

   

    
   
4174
	if (mode) { /* Neon */

    
   
4175
		if (debug) {

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

    
   
4177
				"Neon ring on channel %d, lasttxhook was 0x%x\n",

    
   
4178
				mod->card,

    
   
4179
				fxs->lasttxhook

    
   
4180
				);

    
   
4181
		}

    
   
4182

   

    
   
4183
		/* Must be in FORWARD ACTIVE before setting up ringer */

    
   
4184
		fxs->lasttxhook = SLIC_LF_ACTIVE_FWD;

    
   
4185
		wctdm_setreg_intr(wc, mod, LINE_STATE, fxs->lasttxhook);

    
   
4186

   

    
   
4187
		wctdm_proslic_setreg_indirect(wc, mod, RING_Y, 0x03e8);			/* 4 HZ */

    
   
4188
		wctdm_proslic_setreg_indirect(wc, mod, RING_X, 0x7bef);			/* 91.5Vpk */

    
   
4189
		wctdm_proslic_setreg_indirect(wc, mod, RING_OSC_COEF, 0x009f);		/* (RNGX, t rise) */

    
   
4190

   

    
   
4191
		wctdm_setreg_intr(wc, mod, RING_OSC_CTL, 0x19);				/* Ringing Osc. Control */

    
   
4192
		wctdm_setreg_intr(wc, mod, BAT_V_HI, 0x3f);				/* 94.5V */

    
   
4193
		wctdm_proslic_setreg_indirect(wc, mod, RING_TRIP_THRESH, 0x4600);

    
   
4194
		/* A write of 0x04 to register LINE_STATE(64) will turn on the VM neon */

    
   
4195

   

    
   
4196
	} else {

    
   
4197
		if (debug) {

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

    
   
4199
				"Normal ring on channel %d, lasttxhook was 0x%x\n",

    
   
4200
				mod->card,

    
   
4201
				fxs->lasttxhook

    
   
4202
				);

    
   
4203
		}

    
   
4204

   

    
   
4205
		wctdm_setreg_intr(wc, mod, RING_OSC_CTL, 0x00);				/* Ringing Osc. Control */

    
   
4206
		wctdm_proslic_setreg_indirect(wc, mod, RING_Y, 0x0000);			/* RNGY Initial Phase */

    
   
4207
		wctdm_proslic_setreg_indirect(wc, mod, RING_TRIP_THRESH, 0x3600);	/* RPTP */

    
   
4208
		/* A write of 0x04 to register LINE_STATE(64) will turn on the ringer */

    
   
4209

   

    
   
4210
		if (fastringer) {

    
   
4211
			/* Speed up Ringer */

    
   
4212
			reg20 =  0x7e6d;

    
   
4213

   

    
   
4214
			reg74 = 0x32;	/* Default */
Moved from 3409

    
   
4215
			/* Beef up Ringing voltage to 89V */
Moved from 3410

    
   
4216
			if (boostringer) {

    
   
4217
				reg74 = 0x3f;

    
   
4218
				reg21 = 0x0247; /* RNGX */

    
   
4219
				if (debug)

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

    
   
4221
			} else if (lowpower) {

    
   
4222
				reg21 = 0x014b; /* RNGX */

    
   
4223
				if (debug)

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

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

    
   
4226
				reg21 = fxo_modes[_opermode].ring_x;

    
   
4227
				if (debug)

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

    
   
4229
			} else {

    
   
4230
				reg21 = 0x01b9;

    
   
4231
				if (debug)

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

    
   
4233
			}

    
   
4234
			wctdm_setreg_intr(wc, mod, BAT_V_HI, reg74);

    
   
4235
			wctdm_proslic_setreg_indirect(wc, mod, RING_OSC_COEF, reg20);

    
   
4236
			wctdm_proslic_setreg_indirect(wc, mod, RING_X, reg21);

    
   
4237

   

    
   
4238
		} else {

    
   
4239
			/* Ringer Speed */

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

    
   
4241
				reg20 = fxo_modes[_opermode].ring_osc;

    
   
4242
				if (debug)

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

    
   
4244
			} else {

    
   
4245
				reg20 = 0x7ef0; /* Default */

    
   
4246
			}

    
   
4247

   

    
   
4248
			reg74 = 0x32;   /* Default */
Moved from 3409

    
   
4249
			/* Beef up Ringing voltage to 89V */
Moved from 3410

    
   
4250
			if (boostringer) {

    
   
4251
				reg74 = 0x3f;

    
   
4252
				reg21 = 0x1d1;

    
   
4253
				if (debug)

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

    
   
4255
			} else if (lowpower) {

    
   
4256
				reg21 = 0x108;

    
   
4257
				if (debug)

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

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

    
   
4260
				reg21 = fxo_modes[_opermode].ring_x;

    
   
4261
				if (debug)

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

    
   
4263
			} else {

    
   
4264
				reg21 = 0x160;

    
   
4265
				if (debug)

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

    
   
4267
			}

    
   
4268
			wctdm_setreg_intr(wc, mod, BAT_V_HI, reg74);

    
   
4269
			wctdm_proslic_setreg_indirect(wc, mod, RING_OSC_COEF, reg20);

    
   
4270
			wctdm_proslic_setreg_indirect(wc, mod, RING_X, reg21);

    
   
4271
		}

    
   
4272
	}

    
   
4273
	return 0;

    
   
4274
}

    
   
4275

   

    
   
4276

   
4132
static int wctdm_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
4277
static int wctdm_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
4133
{
4278
{
4134
	struct wctdm *wc = chan->pvt;
4279
	struct wctdm *wc = chan->pvt;
4135
	int reg = 0;
4280
	int reg = 0;
4136
	struct wctdm_module *const mod = &wc->mods[chan->chanpos - 1];
4281
	struct wctdm_module *const mod = &wc->mods[chan->chanpos - 1];
[+20] [20] 2098 lines
linux/trunk/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
Revision 10660 New Change
 
  1. linux/trunk/drivers/dahdi/wctdm24xxp/base.c: Loading...
  2. 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.