1*55716d26SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 28714c0ceSSteffen Trumtrar /* 38714c0ceSSteffen Trumtrar * generic display timing functions 48714c0ceSSteffen Trumtrar * 58714c0ceSSteffen Trumtrar * Copyright (c) 2012 Steffen Trumtrar <s.trumtrar@pengutronix.de>, Pengutronix 68714c0ceSSteffen Trumtrar */ 78714c0ceSSteffen Trumtrar 88714c0ceSSteffen Trumtrar #include <linux/errno.h> 98714c0ceSSteffen Trumtrar #include <linux/export.h> 108714c0ceSSteffen Trumtrar #include <video/display_timing.h> 118714c0ceSSteffen Trumtrar #include <video/videomode.h> 128714c0ceSSteffen Trumtrar videomode_from_timing(const struct display_timing * dt,struct videomode * vm)136cd2c7dbSTomi Valkeinenvoid videomode_from_timing(const struct display_timing *dt, 146cd2c7dbSTomi Valkeinen struct videomode *vm) 158714c0ceSSteffen Trumtrar { 16694f0506STomi Valkeinen vm->pixelclock = dt->pixelclock.typ; 17694f0506STomi Valkeinen vm->hactive = dt->hactive.typ; 18694f0506STomi Valkeinen vm->hfront_porch = dt->hfront_porch.typ; 19694f0506STomi Valkeinen vm->hback_porch = dt->hback_porch.typ; 20694f0506STomi Valkeinen vm->hsync_len = dt->hsync_len.typ; 218714c0ceSSteffen Trumtrar 22694f0506STomi Valkeinen vm->vactive = dt->vactive.typ; 23694f0506STomi Valkeinen vm->vfront_porch = dt->vfront_porch.typ; 24694f0506STomi Valkeinen vm->vback_porch = dt->vback_porch.typ; 25694f0506STomi Valkeinen vm->vsync_len = dt->vsync_len.typ; 268714c0ceSSteffen Trumtrar 2706a33079STomi Valkeinen vm->flags = dt->flags; 286cd2c7dbSTomi Valkeinen } 296cd2c7dbSTomi Valkeinen EXPORT_SYMBOL_GPL(videomode_from_timing); 306cd2c7dbSTomi Valkeinen videomode_from_timings(const struct display_timings * disp,struct videomode * vm,unsigned int index)316cd2c7dbSTomi Valkeinenint videomode_from_timings(const struct display_timings *disp, 326cd2c7dbSTomi Valkeinen struct videomode *vm, unsigned int index) 336cd2c7dbSTomi Valkeinen { 346cd2c7dbSTomi Valkeinen struct display_timing *dt; 356cd2c7dbSTomi Valkeinen 366cd2c7dbSTomi Valkeinen dt = display_timings_get(disp, index); 376cd2c7dbSTomi Valkeinen if (!dt) 386cd2c7dbSTomi Valkeinen return -EINVAL; 396cd2c7dbSTomi Valkeinen 406cd2c7dbSTomi Valkeinen videomode_from_timing(dt, vm); 418714c0ceSSteffen Trumtrar 428714c0ceSSteffen Trumtrar return 0; 438714c0ceSSteffen Trumtrar } 446cd2c7dbSTomi Valkeinen EXPORT_SYMBOL_GPL(videomode_from_timings); 45