forked from rubenslte/android_kernel_samsung_msm8226
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. Change-Id: I7cddf73773186c3ec8b56c111affacac3b07fcc7 Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
f06e7561fc
commit
a65516bd80
+11
-19
@@ -211,6 +211,8 @@ static const struct {
|
||||
512, 0, 2, SZ_128K, 0x3FF037, 0x3FF016 },
|
||||
};
|
||||
|
||||
static unsigned int adreno_isidle(struct kgsl_device *device);
|
||||
|
||||
/**
|
||||
* adreno_perfcounter_init: Reserve kernel performance counters
|
||||
* @device: device to configure
|
||||
@@ -2977,11 +2979,10 @@ 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];
|
||||
struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
|
||||
|
||||
memset(prev_reg_val, 0, sizeof(prev_reg_val));
|
||||
|
||||
@@ -2999,23 +3000,15 @@ retry:
|
||||
wait_time_part = jiffies + msecs_to_jiffies(KGSL_TIMEOUT_PART);
|
||||
|
||||
while (time_before(jiffies, wait_time)) {
|
||||
adreno_readreg(adreno_dev, ADRENO_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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3064,9 +3057,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? */
|
||||
unsigned int rptr = adreno_get_rptr(rb);
|
||||
if (rptr == rb->wptr) {
|
||||
|
||||
@@ -1214,6 +1214,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
|
||||
@@ -1230,7 +1235,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);
|
||||
|
||||
|
||||
@@ -110,6 +110,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;
|
||||
|
||||
Reference in New Issue
Block a user