From patchwork Mon Jun 8 13:40:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 6565331 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5C421C0020 for ; Mon, 8 Jun 2015 13:44:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6CE08203B8 for ; Mon, 8 Jun 2015 13:44:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF02620531 for ; Mon, 8 Jun 2015 13:44:16 +0000 (UTC) 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 1Z1xJZ-0005eS-Uk; Mon, 08 Jun 2015 13:42:09 +0000 Received: from mail-pd0-f180.google.com ([209.85.192.180]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z1xJ7-0005Rw-J9 for linux-arm-kernel@lists.infradead.org; Mon, 08 Jun 2015 13:41:42 +0000 Received: by pdjm12 with SMTP id m12so104958594pdj.3 for ; Mon, 08 Jun 2015 06:41: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:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=Q9XtEVHfwFAySl17n5DqQ4ZhspUn+gS8UhoDHpSUY/E=; b=mruA1SEA/Vsx9fqo3Yd29ez+swwrVAL+twwSmJXcnEMXMO9NuhwMZqzCDmph0rPUCL dT0GIJ1U8qHJKm/9Lkc0KinmUNCsmnMjnl/U1+JeCFryYKGLiv/EwRRciN2iJwnh8cCX ICyXn1OL2pYw9Rs9zZAwmDtZtVRaezETJBrywJK7ClaXTvvSa+danIJoqoich50mGpPI 5H3XWhkQVdDio1ngZwxQeGAlomcKsqFoqNzNpVCQbNRpk+faAmWE1La2sf/Hu5Pxvk1i 98DRIbkSETZa0FZUtEeW9yxTLTmM0vwfryY1tjpgdkQlbXD+LoNLodMk1xZwTerNoknU RZ2A== X-Gm-Message-State: ALoCoQmGWDyO68nZRxIm7L1gaAUSJ5EIuyCGFi9tJclbDfkI4kec9tFOeN3z4DNWZp4UG1xTdkJ9 X-Received: by 10.66.168.11 with SMTP id zs11mr30413711pab.138.1433770880486; Mon, 08 Jun 2015 06:41:20 -0700 (PDT) Received: from localhost ([122.167.219.251]) by mx.google.com with ESMTPSA id zs5sm2714883pac.11.2015.06.08.06.41.18 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 08 Jun 2015 06:41:19 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Subject: [PATCH 2/6] clocksource: arm_global_timer: Migrate to new 'set-state' interface Date: Mon, 8 Jun 2015 19:10:43 +0530 Message-Id: <54f346e663f605e2f078a3114de85ba281d1e6d0.1433768426.git.viresh.kumar@linaro.org> 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-20150608_064141_726866_F1BEC52B X-CRM114-Status: GOOD ( 13.69 ) X-Spam-Score: -1.8 (-) Cc: linaro-kernel@lists.linaro.org, Viresh Kumar , linux-kernel@vger.kernel.org, Patrice Chotard , Srinivas Kandagatla , linux-arm-kernel@lists.infradead.org, Maxime Coquelin X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Migrate arm_global_timer driver to the new 'set-state' interface provided by the 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: Srinivas Kandagatla Cc: Maxime Coquelin Cc: Patrice Chotard Signed-off-by: Viresh Kumar Acked-by: Daniel Lezcano Acked-by: Srinivas Kandagatla --- drivers/clocksource/arm_global_timer.c | 37 ++++++++++++++++------------------ 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/drivers/clocksource/arm_global_timer.c b/drivers/clocksource/arm_global_timer.c index e6833771a716..29ea50ac366a 100644 --- a/drivers/clocksource/arm_global_timer.c +++ b/drivers/clocksource/arm_global_timer.c @@ -107,26 +107,21 @@ static void gt_compare_set(unsigned long delta, int periodic) writel(ctrl, gt_base + GT_CONTROL); } -static void gt_clockevent_set_mode(enum clock_event_mode mode, - struct clock_event_device *clk) +static int gt_clockevent_shutdown(struct clock_event_device *evt) { unsigned long ctrl; - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - gt_compare_set(DIV_ROUND_CLOSEST(gt_clk_rate, HZ), 1); - break; - case CLOCK_EVT_MODE_ONESHOT: - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - ctrl = readl(gt_base + GT_CONTROL); - ctrl &= ~(GT_CONTROL_COMP_ENABLE | - GT_CONTROL_IRQ_ENABLE | GT_CONTROL_AUTO_INC); - writel(ctrl, gt_base + GT_CONTROL); - break; - default: - break; - } + ctrl = readl(gt_base + GT_CONTROL); + ctrl &= ~(GT_CONTROL_COMP_ENABLE | GT_CONTROL_IRQ_ENABLE | + GT_CONTROL_AUTO_INC); + writel(ctrl, gt_base + GT_CONTROL); + return 0; +} + +static int gt_clockevent_set_periodic(struct clock_event_device *evt) +{ + gt_compare_set(DIV_ROUND_CLOSEST(gt_clk_rate, HZ), 1); + return 0; } static int gt_clockevent_set_next_event(unsigned long evt, @@ -155,7 +150,7 @@ static irqreturn_t gt_clockevent_interrupt(int irq, void *dev_id) * the Global Timer flag _after_ having incremented * the Comparator register value to a higher value. */ - if (evt->mode == CLOCK_EVT_MODE_ONESHOT) + if (clockevent_state_oneshot(evt)) gt_compare_set(ULONG_MAX, 0); writel_relaxed(GT_INT_STATUS_EVENT_FLAG, gt_base + GT_INT_STATUS); @@ -171,7 +166,9 @@ static int gt_clockevents_init(struct clock_event_device *clk) clk->name = "arm_global_timer"; clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERCPU; - clk->set_mode = gt_clockevent_set_mode; + clk->set_state_shutdown = gt_clockevent_shutdown; + clk->set_state_periodic = gt_clockevent_set_periodic; + clk->set_state_oneshot = gt_clockevent_shutdown; clk->set_next_event = gt_clockevent_set_next_event; clk->cpumask = cpumask_of(cpu); clk->rating = 300; @@ -184,7 +181,7 @@ static int gt_clockevents_init(struct clock_event_device *clk) static void gt_clockevents_stop(struct clock_event_device *clk) { - gt_clockevent_set_mode(CLOCK_EVT_MODE_UNUSED, clk); + gt_clockevent_shutdown(clk); disable_percpu_irq(clk->irq); }