~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/video/omap2/dss/display.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include <linux/platform_device.h>
29
29
#include <linux/slab.h>
30
30
 
31
 
#include <plat/display.h>
 
31
#include <video/omapdss.h>
32
32
#include "dss.h"
33
33
 
34
34
static ssize_t display_enabled_show(struct device *dev,
45
45
                const char *buf, size_t size)
46
46
{
47
47
        struct omap_dss_device *dssdev = to_dss_device(dev);
48
 
        bool enabled, r;
49
 
 
50
 
        enabled = simple_strtoul(buf, NULL, 10);
 
48
        int r, enabled;
 
49
 
 
50
        r = kstrtoint(buf, 0, &enabled);
 
51
        if (r)
 
52
                return r;
 
53
 
 
54
        enabled = !!enabled;
51
55
 
52
56
        if (enabled != (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)) {
53
57
                if (enabled) {
83
87
        if (!dssdev->driver->set_update_mode)
84
88
                return -EINVAL;
85
89
 
86
 
        val = simple_strtoul(buf, NULL, 10);
 
90
        r = kstrtoint(buf, 0, &val);
 
91
        if (r)
 
92
                return r;
87
93
 
88
94
        switch (val) {
89
95
        case OMAP_DSS_UPDATE_DISABLED:
115
121
                struct device_attribute *attr, const char *buf, size_t size)
116
122
{
117
123
        struct omap_dss_device *dssdev = to_dss_device(dev);
118
 
        unsigned long te;
119
 
        int r;
 
124
        int te, r;
120
125
 
121
126
        if (!dssdev->driver->enable_te || !dssdev->driver->get_te)
122
127
                return -ENOENT;
123
128
 
124
 
        te = simple_strtoul(buf, NULL, 0);
 
129
        r = kstrtoint(buf, 0, &te);
 
130
        if (r)
 
131
                return r;
 
132
 
 
133
        te = !!te;
125
134
 
126
135
        r = dssdev->driver->enable_te(dssdev, te);
127
136
        if (r)
197
206
                struct device_attribute *attr, const char *buf, size_t size)
198
207
{
199
208
        struct omap_dss_device *dssdev = to_dss_device(dev);
200
 
        unsigned long rot;
201
 
        int r;
 
209
        int rot, r;
202
210
 
203
211
        if (!dssdev->driver->set_rotate || !dssdev->driver->get_rotate)
204
212
                return -ENOENT;
205
213
 
206
 
        rot = simple_strtoul(buf, NULL, 0);
 
214
        r = kstrtoint(buf, 0, &rot);
 
215
        if (r)
 
216
                return r;
207
217
 
208
218
        r = dssdev->driver->set_rotate(dssdev, rot);
209
219
        if (r)
227
237
                struct device_attribute *attr, const char *buf, size_t size)
228
238
{
229
239
        struct omap_dss_device *dssdev = to_dss_device(dev);
230
 
        unsigned long mirror;
231
 
        int r;
 
240
        int mirror, r;
232
241
 
233
242
        if (!dssdev->driver->set_mirror || !dssdev->driver->get_mirror)
234
243
                return -ENOENT;
235
244
 
236
 
        mirror = simple_strtoul(buf, NULL, 0);
 
245
        r = kstrtoint(buf, 0, &mirror);
 
246
        if (r)
 
247
                return r;
 
248
 
 
249
        mirror = !!mirror;
237
250
 
238
251
        r = dssdev->driver->set_mirror(dssdev, mirror);
239
252
        if (r)
260
273
                struct device_attribute *attr, const char *buf, size_t size)
261
274
{
262
275
        struct omap_dss_device *dssdev = to_dss_device(dev);
263
 
        unsigned long wss;
 
276
        u32 wss;
264
277
        int r;
265
278
 
266
279
        if (!dssdev->driver->get_wss || !dssdev->driver->set_wss)
267
280
                return -ENOENT;
268
281
 
269
 
        if (strict_strtoul(buf, 0, &wss))
270
 
                return -EINVAL;
 
282
        r = kstrtou32(buf, 0, &wss);
 
283
        if (r)
 
284
                return r;
271
285
 
272
286
        if (wss > 0xfffff)
273
287
                return -EINVAL;
313
327
}
314
328
EXPORT_SYMBOL(omapdss_default_get_resolution);
315
329
 
 
330
void omapdss_default_get_timings(struct omap_dss_device *dssdev,
 
331
                        struct omap_video_timings *timings)
 
332
{
 
333
        *timings = dssdev->panel.timings;
 
334
}
 
335
EXPORT_SYMBOL(omapdss_default_get_timings);
 
336
 
 
337
int omapdss_default_check_timings(struct omap_dss_device *dssdev,
 
338
                        struct omap_video_timings *timings)
 
339
{
 
340
        return memcmp(&dssdev->panel.timings, timings, sizeof(*timings));
 
341
}
 
342
EXPORT_SYMBOL(omapdss_default_check_timings);
 
343
 
 
344
bool omapdss_default_is_detected(struct omap_dss_device *dssdev, bool force)
 
345
{
 
346
        if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) {
 
347
                /* show resume info for suspended displays */
 
348
                return dssdev->activate_after_resume;
 
349
        } else {
 
350
                return dssdev->state != OMAP_DSS_DISPLAY_DISABLED;
 
351
        }
 
352
}
 
353
EXPORT_SYMBOL(omapdss_default_is_detected);
 
354
 
 
355
 
316
356
void default_get_overlay_fifo_thresholds(enum omap_plane plane,
317
357
                u32 fifo_size, enum omap_burst_size *burst_size,
318
358
                u32 *fifo_low, u32 *fifo_high)
662
702
        blocking_notifier_chain_unregister(&dssdev->notifier, nb);
663
703
}
664
704
EXPORT_SYMBOL(omap_dss_remove_notify);
665