@@ -109,8 +109,9 @@ enum SHM_DESCTYPE {
SHM_CURROPP = 0,
SHM_OPPINFO = 1,
SHM_GETOPP = 2, /* Get DSP requested OPP info */
- SHM_WDTOVF = 3, /* Set the WDT overflow time */
- SHM_WDTCLOCKS = 4 /* Set/unset F/I WDT clocks flag */
+ SHM_GETWDTOVF, /* Set the WDT overflow time */
+ SHM_WDTOVF, /* Set the WDT overflow time */
+ SHM_WDTCLOCKS /* Set/unset F/I WDT clocks flag */
} ;
/* Structure in shared between DSP and PC for communication.*/
old mode 100755
new mode 100644
@@ -65,6 +65,9 @@
#include <dspbridge/dbdefs.h>
#include <dspbridge/errbase.h>
#include <_tiomap.h>
+#ifdef CONFIG_BRIDGE_WDT3
+#include <dspbridge/io_sm.h>
+#endif
/* ----------------------------------- Trace & Debug */
#include <dspbridge/gt.h>
@@ -753,12 +756,58 @@ func_end:
}
static DEVICE_ATTR(wdt3_enable, S_IWUSR | S_IRUGO, wdt3_show, wdt3_store);
+
+static ssize_t wdt3_timeout_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ u32 wdt3_to;
+ struct DEV_OBJECT *dev_object;
+ struct IO_MGR *io_mgr;
+
+ dev_object = DEV_GetFirst();
+ if (!dev_object)
+ return 0;
+ DEV_GetIOMgr(dev_object, &io_mgr);
+ if (!io_mgr)
+ return 0;
+
+ if (DSP_FAILED(IO_SHMsetting(io_mgr, SHM_GETWDTOVF, &wdt3_to)))
+ return 0;
+
+ return sprintf(buf, "%u\n", wdt3_to);
+}
+
+static ssize_t wdt3_timeout_store(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t n)
+{
+ u32 wdt3_to;
+ struct DEV_OBJECT *dev_object;
+ struct IO_MGR *io_mgr;
+
+ if (sscanf(buf, "%u", &wdt3_to) != 1)
+ return -EINVAL;
+
+ dev_object = DEV_GetFirst();
+ if (!dev_object)
+ goto func_end;
+ DEV_GetIOMgr(dev_object, &io_mgr);
+ if (!io_mgr)
+ goto func_end;
+
+ IO_SHMsetting(io_mgr, SHM_WDTOVF, (void *)wdt3_to);
+func_end:
+ return n;
+}
+
+static DEVICE_ATTR(wdt3_timeout, S_IWUSR | S_IRUGO, wdt3_timeout_show,
+ wdt3_timeout_store);
#endif
static struct attribute *attrs[] = {
&dev_attr_drv_state.attr,
#ifdef CONFIG_BRIDGE_WDT3
&dev_attr_wdt3_enable.attr,
+ &dev_attr_wdt3_timeout.attr,
#endif
NULL,
};
@@ -1815,6 +1815,14 @@ DSP_STATUS IO_SHMsetting(IN struct IO_MGR *hIOMgr, IN enum SHM_DESCTYPE desc,
#endif
switch (desc) {
#ifdef CONFIG_BRIDGE_WDT3
+ case SHM_GETWDTOVF:
+ /* Update the shared memory with WDT timeout */
+ if (pArgs && hIOMgr->pSharedMem &&
+ (int)hIOMgr->pSharedMem != -1)
+ *(u32 *)pArgs = hIOMgr->pSharedMem->wdt_overflow;
+ else
+ return DSP_EPOINTER;
+ break;
case SHM_WDTOVF:
/* Update the shared memory with WDT timeout */
if (hIOMgr->pSharedMem && (int)hIOMgr->pSharedMem != -1)