[dahdi-commits] tzafrir: branch linux/2.5 r10488 - /linux/branches/2.5/drivers/dahdi/xpp/
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Thu Mar 15 12:33:20 CDT 2012
Author: tzafrir
Date: Thu Mar 15 12:33:16 2012
New Revision: 10488
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10488
Log:
xpp: FXS: better power-down to lower noise
* Now every linefeed control command which is not RING'ing
powers-down the SLIC. This reduce audible noise when
several channels are ringing.
* Simplify code by removing redundant calls to do_chan_power()
before linefeed_control()
* Manage vbat_h state so we skip do_chan_power() calls when
there isn't a state change
* Export vbat_h state to /proc/.../fxs_info
Signed-off-by: Oron Peled <oron.peled at xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10478
Modified:
linux/branches/2.5/drivers/dahdi/xpp/card_fxs.c
Modified: linux/branches/2.5/drivers/dahdi/xpp/card_fxs.c
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.5/drivers/dahdi/xpp/card_fxs.c?view=diff&rev=10488&r1=10487&r2=10488
==============================================================================
--- linux/branches/2.5/drivers/dahdi/xpp/card_fxs.c (original)
+++ linux/branches/2.5/drivers/dahdi/xpp/card_fxs.c Thu Mar 15 12:33:16 2012
@@ -135,6 +135,7 @@
xpp_line_t want_dtmf_mute; /* what dahdi want */
xpp_line_t prev_key_down; /* DTMF down sets the bit */
xpp_line_t neon_blinking;
+ xpp_line_t vbat_h; /* High voltage */
struct timeval prev_key_time[CHANNELS_PERXPD];
int led_counter[NUM_LEDS][CHANNELS_PERXPD];
int ohttimer[CHANNELS_PERXPD];
@@ -157,24 +158,33 @@
#define LED_BLINK_RING (1000/8) /* in ticks */
/*---------------- FXS: Static functions ----------------------------------*/
+static int do_chan_power(xbus_t *xbus, xpd_t *xpd, lineno_t chan, bool on)
+{
+ struct FXS_priv_data *priv;
+
+ BUG_ON(!xbus);
+ BUG_ON(!xpd);
+ priv = xpd->priv;
+ LINE_DBG(SIGNAL, xpd, chan, "%s\n", (on) ? "up" : "down");
+ if (on)
+ BIT_SET(priv->vbat_h, chan);
+ else
+ BIT_CLR(priv->vbat_h, chan);
+ return SLIC_DIRECT_REQUEST(xbus, xpd, chan, SLIC_WRITE, REG_BATTERY,
+ (on) ? REG_BATTERY_BATSL : 0x00);
+}
+
static int linefeed_control(xbus_t *xbus, xpd_t *xpd, lineno_t chan, enum fxs_state value)
{
struct FXS_priv_data *priv;
+ bool want_vbat_h = (value == FXS_LINE_RING) ? 1 : 0;
priv = xpd->priv;
LINE_DBG(SIGNAL, xpd, chan, "value=0x%02X\n", value);
priv->lasttxhook[chan] = value;
+ if (IS_SET(priv->vbat_h, chan) != want_vbat_h)
+ do_chan_power(xbus, xpd, chan, want_vbat_h);
return SLIC_DIRECT_REQUEST(xbus, xpd, chan, SLIC_WRITE, 0x40, value);
-}
-
-static int do_chan_power(xbus_t *xbus, xpd_t *xpd, lineno_t chan, bool on)
-{
- int value = (on) ? REG_BATTERY_BATSL : 0x00;
-
- BUG_ON(!xbus);
- BUG_ON(!xpd);
- LINE_DBG(SIGNAL, xpd, chan, "%s\n", (on) ? "up" : "down");
- return SLIC_DIRECT_REQUEST(xbus, xpd, chan, SLIC_WRITE, REG_BATTERY, value);
}
static void vmwi_search(xpd_t *xpd, lineno_t pos, bool on)
@@ -654,7 +664,6 @@
msgs = PHONEDEV(xpd).msg_waiting[pos];
LINE_DBG(SIGNAL, xpd, pos, "%s\n", (msgs) ? "ON" : "OFF");
set_vm_led_mode(xbus, xpd, pos, msgs);
- do_chan_power(xbus, xpd, pos, msgs > 0);
linefeed_control(xbus, xpd, pos, (msgs > 0) ?
FXS_LINE_RING : priv->idletxhookstate[pos]);
}
@@ -691,7 +700,6 @@
LINE_DBG(SIGNAL, xpd, chan, "%s\n", (on)?"on":"off");
priv = xpd->priv;
set_vm_led_mode(xbus, xpd, chan, 0);
- do_chan_power(xbus, xpd, chan, on); // Power up (for ring)
ret = linefeed_control(xbus, xpd, chan, value);
if(on) {
MARK_BLINK(priv, chan, LED_GREEN, LED_BLINK_RING);
@@ -1555,6 +1563,11 @@
IS_SET(priv->search_fsk_pattern, i)
);
}
+ len += sprintf(page + len, "\n%-12s", "vbat_h:");
+ for_each_line(xpd, i) {
+ len += sprintf(page + len, "%4d",
+ IS_SET(priv->vbat_h, i));
+ }
len += sprintf(page + len, "\n");
for(led = 0; led < NUM_LEDS; led++) {
len += sprintf(page + len, "LED #%d", led);
More information about the dahdi-commits
mailing list