From patchwork Thu Oct 6 08:43:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Twiss X-Patchwork-Id: 9364323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8A2A66077E for ; Thu, 6 Oct 2016 09:13:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B35A28E7C for ; Thu, 6 Oct 2016 09:13:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FFCF28E80; Thu, 6 Oct 2016 09:13:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F083D28E7C for ; Thu, 6 Oct 2016 09:13:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966861AbcJFJN1 (ORCPT ); Thu, 6 Oct 2016 05:13:27 -0400 Received: from mail1.bemta5.messagelabs.com ([195.245.231.138]:19839 "EHLO mail1.bemta5.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966623AbcJFJJf (ORCPT ); Thu, 6 Oct 2016 05:09:35 -0400 Received: from [85.158.139.51] by server-2.bemta-5.messagelabs.com id 6B/8F-01972-E4316F75; Thu, 06 Oct 2016 09:03:10 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJKsWRWlGSWpSXmKPExsUSt3Opsa6P8Ld wg9kXBCymPnzCZjH/yDlWi8OLXjBazL9yjdXi/tejjBbfrnQwWdz89I3V4vKuOWwWn3uPMFrc WLeP3eLJwjNMFkuvX2SyaN17BMh92MdmcXliJ7vFrRkvWB0EPNbMW8PosXPWXXaPa5vFPBbve cnksWlVJ5vHnWt72Dx2fm9g9/i8SS6AI4o1My8pvyKBNWPZjvNMBZ/kKnbfYm1gnCzVxcjJIS SwjlHiwzxRCLtCYlp7CxOIzSuQLNG9Yy+QzcHBKeAo8WCKE0SJg8TqNy9ZQGw2AUOJeW/eM4L YLAIqElOermIBKRcWsJaYdyKvi5GLQ0RgBaPEnRnbmEEcZoHbzBKffx1ihZgvKHFy5hOwQcwC EhIHX7xgBmkWEtCSWH4sEiQsIWAvMf39VbCwhIC+ROOxWIiwocT3Wd9YIMLmEpvOR01gFJyFZ OYsJDMXMDKtYtQoTi0qSy3SNTLUSyrKTM8oyU3MzNE1NDDVy00tLk5MT81JTCrWS87P3cQIjL Z6BgbGHYx3J/sdYpTkYFIS5V3P9C1ciC8pP6UyI7E4I76oNCe1+BCjDAeHkgTvW0GgnGBRanp qRVpmDjDuYdISHDxKIrzXBIDSvMUFibnFmekQqVOMuhxLdj1YyyTEkpeflyolzisvBFQkAFKU UZoHNwKWgi4xykoJ8zIyMDAI8RSkFuVmlqDKv2IU52BUEuZ9CnIJT2ZeCdymV0BHMAEdkb/0C 8gRJYkIKakGxopZH0/Or0iMTdt94t0klS1PJ51oFXOINX8V8WN5p8N0SRsDrfvKj90u+9fNEY /4ebZsdZohV/ZW7umGLsIKgmK7TGSuey0QW7F+tlxk8kUHhckn5b7Ershw3+axJeDL555jJ15 mWbexNfxL/8rnZ1Clt2VtnVH6a2XHBoGvBzMWtO6dYeF1RYmlOCPRUIu5qDgRAIo7PCY8AwAA X-Env-Sender: stwiss.opensource@diasemi.com X-Msg-Ref: server-15.tower-180.messagelabs.com!1475744586!47609953!5 X-Originating-IP: [94.185.165.51] X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 13506 invoked from network); 6 Oct 2016 09:03:08 -0000 Received: from mailrelay2.diasemi.com (HELO sw-ex-cashub01.diasemi.com) (94.185.165.51) by server-15.tower-180.messagelabs.com with AES128-SHA encrypted SMTP; 6 Oct 2016 09:03:08 -0000 Received: from swsrvapps-01.diasemi.com (10.20.28.141) by SW-EX-CASHUB01.diasemi.com (10.20.16.140) with Microsoft SMTP Server id 14.3.248.2; Thu, 6 Oct 2016 10:03:05 +0100 Received: by swsrvapps-01.diasemi.com (Postfix, from userid 22547) id 7865E3FBF0; Thu, 6 Oct 2016 10:03:05 +0100 (BST) Message-ID: In-Reply-To: References: From: Steve Twiss Date: Thu, 6 Oct 2016 09:43:30 +0100 Subject: [PATCH V1 04/10] watchdog: da9061: watchdog driver To: Guenter Roeck , LINUX-KERNEL , LINUX-WATCHDOG , Wim Van Sebroeck CC: DEVICETREE , Dmitry Torokhov , Eduardo Valentin , LINUX-INPUT , LINUX-PM , Lee Jones , Liam Girdwood , Mark Brown , Mark Rutland , Rob Herring , Support Opensource , Zhang Rui MIME-Version: 1.0 X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-ServerInfo: sw-ex-cashub01.diasemi.com, 9 X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 06/10/2016 07:06:00 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Steve Twiss Support for the DA9061 watchdog is added into the DA9062 watchdog driver. The of_device_id match array is expanded to support "dlg,da9061-watchdog" as a valid .compatible string. A new watchdog_info structure is added and linked to this device tree compatible string in the .data section. Extra code is added into the probe function to search-for and assign this match data. Copyright header is updated to add DA9061 in its description and the module description macro is extended to include DA9061. Kconfig is updated to reflect support for DA9061/62. Signed-off-by: Steve Twiss --- This patch applies against linux-next and v4.8 Regards, Steve Twiss, Dialog Semiconductor Ltd. drivers/watchdog/Kconfig | 4 ++-- drivers/watchdog/da9062_wdt.c | 24 +++++++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 1bffe00..d6b4088 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -104,11 +104,11 @@ config DA9063_WATCHDOG This driver can be built as a module. The module name is da9063_wdt. config DA9062_WATCHDOG - tristate "Dialog DA9062 Watchdog" + tristate "Dialog DA9062/61 Watchdog" depends on MFD_DA9062 select WATCHDOG_CORE help - Support for the watchdog in the DA9062 PMIC. + Support for the watchdog in the DA9062 and DA9061 PMICs. This driver can be built as a module. The module name is da9062_wdt. diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c index 7386111..5b9d408 100644 --- a/drivers/watchdog/da9062_wdt.c +++ b/drivers/watchdog/da9062_wdt.c @@ -1,5 +1,5 @@ /* - * da9062_wdt.c - WDT device driver for DA9062 + * Watchdog device driver for DA9062 and DA9061 PMICs * Copyright (C) 2015 Dialog Semiconductor Ltd. * * This program is free software; you can redistribute it and/or @@ -180,6 +180,11 @@ static const struct watchdog_info da9062_watchdog_info = { .identity = "DA9062 WDT", }; +static const struct watchdog_info da9061_watchdog_info = { + .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, + .identity = "DA9061 WDT", +}; + static const struct watchdog_ops da9062_watchdog_ops = { .owner = THIS_MODULE, .start = da9062_wdt_start, @@ -188,23 +193,35 @@ static const struct watchdog_ops da9062_watchdog_ops = { .set_timeout = da9062_wdt_set_timeout, }; +static const struct of_device_id da9062_compatible_id_table[] = { + { .compatible = "dlg,da9062-watchdog", .data = &da9062_watchdog_info }, + { .compatible = "dlg,da9061-watchdog", .data = &da9061_watchdog_info }, + { }, +}; + static int da9062_wdt_probe(struct platform_device *pdev) { int ret; struct da9062 *chip; struct da9062_watchdog *wdt; + const struct of_device_id *match; chip = dev_get_drvdata(pdev->dev.parent); if (!chip) return -EINVAL; + match = of_match_node(da9062_compatible_id_table, + pdev->dev.of_node); + if (!match) + return -ENXIO; + wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); if (!wdt) return -ENOMEM; wdt->hw = chip; - wdt->wdtdev.info = &da9062_watchdog_info; + wdt->wdtdev.info = (const struct watchdog_info *)match->data; wdt->wdtdev.ops = &da9062_watchdog_ops; wdt->wdtdev.min_timeout = DA9062_WDT_MIN_TIMEOUT; wdt->wdtdev.max_timeout = DA9062_WDT_MAX_TIMEOUT; @@ -244,11 +261,12 @@ static struct platform_driver da9062_wdt_driver = { .remove = da9062_wdt_remove, .driver = { .name = "da9062-watchdog", + .of_match_table = da9062_compatible_id_table, }, }; module_platform_driver(da9062_wdt_driver); MODULE_AUTHOR("S Twiss "); -MODULE_DESCRIPTION("WDT device driver for Dialog DA9062"); +MODULE_DESCRIPTION("WDT device driver for Dialog DA9062 and DA9061"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:da9062-watchdog");