From patchwork Thu Jun 18 10:54:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50039 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3780622903 for ; Thu, 18 Jun 2015 11:06:28 +0000 (UTC) Received: by wimx15 with SMTP id x15sf2842578wim.1 for ; Thu, 18 Jun 2015 04:06:27 -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=wvrCDzQgIKFRguTBDTKjZilgf3MVA61LabqWaQdvp48=; b=EDofKuRH9yuPR65CZMdIApQFRJX0zrye73X7iFrfsvHvyvfGwJ9odHDbssh4I8waYl V+Xyat842Zw+MDXXz7WjGVYtGSOtd97NnfY6BWXL79UgT2hGPS2uRnoDOe2lF9sdDdEF a43fkKm10NOFxQrbyDVhIHZ1a61HqxZPC46Ubd+bLb9g3zxrzyNHkoN3p2J6bL2nwxE9 oUQjT0kf/UATqwbOJwR24b4CFRWc6g3PAjGXS4TUQzDkcO8PNUXcJ+WETod1ANw08AVT nZ92xL/FJPTK7ZwrBz8dex2AZSeBVTG81ApjPqsXn3QtvKHw6th3Pz+QberGGenCuk5v zhiQ== X-Gm-Message-State: ALoCoQmySGskLZZB5nZWq0XAvQMJAwDiQ5USdCyT2x50Jdyy/ORUo0P4Pmj7pOF64LHS0R8c7zk7 X-Received: by 10.152.26.134 with SMTP id l6mr9854239lag.10.1434625587239; Thu, 18 Jun 2015 04:06:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.168 with SMTP id w8ls448337lae.41.gmail; Thu, 18 Jun 2015 04:06:26 -0700 (PDT) X-Received: by 10.112.171.101 with SMTP id at5mr12654036lbc.66.1434625586933; Thu, 18 Jun 2015 04:06:26 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id n10si6191025lah.93.2015.06.18.04.06.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 04:06:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by laka10 with SMTP id a10so51993800lak.0 for ; Thu, 18 Jun 2015 04:06:26 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr12809402lbc.32.1434625586779; Thu, 18 Jun 2015 04:06:26 -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 hn6csp1100772lbb; Thu, 18 Jun 2015 04:06:25 -0700 (PDT) X-Received: by 10.70.96.139 with SMTP id ds11mr20127222pdb.98.1434625584893; Thu, 18 Jun 2015 04:06:24 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si10858086pdf.241.2015.06.18.04.06.24; Thu, 18 Jun 2015 04:06:24 -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 S1754834AbbFRLGU (ORCPT + 30 others); Thu, 18 Jun 2015 07:06:20 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:34569 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932201AbbFRKzr (ORCPT ); Thu, 18 Jun 2015 06:55:47 -0400 Received: by pabvl15 with SMTP id vl15so12911877pab.1 for ; Thu, 18 Jun 2015 03:55:47 -0700 (PDT) X-Received: by 10.68.135.233 with SMTP id pv9mr20402985pbb.115.1434624946963; Thu, 18 Jun 2015 03:55:46 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id bt16sm7659330pdb.91.2015.06.18.03.55.45 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:55:46 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Viresh Kumar , Jonas Jensen Subject: [PATCH 12/41] clocksource: moxart: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:26 +0530 Message-Id: <8a06c6c0fd6fbb4150ef9313af74d7ed81451910.1434622147.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.45 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 moxart 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: Jonas Jensen Signed-off-by: Viresh Kumar --- drivers/clocksource/moxart_timer.c | 49 ++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/clocksource/moxart_timer.c b/drivers/clocksource/moxart_timer.c index 5eb2c35932b1..19857af651c1 100644 --- a/drivers/clocksource/moxart_timer.c +++ b/drivers/clocksource/moxart_timer.c @@ -58,25 +58,24 @@ static void __iomem *base; static unsigned int clock_count_per_tick; -static void moxart_clkevt_mode(enum clock_event_mode mode, - struct clock_event_device *clk) +static int moxart_shutdown(struct clock_event_device *evt) { - switch (mode) { - case CLOCK_EVT_MODE_RESUME: - case CLOCK_EVT_MODE_ONESHOT: - writel(TIMER1_DISABLE, base + TIMER_CR); - writel(~0, base + TIMER1_BASE + REG_LOAD); - break; - case CLOCK_EVT_MODE_PERIODIC: - writel(clock_count_per_tick, base + TIMER1_BASE + REG_LOAD); - writel(TIMER1_ENABLE, base + TIMER_CR); - break; - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - default: - writel(TIMER1_DISABLE, base + TIMER_CR); - break; - } + writel(TIMER1_DISABLE, base + TIMER_CR); + return 0; +} + +static int moxart_set_oneshot(struct clock_event_device *evt) +{ + writel(TIMER1_DISABLE, base + TIMER_CR); + writel(~0, base + TIMER1_BASE + REG_LOAD); + return 0; +} + +static int moxart_set_periodic(struct clock_event_device *evt) +{ + writel(clock_count_per_tick, base + TIMER1_BASE + REG_LOAD); + writel(TIMER1_ENABLE, base + TIMER_CR); + return 0; } static int moxart_clkevt_next_event(unsigned long cycles, @@ -95,11 +94,15 @@ static int moxart_clkevt_next_event(unsigned long cycles, } static struct clock_event_device moxart_clockevent = { - .name = "moxart_timer", - .rating = 200, - .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .set_mode = moxart_clkevt_mode, - .set_next_event = moxart_clkevt_next_event, + .name = "moxart_timer", + .rating = 200, + .features = CLOCK_EVT_FEAT_PERIODIC | + CLOCK_EVT_FEAT_ONESHOT, + .set_state_shutdown = moxart_shutdown, + .set_state_periodic = moxart_set_periodic, + .set_state_oneshot = moxart_set_oneshot, + .tick_resume = moxart_set_oneshot, + .set_next_event = moxart_clkevt_next_event, }; static irqreturn_t moxart_timer_interrupt(int irq, void *dev_id)