[PATCH 2/3] DSPBRIDGE: Implement sysfs entry to enable/disable wdt3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 538a9876a6a1568a0c63679cab0f1ce787aedef9 Mon Sep 17 00:00:00 2001
From: Fernando Guzman Lugo <x0095840@xxxxxx>
Date: Wed, 11 Nov 2009 00:31:48 -0600
Subject: [PATCH] DSPBRIDGE: Implement sysfs entry to enable/disable wdt3

This patch implements new sysfs entry to enable or disable
wdt3 at run time:
echo 1 > /sys/devices/platform/C6410/wdt3_enable //to enable
echo 0 > /sys/devices/platform/C6410/wdt3_enable //to disable

Signed-off-by: Fernando Guzman Lugo <x0095840@xxxxxx>
Signed-off-by: Armando Uribe <x0095078@xxxxxx>
Signed-off-by: Somashekar Chandrappa <somashekar.c@xxxxxx>
---
 drivers/dsp/bridge/rmgr/drv_interface.c |   63 +++++++++++++++++++++++++++++--
 1 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c b/drivers/dsp/bridge/rmgr/drv_interface.c
index 65ac1e7..e9cd647 100755
--- a/drivers/dsp/bridge/rmgr/drv_interface.c
+++ b/drivers/dsp/bridge/rmgr/drv_interface.c
@@ -130,6 +130,9 @@ static s32 shm_size = 0x500000;	/* 5 MB */
 static u32 phys_mempool_base;
 static u32 phys_mempool_size;
 static int tc_wordswapon;	/* Default value is always false */
+#ifdef CONFIG_BRIDGE_WDT3
+extern u32 wtd3_enable;
+#endif
 
 /* Minimum ACTIVE VDD1 OPP level for reliable DSP operation */
 unsigned short min_active_opp = 3;
@@ -680,7 +683,7 @@ DSP_STATUS DRV_RemoveAllResources(HANDLE hPCtxt)
 /*
  * sysfs
  */
-static ssize_t drv_state_show(struct kobject *kobj, struct kobj_attribute *attr,
+static ssize_t drv_state_show(struct device *dev, struct device_attribute *attr,
                         char *buf)
 {
 	struct WMD_DEV_CONTEXT *dwContext;
@@ -701,11 +704,63 @@ static ssize_t drv_state_show(struct kobject *kobj, struct kobj_attribute *attr,
         return sprintf(buf, "%d\n", drv_state);
 }
 
-static struct kobj_attribute drv_state_attr = __ATTR_RO(drv_state);
+static DEVICE_ATTR(drv_state, S_IRUGO, drv_state_show, NULL);
+
+#ifdef CONFIG_BRIDGE_WDT3
+static ssize_t wdt3_show(struct device *dev, struct device_attribute *attr,
+							char *buf)
+{
+	return sprintf(buf, "%d\n", wtd3_enable);
+}
+
+static ssize_t wdt3_store(struct device *dev, struct device_attribute *attr,
+					const char *buf, size_t n)
+{
+	u32 wdt3;
+	struct DEV_OBJECT *dev_object;
+	struct WMD_DEV_CONTEXT *dev_ctxt;
+
+	if (sscanf(buf, "%d", &wdt3) != 1)
+		return -EINVAL;
+
+	dev_object = DEV_GetFirst();
+	if (!dev_object)
+		goto func_end;
+	DEV_GetWMDContext(dev_object, &dev_ctxt);
+	if (!dev_ctxt)
+		goto func_end;
+
+	/* enable WDT */
+	if (wdt3 == 1) {
+		if (wtd3_enable)
+			goto func_end;
+		if (!CLK_Get_UseCnt(SERVICESCLK_wdt3_fck) &&
+				dev_ctxt->dwBrdState != BRD_DSP_HIBERNATION &&
+				DSP_FAILED(dsp_wdt_config(WDT3_ENABLE))) {
+			pr_err("Error enabling WDT3\n");
+			goto func_end;
+		}
+		wtd3_enable = 1;
+	} else if (!wdt3) {
+		if (!wtd3_enable)
+			goto func_end;
+		if (CLK_Get_UseCnt(SERVICESCLK_wdt3_fck))
+			dsp_wdt_config(WDT3_DISABLE);
+		wtd3_enable = 0;
+	}
+func_end:
+	return n;
+}
+
+static DEVICE_ATTR(wdt3_enable, S_IWUSR | S_IRUGO, wdt3_show, wdt3_store);
+#endif
 
 static struct attribute *attrs[] = {
-        &drv_state_attr.attr,
-        NULL,
+	&dev_attr_drv_state.attr,
+#ifdef CONFIG_BRIDGE_WDT3
+	&dev_attr_wdt3_enable.attr,
+#endif
+	NULL,
 };
 
 static struct attribute_group attr_group = {
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux