From patchwork Mon Aug 10 09:51:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 52201 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 853F12152A for ; Mon, 10 Aug 2015 10:06:43 +0000 (UTC) Received: by wicja10 with SMTP id ja10sf12322272wic.2 for ; Mon, 10 Aug 2015 03:06:42 -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=VYphV4lwe9AYDZAmIMlLDWZILaoSTqk+xn/leHFS0dg=; b=W+RO0yUdU0PbkdK2Mh67QcKv7So6AsPaMoWmswZeN/kDbxo/VMbVtJ0YayU5S2+XHO yhlYMpzweT97pDZkSygqWD2bcF4lordifywtXbXRd5ghsaXL0NZZQHWVhhDCKVIPBxHE FzBjKkrN/USMHlN6xi9hmUxdBj5wN+ADzo0Q9XaVUSdgSwkC1V6/ThkpUwIhTDpkUn1Q XB0Ui7E8UbeVA+J+co9h0aA+J+M5f+g4xMZBZwCFof9KVwLk5Xe2ohL5XGT1/6ROUE25 4bBnjqnhhtf1zBpkhZM7wkYkM5wo9EJrzC/Xd8X/tBP8el8QgIuwjFp4rEq+1pITnNVj gaGQ== X-Gm-Message-State: ALoCoQmbfXl6lkXaMc3O3AwDHcOWfTAVn4PCTC1VVAQ9EORTZresZapzIiPKsFV/LWuQ3WydwZcl X-Received: by 10.194.71.39 with SMTP id r7mr6112399wju.0.1439201202725; Mon, 10 Aug 2015 03:06:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.169 with SMTP id f9ls732438lam.93.gmail; Mon, 10 Aug 2015 03:06:42 -0700 (PDT) X-Received: by 10.112.171.68 with SMTP id as4mr19622763lbc.64.1439201202524; Mon, 10 Aug 2015 03:06:42 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id xg7si13778862lbb.48.2015.08.10.03.06.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 03:06:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lahi9 with SMTP id i9so20429157lah.2 for ; Mon, 10 Aug 2015 03:06:42 -0700 (PDT) X-Received: by 10.112.209.106 with SMTP id ml10mr19308687lbc.112.1439201202093; Mon, 10 Aug 2015 03:06:42 -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 l6csp1833780lba; Mon, 10 Aug 2015 03:06:40 -0700 (PDT) X-Received: by 10.70.0.166 with SMTP id 6mr42310059pdf.119.1439201200190; Mon, 10 Aug 2015 03:06:40 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4si32293722pdm.243.2015.08.10.03.06.38; Mon, 10 Aug 2015 03:06:40 -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 S1755503AbbHJKGh (ORCPT + 28 others); Mon, 10 Aug 2015 06:06:37 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:35064 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933236AbbHJJyP (ORCPT ); Mon, 10 Aug 2015 05:54:15 -0400 Received: by wicne3 with SMTP id ne3so15334951wic.0 for ; Mon, 10 Aug 2015 02:54:14 -0700 (PDT) X-Received: by 10.194.122.200 with SMTP id lu8mr40226599wjb.83.1439200454000; Mon, 10 Aug 2015 02:54:14 -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.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Aug 2015 02:54:13 -0700 (PDT) From: Daniel Lezcano To: mingo@kernel.org Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, Viresh Kumar , Thierry Reding , Stephen Warren , Thierry Reding , Alexandre Courbot , linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTUR...) Subject: [PATCH 33/74] clockevents/drivers/tegra20: Migrate to new 'set-state' interface Date: Mon, 10 Aug 2015 11:51:50 +0200 Message-Id: <1439200352-26767-33-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.215.54 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 tegra20 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: Thierry Reding Cc: Stephen Warren Signed-off-by: Viresh Kumar Signed-off-by: Daniel Lezcano --- drivers/clocksource/tegra20_timer.c | 45 ++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/drivers/clocksource/tegra20_timer.c b/drivers/clocksource/tegra20_timer.c index 5a112d7..6ebda11 100644 --- a/drivers/clocksource/tegra20_timer.c +++ b/drivers/clocksource/tegra20_timer.c @@ -72,33 +72,36 @@ static int tegra_timer_set_next_event(unsigned long cycles, return 0; } -static void tegra_timer_set_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static inline void timer_shutdown(struct clock_event_device *evt) { - u32 reg; - timer_writel(0, TIMER3_BASE + TIMER_PTV); +} - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - reg = 0xC0000000 | ((1000000/HZ)-1); - timer_writel(reg, TIMER3_BASE + TIMER_PTV); - break; - case CLOCK_EVT_MODE_ONESHOT: - break; - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - case CLOCK_EVT_MODE_RESUME: - break; - } +static int tegra_timer_shutdown(struct clock_event_device *evt) +{ + timer_shutdown(evt); + return 0; +} + +static int tegra_timer_set_periodic(struct clock_event_device *evt) +{ + u32 reg = 0xC0000000 | ((1000000 / HZ) - 1); + + timer_shutdown(evt); + timer_writel(reg, TIMER3_BASE + TIMER_PTV); + return 0; } static struct clock_event_device tegra_clockevent = { - .name = "timer0", - .rating = 300, - .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, - .set_next_event = tegra_timer_set_next_event, - .set_mode = tegra_timer_set_mode, + .name = "timer0", + .rating = 300, + .features = CLOCK_EVT_FEAT_ONESHOT | + CLOCK_EVT_FEAT_PERIODIC, + .set_next_event = tegra_timer_set_next_event, + .set_state_shutdown = tegra_timer_shutdown, + .set_state_periodic = tegra_timer_set_periodic, + .set_state_oneshot = tegra_timer_shutdown, + .tick_resume = tegra_timer_shutdown, }; static u64 notrace tegra_read_sched_clock(void)