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

Commit 6a1c7d8e authored by Kyle Yan's avatar Kyle Yan Committed by Gerrit - the friendly Code Review server
Browse files

Merge changes I8f374504,I2e6dde03,I66790e51 into msm-4.9

* changes:
  drivers: qcom: rpmh: Remove excessive print in kernel log
  drivers: soc: rpmh: Set up next wakeup correctly
  drivers: qcom: rpmh: Setup wake requests as 'complete'
parents 5200b4ba 20646542
Loading
Loading
Loading
Loading
+3 −12
Original line number Diff line number Diff line
@@ -79,7 +79,6 @@

/* Control/Hidden TCS */
#define TCS_HIDDEN_MAX_SLOTS		3
#define TCS_HIDDEN_CMD0_DRV_ADDR	0x34
#define TCS_HIDDEN_CMD0_DRV_DATA	0x38
#define TCS_HIDDEN_CMD_SHIFT		0x08

@@ -830,15 +829,12 @@ static int tcs_mbox_invalidate(struct mbox_chan *chan)
static void __tcs_write_hidden(void *base, int d, struct tcs_mbox_msg *msg)
{
	int i;
	void __iomem *addr;
	const u32 offset = TCS_HIDDEN_CMD0_DRV_DATA - TCS_HIDDEN_CMD0_DRV_ADDR;
	void __iomem *addr = base + TCS_HIDDEN_CMD0_DRV_DATA;

	addr = base + TCS_HIDDEN_CMD0_DRV_ADDR;
	for (i = 0; i < msg->num_payload; i++) {
		/* Only data is write capable */
		writel_relaxed(cpu_to_le32(msg->payload[i].data),
							addr + offset);
		trace_rpmh_control_msg(addr + offset, msg->payload[i].data);
		writel_relaxed(cpu_to_le32(msg->payload[i].data), addr);
		trace_rpmh_control_msg(addr, msg->payload[i].data);
		addr += TCS_HIDDEN_CMD_SHIFT;
	}
}
@@ -899,11 +895,6 @@ static int chan_tcs_ctrl_write(struct mbox_chan *chan, void *data)
		goto tx_done;
	}

	if (msg->is_complete) {
		dev_err(dev, "Incorrect ctrl request.\n");
		goto tx_done;
	}

	/* Post the message to the TCS without trigger */
	ret = tcs_mbox_write(chan, msg, false);

+3 −12
Original line number Diff line number Diff line
@@ -245,16 +245,6 @@ int __rpmh_write(struct rpmh_client *rc, enum rpmh_state state,
	int ret = 0;
	int i;

	/*
	 * We cannot wait for completion for a sleep set, its done
	 * outside the processor.
	 */
	if (rpm_msg->msg.is_complete &&
		(state == RPMH_SLEEP_STATE || state == RPMH_WAKE_ONLY_STATE)) {
		pr_err("Mismatch: sleep/wake set with completion.\n");
		return -EINVAL;
	}

	/* Cache the request in our store and link the payload */
	for (i = 0; i < rpm_msg->msg.num_payload; i++) {
		req = cache_rpm_request(rc, state, &rpm_msg->msg.payload[i]);
@@ -638,7 +628,8 @@ int send_single(struct rpmh_client *rc, enum rpmh_state state, u32 addr,
{
	DEFINE_RPMH_MSG_ONSTACK(rc, state, NULL, NULL, rpm_msg);

	rpm_msg.msg.is_complete = false;
	/* Wake sets are always complete and sleep sets are not */
	rpm_msg.msg.is_complete = (state == RPMH_WAKE_ONLY_STATE);
	rpm_msg.cmd.addr = addr;
	rpm_msg.cmd.data = data;

@@ -673,7 +664,7 @@ int rpmh_flush(struct rpmh_client *rc)

	spin_lock(&rpm->lock);
	if (!rpm->dirty) {
		pr_info("Skipping flush, TCS has latest data.\n");
		pr_debug("Skipping flush, TCS has latest data.\n");
		spin_unlock(&rpm->lock);
		return 0;
	}
+14 −5
Original line number Diff line number Diff line
/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2017, 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
@@ -16,6 +16,7 @@

#include <soc/qcom/rpmh.h>

#define ARCH_TIMER_HZ		(19200000UL)
#define PDC_TIME_VALID_SHIFT	31
#define PDC_TIME_UPPER_MASK	0xFFFFFF

@@ -25,9 +26,9 @@ static int setup_wakeup(uint64_t sleep_val)
{
	struct tcs_cmd cmd[3] = { { 0 } };

	cmd[0].data = sleep_val & 0xFFFFFFFF;
	cmd[1].data = (sleep_val >> 32) & PDC_TIME_UPPER_MASK;
	cmd[1].data |= 1 << PDC_TIME_VALID_SHIFT;
	cmd[0].data = (sleep_val >> 32) & PDC_TIME_UPPER_MASK;
	cmd[0].data |= 1 << PDC_TIME_VALID_SHIFT;
	cmd[1].data = sleep_val & 0xFFFFFFFF;

	return rpmh_write_control(rpmh_client, cmd, ARRAY_SIZE(cmd));
}
@@ -35,7 +36,7 @@ static int setup_wakeup(uint64_t sleep_val)
/**
 * system_sleep_enter() - Activties done when entering system low power modes
 *
 * @sleep_val: The qtimer value for the next wakeup time
 * @sleep_val: The sleep duration in us.
 *
 * Returns 0 for success or error values from writing the timer value in the
 * hardware block.
@@ -51,6 +52,14 @@ int system_sleep_enter(uint64_t sleep_val)
	if (ret)
		return ret;

	/*
	 * Set up the wake up value offset from the current time.
	 * Convert us to ns to allow div by 19.2 Mhz tick timer.
	 */
	sleep_val *= NSEC_PER_USEC;
	do_div(sleep_val, NSEC_PER_SEC/ARCH_TIMER_HZ);
	sleep_val += arch_counter_get_cntvct();

	return setup_wakeup(sleep_val);
}
EXPORT_SYMBOL(system_sleep_enter);