#include <linux/delay.h>
#include <linux/pm_runtime.h>
#include <linux/wakelock.h>
+#include <linux/jack.h>
#include <asm/intel_scu_ipc.h>
#include <asm/intel-mid.h>
#include "../core/usb.h"
power_supply_charger_event(psc_cap);
}
+static bool connected(enum usb_otg_state state)
+{
+ if (state == OTG_STATE_A_HOST || state == OTG_STATE_A_PERIPHERAL ||
+ state == OTG_STATE_B_HOST || state == OTG_STATE_B_PERIPHERAL)
+ return true;
+ return false;
+}
+
static void penwell_otg_work(struct work_struct *work)
{
struct penwell_otg *pnw = container_of(work,
int retval;
struct pci_dev *pdev;
unsigned long flags;
+ enum usb_otg_state old_state;
+ enum usb_otg_state new_state;
+ old_state = iotg->otg.state;
dev_dbg(pnw->dev,
- "old state = %s\n", state_string(iotg->otg.state));
+ "old state = %s\n", state_string(old_state));
pm_runtime_get_sync(pnw->dev);
penwell_otg_start_ulpi_poll();
iotg->otg.state = OTG_STATE_B_PERIPHERAL;
-
} else if ((hsm->b_bus_req || hsm->power_up || hsm->adp_change
|| hsm->otg_srp_reqd) && !hsm->b_srp_fail_tmr) {
pm_runtime_put_sync(pnw->dev);
+ new_state = iotg->otg.state;
dev_dbg(pnw->dev,
- "new state = %s\n", state_string(iotg->otg.state));
+ "new state = %s\n", state_string(new_state));
+#ifdef CONFIG_JACK_MON
+ if (connected(old_state) && !connected(new_state))
+ jack_event_handler("usb", 0);
+ else if (!connected(old_state) && connected(new_state))
+ jack_event_handler("usb", 1);
+#endif
}
static ssize_t