msm: kgsl: use the same logic in adreno_idle and adreno_isidle
These two functions need to agree on the meaning of "idle", so that calling adreno_isidle() right after an adreno_idle() will always return true. Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org> (cherry picked from commit 5365240cf0abf2d799dd849abca0dc5b46d4b784) Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org> Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org> Change-Id: I7cddf73773186c3ec8b56c111affacac3b07fcc7
This commit is contained in:
parent
6ee4d3376c
commit
694e986b4f
|
@ -211,6 +211,8 @@ static const struct {
|
|||
512, 0, 2, SZ_1M, NO_VER, NO_VER },
|
||||
};
|
||||
|
||||
static unsigned int adreno_isidle(struct kgsl_device *device);
|
||||
|
||||
/**
|
||||
* adreno_perfcounter_init: Reserve kernel performance counters
|
||||
* @device: device to configure
|
||||
|
@ -2681,12 +2683,11 @@ static int adreno_ringbuffer_drain(struct kgsl_device *device,
|
|||
/* Caller must hold the device mutex. */
|
||||
int adreno_idle(struct kgsl_device *device)
|
||||
{
|
||||
struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
|
||||
unsigned int rbbm_status;
|
||||
unsigned long wait_time;
|
||||
unsigned long wait_time_part;
|
||||
unsigned int prev_reg_val[ft_detect_regs_count];
|
||||
|
||||
|
||||
memset(prev_reg_val, 0, sizeof(prev_reg_val));
|
||||
|
||||
kgsl_cffdump_regpoll(device->id,
|
||||
|
@ -2703,23 +2704,15 @@ retry:
|
|||
wait_time_part = jiffies + msecs_to_jiffies(KGSL_TIMEOUT_PART);
|
||||
|
||||
while (time_before(jiffies, wait_time)) {
|
||||
adreno_regread(device, adreno_dev->gpudev->reg_rbbm_status,
|
||||
&rbbm_status);
|
||||
if (adreno_is_a2xx(adreno_dev)) {
|
||||
if (rbbm_status == 0x110)
|
||||
return 0;
|
||||
} else {
|
||||
if (!(rbbm_status & 0x80000000))
|
||||
return 0;
|
||||
}
|
||||
if (adreno_isidle(device))
|
||||
return 0;
|
||||
|
||||
/* Dont wait for timeout, detect hang faster.
|
||||
*/
|
||||
/* Dont wait for timeout, detect hang faster. */
|
||||
if (time_after(jiffies, wait_time_part)) {
|
||||
wait_time_part = jiffies +
|
||||
msecs_to_jiffies(KGSL_TIMEOUT_PART);
|
||||
if ((adreno_ft_detect(device, prev_reg_val)))
|
||||
goto err;
|
||||
wait_time_part = jiffies +
|
||||
msecs_to_jiffies(KGSL_TIMEOUT_PART);
|
||||
if ((adreno_ft_detect(device, prev_reg_val)))
|
||||
goto err;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2769,9 +2762,8 @@ static unsigned int adreno_isidle(struct kgsl_device *device)
|
|||
struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
|
||||
struct adreno_ringbuffer *rb = &adreno_dev->ringbuffer;
|
||||
|
||||
WARN_ON(device->state == KGSL_STATE_INIT);
|
||||
/* If the device isn't active, don't force it on. */
|
||||
if (device->state == KGSL_STATE_ACTIVE) {
|
||||
if (kgsl_pwrctrl_isenabled(device)) {
|
||||
/* Is the ring buffer is empty? */
|
||||
GSL_RB_GET_READPTR(rb, &rb->rptr);
|
||||
if (rb->rptr == rb->wptr) {
|
||||
|
|
|
@ -1076,6 +1076,11 @@ void kgsl_timer(unsigned long data)
|
|||
}
|
||||
}
|
||||
|
||||
bool kgsl_pwrctrl_isenabled(struct kgsl_device *device)
|
||||
{
|
||||
struct kgsl_pwrctrl *pwr = &device->pwrctrl;
|
||||
return (test_bit(KGSL_PWRFLAGS_CLK_ON, &pwr->power_flags) != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* kgsl_pre_hwaccess - Enforce preconditions for touching registers
|
||||
|
@ -1092,7 +1097,7 @@ void kgsl_pre_hwaccess(struct kgsl_device *device)
|
|||
/* In order to touch a register you must hold the device mutex...*/
|
||||
BUG_ON(!mutex_is_locked(&device->mutex));
|
||||
/* and have the clock on! */
|
||||
BUG_ON(!test_bit(KGSL_PWRFLAGS_CLK_ON, &device->pwrctrl.power_flags));
|
||||
BUG_ON(!kgsl_pwrctrl_isenabled(device));
|
||||
}
|
||||
EXPORT_SYMBOL(kgsl_pre_hwaccess);
|
||||
|
||||
|
|
|
@ -101,6 +101,8 @@ int kgsl_pwrctrl_init_sysfs(struct kgsl_device *device);
|
|||
void kgsl_pwrctrl_uninit_sysfs(struct kgsl_device *device);
|
||||
void kgsl_pwrctrl_enable(struct kgsl_device *device);
|
||||
void kgsl_pwrctrl_disable(struct kgsl_device *device);
|
||||
bool kgsl_pwrctrl_isenabled(struct kgsl_device *device);
|
||||
|
||||
static inline unsigned long kgsl_get_clkrate(struct clk *clk)
|
||||
{
|
||||
return (clk != NULL) ? clk_get_rate(clk) : 0;
|
||||
|
|
Loading…
Reference in New Issue