From patchwork Thu Jun 18 10:54:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50018 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9FCE2228CC for ; Thu, 18 Jun 2015 10:58:30 +0000 (UTC) Received: by lbbti3 with SMTP id ti3sf19623671lbb.1 for ; Thu, 18 Jun 2015 03:58:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=bIVfpf/slbgcV9B8SXpkhEkdcVr/aVxoT3UWkP1AXJw=; b=HMofqDML40jbdY7AF9BUdcpvklnrMagMTeRPO/pdmwW7ZoDjembob55tzd9Pc5WvCB J1PunbCNtZEK0Vrr0EEHuiJLiGgJqH8WZZrffrhELIjTwGeClzm1w3RWP4LjIGeLW+Lz KC1i43JoBsUqjT0n0OrX/xgn4g/huKPhxQWso41qSTWrtZteoi/cTr2ms8xNScr7vcAD LYtTvLHvRBcK2NlwKtUoU4R0FyX1Igsna5LoNJUvNXlfOLodGMZGgIfmYOOpoLBf/S6p Tev24uI3MUU6ujUK8wb2jMCkMqbA/Swaq4EUioKY9hqm/OOXk7BfROVwTZCLsporxLK8 tkWg== X-Gm-Message-State: ALoCoQlFw8j9XYke60aPo6h0EAVpYhIl8N52dfTCSkTO9csO4hDcerXKGn6xIBn6c9y1IBCos465 X-Received: by 10.112.28.111 with SMTP id a15mr9717289lbh.21.1434625109697; Thu, 18 Jun 2015 03:58:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.129 with SMTP id m1ls398221laf.76.gmail; Thu, 18 Jun 2015 03:58:29 -0700 (PDT) X-Received: by 10.112.190.10 with SMTP id gm10mr12170803lbc.2.1434625109527; Thu, 18 Jun 2015 03:58:29 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id ew10si6193221lac.11.2015.06.18.03.58.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 03:58:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by laka10 with SMTP id a10so51864672lak.0 for ; Thu, 18 Jun 2015 03:58:29 -0700 (PDT) X-Received: by 10.152.21.136 with SMTP id v8mr12469224lae.19.1434625109430; Thu, 18 Jun 2015 03:58:29 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1095838lbb; Thu, 18 Jun 2015 03:58:28 -0700 (PDT) X-Received: by 10.70.36.10 with SMTP id m10mr20121621pdj.34.1434625102030; Thu, 18 Jun 2015 03:58:22 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xe2si10843486pbb.87.2015.06.18.03.58.21; Thu, 18 Jun 2015 03:58:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755193AbbFRK6M (ORCPT + 30 others); Thu, 18 Jun 2015 06:58:12 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:34666 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754880AbbFRK5S (ORCPT ); Thu, 18 Jun 2015 06:57:18 -0400 Received: by pabvl15 with SMTP id vl15so12935775pab.1 for ; Thu, 18 Jun 2015 03:57:16 -0700 (PDT) X-Received: by 10.68.161.4 with SMTP id xo4mr20192763pbb.65.1434625036416; Thu, 18 Jun 2015 03:57:16 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id qs8sm7646777pbc.38.2015.06.18.03.57.15 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:57:15 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Viresh Kumar , Maxime Ripard Subject: [PATCH 37/41] clocksource: sun5i: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:51 +0530 Message-Id: X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Migrate sun5i driver to the new 'set-state' interface provided by clockevents core, the earlier 'set-mode' interface is marked obsolete now. This also enables us to implement callbacks for new states of clockevent devices, for example: ONESHOT_STOPPED. Cc: Maxime Ripard Signed-off-by: Viresh Kumar --- drivers/clocksource/timer-sun5i.c | 45 ++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c index 0ffb4ea7c925..bca9573e036a 100644 --- a/drivers/clocksource/timer-sun5i.c +++ b/drivers/clocksource/timer-sun5i.c @@ -103,27 +103,31 @@ static void sun5i_clkevt_time_start(struct sun5i_timer_clkevt *ce, u8 timer, boo ce->timer.base + TIMER_CTL_REG(timer)); } -static void sun5i_clkevt_mode(enum clock_event_mode mode, - struct clock_event_device *clkevt) +static int sun5i_clkevt_shutdown(struct clock_event_device *clkevt) { struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt); - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - sun5i_clkevt_time_stop(ce, 0); - sun5i_clkevt_time_setup(ce, 0, ce->timer.ticks_per_jiffy); - sun5i_clkevt_time_start(ce, 0, true); - break; - case CLOCK_EVT_MODE_ONESHOT: - sun5i_clkevt_time_stop(ce, 0); - sun5i_clkevt_time_start(ce, 0, false); - break; - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - default: - sun5i_clkevt_time_stop(ce, 0); - break; - } + sun5i_clkevt_time_stop(ce, 0); + return 0; +} + +static int sun5i_clkevt_set_oneshot(struct clock_event_device *clkevt) +{ + struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt); + + sun5i_clkevt_time_stop(ce, 0); + sun5i_clkevt_time_start(ce, 0, false); + return 0; +} + +static int sun5i_clkevt_set_periodic(struct clock_event_device *clkevt) +{ + struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt); + + sun5i_clkevt_time_stop(ce, 0); + sun5i_clkevt_time_setup(ce, 0, ce->timer.ticks_per_jiffy); + sun5i_clkevt_time_start(ce, 0, true); + return 0; } static int sun5i_clkevt_next_event(unsigned long evt, @@ -286,7 +290,10 @@ static int __init sun5i_setup_clockevent(struct device_node *node, void __iomem ce->clkevt.name = node->name; ce->clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; ce->clkevt.set_next_event = sun5i_clkevt_next_event; - ce->clkevt.set_mode = sun5i_clkevt_mode; + ce->clkevt.set_state_shutdown = sun5i_clkevt_shutdown; + ce->clkevt.set_state_periodic = sun5i_clkevt_set_periodic; + ce->clkevt.set_state_oneshot = sun5i_clkevt_set_oneshot; + ce->clkevt.tick_resume = sun5i_clkevt_shutdown; ce->clkevt.rating = 340; ce->clkevt.irq = irq; ce->clkevt.cpumask = cpu_possible_mask;