From 1543e317f1da31b75942316931e8f491a8920811 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Thu, 04 Jan 2024 10:08:02 +0000
Subject: [PATCH] disable FB
---
kernel/drivers/gpu/drm/rockchip/cdn-dp-reg.c | 73 +++++++++---------------------------
1 files changed, 18 insertions(+), 55 deletions(-)
diff --git a/kernel/drivers/gpu/drm/rockchip/cdn-dp-reg.c b/kernel/drivers/gpu/drm/rockchip/cdn-dp-reg.c
index f243f1e..2a54486 100644
--- a/kernel/drivers/gpu/drm/rockchip/cdn-dp-reg.c
+++ b/kernel/drivers/gpu/drm/rockchip/cdn-dp-reg.c
@@ -1,15 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
* Author: Chris Zhong <zyw@rock-chips.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*/
#include <linux/clk.h>
@@ -596,8 +588,8 @@
if (ret)
goto err_get_training_status;
- dp->link.rate = status[0];
- dp->link.num_lanes = status[1];
+ dp->max_rate = status[0];
+ dp->max_lanes = status[1];
err_get_training_status:
if (ret)
@@ -646,9 +638,9 @@
return ret;
}
- DRM_DEV_DEBUG_KMS(dp->dev, "rate:0x%x, lanes:%d\n", dp->link.rate,
- dp->link.num_lanes);
- return 0;
+ DRM_DEV_DEBUG_KMS(dp->dev, "rate:0x%x, lanes:%d\n", dp->max_rate,
+ dp->max_lanes);
+ return ret;
}
int cdn_dp_set_video_status(struct cdn_dp_device *dp, int active)
@@ -687,7 +679,7 @@
case YCBCR_4_2_0:
val[0] = 5;
break;
- };
+ }
switch (video->color_depth) {
case 6:
@@ -705,7 +697,7 @@
case 16:
val[1] = 4;
break;
- };
+ }
msa_misc = 2 * val[0] + 32 * val[1] +
((video->color_fmt == Y_ONLY) ? (1 << 14) : 0);
@@ -725,7 +717,7 @@
bit_per_pix = (video->color_fmt == YCBCR_4_2_2) ?
(video->color_depth * 2) : (video->color_depth * 3);
- link_rate = drm_dp_bw_code_to_link_rate(dp->link.rate) / 1000;
+ link_rate = drm_dp_bw_code_to_link_rate(dp->max_rate) / 1000;
ret = cdn_dp_reg_write(dp, BND_HSYNC2VSYNC, VIF_BYPASS_INTERLACE);
if (ret)
@@ -744,15 +736,14 @@
*/
do {
tu_size_reg += 2;
- symbol = tu_size_reg * mode->clock * bit_per_pix;
- do_div(symbol, dp->link.num_lanes * link_rate * 8);
+ symbol = (u64)tu_size_reg * mode->clock * bit_per_pix;
+ do_div(symbol, dp->max_lanes * link_rate * 8);
rem = do_div(symbol, 1000);
if (tu_size_reg > 64) {
ret = -EINVAL;
DRM_DEV_ERROR(dp->dev,
"tu error, clk:%d, lanes:%d, rate:%d\n",
- mode->clock, dp->link.num_lanes,
- link_rate);
+ mode->clock, dp->max_lanes, link_rate);
goto err_config_video;
}
} while ((symbol <= 1) || (tu_size_reg - symbol < 4) ||
@@ -766,7 +757,7 @@
/* set the FIFO Buffer size */
val = div_u64(mode->clock * (symbol + 1), 1000) + link_rate;
- val /= (dp->link.num_lanes * link_rate);
+ val /= (dp->max_lanes * link_rate);
val = div_u64(8 * (symbol + 1), bit_per_pix) - val;
val += 2;
ret = cdn_dp_reg_write(dp, DP_VC_TABLE(15), val);
@@ -787,7 +778,7 @@
case 16:
val = BCS_16;
break;
- };
+ }
val += video->color_fmt << 8;
ret = cdn_dp_reg_write(dp, DP_FRAMER_PXL_REPR, val);
@@ -919,7 +910,7 @@
u32 val;
if (audio->channels == 2) {
- if (dp->link.num_lanes == 1)
+ if (dp->max_lanes == 1)
sub_pckt_num = 2;
else
sub_pckt_num = 4;
@@ -998,23 +989,13 @@
writel(I2S_DEC_START, dp->regs + AUDIO_SRC_CNTL);
}
-static void cdn_dp_audio_config_spdif(struct cdn_dp_device *dp,
- struct audio_info *audio)
+static void cdn_dp_audio_config_spdif(struct cdn_dp_device *dp)
{
u32 val;
- int sub_pckt_num = 1;
- if (audio->channels == 2) {
- if (dp->link.num_lanes == 1)
- sub_pckt_num = 2;
- else
- sub_pckt_num = 4;
- }
writel(SYNC_WR_TO_CH_ZERO, dp->regs + FIFO_CNTL);
- val = MAX_NUM_CH(audio->channels);
- val |= AUDIO_TYPE_LPCM;
- val |= CFG_SUB_PCKT_NUM(sub_pckt_num);
+ val = MAX_NUM_CH(2) | AUDIO_TYPE_LPCM | CFG_SUB_PCKT_NUM(4);
writel(val, dp->regs + SMPL2PKT_CNFG);
writel(SMPL2PKT_EN, dp->regs + SMPL2PKT_CNTL);
@@ -1023,24 +1004,6 @@
clk_prepare_enable(dp->spdif_clk);
clk_set_rate(dp->spdif_clk, CDN_DP_SPDIF_CLK);
-}
-
-void cdn_dp_infoframe_set(struct cdn_dp_device *dp, int entry_id,
- u8 *buf, u32 len, int type)
-{
- unsigned int idx;
- u32 *packet = (u32 *)buf;
- u32 length = len / 4;
-
- for (idx = 0; idx < length; idx++)
- writel(cpu_to_le32(*packet++), dp->regs + SOURCE_PIF_DATA_WR);
-
- writel(entry_id, dp->regs + SOURCE_PIF_WR_ADDR);
- writel(HOST_WR, dp->regs + SOURCE_PIF_WR_REQ);
- writel(ACTIVE_IDLE_TYPE(1) | TYPE_VALID |
- PACKET_TYPE(type) | PKT_ALLOC_ADDRESS(entry_id),
- dp->regs + SOURCE_PIF_PKT_ALLOC_REG);
- writel(PKT_ALLOC_WR_EN, dp->regs + SOURCE_PIF_PKT_ALLOC_WR_EN);
}
int cdn_dp_audio_config(struct cdn_dp_device *dp, struct audio_info *audio)
@@ -1064,7 +1027,7 @@
if (audio->format == AFMT_I2S)
cdn_dp_audio_config_i2s(dp, audio);
else if (audio->format == AFMT_SPDIF)
- cdn_dp_audio_config_spdif(dp, audio);
+ cdn_dp_audio_config_spdif(dp);
ret = cdn_dp_reg_write(dp, AUDIO_PACK_CONTROL, AUDIO_PACK_EN);
--
Gitblit v1.6.2