From 020735e3a76d64cb217442d0606633a5295d8270 Mon Sep 17 00:00:00 2001 From: Dima Stoliarov Date: Thu, 31 Mar 2016 20:13:32 +0300 Subject: [PATCH] xpp: FXS type 6: support digital outputs Signed-off-by: Tzafrir Cohen --- drivers/dahdi/xpp/card_fxs.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/dahdi/xpp/card_fxs.c b/drivers/dahdi/xpp/card_fxs.c index 1c9d145..8a3a00e 100644 --- a/drivers/dahdi/xpp/card_fxs.c +++ b/drivers/dahdi/xpp/card_fxs.c @@ -826,23 +826,34 @@ static void start_stop_vm_led(xbus_t *xbus, xpd_t *xpd, lineno_t pos) static int relay_out(xpd_t *xpd, int pos, bool on) { - int value; + int ret = 0; + int value = 0; int which = pos; - int relay_channels[] = { 0, 4 }; BUG_ON(!xpd); /* map logical position to output port number (0/1) */ which -= (XPD_HW(xpd).subtype == 2) ? 6 : 8; LINE_DBG(SIGNAL, xpd, pos, "which=%d -- %s\n", which, (on) ? "on" : "off"); - which = which % ARRAY_SIZE(relay_channels); - value = BIT(2) | BIT(3); - value |= - ((BIT(5) | BIT(6) | BIT(7)) & ~led_register_mask[OUTPUT_RELAY]); - if (on) - value |= led_register_vals[OUTPUT_RELAY]; - return SLIC_DIRECT_REQUEST(xpd->xbus, xpd, relay_channels[which], + if (XPD_HW(xpd).type == 6) { + int relay_values_type6[] = { 0x01, 0x40 }; + which = which % ARRAY_SIZE(relay_values_type6); + if (on) + value |= relay_values_type6[which]; + ret = EXP_REQUEST(xpd->xbus, xpd, SLIC_WRITE, + REG_TYPE6_EXP_GPIOB, value, relay_values_type6[which]); + } else { + int relay_channels_type1[] = { 0, 4 }; + which = which % ARRAY_SIZE(relay_channels_type1); + value = BIT(2) | BIT(3); + value |= + ((BIT(5) | BIT(6) | BIT(7)) & ~led_register_mask[OUTPUT_RELAY]); + if (on) + value |= led_register_vals[OUTPUT_RELAY]; + ret = SLIC_DIRECT_REQUEST(xpd->xbus, xpd, relay_channels_type1[which], SLIC_WRITE, REG_TYPE1_DIGITAL_IOCTRL, value); + } + return ret; } static int send_ring(xpd_t *xpd, lineno_t chan, bool on)