mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 16:46:15 -04:00
Merge "usb: misc: nb7vpq904m: support 4 lanes display"
This commit is contained in:
commit
b0c199468a
4 changed files with 73 additions and 2 deletions
|
|
@ -40,6 +40,7 @@
|
|||
#include <linux/reset.h>
|
||||
#include <linux/usb/dwc3-msm.h>
|
||||
#include <linux/usb/role.h>
|
||||
#include <linux/usb/redriver.h>
|
||||
|
||||
#include "core.h"
|
||||
#include "gadget.h"
|
||||
|
|
@ -3985,6 +3986,7 @@ int dwc3_msm_release_ss_lane(struct device *dev)
|
|||
{
|
||||
struct dwc3_msm *mdwc = dev_get_drvdata(dev);
|
||||
struct dwc3 *dwc = NULL;
|
||||
struct device_node *ssusb_redriver_node;
|
||||
|
||||
if (mdwc == NULL) {
|
||||
dev_err(dev, "dwc3-msm is not initialized yet.\n");
|
||||
|
|
@ -4002,6 +4004,10 @@ int dwc3_msm_release_ss_lane(struct device *dev)
|
|||
flush_work(&mdwc->resume_work);
|
||||
drain_workqueue(mdwc->sm_usb_wq);
|
||||
|
||||
ssusb_redriver_node =
|
||||
of_parse_phandle(mdwc->dev->of_node, "ssusb_redriver", 0);
|
||||
redriver_release_usb_lanes(ssusb_redriver_node);
|
||||
|
||||
mdwc->ss_release_called = true;
|
||||
if (mdwc->id_state == DWC3_ID_GROUND) {
|
||||
/* stop USB host mode */
|
||||
|
|
|
|||
|
|
@ -266,8 +266,12 @@ config USB_CHAOSKEY
|
|||
To compile this driver as a module, choose M here: the
|
||||
module will be called chaoskey.
|
||||
|
||||
config USB_REDRIVER
|
||||
bool
|
||||
|
||||
config USB_REDRIVER_NB7VPQ904M
|
||||
tristate "USB 3.1 Gen1/Gen2 10Gbps re-driver driver for NB7VPQ904M"
|
||||
depends on USB_PHY
|
||||
select USB_REDRIVER
|
||||
help
|
||||
Say Y here if you want to support USB super speed re-driver NB7VPQ904M.
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include <linux/usb/ucsi_glink.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/usb/redriver.h>
|
||||
|
||||
/* priority: INT_MAX >= x >= 0 */
|
||||
#define NOTIFIER_PRIORITY 1
|
||||
|
|
@ -503,10 +504,21 @@ static int ssusb_redriver_ucsi_notifier(struct notifier_block *nb,
|
|||
struct ucsi_glink_constat_info *info = data;
|
||||
enum operation_mode op_mode;
|
||||
|
||||
if (info->partner_usb && info->partner_alternate_mode)
|
||||
/*
|
||||
* when connect a DP only cable,
|
||||
* ucsi set usb flag first, then set usb and alternate mode
|
||||
* after dp start link training.
|
||||
* it should only set alternate_mode flag ???
|
||||
*/
|
||||
if (info->partner_usb && info->partner_alternate_mode) {
|
||||
if (redriver->op_mode == OP_MODE_DP)
|
||||
return NOTIFY_OK;
|
||||
op_mode = OP_MODE_USB_AND_DP;
|
||||
else if (info->partner_usb)
|
||||
} else if (info->partner_usb) {
|
||||
if (redriver->op_mode == OP_MODE_DP)
|
||||
return NOTIFY_OK;
|
||||
op_mode = OP_MODE_USB;
|
||||
}
|
||||
else if (info->partner_alternate_mode)
|
||||
op_mode = OP_MODE_DP;
|
||||
else
|
||||
|
|
@ -534,6 +546,33 @@ static int ssusb_redriver_ucsi_notifier(struct notifier_block *nb,
|
|||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
int redriver_release_usb_lanes(struct device_node *node)
|
||||
{
|
||||
struct ssusb_redriver *redriver;
|
||||
struct i2c_client *client;
|
||||
|
||||
if (!node)
|
||||
return -EINVAL;
|
||||
|
||||
client = of_find_i2c_device_by_node(node);
|
||||
if (!client)
|
||||
return -EINVAL;
|
||||
|
||||
redriver = i2c_get_clientdata(client);
|
||||
|
||||
if (redriver->op_mode == OP_MODE_DP)
|
||||
return 0;
|
||||
|
||||
dev_dbg(redriver->dev, "display notify 4 lane mode\n");
|
||||
redriver->op_mode = OP_MODE_DP;
|
||||
|
||||
ssusb_redriver_channel_update(redriver);
|
||||
ssusb_redriver_gen_dev_set(redriver);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(redriver_release_usb_lanes);
|
||||
|
||||
static void ssusb_redriver_orientation_gpio_init(
|
||||
struct ssusb_redriver *redriver)
|
||||
{
|
||||
|
|
|
|||
22
include/linux/usb/redriver.h
Normal file
22
include/linux/usb/redriver.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_USB_REDRIVER_H
|
||||
#define __LINUX_USB_REDRIVER_H
|
||||
|
||||
#ifdef CONFIG_USB_REDRIVER
|
||||
|
||||
int redriver_release_usb_lanes(struct device_node *node);
|
||||
|
||||
#else
|
||||
|
||||
static inline int redriver_release_usb_lanes(struct device_node *node)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /*__LINUX_USB_REDRIVER_H */
|
||||
Loading…
Reference in a new issue