Commit 3eafcddf authored by Imre Deak's avatar Imre Deak
Browse files

drm/i915/tc: Move TC port fields to a new intel_tc_port struct



Move the TC port specific fields from intel_digital_port to a new
intel_tc_port struct. Pass an intel_tc_port pointer to all static
functions in intel_tc.c keeping dig_port accessible for these via a
pointer stored in the new struct.

The next patch will allocate the intel_tc_port dynamically, allowing
moving the struct definition to intel_tc.c.

Reviewed-by: default avatarMika Kahola <mika.kahola@intel.com>
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230323142035.1432621-6-imre.deak@intel.com
parent 39feb7b1
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -164,13 +164,6 @@ enum tc_port {
	I915_MAX_TC_PORTS
};

enum tc_port_mode {
	TC_PORT_DISCONNECTED,
	TC_PORT_TBT_ALT,
	TC_PORT_DP_ALT,
	TC_PORT_LEGACY,
};

enum aux_ch {
	AUX_CH_NONE = -1,

+2 −11
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@
#include "intel_display_power.h"
#include "intel_dpll_mgr.h"
#include "intel_wm_types.h"
#include "intel_tc.h"

struct drm_printer;
struct __intel_global_objs_state;
@@ -1782,17 +1783,7 @@ struct intel_digital_port {
	intel_wakeref_t ddi_io_wakeref;
	intel_wakeref_t aux_wakeref;

	struct mutex tc_lock;	/* protects the TypeC port mode */
	intel_wakeref_t tc_lock_wakeref;
	enum intel_display_power_domain tc_lock_power_domain;
	struct delayed_work tc_disconnect_phy_work;
	int tc_link_refcount;
	bool tc_legacy_port:1;
	char tc_port_name[8];
	enum tc_port_mode tc_mode;
	enum tc_port_mode tc_init_mode;
	enum phy_fia tc_phy_fia;
	u8 tc_phy_fia_idx;
	struct intel_tc_port tc;

	/* protects num_hdcp_streams reference count, hdcp_port_data and hdcp_auth_status */
	struct mutex hdcp_mutex;
+307 −271

File changed.

Preview size limit exceeded, changes collapsed.

+26 −0
Original line number Diff line number Diff line
@@ -9,10 +9,36 @@
#include <linux/mutex.h>
#include <linux/types.h>

#include "intel_display.h"
#include "intel_display_power.h"
#include "intel_wakeref.h"

struct intel_crtc_state;
struct intel_digital_port;
struct intel_encoder;

enum tc_port_mode {
	TC_PORT_DISCONNECTED,
	TC_PORT_TBT_ALT,
	TC_PORT_DP_ALT,
	TC_PORT_LEGACY,
};

struct intel_tc_port {
	struct intel_digital_port *dig_port;
	struct mutex lock;	/* protects the TypeC port mode */
	intel_wakeref_t lock_wakeref;
	enum intel_display_power_domain lock_power_domain;
	struct delayed_work disconnect_phy_work;
	int link_refcount;
	bool legacy_port:1;
	char port_name[8];
	enum tc_port_mode mode;
	enum tc_port_mode init_mode;
	enum phy_fia phy_fia;
	u8 phy_fia_idx;
};

bool intel_tc_port_in_tbt_alt_mode(struct intel_digital_port *dig_port);
bool intel_tc_port_in_dp_alt_mode(struct intel_digital_port *dig_port);
bool intel_tc_port_in_legacy_mode(struct intel_digital_port *dig_port);