USB: dwc3: msm: fix mmap to allow only charger block register address space

/dev/usb_ext_chg device file interface supports mmap and its current
implementation allows any address for mapping.  Fix it by mapping only
charger block register address space.  The user space does not need to
pass any physical address in mmap.  Implement an ioctl to tell the
offset from which the first charger block register is available.  User
space adds this offset to the virtual address returned by mmap to access
charger detection registers.

The MSM_USB_EXT_CHG_INFO ioctl also returns the charger block type
(QSCRATCH/ULPI) to user space.  Use the ioctl interface for blocking
low power mode while charger detection takes place in user space.

Change-Id: Ie27988e1989564124b40cf7c40c8eb67dac99c65
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
3 files changed