xpp: FXS type 6: basic hookstate detection

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
This commit is contained in:
Oron Peled 2015-11-30 19:07:08 +02:00 committed by Tzafrir Cohen
parent a380b84545
commit 28a2cd068d

View File

@ -582,8 +582,13 @@ static int FXS_card_init(xbus_t *xbus, xpd_t *xpd)
(PHONEDEV(xpd).digital_outputs | PHONEDEV(xpd). (PHONEDEV(xpd).digital_outputs | PHONEDEV(xpd).
digital_inputs, i)) digital_inputs, i))
continue; continue;
SLIC_DIRECT_REQUEST(xbus, xpd, i, SLIC_READ, REG_TYPE1_LOOPCLOSURE, if (XPD_HW(xpd).type == 6) {
0); SLIC_DIRECT_REQUEST(xbus, xpd, i, SLIC_READ, REG_TYPE6_LCRRTP,
0);
} else {
SLIC_DIRECT_REQUEST(xbus, xpd, i, SLIC_READ, REG_TYPE1_LOOPCLOSURE,
0);
}
} }
return 0; return 0;
err: err:
@ -1653,7 +1658,7 @@ static int FXS_card_register_reply(xbus_t *xbus, xpd_t *xpd, reg_cmd_t *info)
else if (!indirect && regnum == REG_TYPE1_DIGITAL_IOCTRL) else if (!indirect && regnum == REG_TYPE1_DIGITAL_IOCTRL)
process_digital_inputs(xpd, info); process_digital_inputs(xpd, info);
#endif #endif
else if (!indirect && regnum == REG_TYPE1_LOOPCLOSURE) { /* OFFHOOK ? */ else if (XPD_HW(xpd).type == 1 && !indirect && regnum == REG_TYPE1_LOOPCLOSURE) { /* OFFHOOK ? */
__u8 val = REG_FIELD(info, data_low); __u8 val = REG_FIELD(info, data_low);
xpp_line_t mask = BIT(info->h.portnum); xpp_line_t mask = BIT(info->h.portnum);
xpp_line_t offhook; xpp_line_t offhook;
@ -1670,6 +1675,23 @@ static int FXS_card_register_reply(xbus_t *xbus, xpd_t *xpd, reg_cmd_t *info)
val, offhook, mask); val, offhook, mask);
process_hookstate(xpd, offhook, mask); process_hookstate(xpd, offhook, mask);
} }
} else if (XPD_HW(xpd).type == 6 && !indirect && regnum == REG_TYPE6_LCRRTP) { /* OFFHOOK ? */
__u8 val = REG_FIELD(info, data_low);
xpp_line_t mask = BIT(info->h.portnum);
xpp_line_t offhook;
/*
* Validate reply. Non-existing/disabled ports
* will reply with 0xFF. Ignore these.
*/
if ((val & REG_TYPE6_LCRRTP_ZERO) == 0) {
offhook = (val & REG_TYPE6_LCRRTP_LCR) ? mask : 0;
LINE_DBG(SIGNAL, xpd, info->h.portnum,
"REG_TYPE6_LCRRTP: dataL=0x%X "
"(offhook=0x%X mask=0x%X)\n",
val, offhook, mask);
process_hookstate(xpd, offhook, mask);
}
} else { } else {
#if 0 #if 0
XPD_NOTICE(xpd, XPD_NOTICE(xpd,