From patchwork Mon Aug 10 09:52:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 52158 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 0C86B2152A for ; Mon, 10 Aug 2015 09:55:22 +0000 (UTC) Received: by labth1 with SMTP id th1sf59646652lab.2 for ; Mon, 10 Aug 2015 02:55:21 -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=n1KvgZ20iVU6lVlic6Y3joDNs0GALeHl9MODraS4RrQ=; b=S4auuOG2ENfXNo3E81B0evTK93lyDp/IIi8/F6bOe9vlC8DOjyvpkm8Y77Bfe3iSo9 vJuAilmx1P5yHn3/Jzn2eQy64B5s9S2WstlDCyZjF8Ey3dCn5TlLtLvMNR2hrX5Jb043 a37GuC+74NCg9dV9YnijO426dngpELd92S7T3nlYfj3e3vGQf2HV8ttWQdB1W0OdN3qA 8dYernsYaveE3mAwYkyppRsKTY6yOI4bcUR4ArQgppztfSYStnbVRGK3kBEyjoJTpQMf QPdeYNK/G0B2EMcfj4lFRMPzaLaE8gZ/IecTs4U9/IgRJlvCqRPymFO7WtVYc3fM8Ayk zW/Q== X-Gm-Message-State: ALoCoQlRCsPo/i5igXve6pdRwFp74fktu9Cy+5Aedd4bUEtrsjRTuGsBOkbqP4yV519uK4PxaNOP X-Received: by 10.112.139.65 with SMTP id qw1mr6062488lbb.24.1439200520967; Mon, 10 Aug 2015 02:55:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.3 with SMTP id r3ls793902lae.89.gmail; Mon, 10 Aug 2015 02:55:20 -0700 (PDT) X-Received: by 10.112.160.73 with SMTP id xi9mr19082132lbb.92.1439200520649; Mon, 10 Aug 2015 02:55:20 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id p6si13754971laj.67.2015.08.10.02.55.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 02:55:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbpu9 with SMTP id pu9so64545599lbb.3 for ; Mon, 10 Aug 2015 02:55:20 -0700 (PDT) X-Received: by 10.112.160.42 with SMTP id xh10mr19424963lbb.88.1439200520534; Mon, 10 Aug 2015 02:55:20 -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 l6csp1828033lba; Mon, 10 Aug 2015 02:55:19 -0700 (PDT) X-Received: by 10.70.30.161 with SMTP id t1mr43250847pdh.138.1439200511445; Mon, 10 Aug 2015 02:55:11 -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.10; Mon, 10 Aug 2015 02:55:11 -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 S933373AbbHJJyo (ORCPT + 28 others); Mon, 10 Aug 2015 05:54:44 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:36853 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933315AbbHJJy2 (ORCPT ); Mon, 10 Aug 2015 05:54:28 -0400 Received: by wicja10 with SMTP id ja10so30322898wic.1 for ; Mon, 10 Aug 2015 02:54:27 -0700 (PDT) X-Received: by 10.194.103.7 with SMTP id fs7mr42128233wjb.75.1439200467354; Mon, 10 Aug 2015 02:54:27 -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.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Aug 2015 02:54:26 -0700 (PDT) From: Daniel Lezcano To: mingo@kernel.org Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, Viresh Kumar , Barry Song , linux-arm-kernel@lists.infradead.org (moderated list:ARM/CSR SIRFPRIMA...) Subject: [PATCH 43/74] clockevents/drivers/prima2: Migrate to new 'set-state' interface Date: Mon, 10 Aug 2015 11:52:00 +0200 Message-Id: <1439200352-26767-43-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.169 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 prima2 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: Barry Song Signed-off-by: Viresh Kumar Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-prima2.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/drivers/clocksource/timer-prima2.c b/drivers/clocksource/timer-prima2.c index ce18d57..78de982 100644 --- a/drivers/clocksource/timer-prima2.c +++ b/drivers/clocksource/timer-prima2.c @@ -104,26 +104,21 @@ static int sirfsoc_timer_set_next_event(unsigned long delta, return next - now > delta ? -ETIME : 0; } -static void sirfsoc_timer_set_mode(enum clock_event_mode mode, - struct clock_event_device *ce) +static int sirfsoc_timer_shutdown(struct clock_event_device *evt) { u32 val = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN); - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - WARN_ON(1); - break; - case CLOCK_EVT_MODE_ONESHOT: - writel_relaxed(val | BIT(0), - sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN); - break; - case CLOCK_EVT_MODE_SHUTDOWN: - writel_relaxed(val & ~BIT(0), - sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN); - break; - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_RESUME: - break; - } + + writel_relaxed(val & ~BIT(0), + sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN); + return 0; +} + +static int sirfsoc_timer_set_oneshot(struct clock_event_device *evt) +{ + u32 val = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN); + + writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN); + return 0; } static void sirfsoc_clocksource_suspend(struct clocksource *cs) @@ -157,7 +152,8 @@ static struct clock_event_device sirfsoc_clockevent = { .name = "sirfsoc_clockevent", .rating = 200, .features = CLOCK_EVT_FEAT_ONESHOT, - .set_mode = sirfsoc_timer_set_mode, + .set_state_shutdown = sirfsoc_timer_shutdown, + .set_state_oneshot = sirfsoc_timer_set_oneshot, .set_next_event = sirfsoc_timer_set_next_event, };