linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][RFC][0/3] mode attribute in sysfs tree
@ 2004-06-15 17:21 Kronos
  2004-06-16  2:43 ` Antonino A. Daplas
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Kronos @ 2004-06-15 17:21 UTC (permalink / raw)
  To: linux-fbdev-devel

Hi,
I played with sysfs for a while, this is the result. Note that is a RFC,
the code is not meant for inclusion.

The patch a "mode" attribute to each fb device. This attribute is not
writable (yet). The attribute show the current video mode in the form
<xres>x<yres>-<bpp>@<refresh>.

This interface is simple and usable by the user but it's not possible to
pass a detailed mode using a fb_var_screeninfo (like the ioctl). It may
be worth adding another attribute (binary) - say "mode_detailed" - that
deals with fb_var_screeninfo and not with strings.

This is how sysfs tree looks like:

kronos@notebook:~$ tree /sys/class/graphics
/sys/class/graphics
`-- fb0
    |-- dev
    `-- mode

1 directory, 2 files

And the output is the following:
kronos@notebook:~$ cat /sys/class/graphics/fb0/mode
1024x768-16@58

Note that 58 is really 60Hz, I'm having problems with the approx.
Does anyone have a better method to calculate the refresh rate?

The patch is composed by 2 parts: the first add a class_device field to
the struct fb_info. In this way modules can attach attributes to this
class_device. The problem with the current code is that class_dev is
initialized in register_framebuffer so you can use it only after current
fb is registered. This happens because with the class_simple interface
it's not possibile to split the creation of the class_device and its
insertion into the hierarchy (this is possible with normal class_device
interface though).

Another problem is that the driver's private modedb is not available,
so the code will search only standard modedb (using fb_find_mode).
This issue can be solved adding a "modedb" field to the struct fb_info. 
Of course drivers can ignore my macro and create their own "mode" attribute
where they do whatever they want, but I don't like this solution very much.

The second patch add the function that does the real work (fb_show_mode)
and a helper macro that helps in the creation of the "mode" attribute.
It's similar to other *_ATTR macros in device.h, and you can use like this:

static FB_MODE_ATTR(my_mode_attr);
...
class_device_create_file(my_fb_info->class_dev, &my_mode_attr);

Finally there's a patch that shows the usage the attribute (with sisfb).
Compile and boot tested on my notebook.

I'll send patches in reply to this mail.

Comments?

Luca
-- 
Home: http://kronoz.cjb.net
Il piu` bel momento dell'amore e` quando ci si illude che duri per 
sempre; il piu` brutto, quando ci si accorge che dura da troppo.


-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-06-16  9:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-15 17:21 [PATCH][RFC][0/3] mode attribute in sysfs tree Kronos
2004-06-16  2:43 ` Antonino A. Daplas
2004-06-16  9:28 ` [PATCH][RFC][1/3] " Kronos
2004-06-16  9:30 ` [PATCH][RFC][2/3] " Kronos
2004-06-16  9:32 ` [PATCH][RFC][3/3] " Kronos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).