From patchwork Thu Jun 18 10:54:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50036 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C2C9D22903 for ; Thu, 18 Jun 2015 11:04:31 +0000 (UTC) Received: by wguu7 with SMTP id u7sf4269610wgu.0 for ; Thu, 18 Jun 2015 04:04: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: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=o0B0RSXcqU2veK7eNKWktwxOR2nuPZXQHasO9wtXQNQ=; b=YYXgX4r+P6elVQ1hoFT449Ro6AXa4WnP/L9oPCkzFeUxfgjPgfT4sXDX7ZWtvGKWDH A+t7JOg8Ceaedh/9Edx7+brBAHrqIi5CyezuDy5E3F8+APyfFc6BlylswcpI+WVKJu+r igdK2/rPO7yJwrJrJxcmwafmgaQBhF4WWYJnags2F+i8wScv/Yn1vznHrAj5yT+t31Tz YCCmOQkMo1uqDY/iLDqeDBfr452ltWj7f8ICglWGW+PcYlHDgCj3gZHej7h0Neh+KhC0 gdfFeasyv7NAvyW7JHrnEscNTrJSXRHqr3IU2bWIca2HnZaqEc3T10U0Di1yq9Kl+vsp GfkA== X-Gm-Message-State: ALoCoQn5SdZvjieFXM3qbSFllEytqi1dYfvm+Rw5s9+5dvlybFoKMOckITa/3gl/YF36fAZ47P1N X-Received: by 10.112.118.162 with SMTP id kn2mr9944144lbb.22.1434625471068; Thu, 18 Jun 2015 04:04:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.72 with SMTP id h8ls444813laa.71.gmail; Thu, 18 Jun 2015 04:04:30 -0700 (PDT) X-Received: by 10.112.144.69 with SMTP id sk5mr12489468lbb.6.1434625470808; Thu, 18 Jun 2015 04:04: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 k8si6187867lbh.105.2015.06.18.04.04.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 04:04: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 lbbwc1 with SMTP id wc1so49923687lbb.2 for ; Thu, 18 Jun 2015 04:04:30 -0700 (PDT) X-Received: by 10.152.27.1 with SMTP id p1mr12322303lag.112.1434625470509; Thu, 18 Jun 2015 04:04: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.108.230 with SMTP id hn6csp1099514lbb; Thu, 18 Jun 2015 04:04:29 -0700 (PDT) X-Received: by 10.69.19.129 with SMTP id gu1mr20388701pbd.162.1434625468744; Thu, 18 Jun 2015 04:04:28 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hn3si10876626pac.142.2015.06.18.04.04.27; Thu, 18 Jun 2015 04:04:28 -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 S932489AbbFRLEW (ORCPT + 30 others); Thu, 18 Jun 2015 07:04:22 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:34315 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932361AbbFRK4I (ORCPT ); Thu, 18 Jun 2015 06:56:08 -0400 Received: by pdbki1 with SMTP id ki1so64233791pdb.1 for ; Thu, 18 Jun 2015 03:56:08 -0700 (PDT) X-Received: by 10.69.26.170 with SMTP id iz10mr19852181pbd.81.1434624968035; Thu, 18 Jun 2015 03:56:08 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id td3sm7744123pab.46.2015.06.18.03.56.06 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:56:07 -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 , Heiko Stuebner Subject: [PATCH 18/41] clocksource: rockchip: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:32 +0530 Message-Id: <94ca38bcf546de1481b2764f6286b8c370e17f74.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.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 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 --- 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 a35993bafb20..bb2c2b050964 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;