aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2012-04-24 16:52:13 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-26 05:21:03 -0400
commit864fd636b196e7502df14d82a719744203d47193 (patch)
treeab0ceb83956ecb2dcd26b91058e0c4cb8a80d4f9 /drivers/isdn/hardware
parentd2fb549654882ae5806a8a676b322ac1ceea4608 (diff)
mISDN: Rework of LED status display for HFC-4S/8S/E1 cards.
LEDs will show RED if layer 1 is disabled or fails. LEDs will show GREEN if layer 1 is active. LEDs will blink if traffic on D-channel. Signed-off-by: Andreas Eversberg <jolly@eversberg.eu> Signed-off-by: Karsten Keil <keil@b1-systems.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/hardware')
-rw-r--r--drivers/isdn/hardware/mISDN/hfc_multi.h9
-rw-r--r--drivers/isdn/hardware/mISDN/hfcmulti.c157
2 files changed, 95 insertions, 71 deletions
diff --git a/drivers/isdn/hardware/mISDN/hfc_multi.h b/drivers/isdn/hardware/mISDN/hfc_multi.h
index b0588acbb47d..09e4e77811f1 100644
--- a/drivers/isdn/hardware/mISDN/hfc_multi.h
+++ b/drivers/isdn/hardware/mISDN/hfc_multi.h
@@ -205,18 +205,19 @@ struct hfc_multi {
205 205
206 u_int slots; /* number of PCM slots */ 206 u_int slots; /* number of PCM slots */
207 u_int leds; /* type of leds */ 207 u_int leds; /* type of leds */
208 u_int ledcount; /* used to animate leds */
209 u_long ledstate; /* save last state of leds */ 208 u_long ledstate; /* save last state of leds */
210 int opticalsupport; /* has the e1 board */ 209 int opticalsupport; /* has the e1 board */
211 /* an optical Interface */ 210 /* an optical Interface */
212 int dslot; /* channel # of d-channel (E1) default 16 */ 211 int dslot; /* channel # of d-channel (E1) default 16 */
212 u_int activity_tx; /* if there is data TX / RX */
213 u_int activity_rx; /* bitmask according to port number */
214 /* (will be cleared after */
215 /* showing led-states) */
216 u_int flash[8]; /* counter for flashing 8 leds on activity */
213 217
214 u_long wdcount; /* every 500 ms we need to */ 218 u_long wdcount; /* every 500 ms we need to */
215 /* send the watchdog a signal */ 219 /* send the watchdog a signal */
216 u_char wdbyte; /* watchdog toggle byte */ 220 u_char wdbyte; /* watchdog toggle byte */
217 u_int activity[8]; /* if there is any action on this */
218 /* port (will be cleared after */
219 /* showing led-states) */
220 int e1_state; /* keep track of last state */ 221 int e1_state; /* keep track of last state */
221 int e1_getclock; /* if sync is retrieved from interface */ 222 int e1_getclock; /* if sync is retrieved from interface */
222 int syncronized; /* keep track of existing sync interface */ 223 int syncronized; /* keep track of existing sync interface */
diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c
index cc978e8f2c9b..876f7d0db26f 100644
--- a/drivers/isdn/hardware/mISDN/hfcmulti.c
+++ b/drivers/isdn/hardware/mISDN/hfcmulti.c
@@ -1607,40 +1607,46 @@ hfcmulti_leds(struct hfc_multi *hc)
1607 struct dchannel *dch; 1607 struct dchannel *dch;
1608 int led[4]; 1608 int led[4];
1609 1609
1610 hc->ledcount += poll;
1611 if (hc->ledcount > 4096) {
1612 hc->ledcount -= 4096;
1613 hc->ledstate = 0xAFFEAFFE;
1614 }
1615
1616 switch (hc->leds) { 1610 switch (hc->leds) {
1617 case 1: /* HFC-E1 OEM */ 1611 case 1: /* HFC-E1 OEM */
1618 /* 2 red blinking: NT mode deactivate 1612 /* 2 red steady: LOS
1619 * 2 red steady: TE mode deactivate 1613 * 1 red steady: L1 not active
1620 * left green: L1 active 1614 * 2 green steady: L1 active
1621 * left red: frame sync, but no L1 1615 * 1st green flashing: activity on TX
1622 * todo right green: L2 active 1616 * 2nd green flashing: activity on RX
1623 */ 1617 */
1618 led[0] = 0;
1619 led[1] = 0;
1620 led[2] = 0;
1621 led[3] = 0;
1624 dch = hc->chan[hc->dslot].dch; 1622 dch = hc->chan[hc->dslot].dch;
1625 if (test_bit(FLG_ACTIVE, &dch->Flags)) { 1623 if (dch) {
1626 led[0] = 0; 1624 if (hc->chan[hc->dslot].los)
1627 led[1] = 0;
1628 led[2] = 0;
1629 led[3] = 1;
1630 } else {
1631 if (dch->dev.D.protocol
1632 != ISDN_P_NT_E1) {
1633 led[0] = 1;
1634 led[1] = 1; 1625 led[1] = 1;
1635 } else if (hc->ledcount >> 11) { 1626 if (hc->e1_state != 1) {
1636 led[0] = 1; 1627 led[0] = 1;
1637 led[1] = 1; 1628 hc->flash[2] = 0;
1629 hc->flash[3] = 0;
1638 } else { 1630 } else {
1639 led[0] = 0; 1631 led[2] = 1;
1640 led[1] = 0; 1632 led[3] = 1;
1633 if (!hc->flash[2] && hc->activity_tx)
1634 hc->flash[2] = poll;
1635 if (!hc->flash[3] && hc->activity_rx)
1636 hc->flash[3] = poll;
1637 if (hc->flash[2] && hc->flash[2] < 1024)
1638 led[2] = 0;
1639 if (hc->flash[3] && hc->flash[3] < 1024)
1640 led[3] = 0;
1641 if (hc->flash[2] >= 2048)
1642 hc->flash[2] = 0;
1643 if (hc->flash[3] >= 2048)
1644 hc->flash[3] = 0;
1645 if (hc->flash[2])
1646 hc->flash[2] += poll;
1647 if (hc->flash[3])
1648 hc->flash[3] += poll;
1641 } 1649 }
1642 led[2] = 0;
1643 led[3] = 0;
1644 } 1650 }
1645 leds = (led[0] | (led[1]<<2) | (led[2]<<1) | (led[3]<<3))^0xF; 1651 leds = (led[0] | (led[1]<<2) | (led[2]<<1) | (led[3]<<3))^0xF;
1646 /* leds are inverted */ 1652 /* leds are inverted */
@@ -1651,9 +1657,9 @@ hfcmulti_leds(struct hfc_multi *hc)
1651 break; 1657 break;
1652 1658
1653 case 2: /* HFC-4S OEM */ 1659 case 2: /* HFC-4S OEM */
1654 /* red blinking = PH_DEACTIVATE NT Mode 1660 /* red steady: PH_DEACTIVATE
1655 * red steady = PH_DEACTIVATE TE Mode 1661 * green steady: PH_ACTIVATE
1656 * green steady = PH_ACTIVATE 1662 * green flashing: activity on TX
1657 */ 1663 */
1658 for (i = 0; i < 4; i++) { 1664 for (i = 0; i < 4; i++) {
1659 state = 0; 1665 state = 0;
@@ -1669,17 +1675,20 @@ hfcmulti_leds(struct hfc_multi *hc)
1669 if (state) { 1675 if (state) {
1670 if (state == active) { 1676 if (state == active) {
1671 led[i] = 1; /* led green */ 1677 led[i] = 1; /* led green */
1672 } else 1678 hc->activity_tx |= hc->activity_rx;
1673 if (dch->dev.D.protocol == ISDN_P_TE_S0) 1679 if (!hc->flash[i] &&
1674 /* TE mode: led red */ 1680 (hc->activity_tx & (1 << i)))
1675 led[i] = 2; 1681 hc->flash[i] = poll;
1676 else 1682 if (hc->flash[i] && hc->flash[i] < 1024)
1677 if (hc->ledcount >> 11) 1683 led[i] = 0; /* led off */
1678 /* led red */ 1684 if (hc->flash[i] >= 2048)
1679 led[i] = 2; 1685 hc->flash[i] = 0;
1680 else 1686 if (hc->flash[i])
1681 /* led off */ 1687 hc->flash[i] += poll;
1682 led[i] = 0; 1688 } else {
1689 led[i] = 2; /* led red */
1690 hc->flash[i] = 0;
1691 }
1683 } else 1692 } else
1684 led[i] = 0; /* led off */ 1693 led[i] = 0; /* led off */
1685 } 1694 }
@@ -1712,9 +1721,9 @@ hfcmulti_leds(struct hfc_multi *hc)
1712 break; 1721 break;
1713 1722
1714 case 3: /* HFC 1S/2S Beronet */ 1723 case 3: /* HFC 1S/2S Beronet */
1715 /* red blinking = PH_DEACTIVATE NT Mode 1724 /* red steady: PH_DEACTIVATE
1716 * red steady = PH_DEACTIVATE TE Mode 1725 * green steady: PH_ACTIVATE
1717 * green steady = PH_ACTIVATE 1726 * green flashing: activity on TX
1718 */ 1727 */
1719 for (i = 0; i < 2; i++) { 1728 for (i = 0; i < 2; i++) {
1720 state = 0; 1729 state = 0;
@@ -1730,22 +1739,23 @@ hfcmulti_leds(struct hfc_multi *hc)
1730 if (state) { 1739 if (state) {
1731 if (state == active) { 1740 if (state == active) {
1732 led[i] = 1; /* led green */ 1741 led[i] = 1; /* led green */
1733 } else 1742 hc->activity_tx |= hc->activity_rx;
1734 if (dch->dev.D.protocol == ISDN_P_TE_S0) 1743 if (!hc->flash[i] &&
1735 /* TE mode: led red */ 1744 (hc->activity_tx & (1 << i)))
1736 led[i] = 2; 1745 hc->flash[i] = poll;
1737 else 1746 if (hc->flash[i] < 1024)
1738 if (hc->ledcount >> 11) 1747 led[i] = 0; /* led off */
1739 /* led red */ 1748 if (hc->flash[i] >= 2048)
1740 led[i] = 2; 1749 hc->flash[i] = 0;
1741 else 1750 if (hc->flash[i])
1742 /* led off */ 1751 hc->flash[i] += poll;
1743 led[i] = 0; 1752 } else {
1753 led[i] = 2; /* led red */
1754 hc->flash[i] = 0;
1755 }
1744 } else 1756 } else
1745 led[i] = 0; /* led off */ 1757 led[i] = 0; /* led off */
1746 } 1758 }
1747
1748
1749 leds = (led[0] > 0) | ((led[1] > 0) << 1) | ((led[0]&1) << 2) 1759 leds = (led[0] > 0) | ((led[1] > 0) << 1) | ((led[0]&1) << 2)
1750 | ((led[1]&1) << 3); 1760 | ((led[1]&1) << 3);
1751 if (leds != (int)hc->ledstate) { 1761 if (leds != (int)hc->ledstate) {
@@ -1757,8 +1767,11 @@ hfcmulti_leds(struct hfc_multi *hc)
1757 } 1767 }
1758 break; 1768 break;
1759 case 8: /* HFC 8S+ Beronet */ 1769 case 8: /* HFC 8S+ Beronet */
1760 lled = 0; 1770 /* off: PH_DEACTIVATE
1761 1771 * steady: PH_ACTIVATE
1772 * flashing: activity on TX
1773 */
1774 lled = 0xff; /* leds off */
1762 for (i = 0; i < 8; i++) { 1775 for (i = 0; i < 8; i++) {
1763 state = 0; 1776 state = 0;
1764 active = -1; 1777 active = -1;
@@ -1772,14 +1785,20 @@ hfcmulti_leds(struct hfc_multi *hc)
1772 } 1785 }
1773 if (state) { 1786 if (state) {
1774 if (state == active) { 1787 if (state == active) {
1775 lled |= 0 << i; 1788 lled &= ~(1 << i); /* led on */
1789 hc->activity_tx |= hc->activity_rx;
1790 if (!hc->flash[i] &&
1791 (hc->activity_tx & (1 << i)))
1792 hc->flash[i] = poll;
1793 if (hc->flash[i] < 1024)
1794 lled |= 1 << i; /* led off */
1795 if (hc->flash[i] >= 2048)
1796 hc->flash[i] = 0;
1797 if (hc->flash[i])
1798 hc->flash[i] += poll;
1776 } else 1799 } else
1777 if (hc->ledcount >> 11) 1800 hc->flash[i] = 0;
1778 lled |= 0 << i; 1801 }
1779 else
1780 lled |= 1 << i;
1781 } else
1782 lled |= 1 << i;
1783 } 1802 }
1784 leddw = lled << 24 | lled << 16 | lled << 8 | lled; 1803 leddw = lled << 24 | lled << 16 | lled << 8 | lled;
1785 if (leddw != hc->ledstate) { 1804 if (leddw != hc->ledstate) {
@@ -1794,6 +1813,8 @@ hfcmulti_leds(struct hfc_multi *hc)
1794 } 1813 }
1795 break; 1814 break;
1796 } 1815 }
1816 hc->activity_tx = 0;
1817 hc->activity_rx = 0;
1797} 1818}
1798/* 1819/*
1799 * read dtmf coefficients 1820 * read dtmf coefficients
@@ -2093,7 +2114,8 @@ next_frame:
2093 *txpending = 1; 2114 *txpending = 1;
2094 2115
2095 /* show activity */ 2116 /* show activity */
2096 hc->activity[hc->chan[ch].port] = 1; 2117 if (dch)
2118 hc->activity_tx |= 1 << hc->chan[ch].port;
2097 2119
2098 /* fill fifo to what we have left */ 2120 /* fill fifo to what we have left */
2099 ii = len; 2121 ii = len;
@@ -2236,7 +2258,8 @@ next_frame:
2236 } 2258 }
2237 } 2259 }
2238 /* show activity */ 2260 /* show activity */
2239 hc->activity[hc->chan[ch].port] = 1; 2261 if (dch)
2262 hc->activity_rx |= 1 << hc->chan[ch].port;
2240 2263
2241 /* empty fifo with what we have */ 2264 /* empty fifo with what we have */
2242 if (dch || test_bit(FLG_HDLC, &bch->Flags)) { 2265 if (dch || test_bit(FLG_HDLC, &bch->Flags)) {