Skip to content

Commit

Permalink
usb: fix mtp on AOSP roms
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey0800770 committed Jan 10, 2025
1 parent 3bcc137 commit b59b053
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion arch/arm64/configs/crownqlte_chn_open_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4057,7 +4057,7 @@ CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VBUS_DRAW=500
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
CONFIG_USB_G_ANDROID=y
CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE=y
#CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE is not set
# CONFIG_USB_FFS_IPC_LOGGING is not set
CONFIG_USB_NCM_SUPPORT_MTU_CHANGE=y

Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/configs/star2qlte_chn_open_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4058,7 +4058,7 @@ CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VBUS_DRAW=500
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
CONFIG_USB_G_ANDROID=y
CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE=y
#CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE is not set
# CONFIG_USB_FFS_IPC_LOGGING is not set
CONFIG_USB_NCM_SUPPORT_MTU_CHANGE=y

Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/configs/star2qlte_usa_single_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4056,7 +4056,7 @@ CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VBUS_DRAW=500
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
CONFIG_USB_G_ANDROID=y
CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE=y
#CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE is not set
# CONFIG_USB_FFS_IPC_LOGGING is not set
CONFIG_USB_NCM_SUPPORT_MTU_CHANGE=y

Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/configs/starqlte_chn_open_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4057,7 +4057,7 @@ CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VBUS_DRAW=500
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
CONFIG_USB_G_ANDROID=y
CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE=y
#CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE is not set
# CONFIG_USB_FFS_IPC_LOGGING is not set
CONFIG_USB_NCM_SUPPORT_MTU_CHANGE=y

Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/configs/starqlte_usa_single_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4056,7 +4056,7 @@ CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VBUS_DRAW=500
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
CONFIG_USB_G_ANDROID=y
CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE=y
#CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE is not set
# CONFIG_USB_FFS_IPC_LOGGING is not set
CONFIG_USB_NCM_SUPPORT_MTU_CHANGE=y

Expand Down
13 changes: 9 additions & 4 deletions drivers/usb/gadget/function/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@ obj-$(CONFIG_USB_F_PRINTER) += usb_f_printer.o
usb_f_tcm-y := f_tcm.o
obj-$(CONFIG_USB_F_TCM) += usb_f_tcm.o
ifeq ($(CONFIG_SEC_FACTORY),y)
usb_f_mtp-y := f_mtp.o
obj-$(CONFIG_USB_F_MTP) += usb_f_mtp.o
usb_f_mtp-y := f_mtp.o
obj-$(CONFIG_USB_F_MTP) += usb_f_mtp.o
else
usb_f_mtp_samsung-y := f_mtp_samsung.o
obj-$(CONFIG_USB_F_MTP) += usb_f_mtp_samsung.o
ifeq ($(CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE),y)
usb_f_mtp_samsung-y := f_mtp_samsung.o
obj-$(CONFIG_USB_F_MTP) += usb_f_mtp_samsung.o
else
usb_f_mtp-y := f_mtp.o
obj-$(CONFIG_USB_F_MTP) += usb_f_mtp.o
endif
endif
usb_f_ptp-y := f_ptp.o
obj-$(CONFIG_USB_F_PTP) += usb_f_ptp.o
Expand Down
8 changes: 4 additions & 4 deletions drivers/usb/notify/usb_notifier_qcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
extern int dwc_msm_vbus_event(bool enable);
extern int dwc_msm_id_event(bool enable);
extern void dwc3_max_speed_setting(int speed);

#ifdef CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE
extern void set_ncm_ready(bool ready);

#endif
#if defined(CONFIG_CCIC_NOTIFIER)
int is_host;
#endif
Expand Down Expand Up @@ -306,15 +306,15 @@ static int otg_accessory_power(bool enable)

return ret;
}

static int qcom_set_peripheral(bool enable)
{
dwc_msm_vbus_event(enable);
#ifdef CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE
if(!enable)
set_ncm_ready(false);
#endif
return 0;
}

static int qcom_set_host(bool enable)
{
dwc_msm_id_event(enable);
Expand Down

0 comments on commit b59b053

Please sign in to comment.