From patchwork Fri Jul 17 05:10:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51211 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B0FFC22A8C for ; Fri, 17 Jul 2015 05:12:18 +0000 (UTC) Received: by lbbvz8 with SMTP id vz8sf22875764lbb.2 for ; Thu, 16 Jul 2015 22:12:17 -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=m0LHWRkOFlYL19KP+sgVVr81GiqFB/4ZNAXDQX4J0Tw=; b=Zem0Rtk/nu5mnAIoYRaxFK7TvEZMOv8GmdYRZC6vhp5A9gvsFr0a7oVDB5DHF5OQDp QmHUKvl3IvHdE0SfF6Nl70sZn/Ozlo7+HiB7YEzODDUUHwvy8zRGkTUb/7iPkoA3i0H7 r9K76VSNqHATQ8+jYUiQG/i+yulOHUJzKTX0cCWPDQdTSBmg59uR3yPMfFniQIUtAj10 SNd7P9Wpa+Gd5sDjBMqpGr9MHRopwtyyVKSZpyN7qw8U2PzsAGCCxkKBqNv6P4IVOUpN A25Im49ToJyGpVBp5pGTs6GGlhGLgdDkJjw3D9UFb10k0sG+D5HTCye0Uf0klZa3n/MC wzIA== X-Gm-Message-State: ALoCoQke6PshKHU1P3TNCGG2TraT3Z4VJfq4Ie9BHm36G7liSk9gOSSGWEalrGLWePoXVrdOLQRx X-Received: by 10.194.93.198 with SMTP id cw6mr6612189wjb.3.1437109937708; Thu, 16 Jul 2015 22:12:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.179.171 with SMTP id dh11ls402278lac.47.gmail; Thu, 16 Jul 2015 22:12:17 -0700 (PDT) X-Received: by 10.152.21.132 with SMTP id v4mr12666063lae.18.1437109937517; Thu, 16 Jul 2015 22:12:17 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id ay7si8884154lbc.60.2015.07.16.22.12.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 22:12:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lahh5 with SMTP id h5so55019116lah.2 for ; Thu, 16 Jul 2015 22:12:17 -0700 (PDT) X-Received: by 10.152.1.66 with SMTP id 2mr13029276lak.56.1437109937033; Thu, 16 Jul 2015 22:12:17 -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 hn6csp668287lbb; Thu, 16 Jul 2015 22:12:15 -0700 (PDT) X-Received: by 10.66.119.136 with SMTP id ku8mr25347432pab.26.1437109934934; Thu, 16 Jul 2015 22:12:14 -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.14; Thu, 16 Jul 2015 22:12:14 -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 S1756126AbbGQFL5 (ORCPT + 28 others); Fri, 17 Jul 2015 01:11:57 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:33491 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755714AbbGQFLy (ORCPT ); Fri, 17 Jul 2015 01:11:54 -0400 Received: by padck2 with SMTP id ck2so54324492pad.0 for ; Thu, 16 Jul 2015 22:11:54 -0700 (PDT) X-Received: by 10.66.100.138 with SMTP id ey10mr25687900pab.110.1437109914003; Thu, 16 Jul 2015 22:11:54 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id fq3sm4466364pbb.17.2015.07.16.22.11.52 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jul 2015 22:11:53 -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 , Russell King , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 04/18] ARM/dc21285-timer: Migrate to new 'set-state' interface Date: Fri, 17 Jul 2015 10:40:58 +0530 Message-Id: <947d9cf53f5c9c4dfbbffe68f07dd4d02da2093d.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.43 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 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);