Merge "include: uapi: add Kbuild entries for msm_hdmi_hdcp_mgr.h"

This commit is contained in:
qctecmdr 2020-03-20 08:59:05 -07:00 • committed by Gerrit - the friendly Code Review server
commit ce305188eb
25 changed files with 2216 additions and 268 deletions

View file

@ -1,6 +1,7 @@
ifeq ($(CONFIG_QGKI),y)
export CONFIG_DRM_MSM=y
export CONFIG_DRM_MSM_SDE=y
export CONFIG_DRM_MSM_DP=y
export CONFIG_SYNC_FILE=y
export CONFIG_DRM_MSM_DSI=y
export CONFIG_DSI_PARSER=y

View file

@ -4,6 +4,7 @@
*/
#define CONFIG_DRM_MSM 1
#define CONFIG_DRM_MSM_DP 1
#define CONFIG_DRM_MSM_SDE 1
#define CONFIG_SYNC_FILE 1
#define CONFIG_DRM_MSM_DSI 1

View file

@ -2,3 +2,4 @@
header-y += media/
header-y += drm/
header-y += hdcp/

View file

@ -0,0 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note
header-y += msm_hdmi_hdcp_mgr.h

View file

@ -4,7 +4,7 @@ ccflags-y += -I$(srctree)/techpack/display/msm/sde
ccflags-y += -I$(srctree)/techpack/display/rotator
ccflags-y += -I$(srctree)/drivers/clk/qcom/
msm_drm-$(CONFIG_DRM_MSM_DP) += dp/dp_usbpd.o \
msm_drm-$(CONFIG_DRM_MSM_DP) += dp/dp_altmode.o \
dp/dp_parser.o \
dp/dp_power.o \
dp/dp_catalog.o \
@ -24,8 +24,11 @@ msm_drm-$(CONFIG_DRM_MSM_DP) += dp/dp_usbpd.o \
dp/dp_hdcp2p2.o \
sde_hdcp_1x.o \
sde_hdcp_2x.o \
dp/dp_pll.o \
dp/dp_pll_5nm.o \
msm_drm-$(CONFIG_DRM_MSM_DP_MST) += dp/dp_mst_drm.o \
msm_drm-$(CONFIG_DRM_MSM_DP_USBPD_LEGACY) += dp/dp_usbpd.o \
msm_drm-$(CONFIG_DRM_MSM_SDE) += sde/sde_crtc.o \
sde/sde_encoder.o \

339
msm/dp/dp_altmode.c Normal file
View file

@ -0,0 +1,339 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/kthread.h>
#include <linux/soc/qcom/altmode-glink.h>
#include <linux/usb/dwc3-msm.h>
#include <linux/usb/pd_vdo.h>
#include "dp_altmode.h"
#include "dp_debug.h"
#include "sde_dbg.h"
#define ALTMODE_CONFIGURE_MASK (0x3f)
#define ALTMODE_HPD_STATE_MASK (0x40)
#define ALTMODE_HPD_IRQ_MASK (0x80)
struct dp_altmode_private {
bool forced_disconnect;
struct device *dev;
struct dp_hpd_cb *dp_cb;
struct dp_altmode dp_altmode;
struct altmode_client *amclient;
struct altmode_client_data altmode;
const char *parent_name;
bool connected;
struct notifier_block nb;
};
enum dp_altmode_pin_assignment {
DPAM_HPD_OUT,
DPAM_HPD_A,
DPAM_HPD_B,
DPAM_HPD_C,
DPAM_HPD_D,
DPAM_HPD_E,
DPAM_HPD_F,
};
static int dp_altmode_release_ss_lanes(struct dp_altmode_private *altmode)
{
int rc;
struct device_node *np;
struct device_node *usb_node;
struct platform_device *usb_pdev;
int timeout = 250;
if (!altmode || !altmode->dev) {
DP_ERR("invalid args\n");
return -EINVAL;
}
np = altmode->dev->of_node;
usb_node = of_parse_phandle(np, "usb-controller", 0);
if (!usb_node) {
DP_ERR("unable to get usb node\n");
return -EINVAL;
}
usb_pdev = of_find_device_by_node(usb_node);
if (!usb_pdev) {
of_node_put(usb_node);
DP_ERR("unable to get usb pdev\n");
return -EINVAL;
}
while (timeout) {
rc = dwc3_msm_release_ss_lane(&usb_pdev->dev);
if (rc != -EBUSY)
break;
DP_WARN("USB busy, retry\n");
/* wait for hw recommended delay for usb */
msleep(20);
timeout--;
}
of_node_put(usb_node);
platform_device_put(usb_pdev);
if (rc)
DP_ERR("Error releasing SS lanes: %d\n", rc);
return rc;
}
static void dp_altmode_send_pan_ack(struct altmode_client *amclient,
u8 port_index)
{
int rc;
struct altmode_pan_ack_msg ack;
ack.cmd_type = ALTMODE_PAN_ACK;
ack.port_index = port_index;
rc = altmode_send_data(amclient, &ack, sizeof(ack));
if (rc < 0) {
DP_ERR("failed: %d\n", rc);
return;
}
DP_DEBUG("port=%d\n", port_index);
}
static int dp_altmode_notify(void *priv, void *data, size_t len)
{
int rc = 0;
struct dp_altmode_private *altmode =
(struct dp_altmode_private *) priv;
u8 port_index, dp_data, orientation;
u8 *payload = (u8 *) data;
u8 pin, hpd_state, hpd_irq;
bool force_multi_func = altmode->dp_altmode.base.force_multi_func;
port_index = payload[0];
orientation = payload[1];
dp_data = payload[8];
pin = dp_data & ALTMODE_CONFIGURE_MASK;
hpd_state = (dp_data & ALTMODE_HPD_STATE_MASK) >> 6;
hpd_irq = (dp_data & ALTMODE_HPD_IRQ_MASK) >> 7;
altmode->dp_altmode.base.hpd_high = !!hpd_state;
altmode->dp_altmode.base.hpd_irq = !!hpd_irq;
altmode->dp_altmode.base.multi_func = force_multi_func ? true :
!(pin == DPAM_HPD_C || pin == DPAM_HPD_E);
DP_DEBUG("payload=0x%x\n", dp_data);
DP_DEBUG("port_index=%d, orientation=%d, pin=%d, hpd_state=%d\n",
port_index, orientation, pin, hpd_state);
DP_DEBUG("multi_func=%d, hpd_high=%d, hpd_irq=%d\n",
altmode->dp_altmode.base.multi_func,
altmode->dp_altmode.base.hpd_high,
altmode->dp_altmode.base.hpd_irq);
DP_DEBUG("connected=%d\n", altmode->connected);
SDE_EVT32_VERBOSE(dp_data, port_index, orientation, pin, hpd_state,
altmode->dp_altmode.base.multi_func,
altmode->dp_altmode.base.hpd_high,
altmode->dp_altmode.base.hpd_irq, altmode->connected);
if (!pin) {
/* Cable detach */
if (altmode->connected) {
altmode->connected = false;
altmode->dp_altmode.base.alt_mode_cfg_done = false;
altmode->dp_altmode.base.orientation = ORIENTATION_NONE;
if (altmode->dp_cb && altmode->dp_cb->disconnect)
altmode->dp_cb->disconnect(altmode->dev);
}
goto ack;
}
/* Configure */
if (!altmode->connected) {
altmode->connected = true;
altmode->dp_altmode.base.alt_mode_cfg_done = true;
switch (orientation) {
case 0:
orientation = ORIENTATION_CC1;
break;
case 1:
orientation = ORIENTATION_CC2;
break;
case 2:
orientation = ORIENTATION_NONE;
break;
default:
orientation = ORIENTATION_NONE;
break;
}
altmode->dp_altmode.base.orientation = orientation;
if (!altmode->dp_altmode.base.multi_func) {
rc = dp_altmode_release_ss_lanes(altmode);
if (rc)
goto ack;
}
if (altmode->dp_cb && altmode->dp_cb->configure)
altmode->dp_cb->configure(altmode->dev);
goto ack;
}
/* Attention */
if (altmode->forced_disconnect)
goto ack;
if (altmode->dp_cb && altmode->dp_cb->attention)
altmode->dp_cb->attention(altmode->dev);
ack:
dp_altmode_send_pan_ack(altmode->amclient, port_index);
return rc;
}
static int dp_altmode_register(struct notifier_block *nb, unsigned long ebt,
void *pdev)
{
int rc;
struct platform_device *altmode_pdev = pdev;
struct dp_altmode_private *altmode = container_of(nb,
struct dp_altmode_private, nb);
altmode->amclient = altmode_register_client(&altmode_pdev->dev,
&altmode->altmode);
if (IS_ERR_OR_NULL(altmode->amclient)) {
rc = PTR_ERR(altmode->amclient);
DP_ERR("failed to register dp altmode client: %d\n", rc);
return -EINVAL;
}
DP_DEBUG("success\n");
return 0;
}
static int dp_altmode_simulate_connect(struct dp_hpd *dp_hpd, bool hpd)
{
struct dp_altmode *dp_altmode;
struct dp_altmode_private *altmode;
dp_altmode = container_of(dp_hpd, struct dp_altmode, base);
altmode = container_of(dp_altmode, struct dp_altmode_private,
dp_altmode);
dp_altmode->base.hpd_high = hpd;
altmode->forced_disconnect = !hpd;
altmode->dp_altmode.base.alt_mode_cfg_done = hpd;
if (hpd)
altmode->dp_cb->configure(altmode->dev);
else
altmode->dp_cb->disconnect(altmode->dev);
return 0;
}
static int dp_altmode_simulate_attention(struct dp_hpd *dp_hpd, int vdo)
{
struct dp_altmode *dp_altmode;
struct dp_altmode_private *altmode;
struct dp_altmode *status;
dp_altmode = container_of(dp_hpd, struct dp_altmode, base);
altmode = container_of(dp_altmode, struct dp_altmode_private,
dp_altmode);
status = &altmode->dp_altmode;
status->base.hpd_high = (vdo & BIT(7)) ? true : false;
status->base.hpd_irq = (vdo & BIT(8)) ? true : false;
if (altmode->dp_cb && altmode->dp_cb->attention)
altmode->dp_cb->attention(altmode->dev);
return 0;
}
struct dp_hpd *dp_altmode_get(struct device *dev, struct dp_hpd_cb *cb)
{
int rc = 0;
struct dp_altmode_private *altmode;
struct dp_altmode *dp_altmode;
const char *altmode_str = "qcom,altmode-parent";
struct altmode_client_data client_data = {
.callback = &dp_altmode_notify,
};
if (!cb) {
DP_ERR("invalid cb data\n");
return ERR_PTR(-EINVAL);
}
altmode = kzalloc(sizeof(*altmode), GFP_KERNEL);
if (!altmode)
return ERR_PTR(-ENOMEM);
altmode->dev = dev;
altmode->dp_cb = cb;
client_data.name = "displayport";
client_data.svid = USB_SID_DISPLAYPORT;
client_data.priv = altmode;
altmode->altmode = client_data;
dp_altmode = &altmode->dp_altmode;
dp_altmode->base.register_hpd = NULL;
dp_altmode->base.simulate_connect = dp_altmode_simulate_connect;
dp_altmode->base.simulate_attention = dp_altmode_simulate_attention;
rc = of_property_read_string(altmode->dev->of_node, altmode_str,
&altmode->parent_name);
if (rc < 0) {
DP_ERR("No altmode parent device specified\n");
goto error;
}
DP_DEBUG("parent_name=%s\n", altmode->parent_name);
altmode->nb.notifier_call = dp_altmode_register;
rc = altmode_register_notifier(altmode->parent_name, &altmode->nb);
if (rc < 0) {
DP_ERR("altmode probe notifier registration failed: %d\n", rc);
goto error;
}
DP_DEBUG("success\n");
return &dp_altmode->base;
error:
kfree(altmode);
return ERR_PTR(rc);
}
void dp_altmode_put(struct dp_hpd *dp_hpd)
{
struct dp_altmode *dp_altmode;
struct dp_altmode_private *altmode;
dp_altmode = container_of(dp_hpd, struct dp_altmode, base);
if (!dp_altmode)
return;
altmode = container_of(dp_altmode, struct dp_altmode_private,
dp_altmode);
altmode_deregister_client(altmode->amclient);
kfree(altmode);
}

22
msm/dp/dp_altmode.h Normal file
View file

@ -0,0 +1,22 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _DP_ALTMODE_H_
#define _DP_ALTMODE_H_
#include <linux/types.h>
#include "dp_hpd.h"
struct device;
struct dp_altmode {
struct dp_hpd base;
};
struct dp_hpd *dp_altmode_get(struct device *dev, struct dp_hpd_cb *cb);
void dp_altmode_put(struct dp_hpd *pd);
#endif /* _DP_ALTMODE_H_ */

View file

@ -1,13 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/soc/qcom/fsa4480-i2c.h>
#include <linux/usb/usbpd.h>
#include <linux/delay.h>
#include "dp_aux.h"
#include "dp_hpd.h"
#include "dp_debug.h"
#define DP_AUX_ENUM_STR(x) #x

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _DP_AUX_H_
@ -22,6 +22,7 @@
#define DP_STATE_LINK_MAINTENANCE_COMPLETED BIT(10)
#define DP_STATE_LINK_MAINTENANCE_FAILED BIT(11)
#define DP_STATE_AUX_TIMEOUT BIT(12)
#define DP_STATE_PLL_LOCKED BIT(13)
enum dp_aux_error {
DP_AUX_ERR_NONE = 0,

View file

@ -13,6 +13,8 @@
#include "drm_connector.h"
#include "sde_connector.h"
#include "dp_display.h"
#include "dp_pll.h"
#include "dp_hpd.h"
#define DEBUG_NAME "drm_dp"
@ -40,6 +42,7 @@ struct dp_debug_private {
struct dp_debug dp_debug;
struct dp_parser *parser;
struct dp_ctrl *ctrl;
struct dp_pll *pll;
struct mutex lock;
};
@ -785,35 +788,6 @@ static ssize_t dp_debug_mst_sideband_mode_write(struct file *file,
return count;
}
static ssize_t dp_debug_widebus_mode_write(struct file *file,
const char __user *user_buff, size_t count, loff_t *ppos)
{
struct dp_debug_private *debug = file->private_data;
char buf[SZ_8];
size_t len = 0;
u32 widebus_mode = 0;
if (!debug || !debug->parser)
return -ENODEV;
if (*ppos)
return 0;
len = min_t(size_t, count, SZ_8 - 1);
if (copy_from_user(buf, user_buff, len))
return -EFAULT;
buf[len] = '\0';
if (kstrtoint(buf, 10, &widebus_mode) != 0)
return -EINVAL;
debug->parser->has_widebus = widebus_mode ? true : false;
DP_DEBUG("widebus_enable: %d\n", widebus_mode);
return len;
}
static ssize_t dp_debug_tpg_write(struct file *file,
const char __user *user_buff, size_t count, loff_t *ppos)
{
@ -1900,17 +1874,400 @@ static const struct file_operations hdcp_fops = {
.read = dp_debug_read_hdcp,
};
static const struct file_operations widebus_mode_fops = {
.open = simple_open,
.write = dp_debug_widebus_mode_write,
};
static int dp_debug_init_mst(struct dp_debug_private *debug, struct dentry *dir)
{
int rc = 0;
struct dentry *file;
file = debugfs_create_file("mst_con_id", 0644, dir,
debug, &mst_con_id_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs create mst_con_id failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("mst_con_info", 0644, dir,
debug, &mst_conn_info_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs create mst_conn_info failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("mst_con_add", 0644, dir,
debug, &mst_con_add_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DRM_ERROR("[%s] debugfs create mst_con_add failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("mst_con_remove", 0644, dir,
debug, &mst_con_remove_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DRM_ERROR("[%s] debugfs create mst_con_remove failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("mst_mode", 0644, dir,
debug, &mst_mode_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs mst_mode failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("mst_sideband_mode", 0644, dir,
debug, &mst_sideband_mode_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs mst_sideband_mode failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
return rc;
}
static int dp_debug_init_link(struct dp_debug_private *debug,
struct dentry *dir)
{
int rc = 0;
struct dentry *file;
file = debugfs_create_file("max_bw_code", 0644, dir,
debug, &bw_code_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs max_bw_code failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("max_pclk_khz", 0644, dir,
debug, &max_pclk_khz_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs max_pclk_khz failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_u32("max_lclk_khz", 0644, dir,
&debug->parser->max_lclk_khz);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs max_lclk_khz failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_u32("lane_count", 0644, dir,
&debug->panel->lane_count);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs lane_count failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_u32("link_bw_code", 0644, dir,
&debug->panel->link_bw_code);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs link_bw_code failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
return rc;
}
static int dp_debug_init_hdcp(struct dp_debug_private *debug,
struct dentry *dir)
{
int rc = 0;
struct dentry *file;
file = debugfs_create_bool("hdcp_wait_sink_sync", 0644, dir,
&debug->dp_debug.hdcp_wait_sink_sync);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs hdcp_wait_sink_sync failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_bool("force_encryption", 0644, dir,
&debug->dp_debug.force_encryption);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs force_encryption failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
return rc;
}
static int dp_debug_init_sink_caps(struct dp_debug_private *debug,
struct dentry *dir)
{
int rc = 0;
struct dentry *file;
file = debugfs_create_file("edid_modes", 0644, dir,
debug, &edid_modes_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs create edid_modes failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("edid_modes_mst", 0644, dir,
debug, &edid_modes_mst_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs create edid_modes_mst failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("edid", 0644, dir,
debug, &edid_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs edid failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("dpcd", 0644, dir,
debug, &dpcd_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs dpcd failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
return rc;
}
static int dp_debug_init_status(struct dp_debug_private *debug,
struct dentry *dir)
{
int rc = 0;
struct dentry *file;
file = debugfs_create_file("dp_debug", 0444, dir,
debug, &dp_debug_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs create file failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("connected", 0444, dir,
debug, &connected_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs connected failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("hdr", 0400, dir, debug, &hdr_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs hdr failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("hdr_mst", 0400, dir, debug, &hdr_mst_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs hdr_mst failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("hdcp", 0644, dir, debug, &hdcp_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs hdcp failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
return rc;
}
static int dp_debug_init_sim(struct dp_debug_private *debug, struct dentry *dir)
{
int rc = 0;
struct dentry *file;
file = debugfs_create_file("hpd", 0644, dir, debug, &hpd_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs hpd failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("sim", 0644, dir, debug, &sim_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs sim failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("attention", 0644, dir,
debug, &attention_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs attention failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_bool("skip_uevent", 0644, dir,
&debug->dp_debug.skip_uevent);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs skip_uevent failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_bool("force_multi_func", 0644, dir,
&debug->hpd->force_multi_func);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs force_multi_func failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
return rc;
}
static int dp_debug_init_dsc_fec(struct dp_debug_private *debug,
struct dentry *dir)
{
int rc = 0;
struct dentry *file;
file = debugfs_create_bool("dsc_feature_enable", 0644, dir,
&debug->parser->dsc_feature_enable);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs dsc_feature failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_bool("fec_feature_enable", 0644, dir,
&debug->parser->fec_feature_enable);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs fec_feature_enable failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
return rc;
}
static int dp_debug_init_tpg(struct dp_debug_private *debug, struct dentry *dir)
{
int rc = 0;
struct dentry *file;
file = debugfs_create_file("tpg_ctrl", 0644, dir,
debug, &tpg_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs tpg failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
return rc;
}
static int dp_debug_init_reg_dump(struct dp_debug_private *debug,
struct dentry *dir)
{
int rc = 0;
struct dentry *file;
file = debugfs_create_file("exe_mode", 0644, dir,
debug, &exe_mode_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs register failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_file("dump", 0644, dir,
debug, &dump_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs dump failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
return rc;
}
static int dp_debug_init_feature_toggle(struct dp_debug_private *debug,
struct dentry *dir)
{
int rc = 0;
struct dentry *file;
file = debugfs_create_bool("ssc_enable", 0644, dir,
&debug->pll->ssc_en);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs ssc_enable failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
file = debugfs_create_bool("widebus_mode", 0644, dir,
&debug->parser->has_widebus);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs widebus_mode failed, rc=%d\n",
DEBUG_NAME, rc);
return rc;
}
return rc;
}
static int dp_debug_init(struct dp_debug *dp_debug)
{
int rc = 0;
struct dp_debug_private *debug = container_of(dp_debug,
struct dp_debug_private, dp_debug);
struct dentry *dir, *file;
struct dentry *dir;
dir = debugfs_create_dir(DEBUG_NAME, NULL);
if (IS_ERR_OR_NULL(dir)) {
@ -1925,272 +2282,49 @@ static int dp_debug_init(struct dp_debug *dp_debug)
debug->root = dir;
file = debugfs_create_file("dp_debug", 0444, dir,
debug, &dp_debug_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs create file failed, rc=%d\n",
DEBUG_NAME, rc);
rc = dp_debug_init_status(debug, dir);
if (rc)
goto error_remove_dir;
}
file = debugfs_create_file("edid_modes", 0644, dir,
debug, &edid_modes_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs create edid_modes failed, rc=%d\n",
DEBUG_NAME, rc);
rc = dp_debug_init_sink_caps(debug, dir);
if (rc)
goto error_remove_dir;
}
file = debugfs_create_file("edid_modes_mst", 0644, dir,
debug, &edid_modes_mst_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs create edid_modes_mst failed, rc=%d\n",
DEBUG_NAME, rc);
rc = dp_debug_init_mst(debug, dir);
if (rc)
goto error_remove_dir;
}
file = debugfs_create_file("mst_con_id", 0644, dir,
debug, &mst_con_id_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs create mst_con_id failed, rc=%d\n",
DEBUG_NAME, rc);
rc = dp_debug_init_link(debug, dir);
if (rc)
goto error_remove_dir;
}
file = debugfs_create_file("mst_con_info", 0644, dir,
debug, &mst_conn_info_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs create mst_conn_info failed, rc=%d\n",
DEBUG_NAME, rc);
rc = dp_debug_init_hdcp(debug, dir);
if (rc)
goto error_remove_dir;
}
file = debugfs_create_file("mst_con_add", 0644, dir,
debug, &mst_con_add_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DRM_ERROR("[%s] debugfs create mst_con_add failed, rc=%d\n",
DEBUG_NAME, rc);
rc = dp_debug_init_sim(debug, dir);
if (rc)
goto error_remove_dir;
}
file = debugfs_create_file("mst_con_remove", 0644, dir,
debug, &mst_con_remove_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DRM_ERROR("[%s] debugfs create mst_con_remove failed, rc=%d\n",
DEBUG_NAME, rc);
rc = dp_debug_init_dsc_fec(debug, dir);
if (rc)
goto error_remove_dir;
}
file = debugfs_create_file("hpd", 0644, dir,
debug, &hpd_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs hpd failed, rc=%d\n",
DEBUG_NAME, rc);
rc = dp_debug_init_tpg(debug, dir);
if (rc)
goto error_remove_dir;
}
file = debugfs_create_file("connected", 0444, dir,
debug, &connected_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs connected failed, rc=%d\n",
DEBUG_NAME, rc);
rc = dp_debug_init_reg_dump(debug, dir);
if (rc)
goto error_remove_dir;
}
file = debugfs_create_file("max_bw_code", 0644, dir,
debug, &bw_code_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs max_bw_code failed, rc=%d\n",
DEBUG_NAME, rc);
}
file = debugfs_create_file("exe_mode", 0644, dir,
debug, &exe_mode_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs register failed, rc=%d\n",
DEBUG_NAME, rc);
}
file = debugfs_create_file("edid", 0644, dir,
debug, &edid_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs edid failed, rc=%d\n",
DEBUG_NAME, rc);
rc = dp_debug_init_feature_toggle(debug, dir);
if (rc)
goto error_remove_dir;
}
file = debugfs_create_file("dpcd", 0644, dir,
debug, &dpcd_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs dpcd failed, rc=%d\n",
DEBUG_NAME, rc);
goto error_remove_dir;
}
file = debugfs_create_file("tpg_ctrl", 0644, dir,
debug, &tpg_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs tpg failed, rc=%d\n",
DEBUG_NAME, rc);
goto error_remove_dir;
}
file = debugfs_create_file("hdr", 0400, dir,
debug, &hdr_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs hdr failed, rc=%d\n",
DEBUG_NAME, rc);
goto error_remove_dir;
}
file = debugfs_create_file("hdr_mst", 0400, dir,
debug, &hdr_mst_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs hdr_mst failed, rc=%d\n",
DEBUG_NAME, rc);
goto error_remove_dir;
}
file = debugfs_create_file("sim", 0644, dir,
debug, &sim_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs sim failed, rc=%d\n",
DEBUG_NAME, rc);
goto error_remove_dir;
}
file = debugfs_create_file("attention", 0644, dir,
debug, &attention_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs attention failed, rc=%d\n",
DEBUG_NAME, rc);
goto error_remove_dir;
}
file = debugfs_create_file("dump", 0644, dir,
debug, &dump_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs dump failed, rc=%d\n",
DEBUG_NAME, rc);
goto error_remove_dir;
}
file = debugfs_create_file("mst_mode", 0644, dir,
debug, &mst_mode_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs max_bw_code failed, rc=%d\n",
DEBUG_NAME, rc);
goto error_remove_dir;
}
file = debugfs_create_file("mst_sideband_mode", 0644, dir,
debug, &mst_sideband_mode_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs max_bw_code failed, rc=%d\n",
DEBUG_NAME, rc);
goto error_remove_dir;
}
file = debugfs_create_file("max_pclk_khz", 0644, dir,
debug, &max_pclk_khz_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs max_pclk_khz failed, rc=%d\n",
DEBUG_NAME, rc);
goto error_remove_dir;
}
file = debugfs_create_bool("force_encryption", 0644, dir,
&debug->dp_debug.force_encryption);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs force_encryption failed, rc=%d\n",
DEBUG_NAME, rc);
goto error_remove_dir;
}
file = debugfs_create_file("hdcp", 0644, dir,
debug, &hdcp_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs hdcp failed, rc=%d\n",
DEBUG_NAME, rc);
goto error_remove_dir;
}
file = debugfs_create_bool("hdcp_wait_sink_sync", 0644, dir,
&debug->dp_debug.hdcp_wait_sink_sync);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs hdcp_wait_sink_sync failed, rc=%d\n",
DEBUG_NAME, rc);
goto error_remove_dir;
}
file = debugfs_create_bool("dsc_feature_enable", 0644, dir,
&debug->parser->dsc_feature_enable);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs dsc_feature failed, rc=%d\n",
DEBUG_NAME, rc);
}
file = debugfs_create_bool("fec_feature_enable", 0644, dir,
&debug->parser->fec_feature_enable);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs fec_feature_enable failed, rc=%d\n",
DEBUG_NAME, rc);
}
file = debugfs_create_file("widebus_mode", 0644, dir,
debug, &widebus_mode_fops);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs widebus failed, rc=%d\n",
DEBUG_NAME, rc);
}
file = debugfs_create_u32("max_lclk_khz", 0644, dir,
&debug->parser->max_lclk_khz);
if (IS_ERR_OR_NULL(file)) {
rc = PTR_ERR(file);
DP_ERR("[%s] debugfs max_lclk_khz failed, rc=%d\n",
DEBUG_NAME, rc);
}
return 0;
error_remove_dir:
if (!file)
rc = -EINVAL;
debugfs_remove_recursive(dir);
error:
return rc;
@ -2229,7 +2363,7 @@ struct dp_debug *dp_debug_get(struct dp_debug_in *in)
struct dp_debug *dp_debug;
if (!in->dev || !in->panel || !in->hpd || !in->link ||
!in->catalog || !in->ctrl) {
!in->catalog || !in->ctrl || !in->pll) {
DP_ERR("invalid input\n");
rc = -EINVAL;
goto error;
@ -2251,6 +2385,7 @@ struct dp_debug *dp_debug_get(struct dp_debug_in *in)
debug->catalog = in->catalog;
debug->parser = in->parser;
debug->ctrl = in->ctrl;
debug->pll = in->pll;
dp_debug = &debug->dp_debug;
dp_debug->vdisplay = 0;

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _DP_DEBUG_H_
@ -9,9 +9,9 @@
#include "dp_panel.h"
#include "dp_ctrl.h"
#include "dp_link.h"
#include "dp_usbpd.h"
#include "dp_aux.h"
#include "dp_display.h"
#include "dp_pll.h"
#define DP_WARN(fmt, ...) DRM_WARN("[msm-dp-warn] "fmt, ##__VA_ARGS__)
#define DP_ERR(fmt, ...) DRM_DEV_ERROR(NULL, "[msm-dp-error]" fmt, \
@ -35,6 +35,7 @@
* @tpg_state: specifies whether tpg feature is enabled
* @max_pclk_khz: max pclk supported
* @force_encryption: enable/disable forced encryption for HDCP 2.2
* @skip_uevent: skip hotplug uevent to the user space
* @hdcp_status: string holding hdcp status information
* @dp_mst_connector_list: list containing all dp mst connectors
* @mst_hpd_sim: specifies whether simulated hpd enabled
@ -56,6 +57,7 @@ struct dp_debug {
bool tpg_state;
u32 max_pclk_khz;
bool force_encryption;
bool skip_uevent;
char hdcp_status[SZ_128];
struct dp_mst_connector dp_mst_connector_list;
bool mst_hpd_sim;
@ -78,6 +80,8 @@ struct dp_debug {
* @connector: double pointer to display connector
* @catalog: instance of catalog module
* @parser: instance of parser module
* @ctrl: instance of controller module
* @pll: instance of pll module
*/
struct dp_debug_in {
struct device *dev;
@ -89,6 +93,7 @@ struct dp_debug_in {
struct dp_catalog *catalog;
struct dp_parser *parser;
struct dp_ctrl *ctrl;
struct dp_pll *pll;
};
/**

View file

@ -11,7 +11,6 @@
#include <linux/of_irq.h>
#include <linux/extcon.h>
#include <linux/soc/qcom/fsa4480-i2c.h>
#include <linux/usb/usbpd.h>
#include "sde_connector.h"
@ -28,6 +27,7 @@
#include "dp_display.h"
#include "sde_hdcp.h"
#include "dp_debug.h"
#include "dp_pll.h"
#define DP_MST_DEBUG(fmt, ...) DP_DEBUG(fmt, ##__VA_ARGS__)
@ -152,6 +152,7 @@ struct dp_display_private {
struct dp_panel *panel;
struct dp_ctrl *ctrl;
struct dp_debug *debug;
struct dp_pll *pll;
struct dp_panel *active_panels[DP_STREAM_MAX];
struct dp_hdcp hdcp;
@ -493,7 +494,8 @@ static void dp_display_deinitialize_hdcp(struct dp_display_private *dp)
return;
}
sde_dp_hdcp2p2_deinit(dp->hdcp.data);
sde_hdcp_1x_deinit(dp->hdcp.dev[HDCP_VERSION_1X].fd);
sde_dp_hdcp2p2_deinit(dp->hdcp.dev[HDCP_VERSION_2P2].fd);
}
static int dp_display_initialize_hdcp(struct dp_display_private *dp)
@ -527,19 +529,18 @@ static int dp_display_initialize_hdcp(struct dp_display_private *dp)
fd = sde_hdcp_1x_init(&hdcp_init_data);
if (IS_ERR_OR_NULL(fd)) {
DP_ERR("Error initializing HDCP 1.x\n");
rc = -EINVAL;
goto error;
DP_DEBUG("Error initializing HDCP 1.x\n");
return -EINVAL;
}
dp->hdcp.dev[HDCP_VERSION_1X].fd = fd;
dp->hdcp.dev[HDCP_VERSION_1X].ops = sde_hdcp_1x_get(fd);
dp->hdcp.dev[HDCP_VERSION_1X].ver = HDCP_VERSION_1X;
DP_DEBUG("HDCP 1.3 initialized\n");
DP_INFO("HDCP 1.3 initialized\n");
fd = sde_dp_hdcp2p2_init(&hdcp_init_data);
if (IS_ERR_OR_NULL(fd)) {
DP_ERR("Error initializing HDCP 2.x\n");
DP_DEBUG("Error initializing HDCP 2.x\n");
rc = -EINVAL;
goto error;
}
@ -547,11 +548,11 @@ static int dp_display_initialize_hdcp(struct dp_display_private *dp)
dp->hdcp.dev[HDCP_VERSION_2P2].fd = fd;
dp->hdcp.dev[HDCP_VERSION_2P2].ops = sde_dp_hdcp2p2_get(fd);
dp->hdcp.dev[HDCP_VERSION_2P2].ver = HDCP_VERSION_2P2;
DP_DEBUG("HDCP 2.2 initialized\n");
DP_INFO("HDCP 2.2 initialized\n");
return 0;
error:
dp_display_deinitialize_hdcp(dp);
sde_hdcp_1x_deinit(dp->hdcp.dev[HDCP_VERSION_1X].fd);
return rc;
}
@ -661,8 +662,9 @@ static void dp_display_send_hpd_event(struct dp_display_private *dp)
envp[2] = bpp;
envp[3] = pattern;
envp[4] = NULL;
kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE,
envp);
if (!dp->debug->skip_uevent)
kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE,
envp);
if (connector->status == connector_status_connected) {
dp_display_state_add(DP_STATE_CONNECT_NOTIFIED);
@ -1346,17 +1348,18 @@ static int dp_display_get_usb_extcon(struct dp_display_private *dp)
static void dp_display_deinit_sub_modules(struct dp_display_private *dp)
{
dp_debug_put(dp->debug);
dp_hpd_put(dp->hpd);
dp_audio_put(dp->panel->audio);
dp_ctrl_put(dp->ctrl);
dp_link_put(dp->link);
dp_panel_put(dp->panel);
dp_aux_put(dp->aux);
dp_link_put(dp->link);
dp_power_put(dp->power);
dp_pll_put(dp->pll);
dp_aux_put(dp->aux);
dp_catalog_put(dp->catalog);
dp_parser_put(dp->parser);
dp_hpd_put(dp->hpd);
mutex_destroy(&dp->session_lock);
dp_debug_put(dp->debug);
}
static int dp_init_sub_modules(struct dp_display_private *dp)
@ -1374,6 +1377,9 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
struct dp_debug_in debug_in = {
.dev = dev,
};
struct dp_pll_in pll_in = {
.pdev = dp->pdev,
};
mutex_init(&dp->session_lock);
@ -1401,21 +1407,6 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
goto error_catalog;
}
dp->power = dp_power_get(dp->parser);
if (IS_ERR(dp->power)) {
rc = PTR_ERR(dp->power);
DP_ERR("failed to initialize power, rc = %d\n", rc);
dp->power = NULL;
goto error_power;
}
rc = dp->power->power_client_init(dp->power, &dp->priv->phandle,
dp->dp_display.drm_dev);
if (rc) {
DP_ERR("Power client create failed\n");
goto error_aux;
}
dp->aux = dp_aux_get(dev, &dp->catalog->aux, dp->parser,
dp->aux_switch_node);
if (IS_ERR(dp->aux)) {
@ -1428,6 +1419,32 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
rc = dp->aux->drm_aux_register(dp->aux);
if (rc) {
DP_ERR("DRM DP AUX register failed\n");
goto error_pll;
}
pll_in.aux = dp->aux;
pll_in.parser = dp->parser;
dp->pll = dp_pll_get(&pll_in);
if (IS_ERR(dp->pll)) {
rc = PTR_ERR(dp->pll);
DP_ERR("failed to initialize pll, rc = %d\n", rc);
dp->pll = NULL;
goto error_pll;
}
dp->power = dp_power_get(dp->parser, dp->pll);
if (IS_ERR(dp->power)) {
rc = PTR_ERR(dp->power);
DP_ERR("failed to initialize power, rc = %d\n", rc);
dp->power = NULL;
goto error_power;
}
rc = dp->power->power_client_init(dp->power, &dp->priv->phandle,
dp->dp_display.drm_dev);
if (rc) {
DP_ERR("Power client create failed\n");
goto error_link;
}
@ -1503,6 +1520,7 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
debug_in.catalog = dp->catalog;
debug_in.parser = dp->parser;
debug_in.ctrl = dp->ctrl;
debug_in.pll = dp->pll;
dp->debug = dp_debug_get(&debug_in);
if (IS_ERR(dp->debug)) {
@ -1520,10 +1538,12 @@ static int dp_init_sub_modules(struct dp_display_private *dp)
dp_display_get_usb_extcon(dp);
rc = dp->hpd->register_hpd(dp->hpd);
if (rc) {
DP_ERR("failed register hpd\n");
goto error_hpd_reg;
if (dp->hpd->register_hpd) {
rc = dp->hpd->register_hpd(dp->hpd);
if (rc) {
DP_ERR("failed register hpd\n");
goto error_hpd_reg;
}
}
return rc;
@ -1540,10 +1560,12 @@ error_ctrl:
error_panel:
dp_link_put(dp->link);
error_link:
dp_aux_put(dp->aux);
error_aux:
dp_power_put(dp->power);
error_power:
dp_pll_put(dp->pll);
error_pll:
dp_aux_put(dp->aux);
error_aux:
dp_catalog_put(dp->catalog);
error_catalog:
dp_parser_put(dp->parser);

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/slab.h>
@ -9,6 +9,7 @@
#include <linux/err.h>
#include "dp_hpd.h"
#include "dp_altmode.h"
#include "dp_usbpd.h"
#include "dp_gpio_hpd.h"
#include "dp_lphw_hpd.h"
@ -58,6 +59,14 @@ struct dp_hpd *dp_hpd_get(struct device *dev, struct dp_parser *parser,
}
dp_hpd->type = DP_HPD_GPIO;
} else {
dp_hpd = dp_altmode_get(dev, cb);
if (!IS_ERR(dp_hpd)) {
dp_hpd->type = DP_HPD_ALTMODE;
goto config;
}
DP_WARN("dp_altmode failed (%ld), falling back to dp_usbpd\n",
PTR_ERR(dp_hpd));
dp_hpd = dp_usbpd_get(dev, cb);
if (IS_ERR(dp_hpd)) {
DP_ERR("failed to get usbpd\n");
@ -66,6 +75,7 @@ struct dp_hpd *dp_hpd_get(struct device *dev, struct dp_parser *parser,
dp_hpd->type = DP_HPD_USBPD;
}
config:
if (!dp_hpd->host_init)
dp_hpd->host_init = dp_hpd_host_init;
if (!dp_hpd->host_deinit)
@ -85,6 +95,9 @@ void dp_hpd_put(struct dp_hpd *dp_hpd)
case DP_HPD_USBPD:
dp_usbpd_put(dp_hpd);
break;
case DP_HPD_ALTMODE:
dp_altmode_put(dp_hpd);
break;
case DP_HPD_GPIO:
dp_gpio_hpd_put(dp_hpd);
break;

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _DP_HPD_H_
@ -12,14 +12,28 @@
struct device;
/**
* enum dp_hpd_plug_orientation - plug orientation
* @ORIENTATION_NONE: Undefined or unspecified
* @ORIENTATION_CC1: CC1
* @ORIENTATION_CC2: CC2
*/
enum dp_hpd_plug_orientation {
ORIENTATION_NONE,
ORIENTATION_CC1,
ORIENTATION_CC2,
};
/**
* enum dp_hpd_type - dp hpd type
* @DP_HPD_ALTMODE: AltMode over G-Link based HPD
* @DP_HPD_USBPD: USB type-c based HPD
* @DP_HPD_GPIO: GPIO based HPD
* @DP_HPD_BUILTIN: Controller built-in HPD
*/
enum dp_hpd_type {
DP_HPD_ALTMODE,
DP_HPD_USBPD,
DP_HPD_GPIO,
DP_HPD_LPHW,
@ -48,6 +62,8 @@ struct dp_hpd_cb {
* @hpd_irq: Change in the status since last message
* @alt_mode_cfg_done: bool to specify alt mode status
* @multi_func: multi-function preferred, USBPD type only
* @peer_usb_com: downstream supports usb data communication
* @force_multi_func: force multi-function preferred
* @isr: event interrupt, BUILTIN and LPHW type only
* @register_hpd: register hardware callback
* @host_init: source or host side setup for hpd
@ -64,6 +80,7 @@ struct dp_hpd {
bool alt_mode_cfg_done;
bool multi_func;
bool peer_usb_comm;
bool force_multi_func;
void (*isr)(struct dp_hpd *dp_hpd);
int (*register_hpd)(struct dp_hpd *dp_hpd);

View file

@ -1528,6 +1528,18 @@ skip_dpcd_read:
link_info->num_lanes = dpcd[DP_MAX_LANE_COUNT] & DP_MAX_LANE_COUNT_MASK;
if (is_link_rate_valid(panel->dp_panel.link_bw_code)) {
DP_DEBUG("debug link bandwidth code: 0x%x\n",
panel->dp_panel.link_bw_code);
link_info->rate = drm_dp_bw_code_to_link_rate(
panel->dp_panel.link_bw_code);
}
if (is_lane_count_valid(panel->dp_panel.lane_count)) {
DP_DEBUG("debug lane count: %d\n", panel->dp_panel.lane_count);
link_info->num_lanes = panel->dp_panel.lane_count;
}
if (multi_func)
link_info->num_lanes = min_t(unsigned int,
link_info->num_lanes, 2);
@ -2272,11 +2284,6 @@ static int dp_panel_deinit_panel_info(struct dp_panel *dp_panel, u32 flags)
struct drm_connector *connector;
struct sde_connector_state *c_state;
if (!dp_panel) {
DP_ERR("invalid input\n");
return -EINVAL;
}
if (flags & DP_PANEL_SRC_INITIATED_POWER_DOWN) {
DP_DEBUG("retain states in src initiated power down request\n");
return 0;
@ -2318,6 +2325,9 @@ static int dp_panel_deinit_panel_info(struct dp_panel *dp_panel, u32 flags)
memset(&c_state->hdr_meta, 0, sizeof(c_state->hdr_meta));
memset(&c_state->dyn_hdr_meta, 0, sizeof(c_state->dyn_hdr_meta));
dp_panel->link_bw_code = 0;
dp_panel->lane_count = 0;
return rc;
}
@ -3001,6 +3011,8 @@ struct dp_panel *dp_panel_get(struct dp_panel_in *in)
dp_panel = &panel->dp_panel;
dp_panel->max_bw_code = DP_LINK_BW_8_1;
dp_panel->spd_enabled = true;
dp_panel->link_bw_code = 0;
dp_panel->lane_count = 0;
memcpy(panel->spd_vendor_name, vendor_name, (sizeof(u8) * 8));
memcpy(panel->spd_product_description, product_desc, (sizeof(u8) * 16));
dp_panel->connector = in->connector;

View file

@ -10,7 +10,6 @@
#include "dp_aux.h"
#include "dp_link.h"
#include "dp_usbpd.h"
#include "sde_edid_parser.h"
#include "sde_connector.h"
#include "msm_drv.h"
@ -108,6 +107,8 @@ struct dp_panel {
/* debug */
u32 max_bw_code;
u32 lane_count;
u32 link_bw_code;
/* By default, stream_id is assigned to DP_INVALID_STREAM.
* Client sets the stream id value using set_stream_id interface.

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/of_gpio.h>
@ -297,6 +297,7 @@ static const char *dp_parser_supply_node_name(enum dp_pm_type module)
case DP_CORE_PM: return "qcom,core-supply-entries";
case DP_CTRL_PM: return "qcom,ctrl-supply-entries";
case DP_PHY_PM: return "qcom,phy-supply-entries";
case DP_PLL_PM: return "qcom,pll-supply-entries";
default: return "???";
}
}

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _DP_PARSER_H_
@ -21,6 +21,7 @@ enum dp_pm_type {
DP_STREAM0_PM,
DP_STREAM1_PM,
DP_LINK_PM,
DP_PLL_PM,
DP_MAX_PM
};
@ -33,6 +34,7 @@ static inline const char *dp_parser_pm_name(enum dp_pm_type module)
case DP_STREAM0_PM: return "DP_STREAM0_PM";
case DP_STREAM1_PM: return "DP_STREAM1_PM";
case DP_LINK_PM: return "DP_LINK_PM";
case DP_PLL_PM: return "DP_PLL_PM";
default: return "???";
}
}

143
msm/dp/dp_pll.c Normal file
View file

@ -0,0 +1,143 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/err.h>
#include <linux/of_device.h>
#include "dp_debug.h"
#include "dp_pll.h"
static int dp_pll_fill_io(struct dp_pll *pll)
{
struct dp_parser *parser = pll->parser;
pll->io.dp_phy = parser->get_io(parser, "dp_phy");
if (!pll->io.dp_phy) {
DP_ERR("Invalid dp_phy resource\n");
return -ENOMEM;
}
pll->io.dp_pll = parser->get_io(parser, "dp_pll");
if (!pll->io.dp_pll) {
DP_ERR("Invalid dp_pll resource\n");
return -ENOMEM;
}
pll->io.dp_ln_tx0 = parser->get_io(parser, "dp_ln_tx0");
if (!pll->io.dp_ln_tx0) {
DP_ERR("Invalid dp_ln_tx1 resource\n");
return -ENOMEM;
}
pll->io.dp_ln_tx1 = parser->get_io(parser, "dp_ln_tx1");
if (!pll->io.dp_ln_tx1) {
DP_ERR("Invalid dp_ln_tx1 resource\n");
return -ENOMEM;
}
pll->io.gdsc = parser->get_io(parser, "gdsc");
if (!pll->io.gdsc) {
DP_ERR("Invalid gdsc resource\n");
return -ENOMEM;
}
return 0;
}
static int dp_pll_clock_register(struct dp_pll *pll)
{
int rc;
switch (pll->revision) {
case DP_PLL_5NM_V1:
case DP_PLL_5NM_V2:
rc = dp_pll_clock_register_5nm(pll);
break;
default:
rc = -ENOTSUPP;
break;
}
return rc;
}
static void dp_pll_clock_unregister(struct dp_pll *pll)
{
switch (pll->revision) {
case DP_PLL_5NM_V1:
case DP_PLL_5NM_V2:
dp_pll_clock_unregister_5nm(pll);
break;
default:
break;
}
}
struct dp_pll *dp_pll_get(struct dp_pll_in *in)
{
int rc = 0;
struct dp_pll *pll;
struct dp_parser *parser;
const char *label = NULL;
struct platform_device *pdev;
if (!in || !in->pdev || !in->pdev->dev.of_node || !in->parser) {
DP_ERR("Invalid resource pointers\n");
return ERR_PTR(-EINVAL);
}
pll = kzalloc(sizeof(*pll), GFP_KERNEL);
if (!pll)
return ERR_PTR(-ENOMEM);
pll->pdev = in->pdev;
pll->parser = in->parser;
pll->aux = in->aux;
parser = pll->parser;
pdev = pll->pdev;
label = of_get_property(pdev->dev.of_node, "qcom,pll-revision", NULL);
if (label) {
if (!strcmp(label, "5nm-v1")) {
pll->revision = DP_PLL_5NM_V1;
} else if (!strcmp(label, "5nm-v2")) {
pll->revision = DP_PLL_5NM_V2;
} else {
DP_ERR("Unsupported pll revision\n");
rc = -ENOTSUPP;
goto error;
}
} else {
DP_ERR("pll revision not specified\n");
rc = -EINVAL;
goto error;
}
pll->ssc_en = of_property_read_bool(pdev->dev.of_node,
"qcom,ssc-feature-enable");
pll->bonding_en = of_property_read_bool(pdev->dev.of_node,
"qcom,bonding-feature-enable");
rc = dp_pll_fill_io(pll);
if (rc)
goto error;
rc = dp_pll_clock_register(pll);
if (rc)
goto error;
DP_INFO("revision=%s, ssc_en=%d, bonding_en=%d\n",
dp_pll_get_revision(pll->revision), pll->ssc_en,
pll->bonding_en);
return pll;
error:
kfree(pll);
return ERR_PTR(rc);
}
void dp_pll_put(struct dp_pll *pll)
{
dp_pll_clock_unregister(pll);
kfree(pll);
}

142
msm/dp/dp_pll.h Normal file
View file

@ -0,0 +1,142 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
*/
#ifndef __DP_PLL_H
#define __DP_PLL_H
#include <linux/io.h>
#include <linux/clk-provider.h>
#include <linux/of_device.h>
#include "dp_parser.h"
#include "sde_dbg.h"
#define DP_VCO_HSCLK_RATE_1620MHZDIV1000 1620000UL
#define DP_VCO_HSCLK_RATE_2700MHZDIV1000 2700000UL
#define DP_VCO_HSCLK_RATE_5400MHZDIV1000 5400000UL
#define DP_VCO_HSCLK_RATE_8100MHZDIV1000 8100000UL
#define dp_pll_get_base(x) pll->io.x->io.base
#define dp_pll_read(x, offset) ({ \
readl_relaxed((dp_pll_get_base(x)) + (offset)); \
})
#define dp_pll_write(x, offset, data) ({ \
DP_DEBUG(#offset", addr=0x%x, val=0x%x\n", \
(dp_pll_get_base(x)) + (offset), (data)); \
SDE_EVT32_VERBOSE((dp_pll_get_base(x)) + (offset), (data)); \
writel_relaxed((data), (dp_pll_get_base(x)) + (offset)); \
})
enum dp_pll_revision {
DP_PLL_UNKNOWN,
DP_PLL_5NM_V1,
DP_PLL_5NM_V2,
};
static inline const char *dp_pll_get_revision(enum dp_pll_revision rev)
{
switch (rev) {
case DP_PLL_UNKNOWN: return "DP_PLL_UNKNOWN";
case DP_PLL_5NM_V1: return "DP_PLL_5NM_V1";
case DP_PLL_5NM_V2: return "DP_PLL_5NM_V2";
default: return "???";
}
}
struct dp_pll_io {
struct dp_io_data *dp_phy;
struct dp_io_data *dp_pll;
struct dp_io_data *dp_ln_tx0;
struct dp_io_data *dp_ln_tx1;
struct dp_io_data *gdsc;
};
struct dp_pll_vco_clk {
struct clk_hw hw;
unsigned long rate; /* current vco rate */
u64 min_rate; /* min vco rate */
u64 max_rate; /* max vco rate */
void *priv;
};
struct dp_pll {
/*
* target pll revision information
*/
u32 revision;
/*
* Certain plls needs to update the same vco rate after resume in
* suspend/resume scenario. Cached the vco rate for such plls.
*/
unsigned long vco_cached_rate;
/*
* PLL index if multiple index are available. Eg. in case of
* DSI we have 2 plls.
*/
uint32_t index;
bool ssc_en;
bool bonding_en;
void *priv;
struct platform_device *pdev;
struct dp_parser *parser;
struct dp_power *power;
struct dp_aux *aux;
struct dp_pll_io io;
struct clk_onecell_data *clk_data;
};
struct dp_pll_db {
struct dp_pll *pll;
/* lane and orientation settings */
u8 lane_cnt;
u8 orientation;
/* COM PHY settings */
u32 hsclk_sel;
u32 dec_start_mode0;
u32 div_frac_start1_mode0;
u32 div_frac_start2_mode0;
u32 div_frac_start3_mode0;
u32 integloop_gain0_mode0;
u32 integloop_gain1_mode0;
u32 lock_cmp1_mode0;
u32 lock_cmp2_mode0;
u32 lock_cmp_en;
u32 ssc_step_size1_mode0;
u32 ssc_step_size2_mode0;
/* PHY vco divider */
u32 phy_vco_div;
};
static inline struct dp_pll_vco_clk *to_dp_vco_hw(struct clk_hw *hw)
{
return container_of(hw, struct dp_pll_vco_clk, hw);
}
static inline bool is_gdsc_disabled(struct dp_pll *pll)
{
return (dp_pll_read(gdsc, 0x0) & BIT(31)) ? false : true;
}
int dp_pll_clock_register_5nm(struct dp_pll *pll);
void dp_pll_clock_unregister_5nm(struct dp_pll *pll);
struct dp_pll_in {
struct platform_device *pdev;
struct dp_aux *aux;
struct dp_parser *parser;
};
struct dp_pll *dp_pll_get(struct dp_pll_in *in);
void dp_pll_put(struct dp_pll *pll);
#endif /* __DP_PLL_H */

1038
msm/dp/dp_pll_5nm.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/clk.h>
@ -9,16 +9,17 @@
#include "dp_power.h"
#include "dp_catalog.h"
#include "dp_debug.h"
#include "dp_pll.h"
#define DP_CLIENT_NAME_SIZE 20
struct dp_power_private {
struct dp_parser *parser;
struct dp_pll *pll;
struct platform_device *pdev;
struct clk *pixel_clk_rcg;
struct clk *pixel_parent;
struct clk *pixel1_clk_rcg;
struct clk *pixel1_parent;
struct dp_power dp_power;
@ -84,6 +85,17 @@ static int dp_power_regulator_ctrl(struct dp_power_private *power, bool enable)
parser = power->parser;
for (i = DP_CORE_PM; i < DP_MAX_PM; i++) {
/*
* The DP_PLL_PM regulator is controlled by dp_display based
* on the link configuration.
*/
if (i == DP_PLL_PM) {
DP_DEBUG("skipping: '%s' vregs for %s\n",
enable ? "enable" : "disable",
dp_parser_pm_name(i));
continue;
}
rc = msm_dss_enable_vreg(
parser->mp[i].vreg_config,
parser->mp[i].num_vreg, enable);
@ -151,6 +163,20 @@ static int dp_power_pinctrl_set(struct dp_power_private *power, bool active)
return rc;
}
static void dp_power_clk_put(struct dp_power_private *power)
{
enum dp_pm_type module;
for (module = DP_CORE_PM; module < DP_MAX_PM; module++) {
struct dss_module_power *pm = &power->parser->mp[module];
if (!pm->num_clk)
continue;
msm_dss_put_clk(pm->clk_config, pm->num_clk);
}
}
static int dp_power_clk_init(struct dp_power_private *power, bool enable)
{
int rc = 0;
@ -175,52 +201,53 @@ static int dp_power_clk_init(struct dp_power_private *power, bool enable)
}
}
power->pixel_clk_rcg = devm_clk_get(dev, "pixel_clk_rcg");
power->pixel_clk_rcg = clk_get(dev, "pixel_clk_rcg");
if (IS_ERR(power->pixel_clk_rcg)) {
DP_DEBUG("Unable to get DP pixel clk RCG\n");
DP_ERR("Unable to get DP pixel clk RCG: %d\n",
PTR_ERR(power->pixel_clk_rcg));
rc = PTR_ERR(power->pixel_clk_rcg);
power->pixel_clk_rcg = NULL;
goto err_pixel_clk_rcg;
}
power->pixel_parent = devm_clk_get(dev, "pixel_parent");
power->pixel_parent = clk_get(dev, "pixel_parent");
if (IS_ERR(power->pixel_parent)) {
DP_DEBUG("Unable to get DP pixel RCG parent\n");
DP_DEBUG("Unable to get DP pixel RCG parent: %d\n",
PTR_ERR(power->pixel_parent));
rc = PTR_ERR(power->pixel_parent);
power->pixel_parent = NULL;
goto err_pixel_parent;
}
power->pixel1_clk_rcg = devm_clk_get(dev, "pixel1_clk_rcg");
power->pixel1_clk_rcg = clk_get(dev, "pixel1_clk_rcg");
if (IS_ERR(power->pixel1_clk_rcg)) {
DP_DEBUG("Unable to get DP pixel1 clk RCG\n");
DP_DEBUG("Unable to get DP pixel1 clk RCG: %d\n",
PTR_ERR(power->pixel1_clk_rcg));
rc = PTR_ERR(power->pixel1_clk_rcg);
power->pixel1_clk_rcg = NULL;
}
power->pixel1_parent = devm_clk_get(dev, "pixel1_parent");
if (IS_ERR(power->pixel1_parent)) {
DP_DEBUG("Unable to get DP pixel1 RCG parent\n");
power->pixel1_parent = NULL;
goto err_pixel1_clk_rcg;
}
} else {
if (power->pixel1_clk_rcg)
clk_put(power->pixel1_clk_rcg);
if (power->pixel_parent)
devm_clk_put(dev, power->pixel_parent);
clk_put(power->pixel_parent);
if (power->pixel_clk_rcg)
devm_clk_put(dev, power->pixel_clk_rcg);
clk_put(power->pixel_clk_rcg);
if (power->pixel1_parent)
devm_clk_put(dev, power->pixel1_parent);
if (power->pixel1_clk_rcg)
devm_clk_put(dev, power->pixel1_clk_rcg);
for (module = DP_CORE_PM; module < DP_MAX_PM; module++) {
struct dss_module_power *pm =
&power->parser->mp[module];
if (!pm->num_clk)
continue;
msm_dss_put_clk(pm->clk_config, pm->num_clk);
}
dp_power_clk_put(power);
}
return rc;
err_pixel1_clk_rcg:
clk_put(power->pixel_parent);
err_pixel_parent:
clk_put(power->pixel_clk_rcg);
err_pixel_clk_rcg:
dp_power_clk_put(power);
exit:
return rc;
}
@ -373,7 +400,7 @@ static int dp_power_request_gpios(struct dp_power_private *power)
unsigned int gpio = mp->gpio_config[i].gpio;
if (gpio_is_valid(gpio)) {
rc = devm_gpio_request(dev, gpio, gpio_names[i]);
rc = gpio_request(gpio, gpio_names[i]);
if (rc) {
DP_ERR("request %s gpio failed, rc=%d\n",
gpio_names[i], rc);
@ -521,13 +548,20 @@ static int dp_power_set_pixel_clk_parent(struct dp_power *dp_power, u32 strm_id)
if (strm_id == DP_STREAM_0) {
if (power->pixel_clk_rcg && power->pixel_parent)
clk_set_parent(power->pixel_clk_rcg,
rc = clk_set_parent(power->pixel_clk_rcg,
power->pixel_parent);
else
DP_WARN("skipped for strm_id=%d\n", strm_id);
} else if (strm_id == DP_STREAM_1) {
if (power->pixel1_clk_rcg && power->pixel1_parent)
clk_set_parent(power->pixel1_clk_rcg,
power->pixel1_parent);
if (power->pixel1_clk_rcg && power->pixel_parent)
rc = clk_set_parent(power->pixel1_clk_rcg,
power->pixel_parent);
else
DP_WARN("skipped for strm_id=%d\n", strm_id);
}
if (rc)
DP_ERR("failed. strm_id=%d, rc=%d\n", strm_id, rc);
exit:
return rc;
}
@ -653,25 +687,26 @@ exit:
return rc;
}
struct dp_power *dp_power_get(struct dp_parser *parser)
struct dp_power *dp_power_get(struct dp_parser *parser, struct dp_pll *pll)
{
int rc = 0;
struct dp_power_private *power;
struct dp_power *dp_power;
if (!parser) {
if (!parser || !pll) {
DP_ERR("invalid input\n");
rc = -EINVAL;
goto error;
}
power = devm_kzalloc(&parser->pdev->dev, sizeof(*power), GFP_KERNEL);
power = kzalloc(sizeof(*power), GFP_KERNEL);
if (!power) {
rc = -ENOMEM;
goto error;
}
power->parser = parser;
power->pll = pll;
power->pdev = parser->pdev;
dp_power = &power->dp_power;
@ -698,5 +733,5 @@ void dp_power_put(struct dp_power *dp_power)
power = container_of(dp_power, struct dp_power_private, dp_power);
devm_kfree(&power->pdev->dev, power);
kfree(power);
}

View file

@ -1,12 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _DP_POWER_H_
#define _DP_POWER_H_
#include "dp_parser.h"
#include "dp_pll.h"
#include "sde_power_handle.h"
/**
@ -17,6 +18,8 @@
* @clk_enable: enable/disable the DP clocks
* @set_pixel_clk_parent: set the parent of DP pixel clock
* @clk_get_rate: get the current rate for provided clk_name
* @power_client_init: configures clocks and regulators
* @power_client_deinit: frees clock and regulator resources
*/
struct dp_power {
struct drm_device *drm_dev;
@ -37,13 +40,14 @@ struct dp_power {
* dp_power_get() - configure and get the DisplayPort power module data
*
* @parser: instance of parser module
* @pll: instance of pll module
* return: pointer to allocated power module data
*
* This API will configure the DisplayPort's power module and provides
* methods to be called by the client to configure the power related
* modueles.
*/
struct dp_power *dp_power_get(struct dp_parser *parser);
struct dp_power *dp_power_get(struct dp_parser *parser, struct dp_pll *pll);
/**
* dp_power_put() - release the power related resources

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _DP_REG_H_
@ -387,11 +387,9 @@
#define TXn_HIGHZ_DRVR_EN_V420 (0x0058)
#define TXn_TX_POL_INV_V420 (0x005C)
#define QSERDES_COM_BIAS_EN_CLKBUFLR_EN (0x004)
#define QSERDES_COM_BIAS_EN_CLKBUFLR_EN (0x044)
/* DP MMSS_CC registers */
#define MMSS_DP_LINK_CMD_RCGR (0x0138)
#define MMSS_DP_LINK_CFG_RCGR (0x013C)
#define MMSS_DP_PIXEL_M (0x01B4)
#define MMSS_DP_PIXEL_N (0x01B8)
#define MMSS_DP_PIXEL1_M (0x01CC)
@ -400,10 +398,10 @@
#define MMSS_DP_PIXEL_N_V200 (0x0134)
#define MMSS_DP_PIXEL1_M_V200 (0x0148)
#define MMSS_DP_PIXEL1_N_V200 (0x014C)
#define MMSS_DP_PIXEL_M_V420 (0x01B4)
#define MMSS_DP_PIXEL_N_V420 (0x01B8)
#define MMSS_DP_PIXEL1_M_V420 (0x01CC)
#define MMSS_DP_PIXEL1_N_V420 (0x01D0)
#define MMSS_DP_PIXEL_M_V420 (0x01B0)
#define MMSS_DP_PIXEL_N_V420 (0x01B4)
#define MMSS_DP_PIXEL1_M_V420 (0x01C8)
#define MMSS_DP_PIXEL1_N_V420 (0x01CC)
/* DP HDCP 1.3 registers */
#define DP_HDCP_CTRL (0x0A0)
@ -431,13 +429,11 @@
#define HDCP_SEC_DP_TZ_HV_HLOS_HDCP_RCVPORT_DATA12 (0x020)
/* USB3 DP COM registers */
#define USB3_DP_COM_RESET_OVRD_CTRL (0x1C)
#define USB3_DP_COM_PHY_MODE_CTRL (0x00)
#define USB3_DP_COM_SW_RESET (0x04)
#define USB3_DP_COM_TYPEC_CTRL (0x10)
#define USB3_DP_COM_SWI_CTRL (0x0c)
#define USB3_DP_COM_POWER_DOWN_CTRL (0x08)
#define USB3_DP_COM_SWI_CTRL (0x0C)
#define USB3_DP_COM_TYPEC_CTRL (0x10)
#define USB3_DP_COM_RESET_OVRD_CTRL (0x1C)
#endif /* _DP_REG_H_ */

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
*/
#ifndef _DP_USBPD_H_
@ -46,6 +46,7 @@ struct dp_usbpd {
bool debug_en;
};
#ifdef CONFIG_DRM_MSM_DP_USBPD_LEGACY
/**
* dp_usbpd_get() - setup usbpd module
*
@ -59,6 +60,16 @@ struct dp_usbpd {
* the callback functions about the connection and status.
*/
struct dp_hpd *dp_usbpd_get(struct device *dev, struct dp_hpd_cb *cb);
void dp_usbpd_put(struct dp_hpd *pd);
#else
static inline struct dp_hpd *dp_usbpd_get(struct device *dev,
struct dp_hpd_cb *cb)
{
return NULL;
}
static inline void dp_usbpd_put(struct dp_hpd *pd)
{
}
#endif /* CONFIG_DRM_MSM_DP_USBPD_LEGACY */
#endif /* _DP_USBPD_H_ */