From patchwork Wed Nov 8 12:28:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J, KEERTHY" X-Patchwork-Id: 10048435 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 731FA6032D for ; Wed, 8 Nov 2017 12:45:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6436D2A335 for ; Wed, 8 Nov 2017 12:45:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58CF92A5E0; Wed, 8 Nov 2017 12:45:48 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D2B452A335 for ; Wed, 8 Nov 2017 12:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mfCjZvwj9jMJjFx7O2+uDFzedn7qVPzu+R6/tv0fycQ=; b=mZXDCqPtAH6okC +/6sGl9A8wI0cFK8xlSvRO52AnsNxgeIIUwDv/9aEVCk2Ak3XybGrrjSr9zXrKnuNc89q9IkApjmx rBKQANWGfFILqS443dSk0NZAn4erWn/8Edyieov7v5jPfpnsvpt+zJ5Sfv2hQDcnTtigEb0yA37CB jrV/KN1MjV2obUyoztpLPeqVfgtoUbah1QCPoRJHAWD+dK8zx7FYy6/udaIiCM3Wb4yBwChMtQpGa SdLGOYrgmsJDoI7Z88yX6LASw+NjyBDsRdD7G2FZLJcm7BMiW0t0t99PVkZNw+yufNNlwxaxRPjhq QutmskMUF0D4SNlMVWWA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eCPjl-0005Vd-Tm; Wed, 08 Nov 2017 12:45:45 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eCPjj-0004UM-Of for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Nov 2017 12:45:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=9qb39ZFr7YY0J/BIj3XWg+emLwAV2IWxek438lzTFzY=; b=pjfaHPgp+ymhpKRIAjzT86KWy A0ZlEh81WeYST29JKwDouKLUlwhua++cUYGumUMfOxag++nQj5Zy8fTv0Ioik3aKA6H3f+lh22gDE 7P786rP91bN5oDIVgqUrQWkDwnLx6d9vvXulw21MnhIm2/MeLe/oVmS1WAoAqfbvEsFq9aV7UOR/w uxFLH3XIYmI+srVlEEs5dhV1p8cS3jwsWJsxvLEsnMDqc3CZzfxBMLxBoIig4V+aq7sIWNonCQOjO /30vLar0ykAv1aDYfnO++YDHoBYFWDMVbYHPxY2if2psrpZEDUO5rEKnM3rCQfod+xF7cR/+3wKi9 KoTS7jwVQ==; Received: from fllnx209.ext.ti.com ([198.47.19.16]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eCPW0-0003cp-0U for linux-arm-kernel@lists.infradead.org; Wed, 08 Nov 2017 12:31:34 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id vA8CTKG4031419; Wed, 8 Nov 2017 06:29:20 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1510144160; bh=BsncGawNpk+DYY6q+Qowpy95WE+WZ9bB7LkaPvBOxUA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=JvkWl4pV1+faHmVQtv1nwycDUTi7Rc7eebapeVJrGwnnTSJhToCgWE2zz996C0GnI 5h492wGfDiHCeP9jJPG05dZgUfD4x2VJviql8k63RTYe48vuuj/NKz6mCr2cWGGUDK I+PRq6Tuw4v/Pjau/twyXYk5Xu8VGS4lvybObG1c= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id vA8CTFBE001184; Wed, 8 Nov 2017 06:29:15 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Wed, 8 Nov 2017 06:29:15 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Wed, 8 Nov 2017 06:29:15 -0600 Received: from ula0393675.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id vA8CSm3U002789; Wed, 8 Nov 2017 06:29:11 -0600 From: Keerthy To: , , Subject: [PATCH v2 6/7] pwm: pwm-omap-dmtimer: Adapt driver to utilize dmtimer pdata ops Date: Wed, 8 Nov 2017 17:58:27 +0530 Message-ID: <1510144108-29563-7-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1510144108-29563-1-git-send-email-j-keerthy@ti.com> References: <1510144108-29563-1-git-send-email-j-keerthy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171108_123132_422024_3833125B X-CRM114-Status: GOOD ( 14.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, khilman@kernel.org, j-keerthy@ti.com, daniel.lezcano@linaro.org, linux@armlinux.org.uk, sebastian.reichel@collabora.co.uk, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Adapt driver to utilize dmtimer pdata ops instead of pdata-quirks. Signed-off-by: Keerthy Reviewed-by: Sebastian Reichel --- No code changes in this v2 version. Only enhanced patch statistics for renames. drivers/pwm/pwm-omap-dmtimer.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c index 5ad42f3..3b27aff 100644 --- a/drivers/pwm/pwm-omap-dmtimer.c +++ b/drivers/pwm/pwm-omap-dmtimer.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -37,7 +38,7 @@ struct pwm_omap_dmtimer_chip { struct pwm_chip chip; struct mutex mutex; pwm_omap_dmtimer *dm_timer; - struct pwm_omap_dmtimer_pdata *pdata; + struct omap_dm_timer_ops *pdata; struct platform_device *dm_timer_pdev; }; @@ -242,19 +243,33 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct device_node *timer; + struct platform_device *timer_pdev; struct pwm_omap_dmtimer_chip *omap; - struct pwm_omap_dmtimer_pdata *pdata; + struct dmtimer_platform_data *timer_pdata; + struct omap_dm_timer_ops *pdata; pwm_omap_dmtimer *dm_timer; u32 v; int status; - pdata = dev_get_platdata(&pdev->dev); - if (!pdata) { - dev_err(&pdev->dev, "Missing dmtimer platform data\n"); + timer = of_parse_phandle(np, "ti,timers", 0); + if (!timer) + return -ENODEV; + + timer_pdev = of_find_device_by_node(timer); + if (!timer_pdev) { + dev_err(&pdev->dev, "Unable to find Timer pdev\n"); + return -ENODEV; + } + + timer_pdata = dev_get_platdata(&timer_pdev->dev); + if (!timer_pdata) { + dev_err(&pdev->dev, "dmtimer pdata structure NULL\n"); return -EINVAL; } - if (!pdata->request_by_node || + pdata = timer_pdata->timer_ops; + + if (!pdata || !pdata->request_by_node || !pdata->free || !pdata->enable || !pdata->disable || @@ -270,10 +285,6 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) return -EINVAL; } - timer = of_parse_phandle(np, "ti,timers", 0); - if (!timer) - return -ENODEV; - if (!of_get_property(timer, "ti,timer-pwm", NULL)) { dev_err(&pdev->dev, "Missing ti,timer-pwm capability\n"); return -ENODEV; @@ -291,13 +302,7 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev) omap->pdata = pdata; omap->dm_timer = dm_timer; - - omap->dm_timer_pdev = of_find_device_by_node(timer); - if (!omap->dm_timer_pdev) { - dev_err(&pdev->dev, "Unable to find timer pdev\n"); - omap->pdata->free(dm_timer); - return -EINVAL; - } + omap->dm_timer_pdev = timer_pdev; /* * Ensure that the timer is stopped before we allow PWM core to call