Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 594b00d6 authored by Mahesh Sivasubramanian's avatar Mahesh Sivasubramanian
Browse files

msm: pm: Set affinity of PM irqs to next scheduled CPU



Modify the affinity of the interrupts associated with PM driver to the cpu
that will wakeup for the next expiring timer.

Change-Id: I6a1b25538a6d12bada3345a17b3ed4ff181ac089
Signed-off-by: default avatarMahesh Sivasubramanian <msivasub@codeaurora.org>
parent 2d415be7
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
/* linux/include/asm-arm/arch-msm/msm_smd.h
 *
 * Copyright (C) 2007 Google, Inc.
 * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
 * Author: Brian Swetland <swetland@google.com>
 *
 * This software is licensed under the terms of the GNU General Public
@@ -23,6 +23,7 @@
#include <soc/qcom/smem.h>

typedef struct smd_channel smd_channel_t;
struct cpumask;

#define SMD_MAX_CH_NAME_LEN 20 /* includes null char at end */

@@ -139,13 +140,15 @@ void smd_disable_read_intr(smd_channel_t *ch);
 * particular channel.
 * @ch:      open channel handle to use for the edge
 * @mask:    1 = mask interrupts; 0 = unmask interrupts
 * @cpumask  cpumask for the next cpu scheduled to be woken up
 * @returns: 0 for success; < 0 for failure
 *
 * Note that this enables/disables all interrupts from the remote subsystem for
 * all channels.  As such, it should be used with care and only for specific
 * use cases such as power-collapse sequencing.
 */
int smd_mask_receive_interrupt(smd_channel_t *ch, bool mask);
int smd_mask_receive_interrupt(smd_channel_t *ch, bool mask,
		const struct cpumask *cpumask);

/* Starts a packet transaction.  The size of the packet may exceed the total
 * size of the smd ring buffer.
@@ -337,7 +340,8 @@ static inline void smd_disable_read_intr(smd_channel_t *ch)
{
}

static inline int smd_mask_receive_interrupt(smd_channel_t *ch, bool mask)
static inline int smd_mask_receive_interrupt(smd_channel_t *ch, bool mask
		const struct cpumask *cpumask)
{
	return -ENODEV;
}
+2 −2
Original line number Diff line number Diff line
@@ -376,7 +376,7 @@ static void lpm_system_prepare(struct lpm_system_state *system_state,
	if (!lvl->notify_rpm)
		goto skip_rpm;

	ret = msm_rpm_enter_sleep(dbg_mask);
	ret = msm_rpm_enter_sleep(dbg_mask, &nextcpu);
	if (ret) {
		pr_info("msm_rpm_enter_sleep() failed with rc = %d\n", ret);
		goto bail_system_sleep;
@@ -384,7 +384,7 @@ static void lpm_system_prepare(struct lpm_system_state *system_state,

	do_div(us, USEC_PER_SEC/SCLK_HZ);
	sclk = (uint32_t)us;
	msm_mpm_enter_sleep(sclk, from_idle);
	msm_mpm_enter_sleep(sclk, from_idle, &nextcpu);
skip_rpm:
	system_state->last_entered_cluster_index = index;
	spin_unlock(&system_state->sync_lock);
+6 −2
Original line number Diff line number Diff line
/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -518,7 +518,9 @@ bool msm_mpm_irqs_detectable(bool from_idle)
	return msm_mpm_interrupts_detectable(MSM_MPM_GIC_IRQ_DOMAIN,
			from_idle);
}
void msm_mpm_enter_sleep(uint32_t sclk_count, bool from_idle)

void msm_mpm_enter_sleep(uint32_t sclk_count, bool from_idle,
		const struct cpumask *cpumask)
{
	cycle_t wakeup = (u64)sclk_count * ARCH_TIMER_HZ;

@@ -535,6 +537,8 @@ void msm_mpm_enter_sleep(uint32_t sclk_count, bool from_idle)
	}

	msm_mpm_set(wakeup, !from_idle);
	if (cpumask)
		irq_set_affinity(msm_mpm_dev_data.mpm_ipc_irq, cpumask);
}

void msm_mpm_exit_sleep(bool from_idle)
+3 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -42,10 +42,11 @@ int msm_rpm_unregister_notifier(struct notifier_block *nb);
 * msm_rpm_enter_sleep - Notify RPM driver to prepare for entering sleep
 *
 * @bool - flag to enable print contents of sleep buffer.
 * @cpumask - cpumask of next wakeup cpu
 *
 * return 0 on success errno on failure.
 */
int msm_rpm_enter_sleep(bool print);
int msm_rpm_enter_sleep(bool print, const struct cpumask *cpumask);

/**
 * msm_rpm_exit_sleep - Notify RPM driver about resuming from power collapse
+3 −3
Original line number Diff line number Diff line
@@ -1307,14 +1307,14 @@ EXPORT_SYMBOL(msm_rpm_send_message_noirq);
 * During power collapse, the rpm driver disables the SMD interrupts to make
 * sure that the interrupt doesn't wakes us from sleep.
 */
int msm_rpm_enter_sleep(bool print)
int msm_rpm_enter_sleep(bool print, const struct cpumask *cpumask)
{
	if (standalone)
		return 0;

	msm_rpm_flush_requests(print);

	return smd_mask_receive_interrupt(msm_rpm_data.ch_info, true);
	return smd_mask_receive_interrupt(msm_rpm_data.ch_info, true, cpumask);
}
EXPORT_SYMBOL(msm_rpm_enter_sleep);

@@ -1327,7 +1327,7 @@ void msm_rpm_exit_sleep(void)
	if (standalone)
		return;

	smd_mask_receive_interrupt(msm_rpm_data.ch_info, false);
	smd_mask_receive_interrupt(msm_rpm_data.ch_info, false, NULL);
}
EXPORT_SYMBOL(msm_rpm_exit_sleep);

Loading