From patchwork Fri Jul 17 05:11:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51215 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 04FAF22A28 for ; Fri, 17 Jul 2015 05:12:30 +0000 (UTC) Received: by lbbvz8 with SMTP id vz8sf22876414lbb.2 for ; Thu, 16 Jul 2015 22:12: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=hGDEvkD8NrTm9ipntj8+jkvsTaGCgC32hKG7poRd+xw=; b=mswSfByV0y968jd7j4J4tpDHdL+BLKQ3tmeLQt3CqhP7Yui6ikriUcxJdUfiCt1Hhf bimhJxP+6nhHpEOYn15hgiAK9xkRtVsWPAR8eCWnbBVqxd3nWvN/38CZznWPUy0261rm KaVvZnr+3NCRIZUOwBxfTL0dwVglgmPRGGphFzsOi4tbbk0BaNpWzB1RJtwoZ7k0Y2Hi rJBig0ekjw0740iZ7+NgoAhEzTkZ4G0lHi0Vjge8Ye+PpkRnd9G9IG894z/nCVZrEfMu kbR3j6N/0uNnEcqAyMaI20+GrLxx+vy5yogXHWDWIQxqc6dPrFNY58iNY255dMvbTNan UoGg== X-Gm-Message-State: ALoCoQlfelJqUYCQd2+LDP6rIIJqvltNHx4A73yA/AntRtXu3BhVz1CeJe0dsAL2hOBV2MKM1kjv X-Received: by 10.152.8.110 with SMTP id q14mr6606290laa.3.1437109949027; Thu, 16 Jul 2015 22:12:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.231 with SMTP id e7ls426678laa.34.gmail; Thu, 16 Jul 2015 22:12:28 -0700 (PDT) X-Received: by 10.112.133.72 with SMTP id pa8mr12616389lbb.117.1437109948520; Thu, 16 Jul 2015 22:12:28 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id y6si8898098lbj.20.2015.07.16.22.12.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 22:12:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by lagx9 with SMTP id x9so55000364lag.1 for ; Thu, 16 Jul 2015 22:12:28 -0700 (PDT) X-Received: by 10.112.131.98 with SMTP id ol2mr13026481lbb.56.1437109948084; Thu, 16 Jul 2015 22:12:28 -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 hn6csp668355lbb; Thu, 16 Jul 2015 22:12:26 -0700 (PDT) X-Received: by 10.68.173.197 with SMTP id bm5mr26045467pbc.13.1437109939374; Thu, 16 Jul 2015 22:12:19 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nm5si16574979pbc.166.2015.07.16.22.12.18; Thu, 16 Jul 2015 22:12:19 -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 S1756705AbbGQFMQ (ORCPT + 28 others); Fri, 17 Jul 2015 01:12:16 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:34582 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756537AbbGQFMN (ORCPT ); Fri, 17 Jul 2015 01:12:13 -0400 Received: by pdbbh15 with SMTP id bh15so10298585pdb.1 for ; Thu, 16 Jul 2015 22:12:12 -0700 (PDT) X-Received: by 10.70.37.144 with SMTP id y16mr25699114pdj.86.1437109932894; Thu, 16 Jul 2015 22:12:12 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id gp1sm9666803pbd.64.2015.07.16.22.12.11 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jul 2015 22:12:12 -0700 (PDT) From: Viresh Kumar To: arm@kernel.org, olof@lixom.net Cc: linaro-kernel@lists.linaro.org, arnd.bergmann@linaro.org, linux-arm-kernel@lists.infradead.org, Viresh Kumar , Greg Ungerer , linux-kernel@vger.kernel.org (open list), Russell King Subject: [PATCH 08/18] ARM/ks8695/time: Migrate to new 'set-state' interface Date: Fri, 17 Jul 2015 10:41:02 +0530 Message-Id: <7cfa3c69ca97acfd7cac19652d82aa610015bab8.1437101996.git.viresh.kumar@linaro.org> 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.47 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 ks8695 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. There is nothing to be done for oneshot or shutdown states and so are not implemented. Acked-by: Greg Ungerer Signed-off-by: Viresh Kumar --- arch/arm/mach-ks8695/time.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/arch/arm/mach-ks8695/time.c b/arch/arm/mach-ks8695/time.c index a197874bf382..18eb0fbd8d82 100644 --- a/arch/arm/mach-ks8695/time.c +++ b/arch/arm/mach-ks8695/time.c @@ -54,28 +54,25 @@ /* Timer0 Timeout Counter Register */ #define T0TC_WATCHDOG (0xff) /* Enable watchdog mode */ -static void ks8695_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int ks8695_set_periodic(struct clock_event_device *evt) { + u32 rate = DIV_ROUND_CLOSEST(KS8695_CLOCK_RATE, HZ); + u32 half = DIV_ROUND_CLOSEST(rate, 2); u32 tmcon; - if (mode == CLOCK_EVT_FEAT_PERIODIC) { - u32 rate = DIV_ROUND_CLOSEST(KS8695_CLOCK_RATE, HZ); - u32 half = DIV_ROUND_CLOSEST(rate, 2); - - /* Disable timer 1 */ - tmcon = readl_relaxed(KS8695_TMR_VA + KS8695_TMCON); - tmcon &= ~TMCON_T1EN; - writel_relaxed(tmcon, KS8695_TMR_VA + KS8695_TMCON); + /* Disable timer 1 */ + tmcon = readl_relaxed(KS8695_TMR_VA + KS8695_TMCON); + tmcon &= ~TMCON_T1EN; + writel_relaxed(tmcon, KS8695_TMR_VA + KS8695_TMCON); - /* Both registers need to count down */ - writel_relaxed(half, KS8695_TMR_VA + KS8695_T1TC); - writel_relaxed(half, KS8695_TMR_VA + KS8695_T1PD); + /* Both registers need to count down */ + writel_relaxed(half, KS8695_TMR_VA + KS8695_T1TC); + writel_relaxed(half, KS8695_TMR_VA + KS8695_T1PD); - /* Re-enable timer1 */ - tmcon |= TMCON_T1EN; - writel_relaxed(tmcon, KS8695_TMR_VA + KS8695_TMCON); - } + /* Re-enable timer1 */ + tmcon |= TMCON_T1EN; + writel_relaxed(tmcon, KS8695_TMR_VA + KS8695_TMCON); + return 0; } static int ks8695_set_next_event(unsigned long cycles, @@ -102,11 +99,13 @@ static int ks8695_set_next_event(unsigned long cycles, } static struct clock_event_device clockevent_ks8695 = { - .name = "ks8695_t1tc", - .rating = 300, /* Reasonably fast and accurate clock event */ - .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, - .set_next_event = ks8695_set_next_event, - .set_mode = ks8695_set_mode, + .name = "ks8695_t1tc", + /* Reasonably fast and accurate clock event */ + .rating = 300, + .features = CLOCK_EVT_FEAT_ONESHOT | + CLOCK_EVT_FEAT_PERIODIC, + .set_next_event = ks8695_set_next_event, + .set_state_periodic = ks8695_set_periodic, }; /*