From patchwork Thu Jun 18 10:54:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50031 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 07832228CC for ; Thu, 18 Jun 2015 11:02:40 +0000 (UTC) Received: by lbcak1 with SMTP id ak1sf19669370lbc.2 for ; Thu, 18 Jun 2015 04:02:38 -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:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references:mime-version :content-type:content-transfer-encoding:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=UAaR7Lcb8oSNZV5Omze6AaRUscEzSrZAMAEQS7aCI6A=; b=QpI0sLqwUBijnklY5VGiEN4xjvmhwxzA9QNuM0XIX3hLjbeHakFEQsC7Y/3dhJeQey XbmXCRtqiSqUbZy5jTIRksE/WMbuoqLelwaF6AdyT+weYn28x9yPCtDvUepTHveo807B Hl5lfQyugjUmzarXMEcZoHFraZV/GJKvrGnnyO/dJDHGl6fiYc8FHVduUtRQx6HTjWAH iOwQkrM7w4HAMuuUi3jJLsRBieURPFNGo/x2UknKNNbYr/ezzDTB5IoHhgMp5Xk38OfG P3cbO0F16Rd9vPhZYpdvqMcawvYeQcHJ2UFJ3C5ouMJ9VnsPQz88SLhYDIpxxlWaA2aN 5oFw== X-Gm-Message-State: ALoCoQlthWyjFMoZo71sMF8WymWSgnAbtFrFEsJYuekcCB4ZgR7m+upQI6uOG9wLmoF7qvcJMV+7 X-Received: by 10.180.35.164 with SMTP id i4mr411963wij.0.1434625358907; Thu, 18 Jun 2015 04:02:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.1 with SMTP id g1ls53972lag.46.gmail; Thu, 18 Jun 2015 04:02:38 -0700 (PDT) X-Received: by 10.112.126.136 with SMTP id my8mr12474126lbb.18.1434625358721; Thu, 18 Jun 2015 04:02:38 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id dn7si6193066lbb.71.2015.06.18.04.02.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 04:02:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbwc1 with SMTP id wc1so49892739lbb.2 for ; Thu, 18 Jun 2015 04:02:38 -0700 (PDT) X-Received: by 10.112.155.197 with SMTP id vy5mr12269309lbb.29.1434625358602; Thu, 18 Jun 2015 04:02:38 -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 hn6csp1098299lbb; Thu, 18 Jun 2015 04:02:37 -0700 (PDT) X-Received: by 10.68.225.42 with SMTP id rh10mr20356309pbc.158.1434625354676; Thu, 18 Jun 2015 04:02:34 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e7si10870392pdl.156.2015.06.18.04.02.33; Thu, 18 Jun 2015 04:02:34 -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 S1755648AbbFRLC1 (ORCPT + 30 others); Thu, 18 Jun 2015 07:02:27 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:34215 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753381AbbFRK4k (ORCPT ); Thu, 18 Jun 2015 06:56:40 -0400 Received: by pabvl15 with SMTP id vl15so12926277pab.1 for ; Thu, 18 Jun 2015 03:56:40 -0700 (PDT) X-Received: by 10.70.133.230 with SMTP id pf6mr7463234pdb.56.1434625000023; Thu, 18 Jun 2015 03:56:40 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id k5sm7694351pda.34.2015.06.18.03.56.39 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jun 2015 03:56:39 -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 , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Subject: [PATCH 27/41] clocksource: efm32: Migrate to new 'set-state' interface Date: Thu, 18 Jun 2015 16:24:41 +0530 Message-Id: <9f1d1bd65917023c427a1dd4951a434ea8aef54b.1434622147.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 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.182 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 efm32 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. There is nothing to be done for resume state and so isn't implemented. Cc: Uwe Kleine-König Signed-off-by: Viresh Kumar --- drivers/clocksource/time-efm32.c | 66 +++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/drivers/clocksource/time-efm32.c b/drivers/clocksource/time-efm32.c index 5b6e3d5644c9..b06e4c2be406 100644 --- a/drivers/clocksource/time-efm32.c +++ b/drivers/clocksource/time-efm32.c @@ -48,40 +48,42 @@ struct efm32_clock_event_ddata { unsigned periodic_top; }; -static void efm32_clock_event_set_mode(enum clock_event_mode mode, - struct clock_event_device *evtdev) +static int efm32_clock_event_shutdown(struct clock_event_device *evtdev) { struct efm32_clock_event_ddata *ddata = container_of(evtdev, struct efm32_clock_event_ddata, evtdev); - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - writel_relaxed(TIMERn_CMD_STOP, ddata->base + TIMERn_CMD); - writel_relaxed(ddata->periodic_top, ddata->base + TIMERn_TOP); - writel_relaxed(TIMERn_CTRL_PRESC_1024 | - TIMERn_CTRL_CLKSEL_PRESCHFPERCLK | - TIMERn_CTRL_MODE_DOWN, - ddata->base + TIMERn_CTRL); - writel_relaxed(TIMERn_CMD_START, ddata->base + TIMERn_CMD); - break; - - case CLOCK_EVT_MODE_ONESHOT: - writel_relaxed(TIMERn_CMD_STOP, ddata->base + TIMERn_CMD); - writel_relaxed(TIMERn_CTRL_PRESC_1024 | - TIMERn_CTRL_CLKSEL_PRESCHFPERCLK | - TIMERn_CTRL_OSMEN | - TIMERn_CTRL_MODE_DOWN, - ddata->base + TIMERn_CTRL); - break; - - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - writel_relaxed(TIMERn_CMD_STOP, ddata->base + TIMERn_CMD); - break; - - case CLOCK_EVT_MODE_RESUME: - break; - } + writel_relaxed(TIMERn_CMD_STOP, ddata->base + TIMERn_CMD); + return 0; +} + +static int efm32_clock_event_set_oneshot(struct clock_event_device *evtdev) +{ + struct efm32_clock_event_ddata *ddata = + container_of(evtdev, struct efm32_clock_event_ddata, evtdev); + + writel_relaxed(TIMERn_CMD_STOP, ddata->base + TIMERn_CMD); + writel_relaxed(TIMERn_CTRL_PRESC_1024 | + TIMERn_CTRL_CLKSEL_PRESCHFPERCLK | + TIMERn_CTRL_OSMEN | + TIMERn_CTRL_MODE_DOWN, + ddata->base + TIMERn_CTRL); + return 0; +} + +static int efm32_clock_event_set_periodic(struct clock_event_device *evtdev) +{ + struct efm32_clock_event_ddata *ddata = + container_of(evtdev, struct efm32_clock_event_ddata, evtdev); + + writel_relaxed(TIMERn_CMD_STOP, ddata->base + TIMERn_CMD); + writel_relaxed(ddata->periodic_top, ddata->base + TIMERn_TOP); + writel_relaxed(TIMERn_CTRL_PRESC_1024 | + TIMERn_CTRL_CLKSEL_PRESCHFPERCLK | + TIMERn_CTRL_MODE_DOWN, + ddata->base + TIMERn_CTRL); + writel_relaxed(TIMERn_CMD_START, ddata->base + TIMERn_CMD); + return 0; } static int efm32_clock_event_set_next_event(unsigned long evt, @@ -112,7 +114,9 @@ static struct efm32_clock_event_ddata clock_event_ddata = { .evtdev = { .name = "efm32 clockevent", .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, - .set_mode = efm32_clock_event_set_mode, + .set_state_shutdown = efm32_clock_event_shutdown, + .set_state_periodic = efm32_clock_event_set_periodic, + .set_state_oneshot = efm32_clock_event_set_oneshot, .set_next_event = efm32_clock_event_set_next_event, .rating = 200, },