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 @@
#define DC_LOGGER_INIT(logger)
#define LINK_INFO(...) \
DC_LOG_HW_HOTPLUG( \
__VA_ARGS__)
......@@ -79,7 +78,7 @@ static void dc_link_destruct(struct dc_link *link)
{
int i;
if (link->hpd_gpio != NULL) {
if (link->hpd_gpio) {
dal_gpio_destroy_irq(&link->hpd_gpio);
link->hpd_gpio = NULL;
}
......@@ -87,7 +86,7 @@ static void dc_link_destruct(struct dc_link *link)
if (link->ddc)
dal_ddc_service_destroy(&link->ddc);
if(link->link_enc)
if (link->link_enc)
link->link_enc->funcs->destroy(&link->link_enc);
if (link->local_sink)
......@@ -116,8 +115,7 @@ struct gpio *get_hpd_gpio(struct dc_bios *dcb,
return NULL;
}
return dal_gpio_service_create_irq(
gpio_service,
return dal_gpio_service_create_irq(gpio_service,
pin_info.offset,
pin_info.mask);
}
......@@ -134,13 +132,10 @@ struct gpio *get_hpd_gpio(struct dc_bios *dcb,
* @return
* true on success, false otherwise
*/
static bool program_hpd_filter(
const struct dc_link *link)
static bool program_hpd_filter(const struct dc_link *link)
{
bool result = false;
struct gpio *hpd;
int delay_on_connect_in_ms = 0;
int delay_on_disconnect_in_ms = 0;
......@@ -161,7 +156,7 @@ static bool program_hpd_filter(
/* 500: not able to detect MST <-> SST switch as HPD is low for
* only 100ms on DELL U2413
* 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.
*/
delay_on_connect_in_ms = 80;
......@@ -175,7 +170,8 @@ static bool program_hpd_filter(
}
/* 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)
return result;
......@@ -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 */
hpd_pin = get_hpd_gpio(link->ctx->dc_bios, link->link_id, link->ctx->gpio_service);
if (hpd_pin == NULL)
hpd_pin = get_hpd_gpio(link->ctx->dc_bios, link->link_id,
link->ctx->gpio_service);
if (!hpd_pin)
goto hpd_gpio_failure;
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)
return false;
}
static enum ddc_transaction_type get_ddc_transaction_type(
enum signal_type sink_signal)
static enum ddc_transaction_type get_ddc_transaction_type(enum signal_type sink_signal)
{
enum ddc_transaction_type transaction_type = DDC_TRANSACTION_TYPE_NONE;
......@@ -282,8 +278,7 @@ static enum ddc_transaction_type get_ddc_transaction_type(
return transaction_type;
}
static enum signal_type get_basic_signal_type(
struct graphics_object_id encoder,
static enum signal_type get_basic_signal_type(struct graphics_object_id encoder,
struct graphics_object_id downstream)
{
if (downstream.type == OBJECT_TYPE_CONNECTOR) {
......@@ -373,8 +368,8 @@ bool dc_link_is_dp_sink_present(struct dc_link *link)
* which indicates we need additional delay
*/
if (GPIO_RESULT_OK != dal_ddc_open(
ddc, GPIO_MODE_INPUT, GPIO_DDC_CONFIG_TYPE_MODE_I2C)) {
if (dal_ddc_open(ddc, GPIO_MODE_INPUT,
GPIO_DDC_CONFIG_TYPE_MODE_I2C) != GPIO_RESULT_OK) {
dal_ddc_close(ddc);
return present;
......@@ -408,12 +403,11 @@ bool dc_link_is_dp_sink_present(struct dc_link *link)
* @brief
* Detect output sink type
*/
static enum signal_type link_detect_sink(
struct dc_link *link,
static enum signal_type link_detect_sink(struct dc_link *link,
enum dc_detect_reason reason)
{
enum signal_type result = get_basic_signal_type(
link->link_enc->id, link->link_id);
enum signal_type result = get_basic_signal_type(link->link_enc->id,
link->link_id);
/* Internal digital encoder will detect only dongles
* that require digital signal
......@@ -428,17 +422,16 @@ static enum signal_type link_detect_sink(
*/
/* 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 */
}
switch (link->link_id.id) {
case CONNECTOR_ID_HDMI_TYPE_A: {
/* check audio support:
* 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 (link->link_id.id == CONNECTOR_ID_HDMI_TYPE_A)
......@@ -466,8 +459,7 @@ static enum signal_type link_detect_sink(
return result;
}
static enum signal_type decide_signal_from_strap_and_dongle_type(
enum display_dongle_type dongle_type,
static enum signal_type decide_signal_from_strap_and_dongle_type(enum display_dongle_type dongle_type,
struct audio_support *audio_support)
{
enum signal_type signal = SIGNAL_TYPE_NONE;
......@@ -496,15 +488,13 @@ static enum signal_type decide_signal_from_strap_and_dongle_type(
return signal;
}
static enum signal_type dp_passive_dongle_detection(
struct ddc_service *ddc,
static enum signal_type dp_passive_dongle_detection(struct ddc_service *ddc,
struct display_sink_capability *sink_cap,
struct audio_support *audio_support)
{
dal_ddc_service_i2c_query_dp_dual_mode_adaptor(
ddc, sink_cap);
return decide_signal_from_strap_and_dongle_type(
sink_cap->dongle_type,
dal_ddc_service_i2c_query_dp_dual_mode_adaptor(ddc, sink_cap);
return decide_signal_from_strap_and_dongle_type(sink_cap->dongle_type,
audio_support);
}
......@@ -524,7 +514,6 @@ static void link_disconnect_remap(struct dc_sink *prev_sink, struct dc_link *lin
link->local_sink = prev_sink;
}
static void read_current_link_settings_on_detect(struct dc_link *link)
{
union lane_count_set lane_count_set = { {0} };
......@@ -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
for (i = 0; i < read_dpcd_retry_cnt; i++) {
status = core_link_read_dpcd(
link,
status = core_link_read_dpcd(link,
DP_LANE_COUNT_SET,
&lane_count_set.raw,
sizeof(lane_count_set));
......@@ -548,7 +536,8 @@ static void read_current_link_settings_on_detect(struct dc_link *link)
* case scenario of 80 ms.
*/
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;
}
......
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