From patchwork Fri Jul 17 05:11:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51222 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 16FD422A28 for ; Fri, 17 Jul 2015 05:13:20 +0000 (UTC) Received: by wgwk7 with SMTP id k7sf23445496wgw.0 for ; Thu, 16 Jul 2015 22:13:19 -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=74fE8AA9c5lv2Bxn64UMWztyJQoj1FGTdvRbhrifOGY=; b=azAfqDOwr/7Y/PQXtC9FE7Oagr5b5ODB2b9z0YgHe6dHdNoHonY2gKTHcK58UslC9A jpZp087MEKRUFSTI16SKPVM0FwYQcHE6tco2FDaKt6we4xRh5LadlLlOg5GIzbbt2qB0 j93L2yiEeusBA6dm4AQ4TKxUxXN9NpZYvdUbJgfqemXJ0sInnJnBJwO2fqrTlwaUm7M9 61aJemvWH85v6x/EmDYao/2gstBF5i60yovk/m1OOfonh3YHKyerZqkTwPl1KHK4qZ3L lOQEvYXRz7HO3QxHsbEBTCiyA711MRt17SdPaxqeNfZqju3jUXylIst7bPIk8+qFTi5t ESNA== X-Gm-Message-State: ALoCoQlUvtGIuziYqBoYSpUrmZigfQRCOLsIDe3ewsF6qFcefkBKR95+iFYlBI4Y7vccSGmCuuPl X-Received: by 10.180.182.110 with SMTP id ed14mr3625384wic.5.1437109999349; Thu, 16 Jul 2015 22:13:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.7 with SMTP id v7ls90061laa.107.gmail; Thu, 16 Jul 2015 22:13:19 -0700 (PDT) X-Received: by 10.152.5.197 with SMTP id u5mr11629545lau.76.1437109999158; Thu, 16 Jul 2015 22:13:19 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id dz8si57481lac.4.2015.07.16.22.13.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 22:13:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lblf12 with SMTP id f12so55200819lbl.2 for ; Thu, 16 Jul 2015 22:13:19 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr12738887lbc.19.1437109999055; Thu, 16 Jul 2015 22:13:19 -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 hn6csp668621lbb; Thu, 16 Jul 2015 22:13:17 -0700 (PDT) X-Received: by 10.70.42.233 with SMTP id r9mr25540532pdl.140.1437109989397; Thu, 16 Jul 2015 22:13:09 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dn2si16701042pdb.54.2015.07.16.22.13.08; Thu, 16 Jul 2015 22:13:09 -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 S1756921AbbGQFM6 (ORCPT + 28 others); Fri, 17 Jul 2015 01:12:58 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:36141 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756860AbbGQFMz (ORCPT ); Fri, 17 Jul 2015 01:12:55 -0400 Received: by pachj5 with SMTP id hj5so54642433pac.3 for ; Thu, 16 Jul 2015 22:12:54 -0700 (PDT) X-Received: by 10.68.219.101 with SMTP id pn5mr25962366pbc.77.1437109974695; Thu, 16 Jul 2015 22:12:54 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id og1sm9693994pdb.58.2015.07.16.22.12.53 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jul 2015 22:12:54 -0700 (PDT) From: Viresh Kumar To: arm@kernel.org, olof@lixom.net Cc: linaro-kernel@lists.linaro.org, arnd.bergmann@linaro.org, linux-arm-kernel@lists.infradead.org, Viresh Kumar , Russell King , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 17/18] ARM/iop/time: Migrate to new 'set-state' interface Date: Fri, 17 Jul 2015 10:41:11 +0530 Message-Id: <8d778377e598bd78d4ce788b20b1c74777c5d137.1437101996.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.173 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 iop 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: Russell King Signed-off-by: Viresh Kumar --- arch/arm/plat-iop/time.c | 70 +++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/arch/arm/plat-iop/time.c b/arch/arm/plat-iop/time.c index 6ad65d8ae237..101e8f2c7abe 100644 --- a/arch/arm/plat-iop/time.c +++ b/arch/arm/plat-iop/time.c @@ -77,41 +77,57 @@ static int iop_set_next_event(unsigned long delta, static unsigned long ticks_per_jiffy; -static void iop_set_mode(enum clock_event_mode mode, - struct clock_event_device *unused) +static int iop_set_periodic(struct clock_event_device *evt) { u32 tmr = read_tmr0(); - switch (mode) { - case CLOCK_EVT_MODE_PERIODIC: - write_tmr0(tmr & ~IOP_TMR_EN); - write_tcr0(ticks_per_jiffy - 1); - write_trr0(ticks_per_jiffy - 1); - tmr |= (IOP_TMR_RELOAD | IOP_TMR_EN); - break; - case CLOCK_EVT_MODE_ONESHOT: - /* ->set_next_event sets period and enables timer */ - tmr &= ~(IOP_TMR_RELOAD | IOP_TMR_EN); - break; - case CLOCK_EVT_MODE_RESUME: - tmr |= IOP_TMR_EN; - break; - case CLOCK_EVT_MODE_SHUTDOWN: - case CLOCK_EVT_MODE_UNUSED: - default: - tmr &= ~IOP_TMR_EN; - break; - } + write_tmr0(tmr & ~IOP_TMR_EN); + write_tcr0(ticks_per_jiffy - 1); + write_trr0(ticks_per_jiffy - 1); + tmr |= (IOP_TMR_RELOAD | IOP_TMR_EN); write_tmr0(tmr); + return 0; +} + +static int iop_set_oneshot(struct clock_event_device *evt) +{ + u32 tmr = read_tmr0(); + + /* ->set_next_event sets period and enables timer */ + tmr &= ~(IOP_TMR_RELOAD | IOP_TMR_EN); + write_tmr0(tmr); + return 0; +} + +static int iop_shutdown(struct clock_event_device *evt) +{ + u32 tmr = read_tmr0(); + + tmr &= ~IOP_TMR_EN; + write_tmr0(tmr); + return 0; +} + +static int iop_resume(struct clock_event_device *evt) +{ + u32 tmr = read_tmr0(); + + tmr |= IOP_TMR_EN; + write_tmr0(tmr); + return 0; } static struct clock_event_device iop_clockevent = { - .name = "iop_timer0", - .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .rating = 300, - .set_next_event = iop_set_next_event, - .set_mode = iop_set_mode, + .name = "iop_timer0", + .features = CLOCK_EVT_FEAT_PERIODIC | + CLOCK_EVT_FEAT_ONESHOT, + .rating = 300, + .set_next_event = iop_set_next_event, + .set_state_shutdown = iop_shutdown, + .set_state_periodic = iop_set_periodic, + .tick_resume = iop_resume, + .set_state_oneshot = iop_set_oneshot, }; static irqreturn_t