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: 50014 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CD0A2228CC for ; Thu, 18 Jun 2015 10:58:14 +0000 (UTC) Received: by wgbhy7 with SMTP id hy7sf19223349wgb.3 for ; Thu, 18 Jun 2015 03:58:14 -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: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=l7+21XUIAq5+H1nskcRR+80n67nLUW5ri2Z/MePO3xY=; b=lHKAkar2V2mzQmYl5DNuTd21M3AJIHmEqtTApjRQL/T84SGPv5FaLM4vdyhaooO6Sx 1eWKVM5dS3YthwOPw+kHumlZmbeRUd894cFJJYrfadBIDLfIXToQyRqFgZgvUBlSFfJe /gdUcFYRuAF42mp3e0w4AEg1NqWx7U1LMvDEZc1QyoOw1QLFBrUHcUMCTZ3WPh70SB1l toJi33gmoHAovkle56zmIWTg00KUkY35+sWWdTzlWh18oeN9z1ixpjJZiXSQP4kFM24n wcBMMWGzod0BU6UewPGQM76kWbDc2LXl/oXa0PEjfAJVzdePCA9ptfSbUJb1kyfGsCDV cHWA== X-Gm-Message-State: ALoCoQnwcqJKvoiIjfvUk4U3Ky740vZnhyf8E4Eh/2KKvmiPy4YH/CxKiFkQ5Staw9hkMwl+tUXZ X-Received: by 10.180.37.198 with SMTP id a6mr12710680wik.7.1434625094170; Thu, 18 Jun 2015 03:58:14 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.40 with SMTP id v8ls410949laj.88.gmail; Thu, 18 Jun 2015 03:58:13 -0700 (PDT) X-Received: by 10.152.23.38 with SMTP id j6mr12056712laf.47.1434625093838; Thu, 18 Jun 2015 03:58:13 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id s6si3663973las.169.2015.06.18.03.58.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 03:58:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbbqq2 with SMTP id qq2so49674582lbb.3 for ; Thu, 18 Jun 2015 03:58:13 -0700 (PDT) X-Received: by 10.112.204.6 with SMTP id ku6mr12309284lbc.73.1434625093712; Thu, 18 Jun 2015 03:58:13 -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 hn6csp1095708lbb; Thu, 18 Jun 2015 03:58:12 -0700 (PDT) X-Received: by 10.70.138.8 with SMTP id qm8mr20015840pdb.96.1434625091937; Thu, 18 Jun 2015 03:58:11 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ev6si10872338pdb.91.2015.06.18.03.58.10; Thu, 18 Jun 2015 03:58:11 -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 S1755165AbbFRK6A (ORCPT + 30 others); Thu, 18 Jun 2015 06:58:00 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:34120 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754824AbbFRK5N (ORCPT ); Thu, 18 Jun 2015 06:57:13 -0400 Received: by pdbki1 with SMTP id ki1so64251252pdb.1 for ; Thu, 18 Jun 2015 03:57:13 -0700 (PDT) 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 Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Viresh Kumar , Maxime Coquelin 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: 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: 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.217.170 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: , 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 --- 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, },