summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-02-10 08:53:33 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-02-10 08:53:33 +0000
commit1f592081f319c791bdfd9f75399b9402b1efbc90 (patch)
treee2dffe1c9a5b167029b485566077551387168fdb
parent27127cf8c8e6dacdcff44a08ae39da5ade2de46c (diff)
parent349277c3bc2825086610042f10ad2edd9368e3f0 (diff)
downloadgs-android-gs-raviole-5.10-t-qpr2-beta-3.2.tar.gz
Snap for 9513679 from 349277c3bc2825086610042f10ad2edd9368e3f0 to android13-gs-pixel-5.10-releaseandroid-t-qpr2-beta-3.2_r0.4android-13.0.0_r0.63android-gs-raviole-5.10-t-qpr2-beta-3.2
Change-Id: Ifa5957e82074ef3c86ac47db7bef2452136de01b
-rw-r--r--Makefile.ext_modules.slider2
-rw-r--r--drivers/usb/dwc3/dwc3-exynos-otg.c37
-rw-r--r--drivers/usb/dwc3/exynos-otg.h2
-rw-r--r--drivers/usb/typec/tcpm/google/tcpci_max77759.c16
-rw-r--r--drivers/usb/typec/tcpm/google/tcpci_max77759.h3
5 files changed, 60 insertions, 0 deletions
diff --git a/Makefile.ext_modules.slider b/Makefile.ext_modules.slider
index 44701addae00..aac2b74e38c2 100644
--- a/Makefile.ext_modules.slider
+++ b/Makefile.ext_modules.slider
@@ -49,4 +49,6 @@ power/reset: | bms
touch/sec: | touch/common
+touch/fts/ftm5: | touch/common
+
include $(KERNEL_SRC)/Makefile.ext_modules.include
diff --git a/drivers/usb/dwc3/dwc3-exynos-otg.c b/drivers/usb/dwc3/dwc3-exynos-otg.c
index 2aa0e6e4be88..1f11950fd44e 100644
--- a/drivers/usb/dwc3/dwc3-exynos-otg.c
+++ b/drivers/usb/dwc3/dwc3-exynos-otg.c
@@ -33,6 +33,8 @@
#define BUS_ACTIVITY_CHECK (0x3F << 16)
#define READ_TRANS_OFFSET 10
+#define SSPHY_RESTART_EL "SSPHY_RESTART"
+
/* -------------------------------------------------------------------------- */
static int dwc3_otg_reboot_notify(struct notifier_block *nb, unsigned long event, void *buf);
static struct notifier_block dwc3_otg_reboot_notifier = {
@@ -260,6 +262,19 @@ static void usb3_phy_control(struct dwc3_otg *dotg,
}
}
+static void dwc3_usb3_phy_restart(struct dwc3_otg *dotg)
+{
+ struct dwc3 *dwc = dotg->dwc;
+
+ mutex_lock(&dotg->lock);
+
+ usb3_phy_control(dotg, 0, 0);
+ exynos_usbdrd_phy_tune(dwc->usb3_generic_phy, dotg->otg.state);
+ usb3_phy_control(dotg, 0, 1);
+
+ mutex_unlock(&dotg->lock);
+}
+
int dwc3_otg_phy_enable(struct otg_fsm *fsm, int owner, bool on)
{
struct usb_otg *otg = fsm->otg;
@@ -990,6 +1005,17 @@ int dwc3_otg_usb_recovery_reconn(struct dwc3_exynos *exynos)
return 0;
}
+static int dwc3_otg_ssphy_restart_cb(struct gvotable_election *el, const char *reason, void *value)
+{
+ struct dwc3_otg *dotg = gvotable_get_data(el);
+ bool restart_phy = !!(long)value;
+
+ if (restart_phy)
+ dwc3_usb3_phy_restart(dotg);
+
+ return 0;
+}
+
static int dwc3_otg_pm_notifier(struct notifier_block *nb,
unsigned long action, void *nb_data)
{
@@ -1083,6 +1109,16 @@ int dwc3_exynos_otg_init(struct dwc3 *dwc, struct dwc3_exynos *exynos)
if (ret)
dev_err(dwc->dev, "failed register reboot notifier\n");
+ dotg->ssphy_restart_votable = gvotable_create_bool_election(SSPHY_RESTART_EL,
+ dwc3_otg_ssphy_restart_cb,
+ dotg);
+ if (IS_ERR_OR_NULL(dotg->ssphy_restart_votable)) {
+ ret = PTR_ERR(dotg->ssphy_restart_votable);
+ dev_err(dwc->dev, "failed to create ssphy_restart votable (%d)\n", ret);
+ return ret;
+ }
+ gvotable_set_vote2str(dotg->ssphy_restart_votable, gvotable_v2s_int);
+
dev_dbg(dwc->dev, "otg_init done\n");
return 0;
@@ -1095,6 +1131,7 @@ void dwc3_exynos_otg_exit(struct dwc3 *dwc, struct dwc3_exynos *exynos)
if (!dotg->ext_otg_ops)
return;
+ gvotable_destroy_election(dotg->ssphy_restart_votable);
unregister_pm_notifier(&dotg->pm_nb);
dwc3_ext_otg_exit(dotg);
diff --git a/drivers/usb/dwc3/exynos-otg.h b/drivers/usb/dwc3/exynos-otg.h
index cfc8b0ce4f73..243531873eeb 100644
--- a/drivers/usb/dwc3/exynos-otg.h
+++ b/drivers/usb/dwc3/exynos-otg.h
@@ -12,6 +12,7 @@
#include <linux/pm_wakeup.h>
#include <linux/usb/otg-fsm.h>
#include <linux/pm_qos.h>
+#include <misc/gvotable.h>
#include <soc/google/exynos_pm_qos.h>
#include "dwc3-exynos.h"
@@ -68,6 +69,7 @@ struct dwc3_otg {
u16 combo_phy_control;
u16 usb2_phy_control;
+ struct gvotable_election *ssphy_restart_votable;
};
static inline int dwc3_ext_otg_setup(struct dwc3_otg *dotg)
diff --git a/drivers/usb/typec/tcpm/google/tcpci_max77759.c b/drivers/usb/typec/tcpm/google/tcpci_max77759.c
index a40aa0002f94..9f3d6431fdaa 100644
--- a/drivers/usb/typec/tcpm/google/tcpci_max77759.c
+++ b/drivers/usb/typec/tcpm/google/tcpci_max77759.c
@@ -141,6 +141,9 @@ static unsigned int sink_discovery_delay_ms;
/* Callback for data_active changes */
void (*data_active_callback)(void *data_active_payload);
void *data_active_payload;
+/* Callback for orientation changes */
+void (*orientation_callback)(void *orientation_payload);
+void *orientation_payload;
struct tcpci {
struct device *dev;
@@ -492,6 +495,13 @@ void register_data_active_callback(void (*callback)(void *data_active_payload),
}
EXPORT_SYMBOL_GPL(register_data_active_callback);
+void register_orientation_callback(void (*callback)(void *orientation_payload), void *data)
+{
+ orientation_callback = callback;
+ orientation_payload = data;
+}
+EXPORT_SYMBOL_GPL(register_orientation_callback);
+
#ifdef CONFIG_GPIOLIB
static int ext_bst_en_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
{
@@ -1737,6 +1747,12 @@ static int max77759_usb_set_orientation(struct typec_switch *sw, enum typec_orie
"Failed" : "Succeeded", polarity);
dev_info(chip->dev, "TCPM_DEBUG %s setting polarity USB %d", ret < 0 ? "Failed" :
"Succeeded", polarity);
+
+ chip->polarity = polarity;
+
+ if (orientation_callback)
+ (*orientation_callback)(orientation_payload);
+
return ret;
}
diff --git a/drivers/usb/typec/tcpm/google/tcpci_max77759.h b/drivers/usb/typec/tcpm/google/tcpci_max77759.h
index 8fc48bdadc7b..dbfc4217d8bf 100644
--- a/drivers/usb/typec/tcpm/google/tcpci_max77759.h
+++ b/drivers/usb/typec/tcpm/google/tcpci_max77759.h
@@ -40,6 +40,8 @@ struct max77759_plat {
enum typec_data_role active_data_role;
/* Data role from the TCPM stack */
enum typec_data_role data_role;
+ /* CC polarity from the TCPM stack */
+ enum typec_cc_polarity polarity;
/* protects tcpc_enable_data_path */
struct mutex data_path_lock;
/* Vote for data from BC1.2 */
@@ -204,4 +206,5 @@ enum tcpm_psy_online_states {
void enable_data_path_locked(struct max77759_plat *chip);
void data_alt_path_active(struct max77759_plat *chip, bool active);
void register_data_active_callback(void (*callback)(void *data_active_payload), void *data);
+void register_orientation_callback(void (*callback)(void *orientation_payload), void *data);
#endif /* __TCPCI_MAX77759_H */