@@ -3684,7 +3684,7 @@ int tokenize_dp_config(char *input_buffer, char *output[])
static int displayport_parse_config(char *input_buffer,
ssize_t buffer_size,
- struct intel_dp_link_config *dp_conf)
+ struct intel_dp *intel_dp)
{
int status = 0;
char *lines[MAX_DP_CONFIG_LINE_COUNT];
@@ -3715,19 +3715,11 @@ static int displayport_parse_config(char *input_buffer,
}
}
- for (i = 1; i < DP_PARAMETER_COUNT; i++)
- DRM_DEBUG_DRIVER("%s = %lu\n",
- dp_conf_tokens[parms[i].type],
- parms[i].value);
-
/* Validate any/all incoming parameters */
- strcpy(dp_conf->connector_name,
- (char *)parms[DP_CONFIG_PARAM_CONNECTOR].value);
-
if (parms[DP_CONFIG_PARAM_LINK_RATE].value == 0x06 ||
parms[DP_CONFIG_PARAM_LINK_RATE].value == 0x0a ||
parms[DP_CONFIG_PARAM_LINK_RATE].value == 0x14) {
- dp_conf->link_rate =
+ intel_dp->compliance_config.link_rate =
parms[DP_CONFIG_PARAM_LINK_RATE].value;
} else
return -EINVAL;
@@ -3735,21 +3727,21 @@ static int displayport_parse_config(char *input_buffer,
if (parms[DP_CONFIG_PARAM_LANE_COUNT].value == 0x01 ||
parms[DP_CONFIG_PARAM_LANE_COUNT].value == 0x02 ||
parms[DP_CONFIG_PARAM_LANE_COUNT].value == 0x04) {
- dp_conf->lane_count =
+ intel_dp->compliance_config.lane_count =
parms[DP_CONFIG_PARAM_LANE_COUNT].value;
} else
return -EINVAL;
if (parms[DP_CONFIG_PARAM_VOLTAGE_SWING].value <= 0x03 &&
parms[DP_CONFIG_PARAM_VOLTAGE_SWING].value >= 0x00) {
- dp_conf->vswing_level =
+ intel_dp->compliance_config.vswing_level =
parms[DP_CONFIG_PARAM_VOLTAGE_SWING].value;
} else
return -EINVAL;
if (parms[DP_CONFIG_PARAM_PREEMPHASIS].value <= 0x03 &&
parms[DP_CONFIG_PARAM_PREEMPHASIS].value >= 0x00) {
- dp_conf->preemp_level =
+ intel_dp->compliance_config.preemp_level =
parms[DP_CONFIG_PARAM_PREEMPHASIS].value;
} else
return -EINVAL;
@@ -3758,21 +3750,21 @@ static int displayport_parse_config(char *input_buffer,
parms[DP_CONFIG_PARAM_BPP].value == 24 ||
parms[DP_CONFIG_PARAM_BPP].value == 30 ||
parms[DP_CONFIG_PARAM_BPP].value == 36) {
- dp_conf->bits_per_pixel =
+ intel_dp->compliance_config.bits_per_pixel =
parms[DP_CONFIG_PARAM_PREEMPHASIS].value;
} else
return -EINVAL;
if (parms[DP_CONFIG_PARAM_HRES].value > 0 &&
parms[DP_CONFIG_PARAM_HRES].value <= 8192) {
- dp_conf->hres =
+ intel_dp->compliance_config.hres =
parms[DP_CONFIG_PARAM_HRES].value;
} else
return -EINVAL;
if (parms[DP_CONFIG_PARAM_VRES].value > 0 &&
parms[DP_CONFIG_PARAM_VRES].value <= 8192) {
- dp_conf->vres =
+ intel_dp->compliance_config.vres =
parms[DP_CONFIG_PARAM_VRES].value;
} else
return -EINVAL;
@@ -3830,7 +3822,6 @@ static ssize_t displayport_config_ctl_write(struct file *file,
struct intel_encoder *intel_encoder;
struct intel_connector *intel_connector;
struct intel_dp *intel_dp;
- struct intel_dp_link_config dp_conf;
m = file->private_data;
if (!m) {
@@ -3857,9 +3848,7 @@ static ssize_t displayport_config_ctl_write(struct file *file,
}
input_buffer[len] = '\0';
- memset(&dp_conf, 0, sizeof(struct intel_dp_link_config));
DRM_DEBUG_DRIVER("Copied %d bytes from user\n", (unsigned int)len);
- status = displayport_parse_config(input_buffer, len, &dp_conf);
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
intel_connector = to_intel_connector(connector);
@@ -3868,9 +3857,11 @@ static ssize_t displayport_config_ctl_write(struct file *file,
if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT ||
intel_encoder->type == INTEL_OUTPUT_UNKNOWN) {
intel_dp = enc_to_intel_dp(&intel_encoder->base);
- memcpy(&intel_dp->compliance_config,
- &dp_conf,
- sizeof(struct intel_dp_link_config));
+ status = displayport_parse_config(input_buffer,
+ len,
+ intel_dp);
+ if (status < 0)
+ goto out;
}
}
}
@@ -554,6 +554,18 @@ enum edp_drrs_refresh_rate_type {
DRRS_MAX_RR, /* RR count */
};
+struct intel_dp_link_config {
+ uint8_t lane_count;
+ uint8_t link_rate;
+ uint8_t vswing_level;
+ uint8_t preemp_level;
+ uint32_t hres;
+ uint32_t vres;
+ uint8_t bits_per_pixel;
+ struct drm_display_mode *compliance_mode;
+ char connector_name[12];
+};
+
struct intel_dp {
uint32_t output_reg;
uint32_t aux_ch_ctl_reg;
@@ -613,11 +625,13 @@ struct intel_dp {
enum edp_drrs_refresh_rate_type refresh_rate_type;
struct mutex mutex;
} drrs_state;
+
/* Displayport compliance testing */
unsigned long compliance_app_pid;
unsigned long compliance_test_data;
bool compliance_testing_active;
-
+ struct intel_dp_link_config compliance_config;
+ struct intel_dp_link_config saved_config;
};
struct intel_digital_port {
Adds a struct to hold link configuration parameters and several other variables for use during Displayport compliance testing. Adding these items here allows for efficient handling of compliance test data and configuration parameters where necessary in the driver. Also updates the debugfs interface to use these new parameters instead of storing them in an intermediate structure. Values are stored on a per-connector basis in the intel_dp struct. Signed-off-by: Todd Previte <tprevite@gmail.com> --- drivers/gpu/drm/i915/i915_debugfs.c | 35 +++++++++++++---------------------- drivers/gpu/drm/i915/intel_drv.h | 16 +++++++++++++++- 2 files changed, 28 insertions(+), 23 deletions(-)