Commit dbb3fc0f authored by Abhishek Pandit-Subedi's avatar Abhishek Pandit-Subedi Committed by Greg Kroah-Hartman
Browse files

platform/chrome: cros_ec_typec: Displayport support



Add support for entering and exiting displayport alt-mode on systems
using AP driven alt-mode.

Signed-off-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
Link: https://lore.kernel.org/r/20241213153543.v5.6.I142fc0c09df58689b98f0cebf1c5e48b9d4fa800@changeid


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5b2f3305
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -5436,9 +5436,12 @@ F: include/linux/platform_data/cros_usbpd_notify.h
CHROMEOS EC USB TYPE-C DRIVER
M:	Prashant Malani <pmalani@chromium.org>
M:	Benson Leung <bleung@chromium.org>
M:	Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
L:	chrome-platform@lists.linux.dev
S:	Maintained
F:	drivers/platform/chrome/cros_ec_typec.*
F:	drivers/platform/chrome/cros_typec_altmode.*
F:	drivers/platform/chrome/cros_typec_switch.c
F:	drivers/platform/chrome/cros_typec_vdm.*
+6 −0
Original line number Diff line number Diff line
@@ -237,12 +237,18 @@ config CROS_EC_SYSFS
	  To compile this driver as a module, choose M here: the
	  module will be called cros_ec_sysfs.

config CROS_EC_TYPEC_ALTMODES
	bool
	help
	  Selectable symbol to enable altmodes.

config CROS_EC_TYPEC
	tristate "ChromeOS EC Type-C Connector Control"
	depends on MFD_CROS_EC_DEV && TYPEC
	depends on CROS_USBPD_NOTIFY
	depends on USB_ROLE_SWITCH
	default MFD_CROS_EC_DEV
	select CROS_EC_TYPEC_ALTMODES if TYPEC_DP_ALTMODE
	help
	  If you say Y here, you get support for accessing Type C connector
	  information from the Chrome OS EC.
+4 −0
Original line number Diff line number Diff line
@@ -19,7 +19,11 @@ obj-$(CONFIG_CROS_EC_SPI) += cros_ec_spi.o
obj-$(CONFIG_CROS_EC_UART)		+= cros_ec_uart.o
cros_ec_lpcs-objs			:= cros_ec_lpc.o cros_ec_lpc_mec.o
cros-ec-typec-objs			:= cros_ec_typec.o cros_typec_vdm.o
ifneq ($(CONFIG_CROS_EC_TYPEC_ALTMODES),)
	cros-ec-typec-objs		+= cros_typec_altmode.o
endif
obj-$(CONFIG_CROS_EC_TYPEC)		+= cros-ec-typec.o

obj-$(CONFIG_CROS_EC_LPC)		+= cros_ec_lpcs.o
obj-$(CONFIG_CROS_EC_PROTO)		+= cros_ec_proto.o cros_ec_trace.o
obj-$(CONFIG_CROS_KBD_LED_BACKLIGHT)	+= cros_kbd_led_backlight.o
+10 −3
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#include "cros_ec_typec.h"
#include "cros_typec_vdm.h"
#include "cros_typec_altmode.h"

#define DRV_NAME "cros-ec-typec"

@@ -290,15 +291,15 @@ static int cros_typec_register_port_altmodes(struct cros_typec_data *typec,
	struct typec_altmode *amode;

	/* All PD capable CrOS devices are assumed to support DP altmode. */
	memset(&desc, 0, sizeof(desc));
	desc.svid = USB_TYPEC_DP_SID;
	desc.mode = USB_TYPEC_DP_MODE;
	desc.vdo = DP_PORT_VDO;
	amode = typec_port_register_altmode(port->port, &desc);
	amode = cros_typec_register_displayport(port, &desc,
						typec->ap_driven_altmode);
	if (IS_ERR(amode))
		return PTR_ERR(amode);
	port->port_altmode[CROS_EC_ALTMODE_DP] = amode;
	typec_altmode_set_drvdata(amode, port);
	amode->ops = &port_amode_ops;

	/*
	 * Register TBT compatibility alt mode. The EC will not enter the mode
@@ -576,6 +577,10 @@ static int cros_typec_enable_dp(struct cros_typec_data *typec,
	if (!ret)
		ret = typec_mux_set(port->mux, &port->state);

	if (!ret)
		ret = cros_typec_displayport_status_update(port->state.alt,
							   port->state.data);

	return ret;
}

@@ -1253,6 +1258,8 @@ static int cros_typec_probe(struct platform_device *pdev)

	typec->typec_cmd_supported = cros_ec_check_features(ec_dev, EC_FEATURE_TYPEC_CMD);
	typec->needs_mux_ack = cros_ec_check_features(ec_dev, EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK);
	typec->ap_driven_altmode = cros_ec_check_features(
		ec_dev, EC_FEATURE_TYPEC_REQUIRE_AP_MODE_ENTRY);

	ret = cros_ec_cmd(typec->ec, 0, EC_CMD_USB_PD_PORTS, NULL, 0,
			  &resp, sizeof(resp));
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ struct cros_typec_data {
	struct work_struct port_work;
	bool typec_cmd_supported;
	bool needs_mux_ack;
	bool ap_driven_altmode;
};

/* Per port data. */
Loading