Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * generic display timing functions
0004  *
0005  * Copyright (c) 2012 Steffen Trumtrar <s.trumtrar@pengutronix.de>, Pengutronix
0006  */
0007 
0008 #include <linux/errno.h>
0009 #include <linux/export.h>
0010 #include <video/display_timing.h>
0011 #include <video/videomode.h>
0012 
0013 void videomode_from_timing(const struct display_timing *dt,
0014               struct videomode *vm)
0015 {
0016     vm->pixelclock = dt->pixelclock.typ;
0017     vm->hactive = dt->hactive.typ;
0018     vm->hfront_porch = dt->hfront_porch.typ;
0019     vm->hback_porch = dt->hback_porch.typ;
0020     vm->hsync_len = dt->hsync_len.typ;
0021 
0022     vm->vactive = dt->vactive.typ;
0023     vm->vfront_porch = dt->vfront_porch.typ;
0024     vm->vback_porch = dt->vback_porch.typ;
0025     vm->vsync_len = dt->vsync_len.typ;
0026 
0027     vm->flags = dt->flags;
0028 }
0029 EXPORT_SYMBOL_GPL(videomode_from_timing);
0030 
0031 int videomode_from_timings(const struct display_timings *disp,
0032               struct videomode *vm, unsigned int index)
0033 {
0034     struct display_timing *dt;
0035 
0036     dt = display_timings_get(disp, index);
0037     if (!dt)
0038         return -EINVAL;
0039 
0040     videomode_from_timing(dt, vm);
0041 
0042     return 0;
0043 }
0044 EXPORT_SYMBOL_GPL(videomode_from_timings);