Commit 9f0fbaea authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen

drm: omapdrm: Move DSS_FCK feature to dss driver

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent c4ff6ea6
...@@ -3502,7 +3502,7 @@ bool dispc_div_calc(unsigned long dispc_freq, ...@@ -3502,7 +3502,7 @@ bool dispc_div_calc(unsigned long dispc_freq,
pckd_hw_min = dispc.feat->min_pcd; pckd_hw_min = dispc.feat->min_pcd;
pckd_hw_max = 255; 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_min = pck_min ? pck_min : 1;
pck_max = pck_max ? pck_max : ULONG_MAX; pck_max = pck_max ? pck_max : ULONG_MAX;
......
...@@ -211,7 +211,7 @@ static bool dpi_calc_pll_cb(int n, int m, unsigned long fint, ...@@ -211,7 +211,7 @@ static bool dpi_calc_pll_cb(int n, int m, unsigned long fint,
ctx->pll_cinfo.clkdco = clkdco; ctx->pll_cinfo.clkdco = clkdco;
return dss_pll_hsdiv_calc_a(ctx->pll, 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); dpi_calc_hsdiv_cb, ctx);
} }
......
...@@ -81,6 +81,7 @@ struct dss_ops { ...@@ -81,6 +81,7 @@ struct dss_ops {
struct dss_features { struct dss_features {
enum dss_model model; enum dss_model model;
u8 fck_div_max; u8 fck_div_max;
unsigned int fck_freq_max;
u8 dss_fck_multiplier; u8 dss_fck_multiplier;
const char *parent_clk_name; const char *parent_clk_name;
const enum omap_display_type *ports; const enum omap_display_type *ports;
...@@ -623,7 +624,7 @@ bool dss_div_calc(unsigned long pck, unsigned long fck_min, ...@@ -623,7 +624,7 @@ bool dss_div_calc(unsigned long pck, unsigned long fck_min,
unsigned long prate; unsigned long prate;
unsigned m; 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) { if (dss.parent_clk == NULL) {
unsigned pckd; unsigned pckd;
...@@ -681,6 +682,11 @@ unsigned long dss_get_dispc_clk_rate(void) ...@@ -681,6 +682,11 @@ unsigned long dss_get_dispc_clk_rate(void)
return dss.dss_clk_rate; 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) static int dss_setup_default_clock(void)
{ {
unsigned long max_dss_fck, prate; unsigned long max_dss_fck, prate;
...@@ -688,7 +694,7 @@ static int dss_setup_default_clock(void) ...@@ -688,7 +694,7 @@ static int dss_setup_default_clock(void)
unsigned fck_div; unsigned fck_div;
int r; 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) { if (dss.parent_clk == NULL) {
fck = clk_round_rate(dss.dss_clk, max_dss_fck); fck = clk_round_rate(dss.dss_clk, max_dss_fck);
...@@ -1005,6 +1011,7 @@ static const struct dss_features omap24xx_dss_feats = { ...@@ -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. * from 1 to 6 has no gaps, so let's use that as a max.
*/ */
.fck_div_max = 6, .fck_div_max = 6,
.fck_freq_max = 133000000,
.dss_fck_multiplier = 2, .dss_fck_multiplier = 2,
.parent_clk_name = "core_ck", .parent_clk_name = "core_ck",
.ports = omap2plus_ports, .ports = omap2plus_ports,
...@@ -1017,6 +1024,7 @@ static const struct dss_features omap24xx_dss_feats = { ...@@ -1017,6 +1024,7 @@ static const struct dss_features omap24xx_dss_feats = {
static const struct dss_features omap34xx_dss_feats = { static const struct dss_features omap34xx_dss_feats = {
.model = DSS_MODEL_OMAP3, .model = DSS_MODEL_OMAP3,
.fck_div_max = 16, .fck_div_max = 16,
.fck_freq_max = 173000000,
.dss_fck_multiplier = 2, .dss_fck_multiplier = 2,
.parent_clk_name = "dpll4_ck", .parent_clk_name = "dpll4_ck",
.ports = omap34xx_ports, .ports = omap34xx_ports,
...@@ -1029,6 +1037,7 @@ static const struct dss_features omap34xx_dss_feats = { ...@@ -1029,6 +1037,7 @@ static const struct dss_features omap34xx_dss_feats = {
static const struct dss_features omap3630_dss_feats = { static const struct dss_features omap3630_dss_feats = {
.model = DSS_MODEL_OMAP3, .model = DSS_MODEL_OMAP3,
.fck_div_max = 32, .fck_div_max = 32,
.fck_freq_max = 173000000,
.dss_fck_multiplier = 1, .dss_fck_multiplier = 1,
.parent_clk_name = "dpll4_ck", .parent_clk_name = "dpll4_ck",
.ports = omap2plus_ports, .ports = omap2plus_ports,
...@@ -1041,6 +1050,7 @@ static const struct dss_features omap3630_dss_feats = { ...@@ -1041,6 +1050,7 @@ static const struct dss_features omap3630_dss_feats = {
static const struct dss_features omap44xx_dss_feats = { static const struct dss_features omap44xx_dss_feats = {
.model = DSS_MODEL_OMAP4, .model = DSS_MODEL_OMAP4,
.fck_div_max = 32, .fck_div_max = 32,
.fck_freq_max = 186000000,
.dss_fck_multiplier = 1, .dss_fck_multiplier = 1,
.parent_clk_name = "dpll_per_x2_ck", .parent_clk_name = "dpll_per_x2_ck",
.ports = omap2plus_ports, .ports = omap2plus_ports,
...@@ -1053,6 +1063,7 @@ static const struct dss_features omap44xx_dss_feats = { ...@@ -1053,6 +1063,7 @@ static const struct dss_features omap44xx_dss_feats = {
static const struct dss_features omap54xx_dss_feats = { static const struct dss_features omap54xx_dss_feats = {
.model = DSS_MODEL_OMAP5, .model = DSS_MODEL_OMAP5,
.fck_div_max = 64, .fck_div_max = 64,
.fck_freq_max = 209250000,
.dss_fck_multiplier = 1, .dss_fck_multiplier = 1,
.parent_clk_name = "dpll_per_x2_ck", .parent_clk_name = "dpll_per_x2_ck",
.ports = omap2plus_ports, .ports = omap2plus_ports,
...@@ -1065,6 +1076,7 @@ static const struct dss_features omap54xx_dss_feats = { ...@@ -1065,6 +1076,7 @@ static const struct dss_features omap54xx_dss_feats = {
static const struct dss_features am43xx_dss_feats = { static const struct dss_features am43xx_dss_feats = {
.model = DSS_MODEL_OMAP3, .model = DSS_MODEL_OMAP3,
.fck_div_max = 0, .fck_div_max = 0,
.fck_freq_max = 200000000,
.dss_fck_multiplier = 0, .dss_fck_multiplier = 0,
.parent_clk_name = NULL, .parent_clk_name = NULL,
.ports = omap2plus_ports, .ports = omap2plus_ports,
...@@ -1077,6 +1089,7 @@ static const struct dss_features am43xx_dss_feats = { ...@@ -1077,6 +1089,7 @@ static const struct dss_features am43xx_dss_feats = {
static const struct dss_features dra7xx_dss_feats = { static const struct dss_features dra7xx_dss_feats = {
.model = DSS_MODEL_DRA7, .model = DSS_MODEL_DRA7,
.fck_div_max = 64, .fck_div_max = 64,
.fck_freq_max = 209250000,
.dss_fck_multiplier = 1, .dss_fck_multiplier = 1,
.parent_clk_name = "dpll_per_x2_ck", .parent_clk_name = "dpll_per_x2_ck",
.ports = dra7xx_ports, .ports = dra7xx_ports,
......
...@@ -265,6 +265,7 @@ int dss_runtime_get(void); ...@@ -265,6 +265,7 @@ int dss_runtime_get(void);
void dss_runtime_put(void); void dss_runtime_put(void);
unsigned long dss_get_dispc_clk_rate(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); 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); 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); enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void);
......
...@@ -28,13 +28,8 @@ ...@@ -28,13 +28,8 @@
#include "dss.h" #include "dss.h"
#include "dss_features.h" #include "dss_features.h"
struct dss_param_range {
int min, max;
};
struct omap_dss_features { struct omap_dss_features {
const enum omap_dss_output_id *supported_outputs; 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 */ /* 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[] = { ...@@ -100,36 +95,14 @@ static const enum omap_dss_output_id omap5_dss_supported_outputs[] = {
OMAP_DSS_OUTPUT_DSI2, 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 */ /* OMAP2 DSS Features */
static const struct omap_dss_features omap2_dss_features = { static const struct omap_dss_features omap2_dss_features = {
.supported_outputs = omap2_dss_supported_outputs, .supported_outputs = omap2_dss_supported_outputs,
.dss_params = omap2_dss_param_range,
}; };
/* OMAP3 DSS Features */ /* OMAP3 DSS Features */
static const struct omap_dss_features omap3430_dss_features = { static const struct omap_dss_features omap3430_dss_features = {
.supported_outputs = omap3430_dss_supported_outputs, .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 = { ...@@ -138,55 +111,37 @@ static const struct omap_dss_features omap3430_dss_features = {
*/ */
static const struct omap_dss_features am35xx_dss_features = { static const struct omap_dss_features am35xx_dss_features = {
.supported_outputs = omap3430_dss_supported_outputs, .supported_outputs = omap3430_dss_supported_outputs,
.dss_params = omap3_dss_param_range,
}; };
static const struct omap_dss_features am43xx_dss_features = { static const struct omap_dss_features am43xx_dss_features = {
.supported_outputs = am43xx_dss_supported_outputs, .supported_outputs = am43xx_dss_supported_outputs,
.dss_params = am43xx_dss_param_range,
}; };
static const struct omap_dss_features omap3630_dss_features = { static const struct omap_dss_features omap3630_dss_features = {
.supported_outputs = omap3630_dss_supported_outputs, .supported_outputs = omap3630_dss_supported_outputs,
.dss_params = omap3_dss_param_range,
}; };
/* OMAP4 DSS Features */ /* OMAP4 DSS Features */
/* For OMAP4430 ES 1.0 revision */ /* For OMAP4430 ES 1.0 revision */
static const struct omap_dss_features omap4430_es1_0_dss_features = { static const struct omap_dss_features omap4430_es1_0_dss_features = {
.supported_outputs = omap4_dss_supported_outputs, .supported_outputs = omap4_dss_supported_outputs,
.dss_params = omap4_dss_param_range,
}; };
/* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */ /* For OMAP4430 ES 2.0, 2.1 and 2.2 revisions */
static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = { static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
.supported_outputs = omap4_dss_supported_outputs, .supported_outputs = omap4_dss_supported_outputs,
.dss_params = omap4_dss_param_range,
}; };
/* For all the other OMAP4 versions */ /* For all the other OMAP4 versions */
static const struct omap_dss_features omap4_dss_features = { static const struct omap_dss_features omap4_dss_features = {
.supported_outputs = omap4_dss_supported_outputs, .supported_outputs = omap4_dss_supported_outputs,
.dss_params = omap4_dss_param_range,
}; };
/* OMAP5 DSS Features */ /* OMAP5 DSS Features */
static const struct omap_dss_features omap5_dss_features = { static const struct omap_dss_features omap5_dss_features = {
.supported_outputs = omap5_dss_supported_outputs, .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) enum omap_dss_output_id dss_feat_get_supported_outputs(enum omap_channel channel)
{ {
return omap_current_dss_features->supported_outputs[channel]; return omap_current_dss_features->supported_outputs[channel];
......
...@@ -25,14 +25,6 @@ ...@@ -25,14 +25,6 @@
#define MAX_DSS_LCD_MANAGERS 3 #define MAX_DSS_LCD_MANAGERS 3
#define MAX_NUM_DSI 2 #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); void dss_features_init(enum omapdss_version version);
enum omap_dss_output_id dss_feat_get_supported_outputs(enum omap_channel channel); enum omap_dss_output_id dss_feat_get_supported_outputs(enum omap_channel channel);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment