diff options
author | Adam Jackson <ajax@redhat.com> | 2009-12-03 17:44:37 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-12-04 08:53:22 +1000 |
commit | 7ac96a9cb4982140e206bf3b58236efb2498ab3f (patch) | |
tree | 63d6a6387f18ed022f4f6bf4dd6b918312bbf977 /drivers/gpu/drm/drm_modes.c | |
parent | 9cf00977da092096c7a983276dad8b3002d23a99 (diff) | |
download | kernel_samsung_smdk4412-7ac96a9cb4982140e206bf3b58236efb2498ab3f.zip kernel_samsung_smdk4412-7ac96a9cb4982140e206bf3b58236efb2498ab3f.tar.gz kernel_samsung_smdk4412-7ac96a9cb4982140e206bf3b58236efb2498ab3f.tar.bz2 |
drm/modes: Add drm_mode_hsync()
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_modes.c')
-rw-r--r-- | drivers/gpu/drm/drm_modes.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 51f6772..6d81a02 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -553,6 +553,32 @@ int drm_mode_height(struct drm_display_mode *mode) } EXPORT_SYMBOL(drm_mode_height); +/** drm_mode_hsync - get the hsync of a mode + * @mode: mode + * + * LOCKING: + * None. + * + * Return @modes's hsync rate in kHz, rounded to the nearest int. + */ +int drm_mode_hsync(struct drm_display_mode *mode) +{ + unsigned int calc_val; + + if (mode->hsync) + return mode->hsync; + + if (mode->htotal < 0) + return 0; + + calc_val = (mode->clock * 1000) / mode->htotal; /* hsync in Hz */ + calc_val += 500; /* round to 1000Hz */ + calc_val /= 1000; /* truncate to kHz */ + + return calc_val; +} +EXPORT_SYMBOL(drm_mode_hsync); + /** * drm_mode_vrefresh - get the vrefresh of a mode * @mode: mode @@ -560,7 +586,7 @@ EXPORT_SYMBOL(drm_mode_height); * LOCKING: * None. * - * Return @mode's vrefresh rate or calculate it if necessary. + * Return @mode's vrefresh rate in Hz or calculate it if necessary. * * FIXME: why is this needed? shouldn't vrefresh be set already? * |