From patchwork Fri Oct 26 18:41:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 10657737 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7DE8109C for ; Fri, 26 Oct 2018 18:46:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE10F281C3 for ; Fri, 26 Oct 2018 18:46:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1C332CA5C; Fri, 26 Oct 2018 18:46:12 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 50311281C3 for ; Fri, 26 Oct 2018 18:46:12 +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=5M6zw9X6wtsew8AP1KsWOz6tMDVWP2LN7+orlritSFY=; b=QkLBV2ne0UYh7E wcTo3aISK/2cl1612MPEOlyCnkeud/aAKOpIY6lKq89T6OvX3/LbvKAX1fEd3zYl/QPhb4LrWmjox EphcIcQZqLdxs3CfB0fktXS4DQncGAVdvM02az55JSxz6hnydQRKLRpeZS4RPLRjqwIYzT5gCiNW1 f6vcrtPuibHk+a0I/208vwvfX203LHqyfUS5f7TIcQvW3A0KaZEpckTjs+L1H86aD8jY/dY8e44hL uGM6gxbSlLNQ9CV9FbrwjGNSxWcH46fkaUfq2vSAmz4CJZqF3d/HzzqHaFR24xUMu6cjCRI9CvtU5 xgW+Zx+EiTjnDQs+FIww==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG77Q-0003Aa-LS; Fri, 26 Oct 2018 18:46:00 +0000 Received: from antares.kleine-koenig.org ([94.130.110.236]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG76E-0001MA-5j for linux-arm-kernel@lists.infradead.org; Fri, 26 Oct 2018 18:44:53 +0000 Received: by antares.kleine-koenig.org (Postfix, from userid 1000) id B3221434238; Fri, 26 Oct 2018 20:44:19 +0200 (CEST) From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thierry Reding , Sebastien Bourdelin Subject: [PATCH 3/4] bus: ts-nbus: convert to atomic PWM API Date: Fri, 26 Oct 2018 20:41:57 +0200 Message-Id: <20181026184157.16371-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181026184157.16371-1-u.kleine-koenig@pengutronix.de> References: <20181026184157.16371-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181026_114446_379059_5B019FC4 X-CRM114-Status: GOOD ( 11.89 ) 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, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de 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 The legacy PWM API should be removed in the long run, so convert a user to the atomic PWM API. Signed-off-by: Uwe Kleine-König --- drivers/bus/ts-nbus.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/bus/ts-nbus.c b/drivers/bus/ts-nbus.c index 073fd9011154..51f5ed870ad1 100644 --- a/drivers/bus/ts-nbus.c +++ b/drivers/bus/ts-nbus.c @@ -282,7 +282,7 @@ EXPORT_SYMBOL_GPL(ts_nbus_write); static int ts_nbus_probe(struct platform_device *pdev) { struct pwm_device *pwm; - struct pwm_args pargs; + struct pwm_state pstate; struct device *dev = &pdev->dev; struct ts_nbus *ts_nbus; int ret; @@ -305,25 +305,19 @@ static int ts_nbus_probe(struct platform_device *pdev) return ret; } - pwm_get_args(pwm, &pargs); - if (!pargs.period) { + pwm_get_state_default(pwm, &pstate); + if (!pstate.period) { dev_err(&pdev->dev, "invalid PWM period\n"); return -EINVAL; } - /* - * FIXME: pwm_apply_args() should be removed when switching to - * the atomic PWM API. - */ - pwm_apply_args(pwm); - ret = pwm_config(pwm, pargs.period, pargs.period); + /* We can start the FPGA and populate the peripherals now. */ + pstate.enabled = true; + pstate.duty_cycle = pstate.period; + ret = pwm_apply_state(pwm, &pstate); if (ret < 0) return ret; - /* - * we can now start the FPGA and populate the peripherals. - */ - pwm_enable(pwm); ts_nbus->pwm = pwm; /*