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

Commit db1d5bbc authored by Jordan Crouse's avatar Jordan Crouse Committed by Jeremy Gebben
Browse files

msm: kgsl: Return something when the KGSL device is read



'cat /dev/kgsl-3d0' is the first smoke test that everybody runs when
bringing up a new GPU since it can be run without any other tools
and verifies the full power / initialization path.  Instead of just
returning -EINVAL for a read print a little message to let the user
know that indeed, the GPU is up and happy.

Change-Id: Ic0dedbadf9c8a2a926142a79802d8a340892bc3d
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent 41a6cd64
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -3882,11 +3882,28 @@ static irqreturn_t kgsl_irq_handler(int irq, void *data)

}

#define KGSL_READ_MESSAGE "OH HAI GPU"

static ssize_t kgsl_read(struct file *filep, char __user *buf, size_t count,
		loff_t *pos)
{
	int ret;

	if (*pos >= strlen(KGSL_READ_MESSAGE) + 1)
		return 0;

	ret = snprintf(buf, count, "%s\n", KGSL_READ_MESSAGE);
	*pos += ret;

	return ret;
}

static const struct file_operations kgsl_fops = {
	.owner = THIS_MODULE,
	.release = kgsl_release,
	.open = kgsl_open,
	.mmap = kgsl_mmap,
	.read = kgsl_read,
	.get_unmapped_area = kgsl_get_unmapped_area,
	.unlocked_ioctl = kgsl_ioctl,
	.compat_ioctl = kgsl_compat_ioctl,