From patchwork Mon Jul 6 10:54:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50716 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4F20B218EA for ; Mon, 6 Jul 2015 10:57:48 +0000 (UTC) Received: by wgfk9 with SMTP id k9sf48818825wgf.1 for ; Mon, 06 Jul 2015 03:57:47 -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:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe:cc :mime-version:content-type:content-transfer-encoding:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list; bh=LjLGeRIMekYPfDVJ6k+g/6pl02hY6vz8gw7d2NaTFow=; b=Jv/eljHke4nCYvtoMDv5704TbuUjSop3vdKkjAGPRsAEtMsnqQ+ooLhL6pt0vpJAqS 2J6XT+2evpknXPAoZQs1fLtnby0PF33cXBMGW9GBjLjA1oaidhZS7ANqoVKJTRbsvOe9 iSegy+x3NtEt4SqVuAUlE09TggHn4halAffE/wfSBEGVO4InuovNSyPnuDMBb2nJKwEm MC+Ee64YWjMAzNl2XebthLmxngYnkPUPSjMrE7DHnM3O9uv2ZKlv/9FYlTmYxpsi1oyT GIqcmZmgGLiVuIJQcODQ2XCJ97DUo6nMln7tFHf5idKgynwpVaeEqz8+p1/jLgqSLZJO QUvg== X-Gm-Message-State: ALoCoQmopaaW0xPPW1qByUFbk8rIYLVNNCTt6WEe5ISNAs7LypzpiG4vpAkiKOk1d+jp3mAxgPfH X-Received: by 10.194.60.73 with SMTP id f9mr12126455wjr.6.1436180267631; Mon, 06 Jul 2015 03:57:47 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.18 with SMTP id s18ls688012lal.63.gmail; Mon, 06 Jul 2015 03:57:47 -0700 (PDT) X-Received: by 10.112.220.7 with SMTP id ps7mr24798077lbc.72.1436180267468; Mon, 06 Jul 2015 03:57:47 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id n6si12414759lbj.44.2015.07.06.03.57.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 03:57:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by laar3 with SMTP id r3so150048994laa.0 for ; Mon, 06 Jul 2015 03:57:47 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr49434235lbb.56.1436180267345; Mon, 06 Jul 2015 03:57:47 -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 hn6csp1642916lbb; Mon, 6 Jul 2015 03:57:46 -0700 (PDT) X-Received: by 10.67.8.71 with SMTP id di7mr105083629pad.46.1436180265621; Mon, 06 Jul 2015 03:57:45 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id re12si28532493pdb.36.2015.07.06.03.57.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 03:57:45 -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 1ZC44Y-0005ny-6h; Mon, 06 Jul 2015 10:56:26 +0000 Received: from mail-pa0-f53.google.com ([209.85.220.53]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZC44F-0005S7-5h for linux-arm-kernel@lists.infradead.org; Mon, 06 Jul 2015 10:56:07 +0000 Received: by pacgz10 with SMTP id gz10so20056062pac.3 for ; Mon, 06 Jul 2015 03:55:46 -0700 (PDT) X-Received: by 10.68.176.131 with SMTP id ci3mr105769602pbc.146.1436180146563; Mon, 06 Jul 2015 03:55:46 -0700 (PDT) Received: from localhost ([122.171.186.190]) by mx.google.com with ESMTPSA id pq3sm17825773pbb.24.2015.07.06.03.55.45 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 06 Jul 2015 03:55:45 -0700 (PDT) From: Viresh Kumar To: linux-arm-kernel@lists.infradead.org, Daniel Lezcano , linux@arm.linux.org.uk, arnd.bergmann@linaro.org, olof@lixom.net Subject: [PATCH 04/18] ARM/dc21285-timer: Migrate to new 'set-state' interface Date: Mon, 6 Jul 2015 16:24:11 +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-20150706_035607_244624_C05B51BE X-CRM114-Status: GOOD ( 15.34 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.53 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.220.53 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: Viresh Kumar , Thomas Gleixner , linaro-kernel@lists.linaro.org, arm@kernel.org, Kevin Hilman 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.53 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 footbridge 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: Russell King Signed-off-by: Viresh Kumar --- arch/arm/mach-footbridge/dc21285-timer.c | 48 +++++++++++++++----------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/arch/arm/mach-footbridge/dc21285-timer.c b/arch/arm/mach-footbridge/dc21285-timer.c index bf7aa7d298e7..810edc78c817 100644 --- a/arch/arm/mach-footbridge/dc21285-timer.c +++ b/arch/arm/mach-footbridge/dc21285-timer.c @@ -57,34 +57,32 @@ static int ckevt_dc21285_set_next_event(unsigned long delta, return 0; } -static void ckevt_dc21285_set_mode(enum clock_event_mode mode, - struct clock_event_device *c) +static int ckevt_dc21285_shutdown(struct clock_event_device *c) { - switch (mode) { - case CLOCK_EVT_MODE_RESUME: - case CLOCK_EVT_MODE_PERIODIC: - *CSR_TIMER1_CLR = 0; - *CSR_TIMER1_LOAD = (mem_fclk_21285 + 8 * HZ) / (16 * HZ); - *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | - TIMER_CNTL_DIV16; - break; - - case CLOCK_EVT_MODE_ONESHOT: - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - *CSR_TIMER1_CNTL = 0; - break; - } + *CSR_TIMER1_CNTL = 0; + return 0; +} + +static int ckevt_dc21285_set_periodic(struct clock_event_device *c) +{ + *CSR_TIMER1_CLR = 0; + *CSR_TIMER1_LOAD = (mem_fclk_21285 + 8 * HZ) / (16 * HZ); + *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | + TIMER_CNTL_DIV16; + return 0; } static struct clock_event_device ckevt_dc21285 = { - .name = "dc21285_timer1", - .features = CLOCK_EVT_FEAT_PERIODIC | - CLOCK_EVT_FEAT_ONESHOT, - .rating = 200, - .irq = IRQ_TIMER1, - .set_next_event = ckevt_dc21285_set_next_event, - .set_mode = ckevt_dc21285_set_mode, + .name = "dc21285_timer1", + .features = CLOCK_EVT_FEAT_PERIODIC | + CLOCK_EVT_FEAT_ONESHOT, + .rating = 200, + .irq = IRQ_TIMER1, + .set_next_event = ckevt_dc21285_set_next_event, + .set_state_shutdown = ckevt_dc21285_shutdown, + .set_state_periodic = ckevt_dc21285_set_periodic, + .set_state_oneshot = ckevt_dc21285_shutdown, + .tick_resume = ckevt_dc21285_set_periodic, }; static irqreturn_t timer1_interrupt(int irq, void *dev_id) @@ -94,7 +92,7 @@ static irqreturn_t timer1_interrupt(int irq, void *dev_id) *CSR_TIMER1_CLR = 0; /* Stop the timer if in one-shot mode */ - if (ce->mode == CLOCK_EVT_MODE_ONESHOT) + if (clockevent_state_oneshot(ce)) *CSR_TIMER1_CNTL = 0; ce->event_handler(ce);