From patchwork Tue Jun 30 09:00:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50445 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D9D69218E4 for ; Tue, 30 Jun 2015 09:01:20 +0000 (UTC) Received: by wiar9 with SMTP id r9sf4114418wia.1 for ; Tue, 30 Jun 2015 02:01:20 -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:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:user-agent:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=c3Eq6eILFJBjjdcaVxoRQ24ix6gGMGdbp6x5XElufiM=; b=joisR7uonKSlJMblMj2DjA4MAc9hzme18BISkdvEGTGwKxrOqIG/Y2HUbjAvrrPWyx RFI1LQurvN0Ef4UWmgaSZrA1ZT1m4qOe/gffL/YAS3xh94WFKP7W0VJa88NXibknY4bu KlBys2WNX3i7yw8u1hHnps4v0fYLE8Imn20LQOEJbAKUwk9Eva8dmm6iErbF1jmrZF/N WDgNvRNxIE72dHcBnYPvHzeKFaFrJVZkA5je4cDvIpezEYYbNXV6HR9lAOfbAJ4syBsa oqvAfGiwpbhoH4gY5Yo1cB0s/pPTKWHbKgV0cWQC3oLDRfv9hLvVBniBmua1CPULltPc ZLWw== X-Gm-Message-State: ALoCoQm8KXd3YO+OTGTOLrzx4scMFrCPW7c981AwCu5OqmdvlGJf1MVfZ11vuZT89//AVEUFC+HN X-Received: by 10.112.14.101 with SMTP id o5mr13445433lbc.3.1435654879622; Tue, 30 Jun 2015 02:01:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.201 with SMTP id p9ls15261lae.42.gmail; Tue, 30 Jun 2015 02:01:19 -0700 (PDT) X-Received: by 10.112.126.101 with SMTP id mx5mr18824896lbb.35.1435654879447; Tue, 30 Jun 2015 02:01:19 -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 h10si37506666laa.130.2015.06.30.02.01.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jun 2015 02:01:19 -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 laar3 with SMTP id r3so4907770laa.0 for ; Tue, 30 Jun 2015 02:01:19 -0700 (PDT) X-Received: by 10.112.209.106 with SMTP id ml10mr18291111lbc.112.1435654879320; Tue, 30 Jun 2015 02:01:19 -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 hn6csp2288337lbb; Tue, 30 Jun 2015 02:01:18 -0700 (PDT) X-Received: by 10.43.171.202 with SMTP id nv10mr22743145icc.30.1435654877615; Tue, 30 Jun 2015 02:01:17 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yl10si68138013pac.98.2015.06.30.02.01.14; Tue, 30 Jun 2015 02:01:17 -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 S1752918AbbF3JBB (ORCPT + 30 others); Tue, 30 Jun 2015 05:01:01 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:36066 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751767AbbF3JAx (ORCPT ); Tue, 30 Jun 2015 05:00:53 -0400 Received: by pdcu2 with SMTP id u2so2712104pdc.3 for ; Tue, 30 Jun 2015 02:00:52 -0700 (PDT) X-Received: by 10.66.250.131 with SMTP id zc3mr41287188pac.136.1435654852615; Tue, 30 Jun 2015 02:00:52 -0700 (PDT) Received: from localhost ([122.171.186.190]) by mx.google.com with ESMTPSA id ho10sm44747809pbc.27.2015.06.30.02.00.51 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 30 Jun 2015 02:00:51 -0700 (PDT) Date: Tue, 30 Jun 2015 14:30:48 +0530 From: Viresh Kumar To: Daniel Lezcano Cc: Thomas Gleixner , linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Oleksij Rempel Subject: Re: [PATCH 01/41] clocksource: asm9260: Migrate to new 'set-state' interface Message-ID: <20150630090048.GA4626@linux> References: <57ae9434bbb7218961c3ad45a26fbe1fffe40cbd.1434622147.git.viresh.kumar@linaro.org> <55925268.4050109@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <55925268.4050109@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) 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: , On 30-06-15, 10:25, Daniel Lezcano wrote: > Could you add in the changelog the subtle change with > set_mode(RESUME) and this code. As a default the timer was stopped > when entering in the set_mode function, now with the new API, this > is done explicitly. > Can you replace this line with a call to asm9260_timer_shutdown ? How does this look ? --------------------------8<------------------ Message-Id: <12839571df542ecc8b9304b7de9881216d45aef8.1435654791.git.viresh.kumar@linaro.org> From: Viresh Kumar Date: Fri, 27 Feb 2015 13:39:52 +0530 Subject: [PATCH] clocksource: asm9260: Migrate to new 'set-state' interface Migrate asm9260 driver to the new 'set-state' interface provided by clockevents core, the earlier 'set-mode' interface is marked obsolete now. As a default the timer was stopped when entering in the set_mode(RESUME) function, now this is done explicitly with the new API. This also enables us to implement callbacks for new states of clockevent devices, for example: ONESHOT_STOPPED. Cc: Oleksij Rempel Signed-off-by: Viresh Kumar --- drivers/clocksource/asm9260_timer.c | 64 ++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 25 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/clocksource/asm9260_timer.c b/drivers/clocksource/asm9260_timer.c index 4c2ba59897e8..217438d39eb3 100644 --- a/drivers/clocksource/asm9260_timer.c +++ b/drivers/clocksource/asm9260_timer.c @@ -120,38 +120,52 @@ static int asm9260_timer_set_next_event(unsigned long delta, return 0; } -static void asm9260_timer_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static inline void __asm9260_timer_shutdown(struct clock_event_device *evt) { /* stop timer0 */ writel_relaxed(BM_C0_EN, priv.base + HW_TCR + CLR_REG); +} + +static int asm9260_timer_shutdown(struct clock_event_device *evt) +{ + __asm9260_timer_shutdown(evt); + return 0; +} + +static int asm9260_timer_set_oneshot(struct clock_event_device *evt) +{ + __asm9260_timer_shutdown(evt); + + /* enable reset and stop on match */ + writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), + priv.base + HW_MCR + SET_REG); + return 0; +} + +static int asm9260_timer_set_periodic(struct clock_event_device *evt) +{ + __asm9260_timer_shutdown(evt); - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - /* disable reset and stop on match */ - writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), - priv.base + HW_MCR + CLR_REG); - /* configure match count for TC0 */ - writel_relaxed(priv.ticks_per_jiffy, priv.base + HW_MR0); - /* enable TC0 */ - writel_relaxed(BM_C0_EN, priv.base + HW_TCR + SET_REG); - break; - case CLOCK_EVT_MODE_ONESHOT: - /* enable reset and stop on match */ - writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), - priv.base + HW_MCR + SET_REG); - break; - default: - break; - } + /* disable reset and stop on match */ + writel_relaxed(BM_MCR_RES_EN(0) | BM_MCR_STOP_EN(0), + priv.base + HW_MCR + CLR_REG); + /* configure match count for TC0 */ + writel_relaxed(priv.ticks_per_jiffy, priv.base + HW_MR0); + /* enable TC0 */ + writel_relaxed(BM_C0_EN, priv.base + HW_TCR + SET_REG); + return 0; } static struct clock_event_device event_dev = { - .name = DRIVER_NAME, - .rating = 200, - .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .set_next_event = asm9260_timer_set_next_event, - .set_mode = asm9260_timer_set_mode, + .name = DRIVER_NAME, + .rating = 200, + .features = CLOCK_EVT_FEAT_PERIODIC | + CLOCK_EVT_FEAT_ONESHOT, + .set_next_event = asm9260_timer_set_next_event, + .set_state_shutdown = asm9260_timer_shutdown, + .set_state_periodic = asm9260_timer_set_periodic, + .set_state_oneshot = asm9260_timer_set_oneshot, + .tick_resume = asm9260_timer_shutdown, }; static irqreturn_t asm9260_timer_interrupt(int irq, void *dev_id)