From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Wilson Subject: Re: [PATCH 2/2] drm/i915: Add current GPU freq to sysfs Date: Sun, 02 Sep 2012 09:44:32 +0100 Message-ID: <275ffc$6ep7nn@fmsmga002.fm.intel.com> References: <1346570681-21242-1-git-send-email-ben@bwidawsk.net> <1346570681-21242-2-git-send-email-ben@bwidawsk.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 0871A9E7E1 for ; Sun, 2 Sep 2012 01:45:23 -0700 (PDT) In-Reply-To: <1346570681-21242-2-git-send-email-ben@bwidawsk.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org Cc: Ben Widawsky , Arjan van de Ven List-Id: intel-gfx@lists.freedesktop.org On Sun, 2 Sep 2012 00:24:41 -0700, Ben Widawsky wrote: > Userspace applications such as PowerTOP are interesting in being able to > read the current GPU frequency. The patch itself sets up a generic array > for gen6 attributes so we can easily add other items in the future (and > it also happens to be just about the cleanest way to do this). > > The patch is a nice addition to > commit 1ac02185dff3afac146d745ba220dc6672d1d162 > Author: Daniel Vetter > Date: Thu Aug 30 13:26:48 2012 +0200 > > drm/i915: add a tracepoint for gpu frequency changes > > Reading the GPU frequncy can be done by reading a file like: > /sys/class/drm/card0/render_frequency_mhz > > CC: Arjan van de Ven > Signed-off-by: Ben Widawsky Reviewed-by: Chris Wilson > --- > drivers/gpu/drm/i915/i915_sysfs.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c > index da733a3..0cb479d 100644 > --- a/drivers/gpu/drm/i915/i915_sysfs.c > +++ b/drivers/gpu/drm/i915/i915_sysfs.c > @@ -203,6 +203,30 @@ static struct bin_attribute dpf_attrs = { > .mmap = NULL > }; > > +static ssize_t render_frequency_mhz_show(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + struct drm_minor *dminor = container_of(dev, struct drm_minor, kdev); > + struct drm_device *drm_dev = dminor->dev; I would have called the struct device *kdev so that we could have our standard nameing convention of struct drm_device *dev. -Chris -- Chris Wilson, Intel Open Source Technology Centre