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/amd/display/dc/gpio/hw_ddc.c | 50 ++++++++++++++++++++++++++++++++++++--------------
1 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/kernel/drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c b/kernel/drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c
index 310f489..1ae153e 100644
--- a/kernel/drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c
+++ b/kernel/drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c
@@ -23,8 +23,12 @@
*
*/
+#include <linux/delay.h>
+#include <linux/slab.h>
+
#include "dm_services.h"
+#include "include/gpio_interface.h"
#include "include/gpio_types.h"
#include "hw_gpio.h"
#include "hw_ddc.h"
@@ -42,18 +46,20 @@
#define REG(reg)\
(ddc->regs->reg)
-static void destruct(
+struct gpio;
+
+static void dal_hw_ddc_destruct(
struct hw_ddc *pin)
{
dal_hw_gpio_destruct(&pin->base);
}
-static void destroy(
+static void dal_hw_ddc_destroy(
struct hw_gpio_pin **ptr)
{
struct hw_ddc *pin = HW_DDC_FROM_BASE(*ptr);
- destruct(pin);
+ dal_hw_ddc_destruct(pin);
kfree(pin);
@@ -144,12 +150,23 @@
AUX_PAD1_MODE, 0);
}
+ if (ddc->regs->dc_gpio_aux_ctrl_5 != 0) {
+ REG_UPDATE(dc_gpio_aux_ctrl_5, DDC_PAD_I2CMODE, 1);
+ }
+ //set DC_IO_aux_rxsel = 2'b01
+ if (ddc->regs->phy_aux_cntl != 0) {
+ REG_UPDATE(phy_aux_cntl, AUX_PAD_RXSEL, 1);
+ }
return GPIO_RESULT_OK;
case GPIO_DDC_CONFIG_TYPE_MODE_AUX:
/* set the AUX pad mode */
if (!aux_pad_mode) {
REG_SET(gpio.MASK_reg, regval,
AUX_PAD1_MODE, 1);
+ }
+ if (ddc->regs->dc_gpio_aux_ctrl_5 != 0) {
+ REG_UPDATE(dc_gpio_aux_ctrl_5,
+ DDC_PAD_I2CMODE, 0);
}
return GPIO_RESULT_OK;
@@ -190,7 +207,7 @@
}
static const struct hw_gpio_pin_funcs funcs = {
- .destroy = destroy,
+ .destroy = dal_hw_ddc_destroy,
.open = dal_hw_gpio_open,
.get_value = dal_hw_gpio_get_value,
.set_value = dal_hw_gpio_set_value,
@@ -199,7 +216,7 @@
.close = dal_hw_gpio_close,
};
-static void construct(
+static void dal_hw_ddc_construct(
struct hw_ddc *ddc,
enum gpio_id id,
uint32_t en,
@@ -209,24 +226,29 @@
ddc->base.base.funcs = &funcs;
}
-struct hw_gpio_pin *dal_hw_ddc_create(
+void dal_hw_ddc_init(
+ struct hw_ddc **hw_ddc,
struct dc_context *ctx,
enum gpio_id id,
uint32_t en)
{
- struct hw_ddc *pin;
-
if ((en < GPIO_DDC_LINE_MIN) || (en > GPIO_DDC_LINE_MAX)) {
ASSERT_CRITICAL(false);
- return NULL;
+ *hw_ddc = NULL;
}
- pin = kzalloc(sizeof(struct hw_ddc), GFP_KERNEL);
- if (!pin) {
+ *hw_ddc = kzalloc(sizeof(struct hw_ddc), GFP_KERNEL);
+ if (!*hw_ddc) {
ASSERT_CRITICAL(false);
- return NULL;
+ return;
}
- construct(pin, id, en, ctx);
- return &pin->base.base;
+ dal_hw_ddc_construct(*hw_ddc, id, en, ctx);
+}
+
+struct hw_gpio_pin *dal_hw_ddc_get_pin(struct gpio *gpio)
+{
+ struct hw_ddc *hw_ddc = dal_gpio_get_ddc(gpio);
+
+ return &hw_ddc->base.base;
}
--
Gitblit v1.6.2