From 33cce20d39f2565d11de5f66aa82293e8243d8fd Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Tue, 8 Mar 2011 11:42:26 -0600 Subject: [PATCH] wctdm24xxp: Fix regression with LEDS on TDM410. Signed-off-by: Shaun Ruffell --- drivers/dahdi/wctdm24xxp/base.c | 25 +++++++++++++++++++------ drivers/dahdi/wctdm24xxp/wctdm24xxp.h | 3 ++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c index f42ea2d..093f749 100644 --- a/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c @@ -921,12 +921,8 @@ static inline void wctdm_transmitprep(struct wctdm *wc, unsigned char *writechun if (x < DAHDI_CHUNKSIZE - 1) { writechunk[EFRAME_SIZE] = wc->ctlreg; writechunk[EFRAME_SIZE + 1] = wc->txident++; - - if ((wc->desc->ports == 4) && ((wc->ctlreg & 0x10))) { - writechunk[EFRAME_SIZE + 2] = 0; - for (y = 0; y < 4; y++) - writechunk[EFRAME_SIZE + 2] |= (1 << y); - } + if (4 == wc->desc->ports) + writechunk[EFRAME_SIZE + 2] = wc->tdm410leds; } writechunk += (EFRAME_SIZE + EFRAME_GAP); } @@ -4592,6 +4588,21 @@ static inline void remove_sysfs_files(struct wctdm *wc) { return; } #endif /* CONFIG_VOICEBUS_SYSFS */ +static void wctdm_set_tdm410_leds(struct wctdm *wc) +{ + int i; + + if (4 != wc->desc->ports) + return; + + wc->tdm410leds = 0; /* all on by default */ + for (i = 0; i < wc->desc->ports; ++i) { + /* Turn off the LED for any module that isn't installed. */ + if (MOD_TYPE_NONE == wc->modtype[i]) + wc->tdm410leds |= (1 << i); + } +} + #ifdef USE_ASYNC_INIT struct async_data { struct pci_dev *pdev; @@ -4734,6 +4745,8 @@ __wctdm_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) /* Now track down what modules are installed */ wctdm_identify_modules(wc); + wctdm_set_tdm410_leds(wc); + if (fatal_signal_pending(current)) { wctdm_back_out_gracefully(wc); return -EINTR; diff --git a/drivers/dahdi/wctdm24xxp/wctdm24xxp.h b/drivers/dahdi/wctdm24xxp/wctdm24xxp.h index cacd062..b8c86da 100644 --- a/drivers/dahdi/wctdm24xxp/wctdm24xxp.h +++ b/drivers/dahdi/wctdm24xxp/wctdm24xxp.h @@ -165,7 +165,8 @@ struct wctdm { unsigned char rxident; int flags[NUM_MODULES]; /* bitmap of board-specific + module-specific flags */ - unsigned char ctlreg; /* FIXME: something to do with VPM? */ + u8 ctlreg; /* FIXME: something to do with VPM? */ + u8 tdm410leds; int mods_per_board; /* maximum number of modules for this board */ int digi_mods; /* number of digital modules present */ -- 1.7.4