Files
android_kernel_samsung_msm8226/include/linux/usb/msm_ext_chg.h
T
Pavankumar Kondeti 17b52e7bac 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>
2013-07-04 18:15:01 +05:30

32 lines
1007 B
C

#ifndef __LINUX_USB_MSM_EXT_CHG_H
#define __LINUX_USB_MSM_EXT_CHG_H
#include <linux/ioctl.h>
#define USB_CHG_BLOCK_ULPI 1
#define USB_CHG_BLOCK_QSCRATCH 2
/**
* struct msm_usb_chg_info - MSM USB charger block details.
* @chg_block_type: The type of charger block. QSCRATCH/ULPI.
* @page_offset: USB charger register base may not be aligned to
* PAGE_SIZE. The kernel driver aligns the base
* address and use it for memory mapping. This
* page_offset is used by user space to calaculate
* the corret charger register base address.
* @length: The length of the charger register address space.
*/
struct msm_usb_chg_info {
uint32_t chg_block_type;
off_t page_offset;
size_t length;
};
/* Get the MSM USB charger block information */
#define MSM_USB_EXT_CHG_INFO _IOW('M', 0, struct msm_usb_chg_info)
/* Vote against USB hardware low power mode */
#define MSM_USB_EXT_CHG_BLOCK_LPM _IOW('M', 1, int)
#endif /* __LINUX_USB_MSM_EXT_CHG_H */