]> code.ossystems Code Review - openembedded-core.git/blob
32def9e8d5e72bda5a7a680634986637c7f3b536
[openembedded-core.git] /
1 From a9b3500bd14609750a2337e866e1df62627c1bac Mon Sep 17 00:00:00 2001
2 From: Imre Deak <imre.deak@nokia.com>
3 Date: Mon, 20 Apr 2009 14:55:33 +0200
4 Subject: [PATCH] DSS2: add sysfs entry for seting the rotate type
5
6 This can help in utilizing VRAM memory better. Since with VRFB rotation
7 we waste a lot of physical memory due to the VRFB HW design, provide the
8 possibility to turn it off and free the extra memory for the use by other
9 planes for example.
10 ---
11  drivers/video/omap2/omapfb/omapfb-sysfs.c |   42 ++++++++++++++++++++++++++++-
12  1 files changed, 41 insertions(+), 1 deletions(-)
13
14 diff --git a/drivers/video/omap2/omapfb/omapfb-sysfs.c b/drivers/video/omap2/omapfb/omapfb-sysfs.c
15 index 2c88718..4e3da42 100644
16 --- a/drivers/video/omap2/omapfb/omapfb-sysfs.c
17 +++ b/drivers/video/omap2/omapfb/omapfb-sysfs.c
18 @@ -43,6 +43,46 @@ static ssize_t show_rotate_type(struct device *dev,
19         return snprintf(buf, PAGE_SIZE, "%d\n", ofbi->rotation_type);
20  }
21  
22 +static ssize_t store_rotate_type(struct device *dev,
23 +               struct device_attribute *attr,
24 +               const char *buf, size_t count)
25 +{
26 +       struct fb_info *fbi = dev_get_drvdata(dev);
27 +       struct omapfb_info *ofbi = FB2OFB(fbi);
28 +       struct omapfb2_device *fbdev = ofbi->fbdev;
29 +       enum omap_dss_rotation_type rot_type;
30 +       int r;
31 +
32 +       rot_type = simple_strtoul(buf, NULL, 0);
33 +
34 +       if (rot_type != OMAP_DSS_ROT_DMA && rot_type != OMAP_DSS_ROT_VRFB)
35 +               return -EINVAL;
36 +
37 +       omapfb_lock(fbdev);
38 +
39 +       r = 0;
40 +       if (rot_type == ofbi->rotation_type)
41 +               goto out;
42 +
43 +       r = -EBUSY;
44 +       if (ofbi->region.size)
45 +               goto out;
46 +
47 +       ofbi->rotation_type = rot_type;
48 +
49 +       /*
50 +        * Since the VRAM for this FB is not allocated at the moment we don't need to
51 +        * do any further parameter checking at this point.
52 +        */
53 +
54 +       r = count;
55 +out:
56 +       omapfb_unlock(fbdev);
57 +
58 +       return r;
59 +}
60 +
61 +
62  static ssize_t show_mirror(struct device *dev,
63                 struct device_attribute *attr, char *buf)
64  {
65 @@ -327,7 +367,7 @@ static ssize_t show_virt(struct device *dev,
66  }
67  
68  static struct device_attribute omapfb_attrs[] = {
69 -       __ATTR(rotate_type, S_IRUGO, show_rotate_type, NULL),
70 +       __ATTR(rotate_type, S_IRUGO | S_IWUSR, show_rotate_type, store_rotate_type),
71         __ATTR(mirror, S_IRUGO | S_IWUSR, show_mirror, store_mirror),
72         __ATTR(size, S_IRUGO | S_IWUSR, show_size, store_size),
73         __ATTR(overlays, S_IRUGO | S_IWUSR, show_overlays, store_overlays),
74 -- 
75 1.5.6.5
76