Commit 621514aa authored by Melissa Wen's avatar Melissa Wen Committed by Alex Deucher

drm/amd/display: codestyle cleanup on dc_link file until detect_dp func

Removes codestyle issues on the file dc_link until detect_dp func as
suggested by checkpatch.pl.

Types covered:

CHECK: Please don't use multiple blank lines
CHECK: Comparison to NULL could be written
ERROR: space required before the open parenthesis '('
CHECK: Alignment should match open parenthesis
CHECK: Lines should not end with a '('
WARNING: please, no space before tabs
WARNING: Comparisons should place the constant on the right side of the test
WARNING: braces {} are not necessary for single statement blocks
CHECK: Please don't use multiple blank lines
Signed-off-by: default avatarMelissa Wen <melissa.srw@gmail.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 21764099
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#define DC_LOGGER_INIT(logger) #define DC_LOGGER_INIT(logger)
#define LINK_INFO(...) \ #define LINK_INFO(...) \
DC_LOG_HW_HOTPLUG( \ DC_LOG_HW_HOTPLUG( \
__VA_ARGS__) __VA_ARGS__)
...@@ -79,7 +78,7 @@ static void dc_link_destruct(struct dc_link *link) ...@@ -79,7 +78,7 @@ static void dc_link_destruct(struct dc_link *link)
{ {
int i; int i;
if (link->hpd_gpio != NULL) { if (link->hpd_gpio) {
dal_gpio_destroy_irq(&link->hpd_gpio); dal_gpio_destroy_irq(&link->hpd_gpio);
link->hpd_gpio = NULL; link->hpd_gpio = NULL;
} }
...@@ -87,7 +86,7 @@ static void dc_link_destruct(struct dc_link *link) ...@@ -87,7 +86,7 @@ static void dc_link_destruct(struct dc_link *link)
if (link->ddc) if (link->ddc)
dal_ddc_service_destroy(&link->ddc); dal_ddc_service_destroy(&link->ddc);
if(link->link_enc) if (link->link_enc)
link->link_enc->funcs->destroy(&link->link_enc); link->link_enc->funcs->destroy(&link->link_enc);
if (link->local_sink) if (link->local_sink)
...@@ -116,8 +115,7 @@ struct gpio *get_hpd_gpio(struct dc_bios *dcb, ...@@ -116,8 +115,7 @@ struct gpio *get_hpd_gpio(struct dc_bios *dcb,
return NULL; return NULL;
} }
return dal_gpio_service_create_irq( return dal_gpio_service_create_irq(gpio_service,
gpio_service,
pin_info.offset, pin_info.offset,
pin_info.mask); pin_info.mask);
} }
...@@ -134,13 +132,10 @@ struct gpio *get_hpd_gpio(struct dc_bios *dcb, ...@@ -134,13 +132,10 @@ struct gpio *get_hpd_gpio(struct dc_bios *dcb,
* @return * @return
* true on success, false otherwise * true on success, false otherwise
*/ */
static bool program_hpd_filter( static bool program_hpd_filter(const struct dc_link *link)
const struct dc_link *link)
{ {
bool result = false; bool result = false;
struct gpio *hpd; struct gpio *hpd;
int delay_on_connect_in_ms = 0; int delay_on_connect_in_ms = 0;
int delay_on_disconnect_in_ms = 0; int delay_on_disconnect_in_ms = 0;
...@@ -161,7 +156,7 @@ static bool program_hpd_filter( ...@@ -161,7 +156,7 @@ static bool program_hpd_filter(
/* 500: not able to detect MST <-> SST switch as HPD is low for /* 500: not able to detect MST <-> SST switch as HPD is low for
* only 100ms on DELL U2413 * only 100ms on DELL U2413
* 0: some passive dongle still show aux mode instead of i2c * 0: some passive dongle still show aux mode instead of i2c
* 20-50:not enough to hide bouncing HPD with passive dongle. * 20-50: not enough to hide bouncing HPD with passive dongle.
* also see intermittent i2c read issues. * also see intermittent i2c read issues.
*/ */
delay_on_connect_in_ms = 80; delay_on_connect_in_ms = 80;
...@@ -175,7 +170,8 @@ static bool program_hpd_filter( ...@@ -175,7 +170,8 @@ static bool program_hpd_filter(
} }
/* Obtain HPD handle */ /* Obtain HPD handle */
hpd = get_hpd_gpio(link->ctx->dc_bios, link->link_id, link->ctx->gpio_service); hpd = get_hpd_gpio(link->ctx->dc_bios, link->link_id,
link->ctx->gpio_service);
if (!hpd) if (!hpd)
return result; return result;
...@@ -226,8 +222,9 @@ bool dc_link_detect_sink(struct dc_link *link, enum dc_connection_type *type) ...@@ -226,8 +222,9 @@ bool dc_link_detect_sink(struct dc_link *link, enum dc_connection_type *type)
} }
/* todo: may need to lock gpio access */ /* todo: may need to lock gpio access */
hpd_pin = get_hpd_gpio(link->ctx->dc_bios, link->link_id, link->ctx->gpio_service); hpd_pin = get_hpd_gpio(link->ctx->dc_bios, link->link_id,
if (hpd_pin == NULL) link->ctx->gpio_service);
if (!hpd_pin)
goto hpd_gpio_failure; goto hpd_gpio_failure;
dal_gpio_open(hpd_pin, GPIO_MODE_INTERRUPT); dal_gpio_open(hpd_pin, GPIO_MODE_INTERRUPT);
...@@ -248,8 +245,7 @@ bool dc_link_detect_sink(struct dc_link *link, enum dc_connection_type *type) ...@@ -248,8 +245,7 @@ bool dc_link_detect_sink(struct dc_link *link, enum dc_connection_type *type)
return false; return false;
} }
static enum ddc_transaction_type get_ddc_transaction_type( static enum ddc_transaction_type get_ddc_transaction_type(enum signal_type sink_signal)
enum signal_type sink_signal)
{ {
enum ddc_transaction_type transaction_type = DDC_TRANSACTION_TYPE_NONE; enum ddc_transaction_type transaction_type = DDC_TRANSACTION_TYPE_NONE;
...@@ -282,8 +278,7 @@ static enum ddc_transaction_type get_ddc_transaction_type( ...@@ -282,8 +278,7 @@ static enum ddc_transaction_type get_ddc_transaction_type(
return transaction_type; return transaction_type;
} }
static enum signal_type get_basic_signal_type( static enum signal_type get_basic_signal_type(struct graphics_object_id encoder,
struct graphics_object_id encoder,
struct graphics_object_id downstream) struct graphics_object_id downstream)
{ {
if (downstream.type == OBJECT_TYPE_CONNECTOR) { if (downstream.type == OBJECT_TYPE_CONNECTOR) {
...@@ -373,8 +368,8 @@ bool dc_link_is_dp_sink_present(struct dc_link *link) ...@@ -373,8 +368,8 @@ bool dc_link_is_dp_sink_present(struct dc_link *link)
* which indicates we need additional delay * which indicates we need additional delay
*/ */
if (GPIO_RESULT_OK != dal_ddc_open( if (dal_ddc_open(ddc, GPIO_MODE_INPUT,
ddc, GPIO_MODE_INPUT, GPIO_DDC_CONFIG_TYPE_MODE_I2C)) { GPIO_DDC_CONFIG_TYPE_MODE_I2C) != GPIO_RESULT_OK) {
dal_ddc_close(ddc); dal_ddc_close(ddc);
return present; return present;
...@@ -408,12 +403,11 @@ bool dc_link_is_dp_sink_present(struct dc_link *link) ...@@ -408,12 +403,11 @@ bool dc_link_is_dp_sink_present(struct dc_link *link)
* @brief * @brief
* Detect output sink type * Detect output sink type
*/ */
static enum signal_type link_detect_sink( static enum signal_type link_detect_sink(struct dc_link *link,
struct dc_link *link,
enum dc_detect_reason reason) enum dc_detect_reason reason)
{ {
enum signal_type result = get_basic_signal_type( enum signal_type result = get_basic_signal_type(link->link_enc->id,
link->link_enc->id, link->link_id); link->link_id);
/* Internal digital encoder will detect only dongles /* Internal digital encoder will detect only dongles
* that require digital signal * that require digital signal
...@@ -428,17 +422,16 @@ static enum signal_type link_detect_sink( ...@@ -428,17 +422,16 @@ static enum signal_type link_detect_sink(
*/ */
/* PCIE detects the actual connector on add-on board */ /* PCIE detects the actual connector on add-on board */
if (link->link_id.id == CONNECTOR_ID_PCIE)
if (link->link_id.id == CONNECTOR_ID_PCIE) {
/* ZAZTODO implement PCIE add-on card detection */ /* ZAZTODO implement PCIE add-on card detection */
}
switch (link->link_id.id) { switch (link->link_id.id) {
case CONNECTOR_ID_HDMI_TYPE_A: { case CONNECTOR_ID_HDMI_TYPE_A: {
/* check audio support: /* check audio support:
* if native HDMI is not supported, switch to DVI * if native HDMI is not supported, switch to DVI
*/ */
struct audio_support *aud_support = &link->dc->res_pool->audio_support; struct audio_support *aud_support =
&link->dc->res_pool->audio_support;
if (!aud_support->hdmi_audio_native) if (!aud_support->hdmi_audio_native)
if (link->link_id.id == CONNECTOR_ID_HDMI_TYPE_A) if (link->link_id.id == CONNECTOR_ID_HDMI_TYPE_A)
...@@ -466,8 +459,7 @@ static enum signal_type link_detect_sink( ...@@ -466,8 +459,7 @@ static enum signal_type link_detect_sink(
return result; return result;
} }
static enum signal_type decide_signal_from_strap_and_dongle_type( static enum signal_type decide_signal_from_strap_and_dongle_type(enum display_dongle_type dongle_type,
enum display_dongle_type dongle_type,
struct audio_support *audio_support) struct audio_support *audio_support)
{ {
enum signal_type signal = SIGNAL_TYPE_NONE; enum signal_type signal = SIGNAL_TYPE_NONE;
...@@ -496,15 +488,13 @@ static enum signal_type decide_signal_from_strap_and_dongle_type( ...@@ -496,15 +488,13 @@ static enum signal_type decide_signal_from_strap_and_dongle_type(
return signal; return signal;
} }
static enum signal_type dp_passive_dongle_detection( static enum signal_type dp_passive_dongle_detection(struct ddc_service *ddc,
struct ddc_service *ddc,
struct display_sink_capability *sink_cap, struct display_sink_capability *sink_cap,
struct audio_support *audio_support) struct audio_support *audio_support)
{ {
dal_ddc_service_i2c_query_dp_dual_mode_adaptor( dal_ddc_service_i2c_query_dp_dual_mode_adaptor(ddc, sink_cap);
ddc, sink_cap);
return decide_signal_from_strap_and_dongle_type( return decide_signal_from_strap_and_dongle_type(sink_cap->dongle_type,
sink_cap->dongle_type,
audio_support); audio_support);
} }
...@@ -524,7 +514,6 @@ static void link_disconnect_remap(struct dc_sink *prev_sink, struct dc_link *lin ...@@ -524,7 +514,6 @@ static void link_disconnect_remap(struct dc_sink *prev_sink, struct dc_link *lin
link->local_sink = prev_sink; link->local_sink = prev_sink;
} }
static void read_current_link_settings_on_detect(struct dc_link *link) static void read_current_link_settings_on_detect(struct dc_link *link)
{ {
union lane_count_set lane_count_set = { {0} }; union lane_count_set lane_count_set = { {0} };
...@@ -537,8 +526,7 @@ static void read_current_link_settings_on_detect(struct dc_link *link) ...@@ -537,8 +526,7 @@ static void read_current_link_settings_on_detect(struct dc_link *link)
// Read DPCD 00101h to find out the number of lanes currently set // Read DPCD 00101h to find out the number of lanes currently set
for (i = 0; i < read_dpcd_retry_cnt; i++) { for (i = 0; i < read_dpcd_retry_cnt; i++) {
status = core_link_read_dpcd( status = core_link_read_dpcd(link,
link,
DP_LANE_COUNT_SET, DP_LANE_COUNT_SET,
&lane_count_set.raw, &lane_count_set.raw,
sizeof(lane_count_set)); sizeof(lane_count_set));
...@@ -548,7 +536,8 @@ static void read_current_link_settings_on_detect(struct dc_link *link) ...@@ -548,7 +536,8 @@ static void read_current_link_settings_on_detect(struct dc_link *link)
* case scenario of 80 ms. * case scenario of 80 ms.
*/ */
if (status == DC_OK) { if (status == DC_OK) {
link->cur_link_settings.lane_count = lane_count_set.bits.LANE_COUNT_SET; link->cur_link_settings.lane_count =
lane_count_set.bits.LANE_COUNT_SET;
break; break;
} }
......
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