From patchwork Fri Jul 17 05:10:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51210 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BEE0D22A28 for ; Fri, 17 Jul 2015 05:12:17 +0000 (UTC) Received: by lbbvz8 with SMTP id vz8sf22875666lbb.2 for ; Thu, 16 Jul 2015 22:12:16 -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=c0MbiwEQNtOk+q0+EMWFc58tEXB13msw4qwjhhVCWb4=; b=gc4DWt/3GW19GJTUmdG2/RANtBSixIuS2fzk3cF135PFNIHwzJDZgQ8rWSk6fjt4WF +S6usQhAiQIefxYei9hBRh0em7HEzKe+9Pm9t1Z7II+Bg2wzVOXjSt0ol5KtVdrli1hx QYE503N2ruYpF1n5d1zj5B3HM4De11D0vr+kWImkyl3rRImEKYjZObdrndSaZn1ECT7+ QvQj31XVq0b3zpuyHI7Lab73/jY2/Md9ZLfwSHdxfQsoZVsGfR8G1Tlp6OCHQIZ2L9kH PGLUxo5U9+8tE8hZwmr8bsN7Kb3FxMYDXPPjDnblJN+anlCNSRHgT6U5FwK+XO3DEonQ Q+GQ== X-Gm-Message-State: ALoCoQlOJSAPEptY/pboj8cA1Eb1SxcThP1ZR5jLJY3v/8TJS3Rt+2WMAc5T3vLvZE3LvsmP6sSh X-Received: by 10.180.105.226 with SMTP id gp2mr3158785wib.1.1437109936349; Thu, 16 Jul 2015 22:12:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.201 with SMTP id t9ls441461laa.95.gmail; Thu, 16 Jul 2015 22:12:16 -0700 (PDT) X-Received: by 10.112.63.201 with SMTP id i9mr12633092lbs.93.1437109936085; Thu, 16 Jul 2015 22:12:16 -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 k7si8888099lbj.50.2015.07.16.22.12.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 22:12:15 -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 lagx9 with SMTP id x9so54998632lag.1 for ; Thu, 16 Jul 2015 22:12:15 -0700 (PDT) X-Received: by 10.152.7.7 with SMTP id f7mr12755813laa.106.1437109935659; Thu, 16 Jul 2015 22:12:15 -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 hn6csp668272lbb; Thu, 16 Jul 2015 22:12:14 -0700 (PDT) X-Received: by 10.70.34.171 with SMTP id a11mr25608525pdj.18.1437109933878; Thu, 16 Jul 2015 22:12:13 -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.12; Thu, 16 Jul 2015 22:12:13 -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 S1755600AbbGQFLx (ORCPT + 28 others); Fri, 17 Jul 2015 01:11:53 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:36185 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752654AbbGQFLu (ORCPT ); Fri, 17 Jul 2015 01:11:50 -0400 Received: by pdjr16 with SMTP id r16so56295949pdj.3 for ; Thu, 16 Jul 2015 22:11:49 -0700 (PDT) X-Received: by 10.66.142.73 with SMTP id ru9mr25862186pab.78.1437109909760; Thu, 16 Jul 2015 22:11:49 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id ry2sm9652458pbb.83.2015.07.16.22.11.48 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jul 2015 22:11:49 -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 , Sekhar Nori , Kevin Hilman , linux-kernel@vger.kernel.org (open list), Russell King Subject: [PATCH 03/18] ARM/davinci/time: Migrate to new 'set-state' interface Date: Fri, 17 Jul 2015 10:40:57 +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.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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Migrate davinci 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. We weren't doing anything in set_mode(RESUME) and so .tick_resume() isn't implemented. Cc: Sekhar Nori Cc: Kevin Hilman Signed-off-by: Viresh Kumar --- arch/arm/mach-davinci/time.c | 54 ++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c index 160c9602f490..6c18445a4639 100644 --- a/arch/arm/mach-davinci/time.c +++ b/arch/arm/mach-davinci/time.c @@ -303,36 +303,42 @@ static int davinci_set_next_event(unsigned long cycles, return 0; } -static void davinci_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int davinci_shutdown(struct clock_event_device *evt) { struct timer_s *t = &timers[TID_CLOCKEVENT]; - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - t->period = davinci_clock_tick_rate / (HZ); - t->opts &= ~TIMER_OPTS_STATE_MASK; - t->opts |= TIMER_OPTS_PERIODIC; - timer32_config(t); - break; - case CLOCK_EVT_MODE_ONESHOT: - t->opts &= ~TIMER_OPTS_STATE_MASK; - t->opts |= TIMER_OPTS_ONESHOT; - break; - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - t->opts &= ~TIMER_OPTS_STATE_MASK; - t->opts |= TIMER_OPTS_DISABLED; - break; - case CLOCK_EVT_MODE_RESUME: - break; - } + t->opts &= ~TIMER_OPTS_STATE_MASK; + t->opts |= TIMER_OPTS_DISABLED; + return 0; +} + +static int davinci_set_oneshot(struct clock_event_device *evt) +{ + struct timer_s *t = &timers[TID_CLOCKEVENT]; + + t->opts &= ~TIMER_OPTS_STATE_MASK; + t->opts |= TIMER_OPTS_ONESHOT; + return 0; +} + +static int davinci_set_periodic(struct clock_event_device *evt) +{ + struct timer_s *t = &timers[TID_CLOCKEVENT]; + + t->period = davinci_clock_tick_rate / (HZ); + t->opts &= ~TIMER_OPTS_STATE_MASK; + t->opts |= TIMER_OPTS_PERIODIC; + timer32_config(t); + return 0; } static struct clock_event_device clockevent_davinci = { - .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .set_next_event = davinci_set_next_event, - .set_mode = davinci_set_mode, + .features = CLOCK_EVT_FEAT_PERIODIC | + CLOCK_EVT_FEAT_ONESHOT, + .set_next_event = davinci_set_next_event, + .set_state_shutdown = davinci_shutdown, + .set_state_periodic = davinci_set_periodic, + .set_state_oneshot = davinci_set_oneshot, };