From patchwork Mon Aug 10 09:52:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 52177 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id 6017A2152A for ; Mon, 10 Aug 2015 09:59:32 +0000 (UTC) Received: by lbcli1 with SMTP id li1sf3516335lbc.2 for ; Mon, 10 Aug 2015 02:59: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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=x1h2+h1EmEyea091N6K3AtWwy+I3do73E9OA+hp2nRQ=; b=BFrlwqUYwrCsaXl/6kgFk7M836wGxfvkpFaE2mkMVlCZ/WoN8HqE12nDC/om+IcGxI aricFqGia8izlmHUrA3jfRnYoxXMoUlpcDn+eGVcHZbOqeHnGAsOgi8J+nqButJ1QH8I 8a9muesB7Q/Q/yDLxZQmjXGOSgcLq9GNds7E7ktHx6vKeRBhRVqYZ2HnocRaotDMpBp/ q532XUx1hdZ+v0iF0lT7xv84ZxHZJ2pEduux7Ehgk3RsidpneHcY8PtkBqHYaJITLftg zEL2/hq2WLkGHoftXzv7bLbS94XNsbMhuVHCx/zqGAmetaNFInF0hWTHoUd9td4XhTPF 8Yaw== X-Gm-Message-State: ALoCoQlW1dXGkr0IwRQRjGrlEhxUR0UkW/4hf8EWgrIase5lUMn8EgowWZu+bf+vT+4vzCd3vsP0 X-Received: by 10.180.35.162 with SMTP id i2mr3456322wij.6.1439200771371; Mon, 10 Aug 2015 02:59:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.1 with SMTP id h1ls647871lag.36.gmail; Mon, 10 Aug 2015 02:59:31 -0700 (PDT) X-Received: by 10.112.144.69 with SMTP id sk5mr19402072lbb.6.1439200771168; Mon, 10 Aug 2015 02:59:31 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id u7si13786009lae.3.2015.08.10.02.59.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 02:59:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbbtg9 with SMTP id tg9so54217784lbb.1 for ; Mon, 10 Aug 2015 02:59:31 -0700 (PDT) X-Received: by 10.112.67.65 with SMTP id l1mr9161658lbt.86.1439200771042; Mon, 10 Aug 2015 02:59:31 -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 l6csp1829704lba; Mon, 10 Aug 2015 02:59:29 -0700 (PDT) X-Received: by 10.68.104.67 with SMTP id gc3mr42901073pbb.103.1439200769072; Mon, 10 Aug 2015 02:59:29 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kk7si32354038pab.132.2015.08.10.02.59.27; Mon, 10 Aug 2015 02:59:29 -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 S1755214AbbHJJ7Z (ORCPT + 28 others); Mon, 10 Aug 2015 05:59:25 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:38587 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933414AbbHJJy4 (ORCPT ); Mon, 10 Aug 2015 05:54:56 -0400 Received: by wicja10 with SMTP id ja10so17940301wic.1 for ; Mon, 10 Aug 2015 02:54:55 -0700 (PDT) X-Received: by 10.180.24.40 with SMTP id r8mr23984929wif.13.1439200495645; Mon, 10 Aug 2015 02:54:55 -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.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Aug 2015 02:54:55 -0700 (PDT) From: Daniel Lezcano To: mingo@kernel.org Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, Viresh Kumar , Mark Salter , Aurelien Jacquiot , linux-c6x-dev@linux-c6x.org Subject: [PATCH 61/74] c6x/timer64: Migrate to new 'set-state' interface Date: Mon, 10 Aug 2015 11:52:18 +0200 Message-Id: <1439200352-26767-61-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.179 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 c6x 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 in ->set_mode(RESUME) and so tick_resume() isn't implemented. Cc: Mark Salter Cc: Aurelien Jacquiot Cc: linux-c6x-dev@linux-c6x.org Signed-off-by: Viresh Kumar Signed-off-by: Daniel Lezcano --- arch/c6x/platforms/timer64.c | 52 +++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/arch/c6x/platforms/timer64.c b/arch/c6x/platforms/timer64.c index 3c73d74..c19901e 100644 --- a/arch/c6x/platforms/timer64.c +++ b/arch/c6x/platforms/timer64.c @@ -126,35 +126,37 @@ static int next_event(unsigned long delta, return 0; } -static void set_clock_mode(enum clock_event_mode mode, - struct clock_event_device *evt) +static int set_periodic(struct clock_event_device *evt) { - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - timer64_enable(); - timer64_mode = TIMER64_MODE_PERIODIC; - timer64_config(TIMER64_RATE / HZ); - break; - case CLOCK_EVT_MODE_ONESHOT: - timer64_enable(); - timer64_mode = TIMER64_MODE_ONE_SHOT; - break; - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - timer64_mode = TIMER64_MODE_DISABLED; - timer64_disable(); - break; - case CLOCK_EVT_MODE_RESUME: - break; - } + timer64_enable(); + timer64_mode = TIMER64_MODE_PERIODIC; + timer64_config(TIMER64_RATE / HZ); + return 0; +} + +static int set_oneshot(struct clock_event_device *evt) +{ + timer64_enable(); + timer64_mode = TIMER64_MODE_ONE_SHOT; + return 0; +} + +static int shutdown(struct clock_event_device *evt) +{ + timer64_mode = TIMER64_MODE_DISABLED; + timer64_disable(); + return 0; } static struct clock_event_device t64_clockevent_device = { - .name = "TIMER64_EVT32_TIMER", - .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, - .rating = 200, - .set_mode = set_clock_mode, - .set_next_event = next_event, + .name = "TIMER64_EVT32_TIMER", + .features = CLOCK_EVT_FEAT_ONESHOT | + CLOCK_EVT_FEAT_PERIODIC, + .rating = 200, + .set_state_shutdown = shutdown, + .set_state_periodic = set_periodic, + .set_state_oneshot = set_oneshot, + .set_next_event = next_event, }; static irqreturn_t timer_interrupt(int irq, void *dev_id)