From patchwork Wed Oct 26 16:56:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Twiss X-Patchwork-Id: 9397823 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 8B70F60231 for ; Wed, 26 Oct 2016 17:22:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C72A293E9 for ; Wed, 26 Oct 2016 17:22:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8079F2946D; Wed, 26 Oct 2016 17:22:41 +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 D1A4F293E9 for ; Wed, 26 Oct 2016 17:22:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934890AbcJZRV4 (ORCPT ); Wed, 26 Oct 2016 13:21:56 -0400 Received: from mail1.bemta3.messagelabs.com ([195.245.230.166]:6737 "EHLO mail1.bemta3.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755681AbcJZRTb (ORCPT ); Wed, 26 Oct 2016 13:19:31 -0400 Received: from [85.158.137.19] by server-6.bemta-3.messagelabs.com id 21/5F-02113-F95E0185; Wed, 26 Oct 2016 17:19:27 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA1VSa0hTYRjed7aznYmr47bya6nVICpxU7PLCSL 1lwNB/RVqWJ3pcZvtxs6s9asVFWlYCxR1Lq95weyCgaS5SJ1mYkFe0wyVpsyhGQ6VkqAdh2b/ ntv3vC+8H8YWtqASjLKYKZOe1Eq5QZyL7fVxsqo5PD1mYIBPlMy6uUSV6xNK9NR6AFE1MoYS0 6u9gFgbuYcQEytrKDHc4eASviIXIL48f8sj3DWDCFE//hkh7jhdfjr7gEsMPyrgEZNlHjQBV7 RUtgBFu/0bTzH2aq+irnMBUbQ2F3AVU2OdXEX7upWn8LVGpGGZqEavNFguo+o52wxq/HXQMlj wnWcF0/sLQRAmxF8AuNS9gBQCvp9YYNHHch6DBXg2fO+eQBnMxxNhxbwDDWQS4Lv+DcBgLh4L KxeXNzEHPwxtG0v+HgwT4edgtTeK6RfjTQBOlbWxGcLGv7Kh73c3GhgQAj+UuzkMZuMQdnk8b OaxEI+EjX0ZjAzxeFi6PLopQzwa3uzLCsixcN2+xgnIp2FtyTEbCLHv6LTv6KwGSDM4SlOmq5 RJdvyMXGnSqNRmHanRymJj4uQ6iqZJFaUllbQ826BrBf7L3WCxwGtwy5nSDfZhiHSPYLEfTxf uUhpyrqtJWn3JlK+l6G4QhmFSKCh2+70QE6WiLLkarf/8WzbEgqViwV3GFtBGUkdrVAFrAMiw Jx0zzxAhR2/QU5JQQR4TwpmQOl+/XbH1iYZAuEQkACwWSxhspEw6jfl/3wtCMSAVCWxMS7BGb 96e5PUvgfiXKFVtLmEm/1kSKyhwhBudEb0VdeH2XFGyVL0wLj7fk+RCehpastJEq4bG+z6LM/ EKeS1s9JToZUPtj+LMvCbk5Jsw75ChH50PTq2xcrxqx097Dr27rWYp7uzD9ohMS3KpUjJ54XG GKCUk6kQ8OymsVMy/3RUtLa9NjTtUd+TPZJ/jgDxvhfu0Xsqh1WRsJNtEk38BYFM1cT8DAAA= X-Env-Sender: stwiss.opensource@diasemi.com X-Msg-Ref: server-9.tower-39.messagelabs.com!1477502364!57764713!8 X-Originating-IP: [94.185.165.51] X-StarScan-Received: X-StarScan-Version: 9.0.13; banners=-,-,- X-VirusChecked: Checked Received: (qmail 553 invoked from network); 26 Oct 2016 17:19:27 -0000 Received: from mailrelay2.diasemi.com (HELO sw-ex-cashub01.diasemi.com) (94.185.165.51) by server-9.tower-39.messagelabs.com with AES128-SHA encrypted SMTP; 26 Oct 2016 17:19:27 -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; Wed, 26 Oct 2016 18:19:25 +0100 Received: by swsrvapps-01.diasemi.com (Postfix, from userid 22547) id F3BD73FBF8; Wed, 26 Oct 2016 18:19:23 +0100 (BST) Message-ID: In-Reply-To: References: From: Steve Twiss Date: Wed, 26 Oct 2016 17:56:39 +0100 Subject: [PATCH V2 08/10] watchdog: da9062/61: 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: 26/10/2016 13:31: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 The of_device_id match array is added to support "dlg,da9062-watchdog" as a valid .compatible string. The watchdog_info structure is 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. This patch now assumes the use of a DA9062 fallback compatible string for the DTS to pick up the DA9062 device driver for use with the DA9061 watchdog hardware. 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 v1 -> v2 - Patch renamed from [PATCH V1 04/10] to [PATCH V2 08/10] -- these changes were made to fix checkpatch warnings caused by the patch set dependency order - Removal of the DA9061 compatible entries for this device driver. - Additional explanation in the patch description for the use of a fall-back compatible DTS string Guenter, Alterations have been made in accordance with the previous e-mail thread on the use of compatible strings: https://lkml.org/lkml/2016/10/7/641 This patch now assumes the use of a fallback compatible string in the DTS. Of the form: compatible = "dlg,da9061-watchdog", "dlg,da9062-watchdog"; Regards, Steve Twiss, Dialog Semiconductor Ltd. drivers/watchdog/Kconfig | 4 ++-- drivers/watchdog/da9062_wdt.c | 18 +++++++++++++++--- 2 files changed, 17 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..4b20b7a 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 @@ -188,23 +188,34 @@ 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 }, + { }, +}; + 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 +255,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");