From patchwork Mon Aug 10 09:51:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 52206 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id C4FA52152A for ; Mon, 10 Aug 2015 10:09:28 +0000 (UTC) Received: by wijp15 with SMTP id p15sf37102972wij.3 for ; Mon, 10 Aug 2015 03:09:28 -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=5zoS/MOvkgN2zixq6v6244AQWOcROhkW63PX6g63X3g=; b=an04qUHo9irMPLTllJqo8cNg4V6irjSh0KZzD6CdIpgoypQ2FVo+XbDyRUD3pvaD8s 46CwolQmKeMsXy3hKKwW1hod2vijlXe4f0Ioa+E23voy/QsFs9ZxA2eit0TjJQ2YWhUS TdCVtc3fhrhszWRoFp+H9WMqS1RTMveF71GOzLvnXSFEfKb6LaH/uCKeNqgXXNWU5bYW PqwTxEoZapAV2Zu3mjB0iGkG+YGCTEHDNsXDtXfk6Ls8KkJULvWcTpVpOCccaeADdQMn QzAdd5J6xTXFRFntjWEaZHWDii0DHdf2GHFv9emFd0yyJQKStNvRDnTUvlU+AtFk2va6 ImyQ== X-Gm-Message-State: ALoCoQnCg6YS9KiXr7Ou0j8Qr2f3HolKP9oYoGdvWKoewbWwf8qSbXylgp4POPwCOWvauK2j0EXY X-Received: by 10.112.160.39 with SMTP id xh7mr6088805lbb.22.1439201368013; Mon, 10 Aug 2015 03:09:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.101 with SMTP id 5ls69599lal.59.gmail; Mon, 10 Aug 2015 03:09:27 -0700 (PDT) X-Received: by 10.152.27.41 with SMTP id q9mr518706lag.104.1439201367695; Mon, 10 Aug 2015 03:09:27 -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 b9si13744919lah.122.2015.08.10.03.09.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 03:09:27 -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 lagz9 with SMTP id z9so50820246lag.3 for ; Mon, 10 Aug 2015 03:09:27 -0700 (PDT) X-Received: by 10.112.160.42 with SMTP id xh10mr19466357lbb.88.1439201367562; Mon, 10 Aug 2015 03:09:27 -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 l6csp1835276lba; Mon, 10 Aug 2015 03:09:26 -0700 (PDT) X-Received: by 10.66.196.233 with SMTP id ip9mr20763057pac.79.1439201365579; Mon, 10 Aug 2015 03:09:25 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r11si32470953pdj.1.2015.08.10.03.09.24; Mon, 10 Aug 2015 03:09:25 -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 S933494AbbHJKJW (ORCPT + 28 others); Mon, 10 Aug 2015 06:09:22 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:33898 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933020AbbHJJx5 (ORCPT ); Mon, 10 Aug 2015 05:53:57 -0400 Received: by wicne3 with SMTP id ne3so128853422wic.1 for ; Mon, 10 Aug 2015 02:53:56 -0700 (PDT) X-Received: by 10.180.100.74 with SMTP id ew10mr23622782wib.12.1439200436185; Mon, 10 Aug 2015 02:53:56 -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.53.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Aug 2015 02:53:55 -0700 (PDT) From: Daniel Lezcano To: mingo@kernel.org Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, Viresh Kumar , Jonas Jensen Subject: [PATCH 21/74] clockevents/drivers/moxart: Migrate to new 'set-state' interface Date: Mon, 10 Aug 2015 11:51:38 +0200 Message-Id: <1439200352-26767-21-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 moxart 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: Jonas Jensen Signed-off-by: Viresh Kumar Signed-off-by: Daniel Lezcano --- drivers/clocksource/moxart_timer.c | 49 ++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/clocksource/moxart_timer.c b/drivers/clocksource/moxart_timer.c index 5eb2c35..19857af 100644 --- a/drivers/clocksource/moxart_timer.c +++ b/drivers/clocksource/moxart_timer.c @@ -58,25 +58,24 @@ static void __iomem *base; static unsigned int clock_count_per_tick; -static void moxart_clkevt_mode(enum clock_event_mode mode, - struct clock_event_device *clk) +static int moxart_shutdown(struct clock_event_device *evt) { - switch (mode) { - case CLOCK_EVT_MODE_RESUME: - case CLOCK_EVT_MODE_ONESHOT: - writel(TIMER1_DISABLE, base + TIMER_CR); - writel(~0, base + TIMER1_BASE + REG_LOAD); - break; - case CLOCK_EVT_MODE_PERIODIC: - writel(clock_count_per_tick, base + TIMER1_BASE + REG_LOAD); - writel(TIMER1_ENABLE, base + TIMER_CR); - break; - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - default: - writel(TIMER1_DISABLE, base + TIMER_CR); - break; - } + writel(TIMER1_DISABLE, base + TIMER_CR); + return 0; +} + +static int moxart_set_oneshot(struct clock_event_device *evt) +{ + writel(TIMER1_DISABLE, base + TIMER_CR); + writel(~0, base + TIMER1_BASE + REG_LOAD); + return 0; +} + +static int moxart_set_periodic(struct clock_event_device *evt) +{ + writel(clock_count_per_tick, base + TIMER1_BASE + REG_LOAD); + writel(TIMER1_ENABLE, base + TIMER_CR); + return 0; } static int moxart_clkevt_next_event(unsigned long cycles, @@ -95,11 +94,15 @@ static int moxart_clkevt_next_event(unsigned long cycles, } static struct clock_event_device moxart_clockevent = { - .name = "moxart_timer", - .rating = 200, - .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .set_mode = moxart_clkevt_mode, - .set_next_event = moxart_clkevt_next_event, + .name = "moxart_timer", + .rating = 200, + .features = CLOCK_EVT_FEAT_PERIODIC | + CLOCK_EVT_FEAT_ONESHOT, + .set_state_shutdown = moxart_shutdown, + .set_state_periodic = moxart_set_periodic, + .set_state_oneshot = moxart_set_oneshot, + .tick_resume = moxart_set_oneshot, + .set_next_event = moxart_clkevt_next_event, }; static irqreturn_t moxart_timer_interrupt(int irq, void *dev_id)