18714c0ceSSteffen Trumtrar /* 28714c0ceSSteffen Trumtrar * generic display timing functions 38714c0ceSSteffen Trumtrar * 48714c0ceSSteffen Trumtrar * Copyright (c) 2012 Steffen Trumtrar <s.trumtrar@pengutronix.de>, Pengutronix 58714c0ceSSteffen Trumtrar * 68714c0ceSSteffen Trumtrar * This file is released under the GPLv2 78714c0ceSSteffen Trumtrar */ 88714c0ceSSteffen Trumtrar 98714c0ceSSteffen Trumtrar #include <linux/errno.h> 108714c0ceSSteffen Trumtrar #include <linux/export.h> 118714c0ceSSteffen Trumtrar #include <video/display_timing.h> 128714c0ceSSteffen Trumtrar #include <video/videomode.h> 138714c0ceSSteffen Trumtrar 14*6cd2c7dbSTomi Valkeinen void videomode_from_timing(const struct display_timing *dt, 15*6cd2c7dbSTomi Valkeinen struct videomode *vm) 168714c0ceSSteffen Trumtrar { 17694f0506STomi Valkeinen vm->pixelclock = dt->pixelclock.typ; 18694f0506STomi Valkeinen vm->hactive = dt->hactive.typ; 19694f0506STomi Valkeinen vm->hfront_porch = dt->hfront_porch.typ; 20694f0506STomi Valkeinen vm->hback_porch = dt->hback_porch.typ; 21694f0506STomi Valkeinen vm->hsync_len = dt->hsync_len.typ; 228714c0ceSSteffen Trumtrar 23694f0506STomi Valkeinen vm->vactive = dt->vactive.typ; 24694f0506STomi Valkeinen vm->vfront_porch = dt->vfront_porch.typ; 25694f0506STomi Valkeinen vm->vback_porch = dt->vback_porch.typ; 26694f0506STomi Valkeinen vm->vsync_len = dt->vsync_len.typ; 278714c0ceSSteffen Trumtrar 2806a33079STomi Valkeinen vm->flags = dt->flags; 29*6cd2c7dbSTomi Valkeinen } 30*6cd2c7dbSTomi Valkeinen EXPORT_SYMBOL_GPL(videomode_from_timing); 31*6cd2c7dbSTomi Valkeinen 32*6cd2c7dbSTomi Valkeinen int videomode_from_timings(const struct display_timings *disp, 33*6cd2c7dbSTomi Valkeinen struct videomode *vm, unsigned int index) 34*6cd2c7dbSTomi Valkeinen { 35*6cd2c7dbSTomi Valkeinen struct display_timing *dt; 36*6cd2c7dbSTomi Valkeinen 37*6cd2c7dbSTomi Valkeinen dt = display_timings_get(disp, index); 38*6cd2c7dbSTomi Valkeinen if (!dt) 39*6cd2c7dbSTomi Valkeinen return -EINVAL; 40*6cd2c7dbSTomi Valkeinen 41*6cd2c7dbSTomi Valkeinen videomode_from_timing(dt, vm); 428714c0ceSSteffen Trumtrar 438714c0ceSSteffen Trumtrar return 0; 448714c0ceSSteffen Trumtrar } 45*6cd2c7dbSTomi Valkeinen EXPORT_SYMBOL_GPL(videomode_from_timings); 46