[Intel-gfx] [PATCH] drm/i915: add GPU max frequency control file

Keith Packard keithp at keithp.com
Wed Jul 27 20:51:28 CEST 2011


On Wed, 27 Jul 2011 10:53:28 -0700, Jesse Barnes <jbarnes at virtuousgeek.org> wrote:

> +	len = snprintf(buf, sizeof (buf),
> +		       "freq: %d\n", dev_priv->max_delay * 50);

should probably be 'Max frequency' too?

> +
> +	if (len > sizeof (buf))
> +		len = sizeof (buf);
> +
> +	return simple_read_from_buffer(ubuf, max, ppos, buf, len);
> +}
> +
> +static ssize_t
> +i915_max_freq_write(struct file *filp,
> +		  const char __user *ubuf,
> +		  size_t cnt,
> +		  loff_t *ppos)
> +{
> +	struct drm_device *dev = filp->private_data;
> +	struct drm_i915_private *dev_priv = dev->dev_private;
> +	char buf[20];
> +	int val = 1;
> +
> +	if (cnt > 0) {
> +		if (cnt > sizeof (buf) - 1)
> +			return -EINVAL;
> +
> +		if (copy_from_user(buf, ubuf, cnt))
> +			return -EFAULT;
> +		buf[cnt] = 0;
> +
> +		val = simple_strtoul(buf, NULL, 0);
> +	}
> +
> +	DRM_DEBUG_DRIVER("Manually setting freq to %d\n", val);

And 'max freq' here too.

Otherwise, this seems useful to me too.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20110727/3c309b07/attachment.sig>


More information about the Intel-gfx mailing list