From patchwork Mon Aug 10 09:51:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 52159 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 patches.linaro.org (Postfix) with ESMTPS id 72BC02152A for ; Mon, 10 Aug 2015 09:55:24 +0000 (UTC) Received: by wijp15 with SMTP id p15sf36971189wij.3 for ; Mon, 10 Aug 2015 02:55:23 -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=V6n+tZAffxpu3ADl7CaGADPYInB90NfyJ7uLcqXpP3Q=; b=XMB6g/5YZMwDSLkCIzkEtz9sJGSaGLVcRgm9FERg/uTocwKaOQcJKwiHlkKJpxyNjO JYPsXJAVxstaMIKv8HlRQjDa5OkOZSw06vPYnpcJskR/yZlKIBElwmMkuyL1B/E1Z9jJ vT9VIO0ZcXUqjlOiIa3HL1cfU+5wSiJOdIwFb14XqcJn0XWhMee6SkQsO6B64eco7dhu qKGfTny6i06CUCdDhpfOZbkAtKD0q+bnghxRAeZCdPxg1tdH7V8e9d09CfH9tvDwXgwK iinj76X94Yty7ca9DT6KhnYR33o0t8OwxF+osyNvN3Urdcnhwc7JeNAyd5ktC2+77m6s A8vw== X-Gm-Message-State: ALoCoQmuivfpit2g82pSI30lmxCCoO3kN1RYnZcVVB4/ltBT1LdjxO7TR6SONlf+3wk+Py3XiRAe X-Received: by 10.180.35.162 with SMTP id i2mr3450862wij.6.1439200523723; Mon, 10 Aug 2015 02:55:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.163 with SMTP id w3ls258390lae.21.gmail; Mon, 10 Aug 2015 02:55:23 -0700 (PDT) X-Received: by 10.112.51.133 with SMTP id k5mr18897684lbo.107.1439200523355; Mon, 10 Aug 2015 02:55:23 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id t18si13707107laz.137.2015.08.10.02.55.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 02:55:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbbpu9 with SMTP id pu9so64546226lbb.3 for ; Mon, 10 Aug 2015 02:55:23 -0700 (PDT) X-Received: by 10.112.166.2 with SMTP id zc2mr19296980lbb.29.1439200523269; Mon, 10 Aug 2015 02:55:23 -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 l6csp1828055lba; Mon, 10 Aug 2015 02:55:22 -0700 (PDT) X-Received: by 10.68.103.5 with SMTP id fs5mr43280797pbb.55.1439200512501; Mon, 10 Aug 2015 02:55:12 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sz3si32368137pac.98.2015.08.10.02.55.11; Mon, 10 Aug 2015 02:55:12 -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 S933391AbbHJJyu (ORCPT + 28 others); Mon, 10 Aug 2015 05:54:50 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:35298 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933204AbbHJJy1 (ORCPT ); Mon, 10 Aug 2015 05:54:27 -0400 Received: by wicne3 with SMTP id ne3so15340986wic.0 for ; Mon, 10 Aug 2015 02:54:26 -0700 (PDT) X-Received: by 10.180.218.227 with SMTP id pj3mr22187935wic.59.1439200465976; Mon, 10 Aug 2015 02:54:25 -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.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Aug 2015 02:54:25 -0700 (PDT) From: Daniel Lezcano To: mingo@kernel.org Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, Viresh Kumar , Santosh Shilimkar , linux-arm-kernel@lists.infradead.org (moderated list:ARM/TEXAS INSTRUM...) Subject: [PATCH 42/74] clockevents/drivers/keystone: Migrate to new 'set-state' interface Date: Mon, 10 Aug 2015 11:51:59 +0200 Message-Id: <1439200352-26767-42-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.178 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 keystone 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. Also pass the mode-mask to keystone_timer_config() instead of the mode as mode macro's aren't valid anymore. Cc: Santosh Shilimkar Signed-off-by: Viresh Kumar Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-keystone.c | 44 +++++++++++++----------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/drivers/clocksource/timer-keystone.c b/drivers/clocksource/timer-keystone.c index 0250354..edacf39 100644 --- a/drivers/clocksource/timer-keystone.c +++ b/drivers/clocksource/timer-keystone.c @@ -72,10 +72,10 @@ static inline void keystone_timer_barrier(void) /** * keystone_timer_config: configures timer to work in oneshot/periodic modes. - * @ mode: mode to configure + * @ mask: mask of the mode to configure * @ period: cycles number to configure for */ -static int keystone_timer_config(u64 period, enum clock_event_mode mode) +static int keystone_timer_config(u64 period, int mask) { u32 tcr; u32 off; @@ -84,16 +84,7 @@ static int keystone_timer_config(u64 period, enum clock_event_mode mode) off = tcr & ~(TCR_ENAMODE_MASK); /* set enable mode */ - switch (mode) { - case CLOCK_EVT_MODE_ONESHOT: - tcr |= TCR_ENAMODE_ONESHOT_MASK; - break; - case CLOCK_EVT_MODE_PERIODIC: - tcr |= TCR_ENAMODE_PERIODIC_MASK; - break; - default: - return -1; - } + tcr |= mask; /* disable timer */ keystone_timer_writel(off, TCR); @@ -138,24 +129,19 @@ static irqreturn_t keystone_timer_interrupt(int irq, void *dev_id) static int keystone_set_next_event(unsigned long cycles, struct clock_event_device *evt) { - return keystone_timer_config(cycles, evt->mode); + return keystone_timer_config(cycles, TCR_ENAMODE_ONESHOT_MASK); } -static void keystone_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int keystone_shutdown(struct clock_event_device *evt) { - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - keystone_timer_config(timer.hz_period, CLOCK_EVT_MODE_PERIODIC); - break; - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - case CLOCK_EVT_MODE_ONESHOT: - keystone_timer_disable(); - break; - default: - break; - } + keystone_timer_disable(); + return 0; +} + +static int keystone_set_periodic(struct clock_event_device *evt) +{ + keystone_timer_config(timer.hz_period, TCR_ENAMODE_PERIODIC_MASK); + return 0; } static void __init keystone_timer_init(struct device_node *np) @@ -222,7 +208,9 @@ static void __init keystone_timer_init(struct device_node *np) /* setup clockevent */ event_dev->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; event_dev->set_next_event = keystone_set_next_event; - event_dev->set_mode = keystone_set_mode; + event_dev->set_state_shutdown = keystone_shutdown; + event_dev->set_state_periodic = keystone_set_periodic; + event_dev->set_state_oneshot = keystone_shutdown; event_dev->cpumask = cpu_all_mask; event_dev->owner = THIS_MODULE; event_dev->name = TIMER_NAME;