From patchwork Fri Mar 15 14:27:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 2278271 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 8E53B3FC8F for ; Fri, 15 Mar 2013 14:32:12 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UGVd3-0007Vh-CR; Fri, 15 Mar 2013 14:29:05 +0000 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UGVbQ-0006xJ-58 for linux-arm-kernel@lists.infradead.org; Fri, 15 Mar 2013 14:27:25 +0000 Received: by mail-we0-f179.google.com with SMTP id p43so3263773wea.24 for ; Fri, 15 Mar 2013 07:27:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=62B1i4BwOfOZgXVW/jI9i/A3R1BHhEosU8RFyh9rTZM=; b=lT6B9l2wub9H7Ad06UQpeJ6t2glo8STIHWc47rdvyHHyNpl3Ny9eWqqT0y9fmTcl40 ptVDKct6W3/zFDew6EynvBmAe2W+i8iohZ4inamDLk+tiKDo6mBWOcyWfXAVKN4Sz47p eOte/8IzIuSOLya2hrZVDLzVOkikDQBHgcRnm1hd1B4bxFvShSJ3dUXhnTR2DyZOedIq Wn80wIKMQoxxzzjItlRQV//rd16KXpDz8CRb6/hvsYZqYvks1RR5/rK+CHP8h36mRJWE aZKfHr1z2pJuuIT7xZLqFnKBT19zaYh3UgTEuqkX90BhDV+m8c0z67+fr8JEuw2ZURNb OZ4A== X-Received: by 10.195.12.133 with SMTP id eq5mr11209194wjd.52.1363357641915; Fri, 15 Mar 2013 07:27:21 -0700 (PDT) Received: from mai.home (AToulouse-654-1-276-229.w90-5.abo.wanadoo.fr. [90.5.59.229]) by mx.google.com with ESMTPS id fv2sm3486696wib.6.2013.03.15.07.27.19 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Mar 2013 07:27:21 -0700 (PDT) From: Daniel Lezcano To: linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [RFC patch 03/11] cpuidle / ux500 : use common ARM cpuidle driver Date: Fri, 15 Mar 2013 15:27:02 +0100 Message-Id: <1363357630-22214-4-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1363357630-22214-1-git-send-email-daniel.lezcano@linaro.org> References: <1363357630-22214-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQlJ9Tsl4dDIpx5/LkCUDg8y3Wer2xdfjA2z+j9uB10bgHbfXYYYHU6IooWExKDAWC1gwG70 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130315_102724_375892_362BF101 X-CRM114-Status: GOOD ( 14.57 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: andrew@lunn.ch, magnus.damm@gmail.com, ben-linux@fluff.org, nsekhar@ti.com, nicolas.ferre@atmel.com, rob.herring@calxeda.com, rjw@sisk.pl, kevin.hilman@linaro.org, horms@verge.net.au, kernel@pengutronix.de, kgene.kim@samsung.com, plagnioj@jcrosoft.com, linux@maxim.org.za, jason@lakedaemon.net, lenb@kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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 The ARM generic cpuidle driver handles the initialization and the CPUIDLE_FLAG_TIMER_STOP allows the cpuidle framework to call clockevents_notify. This patch removes the duplicated code and use the arm_idle_init function. Signed-off-by: Daniel Lezcano --- arch/arm/mach-ux500/cpuidle.c | 56 +++-------------------------------------- 1 file changed, 3 insertions(+), 53 deletions(-) diff --git a/arch/arm/mach-ux500/cpuidle.c b/arch/arm/mach-ux500/cpuidle.c index ce91493..36bf4fd 100644 --- a/arch/arm/mach-ux500/cpuidle.c +++ b/arch/arm/mach-ux500/cpuidle.c @@ -22,7 +22,6 @@ static atomic_t master = ATOMIC_INIT(0); static DEFINE_SPINLOCK(master_lock); -static DEFINE_PER_CPU(struct cpuidle_device, ux500_cpuidle_device); static inline int ux500_enter_idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) @@ -30,8 +29,6 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev, int this_cpu = smp_processor_id(); bool recouple = false; - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &this_cpu); - if (atomic_inc_return(&master) == num_online_cpus()) { /* With this lock, we prevent the other cpu to exit and enter @@ -91,8 +88,6 @@ out: spin_unlock(&master_lock); } - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &this_cpu); - return index; } @@ -106,7 +101,8 @@ static struct cpuidle_driver ux500_idle_driver = { .enter = ux500_enter_idle, .exit_latency = 70, .target_residency = 260, - .flags = CPUIDLE_FLAG_TIME_VALID, + .flags = CPUIDLE_FLAG_TIME_VALID | + CPUIDLE_FLAG_TIMER_STOP, .name = "ApIdle", .desc = "ARM Retention", }, @@ -115,59 +111,13 @@ static struct cpuidle_driver ux500_idle_driver = { .state_count = 2, }; -/* - * For each cpu, setup the broadcast timer because we will - * need to migrate the timers for the states >= ApIdle. - */ -static void ux500_setup_broadcast_timer(void *arg) -{ - int cpu = smp_processor_id(); - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu); -} - int __init ux500_idle_init(void) { - int ret, cpu; - struct cpuidle_device *device; - /* Configure wake up reasons */ prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) | PRCMU_WAKEUP(ABB)); - /* - * Configure the timer broadcast for each cpu, that must - * be done from the cpu context, so we use a smp cross - * call with 'on_each_cpu'. - */ - on_each_cpu(ux500_setup_broadcast_timer, NULL, 1); - - ret = cpuidle_register_driver(&ux500_idle_driver); - if (ret) { - printk(KERN_ERR "failed to register ux500 idle driver\n"); - return ret; - } - - for_each_online_cpu(cpu) { - device = &per_cpu(ux500_cpuidle_device, cpu); - device->cpu = cpu; - ret = cpuidle_register_device(device); - if (ret) { - printk(KERN_ERR "Failed to register cpuidle " - "device for cpu%d\n", cpu); - goto out_unregister; - } - } -out: - return ret; - -out_unregister: - for_each_online_cpu(cpu) { - device = &per_cpu(ux500_cpuidle_device, cpu); - cpuidle_unregister_device(device); - } - - cpuidle_unregister_driver(&ux500_idle_driver); - goto out; + return arm_idle_init(&ux500_idle_driver); } device_initcall(ux500_idle_init);