drm: omapdrm: Move FEAT_HDMI_* features to hdmi4 driver
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 4 Aug 2017 22:44:11 +0000 (01:44 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 15 Aug 2017 12:18:25 +0000 (15:18 +0300)
The FEAT_HDMI_* features are specific to the HDMI4, move them from the
omap_dss_features structure to the hdmi4 driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/gpu/drm/omapdrm/dss/dss_features.c
drivers/gpu/drm/omapdrm/dss/dss_features.h
drivers/gpu/drm/omapdrm/dss/hdmi.h
drivers/gpu/drm/omapdrm/dss/hdmi4_core.c

index f2c61bc..3d0bee9 100644 (file)
@@ -240,7 +240,6 @@ static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = {
        FEAT_MGR_LCD2,
        FEAT_CORE_CLK_DIV,
        FEAT_LCD_CLK_SRC,
-       FEAT_HDMI_CTS_SWMODE,
        FEAT_HANDLE_UV_SEPARATE,
        FEAT_ATTR2,
        FEAT_CPR,
@@ -255,8 +254,6 @@ static const enum dss_feat_id omap4_dss_feat_list[] = {
        FEAT_MGR_LCD2,
        FEAT_CORE_CLK_DIV,
        FEAT_LCD_CLK_SRC,
-       FEAT_HDMI_CTS_SWMODE,
-       FEAT_HDMI_AUDIO_USE_MCLK,
        FEAT_HANDLE_UV_SEPARATE,
        FEAT_ATTR2,
        FEAT_CPR,
@@ -272,8 +269,6 @@ static const enum dss_feat_id omap5_dss_feat_list[] = {
        FEAT_MGR_LCD3,
        FEAT_CORE_CLK_DIV,
        FEAT_LCD_CLK_SRC,
-       FEAT_HDMI_CTS_SWMODE,
-       FEAT_HDMI_AUDIO_USE_MCLK,
        FEAT_HANDLE_UV_SEPARATE,
        FEAT_ATTR2,
        FEAT_CPR,
index 61c419a..f5320c3 100644 (file)
@@ -40,8 +40,6 @@ enum dss_feat_id {
        FEAT_CORE_CLK_DIV,
        FEAT_LCD_CLK_SRC,
        FEAT_DPI_USES_VDDS_DSI,
-       FEAT_HDMI_CTS_SWMODE,
-       FEAT_HDMI_AUDIO_USE_MCLK,
        FEAT_HANDLE_UV_SEPARATE,
        FEAT_ATTR2,
        FEAT_CPR,
index 851e5e6..3738a5b 100644 (file)
@@ -261,6 +261,8 @@ struct hdmi_phy_data {
 
 struct hdmi_core_data {
        void __iomem *base;
+       bool cts_swmode;
+       bool audio_use_mclk;
 };
 
 static inline void hdmi_write_reg(void __iomem *base_addr, const u32 idx,
index ed60016..5aef83c 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/platform_device.h>
 #include <linux/string.h>
 #include <linux/seq_file.h>
+#include <linux/sys_soc.h>
 #include <sound/asound.h>
 #include <sound/asoundef.h>
 
@@ -757,10 +758,10 @@ int hdmi4_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
        /* Audio clock regeneration settings */
        acore.n = n;
        acore.cts = cts;
-       if (dss_has_feature(FEAT_HDMI_CTS_SWMODE)) {
+       if (core->cts_swmode) {
                acore.aud_par_busclk = 0;
                acore.cts_mode = HDMI_AUDIO_CTS_MODE_SW;
-               acore.use_mclk = dss_has_feature(FEAT_HDMI_AUDIO_USE_MCLK);
+               acore.use_mclk = core->audio_use_mclk;
        } else {
                acore.aud_par_busclk = (((128 * 31) - 1) << 8);
                acore.cts_mode = HDMI_AUDIO_CTS_MODE_HW;
@@ -884,10 +885,42 @@ void hdmi4_audio_stop(struct hdmi_core_data *core, struct hdmi_wp_data *wp)
        hdmi_wp_audio_core_req_enable(wp, false);
 }
 
+struct hdmi4_features {
+       bool cts_swmode;
+       bool audio_use_mclk;
+};
+
+static const struct hdmi4_features hdmi4_es1_features = {
+       .cts_swmode = false,
+       .audio_use_mclk = false,
+};
+
+static const struct hdmi4_features hdmi4_es2_features = {
+       .cts_swmode = true,
+       .audio_use_mclk = false,
+};
+
+static const struct hdmi4_features hdmi4_es3_features = {
+       .cts_swmode = true,
+       .audio_use_mclk = true,
+};
+
+static const struct soc_device_attribute hdmi4_soc_devices[] = {
+       { .family = "OMAP4", .revision = "ES1.?", .data = &hdmi4_es1_features },
+       { .family = "OMAP4", .revision = "ES2.?", .data = &hdmi4_es2_features },
+       { .family = "OMAP4",                      .data = &hdmi4_es3_features },
+       { /* sentinel */ }
+};
+
 int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
 {
+       const struct hdmi4_features *features;
        struct resource *res;
 
+       features = soc_device_match(hdmi4_soc_devices)->data;
+       core->cts_swmode = features->cts_swmode;
+       core->audio_use_mclk = features->audio_use_mclk;
+
        res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core");
        core->base = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(core->base))