2

I want to use a watchdog timer in my application.

I am using the yocto build system on the msm8953 platform.

As per compatible field in .dtsi file, corresponding driver configured in .defconfig file(i.e. CONFIG_MSM_WATCHDOG_V2 = y) and I am getting following dmesg:

[ 0.270444] msm_watchdog b017000.qcom,wdt: wdog absent resource not present
[ 0.270845] msm_watchdog b017000.qcom,wdt: MSM Watchdog Initialized

But, watchdog node is not created in /dev directory.

I have also configured WATCHDOG and WATCHDOG_CORE driver as default in Kconfig file, but still the watchdog node is not present in /dev directory.

Edit 1: added default value as Y in /drivers/watchdog/Kconfig

menuconfig WATCHDOG

bool "Watchdog Timer Support"

default Y

if WATCHDOG

config WATCHDOG_CORE

bool "WatchDog Timer Driver Core"

default Y

1 Answers1

0

I've found the code from here. My answer is based on this code.

A device driver can generate a node on /dev and also on /sys. So we have to check about both /sys and /dev.

About nodes on /sys

There are many functions to create a node on /sys. One of the functions is device_create_file(). In this code, if init_watchdog_work() is called and device_create_file() is called, watchdog's node, disable would be created by this code.

error = device_create_file(wdog_dd->dev, &dev_attr_disable);

You can find the disable node in msm watchdog directory. And you can find msm watchdog directory using find.

find /sys -name '*watchdog*'

Even if your code is different with this, maybe you can see that device_create_file() is called in watchdog driver. Thus, you can find a node as I said.

About nodes on /dev

Generally, you can use device_create() to create a node on /dev. If device_create() is called, a node is created on /dev, otherwise it is not created.

msm_rotator driver creates msm_rotator node on /dev.

#define DRIVER_NAME "msm_rotator"
...
msm_rotator_dev->device = device_create(msm_rotator_dev->class, NULL,
                    msm_rotator_dev->dev_num, NULL,
                    DRIVER_NAME);

If device_create() is called in your code, you can find the node on /dev. If the function is not called, there is not a node on /dev.

H. Jang
  • 338
  • 3
  • 14
  • 1
    author has asked about devnode, not about sysfs entry – Alex Hoppus Jul 06 '18 at 09:02
  • @AlexHoppus I updated my answer to give explanation about a node on `/dev`. – H. Jang Jul 09 '18 at 07:26
  • @HyeongnamJang, when i enable Softdog driver then watchdog node is created in dev directory. Will softdog reset the system using hardware watchdog? How can i validate that my system is reset by hardware watchdog? – kripalsinh rana Jul 09 '18 at 12:16
  • @kripalsinhrana, First, please tell me more about softdog driver. This driver is provided by qualcomm or codeaurora? Second, for check your system is reset by HW watchdog, the best way is to check PON reason in kernel log, I think. Please refer to [here](https://forum.xda-developers.com/nexus-6p/help/dev-help-debugging-ramoops-bootlooping-t3640826/page6). For detailed about PON, refer to Qualcomm documentation about PON. – H. Jang Jul 09 '18 at 23:47
  • IIUC, if you call `device_create()` it's not enough to have device node. It will be sysfs node and kernel event, based on which `udev` or alike will create a device node on behalf of kernel. – 0andriy Jul 19 '18 at 15:04