drm: omapdrm: Move DSS_FCK feature to dss driver
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 4 Aug 2017 22:44:17 +0000 (01:44 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 15 Aug 2017 12:18:25 +0000 (15:18 +0300)
The FEAT_PARAM_DSS_FCK feature is specific to the DSS, move it from the
omap_dss_features structure to the dss driver.

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

index 49c9c46428f9bee7553cc60d02cba5de26586d4d..39a10665a91f1b4adf0547fa24c15495b1977d8f 100644 (file)
@@ -3502,7 +3502,7 @@ bool dispc_div_calc(unsigned long dispc_freq,
        pckd_hw_min = dispc.feat->min_pcd;
        pckd_hw_max = 255;
 
-       lck_max = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK);
+       lck_max = dss_get_max_fck_rate();
 
        pck_min = pck_min ? pck_min : 1;
        pck_max = pck_max ? pck_max : ULONG_MAX;
index ed057bdee85537d0f8c2c4018c7b31ced05f4748..d15d17ff16d14b6ac1612e5b275e5b4f4d2da737 100644 (file)
@@ -211,7 +211,7 @@ static bool dpi_calc_pll_cb(int n, int m, unsigned long fint,
        ctx->pll_cinfo.clkdco = clkdco;
 
        return dss_pll_hsdiv_calc_a(ctx->pll, clkdco,
-               ctx->pck_min, dss_feat_get_param_max(FEAT_PARAM_DSS_FCK),
+               ctx->pck_min, dss_get_max_fck_rate(),
                dpi_calc_hsdiv_cb, ctx);
 }
 
index 8bb9f8de46f05cf456a4ba4321bbc0ac9148f0f3..89bb41f42a0632f75437486d7f966d83dfd5c545 100644 (file)
@@ -81,6 +81,7 @@ struct dss_ops {
 struct dss_features {
        enum dss_model model;
        u8 fck_div_max;
+       unsigned int fck_freq_max;
        u8 dss_fck_multiplier;
        const char *parent_clk_name;
        const enum omap_display_type *ports;
@@ -623,7 +624,7 @@ bool dss_div_calc(unsigned long pck, unsigned long fck_min,
        unsigned long prate;
        unsigned m;
 
-       fck_hw_max = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK);
+       fck_hw_max = dss.feat->fck_freq_max;
 
        if (dss.parent_clk == NULL) {
                unsigned pckd;
@@ -681,6 +682,11 @@ unsigned long dss_get_dispc_clk_rate(void)
        return dss.dss_clk_rate;
 }
 
+unsigned long dss_get_max_fck_rate(void)
+{
+       return dss.feat->fck_freq_max;
+}
+
 static int dss_setup_default_clock(void)
 {
        unsigned long max_dss_fck, prate;
@@ -688,7 +694,7 @@ static int dss_setup_default_clock(void)
        unsigned fck_div;
        int r;
 
-       max_dss_fck = dss_feat_get_param_max(FEAT_PARAM_DSS_FCK);
+       max_dss_fck = dss.feat->fck_freq_max;
 
        if (dss.parent_clk == NULL) {
                fck = clk_round_rate(dss.dss_clk, max_dss_fck);
@@ -1005,6 +1011,7 @@ static const struct dss_features omap24xx_dss_feats = {
         * from 1 to 6 has no gaps, so let's use that as a max.
         */
        .fck_div_max            =       6,
+       .fck_freq_max           =       133000000,
        .dss_fck_multiplier     =       2,
        .parent_clk_name        =       "core_ck",
        .ports                  =       omap2plus_ports,
@@ -1017,6 +1024,7 @@ static const struct dss_features omap24xx_dss_feats = {
 static const struct dss_features omap34xx_dss_feats = {
        .model                  =       DSS_MODEL_OMAP3,
        .fck_div_max            =       16,
+       .fck_freq_max           =       173000000,
        .dss_fck_multiplier     =       2,
        .parent_clk_name        =       "dpll4_ck",
        .ports                  =       omap34xx_ports,
@@ -1029,6 +1037,7 @@ static const struct dss_features omap34xx_dss_feats = {
 static const struct dss_features omap3630_dss_feats = {
        .model                  =       DSS_MODEL_OMAP3,
        .fck_div_max            =       32,
+       .fck_freq_max           =       173000000,
        .dss_fck_multiplier     =       1,
        .parent_clk_name        =       "dpll4_ck",
        .ports                  =       omap2plus_ports,
@@ -1041,6 +1050,7 @@ static const struct dss_features omap3630_dss_feats = {
 static const struct dss_features omap44xx_dss_feats = {
        .model                  =       DSS_MODEL_OMAP4,
        .fck_div_max            =       32,
+       .fck_freq_max           =       186000000,
        .dss_fck_multiplier     =       1,
        .parent_clk_name        =       "dpll_per_x2_ck",
        .ports                  =       omap2plus_ports,
@@ -1053,6 +1063,7 @@ static const struct dss_features omap44xx_dss_feats = {
 static const struct dss_features omap54xx_dss_feats = {
        .model                  =       DSS_MODEL_OMAP5,
        .fck_div_max            =       64,
+       .fck_freq_max           =       209250000,
        .dss_fck_multiplier     =       1,
        .parent_clk_name        =       "dpll_per_x2_ck",
        .ports                  =       omap2plus_ports,
@@ -1065,6 +1076,7 @@ static const struct dss_features omap54xx_dss_feats = {
 static const struct dss_features am43xx_dss_feats = {
        .model                  =       DSS_MODEL_OMAP3,
        .fck_div_max            =       0,
+       .fck_freq_max           =       200000000,
        .dss_fck_multiplier     =       0,
        .parent_clk_name        =       NULL,
        .ports                  =       omap2plus_ports,
@@ -1077,6 +1089,7 @@ static const struct dss_features am43xx_dss_feats = {
 static const struct dss_features dra7xx_dss_feats = {
        .model                  =       DSS_MODEL_DRA7,
        .fck_div_max            =       64,
+       .fck_freq_max           =       209250000,
        .dss_fck_multiplier     =       1,
        .parent_clk_name        =       "dpll_per_x2_ck",
        .ports                  =       dra7xx_ports,
index ac642607321efa29cdc5723c6f7d19b625c550a4..9980eca14e3ba1a6d3333ba9297ec6d3dae47178 100644 (file)
@@ -265,6 +265,7 @@ int dss_runtime_get(void);
 void dss_runtime_put(void);
 
 unsigned long dss_get_dispc_clk_rate(void);
+unsigned long dss_get_max_fck_rate(void);
 int dss_dpi_select_source(int port, enum omap_channel channel);
 void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select);
 enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void);
index c904d80a5920e91f7bad10a7d5133129d84d1d28..1255bb62934a098798aebd95d4c134ea7d2f716c 100644 (file)
 #include "dss.h"
 #include "dss_features.h"
 
-struct dss_param_range {
-       int min, max;
-};
-
 struct omap_dss_features {
        const enum omap_dss_output_id *supported_outputs;
-       const struct dss_param_range *dss_params;
 };
 
 /* This struct is assigned to one of the below during initialization */
@@ -100,36 +95,14 @@ static const enum omap_dss_output_id omap5_dss_supported_outputs[] = {
        OMAP_DSS_OUTPUT_DSI2,
 };
 
-static const struct dss_param_range omap2_dss_param_range[] = {
-       [FEAT_PARAM_DSS_FCK]                    = { 0, 133000000 },
-};
-
-static const struct dss_param_range omap3_dss_param_range[] = {
-       [FEAT_PARAM_DSS_FCK]                    = { 0, 173000000 },
-};
-
-static const struct dss_param_range am43xx_dss_param_range[] = {
-       [FEAT_PARAM_DSS_FCK]                    = { 0, 200000000 },
-};
-
-static const struct dss_param_range omap4_dss_param_range[] = {
-       [FEAT_PARAM_DSS_FCK]                    = { 0, 186000000 },
-};
-
-static const struct dss_param_range omap5_dss_param_range[] = {
-       [FEAT_PARAM_DSS_FCK]                    = { 0, 209250000 },
-};
-
 /* OMAP2 DSS Features */
 static const struct omap_dss_features omap2_dss_features = {
        .supported_outputs = omap2_dss_supported_outputs,
-       .dss_params = omap2_dss_param_range,
 };
 
 /* OMAP3 DSS Features */
 static const struct omap_dss_features omap3430_dss_features = {
        .supported_outputs = omap3430_dss_supported_outputs,
-       .dss_params = omap3_dss_param_range,
 };
 
 /*
@@ -138,55 +111,37 @@ static const struct omap_dss_features omap3430_dss_features = {
  */
 static const struct omap_dss_features am35xx_dss_features = {
        .supported_outputs = omap3430_dss_supported_outputs,
-       .dss_params = omap3_dss_param_range,
 };
 
 static const struct omap_dss_features am43xx_dss_features = {
        .supported_outputs = am43xx_dss_supported_outputs,
-       .dss_params = am43xx_dss_param_range,
 };
 
 static const struct omap_dss_features omap3630_dss_features = {
        .supported_outputs = omap3630_dss_supported_outputs,
-       .dss_params = omap3_dss_param_range,
 };
 
 /* OMAP4 DSS Features */
 /* For OMAP4430 ES 1.0 revision */
 static const struct omap_dss_features omap4430_es1_0_dss_features  = {
        .supported_outputs = omap4_dss_supported_outputs,
-       .dss_params = omap4_dss_param_range,
 };
 
 /* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
 static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
        .supported_outputs = omap4_dss_supported_outputs,
-       .dss_params = omap4_dss_param_range,
 };
 
 /* For all the other OMAP4 versions */
 static const struct omap_dss_features omap4_dss_features = {
        .supported_outputs = omap4_dss_supported_outputs,
-       .dss_params = omap4_dss_param_range,
 };
 
 /* OMAP5 DSS Features */
 static const struct omap_dss_features omap5_dss_features = {
        .supported_outputs = omap5_dss_supported_outputs,
-       .dss_params = omap5_dss_param_range,
 };
 
-/* Functions returning values related to a DSS feature */
-unsigned long dss_feat_get_param_min(enum dss_range_param param)
-{
-       return omap_current_dss_features->dss_params[param].min;
-}
-
-unsigned long dss_feat_get_param_max(enum dss_range_param param)
-{
-       return omap_current_dss_features->dss_params[param].max;
-}
-
 enum omap_dss_output_id dss_feat_get_supported_outputs(enum omap_channel channel)
 {
        return omap_current_dss_features->supported_outputs[channel];
index b1179fb2586684e82fea2f9903dfef3fe285f8c4..c43d49d00c3f502db20d7fb2dd3e3495508e3706 100644 (file)
 #define MAX_DSS_LCD_MANAGERS   3
 #define MAX_NUM_DSI            2
 
-enum dss_range_param {
-       FEAT_PARAM_DSS_FCK,
-};
-
-/* DSS Feature Functions */
-unsigned long dss_feat_get_param_min(enum dss_range_param param);
-unsigned long dss_feat_get_param_max(enum dss_range_param param);
-
 void dss_features_init(enum omapdss_version version);
 
 enum omap_dss_output_id dss_feat_get_supported_outputs(enum omap_channel channel);