From patchwork Fri Jul 17 05:10:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51208 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E618922A28 for ; Fri, 17 Jul 2015 05:11:48 +0000 (UTC) Received: by widjy10 with SMTP id jy10sf9104090wid.3 for ; Thu, 16 Jul 2015 22:11:48 -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=RC2MRi/d+bViIHDiCpm/jZO4FuVpg6rSsQwKRdID0v8=; b=N79tWwvN6k7cJWf5U7X/MrGa9qn+5AelJqWYilvUNJjCwZKHoxsZ66NENi70JA9kkn 0YgLVd7HomrJeIrdq9oOUKKOlN9iZlIoDZVikE5L0aG5kDt3wKzIQ54fA7IIFmFkvRkV Jl3M80oY1ZWAFFkdQwnsQexEJDatWTUbpR24ex2HvpGjNAXjAlBrfBf6I5vYqRM+VEm7 ZPZg2JiCOq66mcrjQ+mf8al91DYzzS27PYkbgbUbMyDLtq0HI3cLIZXPMIHL2HHLrEsq FVIpcywjTGAZqqeKuDs7jlmNQAOh76t5trBLdob9eCv0xxTvbxjKFDbZZDbHJDCrS7CL ShHQ== X-Gm-Message-State: ALoCoQl1Kgb27QuEo+JAjav4pgx/E37cg3L4GAT94FPXDQblhCcPfq2/bKBClP7Xx76ouIrJ/K3M X-Received: by 10.112.14.101 with SMTP id o5mr6704009lbc.3.1437109908188; Thu, 16 Jul 2015 22:11:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.201 with SMTP id p9ls474141lae.42.gmail; Thu, 16 Jul 2015 22:11:47 -0700 (PDT) X-Received: by 10.112.168.165 with SMTP id zx5mr12428260lbb.111.1437109907686; Thu, 16 Jul 2015 22:11:47 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id zl2si8884599lbb.55.2015.07.16.22.11.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 22:11:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by lblf12 with SMTP id f12so55187872lbl.2 for ; Thu, 16 Jul 2015 22:11:47 -0700 (PDT) X-Received: by 10.152.37.228 with SMTP id b4mr12610864lak.117.1437109907365; Thu, 16 Jul 2015 22:11:47 -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 hn6csp668112lbb; Thu, 16 Jul 2015 22:11:46 -0700 (PDT) X-Received: by 10.68.209.136 with SMTP id mm8mr16587559pbc.64.1437109905315; Thu, 16 Jul 2015 22:11:45 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rt12si16663481pac.104.2015.07.16.22.11.44; Thu, 16 Jul 2015 22:11:45 -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 S1754842AbbGQFLn (ORCPT + 28 others); Fri, 17 Jul 2015 01:11:43 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:36098 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752113AbbGQFLl (ORCPT ); Fri, 17 Jul 2015 01:11:41 -0400 Received: by pdjr16 with SMTP id r16so56293917pdj.3 for ; Thu, 16 Jul 2015 22:11:41 -0700 (PDT) X-Received: by 10.66.231.69 with SMTP id te5mr25426675pac.98.1437109901005; Thu, 16 Jul 2015 22:11:41 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id qg5sm9722629pdb.13.2015.07.16.22.11.39 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jul 2015 22:11:40 -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 , Christoph Lameter , linux-kernel@vger.kernel.org (open list), Tejun Heo , Will Deacon Subject: [PATCH 01/18] ARM/smp_twd: Migrate to new 'set-state' interface Date: Fri, 17 Jul 2015 10:40:55 +0530 Message-Id: <5e2535710ee3fa2807406ea75eb4381f85b29b0b.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.217.174 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 smp_twd 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/kernel/smp_twd.c | 48 +++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index 172c6a05d27f..e9035cda1485 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c @@ -36,29 +36,30 @@ static DEFINE_PER_CPU(bool, percpu_setup_called); static struct clock_event_device __percpu *twd_evt; static int twd_ppi; -static void twd_set_mode(enum clock_event_mode mode, - struct clock_event_device *clk) +static int twd_shutdown(struct clock_event_device *clk) { - unsigned long ctrl; - - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - ctrl = TWD_TIMER_CONTROL_ENABLE | TWD_TIMER_CONTROL_IT_ENABLE - | TWD_TIMER_CONTROL_PERIODIC; - writel_relaxed(DIV_ROUND_CLOSEST(twd_timer_rate, HZ), - twd_base + TWD_TIMER_LOAD); - break; - case CLOCK_EVT_MODE_ONESHOT: - /* period set, and timer enabled in 'next_event' hook */ - ctrl = TWD_TIMER_CONTROL_IT_ENABLE | TWD_TIMER_CONTROL_ONESHOT; - break; - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - default: - ctrl = 0; - } + writel_relaxed(0, twd_base + TWD_TIMER_CONTROL); + return 0; +} +static int twd_set_oneshot(struct clock_event_device *clk) +{ + /* period set, and timer enabled in 'next_event' hook */ + writel_relaxed(TWD_TIMER_CONTROL_IT_ENABLE | TWD_TIMER_CONTROL_ONESHOT, + twd_base + TWD_TIMER_CONTROL); + return 0; +} + +static int twd_set_periodic(struct clock_event_device *clk) +{ + unsigned long ctrl = TWD_TIMER_CONTROL_ENABLE | + TWD_TIMER_CONTROL_IT_ENABLE | + TWD_TIMER_CONTROL_PERIODIC; + + writel_relaxed(DIV_ROUND_CLOSEST(twd_timer_rate, HZ), + twd_base + TWD_TIMER_LOAD); writel_relaxed(ctrl, twd_base + TWD_TIMER_CONTROL); + return 0; } static int twd_set_next_event(unsigned long evt, @@ -94,7 +95,7 @@ static void twd_timer_stop(void) { struct clock_event_device *clk = raw_cpu_ptr(twd_evt); - twd_set_mode(CLOCK_EVT_MODE_UNUSED, clk); + twd_shutdown(clk); disable_percpu_irq(clk->irq); } @@ -296,7 +297,10 @@ static void twd_timer_setup(void) clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_C3STOP; clk->rating = 350; - clk->set_mode = twd_set_mode; + clk->set_state_shutdown = twd_shutdown; + clk->set_state_periodic = twd_set_periodic; + clk->set_state_oneshot = twd_set_oneshot; + clk->tick_resume = twd_shutdown; clk->set_next_event = twd_set_next_event; clk->irq = twd_ppi; clk->cpumask = cpumask_of(cpu);