From patchwork Mon Aug 10 09:51:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 52152 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id EABA22152A for ; Mon, 10 Aug 2015 09:54:31 +0000 (UTC) Received: by lbck9 with SMTP id k9sf8346314lbc.0 for ; Mon, 10 Aug 2015 02:54:31 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=3sfgkA0wOgRhD2/wwcWN8YHQsXA/6gbcb0ItfcRqU70=; b=KChvNlOfuSdSsNLqdMajkyqXH3AXDeTVSxy5Hgd7wZfV2YvPge9IFwCuJCMahVnQUV qR+InsA9I/ReYAFDcbXu+Ev/xP6HpHb5rWd2zzQtCF46f2xqCFiFE9oJWQomjITti9Jh wETvLgUtP8SkAW38KrnV1FqSMwzObWxImUG4AuV3S59rkmFXmtQWMGl6ukhkRJ+Rh6ir sQ97GHx1rjs1TazZuNn/9TTBhw7NmOVp15FAWNRz7xYb+55aeOXNvVBcyS6ulb7m1CEM kZ5xQ8Dg2XtTHdC4sMYooilFuTpZLxNgH+u57NpXPRdLxZCMatNnFxfuSVTUhvqCjtW7 +7SQ== X-Gm-Message-State: ALoCoQkFkBrYFtXFiBmtP1hhReyns6Tlcy4Cbx4AuJCHi5v6PpNj1ri2lOy3/bdzMbmotH9b0B9A X-Received: by 10.180.12.205 with SMTP id a13mr3437624wic.4.1439200470951; Mon, 10 Aug 2015 02:54:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.163 with SMTP id w3ls258302lae.21.gmail; Mon, 10 Aug 2015 02:54:30 -0700 (PDT) X-Received: by 10.152.238.2 with SMTP id vg2mr19815233lac.12.1439200470758; Mon, 10 Aug 2015 02:54:30 -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 sc4si13741852lbb.99.2015.08.10.02.54.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 02:54:30 -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 lbbsx3 with SMTP id sx3so8309337lbb.0 for ; Mon, 10 Aug 2015 02:54:30 -0700 (PDT) X-Received: by 10.152.36.161 with SMTP id r1mr19407184laj.88.1439200470657; Mon, 10 Aug 2015 02:54:30 -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.7.198 with SMTP id l6csp1827652lba; Mon, 10 Aug 2015 02:54:29 -0700 (PDT) X-Received: by 10.68.232.234 with SMTP id tr10mr43410909pbc.134.1439200461222; Mon, 10 Aug 2015 02:54:21 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yq3si32145746pbb.250.2015.08.10.02.54.20; Mon, 10 Aug 2015 02:54:21 -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 S933243AbbHJJyO (ORCPT + 28 others); Mon, 10 Aug 2015 05:54:14 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:38518 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933146AbbHJJyG (ORCPT ); Mon, 10 Aug 2015 05:54:06 -0400 Received: by wicja10 with SMTP id ja10so17912229wic.1 for ; Mon, 10 Aug 2015 02:54:05 -0700 (PDT) X-Received: by 10.180.24.40 with SMTP id r8mr23978841wif.13.1439200445737; Mon, 10 Aug 2015 02:54:05 -0700 (PDT) Received: from localhost.localdomain (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by smtp.gmail.com with ESMTPSA id jr5sm28598154wjc.14.2015.08.10.02.54.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Aug 2015 02:54:05 -0700 (PDT) From: Daniel Lezcano To: mingo@kernel.org Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, Viresh Kumar , Heiko Stuebner , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Rockchip SoC...), linux-rockchip@lists.infradead.org (open list:ARM/Rockchip SoC...) Subject: [PATCH 27/74] clockevents/drivers/rockchip: Migrate to new 'set-state' interface Date: Mon, 10 Aug 2015 11:51:44 +0200 Message-Id: <1439200352-26767-27-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439200352-26767-1-git-send-email-daniel.lezcano@linaro.org> References: <55C87382.4070309@linaro.org> <1439200352-26767-1-git-send-email-daniel.lezcano@linaro.org> 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: daniel.lezcano@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: , From: Viresh Kumar Migrate rockchip 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. We weren't doing anything for oneshot or resume modes, and so the callbacks aren't provided. Cc: Heiko Stuebner Signed-off-by: Viresh Kumar Signed-off-by: Daniel Lezcano --- drivers/clocksource/rockchip_timer.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c index a35993b..bb2c2b0 100644 --- a/drivers/clocksource/rockchip_timer.c +++ b/drivers/clocksource/rockchip_timer.c @@ -82,23 +82,18 @@ static inline int rk_timer_set_next_event(unsigned long cycles, return 0; } -static inline void rk_timer_set_mode(enum clock_event_mode mode, - struct clock_event_device *ce) +static int rk_timer_shutdown(struct clock_event_device *ce) { - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - rk_timer_disable(ce); - rk_timer_update_counter(rk_timer(ce)->freq / HZ - 1, ce); - rk_timer_enable(ce, TIMER_MODE_FREE_RUNNING); - break; - case CLOCK_EVT_MODE_ONESHOT: - case CLOCK_EVT_MODE_RESUME: - break; - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - rk_timer_disable(ce); - break; - } + rk_timer_disable(ce); + return 0; +} + +static int rk_timer_set_periodic(struct clock_event_device *ce) +{ + rk_timer_disable(ce); + rk_timer_update_counter(rk_timer(ce)->freq / HZ - 1, ce); + rk_timer_enable(ce, TIMER_MODE_FREE_RUNNING); + return 0; } static irqreturn_t rk_timer_interrupt(int irq, void *dev_id) @@ -107,7 +102,7 @@ static irqreturn_t rk_timer_interrupt(int irq, void *dev_id) rk_timer_interrupt_clear(ce); - if (ce->mode == CLOCK_EVT_MODE_ONESHOT) + if (clockevent_state_oneshot(ce)) rk_timer_disable(ce); ce->event_handler(ce); @@ -161,7 +156,8 @@ static void __init rk_timer_init(struct device_node *np) ce->name = TIMER_NAME; ce->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; ce->set_next_event = rk_timer_set_next_event; - ce->set_mode = rk_timer_set_mode; + ce->set_state_shutdown = rk_timer_shutdown; + ce->set_state_periodic = rk_timer_set_periodic; ce->irq = irq; ce->cpumask = cpumask_of(0); ce->rating = 250;