drm/exynos/hdmi: refactoring/cleanup patches
Subsystems (3)
cover drm/exynos/hdmi: refactoring/cleanup patches
Hi Inki, Joonyoung,
These patches removes obsolete and old structures, to simplify further development. They should not change behavior of the driver.
The patchset is based on exynos-drm-next plus my HDMI related fixes [1].
The patchset was tested on Universal and Odroid U3.
[1]: http://permalink.gmane.org/gmane.comp.video.dri.devel/132348
Regards
Andrzej
Andrzej Hajda (7):
drm/exynos/hdmi: remove old platform data code drm/exynos/hdmi: Simplify HPD gpio handling drm/exynos/hdmi: remove private lock code drm/exynos/hdmi: add driver data pointer to private context drm/exynos/hdmi: remove redundant configuration fields drm/exynos/hdmi: remove hdmi_v13_conf struct drm/exynos/hdmi: remove hdmi_v14_conf struct
drivers/gpu/drm/exynos/exynos_hdmi.c | 860 ++++++++++------------------------- 1 file changed, 245 insertions(+), 615 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/7 drm/exynos/hdmi: remove old platform data code
s5p_hdmi_platform_data were used before device tree introduction. As HDMI driver is DT only we can drop this struct completely.
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +5 -31
@@ -48,7 +48,6 @@#include "exynos_mixer.h" #include <linux/gpio.h> -#include <media/s5p_hdmi.h> #define ctx_from_connector (c) container_of(c, struct hdmi_context, connector)
@@ -2259,30 +2258,6 @@ fail:return ret; } -static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata - (struct device *dev) -{ -struct device_node *np = dev->of_node; -struct s5p_hdmi_platform_data *pd; -u32 value; - - pd =devm_kzalloc (dev,sizeof (*pd),GFP_KERNEL ); -if (!pd) - goto err_data; - -if (!of_find_property (np,"hpd-gpio" , &value)) { -DRM_ERROR ("no hpd gpio property found\n" ); - goto err_data; - } - - pd->hpd_gpio =of_get_named_gpio (np,"hpd-gpio" ,0 ); - -return pd; - -err_data: -return NULL ; -} -static struct of_device_id hdmi_match_types[] = { { .compatible ="samsung,exynos5-hdmi" ,
@@ -2343,7 +2318,6 @@ static struct device_node *hdmi_legacy_phy_dt_binding(struct device *dev)static int hdmi_probe (struct platform_device *pdev) {struct device_node *ddc_node, *phy_node; -struct s5p_hdmi_platform_data *pdata;struct hdmi_driver_data *drv_data;const struct of_device_id *match;struct device *dev = &pdev->dev;
@@ -2354,10 +2328,6 @@ static int hdmi_probe(struct platform_device *pdev)if (!dev->of_node)return -ENODEV ; - pdata =drm_hdmi_dt_parse_pdata (dev); -if (!pdata) -return -EINVAL ; - hdata =devm_kzalloc (dev,sizeof (struct hdmi_context ),GFP_KERNEL );if (!hdata)return -ENOMEM ;
@@ -2378,8 +2348,12 @@ static int hdmi_probe(struct platform_device *pdev) hdata->phy_confs = drv_data->phy_confs; hdata->phy_conf_count = drv_data->phy_conf_count; - hdata->hpd_gpio = pdata->hpd_gpio; hdata->dev = dev; + hdata->hpd_gpio =of_get_named_gpio (dev->of_node,"hpd-gpio" ,0 ); +if (hdata->hpd_gpio <0 ) { +DRM_ERROR ("cannot get hpd gpio property\n" ); +return hdata->hpd_gpio; + } ret =hdmi_resources_init (hdata);if (ret) {
Signature · 1 line
1.9.1
PATCH 2/7 drm/exynos/hdmi: Simplify HPD gpio handling
In reply to Andrzej HajdaGPIO is tested only in hdmi_detect, so there is no reason to set it in other places and to preserve its value in context.
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +3 -10
@@ -186,7 +186,6 @@ struct hdmi_context {struct drm_device *drm_dev;struct drm_connector connector;struct drm_encoder *encoder; -bool hpd;bool powered;bool dvi_mode;struct mutex hdmi_mutex;
@@ -1037,10 +1036,10 @@ static enum drm_connector_status hdmi_detect(struct drm_connector *connector, {struct hdmi_context *hdata =ctx_from_connector (connector); - hdata->hpd =gpio_get_value (hdata->hpd_gpio); +if (gpio_get_value (hdata->hpd_gpio)) +return connector_status_connected; -return hdata->hpd ? connector_status_connected : - connector_status_disconnected; +return connector_status_disconnected; }static void hdmi_connector_destroy (struct drm_connector *connector)
@@ -2156,10 +2155,6 @@ static void hdmi_hotplug_work_func(struct work_struct *work) hdata = container_of(work, struct hdmi_context, hotplug_work.work); -mutex_lock (&hdata->hdmi_mutex); - hdata->hpd =gpio_get_value (hdata->hpd_gpio); -mutex_unlock (&hdata->hdmi_mutex); -if (hdata->drm_dev)drm_helper_hpd_irq_event (hdata->drm_dev); }
@@ -2428,8 +2423,6 @@ out_get_phy_port: goto err_hdmiphy; } - hdata->hpd =gpio_get_value (hdata->hpd_gpio); -INIT_DELAYED_WORK (&hdata->hotplug_work, hdmi_hotplug_work_func); ret = devm_request_threaded_irq(dev, hdata->irq, NULL,
Signature · 1 line
1.9.1
PATCH 3/7 drm/exynos/hdmi: remove private lock code
In reply to Andrzej HajdaMost of the code is called by drm core framework, so it is already synchronized. The only async function is irq routine which only calls drm framework so it does not need to be synchronized.
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +3 -24
@@ -22,7 +22,6 @@#include "regs-hdmi.h" #include <linux/kernel.h> -#include <linux/spinlock.h> #include <linux/wait.h> #include <linux/i2c.h> #include <linux/platform_device.h>
@@ -188,7 +187,6 @@ struct hdmi_context {struct drm_encoder *encoder;bool powered;bool dvi_mode; -struct mutex hdmi_mutex;void __iomem *regs;int irq;
@@ -1774,10 +1772,8 @@ static void hdmi_conf_apply(struct hdmi_context *hdata)hdmiphy_conf_reset (hdata);hdmiphy_conf_apply (hdata); -mutex_lock (&hdata->hdmi_mutex);hdmi_start (hdata, false);hdmi_conf_init (hdata); -mutex_unlock (&hdata->hdmi_mutex);hdmi_audio_init (hdata);
@@ -2029,12 +2025,8 @@ static void hdmi_commit(struct exynos_drm_display *display) {struct hdmi_context *hdata =display_to_hdmi (display); -mutex_lock (&hdata->hdmi_mutex); -if (!hdata->powered) { -mutex_unlock (&hdata->hdmi_mutex); +if (!hdata->powered)return ; - } -mutex_unlock (&hdata->hdmi_mutex);hdmi_conf_apply (hdata); }
@@ -2043,16 +2035,11 @@ static void hdmi_poweron(struct hdmi_context *hdata) {struct hdmi_resources *res = &hdata->res; -mutex_lock (&hdata->hdmi_mutex); -if (hdata->powered) { -mutex_unlock (&hdata->hdmi_mutex); +if (hdata->powered)return ; - } hdata->powered = true; -mutex_unlock (&hdata->hdmi_mutex); -pm_runtime_get_sync (hdata->dev);if (regulator_bulk_enable (res->regul_count, res->regul_bulk))
@@ -2073,10 +2060,8 @@ static void hdmi_poweroff(struct hdmi_context *hdata) {struct hdmi_resources *res = &hdata->res; -mutex_lock (&hdata->hdmi_mutex);if (!hdata->powered) - goto out; -mutex_unlock (&hdata->hdmi_mutex); +return ;/* HDMI System Disable */ hdmi_reg_writemask (hdata,HDMI_CON_0 ,0 ,HDMI_EN );
@@ -2096,11 +2081,7 @@ static void hdmi_poweroff(struct hdmi_context *hdata)pm_runtime_put_sync (hdata->dev); -mutex_lock (&hdata->hdmi_mutex); hdata->powered = false; - -out: -mutex_unlock (&hdata->hdmi_mutex); }static void hdmi_dpms (struct exynos_drm_display *display,int mode)
@@ -2330,8 +2311,6 @@ static int hdmi_probe(struct platform_device *pdev) hdata->display.type =EXYNOS_DISPLAY_TYPE_HDMI ; hdata->display.ops = &hdmi_display_ops; -mutex_init (&hdata->hdmi_mutex); -platform_set_drvdata (pdev, hdata); match =of_match_node (hdmi_match_types, dev->of_node);
Signature · 1 line
1.9.1
PATCH 4/7 drm/exynos/hdmi: add driver data pointer to private context
In reply to Andrzej HajdaThe patch replaces duplicated driver data fields in private context with pointer to driver data. It also simplifies driver data lookup code.
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 49 +++++++++++++++--------------------- 1 file changed, 20 insertions(+), 29 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +20 -29
@@ -32,8 +32,8 @@#include <linux/clk.h> #include <linux/regulator/consumer.h> #include <linux/io.h> -#include <linux/of.h> #include <linux/of_address.h> +#include <linux/of_device.h> #include <linux/of_gpio.h> #include <linux/hdmi.h> #include <linux/component.h>
@@ -200,14 +200,12 @@ struct hdmi_context {struct hdmi_conf_regs mode_conf;struct hdmi_resources res; +const struct hdmi_driver_data *drv_data;int hpd_gpio;void __iomem *regs_hdmiphy; -const struct hdmiphy_config *phy_confs; -unsigned int phy_conf_count;struct regmap *pmureg; -enum hdmi_type type; };static inline struct hdmi_context *display_to_hdmi (struct exynos_drm_display *d)
@@ -926,7 +924,7 @@ static void hdmi_v14_regs_dump(struct hdmi_context *hdata, char *prefix)static void hdmi_regs_dump (struct hdmi_context *hdata,char *prefix) { -if (hdata->type ==HDMI_TYPE13 ) +if (hdata->drv_data->type ==HDMI_TYPE13 )hdmi_v13_regs_dump (hdata, prefix);else hdmi_v14_regs_dump (hdata, prefix);
@@ -1087,8 +1085,8 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock) {int i; -for (i =0 ; i < hdata->phy_conf_count; i++) -if (hdata->phy_confs[i].pixel_clock == pixel_clock) +for (i =0 ; i < hdata->drv_data->phy_conf_count; i++) +if (hdata->drv_data->phy_confs[i].pixel_clock == pixel_clock)return i;DRM_DEBUG_KMS ("Could not find phy config for %d\n" , pixel_clock);
@@ -1253,7 +1251,7 @@ static void hdmi_reg_acr(struct hdmi_context *hdata, u8 *acr)hdmi_reg_writeb (hdata,HDMI_ACR_CTS1 , acr[2 ]);hdmi_reg_writeb (hdata,HDMI_ACR_CTS2 , acr[1 ]); -if (hdata->type ==HDMI_TYPE13 ) +if (hdata->drv_data->type ==HDMI_TYPE13 )hdmi_reg_writeb (hdata,HDMI_V13_ACR_CON ,4 );else hdmi_reg_writeb (hdata,HDMI_ACR_CON ,4 );
@@ -1387,7 +1385,7 @@ static void hdmi_conf_init(struct hdmi_context *hdata) HDMI_VID_PREAMBLE_DIS | HDMI_GUARD_BAND_DIS); } -if (hdata->type ==HDMI_TYPE13 ) { +if (hdata->drv_data->type ==HDMI_TYPE13 ) {/* choose bluescreen (fecal) color */ hdmi_reg_writeb (hdata,HDMI_V13_BLUE_SCREEN_0 ,0x12 );hdmi_reg_writeb (hdata,HDMI_V13_BLUE_SCREEN_1 ,0x34 );
@@ -1666,7 +1664,7 @@ static void hdmi_v14_mode_apply(struct hdmi_context *hdata)static void hdmi_mode_apply (struct hdmi_context *hdata) { -if (hdata->type ==HDMI_TYPE13 ) +if (hdata->drv_data->type ==HDMI_TYPE13 )hdmi_v13_mode_apply (hdata);else hdmi_v14_mode_apply (hdata);
@@ -1684,7 +1682,7 @@ static void hdmiphy_conf_reset(struct hdmi_context *hdata)hdmiphy_reg_writeb (hdata,HDMIPHY_MODE_SET_DONE ,HDMI_PHY_ENABLE_MODE_SET ); -if (hdata->type ==HDMI_TYPE13 ) +if (hdata->drv_data->type ==HDMI_TYPE13 ) reg =HDMI_V13_PHY_RSTOUT ;else reg =HDMI_PHY_RSTOUT ;
@@ -1698,7 +1696,7 @@ static void hdmiphy_conf_reset(struct hdmi_context *hdata)static void hdmiphy_poweron (struct hdmi_context *hdata) { -if (hdata->type !=HDMI_TYPE14 ) +if (hdata->drv_data->type !=HDMI_TYPE14 )return ;DRM_DEBUG_KMS ("\n" );
@@ -1718,7 +1716,7 @@ static void hdmiphy_poweron(struct hdmi_context *hdata)static void hdmiphy_poweroff (struct hdmi_context *hdata) { -if (hdata->type !=HDMI_TYPE14 ) +if (hdata->drv_data->type !=HDMI_TYPE14 )return ;DRM_DEBUG_KMS ("\n" );
@@ -1750,7 +1748,8 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata)return ; } - ret =hdmiphy_reg_write_buf (hdata,0 , hdata->phy_confs[i].conf,32 ); + ret =hdmiphy_reg_write_buf (hdata,0 , + hdata->drv_data->phy_confs[i].conf,32 );if (ret) {DRM_ERROR ("failed to configure hdmiphy\n" );return ;
@@ -2015,7 +2014,7 @@ static void hdmi_mode_set(struct exynos_drm_display *display,/* preserve mode information for later use. */ drm_mode_copy (&hdata->current_mode, mode); -if (hdata->type ==HDMI_TYPE13 ) +if (hdata->drv_data->type ==HDMI_TYPE13 )hdmi_v13_mode_set (hdata, mode);else hdmi_v14_mode_set (hdata, mode);
@@ -2294,34 +2293,26 @@ static struct device_node *hdmi_legacy_phy_dt_binding(struct device *dev)static int hdmi_probe (struct platform_device *pdev) {struct device_node *ddc_node, *phy_node; -struct hdmi_driver_data *drv_data;const struct of_device_id *match;struct device *dev = &pdev->dev;struct hdmi_context *hdata;struct resource *res;int ret; -if (!dev->of_node) -return -ENODEV ; - hdata =devm_kzalloc (dev,sizeof (struct hdmi_context ),GFP_KERNEL );if (!hdata)return -ENOMEM ; + match =of_match_device (hdmi_match_types, dev); +if (!match) +return -ENODEV ; + + hdata->drv_data = match->data; hdata->display.type =EXYNOS_DISPLAY_TYPE_HDMI ; hdata->display.ops = &hdmi_display_ops;platform_set_drvdata (pdev, hdata); - match =of_match_node (hdmi_match_types, dev->of_node); -if (!match) -return -ENODEV ; - - drv_data = (struct hdmi_driver_data *)match->data; - hdata->type = drv_data->type; - hdata->phy_confs = drv_data->phy_confs; - hdata->phy_conf_count = drv_data->phy_conf_count; - hdata->dev = dev; hdata->hpd_gpio =of_get_named_gpio (dev->of_node,"hpd-gpio" ,0 );if (hdata->hpd_gpio <0 ) {
@@ -2379,7 +2370,7 @@ out_get_ddc_adpt: } out_get_phy_port: -if (drv_data->is_apb_phy) { +if (hdata->drv_data->is_apb_phy) { hdata->regs_hdmiphy =of_iomap (phy_node,0 );if (!hdata->regs_hdmiphy) {DRM_ERROR ("failed to ioremap hdmi phy\n" );
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/7 drm/exynos/hdmi: remove redundant configuration fields
In reply to Andrzej HajdaThe patch removes redundant fields from hdmi_conf_regs. Their values can be calculated from current_mode. This patch is the first step to remove whole hdmi_conf_regs structure.
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 68 +++++++++++++----------------------- 1 file changed, 24 insertions(+), 44 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +24 -44
@@ -169,14 +169,9 @@ struct hdmi_v14_conf {struct hdmi_tg_regs tg; }; -struct hdmi_conf_regs { -int pixel_clock; -int cea_video_id; -enum hdmi_picture_aspect aspect_ratio; -union { -struct hdmi_v13_conf v13_conf; -struct hdmi_v14_conf v14_conf; - } conf; +union hdmi_conf_regs { +struct hdmi_v13_conf v13_conf; +struct hdmi_v14_conf v14_conf; };struct hdmi_context {
@@ -197,7 +192,8 @@ struct hdmi_context {/* current hdmiphy conf regs */ struct drm_display_mode current_mode; -struct hdmi_conf_regs mode_conf; +u8 cea_video_id; +union hdmi_conf_regs mode_conf;struct hdmi_resources res;const struct hdmi_driver_data *drv_data;
@@ -951,7 +947,7 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata,u32 hdr_sum;u8 chksum;u32 mod; -u32 vic; +u8 ar; mod =hdmi_reg_read (hdata,HDMI_MODE_SEL );if (hdata->dvi_mode) {
@@ -982,27 +978,22 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata,* Set the aspect ratio as per the mode, mentioned in * Table 9 AVI InfoFrame Data Byte 2 of CEA-861-D Standard */ -switch (hdata->mode_conf.aspect_ratio) { + ar = hdata->current_mode.picture_aspect_ratio; +switch (ar) {case HDMI_PICTURE_ASPECT_4_3 : -hdmi_reg_writeb (hdata,HDMI_AVI_BYTE (2 ), - hdata->mode_conf.aspect_ratio | -AVI_4_3_CENTER_RATIO ); + ar |=AVI_4_3_CENTER_RATIO ;break ;case HDMI_PICTURE_ASPECT_16_9 : -hdmi_reg_writeb (hdata,HDMI_AVI_BYTE (2 ), - hdata->mode_conf.aspect_ratio | -AVI_16_9_CENTER_RATIO ); + ar |=AVI_16_9_CENTER_RATIO ;break ;case HDMI_PICTURE_ASPECT_NONE :default : -hdmi_reg_writeb (hdata,HDMI_AVI_BYTE (2 ), - hdata->mode_conf.aspect_ratio | -AVI_SAME_AS_PIC_ASPECT_RATIO ); + ar |=AVI_SAME_AS_PIC_ASPECT_RATIO ;break ; } +hdmi_reg_writeb (hdata,HDMI_AVI_BYTE (2 ), ar); - vic = hdata->mode_conf.cea_video_id; -hdmi_reg_writeb (hdata,HDMI_AVI_BYTE (4 ), vic); +hdmi_reg_writeb (hdata,HDMI_AVI_BYTE (4 ), hdata->cea_video_id); chksum =hdmi_chksum (hdata,HDMI_AVI_BYTE (1 ), infoframe->any.length, hdr_sum);
@@ -1418,9 +1409,8 @@ static void hdmi_conf_init(struct hdmi_context *hdata)static void hdmi_v13_mode_apply (struct hdmi_context *hdata) { -const struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v13_conf.tg; -const struct hdmi_v13_core_regs *core = - &hdata->mode_conf.conf.v13_conf.core; +const struct hdmi_tg_regs *tg = &hdata->mode_conf.v13_conf.tg; +const struct hdmi_v13_core_regs *core = &hdata->mode_conf.v13_conf.core;int tries;/* setting core registers */
@@ -1502,9 +1492,8 @@ static void hdmi_v13_mode_apply(struct hdmi_context *hdata)static void hdmi_v14_mode_apply (struct hdmi_context *hdata) { -const struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v14_conf.tg; -const struct hdmi_v14_core_regs *core = - &hdata->mode_conf.conf.v14_conf.core; +const struct hdmi_tg_regs *tg = &hdata->mode_conf.v14_conf.tg; +const struct hdmi_v14_core_regs *core = &hdata->mode_conf.v14_conf.core;int tries;/* setting core registers */
@@ -1742,7 +1731,7 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata)int i;/* pixel clock */ - i =hdmi_find_phy_conf (hdata, hdata->mode_conf.pixel_clock); + i =hdmi_find_phy_conf (hdata, hdata->current_mode.clock *1000 );if (i <0 ) {DRM_ERROR ("failed to find hdmiphy conf\n" );return ;
@@ -1794,15 +1783,10 @@ static void hdmi_set_reg(u8 *reg_pair, int num_bytes, u32 value)static void hdmi_v13_mode_set (struct hdmi_context *hdata,struct drm_display_mode *m) { -struct hdmi_v13_core_regs *core = &hdata->mode_conf.conf.v13_conf.core; -struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v13_conf.tg; +struct hdmi_v13_core_regs *core = &hdata->mode_conf.v13_conf.core; +struct hdmi_tg_regs *tg = &hdata->mode_conf.v13_conf.tg;unsigned int val; - hdata->mode_conf.cea_video_id = -drm_match_cea_mode ((struct drm_display_mode *)m); - hdata->mode_conf.pixel_clock = m->clock *1000 ; - hdata->mode_conf.aspect_ratio = m->picture_aspect_ratio; -hdmi_set_reg (core->h_blank,2 , m->htotal - m->hdisplay);hdmi_set_reg (core->h_v_line,3 , (m->htotal <<12 ) | m->vtotal);
@@ -1891,14 +1875,8 @@ static void hdmi_v13_mode_set(struct hdmi_context *hdata,static void hdmi_v14_mode_set (struct hdmi_context *hdata,struct drm_display_mode *m) { -struct hdmi_tg_regs *tg = &hdata->mode_conf.conf.v14_conf.tg; -struct hdmi_v14_core_regs *core = - &hdata->mode_conf.conf.v14_conf.core; - - hdata->mode_conf.cea_video_id = -drm_match_cea_mode ((struct drm_display_mode *)m); - hdata->mode_conf.pixel_clock = m->clock *1000 ; - hdata->mode_conf.aspect_ratio = m->picture_aspect_ratio; +struct hdmi_tg_regs *tg = &hdata->mode_conf.v14_conf.tg; +struct hdmi_v14_core_regs *core = &hdata->mode_conf.v14_conf.core;hdmi_set_reg (core->h_blank,2 , m->htotal - m->hdisplay);hdmi_set_reg (core->v_line,2 , m->vtotal);
@@ -2014,6 +1992,8 @@ static void hdmi_mode_set(struct exynos_drm_display *display,/* preserve mode information for later use. */ drm_mode_copy (&hdata->current_mode, mode); + hdata->cea_video_id =drm_match_cea_mode (mode); +if (hdata->drv_data->type ==HDMI_TYPE13 )hdmi_v13_mode_set (hdata, mode);else
Signature · 1 line
1.9.1
PATCH 6/7 drm/exynos/hdmi: remove hdmi_v13_conf struct
In reply to Andrzej HajdaThe patch removes intermediate struct for HDMIv13 register configuration, instead registry values are calculated on the fly.
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 280 +++++++++++++---------------------- 1 file changed, 101 insertions(+), 179 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +101 -179
@@ -107,19 +107,6 @@ struct hdmi_tg_regs {u8 tg_3d[1 ]; }; -struct hdmi_v13_core_regs { -u8 h_blank[2 ]; -u8 v_blank[3 ]; -u8 h_v_line[3 ]; -u8 vsync_pol[1 ]; -u8 int_pro_mode[1 ]; -u8 v_blank_f[3 ]; -u8 h_sync_gen[3 ]; -u8 v_sync_gen1[3 ]; -u8 v_sync_gen2[3 ]; -u8 v_sync_gen3[3 ]; -}; -struct hdmi_v14_core_regs {u8 h_blank[2 ];u8 v2_blank[2 ];
@@ -159,21 +146,11 @@ struct hdmi_v14_core_regs {u8 vact_space_6[2 ]; }; -struct hdmi_v13_conf { -struct hdmi_v13_core_regs core; -struct hdmi_tg_regs tg; -}; -struct hdmi_v14_conf {struct hdmi_v14_core_regs core;struct hdmi_tg_regs tg; }; -union hdmi_conf_regs { -struct hdmi_v13_conf v13_conf; -struct hdmi_v14_conf v14_conf; -}; -struct hdmi_context {struct exynos_drm_display display;struct device *dev;
@@ -193,7 +170,7 @@ struct hdmi_context {/* current hdmiphy conf regs */ struct drm_display_mode current_mode;u8 cea_video_id; -union hdmi_conf_regs mode_conf; +struct hdmi_v14_conf mode_conf;struct hdmi_resources res;const struct hdmi_driver_data *drv_data;
@@ -614,6 +591,16 @@ static inline void hdmi_reg_writeb(struct hdmi_context *hdata,writeb (value, hdata->regs + reg_id); } +static inline void hdmi_reg_writev (struct hdmi_context *hdata,u32 reg_id, +int bytes,u32 val) +{ +while (--bytes >=0 ) { +writeb (val &0xff , hdata->regs + reg_id); + val >>=8 ; + reg_id +=4 ; + } +} +static inline void hdmi_reg_writemask (struct hdmi_context *hdata,u32 reg_id,u32 value,u32 mask) {
@@ -1409,65 +1396,94 @@ static void hdmi_conf_init(struct hdmi_context *hdata)static void hdmi_v13_mode_apply (struct hdmi_context *hdata) { -const struct hdmi_tg_regs *tg = &hdata->mode_conf.v13_conf.tg; -const struct hdmi_v13_core_regs *core = &hdata->mode_conf.v13_conf.core; +struct drm_display_mode *m = &hdata->current_mode; +unsigned int val;int tries; -/* setting core registers */ -hdmi_reg_writeb (hdata,HDMI_H_BLANK_0 , core->h_blank[0 ]); -hdmi_reg_writeb (hdata,HDMI_H_BLANK_1 , core->h_blank[1 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_BLANK_0 , core->v_blank[0 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_BLANK_1 , core->v_blank[1 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_BLANK_2 , core->v_blank[2 ]); -hdmi_reg_writeb (hdata,HDMI_V13_H_V_LINE_0 , core->h_v_line[0 ]); -hdmi_reg_writeb (hdata,HDMI_V13_H_V_LINE_1 , core->h_v_line[1 ]); -hdmi_reg_writeb (hdata,HDMI_V13_H_V_LINE_2 , core->h_v_line[2 ]); -hdmi_reg_writeb (hdata,HDMI_VSYNC_POL , core->vsync_pol[0 ]); -hdmi_reg_writeb (hdata,HDMI_INT_PRO_MODE , core->int_pro_mode[0 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_BLANK_F_0 , core->v_blank_f[0 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_BLANK_F_1 , core->v_blank_f[1 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_BLANK_F_2 , core->v_blank_f[2 ]); -hdmi_reg_writeb (hdata,HDMI_V13_H_SYNC_GEN_0 , core->h_sync_gen[0 ]); -hdmi_reg_writeb (hdata,HDMI_V13_H_SYNC_GEN_1 , core->h_sync_gen[1 ]); -hdmi_reg_writeb (hdata,HDMI_V13_H_SYNC_GEN_2 , core->h_sync_gen[2 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_SYNC_GEN_1_0 , core->v_sync_gen1[0 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_SYNC_GEN_1_1 , core->v_sync_gen1[1 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_SYNC_GEN_1_2 , core->v_sync_gen1[2 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_SYNC_GEN_2_0 , core->v_sync_gen2[0 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_SYNC_GEN_2_1 , core->v_sync_gen2[1 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_SYNC_GEN_2_2 , core->v_sync_gen2[2 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_SYNC_GEN_3_0 , core->v_sync_gen3[0 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_SYNC_GEN_3_1 , core->v_sync_gen3[1 ]); -hdmi_reg_writeb (hdata,HDMI_V13_V_SYNC_GEN_3_2 , core->v_sync_gen3[2 ]); +hdmi_reg_writev (hdata,HDMI_H_BLANK_0 ,2 , m->htotal - m->hdisplay); +hdmi_reg_writev (hdata,HDMI_V13_H_V_LINE_0 ,3 , + (m->htotal <<12 ) | m->vtotal); + + val = (m->flags &DRM_MODE_FLAG_NVSYNC ) ?1 :0 ; +hdmi_reg_writev (hdata,HDMI_VSYNC_POL ,1 , val); + + val = (m->flags &DRM_MODE_FLAG_INTERLACE ) ?1 :0 ; +hdmi_reg_writev (hdata,HDMI_INT_PRO_MODE ,1 , val); + + val = (m->hsync_start - m->hdisplay -2 ); + val |= ((m->hsync_end - m->hdisplay -2 ) <<10 ); + val |= ((m->flags &DRM_MODE_FLAG_NHSYNC ) ?1 :0 )<<20 ; +hdmi_reg_writev (hdata,HDMI_V13_H_SYNC_GEN_0 ,3 , val); + +/* +* Quirk requirement for exynos HDMI IP design, +* 2 pixels less than the actual calculation for hsync_start +* and end. +*/ + +/* Following values & calculations differ for different type of modes */ +if (m->flags &DRM_MODE_FLAG_INTERLACE ) { +/* Interlaced Mode */ + val = ((m->vsync_end - m->vdisplay) /2 ); + val |= ((m->vsync_start - m->vdisplay) /2 ) <<12 ; +hdmi_reg_writev (hdata,HDMI_V13_V_SYNC_GEN_1_0 ,3 , val); + + val = m->vtotal /2 ; + val |= ((m->vtotal - m->vdisplay) /2 ) <<11 ; +hdmi_reg_writev (hdata,HDMI_V13_V_BLANK_0 ,3 , val); + + val = (m->vtotal + + ((m->vsync_end - m->vsync_start) *4 ) +5 ) /2 ; + val |= m->vtotal <<11 ; +hdmi_reg_writev (hdata,HDMI_V13_V_BLANK_F_0 ,3 , val); + + val = ((m->vtotal /2 ) +7 ); + val |= ((m->vtotal /2 ) +2 ) <<12 ; +hdmi_reg_writev (hdata,HDMI_V13_V_SYNC_GEN_2_0 ,3 , val); + + val = ((m->htotal /2 ) + (m->hsync_start - m->hdisplay)); + val |= ((m->htotal /2 ) + + (m->hsync_start - m->hdisplay)) <<12 ; +hdmi_reg_writev (hdata,HDMI_V13_V_SYNC_GEN_3_0 ,3 , val); + +hdmi_reg_writev (hdata,HDMI_TG_VACT_ST_L ,2 , + (m->vtotal - m->vdisplay) /2 ); +hdmi_reg_writev (hdata,HDMI_TG_VACT_SZ_L ,2 , m->vdisplay /2 ); + +hdmi_reg_writev (hdata,HDMI_TG_VACT_ST2_L ,2 ,0x249 ); + }else { +/* Progressive Mode */ + + val = m->vtotal; + val |= (m->vtotal - m->vdisplay) <<11 ; +hdmi_reg_writev (hdata,HDMI_V13_V_BLANK_0 ,3 , val); + +hdmi_reg_writev (hdata,HDMI_V13_V_BLANK_F_0 ,3 ,0 ); + + val = (m->vsync_end - m->vdisplay); + val |= ((m->vsync_start - m->vdisplay) <<12 ); +hdmi_reg_writev (hdata,HDMI_V13_V_SYNC_GEN_1_0 ,3 , val); + +hdmi_reg_writev (hdata,HDMI_V13_V_SYNC_GEN_2_0 ,3 ,0x1001 ); +hdmi_reg_writev (hdata,HDMI_V13_V_SYNC_GEN_3_0 ,3 ,0x1001 ); +hdmi_reg_writev (hdata,HDMI_TG_VACT_ST_L ,2 , + m->vtotal - m->vdisplay); +hdmi_reg_writev (hdata,HDMI_TG_VACT_SZ_L ,2 , m->vdisplay); +hdmi_reg_writev (hdata,HDMI_TG_VACT_ST2_L ,2 ,0x248 ); + } +/* Timing generator registers */ -hdmi_reg_writeb (hdata,HDMI_TG_H_FSZ_L , tg->h_fsz[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_H_FSZ_H , tg->h_fsz[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_HACT_ST_L , tg->hact_st[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_HACT_ST_H , tg->hact_st[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_HACT_SZ_L , tg->hact_sz[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_HACT_SZ_H , tg->hact_sz[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_V_FSZ_L , tg->v_fsz[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_V_FSZ_H , tg->v_fsz[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC_L , tg->vsync[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC_H , tg->vsync[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC2_L , tg->vsync2[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC2_H , tg->vsync2[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_ST_L , tg->vact_st[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_ST_H , tg->vact_st[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_SZ_L , tg->vact_sz[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_SZ_H , tg->vact_sz[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_FIELD_CHG_L , tg->field_chg[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_FIELD_CHG_H , tg->field_chg[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_ST2_L , tg->vact_st2[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_ST2_H , tg->vact_st2[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC_TOP_HDMI_L , tg->vsync_top_hdmi[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC_TOP_HDMI_H , tg->vsync_top_hdmi[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC_BOT_HDMI_L , tg->vsync_bot_hdmi[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC_BOT_HDMI_H , tg->vsync_bot_hdmi[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_FIELD_TOP_HDMI_L , tg->field_top_hdmi[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_FIELD_TOP_HDMI_H , tg->field_top_hdmi[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_FIELD_BOT_HDMI_L , tg->field_bot_hdmi[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_FIELD_BOT_HDMI_H , tg->field_bot_hdmi[1 ]); +hdmi_reg_writev (hdata,HDMI_TG_H_FSZ_L ,2 , m->htotal); +hdmi_reg_writev (hdata,HDMI_TG_HACT_ST_L ,2 , m->htotal - m->hdisplay); +hdmi_reg_writev (hdata,HDMI_TG_HACT_SZ_L ,2 , m->hdisplay); +hdmi_reg_writev (hdata,HDMI_TG_V_FSZ_L ,2 , m->vtotal); +hdmi_reg_writev (hdata,HDMI_TG_VSYNC_L ,2 ,0x1 ); +hdmi_reg_writev (hdata,HDMI_TG_VSYNC2_L ,2 ,0x233 ); +hdmi_reg_writev (hdata,HDMI_TG_FIELD_CHG_L ,2 ,0x233 ); +hdmi_reg_writev (hdata,HDMI_TG_VSYNC_TOP_HDMI_L ,2 ,0x1 ); +hdmi_reg_writev (hdata,HDMI_TG_VSYNC_BOT_HDMI_L ,2 ,0x233 ); +hdmi_reg_writev (hdata,HDMI_TG_FIELD_TOP_HDMI_L ,2 ,0x1 ); +hdmi_reg_writev (hdata,HDMI_TG_FIELD_BOT_HDMI_L ,2 ,0x233 );/* waiting for HDMIPHY's PLL to get to steady state */ for (tries =100 ; tries; --tries) {
@@ -1492,8 +1508,8 @@ static void hdmi_v13_mode_apply(struct hdmi_context *hdata)static void hdmi_v14_mode_apply (struct hdmi_context *hdata) { -const struct hdmi_tg_regs *tg = &hdata->mode_conf.v14_conf.tg; -const struct hdmi_v14_core_regs *core = &hdata->mode_conf.v14_conf.core; +const struct hdmi_tg_regs *tg = &hdata->mode_conf.tg; +const struct hdmi_v14_core_regs *core = &hdata->mode_conf.core;int tries;/* setting core registers */
@@ -1780,103 +1796,11 @@ static void hdmi_set_reg(u8 *reg_pair, int num_bytes, u32 value) reg_pair[i] = (value >> (8 * i)) &0xff ; } -static void hdmi_v13_mode_set (struct hdmi_context *hdata, -struct drm_display_mode *m) -{ -struct hdmi_v13_core_regs *core = &hdata->mode_conf.v13_conf.core; -struct hdmi_tg_regs *tg = &hdata->mode_conf.v13_conf.tg; -unsigned int val; - -hdmi_set_reg (core->h_blank,2 , m->htotal - m->hdisplay); -hdmi_set_reg (core->h_v_line,3 , (m->htotal <<12 ) | m->vtotal); - - val = (m->flags &DRM_MODE_FLAG_NVSYNC ) ?1 :0 ; -hdmi_set_reg (core->vsync_pol,1 , val); - - val = (m->flags &DRM_MODE_FLAG_INTERLACE ) ?1 :0 ; -hdmi_set_reg (core->int_pro_mode,1 , val); - - val = (m->hsync_start - m->hdisplay -2 ); - val |= ((m->hsync_end - m->hdisplay -2 ) <<10 ); - val |= ((m->flags &DRM_MODE_FLAG_NHSYNC ) ?1 :0 )<<20 ; -hdmi_set_reg (core->h_sync_gen,3 , val); - -/* -* Quirk requirement for exynos HDMI IP design, -* 2 pixels less than the actual calculation for hsync_start -* and end. -*/ - -/* Following values & calculations differ for different type of modes */ -if (m->flags &DRM_MODE_FLAG_INTERLACE ) { -/* Interlaced Mode */ - val = ((m->vsync_end - m->vdisplay) /2 ); - val |= ((m->vsync_start - m->vdisplay) /2 ) <<12 ; -hdmi_set_reg (core->v_sync_gen1,3 , val); - - val = m->vtotal /2 ; - val |= ((m->vtotal - m->vdisplay) /2 ) <<11 ; -hdmi_set_reg (core->v_blank,3 , val); - - val = (m->vtotal + - ((m->vsync_end - m->vsync_start) *4 ) +5 ) /2 ; - val |= m->vtotal <<11 ; -hdmi_set_reg (core->v_blank_f,3 , val); - - val = ((m->vtotal /2 ) +7 ); - val |= ((m->vtotal /2 ) +2 ) <<12 ; -hdmi_set_reg (core->v_sync_gen2,3 , val); - - val = ((m->htotal /2 ) + (m->hsync_start - m->hdisplay)); - val |= ((m->htotal /2 ) + - (m->hsync_start - m->hdisplay)) <<12 ; -hdmi_set_reg (core->v_sync_gen3,3 , val); - -hdmi_set_reg (tg->vact_st,2 , (m->vtotal - m->vdisplay) /2 ); -hdmi_set_reg (tg->vact_sz,2 , m->vdisplay /2 ); - -hdmi_set_reg (tg->vact_st2,2 ,0x249 );/* Reset value + 1*/ - }else { -/* Progressive Mode */ - - val = m->vtotal; - val |= (m->vtotal - m->vdisplay) <<11 ; -hdmi_set_reg (core->v_blank,3 , val); - -hdmi_set_reg (core->v_blank_f,3 ,0 ); - - val = (m->vsync_end - m->vdisplay); - val |= ((m->vsync_start - m->vdisplay) <<12 ); -hdmi_set_reg (core->v_sync_gen1,3 , val); - -hdmi_set_reg (core->v_sync_gen2,3 ,0x1001 );/* Reset value */ -hdmi_set_reg (core->v_sync_gen3,3 ,0x1001 );/* Reset value */ -hdmi_set_reg (tg->vact_st,2 , m->vtotal - m->vdisplay); -hdmi_set_reg (tg->vact_sz,2 , m->vdisplay); -hdmi_set_reg (tg->vact_st2,2 ,0x248 );/* Reset value */ - } - -/* Timing generator registers */ -hdmi_set_reg (tg->cmd,1 ,0x0 ); -hdmi_set_reg (tg->h_fsz,2 , m->htotal); -hdmi_set_reg (tg->hact_st,2 , m->htotal - m->hdisplay); -hdmi_set_reg (tg->hact_sz,2 , m->hdisplay); -hdmi_set_reg (tg->v_fsz,2 , m->vtotal); -hdmi_set_reg (tg->vsync,2 ,0x1 ); -hdmi_set_reg (tg->vsync2,2 ,0x233 );/* Reset value */ -hdmi_set_reg (tg->field_chg,2 ,0x233 );/* Reset value */ -hdmi_set_reg (tg->vsync_top_hdmi,2 ,0x1 );/* Reset value */ -hdmi_set_reg (tg->vsync_bot_hdmi,2 ,0x233 );/* Reset value */ -hdmi_set_reg (tg->field_top_hdmi,2 ,0x1 );/* Reset value */ -hdmi_set_reg (tg->field_bot_hdmi,2 ,0x233 );/* Reset value */ -hdmi_set_reg (tg->tg_3d,1 ,0x0 );/* Not used */ -} -static void hdmi_v14_mode_set (struct hdmi_context *hdata,struct drm_display_mode *m) { -struct hdmi_tg_regs *tg = &hdata->mode_conf.v14_conf.tg; -struct hdmi_v14_core_regs *core = &hdata->mode_conf.v14_conf.core; +struct hdmi_tg_regs *tg = &hdata->mode_conf.tg; +struct hdmi_v14_core_regs *core = &hdata->mode_conf.core;hdmi_set_reg (core->h_blank,2 , m->htotal - m->hdisplay);hdmi_set_reg (core->v_line,2 , m->vtotal);
@@ -1994,9 +1918,7 @@ static void hdmi_mode_set(struct exynos_drm_display *display, hdata->cea_video_id =drm_match_cea_mode (mode); -if (hdata->drv_data->type ==HDMI_TYPE13 ) -hdmi_v13_mode_set (hdata, mode); -else +if (hdata->drv_data->type ==HDMI_TYPE14 )hdmi_v14_mode_set (hdata, mode); }
Signature · 1 line
1.9.1
PATCH 7/7 drm/exynos/hdmi: remove hdmi_v14_conf struct
In reply to Andrzej HajdaThe patch removes intermediate struct for HDMIv14 register configuration, instead registry values are calculated on the fly.
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 427 +++++++++-------------------------- 1 file changed, 109 insertions(+), 318 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +109 -318
@@ -86,71 +86,6 @@ struct hdmi_resources {int regul_count; }; -struct hdmi_tg_regs { -u8 cmd[1 ]; -u8 h_fsz[2 ]; -u8 hact_st[2 ]; -u8 hact_sz[2 ]; -u8 v_fsz[2 ]; -u8 vsync[2 ]; -u8 vsync2[2 ]; -u8 vact_st[2 ]; -u8 vact_sz[2 ]; -u8 field_chg[2 ]; -u8 vact_st2[2 ]; -u8 vact_st3[2 ]; -u8 vact_st4[2 ]; -u8 vsync_top_hdmi[2 ]; -u8 vsync_bot_hdmi[2 ]; -u8 field_top_hdmi[2 ]; -u8 field_bot_hdmi[2 ]; -u8 tg_3d[1 ]; -}; - -struct hdmi_v14_core_regs { -u8 h_blank[2 ]; -u8 v2_blank[2 ]; -u8 v1_blank[2 ]; -u8 v_line[2 ]; -u8 h_line[2 ]; -u8 hsync_pol[1 ]; -u8 vsync_pol[1 ]; -u8 int_pro_mode[1 ]; -u8 v_blank_f0[2 ]; -u8 v_blank_f1[2 ]; -u8 h_sync_start[2 ]; -u8 h_sync_end[2 ]; -u8 v_sync_line_bef_2[2 ]; -u8 v_sync_line_bef_1[2 ]; -u8 v_sync_line_aft_2[2 ]; -u8 v_sync_line_aft_1[2 ]; -u8 v_sync_line_aft_pxl_2[2 ]; -u8 v_sync_line_aft_pxl_1[2 ]; -u8 v_blank_f2[2 ];/* for 3D mode */ -u8 v_blank_f3[2 ];/* for 3D mode */ -u8 v_blank_f4[2 ];/* for 3D mode */ -u8 v_blank_f5[2 ];/* for 3D mode */ -u8 v_sync_line_aft_3[2 ]; -u8 v_sync_line_aft_4[2 ]; -u8 v_sync_line_aft_5[2 ]; -u8 v_sync_line_aft_6[2 ]; -u8 v_sync_line_aft_pxl_3[2 ]; -u8 v_sync_line_aft_pxl_4[2 ]; -u8 v_sync_line_aft_pxl_5[2 ]; -u8 v_sync_line_aft_pxl_6[2 ]; -u8 vact_space_1[2 ]; -u8 vact_space_2[2 ]; -u8 vact_space_3[2 ]; -u8 vact_space_4[2 ]; -u8 vact_space_5[2 ]; -u8 vact_space_6[2 ]; -}; - -struct hdmi_v14_conf { -struct hdmi_v14_core_regs core; -struct hdmi_tg_regs tg; -}; -struct hdmi_context {struct exynos_drm_display display;struct device *dev;
@@ -170,7 +105,6 @@ struct hdmi_context {/* current hdmiphy conf regs */ struct drm_display_mode current_mode;u8 cea_video_id; -struct hdmi_v14_conf mode_conf;struct hdmi_resources res;const struct hdmi_driver_data *drv_data;
@@ -1508,143 +1442,119 @@ static void hdmi_v13_mode_apply(struct hdmi_context *hdata)static void hdmi_v14_mode_apply (struct hdmi_context *hdata) { -const struct hdmi_tg_regs *tg = &hdata->mode_conf.tg; -const struct hdmi_v14_core_regs *core = &hdata->mode_conf.core; +struct drm_display_mode *m = &hdata->current_mode;int tries; -/* setting core registers */ -hdmi_reg_writeb (hdata,HDMI_H_BLANK_0 , core->h_blank[0 ]); -hdmi_reg_writeb (hdata,HDMI_H_BLANK_1 , core->h_blank[1 ]); -hdmi_reg_writeb (hdata,HDMI_V2_BLANK_0 , core->v2_blank[0 ]); -hdmi_reg_writeb (hdata,HDMI_V2_BLANK_1 , core->v2_blank[1 ]); -hdmi_reg_writeb (hdata,HDMI_V1_BLANK_0 , core->v1_blank[0 ]); -hdmi_reg_writeb (hdata,HDMI_V1_BLANK_1 , core->v1_blank[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_LINE_0 , core->v_line[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_LINE_1 , core->v_line[1 ]); -hdmi_reg_writeb (hdata,HDMI_H_LINE_0 , core->h_line[0 ]); -hdmi_reg_writeb (hdata,HDMI_H_LINE_1 , core->h_line[1 ]); -hdmi_reg_writeb (hdata,HDMI_HSYNC_POL , core->hsync_pol[0 ]); -hdmi_reg_writeb (hdata,HDMI_VSYNC_POL , core->vsync_pol[0 ]); -hdmi_reg_writeb (hdata,HDMI_INT_PRO_MODE , core->int_pro_mode[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_BLANK_F0_0 , core->v_blank_f0[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_BLANK_F0_1 , core->v_blank_f0[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_BLANK_F1_0 , core->v_blank_f1[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_BLANK_F1_1 , core->v_blank_f1[1 ]); -hdmi_reg_writeb (hdata,HDMI_H_SYNC_START_0 , core->h_sync_start[0 ]); -hdmi_reg_writeb (hdata,HDMI_H_SYNC_START_1 , core->h_sync_start[1 ]); -hdmi_reg_writeb (hdata,HDMI_H_SYNC_END_0 , core->h_sync_end[0 ]); -hdmi_reg_writeb (hdata,HDMI_H_SYNC_END_1 , core->h_sync_end[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_BEF_2_0 , - core->v_sync_line_bef_2[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_BEF_2_1 , - core->v_sync_line_bef_2[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_BEF_1_0 , - core->v_sync_line_bef_1[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_BEF_1_1 , - core->v_sync_line_bef_1[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_2_0 , - core->v_sync_line_aft_2[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_2_1 , - core->v_sync_line_aft_2[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_1_0 , - core->v_sync_line_aft_1[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_1_1 , - core->v_sync_line_aft_1[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_PXL_2_0 , - core->v_sync_line_aft_pxl_2[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_PXL_2_1 , - core->v_sync_line_aft_pxl_2[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_PXL_1_0 , - core->v_sync_line_aft_pxl_1[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_PXL_1_1 , - core->v_sync_line_aft_pxl_1[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_BLANK_F2_0 , core->v_blank_f2[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_BLANK_F2_1 , core->v_blank_f2[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_BLANK_F3_0 , core->v_blank_f3[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_BLANK_F3_1 , core->v_blank_f3[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_BLANK_F4_0 , core->v_blank_f4[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_BLANK_F4_1 , core->v_blank_f4[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_BLANK_F5_0 , core->v_blank_f5[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_BLANK_F5_1 , core->v_blank_f5[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_3_0 , - core->v_sync_line_aft_3[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_3_1 , - core->v_sync_line_aft_3[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_4_0 , - core->v_sync_line_aft_4[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_4_1 , - core->v_sync_line_aft_4[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_5_0 , - core->v_sync_line_aft_5[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_5_1 , - core->v_sync_line_aft_5[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_6_0 , - core->v_sync_line_aft_6[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_6_1 , - core->v_sync_line_aft_6[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_PXL_3_0 , - core->v_sync_line_aft_pxl_3[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_PXL_3_1 , - core->v_sync_line_aft_pxl_3[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_PXL_4_0 , - core->v_sync_line_aft_pxl_4[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_PXL_4_1 , - core->v_sync_line_aft_pxl_4[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_PXL_5_0 , - core->v_sync_line_aft_pxl_5[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_PXL_5_1 , - core->v_sync_line_aft_pxl_5[1 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_PXL_6_0 , - core->v_sync_line_aft_pxl_6[0 ]); -hdmi_reg_writeb (hdata,HDMI_V_SYNC_LINE_AFT_PXL_6_1 , - core->v_sync_line_aft_pxl_6[1 ]); -hdmi_reg_writeb (hdata,HDMI_VACT_SPACE_1_0 , core->vact_space_1[0 ]); -hdmi_reg_writeb (hdata,HDMI_VACT_SPACE_1_1 , core->vact_space_1[1 ]); -hdmi_reg_writeb (hdata,HDMI_VACT_SPACE_2_0 , core->vact_space_2[0 ]); -hdmi_reg_writeb (hdata,HDMI_VACT_SPACE_2_1 , core->vact_space_2[1 ]); -hdmi_reg_writeb (hdata,HDMI_VACT_SPACE_3_0 , core->vact_space_3[0 ]); -hdmi_reg_writeb (hdata,HDMI_VACT_SPACE_3_1 , core->vact_space_3[1 ]); -hdmi_reg_writeb (hdata,HDMI_VACT_SPACE_4_0 , core->vact_space_4[0 ]); -hdmi_reg_writeb (hdata,HDMI_VACT_SPACE_4_1 , core->vact_space_4[1 ]); -hdmi_reg_writeb (hdata,HDMI_VACT_SPACE_5_0 , core->vact_space_5[0 ]); -hdmi_reg_writeb (hdata,HDMI_VACT_SPACE_5_1 , core->vact_space_5[1 ]); -hdmi_reg_writeb (hdata,HDMI_VACT_SPACE_6_0 , core->vact_space_6[0 ]); -hdmi_reg_writeb (hdata,HDMI_VACT_SPACE_6_1 , core->vact_space_6[1 ]); +hdmi_reg_writev (hdata,HDMI_H_BLANK_0 ,2 , m->htotal - m->hdisplay); +hdmi_reg_writev (hdata,HDMI_V_LINE_0 ,2 , m->vtotal); +hdmi_reg_writev (hdata,HDMI_H_LINE_0 ,2 , m->htotal); +hdmi_reg_writev (hdata,HDMI_HSYNC_POL ,1 , + (m->flags &DRM_MODE_FLAG_NHSYNC ) ?1 :0 ); +hdmi_reg_writev (hdata,HDMI_VSYNC_POL ,1 , + (m->flags &DRM_MODE_FLAG_NVSYNC ) ?1 :0 ); +hdmi_reg_writev (hdata,HDMI_INT_PRO_MODE ,1 , + (m->flags &DRM_MODE_FLAG_INTERLACE ) ?1 :0 ); + +/* +* Quirk requirement for exynos 5 HDMI IP design, +* 2 pixels less than the actual calculation for hsync_start +* and end. +*/ + +/* Following values & calculations differ for different type of modes */ +if (m->flags &DRM_MODE_FLAG_INTERLACE ) { +/* Interlaced Mode */ +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_BEF_2_0 ,2 , + (m->vsync_end - m->vdisplay) /2 ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_BEF_1_0 ,2 , + (m->vsync_start - m->vdisplay) /2 ); +hdmi_reg_writev (hdata,HDMI_V2_BLANK_0 ,2 , m->vtotal /2 ); +hdmi_reg_writev (hdata,HDMI_V1_BLANK_0 ,2 , + (m->vtotal - m->vdisplay) /2 ); +hdmi_reg_writev (hdata,HDMI_V_BLANK_F0_0 ,2 , + m->vtotal - m->vdisplay /2 ); +hdmi_reg_writev (hdata,HDMI_V_BLANK_F1_0 ,2 , m->vtotal); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_2_0 ,2 , + (m->vtotal /2 ) +7 ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_1_0 ,2 , + (m->vtotal /2 ) +2 ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_PXL_2_0 ,2 , + (m->htotal /2 ) + (m->hsync_start - m->hdisplay)); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_PXL_1_0 ,2 , + (m->htotal /2 ) + (m->hsync_start - m->hdisplay)); +hdmi_reg_writev (hdata,HDMI_TG_VACT_ST_L ,2 , + (m->vtotal - m->vdisplay) /2 ); +hdmi_reg_writev (hdata,HDMI_TG_VACT_SZ_L ,2 , m->vdisplay /2 ); +hdmi_reg_writev (hdata,HDMI_TG_VACT_ST2_L ,2 , + m->vtotal - m->vdisplay /2 ); +hdmi_reg_writev (hdata,HDMI_TG_VSYNC2_L ,2 , + (m->vtotal /2 ) +1 ); +hdmi_reg_writev (hdata,HDMI_TG_VSYNC_BOT_HDMI_L ,2 , + (m->vtotal /2 ) +1 ); +hdmi_reg_writev (hdata,HDMI_TG_FIELD_BOT_HDMI_L ,2 , + (m->vtotal /2 ) +1 ); +hdmi_reg_writev (hdata,HDMI_TG_VACT_ST3_L ,2 ,0x0 ); +hdmi_reg_writev (hdata,HDMI_TG_VACT_ST4_L ,2 ,0x0 ); + }else { +/* Progressive Mode */ +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_BEF_2_0 ,2 , + m->vsync_end - m->vdisplay); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_BEF_1_0 ,2 , + m->vsync_start - m->vdisplay); +hdmi_reg_writev (hdata,HDMI_V2_BLANK_0 ,2 , m->vtotal); +hdmi_reg_writev (hdata,HDMI_V1_BLANK_0 ,2 , + m->vtotal - m->vdisplay); +hdmi_reg_writev (hdata,HDMI_V_BLANK_F0_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_BLANK_F1_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_2_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_1_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_PXL_2_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_PXL_1_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_TG_VACT_ST_L ,2 , + m->vtotal - m->vdisplay); +hdmi_reg_writev (hdata,HDMI_TG_VACT_SZ_L ,2 , m->vdisplay); +hdmi_reg_writev (hdata,HDMI_TG_VACT_ST2_L ,2 ,0x248 ); +hdmi_reg_writev (hdata,HDMI_TG_VACT_ST3_L ,2 ,0x47b ); +hdmi_reg_writev (hdata,HDMI_TG_VACT_ST4_L ,2 ,0x6ae ); +hdmi_reg_writev (hdata,HDMI_TG_VSYNC2_L ,2 ,0x233 ); +hdmi_reg_writev (hdata,HDMI_TG_VSYNC_BOT_HDMI_L ,2 ,0x233 ); +hdmi_reg_writev (hdata,HDMI_TG_FIELD_BOT_HDMI_L ,2 ,0x233 ); + } + +/* Following values & calculations are same irrespective of mode type */ +hdmi_reg_writev (hdata,HDMI_H_SYNC_START_0 ,2 , + m->hsync_start - m->hdisplay -2 ); +hdmi_reg_writev (hdata,HDMI_H_SYNC_END_0 ,2 , + m->hsync_end - m->hdisplay -2 ); +hdmi_reg_writev (hdata,HDMI_VACT_SPACE_1_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_VACT_SPACE_2_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_VACT_SPACE_3_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_VACT_SPACE_4_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_VACT_SPACE_5_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_VACT_SPACE_6_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_BLANK_F2_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_BLANK_F3_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_BLANK_F4_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_BLANK_F5_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_3_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_4_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_5_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_6_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_PXL_3_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_PXL_4_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_PXL_5_0 ,2 ,0xffff ); +hdmi_reg_writev (hdata,HDMI_V_SYNC_LINE_AFT_PXL_6_0 ,2 ,0xffff );/* Timing generator registers */ -hdmi_reg_writeb (hdata,HDMI_TG_H_FSZ_L , tg->h_fsz[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_H_FSZ_H , tg->h_fsz[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_HACT_ST_L , tg->hact_st[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_HACT_ST_H , tg->hact_st[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_HACT_SZ_L , tg->hact_sz[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_HACT_SZ_H , tg->hact_sz[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_V_FSZ_L , tg->v_fsz[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_V_FSZ_H , tg->v_fsz[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC_L , tg->vsync[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC_H , tg->vsync[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC2_L , tg->vsync2[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC2_H , tg->vsync2[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_ST_L , tg->vact_st[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_ST_H , tg->vact_st[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_SZ_L , tg->vact_sz[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_SZ_H , tg->vact_sz[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_FIELD_CHG_L , tg->field_chg[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_FIELD_CHG_H , tg->field_chg[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_ST2_L , tg->vact_st2[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_ST2_H , tg->vact_st2[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_ST3_L , tg->vact_st3[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_ST3_H , tg->vact_st3[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_ST4_L , tg->vact_st4[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VACT_ST4_H , tg->vact_st4[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC_TOP_HDMI_L , tg->vsync_top_hdmi[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC_TOP_HDMI_H , tg->vsync_top_hdmi[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC_BOT_HDMI_L , tg->vsync_bot_hdmi[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_VSYNC_BOT_HDMI_H , tg->vsync_bot_hdmi[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_FIELD_TOP_HDMI_L , tg->field_top_hdmi[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_FIELD_TOP_HDMI_H , tg->field_top_hdmi[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_FIELD_BOT_HDMI_L , tg->field_bot_hdmi[0 ]); -hdmi_reg_writeb (hdata,HDMI_TG_FIELD_BOT_HDMI_H , tg->field_bot_hdmi[1 ]); -hdmi_reg_writeb (hdata,HDMI_TG_3D , tg->tg_3d[0 ]); +hdmi_reg_writev (hdata,HDMI_TG_H_FSZ_L ,2 , m->htotal); +hdmi_reg_writev (hdata,HDMI_TG_HACT_ST_L ,2 , m->htotal - m->hdisplay); +hdmi_reg_writev (hdata,HDMI_TG_HACT_SZ_L ,2 , m->hdisplay); +hdmi_reg_writev (hdata,HDMI_TG_V_FSZ_L ,2 , m->vtotal); +hdmi_reg_writev (hdata,HDMI_TG_VSYNC_L ,2 ,0x1 ); +hdmi_reg_writev (hdata,HDMI_TG_FIELD_CHG_L ,2 ,0x233 ); +hdmi_reg_writev (hdata,HDMI_TG_VSYNC_TOP_HDMI_L ,2 ,0x1 ); +hdmi_reg_writev (hdata,HDMI_TG_FIELD_TOP_HDMI_L ,2 ,0x1 ); +hdmi_reg_writev (hdata,HDMI_TG_3D ,1 ,0x0 );/* waiting for HDMIPHY's PLL to get to steady state */ for (tries =100 ; tries; --tries) {
@@ -1788,120 +1698,6 @@ static void hdmi_conf_apply(struct hdmi_context *hdata)hdmi_regs_dump (hdata,"start" ); } -static void hdmi_set_reg (u8 *reg_pair,int num_bytes,u32 value) -{ -int i; -BUG_ON (num_bytes >4 ); -for (i =0 ; i < num_bytes; i++) - reg_pair[i] = (value >> (8 * i)) &0xff ; -} - -static void hdmi_v14_mode_set (struct hdmi_context *hdata, -struct drm_display_mode *m) -{ -struct hdmi_tg_regs *tg = &hdata->mode_conf.tg; -struct hdmi_v14_core_regs *core = &hdata->mode_conf.core; - -hdmi_set_reg (core->h_blank,2 , m->htotal - m->hdisplay); -hdmi_set_reg (core->v_line,2 , m->vtotal); -hdmi_set_reg (core->h_line,2 , m->htotal); -hdmi_set_reg (core->hsync_pol,1 , - (m->flags &DRM_MODE_FLAG_NHSYNC ) ?1 :0 ); -hdmi_set_reg (core->vsync_pol,1 , - (m->flags &DRM_MODE_FLAG_NVSYNC ) ?1 :0 ); -hdmi_set_reg (core->int_pro_mode,1 , - (m->flags &DRM_MODE_FLAG_INTERLACE ) ?1 :0 ); - -/* -* Quirk requirement for exynos 5 HDMI IP design, -* 2 pixels less than the actual calculation for hsync_start -* and end. -*/ - -/* Following values & calculations differ for different type of modes */ -if (m->flags &DRM_MODE_FLAG_INTERLACE ) { -/* Interlaced Mode */ -hdmi_set_reg (core->v_sync_line_bef_2,2 , - (m->vsync_end - m->vdisplay) /2 ); -hdmi_set_reg (core->v_sync_line_bef_1,2 , - (m->vsync_start - m->vdisplay) /2 ); -hdmi_set_reg (core->v2_blank,2 , m->vtotal /2 ); -hdmi_set_reg (core->v1_blank,2 , (m->vtotal - m->vdisplay) /2 ); -hdmi_set_reg (core->v_blank_f0,2 , m->vtotal - m->vdisplay /2 ); -hdmi_set_reg (core->v_blank_f1,2 , m->vtotal); -hdmi_set_reg (core->v_sync_line_aft_2,2 , (m->vtotal /2 ) +7 ); -hdmi_set_reg (core->v_sync_line_aft_1,2 , (m->vtotal /2 ) +2 ); -hdmi_set_reg (core->v_sync_line_aft_pxl_2,2 , - (m->htotal /2 ) + (m->hsync_start - m->hdisplay)); -hdmi_set_reg (core->v_sync_line_aft_pxl_1,2 , - (m->htotal /2 ) + (m->hsync_start - m->hdisplay)); -hdmi_set_reg (tg->vact_st,2 , (m->vtotal - m->vdisplay) /2 ); -hdmi_set_reg (tg->vact_sz,2 , m->vdisplay /2 ); -hdmi_set_reg (tg->vact_st2,2 , m->vtotal - m->vdisplay /2 ); -hdmi_set_reg (tg->vsync2,2 , (m->vtotal /2 ) +1 ); -hdmi_set_reg (tg->vsync_bot_hdmi,2 , (m->vtotal /2 ) +1 ); -hdmi_set_reg (tg->field_bot_hdmi,2 , (m->vtotal /2 ) +1 ); -hdmi_set_reg (tg->vact_st3,2 ,0x0 ); -hdmi_set_reg (tg->vact_st4,2 ,0x0 ); - }else { -/* Progressive Mode */ -hdmi_set_reg (core->v_sync_line_bef_2,2 , - m->vsync_end - m->vdisplay); -hdmi_set_reg (core->v_sync_line_bef_1,2 , - m->vsync_start - m->vdisplay); -hdmi_set_reg (core->v2_blank,2 , m->vtotal); -hdmi_set_reg (core->v1_blank,2 , m->vtotal - m->vdisplay); -hdmi_set_reg (core->v_blank_f0,2 ,0xffff ); -hdmi_set_reg (core->v_blank_f1,2 ,0xffff ); -hdmi_set_reg (core->v_sync_line_aft_2,2 ,0xffff ); -hdmi_set_reg (core->v_sync_line_aft_1,2 ,0xffff ); -hdmi_set_reg (core->v_sync_line_aft_pxl_2,2 ,0xffff ); -hdmi_set_reg (core->v_sync_line_aft_pxl_1,2 ,0xffff ); -hdmi_set_reg (tg->vact_st,2 , m->vtotal - m->vdisplay); -hdmi_set_reg (tg->vact_sz,2 , m->vdisplay); -hdmi_set_reg (tg->vact_st2,2 ,0x248 );/* Reset value */ -hdmi_set_reg (tg->vact_st3,2 ,0x47b );/* Reset value */ -hdmi_set_reg (tg->vact_st4,2 ,0x6ae );/* Reset value */ -hdmi_set_reg (tg->vsync2,2 ,0x233 );/* Reset value */ -hdmi_set_reg (tg->vsync_bot_hdmi,2 ,0x233 );/* Reset value */ -hdmi_set_reg (tg->field_bot_hdmi,2 ,0x233 );/* Reset value */ - } - -/* Following values & calculations are same irrespective of mode type */ -hdmi_set_reg (core->h_sync_start,2 , m->hsync_start - m->hdisplay -2 ); -hdmi_set_reg (core->h_sync_end,2 , m->hsync_end - m->hdisplay -2 ); -hdmi_set_reg (core->vact_space_1,2 ,0xffff ); -hdmi_set_reg (core->vact_space_2,2 ,0xffff ); -hdmi_set_reg (core->vact_space_3,2 ,0xffff ); -hdmi_set_reg (core->vact_space_4,2 ,0xffff ); -hdmi_set_reg (core->vact_space_5,2 ,0xffff ); -hdmi_set_reg (core->vact_space_6,2 ,0xffff ); -hdmi_set_reg (core->v_blank_f2,2 ,0xffff ); -hdmi_set_reg (core->v_blank_f3,2 ,0xffff ); -hdmi_set_reg (core->v_blank_f4,2 ,0xffff ); -hdmi_set_reg (core->v_blank_f5,2 ,0xffff ); -hdmi_set_reg (core->v_sync_line_aft_3,2 ,0xffff ); -hdmi_set_reg (core->v_sync_line_aft_4,2 ,0xffff ); -hdmi_set_reg (core->v_sync_line_aft_5,2 ,0xffff ); -hdmi_set_reg (core->v_sync_line_aft_6,2 ,0xffff ); -hdmi_set_reg (core->v_sync_line_aft_pxl_3,2 ,0xffff ); -hdmi_set_reg (core->v_sync_line_aft_pxl_4,2 ,0xffff ); -hdmi_set_reg (core->v_sync_line_aft_pxl_5,2 ,0xffff ); -hdmi_set_reg (core->v_sync_line_aft_pxl_6,2 ,0xffff ); - -/* Timing generator registers */ -hdmi_set_reg (tg->cmd,1 ,0x0 ); -hdmi_set_reg (tg->h_fsz,2 , m->htotal); -hdmi_set_reg (tg->hact_st,2 , m->htotal - m->hdisplay); -hdmi_set_reg (tg->hact_sz,2 , m->hdisplay); -hdmi_set_reg (tg->v_fsz,2 , m->vtotal); -hdmi_set_reg (tg->vsync,2 ,0x1 ); -hdmi_set_reg (tg->field_chg,2 ,0x233 );/* Reset value */ -hdmi_set_reg (tg->vsync_top_hdmi,2 ,0x1 );/* Reset value */ -hdmi_set_reg (tg->field_top_hdmi,2 ,0x1 );/* Reset value */ -hdmi_set_reg (tg->tg_3d,1 ,0x0 ); -} -static void hdmi_mode_set (struct exynos_drm_display *display,struct drm_display_mode *mode) {
@@ -1913,13 +1709,8 @@ static void hdmi_mode_set(struct exynos_drm_display *display, m->vrefresh, (m->flags &DRM_MODE_FLAG_INTERLACE ) ? "INTERLACED" : "PROGRESSIVE"); -/* preserve mode information for later use. */ drm_mode_copy (&hdata->current_mode, mode); - hdata->cea_video_id =drm_match_cea_mode (mode); - -if (hdata->drv_data->type ==HDMI_TYPE14 ) -hdmi_v14_mode_set (hdata, mode); }static void hdmi_commit (struct exynos_drm_display *display)
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hello Andrzej!
Just some small comments.
It seems like linux-samsung-soc wasn't put into Cc for '[PATCH RESEND 0/6] drm/exynos: HDMI related fixes' (even though this series was), maybe you should also forward the other series to this list.
This series doesn't apply cleanly when 'drm/exynos: HDMI related fixes' is applied. E.g. the 'powered' boolean was removed by that series, but here in patch 2/7 ('drm/exynos/hdmi: Simplify HPD gpio handling') it's still there.
I also noticed that some of the patches ('drm/exynos/hdmi: remove private lock code') clash with Gustavo's latest cleanup series [1]. E.g. your patch 3/7 ('drm/exynos/hdmi: remove private lock code') touches hdmi_commit() which was removed by Gustavo. Maybe you should coordinate things with him?
With best wishes,
Tobias
[1] http://www.spinics.net/lists/linux-samsung-soc/msg45787.html
Quoted 27 lines · Andrzej Hajda
Hi Inki, Joonyoung,
These patches removes obsolete and old structures, to simplify further development. They should not change behavior of the driver.
The patchset is based on exynos-drm-next plus my HDMI related fixes [1].
The patchset was tested on Universal and Odroid U3.
[1]: http://permalink.gmane.org/gmane.comp.video.dri.devel/132348
Regards
AndrzejAndrzej Hajda (7):
drm/exynos/hdmi: remove old platform data code drm/exynos/hdmi: Simplify HPD gpio handling drm/exynos/hdmi: remove private lock code drm/exynos/hdmi: add driver data pointer to private context drm/exynos/hdmi: remove redundant configuration fields drm/exynos/hdmi: removehdmi_v13_confstruct drm/exynos/hdmi: removehdmi_v14_confstructdrivers/gpu/drm/exynos/exynos_hdmi.c | 860 ++++++++++------------------------- 1 file changed, 245 insertions(+), 615 deletions(-)
Hello Andrzej!
Just some small comments.
It seems like linux-samsung-soc wasn't put into Cc for '[PATCH RESEND 0/6] drm/exynos: HDMI related fixes' (even though this series was), maybe you should also forward the other series to this list.
This series doesn't apply cleanly when 'drm/exynos: HDMI related fixes' is applied. E.g. the 'powered' boolean was removed by that series, but here in patch 2/7 ('drm/exynos/hdmi: Simplify HPD gpio handling') it's still there.
I also noticed that some of the patches ('drm/exynos/hdmi: remove private lock code') clash with Gustavo's latest cleanup series [1]. E.g. your patch 3/7 ('drm/exynos/hdmi: remove private lock code') touches hdmi_commit() which was removed by Gustavo. Maybe you should coordinate things with him?
With best wishes,
Tobias
[1] http://www.spinics.net/lists/linux-samsung-soc/msg45787.html
Quoted 27 lines · Andrzej Hajda
Hi Inki, Joonyoung,
These patches removes obsolete and old structures, to simplify further development. They should not change behavior of the driver.
The patchset is based on exynos-drm-next plus my HDMI related fixes [1].
The patchset was tested on Universal and Odroid U3.
[1]: http://permalink.gmane.org/gmane.comp.video.dri.devel/132348
Regards
AndrzejAndrzej Hajda (7):
drm/exynos/hdmi: remove old platform data code drm/exynos/hdmi: Simplify HPD gpio handling drm/exynos/hdmi: remove private lock code drm/exynos/hdmi: add driver data pointer to private context drm/exynos/hdmi: remove redundant configuration fields drm/exynos/hdmi: removehdmi_v13_confstruct drm/exynos/hdmi: removehdmi_v14_confstructdrivers/gpu/drm/exynos/exynos_hdmi.c | 860 ++++++++++------------------------- 1 file changed, 245 insertions(+), 615 deletions(-)
Hi Tobias,
Quoted 7 lines · Tobias Jakobi
Hello Andrzej!
Just some small comments.
It seems like linux-samsung-soc wasn't put into Cc for '[PATCH RESEND 0/6] drm/exynos: HDMI related fixes' (even though this series was), maybe you should also forward the other series to this list.
Yes, I forgot about it.
Quoted 5 lines
This series doesn't apply cleanly when 'drm/exynos: HDMI related fixes' is applied. E.g. the 'powered' boolean was removed by that series, but here in patch 2/7 ('drm/exynos/hdmi: Simplify HPD gpio handling') it's still there.
'drm/exynos: HDMI related fixes' removes powered field from
mixer driver, and powered field in the patch 2/7 is from hdmi driver. So they should not interfere and for sure they do not interfere in my local git :) Have you any warning when you tried to apply those patches.
Quoted 6 lines
I also noticed that some of the patches ('drm/exynos/hdmi: remove private lock code') clash with Gustavo's latest cleanup series [1]. E.g. your patch 3/7 ('drm/exynos/hdmi: remove private lock code') touches
hdmi_commit()which was removed by Gustavo. Maybe you should coordinate things with him?
This is always problematic :) I can try to rebase my patches on Gustavo's if necessary. Gustavo, Inki what is your opinion?
Regards
Andrzej
Quoted 38 lines
With best wishes,
Tobias[1] http://www.spinics.net/lists/linux-samsung-soc/msg45787.html
Quoted 27 lines · Andrzej Hajda
Hi Inki, Joonyoung,
These patches removes obsolete and old structures, to simplify further development. They should not change behavior of the driver.
The patchset is based on exynos-drm-next plus my HDMI related fixes [1].
The patchset was tested on Universal and Odroid U3.
[1]: http://permalink.gmane.org/gmane.comp.video.dri.devel/132348
Regards
AndrzejAndrzej Hajda (7):
drm/exynos/hdmi: remove old platform data code drm/exynos/hdmi: Simplify HPD gpio handling drm/exynos/hdmi: remove private lock code drm/exynos/hdmi: add driver data pointer to private context drm/exynos/hdmi: remove redundant configuration fields drm/exynos/hdmi: removehdmi_v13_confstruct drm/exynos/hdmi: removehdmi_v14_confstructdrivers/gpu/drm/exynos/exynos_hdmi.c | 860 ++++++++++------------------------- 1 file changed, 245 insertions(+), 615 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hello,
Quoted 19 lines · Andrzej Hajda
Hi Tobias,
Quoted 7 lines · Tobias Jakobi
Hello Andrzej!
Just some small comments.
It seems like linux-samsung-soc wasn't put into Cc for '[PATCH RESEND 0/6] drm/exynos: HDMI related fixes' (even though this series was), maybe you should also forward the other series to this list.
Yes, I forgot about it.
Quoted 5 lines
This series doesn't apply cleanly when 'drm/exynos: HDMI related fixes' is applied. E.g. the 'powered' boolean was removed by that series, but here in patch 2/7 ('drm/exynos/hdmi: Simplify HPD gpio handling') it's still there.
Quoted 4 lines
'drm/exynos: HDMI related fixes' removes powered field from
mixer driver, and powered field in the patch 2/7 is from hdmi driver. So they should not interfere and for sure they do not interfere in my local git :) Have you any warning when you tried to apply those patches.
yes of course, otherwise I wouldn't point this out. The specific hunks just fail.
Which is kinda obvious:
Review struct hdmi_context { · line 191
Quoted 8 lines
(quoted diff) +0
-1@@ -186,7 +186,6 @@ struct hdmi_context { struct drm_device *drm_dev; struct drm_connector connector; struct drm_encoder *encoder; - bool hpd; bool powered; bool dvi_mode; struct mutex hdmi_mutex;
This doesn't apply when 'powered' is no longer ther.
With best wishes,
Tobias
Quoted 8 lines
Quoted 7 lines
I also noticed that some of the patches ('drm/exynos/hdmi: remove private lock code') clash with Gustavo's latest cleanup series [1]. E.g. your patch 3/7 ('drm/exynos/hdmi: remove private lock code') touches
hdmi_commit()which was removed by Gustavo. Maybe you should coordinate things with him?
Quoted 45 lines
This is always problematic :) I can try to rebase my patches on Gustavo's if necessary. Gustavo, Inki what is your opinion?
Regards
AndrzejQuoted 38 lines
With best wishes,
Tobias[1] http://www.spinics.net/lists/linux-samsung-soc/msg45787.html
Quoted 27 lines · Andrzej Hajda
Hi Inki, Joonyoung,
These patches removes obsolete and old structures, to simplify further development. They should not change behavior of the driver.
The patchset is based on exynos-drm-next plus my HDMI related fixes [1].
The patchset was tested on Universal and Odroid U3.
[1]: http://permalink.gmane.org/gmane.comp.video.dri.devel/132348
Regards
AndrzejAndrzej Hajda (7):
drm/exynos/hdmi: remove old platform data code drm/exynos/hdmi: Simplify HPD gpio handling drm/exynos/hdmi: remove private lock code drm/exynos/hdmi: add driver data pointer to private context drm/exynos/hdmi: remove redundant configuration fields drm/exynos/hdmi: removehdmi_v13_confstruct drm/exynos/hdmi: removehdmi_v14_confstructdrivers/gpu/drm/exynos/exynos_hdmi.c | 860 ++++++++++------------------------- 1 file changed, 245 insertions(+), 615 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 27 lines · Tobias Jakobi
Hello,
Quoted 12 lines · Andrzej Hajda
Hi Tobias,
Quoted 7 lines · Tobias Jakobi
Hello Andrzej!
Just some small comments.
It seems like linux-samsung-soc wasn't put into Cc for '[PATCH RESEND 0/6] drm/exynos: HDMI related fixes' (even though this series was), maybe you should also forward the other series to this list.
Yes, I forgot about it.
Quoted 8 lines
Quoted 4 lines
This series doesn't apply cleanly when 'drm/exynos: HDMI related fixes' is applied. E.g. the 'powered' boolean was removed by that series, but here in patch 2/7 ('drm/exynos/hdmi: Simplify HPD gpio handling') it's still there.
'drm/exynos: HDMI related fixes' removes powered field from
mixer driver, and powered field in the patch 2/7 is from hdmi driver. So they should not interfere and for sure they do not interfere in my local git :) Have you any warning when you tried to apply those patches.yes of course, otherwise I wouldn't point this out. The specific hunks just fail.
Which is kinda obvious:
Quoted 9 lines
Review struct hdmi_context { · line 191
Quoted 8 lines
(quoted diff) +0
-1@@ -186,7 +186,6 @@ struct hdmi_context { struct drm_device *drm_dev; struct drm_connector connector; struct drm_encoder *encoder; - bool hpd; bool powered; bool dvi_mode; struct mutex hdmi_mutex;This doesn't apply when 'powered' is no longer ther.
I have this field still present in my tree which is build of following components:
- current exynos-drm-next,
- drm/exynos: HDMI related fixes,
- this patchset
Could you show me exactly which patch removes this field?
As I mentioned one patch removes similar field from mixer driver, but not from hdmi.
Regards
Andrzej
Quoted 54 lines
With best wishes,
TobiasQuoted 47 lines
Quoted 5 lines
I also noticed that some of the patches ('drm/exynos/hdmi: remove private lock code') clash with Gustavo's latest cleanup series [1]. E.g. your patch 3/7 ('drm/exynos/hdmi: remove private lock code') touches
hdmi_commit()which was removed by Gustavo. Maybe you should coordinate things with him?This is always problematic :) I can try to rebase my patches on Gustavo's if necessary. Gustavo, Inki what is your opinion?
Regards
AndrzejQuoted 36 lines
With best wishes,
Tobias[1] http://www.spinics.net/lists/linux-samsung-soc/msg45787.html
Quoted 27 lines · Andrzej Hajda
Hi Inki, Joonyoung,
These patches removes obsolete and old structures, to simplify further development. They should not change behavior of the driver.
The patchset is based on exynos-drm-next plus my HDMI related fixes [1].
The patchset was tested on Universal and Odroid U3.
[1]: http://permalink.gmane.org/gmane.comp.video.dri.devel/132348
Regards
AndrzejAndrzej Hajda (7):
drm/exynos/hdmi: remove old platform data code drm/exynos/hdmi: Simplify HPD gpio handling drm/exynos/hdmi: remove private lock code drm/exynos/hdmi: add driver data pointer to private context drm/exynos/hdmi: remove redundant configuration fields drm/exynos/hdmi: removehdmi_v13_confstruct drm/exynos/hdmi: removehdmi_v14_confstructdrivers/gpu/drm/exynos/exynos_hdmi.c | 860 ++++++++++------------------------- 1 file changed, 245 insertions(+), 615 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hello!
Quoted 38 lines · Andrzej Hajda
Quoted 27 lines · Tobias Jakobi
Hello,
Quoted 12 lines · Andrzej Hajda
Hi Tobias,
Quoted 7 lines · Tobias Jakobi
Hello Andrzej!
Just some small comments.
It seems like linux-samsung-soc wasn't put into Cc for '[PATCH RESEND 0/6] drm/exynos: HDMI related fixes' (even though this series was), maybe you should also forward the other series to this list.
Yes, I forgot about it.
Quoted 8 lines
Quoted 4 lines
This series doesn't apply cleanly when 'drm/exynos: HDMI related fixes' is applied. E.g. the 'powered' boolean was removed by that series, but here in patch 2/7 ('drm/exynos/hdmi: Simplify HPD gpio handling') it's still there.
'drm/exynos: HDMI related fixes' removes powered field from
mixer driver, and powered field in the patch 2/7 is from hdmi driver. So they should not interfere and for sure they do not interfere in my local git :) Have you any warning when you tried to apply those patches.yes of course, otherwise I wouldn't point this out. The specific hunks just fail.
Which is kinda obvious:
Quoted 9 lines
Review struct hdmi_context { · line 191
Quoted 8 lines
(quoted diff) +0
-1@@ -186,7 +186,6 @@ struct hdmi_context { struct drm_device *drm_dev; struct drm_connector connector; struct drm_encoder *encoder; - bool hpd; bool powered; bool dvi_mode; struct mutex hdmi_mutex;This doesn't apply when 'powered' is no longer ther.
Quoted 8 lines
I have this field still present in my tree which is build of following components:
- current exynos-drm-next,
- drm/exynos: HDMI related fixes,
- this patchsetCould you show me exactly which patch removes this field?
As I mentioned one patch removes similar field from mixer driver, but not from hdmi.
You're right, looks like I'm mixing up fields from mixer and hdmi. Hmm, now I'm confused -- I did have some problems applying the patches, but with this now ruled out I can't really recall anything else that may have caused this.
Guess I have to repeat the steps. So until further notice, just disregard everything I said! *g*
With best wishes,
Tobias
Quoted 60 lines
Regards
AndrzejQuoted 54 lines
With best wishes,
TobiasQuoted 47 lines
Quoted 5 lines
I also noticed that some of the patches ('drm/exynos/hdmi: remove private lock code') clash with Gustavo's latest cleanup series [1]. E.g. your patch 3/7 ('drm/exynos/hdmi: remove private lock code') touches
hdmi_commit()which was removed by Gustavo. Maybe you should coordinate things with him?This is always problematic :) I can try to rebase my patches on Gustavo's if necessary. Gustavo, Inki what is your opinion?
Regards
AndrzejQuoted 36 lines
With best wishes,
Tobias[1] http://www.spinics.net/lists/linux-samsung-soc/msg45787.html
Quoted 27 lines · Andrzej Hajda
Hi Inki, Joonyoung,
These patches removes obsolete and old structures, to simplify further development. They should not change behavior of the driver.
The patchset is based on exynos-drm-next plus my HDMI related fixes [1].
The patchset was tested on Universal and Odroid U3.
[1]: http://permalink.gmane.org/gmane.comp.video.dri.devel/132348
Regards
AndrzejAndrzej Hajda (7):
drm/exynos/hdmi: remove old platform data code drm/exynos/hdmi: Simplify HPD gpio handling drm/exynos/hdmi: remove private lock code drm/exynos/hdmi: add driver data pointer to private context drm/exynos/hdmi: remove redundant configuration fields drm/exynos/hdmi: removehdmi_v13_confstruct drm/exynos/hdmi: removehdmi_v14_confstructdrivers/gpu/drm/exynos/exynos_hdmi.c | 860 ++++++++++------------------------- 1 file changed, 245 insertions(+), 615 deletions(-)
Quoted 24 lines · Andrzej Hajda
Hi Inki, Joonyoung,
These patches removes obsolete and old structures, to simplify further development. They should not change behavior of the driver.
The patchset is based on exynos-drm-next plus my HDMI related fixes [1].
The patchset was tested on Universal and Odroid U3.
[1]: http://permalink.gmane.org/gmane.comp.video.dri.devel/132348
Regards
AndrzejAndrzej Hajda (7):
drm/exynos/hdmi: remove old platform data code drm/exynos/hdmi: Simplify HPD gpio handling drm/exynos/hdmi: remove private lock code drm/exynos/hdmi: add driver data pointer to private context drm/exynos/hdmi: remove redundant configuration fields drm/exynos/hdmi: removehdmi_v13_confstruct drm/exynos/hdmi: removehdmi_v14_confstruct
Quoted 3 lines
drivers/gpu/drm/exynos/exynos_hdmi.c | 860 ++++++++++------------------------- 1 file changed, 245 insertions(+), 615 deletions(-)
Looks good to me about this patchset,