drm: bridge: analogix/dp: fix some obvious code style
Fix some obvious alignment problems, like alignment and line over 80 characters problems, make this easy to be maintained later. Acked-by: Jingoo Han <jingoohan1@gmail.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Tested-by: Caesar Wang <wxt@rock-chips.com> Tested-by: Douglas Anderson <dianders@chromium.org> Tested-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Yakir Yang <ykk@rock-chips.com>
This commit is contained in:
Родитель
092f899420
Коммит
bcbb7033ac
|
@ -64,7 +64,7 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp)
|
|||
|
||||
while (analogix_dp_get_plug_in_status(dp) != 0) {
|
||||
timeout_loop++;
|
||||
if (DP_TIMEOUT_LOOP_COUNT < timeout_loop) {
|
||||
if (timeout_loop > DP_TIMEOUT_LOOP_COUNT) {
|
||||
dev_err(dp->dev, "failed to get hpd plug status\n");
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
@ -110,7 +110,8 @@ static int analogix_dp_read_edid(struct analogix_dp_device *dp)
|
|||
dev_dbg(dp->dev, "EDID data includes a single extension!\n");
|
||||
|
||||
/* Read EDID data */
|
||||
retval = analogix_dp_read_bytes_from_i2c(dp, I2C_EDID_DEVICE_ADDR,
|
||||
retval = analogix_dp_read_bytes_from_i2c(dp,
|
||||
I2C_EDID_DEVICE_ADDR,
|
||||
EDID_HEADER_PATTERN,
|
||||
EDID_BLOCK_LENGTH,
|
||||
&edid[EDID_HEADER_PATTERN]);
|
||||
|
@ -155,10 +156,8 @@ static int analogix_dp_read_edid(struct analogix_dp_device *dp)
|
|||
|
||||
/* Read EDID data */
|
||||
retval = analogix_dp_read_bytes_from_i2c(dp,
|
||||
I2C_EDID_DEVICE_ADDR,
|
||||
EDID_HEADER_PATTERN,
|
||||
EDID_BLOCK_LENGTH,
|
||||
&edid[EDID_HEADER_PATTERN]);
|
||||
I2C_EDID_DEVICE_ADDR, EDID_HEADER_PATTERN,
|
||||
EDID_BLOCK_LENGTH, &edid[EDID_HEADER_PATTERN]);
|
||||
if (retval != 0) {
|
||||
dev_err(dp->dev, "EDID Read failed!\n");
|
||||
return -EIO;
|
||||
|
@ -169,16 +168,13 @@ static int analogix_dp_read_edid(struct analogix_dp_device *dp)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
analogix_dp_read_byte_from_dpcd(dp,
|
||||
DP_TEST_REQUEST,
|
||||
analogix_dp_read_byte_from_dpcd(dp, DP_TEST_REQUEST,
|
||||
&test_vector);
|
||||
if (test_vector & DP_TEST_LINK_EDID_READ) {
|
||||
analogix_dp_write_byte_to_dpcd(dp,
|
||||
DP_TEST_EDID_CHECKSUM,
|
||||
edid[EDID_CHECKSUM]);
|
||||
DP_TEST_EDID_CHECKSUM, edid[EDID_CHECKSUM]);
|
||||
analogix_dp_write_byte_to_dpcd(dp,
|
||||
DP_TEST_RESPONSE,
|
||||
DP_TEST_EDID_CHECKSUM_WRITE);
|
||||
DP_TEST_RESPONSE, DP_TEST_EDID_CHECKSUM_WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,8 +189,7 @@ static int analogix_dp_handle_edid(struct analogix_dp_device *dp)
|
|||
int retval;
|
||||
|
||||
/* Read DPCD DP_DPCD_REV~RECEIVE_PORT1_CAP_1 */
|
||||
retval = analogix_dp_read_bytes_from_dpcd(dp, DP_DPCD_REV,
|
||||
12, buf);
|
||||
retval = analogix_dp_read_bytes_from_dpcd(dp, DP_DPCD_REV, 12, buf);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
|
@ -208,7 +203,8 @@ static int analogix_dp_handle_edid(struct analogix_dp_device *dp)
|
|||
return retval;
|
||||
}
|
||||
|
||||
static void analogix_dp_enable_rx_to_enhanced_mode(struct analogix_dp_device *dp,
|
||||
static void
|
||||
analogix_dp_enable_rx_to_enhanced_mode(struct analogix_dp_device *dp,
|
||||
bool enable)
|
||||
{
|
||||
u8 data;
|
||||
|
@ -248,12 +244,12 @@ static void analogix_dp_training_pattern_dis(struct analogix_dp_device *dp)
|
|||
{
|
||||
analogix_dp_set_training_pattern(dp, DP_NONE);
|
||||
|
||||
analogix_dp_write_byte_to_dpcd(dp,
|
||||
DP_TRAINING_PATTERN_SET,
|
||||
analogix_dp_write_byte_to_dpcd(dp, DP_TRAINING_PATTERN_SET,
|
||||
DP_TRAINING_PATTERN_DISABLE);
|
||||
}
|
||||
|
||||
static void analogix_dp_set_lane_lane_pre_emphasis(struct analogix_dp_device *dp,
|
||||
static void
|
||||
analogix_dp_set_lane_lane_pre_emphasis(struct analogix_dp_device *dp,
|
||||
int pre_emphasis, int lane)
|
||||
{
|
||||
switch (lane) {
|
||||
|
@ -294,8 +290,7 @@ static int analogix_dp_link_start(struct analogix_dp_device *dp)
|
|||
/* Setup RX configuration */
|
||||
buf[0] = dp->link_train.link_rate;
|
||||
buf[1] = dp->link_train.lane_count;
|
||||
retval = analogix_dp_write_bytes_to_dpcd(dp, DP_LINK_BW_SET,
|
||||
2, buf);
|
||||
retval = analogix_dp_write_bytes_to_dpcd(dp, DP_LINK_BW_SET, 2, buf);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
|
@ -339,7 +334,7 @@ static int analogix_dp_link_start(struct analogix_dp_device *dp)
|
|||
static unsigned char analogix_dp_get_lane_status(u8 link_status[2], int lane)
|
||||
{
|
||||
int shift = (lane & 1) * 4;
|
||||
u8 link_value = link_status[lane>>1];
|
||||
u8 link_value = link_status[lane >> 1];
|
||||
|
||||
return (link_value >> shift) & 0xf;
|
||||
}
|
||||
|
@ -376,11 +371,11 @@ static int analogix_dp_channel_eq_ok(u8 link_status[2], u8 link_align,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static unsigned char analogix_dp_get_adjust_request_voltage(u8 adjust_request[2],
|
||||
int lane)
|
||||
static unsigned char
|
||||
analogix_dp_get_adjust_request_voltage(u8 adjust_request[2], int lane)
|
||||
{
|
||||
int shift = (lane & 1) * 4;
|
||||
u8 link_value = adjust_request[lane>>1];
|
||||
u8 link_value = adjust_request[lane >> 1];
|
||||
|
||||
return (link_value >> shift) & 0x3;
|
||||
}
|
||||
|
@ -390,7 +385,7 @@ static unsigned char analogix_dp_get_adjust_request_pre_emphasis(
|
|||
int lane)
|
||||
{
|
||||
int shift = (lane & 1) * 4;
|
||||
u8 link_value = adjust_request[lane>>1];
|
||||
u8 link_value = adjust_request[lane >> 1];
|
||||
|
||||
return ((link_value >> shift) & 0xc) >> 2;
|
||||
}
|
||||
|
@ -416,8 +411,8 @@ static void analogix_dp_set_lane_link_training(struct analogix_dp_device *dp,
|
|||
}
|
||||
}
|
||||
|
||||
static unsigned int analogix_dp_get_lane_link_training(
|
||||
struct analogix_dp_device *dp,
|
||||
static unsigned int
|
||||
analogix_dp_get_lane_link_training(struct analogix_dp_device *dp,
|
||||
int lane)
|
||||
{
|
||||
u32 reg;
|
||||
|
@ -725,8 +720,7 @@ static int analogix_dp_sw_link_training(struct analogix_dp_device *dp)
|
|||
}
|
||||
|
||||
static int analogix_dp_set_link_train(struct analogix_dp_device *dp,
|
||||
u32 count,
|
||||
u32 bwtype)
|
||||
u32 count, u32 bwtype)
|
||||
{
|
||||
int i;
|
||||
int retval;
|
||||
|
@ -762,7 +756,7 @@ static int analogix_dp_config_video(struct analogix_dp_device *dp)
|
|||
timeout_loop++;
|
||||
if (analogix_dp_is_slave_video_stream_clock_on(dp) == 0)
|
||||
break;
|
||||
if (DP_TIMEOUT_LOOP_COUNT < timeout_loop) {
|
||||
if (timeout_loop > DP_TIMEOUT_LOOP_COUNT) {
|
||||
dev_err(dp->dev, "Timeout of video streamclk ok\n");
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
@ -793,7 +787,7 @@ static int analogix_dp_config_video(struct analogix_dp_device *dp)
|
|||
} else if (done_count) {
|
||||
done_count = 0;
|
||||
}
|
||||
if (DP_TIMEOUT_LOOP_COUNT < timeout_loop) {
|
||||
if (timeout_loop > DP_TIMEOUT_LOOP_COUNT) {
|
||||
dev_err(dp->dev, "Timeout of video streamclk ok\n");
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
@ -807,15 +801,15 @@ static int analogix_dp_config_video(struct analogix_dp_device *dp)
|
|||
return retval;
|
||||
}
|
||||
|
||||
static void analogix_dp_enable_scramble(struct analogix_dp_device *dp, bool enable)
|
||||
static void analogix_dp_enable_scramble(struct analogix_dp_device *dp,
|
||||
bool enable)
|
||||
{
|
||||
u8 data;
|
||||
|
||||
if (enable) {
|
||||
analogix_dp_enable_scrambling(dp);
|
||||
|
||||
analogix_dp_read_byte_from_dpcd(dp,
|
||||
DP_TRAINING_PATTERN_SET,
|
||||
analogix_dp_read_byte_from_dpcd(dp, DP_TRAINING_PATTERN_SET,
|
||||
&data);
|
||||
analogix_dp_write_byte_to_dpcd(dp,
|
||||
DP_TRAINING_PATTERN_SET,
|
||||
|
@ -823,8 +817,7 @@ static void analogix_dp_enable_scramble(struct analogix_dp_device *dp, bool enab
|
|||
} else {
|
||||
analogix_dp_disable_scrambling(dp);
|
||||
|
||||
analogix_dp_read_byte_from_dpcd(dp,
|
||||
DP_TRAINING_PATTERN_SET,
|
||||
analogix_dp_read_byte_from_dpcd(dp, DP_TRAINING_PATTERN_SET,
|
||||
&data);
|
||||
analogix_dp_write_byte_to_dpcd(dp,
|
||||
DP_TRAINING_PATTERN_SET,
|
||||
|
@ -1130,8 +1123,8 @@ static struct video_info *analogix_dp_dt_parse_pdata(struct device *dev)
|
|||
struct device_node *dp_node = dev->of_node;
|
||||
struct video_info *dp_video_config;
|
||||
|
||||
dp_video_config = devm_kzalloc(dev,
|
||||
sizeof(*dp_video_config), GFP_KERNEL);
|
||||
dp_video_config = devm_kzalloc(dev, sizeof(*dp_video_config),
|
||||
GFP_KERNEL);
|
||||
if (!dp_video_config)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
|
|
|
@ -216,13 +216,18 @@ void analogix_dp_set_link_bandwidth(struct analogix_dp_device *dp, u32 bwtype);
|
|||
void analogix_dp_get_link_bandwidth(struct analogix_dp_device *dp, u32 *bwtype);
|
||||
void analogix_dp_set_lane_count(struct analogix_dp_device *dp, u32 count);
|
||||
void analogix_dp_get_lane_count(struct analogix_dp_device *dp, u32 *count);
|
||||
void analogix_dp_enable_enhanced_mode(struct analogix_dp_device *dp, bool enable);
|
||||
void analogix_dp_enable_enhanced_mode(struct analogix_dp_device *dp,
|
||||
bool enable);
|
||||
void analogix_dp_set_training_pattern(struct analogix_dp_device *dp,
|
||||
enum pattern_set pattern);
|
||||
void analogix_dp_set_lane0_pre_emphasis(struct analogix_dp_device *dp, u32 level);
|
||||
void analogix_dp_set_lane1_pre_emphasis(struct analogix_dp_device *dp, u32 level);
|
||||
void analogix_dp_set_lane2_pre_emphasis(struct analogix_dp_device *dp, u32 level);
|
||||
void analogix_dp_set_lane3_pre_emphasis(struct analogix_dp_device *dp, u32 level);
|
||||
void analogix_dp_set_lane0_pre_emphasis(struct analogix_dp_device *dp,
|
||||
u32 level);
|
||||
void analogix_dp_set_lane1_pre_emphasis(struct analogix_dp_device *dp,
|
||||
u32 level);
|
||||
void analogix_dp_set_lane2_pre_emphasis(struct analogix_dp_device *dp,
|
||||
u32 level);
|
||||
void analogix_dp_set_lane3_pre_emphasis(struct analogix_dp_device *dp,
|
||||
u32 level);
|
||||
void analogix_dp_set_lane0_link_training(struct analogix_dp_device *dp,
|
||||
u32 training_lane);
|
||||
void analogix_dp_set_lane1_link_training(struct analogix_dp_device *dp,
|
||||
|
@ -245,7 +250,8 @@ void analogix_dp_set_video_cr_mn(struct analogix_dp_device *dp,
|
|||
u32 m_value,
|
||||
u32 n_value);
|
||||
void analogix_dp_set_video_timing_mode(struct analogix_dp_device *dp, u32 type);
|
||||
void analogix_dp_enable_video_master(struct analogix_dp_device *dp, bool enable);
|
||||
void analogix_dp_enable_video_master(struct analogix_dp_device *dp,
|
||||
bool enable);
|
||||
void analogix_dp_start_video(struct analogix_dp_device *dp);
|
||||
int analogix_dp_is_video_stream_on(struct analogix_dp_device *dp);
|
||||
void analogix_dp_config_video_slave_mode(struct analogix_dp_device *dp);
|
||||
|
|
|
@ -399,7 +399,7 @@ void analogix_dp_init_aux(struct analogix_dp_device *dp)
|
|||
analogix_dp_reset_aux(dp);
|
||||
|
||||
/* Disable AUX transaction H/W retry */
|
||||
reg = AUX_BIT_PERIOD_EXPECTED_DELAY(3) | AUX_HW_RETRY_COUNT_SEL(0)|
|
||||
reg = AUX_BIT_PERIOD_EXPECTED_DELAY(3) | AUX_HW_RETRY_COUNT_SEL(0) |
|
||||
AUX_HW_RETRY_INTERVAL_600_MICROSECONDS;
|
||||
writel(reg, dp->reg_base + ANALOGIX_DP_AUX_HW_RETRY_CTL);
|
||||
|
||||
|
@ -519,9 +519,8 @@ int analogix_dp_write_byte_to_dpcd(struct analogix_dp_device *dp,
|
|||
retval = analogix_dp_start_aux_transaction(dp);
|
||||
if (retval == 0)
|
||||
break;
|
||||
else
|
||||
dev_dbg(dp->dev, "%s: Aux Transaction fail!\n",
|
||||
__func__);
|
||||
|
||||
dev_dbg(dp->dev, "%s: Aux Transaction fail!\n", __func__);
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
@ -560,9 +559,8 @@ int analogix_dp_read_byte_from_dpcd(struct analogix_dp_device *dp,
|
|||
retval = analogix_dp_start_aux_transaction(dp);
|
||||
if (retval == 0)
|
||||
break;
|
||||
else
|
||||
dev_dbg(dp->dev, "%s: Aux Transaction fail!\n",
|
||||
__func__);
|
||||
|
||||
dev_dbg(dp->dev, "%s: Aux Transaction fail!\n", __func__);
|
||||
}
|
||||
|
||||
/* Read data buffer */
|
||||
|
@ -608,8 +606,9 @@ int analogix_dp_write_bytes_to_dpcd(struct analogix_dp_device *dp,
|
|||
for (cur_data_idx = 0; cur_data_idx < cur_data_count;
|
||||
cur_data_idx++) {
|
||||
reg = data[start_offset + cur_data_idx];
|
||||
writel(reg, dp->reg_base + ANALOGIX_DP_BUF_DATA_0
|
||||
+ 4 * cur_data_idx);
|
||||
writel(reg, dp->reg_base +
|
||||
ANALOGIX_DP_BUF_DATA_0 +
|
||||
4 * cur_data_idx);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -625,7 +624,7 @@ int analogix_dp_write_bytes_to_dpcd(struct analogix_dp_device *dp,
|
|||
retval = analogix_dp_start_aux_transaction(dp);
|
||||
if (retval == 0)
|
||||
break;
|
||||
else
|
||||
|
||||
dev_dbg(dp->dev, "%s: Aux Transaction fail!\n",
|
||||
__func__);
|
||||
}
|
||||
|
@ -683,7 +682,7 @@ int analogix_dp_read_bytes_from_dpcd(struct analogix_dp_device *dp,
|
|||
retval = analogix_dp_start_aux_transaction(dp);
|
||||
if (retval == 0)
|
||||
break;
|
||||
else
|
||||
|
||||
dev_dbg(dp->dev, "%s: Aux Transaction fail!\n",
|
||||
__func__);
|
||||
}
|
||||
|
@ -750,7 +749,8 @@ int analogix_dp_read_byte_from_i2c(struct analogix_dp_device *dp,
|
|||
writel(reg, dp->reg_base + ANALOGIX_DP_BUFFER_DATA_CTL);
|
||||
|
||||
/* Select EDID device */
|
||||
retval = analogix_dp_select_i2c_device(dp, device_addr, reg_addr);
|
||||
retval = analogix_dp_select_i2c_device(dp, device_addr,
|
||||
reg_addr);
|
||||
if (retval != 0)
|
||||
continue;
|
||||
|
||||
|
@ -767,9 +767,8 @@ int analogix_dp_read_byte_from_i2c(struct analogix_dp_device *dp,
|
|||
retval = analogix_dp_start_aux_transaction(dp);
|
||||
if (retval == 0)
|
||||
break;
|
||||
else
|
||||
dev_dbg(dp->dev, "%s: Aux Transaction fail!\n",
|
||||
__func__);
|
||||
|
||||
dev_dbg(dp->dev, "%s: Aux Transaction fail!\n", __func__);
|
||||
}
|
||||
|
||||
/* Read data */
|
||||
|
@ -828,9 +827,8 @@ int analogix_dp_read_bytes_from_i2c(struct analogix_dp_device *dp,
|
|||
retval = analogix_dp_start_aux_transaction(dp);
|
||||
if (retval == 0)
|
||||
break;
|
||||
else
|
||||
dev_dbg(dp->dev,
|
||||
"%s: Aux Transaction fail!\n",
|
||||
|
||||
dev_dbg(dp->dev, "%s: Aux Transaction fail!\n",
|
||||
__func__);
|
||||
}
|
||||
/* Check if Rx sends defer */
|
||||
|
@ -885,7 +883,8 @@ void analogix_dp_get_lane_count(struct analogix_dp_device *dp, u32 *count)
|
|||
*count = reg;
|
||||
}
|
||||
|
||||
void analogix_dp_enable_enhanced_mode(struct analogix_dp_device *dp, bool enable)
|
||||
void analogix_dp_enable_enhanced_mode(struct analogix_dp_device *dp,
|
||||
bool enable)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
|
@ -933,7 +932,8 @@ void analogix_dp_set_training_pattern(struct analogix_dp_device *dp,
|
|||
}
|
||||
}
|
||||
|
||||
void analogix_dp_set_lane0_pre_emphasis(struct analogix_dp_device *dp, u32 level)
|
||||
void analogix_dp_set_lane0_pre_emphasis(struct analogix_dp_device *dp,
|
||||
u32 level)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
|
@ -943,7 +943,8 @@ void analogix_dp_set_lane0_pre_emphasis(struct analogix_dp_device *dp, u32 level
|
|||
writel(reg, dp->reg_base + ANALOGIX_DP_LN0_LINK_TRAINING_CTL);
|
||||
}
|
||||
|
||||
void analogix_dp_set_lane1_pre_emphasis(struct analogix_dp_device *dp, u32 level)
|
||||
void analogix_dp_set_lane1_pre_emphasis(struct analogix_dp_device *dp,
|
||||
u32 level)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
|
@ -953,7 +954,8 @@ void analogix_dp_set_lane1_pre_emphasis(struct analogix_dp_device *dp, u32 level
|
|||
writel(reg, dp->reg_base + ANALOGIX_DP_LN1_LINK_TRAINING_CTL);
|
||||
}
|
||||
|
||||
void analogix_dp_set_lane2_pre_emphasis(struct analogix_dp_device *dp, u32 level)
|
||||
void analogix_dp_set_lane2_pre_emphasis(struct analogix_dp_device *dp,
|
||||
u32 level)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
|
@ -963,7 +965,8 @@ void analogix_dp_set_lane2_pre_emphasis(struct analogix_dp_device *dp, u32 level
|
|||
writel(reg, dp->reg_base + ANALOGIX_DP_LN2_LINK_TRAINING_CTL);
|
||||
}
|
||||
|
||||
void analogix_dp_set_lane3_pre_emphasis(struct analogix_dp_device *dp, u32 level)
|
||||
void analogix_dp_set_lane3_pre_emphasis(struct analogix_dp_device *dp,
|
||||
u32 level)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
|
@ -1126,8 +1129,7 @@ int analogix_dp_is_slave_video_stream_clock_on(struct analogix_dp_device *dp)
|
|||
|
||||
void analogix_dp_set_video_cr_mn(struct analogix_dp_device *dp,
|
||||
enum clock_recovery_m_value_type type,
|
||||
u32 m_value,
|
||||
u32 n_value)
|
||||
u32 m_value, u32 n_value)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
|
@ -1221,7 +1223,7 @@ void analogix_dp_config_video_slave_mode(struct analogix_dp_device *dp)
|
|||
u32 reg;
|
||||
|
||||
reg = readl(dp->reg_base + ANALOGIX_DP_FUNC_EN_1);
|
||||
reg &= ~(MASTER_VID_FUNC_EN_N|SLAVE_VID_FUNC_EN_N);
|
||||
reg &= ~(MASTER_VID_FUNC_EN_N | SLAVE_VID_FUNC_EN_N);
|
||||
reg |= MASTER_VID_FUNC_EN_N;
|
||||
writel(reg, dp->reg_base + ANALOGIX_DP_FUNC_EN_1);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче