From patchwork Tue Oct 31 10:28:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J, KEERTHY" X-Patchwork-Id: 10034083 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 5A4C9600C5 for ; Tue, 31 Oct 2017 10:49:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5599A2866D for ; Tue, 31 Oct 2017 10:49:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A4CB2884E; Tue, 31 Oct 2017 10:49:32 +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 D55AD2866D for ; Tue, 31 Oct 2017 10:49:31 +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=R0zB1FPmLOJJYajnkfdJFcw1l6TWuG3/CGZSj5y2UKk=; b=Jf0ShEeWBQonic IKUYtoefVwQlxoobtmQEYQpwjxztV7FpYLhBDiGpFq6KRg8RNh0zJqIyUxiCvwlJex8o9NgOcDycj J34undB9eKNuWNkPoeUtlLcDT79mk8efEqKmSgpa7R7ZaWbuuHJQ332gzAPU66cnoukGunufe1rHi HRF8lsHjkebqceujee62IZNUKbDU79eYXVl8tWB9B6GZzLzsWln+LilSuYzu85tZ6qfl3Ub7vs4zS MCYaTSDjKzWeLpZHWcqueTjYFZS4DrusdzDGfvDoN+CPwSSLAbAbWeJ4tuaoy14gbyXfOtpkQ4nV6 P9nyIG5Ovjo8gquy/uNA==; 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 1e9U6f-0006DC-Aa; Tue, 31 Oct 2017 10:49:17 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e9U6e-0006CZ-At for linux-arm-kernel@bombadil.infradead.org; Tue, 31 Oct 2017 10:49:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=XtoVEx7e8Wcfmu07bGTtVxKxp84AGtdfIL3xEfHy9bI=; b=1of27b+sFl1ouY3y2d0yIfEdd DiqUQMNghLkvLL9xHdbwqrf5CeuGNmPq1dJA5HqZUA4MekBeibEwzkss4Ww794VUnpIPGg4vEKcqs OfUe/0nuvlTD9QSPkSjyHd7LjxWxqRnH5epfy4o3ffv5m1+G4UKDMo4lBUnRehWvVu9yVgtNQJqMt qrA92SQ/t2TVEAtbv4lq7x5FFBLl6TvBrYPne0W0E48AowCBvGNG3qJ7j5N0+sTK+wV7bi9u1GMkH Qrz1OeY2bzhB4LwzO883EaB02h0XanNnbKXE48oMYP2RCsFw2+iono14BA0CBmnfTGfZ7nL8MJw31 4XPAS92Sw==; Received: from fllnx209.ext.ti.com ([198.47.19.16]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e9TpX-0005z6-5D for linux-arm-kernel@lists.infradead.org; Tue, 31 Oct 2017 10:31:35 +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 v9VATZKX011567; Tue, 31 Oct 2017 05:29:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1509445775; bh=VDzRFMkjjDqnNfIdUuBuVzQuSnJnDNz9RGzn9KsgspM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=JpfrtPyLt+Vg6VTIhj+ZSWFwU6Dx7XqQUWCFdrdAxoETCcldl9BPHJ82u+1e+hszO JGeLINdxXVHYSaDkhC8WMqGy6xmBOuf1I/cbP1WflQSnBOoM6aJku59Tm+KMrTN8Aa BZuOiILhbaQ6rhm+5CDsFnrgMQ4GeaciCS39t8OA= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v9VATUod015937; Tue, 31 Oct 2017 05:29:30 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Tue, 31 Oct 2017 05:29:30 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Tue, 31 Oct 2017 05:29:30 -0500 Received: from ula0393675.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v9VAT8mU002203; Tue, 31 Oct 2017 05:29:27 -0500 From: Keerthy To: , , , Subject: [PATCH 6/7] pwm: pwm-omap-dmtimer: Adapt driver to utilize dmtimer pdata ops Date: Tue, 31 Oct 2017 15:58:45 +0530 Message-ID: <1509445726-21040-7-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1509445726-21040-1-git-send-email-j-keerthy@ti.com> References: <1509445726-21040-1-git-send-email-j-keerthy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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, j-keerthy@ti.com, daniel.lezcano@linaro.org, linux@armlinux.org.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 --- 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