From patchwork Thu Jun 18 10:54:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50013 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EAB44228CC for ; Thu, 18 Jun 2015 10:57:59 +0000 (UTC) Received: by wguu7 with SMTP id u7sf4222699wgu.0 for ; Thu, 18 Jun 2015 03:57:59 -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=O/d4NT3TK0iYXSc5jWkcFJ2iyqViMT2Mz5N38S+4gbY=; b=a28TYoOfFLCHDqudVbYvvrpEll3j/oUulHBO/MDHxuF88Ck8ubAwD1uB7PPTsxd+FH YyfabLiaVIeLklIti27Mn6r1/b0du07r0X5/tN+L6JJOs44GeAG1FMefIEAFETbkZauO 0bQ0tYDOxMtQwtuIOg8Sys+4fAc4j2wNb16YrsKrNF6xuJC/vxMQYdnMxnkGuAVTKREC QCAznXs9oVzeHlyZFXYn7oXNzqO57FneqhdKnXn9UGHpBKlIssZGr+v4ZOfSKqBgDIWn fhufgIe+5FK09ZsFwZkCEIdHL94icVO6br4hS97wq9w1/Qm0uKuDijYQ+5aZjGFAKl7n XYQQ== X-Gm-Message-State: ALoCoQnaOjl05XNRzWGDRpMzU0vDbpmHhbblYjPMAnelLZax5FnoIbf7z5slRWKR+Ta7tW2TPQQX X-Received: by 10.180.35.164 with SMTP id i4mr409745wij.0.1434625079275; Thu, 18 Jun 2015 03:57:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.121.98 with SMTP id lj2ls423343lab.94.gmail; Thu, 18 Jun 2015 03:57:59 -0700 (PDT) X-Received: by 10.152.181.34 with SMTP id dt2mr12414638lac.84.1434625079087; Thu, 18 Jun 2015 03:57:59 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id y2si6167230lad.132.2015.06.18.03.57.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 03:57:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by laka10 with SMTP id a10so51856692lak.0 for ; Thu, 18 Jun 2015 03:57:59 -0700 (PDT) X-Received: by 10.152.88.68 with SMTP id be4mr12300411lab.76.1434625078980; Thu, 18 Jun 2015 03:57:58 -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 hn6csp1095602lbb; Thu, 18 Jun 2015 03:57:57 -0700 (PDT) X-Received: by 10.68.245.42 with SMTP id xl10mr8752891pbc.153.1434625077153; Thu, 18 Jun 2015 03:57:57 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p8si10867358pdi.112.2015.06.18.03.57.55; Thu, 18 Jun 2015 03:57:57 -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 S1755112AbbFRK5t (ORCPT + 30 others); Thu, 18 Jun 2015 06:57:49 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:32820 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754788AbbFRK5K (ORCPT ); Thu, 18 Jun 2015 06:57:10 -0400 Received: by pdjn11 with SMTP id n11so64331452pdj.0 for ; Thu, 18 Jun 2015 03:57:09 -0700 (PDT) X-Received: by 10.70.94.167 with SMTP id dd7mr20426371pdb.115.1434625029664; Thu, 18 Jun 2015 03:57:09 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id cd10sm7723468pac.7.2015.06.18.03.57.08 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:57:09 -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 , Barry Song Subject: [PATCH 35/41] clocksource: prima2: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:49 +0530 Message-Id: <8ea20020657505b77a32139445c169707aad4e86.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.49 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 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 --- 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 ce18d570e1cd..78de982cc640 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, };