drm/msm/dp: remove most of usbpd-related remains
PATCH v2 1/1 drm/msm/dp: remove most of usbpd-related remains
Remove most of remains of downstream usbpd code. Mainline kernel uses different approach for managing Type-C / USB-PD, so this remains unused.
---
Changes since v1:
- Also drop USBPD callbacks as per [1].
[1] https://patchwork.freedesktop.org/patch/536942/?series=117732&rev=1
--- drivers/gpu/drm/msm/Makefile | 1 - drivers/gpu/drm/msm/dp/dp_ctrl.h | 1 - drivers/gpu/drm/msm/dp/dp_debug.c | 6 +-- drivers/gpu/drm/msm/dp/dp_debug.h | 5 +- drivers/gpu/drm/msm/dp/dp_display.c | 34 +------------ drivers/gpu/drm/msm/dp/dp_hpd.c | 67 ------------------------- drivers/gpu/drm/msm/dp/dp_hpd.h | 78 ----------------------------- drivers/gpu/drm/msm/dp/dp_panel.h | 1 - drivers/gpu/drm/msm/dp/dp_power.c | 2 +- drivers/gpu/drm/msm/dp/dp_power.h | 3 +- 10 files changed, 8 insertions(+), 190 deletions(-) delete mode 100644 drivers/gpu/drm/msm/dp/dp_hpd.c delete mode 100644 drivers/gpu/drm/msm/dp/dp_hpd.h
drivers/gpu/drm/msm/Makefile +0 -1
@@ -122,7 +122,6 @@ msm-$(CONFIG_DRM_MSM_DP)+= dp/dp_aux.o \ dp/dp_ctrl.o \ dp/dp_display.o \ dp/dp_drm.o \ - dp/dp_hpd.o \ dp/dp_link.o \ dp/dp_panel.o \ dp/dp_parser.o \
drivers/gpu/drm/msm/dp/dp_ctrl.h +0 -1
@@ -14,7 +14,6 @@#include "dp_catalog.h" struct dp_ctrl { -bool orientation;atomic_t aborted;bool wide_bus_en; };
drivers/gpu/drm/msm/dp/dp_debug.c +2 -4
@@ -21,7 +21,6 @@struct dp_debug_private {struct dentry *root; -struct dp_usbpd *usbpd;struct dp_link *link;struct dp_panel *panel;struct drm_connector *connector;
@@ -232,14 +231,14 @@ static void dp_debug_init(struct dp_debug *dp_debug, struct drm_minor *minor) }struct dp_debug *dp_debug_get (struct device *dev,struct dp_panel *panel, -struct dp_usbpd *usbpd,struct dp_link *link, +struct dp_link *link,struct drm_connector *connector,struct drm_minor *minor) {struct dp_debug_private *debug;struct dp_debug *dp_debug;int rc; -if (!dev || !panel || !usbpd || !link) { +if (!dev || !panel || !link) {DRM_ERROR ("invalid input\n" ); rc = -EINVAL ; goto error;
@@ -252,7 +251,6 @@ struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel, } debug->dp_debug.debug_en = false; - debug->usbpd = usbpd; debug->link = link; debug->panel = panel; debug->dev = dev;
drivers/gpu/drm/msm/dp/dp_debug.h +2 -3
@@ -32,7 +32,6 @@ struct dp_debug {* * @dev: device instance of the caller * @panel: instance of panel module -* @usbpd: instance of usbpd module * @link: instance of link module * @connector: double pointer to display connector * @minor: pointer to drm minor number after device registration
@@ -42,7 +41,7 @@ struct dp_debug {* for debugfs input to be communicated with existing modules */ struct dp_debug *dp_debug_get (struct device *dev,struct dp_panel *panel, -struct dp_usbpd *usbpd,struct dp_link *link, +struct dp_link *link,struct drm_connector *connector,struct drm_minor *minor);
@@ -59,7 +58,7 @@ void dp_debug_put(struct dp_debug *dp_debug);static inline struct dp_debug *dp_debug_get (struct device *dev,struct dp_panel *panel, -struct dp_usbpd *usbpd,struct dp_link *link, +struct dp_link *link,struct drm_connector *connector,struct drm_minor *minor) {return ERR_PTR (-EINVAL );
drivers/gpu/drm/msm/dp/dp_display.c +2 -32
@@ -14,7 +14,6 @@#include "msm_drv.h" #include "msm_kms.h" -#include "dp_hpd.h" #include "dp_parser.h" #include "dp_power.h" #include "dp_catalog.h"
@@ -88,7 +87,6 @@ struct dp_display_private {struct platform_device *pdev;struct dentry *root; -struct dp_usbpd *usbpd;struct dp_parser *parser;struct dp_power *power;struct dp_catalog *catalog;
@@ -98,7 +96,6 @@ struct dp_display_private {struct dp_ctrl *ctrl;struct dp_debug *debug; -struct dp_usbpd_cb usbpd_cb;struct dp_display_mode dp_mode;struct msm_dp dp_display;
@@ -462,7 +459,7 @@ static void dp_display_host_init(struct dp_display_private *dp) dp->dp_display.connector_type, dp->core_initialized, dp->phy_initialized); -dp_power_init (dp->power, false); +dp_power_init (dp->power);dp_ctrl_reset_irq_ctrl (dp->ctrl, true);dp_aux_init (dp->aux); dp->core_initialized = true;
@@ -489,11 +486,6 @@ static int dp_display_usbpd_configure_cb(struct device *dev)return dp_display_process_hpd_high (dp); } -static int dp_display_usbpd_disconnect_cb (struct device *dev) -{ -return 0 ; -} -static int dp_display_notify_disconnect (struct device *dev) {struct dp_display_private *dp =dev_get_dp_display_private (dev);
@@ -578,13 +570,9 @@ static int dp_display_usbpd_attention_cb(struct device *dev)static int dp_hpd_plug_handle (struct dp_display_private *dp,u32 data) { -struct dp_usbpd *hpd = dp->usbpd;u32 state;int ret; -if (!hpd) -return 0 ; -mutex_lock (&dp->event_mutex); state = dp->hpd_state;
@@ -645,12 +633,8 @@ static void dp_display_handle_plugged_change(struct msm_dp *dp_display,static int dp_hpd_unplug_handle (struct dp_display_private *dp,u32 data) { -struct dp_usbpd *hpd = dp->usbpd;u32 state; -if (!hpd) -return 0 ; -mutex_lock (&dp->event_mutex); state = dp->hpd_state;
@@ -763,24 +747,10 @@ static int dp_init_sub_modules(struct dp_display_private *dp) {int rc =0 ;struct device *dev = &dp->pdev->dev; -struct dp_usbpd_cb *cb = &dp->usbpd_cb;struct dp_panel_in panel_in = { .dev = dev, }; -/* Callback APIs used for cable status change event */ - cb->configure = dp_display_usbpd_configure_cb; - cb->disconnect = dp_display_usbpd_disconnect_cb; - cb->attention = dp_display_usbpd_attention_cb; - - dp->usbpd =dp_hpd_get (dev, cb); -if (IS_ERR (dp->usbpd)) { - rc =PTR_ERR (dp->usbpd); -DRM_ERROR ("failed to initialize hpd, rc = %d\n" , rc); - dp->usbpd =NULL ; - goto error; - } - dp->parser =dp_parser_get (dp->pdev);if (IS_ERR (dp->parser)) { rc =PTR_ERR (dp->parser);
@@ -1540,7 +1510,7 @@ void msm_dp_debugfs_init(struct msm_dp *dp_display, struct drm_minor *minor) dp = container_of(dp_display, struct dp_display_private, dp_display); dev = &dp->pdev->dev; - dp->debug =dp_debug_get (dev, dp->panel, dp->usbpd, + dp->debug =dp_debug_get (dev, dp->panel, dp->link, dp->dp_display.connector, minor);if (IS_ERR (dp->debug)) {
drivers/gpu/drm/msm/dp/dp_hpd.c deleted +0 -67
67 lines not on this page · raw message
drivers/gpu/drm/msm/dp/dp_hpd.h deleted +0 -78
78 lines not on this page · raw message
drivers/gpu/drm/msm/dp/dp_panel.h +0 -1
@@ -10,7 +10,6 @@#include "dp_aux.h" #include "dp_link.h" -#include "dp_hpd.h" struct edid ;
drivers/gpu/drm/msm/dp/dp_power.c +1 -1
@@ -195,7 +195,7 @@ void dp_power_client_deinit(struct dp_power *dp_power)pm_runtime_disable (&power->pdev->dev); } -int dp_power_init (struct dp_power *dp_power,bool flip) +int dp_power_init (struct dp_power *dp_power) {int rc =0 ;struct dp_power_private *power =NULL ;
drivers/gpu/drm/msm/dp/dp_power.h +1 -2
@@ -26,13 +26,12 @@ struct dp_power {* dp_power_init() - enable power supplies for display controller * * @power: instance of power module -* @flip: bool for flipping gpio direction * return: 0 if success or error if failure. * * This API will turn on the regulators and configures gpio's * aux/hpd. */ -int dp_power_init (struct dp_power *power,bool flip); +int dp_power_init (struct dp_power *power);/** * dp_power_deinit() - turn off regulators and gpios.
Signature · 1 line
2.39.2
Quoted 4 lines · Dmitry Baryshkov
Remove most of remains of downstream usbpd code. Mainline kernel uses different approach for managing Type-C / USB-PD, so this remains unused.
Signed-off-by Dmitry Baryshkov <[email protected]>
Regards,
Bjorn
Quoted 427 lines
---
Changes since v1:
- Also drop USBPD callbacks as per [1].[1] https://patchwork.freedesktop.org/patch/536942/?series=117732&rev=1
--- drivers/gpu/drm/msm/Makefile | 1 - drivers/gpu/drm/msm/dp/dp_ctrl.h | 1 - drivers/gpu/drm/msm/dp/dp_debug.c | 6 +-- drivers/gpu/drm/msm/dp/dp_debug.h | 5 +- drivers/gpu/drm/msm/dp/dp_display.c | 34 +------------ drivers/gpu/drm/msm/dp/dp_hpd.c | 67 ------------------------- drivers/gpu/drm/msm/dp/dp_hpd.h | 78 ----------------------------- drivers/gpu/drm/msm/dp/dp_panel.h | 1 - drivers/gpu/drm/msm/dp/dp_power.c | 2 +- drivers/gpu/drm/msm/dp/dp_power.h | 3 +- 10 files changed, 8 insertions(+), 190 deletions(-) delete mode 100644 drivers/gpu/drm/msm/dp/dp_hpd.c delete mode 100644 drivers/gpu/drm/msm/dp/dp_hpd.hdrivers/gpu/drm/msm/Makefile +0
-1@@ -122,7 +122,6 @@ msm-$(CONFIG_DRM_MSM_DP)+= dp/dp_aux.o \ dp/dp_ctrl.o \ dp/dp_display.o \ dp/dp_drm.o \ - dp/dp_hpd.o \ dp/dp_link.o \ dp/dp_panel.o \ dp/dp_parser.o \drivers/gpu/drm/msm/dp/dp_ctrl.h +0
-1@@ -14,7 +14,6 @@#include "dp_catalog.h" struct dp_ctrl { -bool orientation;atomic_t aborted;bool wide_bus_en; };drivers/gpu/drm/msm/dp/dp_debug.c +2
-4@@ -21,7 +21,6 @@struct dp_debug_private {struct dentry *root; -struct dp_usbpd *usbpd;struct dp_link *link;struct dp_panel *panel;struct drm_connector *connector;@@ -232,14 +231,14 @@ static void dp_debug_init(struct dp_debug *dp_debug, struct drm_minor *minor) }struct dp_debug *dp_debug_get (struct device *dev,struct dp_panel *panel, -struct dp_usbpd *usbpd,struct dp_link *link, +struct dp_link *link,struct drm_connector *connector,struct drm_minor *minor) {struct dp_debug_private *debug;struct dp_debug *dp_debug;int rc; -if (!dev || !panel || !usbpd || !link) { +if (!dev || !panel || !link) {DRM_ERROR ("invalid input\n" ); rc = -EINVAL ; goto error;@@ -252,7 +251,6 @@ struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel, } debug->dp_debug.debug_en = false; - debug->usbpd = usbpd; debug->link = link; debug->panel = panel; debug->dev = dev;drivers/gpu/drm/msm/dp/dp_debug.h +2
-3@@ -32,7 +32,6 @@ struct dp_debug {* * @dev: device instance of the caller * @panel: instance of panel module -* @usbpd: instance of usbpd module * @link: instance of link module * @connector: double pointer to display connector * @minor: pointer to drm minor number after device registration @@ -42,7 +41,7 @@ struct dp_debug {* for debugfs input to be communicated with existing modules */ struct dp_debug *dp_debug_get (struct device *dev,struct dp_panel *panel, -struct dp_usbpd *usbpd,struct dp_link *link, +struct dp_link *link,struct drm_connector *connector,struct drm_minor *minor);@@ -59,7 +58,7 @@ void dp_debug_put(struct dp_debug *dp_debug);static inline struct dp_debug *dp_debug_get (struct device *dev,struct dp_panel *panel, -struct dp_usbpd *usbpd,struct dp_link *link, +struct dp_link *link,struct drm_connector *connector,struct drm_minor *minor) {return ERR_PTR (-EINVAL );drivers/gpu/drm/msm/dp/dp_display.c +2
-32@@ -14,7 +14,6 @@#include "msm_drv.h" #include "msm_kms.h" -#include "dp_hpd.h" #include "dp_parser.h" #include "dp_power.h" #include "dp_catalog.h" @@ -88,7 +87,6 @@ struct dp_display_private {struct platform_device *pdev;struct dentry *root; -struct dp_usbpd *usbpd;struct dp_parser *parser;struct dp_power *power;struct dp_catalog *catalog;@@ -98,7 +96,6 @@ struct dp_display_private {struct dp_ctrl *ctrl;struct dp_debug *debug; -struct dp_usbpd_cb usbpd_cb;struct dp_display_mode dp_mode;struct msm_dp dp_display;@@ -462,7 +459,7 @@ static void dp_display_host_init(struct dp_display_private *dp) dp->dp_display.connector_type, dp->core_initialized, dp->phy_initialized); -dp_power_init (dp->power, false); +dp_power_init (dp->power);dp_ctrl_reset_irq_ctrl (dp->ctrl, true);dp_aux_init (dp->aux); dp->core_initialized = true;@@ -489,11 +486,6 @@ static int dp_display_usbpd_configure_cb(struct device *dev)return dp_display_process_hpd_high (dp); } -static int dp_display_usbpd_disconnect_cb (struct device *dev) -{ -return 0 ; -} -static int dp_display_notify_disconnect (struct device *dev) {struct dp_display_private *dp =dev_get_dp_display_private (dev);@@ -578,13 +570,9 @@ static int dp_display_usbpd_attention_cb(struct device *dev)static int dp_hpd_plug_handle (struct dp_display_private *dp,u32 data) { -struct dp_usbpd *hpd = dp->usbpd;u32 state;int ret; -if (!hpd) -return 0 ; -mutex_lock (&dp->event_mutex); state = dp->hpd_state;@@ -645,12 +633,8 @@ static void dp_display_handle_plugged_change(struct msm_dp *dp_display,static int dp_hpd_unplug_handle (struct dp_display_private *dp,u32 data) { -struct dp_usbpd *hpd = dp->usbpd;u32 state; -if (!hpd) -return 0 ; -mutex_lock (&dp->event_mutex); state = dp->hpd_state;@@ -763,24 +747,10 @@ static int dp_init_sub_modules(struct dp_display_private *dp) {int rc =0 ;struct device *dev = &dp->pdev->dev; -struct dp_usbpd_cb *cb = &dp->usbpd_cb;struct dp_panel_in panel_in = { .dev = dev, }; -/* Callback APIs used for cable status change event */ - cb->configure = dp_display_usbpd_configure_cb; - cb->disconnect = dp_display_usbpd_disconnect_cb; - cb->attention = dp_display_usbpd_attention_cb; - - dp->usbpd =dp_hpd_get (dev, cb); -if (IS_ERR (dp->usbpd)) { - rc =PTR_ERR (dp->usbpd); -DRM_ERROR ("failed to initialize hpd, rc = %d\n" , rc); - dp->usbpd =NULL ; - goto error; - } - dp->parser =dp_parser_get (dp->pdev);if (IS_ERR (dp->parser)) { rc =PTR_ERR (dp->parser);@@ -1540,7 +1510,7 @@ void msm_dp_debugfs_init(struct msm_dp *dp_display, struct drm_minor *minor) dp = container_of(dp_display, struct dp_display_private, dp_display); dev = &dp->pdev->dev; - dp->debug =dp_debug_get (dev, dp->panel, dp->usbpd, + dp->debug =dp_debug_get (dev, dp->panel, dp->link, dp->dp_display.connector, minor);if (IS_ERR (dp->debug)) {drivers/gpu/drm/msm/dp/dp_hpd.c deleted +0
-67@@ -1,67 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* -* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. -*/ - -#define pr_fmt (fmt) "[drm-dp] %s: " fmt, __func__ - -#include <linux/slab.h> -#include <linux/device.h> - -#include "dp_hpd.h" - -/* DP specific VDM commands */ -#define DP_USBPD_VDM_STATUS 0x10 -#define DP_USBPD_VDM_CONFIGURE 0x11 - -/* USBPD-TypeC specific Macros */ -#define VDM_VERSION 0x0 -#define USB_C_DP_SID 0xFF01 - -struct dp_hpd_private { -struct device *dev; -struct dp_usbpd_cb *dp_cb; -struct dp_usbpd dp_usbpd; -}; - -int dp_hpd_connect (struct dp_usbpd *dp_usbpd,bool hpd) -{ -int rc =0 ; -struct dp_hpd_private *hpd_priv; - - hpd_priv = container_of(dp_usbpd, struct dp_hpd_private, - dp_usbpd); - -if (!hpd_priv->dp_cb || !hpd_priv->dp_cb->configure - || !hpd_priv->dp_cb->disconnect) { -pr_err ("hpd dp_cb not initialized\n" ); -return -EINVAL ; - } -if (hpd) - hpd_priv->dp_cb->configure (hpd_priv->dev); -else - hpd_priv->dp_cb->disconnect (hpd_priv->dev); - -return rc; -} - -struct dp_usbpd *dp_hpd_get (struct device *dev,struct dp_usbpd_cb *cb) -{ -struct dp_hpd_private *dp_hpd; - -if (!cb) { -pr_err ("invalid cb data\n" ); -return ERR_PTR (-EINVAL ); - } - - dp_hpd =devm_kzalloc (dev,sizeof (*dp_hpd),GFP_KERNEL ); -if (!dp_hpd) -return ERR_PTR (-ENOMEM ); - - dp_hpd->dev = dev; - dp_hpd->dp_cb = cb; - - dp_hpd->dp_usbpd.connect = dp_hpd_connect; - -return &dp_hpd->dp_usbpd; -}drivers/gpu/drm/msm/dp/dp_hpd.h deleted +0
-78@@ -1,78 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. -*/ - -#ifndef _DP_HPD_H_ -#define _DP_HPD_H_ - -//#include <linux/usb/usbpd.h> - -#include <linux/types.h> -#include <linux/device.h> - -enum plug_orientation { -ORIENTATION_NONE , -ORIENTATION_CC1 , -ORIENTATION_CC2 , -}; - -/** -* struct dp_usbpd - DisplayPort status -* -* @orientation: plug orientation configuration -* @low_pow_st: low power state -* @adaptor_dp_en: adaptor functionality enabled -* @multi_func: multi-function preferred -* @usb_config_req: request to switch to usb -* @exit_dp_mode: request exit from displayport mode -* @hpd_irq: Change in the status since last message -* @alt_mode_cfg_done: bool to specify alt mode status -* @debug_en: bool to specify debug mode -* @connect: simulate disconnect or connect for debug mode -*/ -struct dp_usbpd { -enum plug_orientation orientation; -bool low_pow_st; -bool adaptor_dp_en; -bool multi_func; -bool usb_config_req; -bool exit_dp_mode; -bool hpd_irq; -bool alt_mode_cfg_done; -bool debug_en; - -int (*connect)(struct dp_usbpd *dp_usbpd,bool hpd); -}; - -/** -* struct dp_usbpd_cb - callback functions provided by the client -* -* @configure: called by usbpd module when PD communication has -* been completed and the usb peripheral has been configured on -* dp mode. -* @disconnect: notify the cable disconnect issued by usb. -* @attention: notify any attention message issued by usb. -*/ -struct dp_usbpd_cb { -int (*configure)(struct device *dev); -int (*disconnect)(struct device *dev); -int (*attention)(struct device *dev); -}; - -/** -* dp_hpd_get() - setup hpd module -* -* @dev: device instance of the caller -* @cb: struct containing callback function pointers. -* -* This function allows the client to initialize the usbpd -* module. The module will communicate with HPD module. -*/ -struct dp_usbpd *dp_hpd_get (struct device *dev,struct dp_usbpd_cb *cb); - -int dp_hpd_register (struct dp_usbpd *dp_usbpd); -void dp_hpd_unregister (struct dp_usbpd *dp_usbpd); -int dp_hpd_connect (struct dp_usbpd *dp_usbpd,bool hpd); - -#endif /* _DP_HPD_H_ */ drivers/gpu/drm/msm/dp/dp_panel.h +0
-1@@ -10,7 +10,6 @@#include "dp_aux.h" #include "dp_link.h" -#include "dp_hpd.h" struct edid ;drivers/gpu/drm/msm/dp/dp_power.c +1
-1@@ -195,7 +195,7 @@ void dp_power_client_deinit(struct dp_power *dp_power)pm_runtime_disable (&power->pdev->dev); } -int dp_power_init (struct dp_power *dp_power,bool flip) +int dp_power_init (struct dp_power *dp_power) {int rc =0 ;struct dp_power_private *power =NULL ;drivers/gpu/drm/msm/dp/dp_power.h +1
-2@@ -26,13 +26,12 @@ struct dp_power {* dp_power_init() - enable power supplies for display controller * * @power: instance of power module -* @flip: bool for flipping gpio direction * return: 0 if success or error if failure. * * This API will turn on the regulators and configures gpio's * aux/hpd. */ -int dp_power_init (struct dp_power *power,bool flip); +int dp_power_init (struct dp_power *power);/** * dp_power_deinit() - turn off regulators and gpios. Signature · 1 line
2.39.2
Dmitry Baryshkov
AppliedQuoted 4 lines · Dmitry Baryshkov
Remove most of remains of downstream usbpd code. Mainline kernel uses different approach for managing Type-C / USB-PD, so this remains unused.
Applied, thanks!
[1/1] drm/msm/dp: remove most of usbpd-related remains
https://gitlab.freedesktop.org/lumag/msm/-/commit/1c5f6051ffdf
Best regards,
Signature · 1 line
Dmitry Baryshkov <[email protected]>