From patchwork Thu Jun 18 10:54:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50020 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 ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C4BA8228CC for ; Thu, 18 Jun 2015 10:58:46 +0000 (UTC) Received: by lbbqq2 with SMTP id qq2sf19615528lbb.0 for ; Thu, 18 Jun 2015 03:58:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:in-reply-to:references:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list; bh=16JhFredUpVcxM/Uajq249d4o5MUAPWCLomRk4416jY=; b=ILH8u7hxwmENyXBOdio8MnbX+un56v8//G2fGKdm7ieVmF7e0+IKZOGu5iNM4K2Mge JDjqGX/YXwZQyXaUrLe8gFtZwKaG9MwORhAQKy+DSeKogu+x3L+6i+sKEng0ct0MqmRY lijiJ0FEWLNkqsxY8pXeovb4ZlqgG8HrK1HOJTiwU5xRRd9vILC24Otu/YeruG5VB71V t/Tw7esHNOKPnFNp4mbzd2wBL4EzH2JvA/72RZ7zmAfEhX4YkJiUKz98E20WqueeqC6R 3WQcT28WT2vNbWi/CUzQzaZSqYIvkJqh9IukLGn2zHT3XvwHKEVCfFUS7M8JaSubOIVZ HyUA== X-Gm-Message-State: ALoCoQn+aOCxDiiNk82kS7EyzJrTK5WYtN1Bhwrl0Je7ivcs6hS/vo2FtXDytoBYirYtJVe1rje3 X-Received: by 10.194.236.230 with SMTP id ux6mr7244479wjc.5.1434625125722; Thu, 18 Jun 2015 03:58:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.169 with SMTP id r9ls424462laj.86.gmail; Thu, 18 Jun 2015 03:58:45 -0700 (PDT) X-Received: by 10.152.3.130 with SMTP id c2mr12489185lac.81.1434625125557; Thu, 18 Jun 2015 03:58:45 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id vk4si6170024lbb.147.2015.06.18.03.58.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 03:58:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lacny3 with SMTP id ny3so51795179lac.3 for ; Thu, 18 Jun 2015 03:58:45 -0700 (PDT) X-Received: by 10.152.7.7 with SMTP id f7mr12562391laa.106.1434625125453; Thu, 18 Jun 2015 03:58:45 -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 hn6csp1095964lbb; Thu, 18 Jun 2015 03:58:44 -0700 (PDT) X-Received: by 10.66.197.231 with SMTP id ix7mr20420766pac.9.1434625124233; Thu, 18 Jun 2015 03:58:44 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ls17si9101078pab.136.2015.06.18.03.58.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 03:58:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5XVJ-0001Rk-EK; Thu, 18 Jun 2015 10:57:05 +0000 Received: from mail-pd0-f171.google.com ([209.85.192.171]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5XUR-0000xz-Mo for linux-arm-kernel@lists.infradead.org; Thu, 18 Jun 2015 10:56:12 +0000 Received: by pdbci14 with SMTP id ci14so5709213pdb.2 for ; Thu, 18 Jun 2015 03:55:50 -0700 (PDT) X-Received: by 10.70.88.98 with SMTP id bf2mr20233824pdb.46.1434624950206; Thu, 18 Jun 2015 03:55:50 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id m2sm7703696pdp.4.2015.06.18.03.55.49 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:55:49 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Subject: [PATCH 13/41] clocksource: mtk: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:27 +0530 Message-Id: X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150618_035611_811904_3BBEDF29 X-CRM114-Status: GOOD ( 11.30 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.192.171 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.192.171 listed in wl.mailspike.net] Cc: Matthias Brugger , Viresh Kumar , linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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.50 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 Migrate mtk 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: Matthias Brugger Signed-off-by: Viresh Kumar --- drivers/clocksource/mtk_timer.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c index 68ab42356d0e..50f0641c65b6 100644 --- a/drivers/clocksource/mtk_timer.c +++ b/drivers/clocksource/mtk_timer.c @@ -102,27 +102,20 @@ static void mtk_clkevt_time_start(struct mtk_clock_event_device *evt, evt->gpt_base + TIMER_CTRL_REG(timer)); } -static void mtk_clkevt_mode(enum clock_event_mode mode, - struct clock_event_device *clk) +static int mtk_clkevt_shutdown(struct clock_event_device *clk) +{ + mtk_clkevt_time_stop(to_mtk_clk(clk), GPT_CLK_EVT); + return 0; +} + +static int mtk_clkevt_set_periodic(struct clock_event_device *clk) { struct mtk_clock_event_device *evt = to_mtk_clk(clk); mtk_clkevt_time_stop(evt, GPT_CLK_EVT); - - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - mtk_clkevt_time_setup(evt, evt->ticks_per_jiffy, GPT_CLK_EVT); - mtk_clkevt_time_start(evt, true, GPT_CLK_EVT); - break; - case CLOCK_EVT_MODE_ONESHOT: - /* Timer is enabled in set_next_event */ - break; - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - default: - /* No more interrupts will occur as source is disabled */ - break; - } + mtk_clkevt_time_setup(evt, evt->ticks_per_jiffy, GPT_CLK_EVT); + mtk_clkevt_time_start(evt, true, GPT_CLK_EVT); + return 0; } static int mtk_clkevt_next_event(unsigned long event, @@ -196,7 +189,10 @@ static void __init mtk_timer_init(struct device_node *node) evt->dev.name = "mtk_tick"; evt->dev.rating = 300; evt->dev.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; - evt->dev.set_mode = mtk_clkevt_mode; + evt->dev.set_state_shutdown = mtk_clkevt_shutdown; + evt->dev.set_state_periodic = mtk_clkevt_set_periodic; + evt->dev.set_state_oneshot = mtk_clkevt_shutdown; + evt->dev.tick_resume = mtk_clkevt_shutdown; evt->dev.set_next_event = mtk_clkevt_next_event; evt->dev.cpumask = cpu_possible_mask;