diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gpu/drm/exynos/exynos_hdmi.c | 68 |
1 files changed, 24 insertions, 44 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index f9c4de16d91a..a3fe2f06b80c 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
| @@ -169,14 +169,9 @@ struct hdmi_v14_conf { | |||
| 169 | struct hdmi_tg_regs tg; | 169 | struct hdmi_tg_regs tg; |
| 170 | }; | 170 | }; |
| 171 | 171 | ||
| 172 | struct hdmi_conf_regs { | 172 | union hdmi_conf_regs { |
| 173 | int pixel_clock; | 173 | struct hdmi_v13_conf v13_conf; |
| 174 | int cea_video_id; | 174 | struct hdmi_v14_conf v14_conf; |
| 175 | enum hdmi_picture_aspect aspect_ratio; | ||
| 176 | union { | ||
| 177 | struct hdmi_v13_conf v13_conf; | ||
| 178 | struct hdmi_v14_conf v14_conf; | ||
| 179 | } conf; | ||
| 180 | }; | 175 | }; |
| 181 | 176 | ||
| 182 | struct hdmi_context { | 177 | struct hdmi_context { |
| @@ -197,7 +192,8 @@ struct hdmi_context { | |||
| 197 | 192 | ||
| 198 | /* current hdmiphy conf regs */ | 193 | /* current hdmiphy conf regs */ |
| 199 | struct drm_display_mode current_mode; | 194 | struct drm_display_mode current_mode; |
| 200 | struct hdmi_conf_regs mode_conf; | 195 | u8 cea_video_id; |
| 196 | union hdmi_conf_regs mode_conf; | ||
| 201 | 197 | ||
| 202 | struct hdmi_resources res; | 198 | struct hdmi_resources res; |
| 203 | const struct hdmi_driver_data *drv_data; | 199 | const struct hdmi_driver_data *drv_data; |
| @@ -951,7 +947,7 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, | |||
| 951 | u32 hdr_sum; | 947 | u32 hdr_sum; |
| 952 | u8 chksum; | 948 | u8 chksum; |
| 953 | u32 mod; | 949 | u32 mod; |
| 954 | u32 vic; | 950 | u8 ar; |
| 955 | 951 | ||
| 956 | mod = hdmi_reg_read(hdata, HDMI_MODE_SEL); | 952 | mod = hdmi_reg_read(hdata, HDMI_MODE_SEL); |
| 957 | if (hdata->dvi_mode) { | 953 | if (hdata->dvi_mode) { |
| @@ -982,27 +978,22 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, | |||
| 982 | * Set the aspect ratio as per the mode, mentioned in | 978 | * Set the aspect ratio as per the mode, mentioned in |
| 983 | * Table 9 AVI InfoFrame Data Byte 2 of CEA-861-D Standard | 979 | * Table 9 AVI InfoFrame Data Byte 2 of CEA-861-D Standard |
| 984 | */ | 980 | */ |
| 985 | switch (hdata->mode_conf.aspect_ratio) { | 981 | ar = hdata->current_mode.picture_aspect_ratio; |
| 982 | switch (ar) { | ||
| 986 | case HDMI_PICTURE_ASPECT_4_3: | 983 | case HDMI_PICTURE_ASPECT_4_3: |
| 987 | hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2), | 984 | ar |= AVI_4_3_CENTER_RATIO; |
| 988 | hdata->mode_conf.aspect_ratio | | ||
| 989 | AVI_4_3_CENTER_RATIO); | ||
| 990 | break; | 985 | break; |
| 991 | case HDMI_PICTURE_ASPECT_16_9: | 986 | case HDMI_PICTURE_ASPECT_16_9: |
| 992 | hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2), | 987 | ar |= AVI_16_9_CENTER_RATIO; |
| 993 | hdata->mode_conf.aspect_ratio | | ||
| 994 | AVI_16_9_CENTER_RATIO); | ||
| 995 | break; | 988 | break; |
| 996 | case HDMI_PICTURE_ASPECT_NONE: | 989 | case HDMI_PICTURE_ASPECT_NONE: |
| 997 | default: | 990 | default: |
| 998 | hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2), | 991 | ar |= AVI_SAME_AS_PIC_ASPECT_RATIO; |
| 999 | hdata->mode_conf.aspect_ratio | | ||
| 1000 | AVI_SAME_AS_PIC_ASPECT_RATIO); | ||
| 1001 | break; | 992 | break; |
| 1002 | } | 993 | } |
| 994 | hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2), ar); | ||
| 1003 | 995 | ||
| 1004 | vic = hdata->mode_conf.cea_video_id; | 996 | hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(4), hdata->cea_video_id); |
| 1005 | hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(4), vic); | ||
| 1006 | 997 | ||
| 1007 | chksum = hdmi_chksum(hdata, HDMI_AVI_BYTE(1), | 998 | chksum = hdmi_chksum(hdata, HDMI_AVI_BYTE(1), |
| 1008 | infoframe->any.length, hdr_sum); | 999 | infoframe->any.length, hdr_sum); |
| @@ -1418,9 +1409,8 @@ static void hdmi_conf_init(struct hdmi_context *hdata) | |||
| 1418 | 1409 | ||
| 1419 | static void hdmi_v13_mode_apply(struct hdmi_context *hdata) | 1410 | static void hdmi_v13_mode_apply(struct hdmi_context *hdata) |
| 1420 | { | 1411 | { |
| 1421 | const struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v13_conf.tg; | 1412 | const struct hdmi_tg_regs *tg = &hdata->mode_conf.v13_conf.tg; |
| 1422 | const struct hdmi_v13_core_regs *core = | 1413 | const struct hdmi_v13_core_regs *core = &hdata->mode_conf.v13_conf.core; |
| 1423 | &hdata->mode_conf.conf.v13_conf.core; | ||
| 1424 | int tries; | 1414 | int tries; |
| 1425 | 1415 | ||
| 1426 | /* setting core registers */ | 1416 | /* setting core registers */ |
| @@ -1502,9 +1492,8 @@ static void hdmi_v13_mode_apply(struct hdmi_context *hdata) | |||
| 1502 | 1492 | ||
| 1503 | static void hdmi_v14_mode_apply(struct hdmi_context *hdata) | 1493 | static void hdmi_v14_mode_apply(struct hdmi_context *hdata) |
| 1504 | { | 1494 | { |
| 1505 | const struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v14_conf.tg; | 1495 | const struct hdmi_tg_regs *tg = &hdata->mode_conf.v14_conf.tg; |
| 1506 | const struct hdmi_v14_core_regs *core = | 1496 | const struct hdmi_v14_core_regs *core = &hdata->mode_conf.v14_conf.core; |
| 1507 | &hdata->mode_conf.conf.v14_conf.core; | ||
| 1508 | int tries; | 1497 | int tries; |
| 1509 | 1498 | ||
| 1510 | /* setting core registers */ | 1499 | /* setting core registers */ |
| @@ -1742,7 +1731,7 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata) | |||
| 1742 | int i; | 1731 | int i; |
| 1743 | 1732 | ||
| 1744 | /* pixel clock */ | 1733 | /* pixel clock */ |
| 1745 | i = hdmi_find_phy_conf(hdata, hdata->mode_conf.pixel_clock); | 1734 | i = hdmi_find_phy_conf(hdata, hdata->current_mode.clock * 1000); |
| 1746 | if (i < 0) { | 1735 | if (i < 0) { |
| 1747 | DRM_ERROR("failed to find hdmiphy conf\n"); | 1736 | DRM_ERROR("failed to find hdmiphy conf\n"); |
| 1748 | return; | 1737 | return; |
| @@ -1794,15 +1783,10 @@ static void hdmi_set_reg(u8 *reg_pair, int num_bytes, u32 value) | |||
| 1794 | static void hdmi_v13_mode_set(struct hdmi_context *hdata, | 1783 | static void hdmi_v13_mode_set(struct hdmi_context *hdata, |
| 1795 | struct drm_display_mode *m) | 1784 | struct drm_display_mode *m) |
| 1796 | { | 1785 | { |
| 1797 | struct hdmi_v13_core_regs *core = &hdata->mode_conf.conf.v13_conf.core; | 1786 | struct hdmi_v13_core_regs *core = &hdata->mode_conf.v13_conf.core; |
| 1798 | struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v13_conf.tg; | 1787 | struct hdmi_tg_regs *tg = &hdata->mode_conf.v13_conf.tg; |
| 1799 | unsigned int val; | 1788 | unsigned int val; |
| 1800 | 1789 | ||
| 1801 | hdata->mode_conf.cea_video_id = | ||
| 1802 | drm_match_cea_mode((struct drm_display_mode *)m); | ||
| 1803 | hdata->mode_conf.pixel_clock = m->clock * 1000; | ||
| 1804 | hdata->mode_conf.aspect_ratio = m->picture_aspect_ratio; | ||
| 1805 | |||
| 1806 | hdmi_set_reg(core->h_blank, 2, m->htotal - m->hdisplay); | 1790 | hdmi_set_reg(core->h_blank, 2, m->htotal - m->hdisplay); |
| 1807 | hdmi_set_reg(core->h_v_line, 3, (m->htotal << 12) | m->vtotal); | 1791 | hdmi_set_reg(core->h_v_line, 3, (m->htotal << 12) | m->vtotal); |
| 1808 | 1792 | ||
| @@ -1891,14 +1875,8 @@ static void hdmi_v13_mode_set(struct hdmi_context *hdata, | |||
| 1891 | static void hdmi_v14_mode_set(struct hdmi_context *hdata, | 1875 | static void hdmi_v14_mode_set(struct hdmi_context *hdata, |
| 1892 | struct drm_display_mode *m) | 1876 | struct drm_display_mode *m) |
| 1893 | { | 1877 | { |
| 1894 | struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v14_conf.tg; | 1878 | struct hdmi_tg_regs *tg = &hdata->mode_conf.v14_conf.tg; |
| 1895 | struct hdmi_v14_core_regs *core = | 1879 | struct hdmi_v14_core_regs *core = &hdata->mode_conf.v14_conf.core; |
| 1896 | &hdata->mode_conf.conf.v14_conf.core; | ||
| 1897 | |||
| 1898 | hdata->mode_conf.cea_video_id = | ||
| 1899 | drm_match_cea_mode((struct drm_display_mode *)m); | ||
| 1900 | hdata->mode_conf.pixel_clock = m->clock * 1000; | ||
| 1901 | hdata->mode_conf.aspect_ratio = m->picture_aspect_ratio; | ||
| 1902 | 1880 | ||
| 1903 | hdmi_set_reg(core->h_blank, 2, m->htotal - m->hdisplay); | 1881 | hdmi_set_reg(core->h_blank, 2, m->htotal - m->hdisplay); |
| 1904 | hdmi_set_reg(core->v_line, 2, m->vtotal); | 1882 | hdmi_set_reg(core->v_line, 2, m->vtotal); |
| @@ -2014,6 +1992,8 @@ static void hdmi_mode_set(struct exynos_drm_display *display, | |||
| 2014 | /* preserve mode information for later use. */ | 1992 | /* preserve mode information for later use. */ |
| 2015 | drm_mode_copy(&hdata->current_mode, mode); | 1993 | drm_mode_copy(&hdata->current_mode, mode); |
| 2016 | 1994 | ||
| 1995 | hdata->cea_video_id = drm_match_cea_mode(mode); | ||
| 1996 | |||
| 2017 | if (hdata->drv_data->type == HDMI_TYPE13) | 1997 | if (hdata->drv_data->type == HDMI_TYPE13) |
| 2018 | hdmi_v13_mode_set(hdata, mode); | 1998 | hdmi_v13_mode_set(hdata, mode); |
| 2019 | else | 1999 | else |
