Skip to content

Commit 6cd2c7d

Browse files
committed
videomode: videomode_from_timing work
We currently have videomode_from_timing(), which takes one display_timing entry from display_timings. To make it easier to use display_timing without display_timings, this patch renames videomode_from_timing() to videomode_from_timings(), and adds a new videomode_from_timing() which just converts a given display_timing to videomode. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>
1 parent 694f050 commit 6cd2c7d

4 files changed

Lines changed: 31 additions & 13 deletions

File tree

‎drivers/gpu/drm/tilcdc/tilcdc_panel.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static int panel_connector_get_modes(struct drm_connector *connector)
173173
struct drm_display_mode *mode = drm_mode_create(dev);
174174
struct videomode vm;
175175

176-
if (videomode_from_timing(timings, &vm, i))
176+
if (videomode_from_timings(timings, &vm, i))
177177
break;
178178

179179
drm_display_mode_from_videomode(&vm, mode);

‎drivers/video/of_videomode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ int of_get_videomode(struct device_node *np, struct videomode *vm,
4343
if (index == OF_USE_NATIVE_MODE)
4444
index = disp->native_mode;
4545

46-
ret = videomode_from_timing(disp, vm, index);
46+
ret = videomode_from_timings(disp, vm, index);
4747
if (ret)
4848
return ret;
4949

‎drivers/video/videomode.c‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,9 @@
1111
#include <video/display_timing.h>
1212
#include <video/videomode.h>
1313

14-
int videomode_from_timing(const struct display_timings *disp,
15-
struct videomode *vm, unsigned int index)
14+
void videomode_from_timing(const struct display_timing *dt,
15+
struct videomode *vm)
1616
{
17-
struct display_timing *dt;
18-
19-
dt = display_timings_get(disp, index);
20-
if (!dt)
21-
return -EINVAL;
22-
2317
vm->pixelclock = dt->pixelclock.typ;
2418
vm->hactive = dt->hactive.typ;
2519
vm->hfront_porch = dt->hfront_porch.typ;
@@ -32,7 +26,20 @@ int videomode_from_timing(const struct display_timings *disp,
3226
vm->vsync_len = dt->vsync_len.typ;
3327

3428
vm->flags = dt->flags;
29+
}
30+
EXPORT_SYMBOL_GPL(videomode_from_timing);
31+
32+
int videomode_from_timings(const struct display_timings *disp,
33+
struct videomode *vm, unsigned int index)
34+
{
35+
struct display_timing *dt;
36+
37+
dt = display_timings_get(disp, index);
38+
if (!dt)
39+
return -EINVAL;
40+
41+
videomode_from_timing(dt, vm);
3542

3643
return 0;
3744
}
38-
EXPORT_SYMBOL_GPL(videomode_from_timing);
45+
EXPORT_SYMBOL_GPL(videomode_from_timings);

‎include/video/videomode.h‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,25 @@ struct videomode {
3434

3535
/**
3636
* videomode_from_timing - convert display timing to videomode
37+
* @dt: display_timing structure
38+
* @vm: return value
39+
*
40+
* DESCRIPTION:
41+
* This function converts a struct display_timing to a struct videomode.
42+
*/
43+
void videomode_from_timing(const struct display_timing *dt,
44+
struct videomode *vm);
45+
46+
/**
47+
* videomode_from_timings - convert one display timings entry to videomode
3748
* @disp: structure with all possible timing entries
3849
* @vm: return value
3950
* @index: index into the list of display timings in devicetree
4051
*
4152
* DESCRIPTION:
42-
* This function converts a struct display_timing to a struct videomode.
53+
* This function converts one struct display_timing entry to a struct videomode.
4354
*/
44-
int videomode_from_timing(const struct display_timings *disp,
55+
int videomode_from_timings(const struct display_timings *disp,
4556
struct videomode *vm, unsigned int index);
4657

4758
#endif

0 commit comments

Comments
 (0)