From patchwork Thu Jun 18 10:54:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 6635601 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 000B89F358 for ; Thu, 18 Jun 2015 11:05:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 11ABC206DF for ; Thu, 18 Jun 2015 11:05:15 +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 24D2720670 for ; Thu, 18 Jun 2015 11:05:14 +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 1Z5XZt-0006Lh-Gp; Thu, 18 Jun 2015 11:01:49 +0000 Received: from mail-pd0-f177.google.com ([209.85.192.177]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5XVJ-0001Ik-A6 for linux-arm-kernel@lists.infradead.org; Thu, 18 Jun 2015 10:57:06 +0000 Received: by pdjm12 with SMTP id m12so64152942pdj.3 for ; Thu, 18 Jun 2015 03:56:43 -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=exs9RpKmxQKtYV798Hx4BdfJPfAqPmSNG3yoCDhd9cc=; b=TOiyZoy4ezRaMkSJbctyg3PG4veDpE51FjpuCJpA8lGgIJOBBH+FiIK9aGhyRHHELs Zi5eO2AfIxkMxnnqcTdtLXaywHOpItvSb6kuw/Ga6dtlTSFjUh45XxSN/yOqAa5NmyzB ezuWkLyk79LUAIRDyMrMmCY/V76YQP3oG6/QoWz5TwpgZq5Sal6N7XGwdPk+AyMkD9HT Ktr02KZUH7WSC/IQ/qAnfHGc33yOxXDv6SUa3gOMokl/3hEBpwQyXvyWMIdLCoKWyh6b Vch6IPAPBD8FRcj1BgmmUk0/VibMVEhZMj47rHbB2FnPY+HTo8I/x5f6khlcWRjD1NU3 W7mg== X-Gm-Message-State: ALoCoQmX/BLOoWdzVrKSBMuEx39EHtxhO91K7A69xjoPBikf/HdlT4/gYv0gBP1qKKDqX9JW8uk6 X-Received: by 10.66.119.70 with SMTP id ks6mr20173780pab.78.1434625003493; Thu, 18 Jun 2015 03:56:43 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id m3sm4969666pdd.29.2015.06.18.03.56.42 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:56:43 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Subject: [PATCH 28/41] clocksource: orion: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:42 +0530 Message-Id: <7797e21f79565a7c078df1c789a2f10cefb37f78.1434622147.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-20150618_035705_440236_349C4BF4 X-CRM114-Status: GOOD ( 13.05 ) X-Spam-Score: -0.7 (/) Cc: Andrew Lunn , linaro-kernel@lists.linaro.org, Jason Cooper , Viresh Kumar , linux-kernel@vger.kernel.org, Gregory Clement , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 orion 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: Jason Cooper Cc: Andrew Lunn Cc: Sebastian Hesselbarth Cc: Gregory Clement Signed-off-by: Viresh Kumar --- drivers/clocksource/time-orion.c | 46 +++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/drivers/clocksource/time-orion.c b/drivers/clocksource/time-orion.c index 0b3ce0399c51..0ece7427b497 100644 --- a/drivers/clocksource/time-orion.c +++ b/drivers/clocksource/time-orion.c @@ -60,30 +60,36 @@ static int orion_clkevt_next_event(unsigned long delta, return 0; } -static void orion_clkevt_mode(enum clock_event_mode mode, - struct clock_event_device *dev) +static int orion_clkevt_shutdown(struct clock_event_device *dev) { - if (mode == CLOCK_EVT_MODE_PERIODIC) { - /* setup and enable periodic timer at 1/HZ intervals */ - writel(ticks_per_jiffy - 1, timer_base + TIMER1_RELOAD); - writel(ticks_per_jiffy - 1, timer_base + TIMER1_VAL); - atomic_io_modify(timer_base + TIMER_CTRL, - TIMER1_RELOAD_EN | TIMER1_EN, - TIMER1_RELOAD_EN | TIMER1_EN); - } else { - /* disable timer */ - atomic_io_modify(timer_base + TIMER_CTRL, - TIMER1_RELOAD_EN | TIMER1_EN, 0); - } + /* disable timer */ + atomic_io_modify(timer_base + TIMER_CTRL, + TIMER1_RELOAD_EN | TIMER1_EN, 0); + return 0; +} + +static int orion_clkevt_set_periodic(struct clock_event_device *dev) +{ + /* setup and enable periodic timer at 1/HZ intervals */ + writel(ticks_per_jiffy - 1, timer_base + TIMER1_RELOAD); + writel(ticks_per_jiffy - 1, timer_base + TIMER1_VAL); + atomic_io_modify(timer_base + TIMER_CTRL, + TIMER1_RELOAD_EN | TIMER1_EN, + TIMER1_RELOAD_EN | TIMER1_EN); + return 0; } static struct clock_event_device orion_clkevt = { - .name = "orion_event", - .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, - .shift = 32, - .rating = 300, - .set_next_event = orion_clkevt_next_event, - .set_mode = orion_clkevt_mode, + .name = "orion_event", + .features = CLOCK_EVT_FEAT_ONESHOT | + CLOCK_EVT_FEAT_PERIODIC, + .shift = 32, + .rating = 300, + .set_next_event = orion_clkevt_next_event, + .set_state_shutdown = orion_clkevt_shutdown, + .set_state_periodic = orion_clkevt_set_periodic, + .set_state_oneshot = orion_clkevt_shutdown, + .tick_resume = orion_clkevt_shutdown, }; static irqreturn_t orion_clkevt_irq_handler(int irq, void *dev_id)