From patchwork Thu Jun 18 10:54:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 6635771 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E8276C0020 for ; Thu, 18 Jun 2015 11:11:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0C724206E5 for ; Thu, 18 Jun 2015 11:11:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 353FE203FB for ; Thu, 18 Jun 2015 11:11:57 +0000 (UTC) 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 1Z5Xgw-0005Iz-0x; Thu, 18 Jun 2015 11:09:06 +0000 Received: from mail-pd0-f175.google.com ([209.85.192.175]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5XVk-0001YJ-0f for linux-arm-kernel@lists.infradead.org; Thu, 18 Jun 2015 10:57:32 +0000 Received: by pdbci14 with SMTP id ci14so5731117pdb.2 for ; Thu, 18 Jun 2015 03:57:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=KqziZ12tJP9g6ErQ6KFxAtfvunBpoGeMZTVPfbRx+Cs=; b=IZEXsAHWYNPTPM8OyyBx7kYKR48gr0BL29jRGo7DsBVROQEEtjH8NmwrR6QvsAGwzC iOv4r7FGUG9h3qvEeOt9BU20elBlt1/N2G1kjcxiGBVXo9T9nveD/blxUJbzb5kg/vwu InPUIAmuYvnXO9NkuIZ2fzvONyawzZ16Nr7nt1iyJF6EhnYhphth0XkJZv1SctOd1EAc B4FIWsYAmtqdb63fnQaCIOMfLICDCpGzHipBqymlZz/0KFULU0JOHD0ioB2RuqvmfGlB 8pjdGr5PL4EV+3ts9Sp4JYliCL1+apIMVl5gL7AA5jtx4+dZasV8WTQSkG6hFUI1Uo0u +NXQ== X-Gm-Message-State: ALoCoQnrN6iqZMNkMBtUfo0IO+QamWGQ/l2o6gY/yGe/GExg/nYej2CbUOSTJIC3eiAQtavQ6gMe X-Received: by 10.66.249.198 with SMTP id yw6mr19767442pac.149.1434625033065; Thu, 18 Jun 2015 03:57:13 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id m3sm4971259pdd.29.2015.06.18.03.57.12 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:57:12 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Subject: [PATCH 36/41] clocksource: stm32: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:50 +0530 Message-Id: <7fc5a0bfae6062b7fbea71a9a469e6574a1c3cf6.1434622147.git.viresh.kumar@linaro.org> 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_035732_119191_3E9E762B X-CRM114-Status: GOOD ( 12.29 ) X-Spam-Score: -0.7 (/) Cc: Maxime Coquelin , 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Migrate stm32 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: Maxime Coquelin Signed-off-by: Viresh Kumar Tested-by: Maxime Coquelin Acked-by: Maxime Coquelin --- drivers/clocksource/timer-stm32.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/clocksource/timer-stm32.c b/drivers/clocksource/timer-stm32.c index a97e8b50701c..f3dcb76799b4 100644 --- a/drivers/clocksource/timer-stm32.c +++ b/drivers/clocksource/timer-stm32.c @@ -40,24 +40,25 @@ struct stm32_clock_event_ddata { void __iomem *base; }; -static void stm32_clock_event_set_mode(enum clock_event_mode mode, - struct clock_event_device *evtdev) +static int stm32_clock_event_shutdown(struct clock_event_device *evtdev) { struct stm32_clock_event_ddata *data = container_of(evtdev, struct stm32_clock_event_ddata, evtdev); void *base = data->base; - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - writel_relaxed(data->periodic_top, base + TIM_ARR); - writel_relaxed(TIM_CR1_ARPE | TIM_CR1_CEN, base + TIM_CR1); - break; + writel_relaxed(0, base + TIM_CR1); + return 0; +} - case CLOCK_EVT_MODE_ONESHOT: - default: - writel_relaxed(0, base + TIM_CR1); - break; - } +static int stm32_clock_event_set_periodic(struct clock_event_device *evtdev) +{ + struct stm32_clock_event_ddata *data = + container_of(evtdev, struct stm32_clock_event_ddata, evtdev); + void *base = data->base; + + writel_relaxed(data->periodic_top, base + TIM_ARR); + writel_relaxed(TIM_CR1_ARPE | TIM_CR1_CEN, base + TIM_CR1); + return 0; } static int stm32_clock_event_set_next_event(unsigned long evt, @@ -88,7 +89,10 @@ static struct stm32_clock_event_ddata clock_event_ddata = { .evtdev = { .name = "stm32 clockevent", .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, - .set_mode = stm32_clock_event_set_mode, + .set_state_shutdown = stm32_clock_event_shutdown, + .set_state_periodic = stm32_clock_event_set_periodic, + .set_state_oneshot = stm32_clock_event_shutdown, + .tick_resume = stm32_clock_event_shutdown, .set_next_event = stm32_clock_event_set_next_event, .rating = 200, },