From patchwork Thu Jun 18 10:54:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50032 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6D26C228CC for ; Thu, 18 Jun 2015 11:02:53 +0000 (UTC) Received: by laar3 with SMTP id r3sf7945567laa.1 for ; Thu, 18 Jun 2015 04:02:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:in-reply-to:references:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list; bh=lxPrEzVwsQsmkWucOUgF1a7bSR/2wAs9gZrn28RPYzw=; b=lvzwbGN6Z1Z1rAZHF7AtBMHmiYRk96ayt8Zd75VlhZ2HuHs83QO81rkfsxo80VOdCu fHZ4/pWMtaoi7BjPRaogzXsECFkPP/YkPUglbr30/5xSeyfQP4UQ2uIZ37V3FzoE/U/l +cnP4QlaoOT7nxldSNLAssX//LAUFHhiLVEpYdEY6fb++4nYm0Ld51DS0Gk/REstN3om LbdK7y7hZnJVR2OXuRHTV3zgxhVhKCsFLM3M0ofsYr7DDDZElgt1MRVG6cg9OS78VBd+ x1XSin1uFjPq1kHYhoutbZmC5LoVYLJbW270Cq7Vk2UYISXhCLsZNxJ1Y8He4nZIxqpA YTZA== X-Gm-Message-State: ALoCoQmxk77mA6+EixgHLQcnnr1SCW1C+3JsUaUdknDeZf1u9UwBakOXWIl7CVUjzOSlj8TPEPUX X-Received: by 10.152.42.208 with SMTP id q16mr9848973lal.9.1434625372438; Thu, 18 Jun 2015 04:02:52 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.246.35 with SMTP id xt3ls408182lac.37.gmail; Thu, 18 Jun 2015 04:02:52 -0700 (PDT) X-Received: by 10.152.9.104 with SMTP id y8mr12502871laa.104.1434625372295; Thu, 18 Jun 2015 04:02:52 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id dn11si6177068lac.122.2015.06.18.04.02.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 04:02:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lacny3 with SMTP id ny3so51861064lac.3 for ; Thu, 18 Jun 2015 04:02:52 -0700 (PDT) X-Received: by 10.112.126.101 with SMTP id mx5mr7189564lbb.35.1434625372190; Thu, 18 Jun 2015 04:02:52 -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 hn6csp1098438lbb; Thu, 18 Jun 2015 04:02:51 -0700 (PDT) X-Received: by 10.66.222.161 with SMTP id qn1mr20591288pac.66.1434625370376; Thu, 18 Jun 2015 04:02:50 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id c1si10853854pdh.205.2015.06.18.04.02.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 04:02:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5XYa-0005GA-Qh; Thu, 18 Jun 2015 11:00:28 +0000 Received: from mail-pd0-f179.google.com ([209.85.192.179]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5XV1-000199-Im for linux-arm-kernel@lists.infradead.org; Thu, 18 Jun 2015 10:56:48 +0000 Received: by pdjn11 with SMTP id n11so64319979pdj.0 for ; Thu, 18 Jun 2015 03:56:26 -0700 (PDT) X-Received: by 10.68.142.42 with SMTP id rt10mr20101429pbb.27.1434624985945; Thu, 18 Jun 2015 03:56:25 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id yp5sm7653594pbb.22.2015.06.18.03.56.24 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:56:25 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Subject: [PATCH 23/41] clocksource: sun4i: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:37 +0530 Message-Id: X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150618_035647_723260_0B054577 X-CRM114-Status: GOOD ( 11.37 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.192.179 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.192.179 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record Cc: Viresh Kumar , Maxime Ripard , linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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.45 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 Migrate sun4i 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/sun4i_timer.c | 41 +++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c index 1928a8912584..6f3719d73390 100644 --- a/drivers/clocksource/sun4i_timer.c +++ b/drivers/clocksource/sun4i_timer.c @@ -81,25 +81,25 @@ static void sun4i_clkevt_time_start(u8 timer, bool periodic) timer_base + TIMER_CTL_REG(timer)); } -static void sun4i_clkevt_mode(enum clock_event_mode mode, - struct clock_event_device *clk) +static int sun4i_clkevt_shutdown(struct clock_event_device *evt) { - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - sun4i_clkevt_time_stop(0); - sun4i_clkevt_time_setup(0, ticks_per_jiffy); - sun4i_clkevt_time_start(0, true); - break; - case CLOCK_EVT_MODE_ONESHOT: - sun4i_clkevt_time_stop(0); - sun4i_clkevt_time_start(0, false); - break; - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - default: - sun4i_clkevt_time_stop(0); - break; - } + sun4i_clkevt_time_stop(0); + return 0; +} + +static int sun4i_clkevt_set_oneshot(struct clock_event_device *evt) +{ + sun4i_clkevt_time_stop(0); + sun4i_clkevt_time_start(0, false); + return 0; +} + +static int sun4i_clkevt_set_periodic(struct clock_event_device *evt) +{ + sun4i_clkevt_time_stop(0); + sun4i_clkevt_time_setup(0, ticks_per_jiffy); + sun4i_clkevt_time_start(0, true); + return 0; } static int sun4i_clkevt_next_event(unsigned long evt, @@ -116,7 +116,10 @@ static struct clock_event_device sun4i_clockevent = { .name = "sun4i_tick", .rating = 350, .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .set_mode = sun4i_clkevt_mode, + .set_state_shutdown = sun4i_clkevt_shutdown, + .set_state_periodic = sun4i_clkevt_set_periodic, + .set_state_oneshot = sun4i_clkevt_set_oneshot, + .tick_resume = sun4i_clkevt_shutdown, .set_next_event = sun4i_clkevt_next_event, };