fix-pcf50633-coldplug-usb-presence.patch

From: Andy Green <[EMAIL PROTECTED]>

Seems that the code is set up to be told about usb
plug events and run with that... but what about usb
coldplug, where we came up with the thing already
plugged in?  This simulates the servicing so we
act right if we had USB plugged in when we were
probed.

Signed-off-by: Andy Green <[EMAIL PROTECTED]>
---

 drivers/i2c/chips/pcf50633.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)


diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
index 78343bb..fe7c10b 100644
--- a/drivers/i2c/chips/pcf50633.c
+++ b/drivers/i2c/chips/pcf50633.c
@@ -1543,6 +1543,17 @@ static int pcf50633_detect(struct i2c_adapter *adapter, int address, int kind)
 	}
 #endif
 
+	/* coldplug the USB if present */
+	if (reg_read(data, PCF50633_REG_MBCS1) & 3) { /* usb present, power ok */
+		DEBUGPC("USBINS ");
+		input_report_key(data->input_dev, KEY_POWER2, 1);
+		apm_queue_event(APM_POWER_STATUS_CHANGE);
+		data->flags |= PCF50633_F_USB_PRESENT;
+		if (data->pdata->cb)
+			data->pdata->cb(&data->client.dev,
+				       PCF50633_FEAT_MBC, PMU_EVT_USB_INSERT);
+	}
+
 	return 0;
 exit_rtc:
 	if (data->pdata->used_features & PCF50633_FEAT_RTC)

Reply via email to