aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel <pavel@ucw.cz>2018-10-28 13:54:53 +0100
committerPavel <pavel@ucw.cz>2019-01-07 11:22:52 +0100
commitedf3cf5c25848302b3aa6a482f868c6f292c3441 (patch)
treeac487273a37159d1442ffdfe6376eee3db4a737a
parentd4e3fa17e2e5c9a6a37f7cc01a3e3d8842f6dc41 (diff)
downloadlinux-k-edf3cf5c25848302b3aa6a482f868c6f292c3441.tar.gz
d4: hack: attempt to force host mode. Not too working.
-rw-r--r--drivers/phy/motorola/phy-cpcap-usb.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/phy/motorola/phy-cpcap-usb.c b/drivers/phy/motorola/phy-cpcap-usb.c
index 6601ad0dfb3ad2..06969038e0c038 100644
--- a/drivers/phy/motorola/phy-cpcap-usb.c
+++ b/drivers/phy/motorola/phy-cpcap-usb.c
@@ -16,6 +16,8 @@
* GNU General Public License for more details.
*/
+#define DEBUG
+
#include <linux/atomic.h>
#include <linux/clk.h>
#include <linux/delay.h>
@@ -207,6 +209,8 @@ static int cpcap_phy_get_ints_state(struct cpcap_phy_ddata *ddata,
static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata);
static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata);
+static bool force_host;
+
static void cpcap_usb_detect(struct work_struct *work)
{
struct cpcap_phy_ddata *ddata;
@@ -216,11 +220,13 @@ static void cpcap_usb_detect(struct work_struct *work)
ddata = container_of(work, struct cpcap_phy_ddata, detect_work.work);
+ schedule_delayed_work(&ddata->detect_work, msecs_to_jiffies(30000));
+
error = cpcap_phy_get_ints_state(ddata, &s);
if (error)
return;
- if (s.id_ground) {
+ if (force_host || s.id_ground) {
dev_dbg(ddata->dev, "id ground, USB host mode\n");
error = cpcap_usb_set_usb_mode(ddata);
if (error)
@@ -248,7 +254,7 @@ static void cpcap_usb_detect(struct work_struct *work)
if (vbus) {
/* Are we connected to a docking station with vbus? */
- if (s.id_ground) {
+ if (force_host || s.id_ground) {
dev_dbg(ddata->dev, "connected to a dock\n");
/* No VBUS needed with docks */
@@ -674,3 +680,6 @@ MODULE_ALIAS("platform:cpcap_usb");
MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
MODULE_DESCRIPTION("CPCAP usb phy driver");
MODULE_LICENSE("GPL v2");
+
+module_param(force_host, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(force_host, "Force USB host mode");