From 92a772b8dbd77e71514da37674fa3d86fdf59d75 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 31 Aug 2016 13:33:11 +0900 Subject: [PATCH 01/16] build: scripts: add input parameters to sprd_dtbtool.sh Instead of fixed dtb file list and its hw platform information, this patch adds input parameters to get proper dtb files and to consider reversed dtc hw platform information. Change-Id: I29b8da3c3520ac6619777d1b4e4456a32d28ba44 Signed-off-by: Seung-Woo Kim --- release.sh | 2 +- release_obs.sh | 2 +- scripts/sprd_dtbtool.sh | 173 +++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 145 insertions(+), 32 deletions(-) diff --git a/release.sh b/release.sh index b947192..e7d03c0 100755 --- a/release.sh +++ b/release.sh @@ -47,7 +47,7 @@ if [ "$?" != "0" ]; then exit 1 fi -./scripts/sprd_dtbtool.sh +./scripts/sprd_dtbtool.sh -p ${DTC_PATH} -v ${BOOT_PATH}/dts/ if [ "$?" != "0" ]; then echo "Failed to make merged-dtb" exit 1 diff --git a/release_obs.sh b/release_obs.sh index 3675592..e875862 100755 --- a/release_obs.sh +++ b/release_obs.sh @@ -80,7 +80,7 @@ if [ "$?" != "0" ]; then exit 1 fi -./scripts/sprd_dtbtool.sh +./scripts/sprd_dtbtool.sh -p ${DTC_PATH} -v ${BOOT_PATH}/dts/ if [ "$?" != "0" ]; then echo "Failed to make merged-dtb" exit 1 diff --git a/scripts/sprd_dtbtool.sh b/scripts/sprd_dtbtool.sh index 14a1f36..9f447ee 100755 --- a/scripts/sprd_dtbtool.sh +++ b/scripts/sprd_dtbtool.sh @@ -2,10 +2,11 @@ ## Functions -function write_to_4bytes_binary() +function write_hex_to_4bytes_binary() { - HEX=`echo "obase=16; $1" | bc` + HEX=$1 + HEX=${HEX#0x} NUM=$((8-${#HEX})) ZERO="00000000" @@ -19,6 +20,13 @@ function write_to_4bytes_binary() done > $2 } +function write_to_4bytes_binary() +{ + HEX=`echo "obase=16; $1" | bc` + + write_hex_to_4bytes_binary $HEX $2 +} + function write_to_padding_binary() { rm -f padding @@ -30,7 +38,9 @@ function write_to_padding_binary() touch padding fi - echo -en " | PAD: $PAD_SIZE[B]\n" + if [ "${VERBOSE}" -eq "1" ]; then + echo -en " | PAD: $PAD_SIZE[B]\n" + fi } function get_dtb_size() @@ -40,33 +50,122 @@ function get_dtb_size() DTB_SIZE=$(($SIZE + $PAD_SIZE)) } +function help() { + echo "sprd_dtbtool.sh [OPTIONS] -o " + echo " options:" + echo " --output-file/-o output file" + echo " --dtc-path/-p path to dtc" + echo " --page-size/-s page size in bytes" + echo " --verbose/-v verbose" + echo " --help/-h this help screen" + exit 0 +} + ## Defines OUT="merged-dtb" OUT_TMP="multi.tmp" OUT_DIR="./arch/arm/boot" -DTS_DIR="./arch/arm/boot/dts" +DTC_PATH=scripts/dtc SPRD_MAGIC="SPRD" SPRD_VERSION=1 - -DTB=( -"sprd-scx35-tizen_z3-r00.dtb" -"sprd-scx35-tizen_z3-r01.dtb" -"sprd-scx35-tizen_z3-r02.dtb" -"sprd-scx35-tizen_z3-r03.dtb" -) -DTB_CNT=4 - -CHIPSET=8830 -PLATFORM=0 -REV=131072 -DTB_OFFSET=2048 +SPRD_TAG="sprd,sc-id" ENDOFHEADER=0 +let MAX_PAD_SIZE=1024*1024 PAD=2048 +VERBOSE=0 + +if [ "$#" -eq "0" ]; then + help +fi + + +## Input parameters +params="$(getopt -o o:p:s:vh -l output-file:,dtc-path:,page-size:,verbose,help --name "$0" -- "$@")" +eval set -- "$params" +while true +do + case "$1" in + -o|--output-file) + OUTPUT_FILE=$2 + shift 2 + OUT_DIR=`dirname $OUTPUT_FILE` + if [ ! -d "$OUT_DIR" ]; then + echo "invalid output path '$OUT_DIR'." + exit 1 + fi + OUT=${OUTPUT_FILE#${OUT_DIR}} + OUT=${OUT//\//} + OUT_TMP=${OUT}.tmp + ;; + -p|--dtc-path) + DTC_PATH=$2 + shift 2 + ;; + -s|--page-size) + PAD=$2 + shift 2 + R=${PAD#-} + R=${R//[0-9]/} + # page size should be number, and larger than 0, and smaller than 1024*1024 + if [ ! -z "$R" ] || [ "$PAD" -lt "0" ] || [ "$PAD" -gt "$MAX_PAD_SIZE" ]; then + echo "invalid page size." + exit 1 + fi + ;; + -v|--verbose) + VERBOSE=1 + shift + ;; + -h|--help) + help + ;; + --) + shift + break + ;; + *) + help + ;; + esac +done + +if [ "$#" -eq "0" ]; then + help +fi + +DTS_DIR=$1 +DTS_DIR=${DTS_DIR%\/} +if [ ! -d "$DTS_DIR" ]; then + echo "invalid DTB input path '$DTS_DIR'." + exit 1 +else + DTB=(`find ${DTS_DIR} -name "*.dtb"`) + for i in ${DTB[*]}; do + if [ -e $i ]; then + TAG_CHECK=`${DTC_PATH}/dtc -I dtb -O dts $i 2>/dev/null | grep "${SPRD_TAG}"` + if [ "z${TAG_CHECK}" == "z" ]; then + # no tag in the dtb file + DTB=(${DTB[@]/$i}) + fi + fi + done +fi + +if [ ! -f "$DTC_PATH/dtc" ]; then + echo "no DTC file in '$DTC_PATH'." + exit 1 +fi + +if [ "${VERBOSE}" -eq "1" ]; then + echo "DTB input path is '${DTS_DIR}'" + echo "output path is '${OUT_DIR}', output file is '${OUT}'" + echo "page size is '${PAD}'" +fi ## Header @@ -74,10 +173,14 @@ rm -f $OUT rm -f $OUT_TMP touch $OUT_TMP +DTB_CNT=${#DTB[@]} HEADER_SIZE=$((12 + 20 * $DTB_CNT + 4)) +DTB_OFFSET=$PAD -echo -en " *HEADER " -echo -en "$HEADER_SIZE[B]\n" +if [ "${VERBOSE}" -eq "1" ]; then + echo -en " *HEADER " + echo -en "$HEADER_SIZE[B]\n" +fi echo -en $SPRD_MAGIC > $OUT cat $OUT >> $OUT_TMP @@ -87,16 +190,22 @@ write_to_4bytes_binary $DTB_CNT $OUT cat $OUT >> $OUT_TMP for i in ${DTB[*]}; do - FILE="$DTS_DIR/$i" + FILE="$i" if [ -e $FILE ]; then - write_to_4bytes_binary $CHIPSET $OUT + TAG_CHECK=`${DTC_PATH}/dtc -I dtb -O dts $i 2>/dev/null | grep "${SPRD_TAG}"` + TAG_CHECK=${TAG_CHECK#*<} + TAG_CHECK=${TAG_CHECK%>*} + CHIPSET=`echo ${TAG_CHECK} | awk '{ print $1 }'` + PLATFORM=`echo ${TAG_CHECK} | awk '{ print $2 }'` + REV=`echo ${TAG_CHECK} | awk '{ print $3 }'` + + write_hex_to_4bytes_binary $CHIPSET $OUT cat $OUT >> $OUT_TMP - write_to_4bytes_binary $PLATFORM $OUT + write_hex_to_4bytes_binary $PLATFORM $OUT cat $OUT >> $OUT_TMP - PLATFORM=$(($PLATFORM + 1)) - write_to_4bytes_binary $REV $OUT + write_hex_to_4bytes_binary $REV $OUT cat $OUT >> $OUT_TMP write_to_4bytes_binary $DTB_OFFSET $OUT @@ -122,15 +231,16 @@ cat $OUT_TMP padding > $OUT ## DTB for i in ${DTB[*]}; do - FILE="$DTS_DIR/$i" + FILE="$i" if [ -e $FILE ]; then NAME=`echo $i` - echo -en " *$NAME " + SIZE=`du -b $FILE | awk '{print $1}'` cat $OUT $FILE > $OUT_TMP - - SIZE=`du -b $FILE | awk '{print $1}'` - echo -en "$SIZE[B]\n" + if [ "${VERBOSE}" -eq "1" ]; then + echo -en " *$NAME " + echo -en "$SIZE[B]\n" + fi write_to_padding_binary $SIZE cat $OUT_TMP padding > $OUT @@ -149,4 +259,7 @@ mv -f $OUT $OUT_DIR/ S=`du -b $OUT_DIR/$OUT | awk '{print $1}'` S_K=$(($S/1024)) -echo -en "## OUT: $OUT size: $S[B]; $S_K[K]\n" +if [ "${VERBOSE}" -eq "1" ]; then + echo -en "## OUT: $OUT size: $S[B]; $S_K[KB]\n" +fi +echo "$OUT_DIR/$OUT (size: ${S_K}KB) is created." -- 2.7.4 From eb77b79a9c3c47b1dd82dfef6d8d72ae962bc7b5 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 31 Aug 2016 20:21:04 +0900 Subject: [PATCH 02/16] build: scripts: add input parameters to sprd_mkdzimage.sh Instead of fixed kernel and dtb files, this patch adds input parameters to get proper kernel and dtb files. Change-Id: Icd253cff63e7bccf12ddead4360417da05a7c7ef Signed-off-by: Seung-Woo Kim --- release.sh | 2 +- release_obs.sh | 2 +- scripts/sprd_mkdzimage.sh | 151 +++++++++++++++++++++++++++++++--------------- 3 files changed, 105 insertions(+), 50 deletions(-) diff --git a/release.sh b/release.sh index e7d03c0..2844293 100755 --- a/release.sh +++ b/release.sh @@ -53,7 +53,7 @@ if [ "$?" != "0" ]; then exit 1 fi -./scripts/sprd_mkdzimage.sh +./scripts/sprd_mkdzimage.sh -o ${BOOT_PATH}/${DZIMAGE} -k ${BOOT_PATH}/zImage -d ${BOOT_PATH}/merged-dtb if [ "$?" != "0" ]; then echo "Failed to make mkdzImage" exit 1 diff --git a/release_obs.sh b/release_obs.sh index e875862..8f475db 100755 --- a/release_obs.sh +++ b/release_obs.sh @@ -86,7 +86,7 @@ if [ "$?" != "0" ]; then exit 1 fi -./scripts/sprd_mkdzimage.sh +./scripts/sprd_mkdzimage.sh -o ${BOOT_PATH}/${DZIMAGE} -k ${BOOT_PATH}/zImage -d ${BOOT_PATH}/merged-dtb if [ "$?" != "0" ]; then echo "Failed to make mkdzImage" exit 1 diff --git a/scripts/sprd_mkdzimage.sh b/scripts/sprd_mkdzimage.sh index f6ea777..eb6f862 100755 --- a/scripts/sprd_mkdzimage.sh +++ b/scripts/sprd_mkdzimage.sh @@ -33,13 +33,21 @@ function write_to_padding_binary() echo -en " | PAD: $PAD_SIZE[B]\n" } +function help() { + echo "sprd_mkdzimage.sh [OPTIONS] -o -k " + echo " options:" + echo " --output-file/-o output file" + echo " --kernel/-k kernel file" + echo " --devicetree/-d devicetree file" + echo " --help/-h this help screen" + exit 0 +} + ## Defines OUT="dzImage" OUT_TMP="dzImage.tmp" - OUT_DIR="./arch/arm/boot" -BOOT_DIR="./arch/arm/boot" MAGIC="NZIT" # 0x54495A4E KERNEL_ADDR=32768 # 0x00008000 @@ -48,6 +56,65 @@ ATAGS_ADDR=31457280 # 0x01e00000 PAD=2048 +if [ "$#" -eq "0" ]; then + help +fi + + +## Input parameters +params="$(getopt -o o:k:d:h -l output-file:,:kernel:,devicetree:,help --name "$0" -- "$@")" +eval set -- "$params" +while true +do + case "$1" in + -o|--output-file) + OUTPUT_FILE=$2 + shift 2 + OUT_DIR=`dirname $OUTPUT_FILE` + if [ ! -d "$OUT_DIR" ]; then + echo "invalid output path '$OUT_DIR'." + exit 1 + fi + OUT=${OUTPUT_FILE#${OUT_DIR}} + OUT=${OUT//\//} + OUT_TMP=${OUT}.tmp + ;; + -k|--kernel) + KERNEL=$2 + shift 2 + ;; + -d|--devicetree) + DEVICETREE=$2 + shift 2 + ;; + -h|--help) + help + ;; + --) + shift + break + ;; + *) + help + ;; + esac +done + +if [ "z${KERNEL}" == "z" ] || [ "z${DEVICETREE}" == "z" ]; then + help +fi + +if [ ! -e "${KERNEL}" ]; then + echo -en "kernel '${KERNEL}' not found.\nexit\n" + exit -1 +fi + +if [ ! -e "${DEVICETREE}" ]; then + echo -en "devicetree '${DEVICETREE}' not found.\nexit\n" + exit -1 +fi + + ## Header rm -f $OUT rm -f $OUT_TMP @@ -63,29 +130,19 @@ cat $OUT >> $OUT_TMP write_to_4bytes_binary $KERNEL_ADDR $OUT cat $OUT >> $OUT_TMP -FILE="$BOOT_DIR/zImage" -if [ -e $FILE ]; then - SIZE=`du -b $FILE | awk '{print $1}'` - write_to_4bytes_binary $SIZE $OUT - cat $OUT >> $OUT_TMP -else - echo -en "$FILE not found.\nexit\n" - exit -1 -fi +FILE="${KERNEL}" +SIZE=`du -b $FILE | awk '{print $1}'` +write_to_4bytes_binary $SIZE $OUT +cat $OUT >> $OUT_TMP DTB_ADDR=$(($KERNEL_ADDR + $SIZE)) write_to_4bytes_binary $DTB_ADDR $OUT cat $OUT >> $OUT_TMP -FILE="$BOOT_DIR/merged-dtb" -if [ -e $FILE ]; then - SIZE=`du -b $FILE | awk '{print $1}'` - write_to_4bytes_binary $SIZE $OUT - cat $OUT >> $OUT_TMP -else - echo -en "$FILE not found.\nexit\n" - exit -1 -fi +FILE="${DEVICETREE}" +SIZE=`du -b $FILE | awk '{print $1}'` +write_to_4bytes_binary $SIZE $OUT +cat $OUT >> $OUT_TMP write_to_4bytes_binary $ATAGS_ADDR $OUT cat $OUT >> $OUT_TMP @@ -97,37 +154,35 @@ cat $OUT_TMP padding > $OUT ## Kernel Binary -FILE="$BOOT_DIR/zImage" -if [ -e $FILE ]; then - echo -en " *zImage " - cat $OUT $FILE > $OUT_TMP - - SIZE=`du -b $FILE | awk '{print $1}'` - echo -en "$SIZE[B]\n" - - write_to_padding_binary $SIZE - cat $OUT_TMP padding > $OUT -else - echo -en "zImage not found.\nexit\n" - exit -1 -fi +FILE="${KERNEL}" +FILE_PATH=`dirname ${KERNEL}` +FILE_NAME=${FILE#${FILE_PATH}} +FILE_NAME=${FILE_NAME//\//} +echo -en " *${FILE_NAME} " +cat $OUT $FILE > $OUT_TMP -## merged-dtb Binary -FILE="$BOOT_DIR/merged-dtb" -if [ -e $FILE ]; then - echo -en " *merged-dtb " - cat $OUT $FILE > $OUT_TMP +SIZE=`du -b $FILE | awk '{print $1}'` +echo -en "$SIZE[B]\n" - SIZE=`du -b $FILE | awk '{print $1}'` - echo -en "$SIZE[B]\n" +write_to_padding_binary $SIZE +cat $OUT_TMP padding > $OUT - write_to_padding_binary $SIZE - cat $OUT_TMP padding > $OUT -else - echo -en "merged-dtb not found.\nexit\n" - exit -1 -fi + +## Devicetree Binary +FILE="${DEVICETREE}" +FILE_PATH=`dirname ${DEVICETREE}` +FILE_NAME=${FILE#${FILE_PATH}} +FILE_NAME=${FILE_NAME//\//} + +echo -en " *${FILE_NAME} " +cat $OUT $FILE > $OUT_TMP + +SIZE=`du -b $FILE | awk '{print $1}'` +echo -en "$SIZE[B]\n" + +write_to_padding_binary $SIZE +cat $OUT_TMP padding > $OUT ## END @@ -138,4 +193,4 @@ mv -f $OUT $OUT_DIR/ S=`du -b $OUT_DIR/$OUT | awk '{print $1}'` S_K=$(($S/1024)) -echo -en "## OUT: $OUT size: $S[B]; $S_K[K]\n" +echo -en "## OUT: $OUT size: $S[B]; $S_K[KB]\n" -- 2.7.4 From d6e68cb0303d38fca82d33ef265e035cd9cfe442 Mon Sep 17 00:00:00 2001 From: jooseong lee Date: Fri, 2 Sep 2016 17:09:30 +0900 Subject: [PATCH 03/16] Smack: Fix wrong backporting for Smack Regard of: Smack: secmark support for netfilter (d587ffac0e6b0849334d575bca4e9e1caa48f891) Smack used to use a mix of smack_known struct and char* throughout its APIs and implementation. I confused it. It should be char*, not smack_known struct. (The latest kernel has a unified format, smack_known struct.) Change-Id: Ifd93e8b3d85c867c8d7a903470abc45e589a1a37 Signed-off-by: jooseong lee --- security/smack/smack_lsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index a7f2b5b..b72abc2 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -3751,8 +3751,8 @@ access_check: ad.a.u.net->netif = skb->skb_iif; ipv6_skb_to_auditdata(skb, &ad.a, NULL); #endif /* CONFIG_AUDIT */ - rc = smk_access(skp, ssp->smk_in, MAY_WRITE, &ad); - rc = smk_bu_note("IPv6 delivery", skp, ssp->smk_in, + rc = smk_access(skp, ssp->smk_in->smk_known, MAY_WRITE, &ad); + rc = smk_bu_note("IPv6 delivery", skp, ssp->smk_in->smk_known, MAY_WRITE, rc); #else /* CONFIG_SECURITY_SMACK_NETFILTER */ rc = smk_ipv6_port_check(sk, &sadd, SMK_RECEIVING); -- 2.7.4 From f500e7d1093f8a0f58bab4e185ccb0b5fd24c11c Mon Sep 17 00:00:00 2001 From: Krzysztof Opasiak Date: Thu, 1 Sep 2016 18:37:59 +0200 Subject: [PATCH 04/16] usb: gadget: Allow to build multiple legacy gadgets Currently it is possible to build in only one legac gadget *OR* compile multiple of them as a modules. It's not possible to mix those 2 ways of building them. This is limited only by Kconfig not any functionality. This patch removes this limitation. With this patch it is possible to set up all build combinations: 1) Multiple gadgets build in 2) Some gadgets build in and some build as a modules etc. As this patch makes Kconfig quite complicated let me clarify how it works: USB_F_ - used in makefile for compilation USB_G__REQ_F_ - set up by gadget to mark that this particular gadget requires this func to work USB_F__SELECTOR - helper config which is used to determine if function should be build in or compiled as a module Change-Id: I43b764ff27d08484df140835a6f2dee35d621248 Signed-off-by: Krzysztof Opasiak --- drivers/usb/gadget/Kconfig | 222 +++++++++++++++++++++++++++++++++------------ 1 file changed, 166 insertions(+), 56 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 55c7c57..16b3882 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -518,50 +518,167 @@ config USB_SPRD_SWITCH # composite based drivers config USB_LIBCOMPOSITE - tristate + tristate "USB Gadget Drivers" select CONFIGFS_FS depends on USB_GADGET config USB_F_ACM tristate +# Just a dummy config which indicates that serial gadget requires ACM in particular state +config USB_G_SERIAL_REQ_F_ACM + tristate + +# Just a dummy config which indicates that cdc gadget requires ACM in particular state +config USB_G_CDC_COMPOSITE_REQ_F_ACM + tristate + +# Just a dummy config which indicates that nokia gadget requires ACM in particular state +config USB_G_NOKIA_REQ_F_ACM + tristate + +# Just a dummy config which indicates that acm ms gadget requires ACM in particular state +config USB_G_ACM_MS_REQ_F_ACM + tristate + +# Just a dummy config which indicates that gadget multi requires ACM in particular state +config USB_G_MULTI_REQ_F_ACM + tristate + +# Just a dummy config which indicates that android gadget requires ACM in particular state +config USB_G_ANDROID_REQ_F_ACM + tristate + +# Just a dummy config which indicates that slp gadget requires ACM in particular state +config USB_G_SLP_REQ_F_ACM + tristate + +if USB_G_SERIAL_REQ_F_ACM = y || USB_G_CDC_COMPOSITE_REQ_F_ACM = y || USB_G_NOKIA_REQ_F_ACM = y || USB_G_ACM_MS_REQ_F_ACM = y || USB_G_MULTI_REQ_F_ACM = y || USB_G_ANDROID_REQ_F_ACM = y || USB_G_SLP_REQ_F_ACM = y + config USB_F_ACM_SELECTOR + tristate + default y + select USB_F_ACM + select USB_F_ACM_REQ_U_SERIAL + endif + + if !(USB_G_SERIAL_REQ_F_ACM = y || USB_G_CDC_COMPOSITE_REQ_F_ACM = y || USB_G_NOKIA_REQ_F_ACM = y || USB_G_ACM_MS_REQ_F_ACM = y || USB_G_MULTI_REQ_F_ACM = y || USB_G_SLP_REQ_F_ACM = y) && (USB_G_SERIAL_REQ_F_ACM = m || USB_G_CDC_COMPOSITE_REQ_F_ACM = m || USB_G_NOKIA_REQ_F_ACM = m || USB_G_ACM_MS_REQ_F_ACM = m || USB_G_MULTI_REQ_F_ACM = m || USB_G_ANDROID_REQ_F_ACM = m || USB_G_SLP_REQ_F_ACM = m) + config USB_F_ACM_SELECTOR + tristate + default m + select USB_F_ACM + select USB_F_ACM_REQ_U_SERIAL + endif + config USB_F_SS_LB tristate +# Just a dummy config which indicates that gadget zero requires SS and LB in particular state +config USB_G_ZERO_REQ_F_SS_LB + tristate + +if USB_G_ZERO_REQ_F_SS_LB = y +config USB_F_SS_LB_SELECTOR + tristate + default y + select USB_F_SS_LB +endif + +if !(USB_G_ZERO_REQ_F_SS_LB = y) && (USB_G_ZERO_REQ_F_SS_LB = m) +config USB_F_SS_LB_SELECTOR + tristate + default m + select USB_F_SS_LB +endif + config USB_U_SERIAL tristate +# Just a dummy config which indicates that F_ACM requires U_SERIAL in particular state +config USB_F_ACM_REQ_U_SERIAL + tristate + +# Just a dummy config which indicates that F_SERIAL requires U_SERIAL in particular state +config USB_F_SERIAL_REQ_U_SERIAL + tristate + +# Just a dummy config which indicates that F_OBEX requires U_SERIAL in particular state +config USB_F_OBEX_REQ_U_SERIAL + tristate + +# Just a dummy config which indicates that dbg gadget requires U_SERIAL in particular state +config USB_G_DBG_REQ_U_SERIAL + tristate + +if USB_F_ACM_REQ_U_SERIAL = y || USB_F_SERIAL_REQ_U_SERIAL = y || USB_F_OBEX_REQ_U_SERIAL = y || USB_G_DBG_REQ_U_SERIAL = y +config USB_U_SERIAL_SELECTOR + tristate + default y + select USB_U_SERIAL +endif + +if !(USB_F_ACM_REQ_U_SERIAL = y || USB_F_SERIAL_REQ_U_SERIAL = y || USB_F_OBEX_REQ_U_SERIAL = y || USB_G_DBG_REQ_U_SERIAL = y) && (USB_F_ACM_REQ_U_SERIAL = m || USB_F_SERIAL_REQ_U_SERIAL = m || USB_F_OBEX_REQ_U_SERIAL = m || USB_G_DBG_REQ_U_SERIAL = m) +config USB_U_SERIAL_SELECTOR + tristate + default m + select USB_U_SERIAL +endif + config USB_F_SERIAL tristate +# Just a dummy config which indicates that serial gadget requires SERIAL in particular state +config USB_G_SERIAL_REQ_F_SERIAL + tristate + +if USB_G_SERIAL_REQ_F_SERIAL = y +config USB_F_SERIAL_SELECTOR + tristate + default y + select USB_F_SERIAL + select USB_F_SERIAL_REQ_U_SERIAL +endif + +if !(USB_G_SERIAL_REQ_F_SERIAL = y) && (USB_G_SERIAL_REQ_F_SERIAL = m) +config USB_F_SERIAL_SELECTOR + tristate + default m + select USB_F_SERIAL + select USB_F_SERIAL_REQ_U_SERIAL +endif config USB_F_OBEX tristate -choice - tristate "USB Gadget Drivers" - default USB_ETH - help - A Linux "Gadget Driver" talks to the USB Peripheral Controller - driver through the abstract "gadget" API. Some other operating - systems call these "client" drivers, of which "class drivers" - are a subset (implementing a USB device class specification). - A gadget driver implements one or more USB functions using - the peripheral hardware. - - Gadget drivers are hardware-neutral, or "platform independent", - except that they sometimes must understand quirks or limitations - of the particular controllers they work with. For example, when - a controller doesn't support alternate configurations or provide - enough of the right types of endpoints, the gadget driver might - not be able work with that controller, or might need to implement - a less common variant of a device class protocol. +# Just a dummy config which indicates that serial gadget requires OBEX in particular state +config USB_G_SERIAL_REQ_F_OBEX + tristate +# Just a dummy config which indicates that nokia gadget requires OBEX in particular state +config USB_G_NOKIA_REQ_F_OBEX + tristate + +if USB_G_SERIAL_REQ_F_OBEX = y || USB_G_NOKIA_REQ_F_OBEX = y +config USB_F_OBEX_SELECTOR + tristate + default y + select USB_F_OBEX + select USB_F_OBEX_REQ_U_SERIAL +endif + +if !(USB_G_SERIAL_REQ_F_OBEX = y || USB_G_NOKIA_REQ_F_OBEX = y) && (USB_G_SERIAL_REQ_F_OBEX = m || USB_G_NOKIA_REQ_F_OBEX = m) +config USB_F_OBEX_SELECTOR + tristate + default m + select USB_F_OBEX + select USB_F_OBEX_REQ_U_SERIAL +endif + +menu "Legacy USB Gadget Drivers" # this first set of drivers all depend on bulk-capable hardware. config USB_ZERO tristate "Gadget Zero (DEVELOPMENT)" - select USB_LIBCOMPOSITE - select USB_F_SS_LB + depends on USB_LIBCOMPOSITE + select USB_G_ZERO_REQ_F_SS_LB help Gadget Zero is a two-configuration device. It either sinks and sources bulk data; or it loops back a configurable number of @@ -597,7 +714,7 @@ config USB_ZERO_HNPTEST config USB_AUDIO tristate "Audio Gadget" depends on SND - select USB_LIBCOMPOSITE + depends on USB_LIBCOMPOSITE select SND_PCM help This Gadget Audio driver is compatible with USB Audio Class @@ -626,7 +743,7 @@ config GADGET_UAC1 config USB_ETH tristate "Ethernet Gadget (with CDC Ethernet support)" depends on NET - select USB_LIBCOMPOSITE + depends on USB_LIBCOMPOSITE select CRC32 help This driver implements Ethernet style communication, in one of @@ -662,7 +779,7 @@ config USB_ETH config USB_ETH_RNDIS bool "RNDIS support" depends on USB_ETH - select USB_LIBCOMPOSITE + depends on USB_LIBCOMPOSITE default y help Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol, @@ -681,7 +798,7 @@ config USB_ETH_RNDIS config USB_ETH_EEM bool "Ethernet Emulation Model (EEM) support" depends on USB_ETH - select USB_LIBCOMPOSITE + depends on USB_LIBCOMPOSITE default n help CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM @@ -698,7 +815,7 @@ config USB_ETH_EEM config USB_G_NCM tristate "Network Control Model (NCM) support" depends on NET - select USB_LIBCOMPOSITE + depends on USB_LIBCOMPOSITE select CRC32 help This driver implements USB CDC NCM subclass standard. NCM is @@ -723,7 +840,7 @@ config USB_GADGETFS config USB_FUNCTIONFS tristate "Function Filesystem" - select USB_LIBCOMPOSITE + depends on USB_LIBCOMPOSITE select USB_FUNCTIONFS_GENERIC if !(USB_FUNCTIONFS_ETH || USB_FUNCTIONFS_RNDIS) help The Function Filesystem (FunctionFS) lets one create USB @@ -762,7 +879,7 @@ config USB_FUNCTIONFS_GENERIC config USB_MASS_STORAGE tristate "Mass Storage Gadget" depends on BLOCK - select USB_LIBCOMPOSITE + depends on USB_LIBCOMPOSITE help The Mass Storage Gadget acts as a USB Mass Storage disk drive. As its storage repository it can use a regular file or a block @@ -778,7 +895,7 @@ config USB_MASS_STORAGE config USB_GADGET_TARGET tristate "USB Gadget Target Fabric Module" depends on TARGET_CORE - select USB_LIBCOMPOSITE + depends on USB_LIBCOMPOSITE help This fabric is an USB gadget. Two USB protocols are supported that is BBB or BOT (Bulk Only Transport) and UAS (USB Attached SCSI). BOT is @@ -789,11 +906,10 @@ config USB_GADGET_TARGET config USB_G_SERIAL tristate "Serial Gadget (with CDC ACM and CDC OBEX support)" depends on TTY - select USB_U_SERIAL - select USB_F_ACM - select USB_F_SERIAL - select USB_F_OBEX - select USB_LIBCOMPOSITE + select USB_G_SERIAL_REQ_F_ACM + select USB_G_SERIAL_REQ_F_SERIAL + select USB_G_SERIAL_REQ_F_OBEX + depends on USB_LIBCOMPOSITE help The Serial Gadget talks to the Linux-USB generic serial driver. This driver supports a CDC-ACM module option, which can be used @@ -814,7 +930,7 @@ config USB_G_SERIAL config USB_MIDI_GADGET tristate "MIDI Gadget" depends on SND - select USB_LIBCOMPOSITE + depends on USB_LIBCOMPOSITE select SND_RAWMIDI help The MIDI Gadget acts as a USB Audio device, with one MIDI @@ -828,7 +944,7 @@ config USB_MIDI_GADGET config USB_G_PRINTER tristate "Printer Gadget" - select USB_LIBCOMPOSITE + depends on USB_LIBCOMPOSITE help The Printer Gadget channels data between the USB host and a userspace program driving the print engine. The user space @@ -844,9 +960,8 @@ config USB_G_PRINTER config USB_G_ANDROID boolean "Android Composite Gadget" - select USB_F_ACM + select USB_G_ANDROID_REQ_F_ACM select USB_LIBCOMPOSITE - select USB_U_SERIAL help The Android Composite Gadget supports multiple USB functions: adb, acm, mass storage, mtp, accessory @@ -880,8 +995,7 @@ config USB_ANDROID_RNDIS_DWORD_ALIGNED config USB_G_SLP boolean "SLP Composite Gadget (similar to Android)" - select USB_F_ACM - select USB_U_SERIAL + select USB_G_SLP_REQ_F_ACM select USB_LIBCOMPOSITE help The SLP gadget driver supports multiple USB functions. @@ -895,9 +1009,8 @@ if TTY config USB_CDC_COMPOSITE tristate "CDC Composite Device (Ethernet and ACM)" depends on NET - select USB_LIBCOMPOSITE - select USB_U_SERIAL - select USB_F_ACM + depends on USB_LIBCOMPOSITE + select USB_G_CDC_COMPOSITE_REQ_F_ACM help This driver provides two functions in one configuration: a CDC Ethernet (ECM) link, and a CDC ACM (serial port) link. @@ -912,9 +1025,8 @@ config USB_CDC_COMPOSITE config USB_G_NOKIA tristate "Nokia composite gadget" depends on PHONET - select USB_LIBCOMPOSITE - select USB_U_SERIAL - select USB_F_ACM + depends on USB_LIBCOMPOSITE + select USB_G_NOKIA_REQ_F_ACM help The Nokia composite gadget provides support for acm, obex and phonet in only one composite gadget driver. @@ -925,9 +1037,8 @@ config USB_G_NOKIA config USB_G_ACM_MS tristate "CDC Composite Device (ACM and mass storage)" depends on BLOCK - select USB_LIBCOMPOSITE - select USB_U_SERIAL - select USB_F_ACM + depends on USB_LIBCOMPOSITE + select USB_G_ACM_MS_REQ_F_ACM help This driver provides two functions in one configuration: a mass storage, and a CDC ACM (serial port) link. @@ -939,9 +1050,8 @@ config USB_G_MULTI tristate "Multifunction Composite Gadget" depends on BLOCK && NET select USB_G_MULTI_CDC if !USB_G_MULTI_RNDIS - select USB_LIBCOMPOSITE - select USB_U_SERIAL - select USB_F_ACM + depends on USB_LIBCOMPOSITE + select USB_G_MULTI_REQ_F_ACM help The Multifunction Composite Gadget provides Ethernet (RNDIS and/or CDC Ethernet), mass storage and ACM serial link @@ -984,7 +1094,7 @@ endif # TTY config USB_G_HID tristate "HID Gadget" - select USB_LIBCOMPOSITE + depends on USB_LIBCOMPOSITE help The HID gadget driver provides generic emulation of USB Human Interface Devices (HID). @@ -999,7 +1109,7 @@ config USB_G_HID config USB_G_DBGP tristate "EHCI Debug Device Gadget" depends on TTY - select USB_LIBCOMPOSITE + depends on USB_LIBCOMPOSITE help This gadget emulates an EHCI Debug device. This is useful when you want to interact with an EHCI Debug Port. @@ -1032,7 +1142,7 @@ endif config USB_G_WEBCAM tristate "USB Webcam Gadget" depends on VIDEO_DEV - select USB_LIBCOMPOSITE + depends on USB_LIBCOMPOSITE select VIDEOBUF2_VMALLOC help The Webcam Gadget acts as a composite USB Audio and Video Class @@ -1042,7 +1152,7 @@ config USB_G_WEBCAM Say "y" to link the driver statically, or "m" to build a dynamically linked module called "g_webcam". -endchoice +endmenu config USB_CORE_IP_293A boolean "usb core ip version (synophsys)" -- 2.7.4 From 40fc7e74c62937f0c24b89ca4c9bc8099734d471 Mon Sep 17 00:00:00 2001 From: Krzysztof Opasiak Date: Thu, 1 Sep 2016 18:49:43 +0200 Subject: [PATCH 05/16] Update config for TM1 board due to changes in Kconfig Just a simple update due to changes in Kconfig of usb gadget subsystem. Change-Id: I21f96fd9ac826efe8bb056a67f0bba62643f13c8 Signed-off-by: Krzysztof Opasiak --- arch/arm/configs/tizen_tm1_defconfig | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/arm/configs/tizen_tm1_defconfig b/arch/arm/configs/tizen_tm1_defconfig index 86bc0ab..a656cde 100755 --- a/arch/arm/configs/tizen_tm1_defconfig +++ b/arch/arm/configs/tizen_tm1_defconfig @@ -2534,6 +2534,15 @@ CONFIG_USB_SPRD_DWC=y # CONFIG_USB_SPRD_SWITCH is not set CONFIG_USB_LIBCOMPOSITE=y CONFIG_USB_F_ACM=y +CONFIG_USB_G_SLP_REQ_F_ACM=y +CONFIG_USB_F_ACM_SELECTOR=y +CONFIG_USB_U_SERIAL=y +CONFIG_USB_F_ACM_REQ_U_SERIAL=y +CONFIG_USB_U_SERIAL_SELECTOR=y + +# +# Legacy USB Gadget Drivers +# CONFIG_USB_HOST_NOTIFY=y CONFIG_USB_NOTIFY_LAYER=y CONFIG_USB_NOTIFIER=y @@ -2550,7 +2559,6 @@ CONFIG_USB_EXTERNAL_DETECT=y # CONFIG_USB_G_PRINTER is not set # CONFIG_USB_G_ANDROID is not set CONFIG_USB_G_SLP=y -CONFIG_USB_DUN_SUPPORT=y # CONFIG_USB_CDC_COMPOSITE is not set # CONFIG_USB_G_ACM_MS is not set # CONFIG_USB_G_MULTI is not set @@ -2561,6 +2569,7 @@ CONFIG_USB_CORE_IP_293A=y # CONFIG_SPRD_USB_DEVICE_ONLY is not set # CONFIG_SHARK_PAD_HW_V102 is not set # CONFIG_USB_INTERRUPT_BY_MUIC is not set +CONFIG_USB_DUN_SUPPORT=y CONFIG_MMC=y # CONFIG_MMC_DEBUG is not set CONFIG_MMC_UNSAFE_RESUME=y -- 2.7.4 From 42136c50c98e4d374f56a5d4fb772f5e1198c53a Mon Sep 17 00:00:00 2001 From: Krzysztof Opasiak Date: Fri, 2 Sep 2016 12:52:40 +0200 Subject: [PATCH 06/16] Build dummy_hcd and g_ffs as a modules Change-Id: Ic505dd282eaf2740848fddbb98678d8fb147be1e Signed-off-by: Krzysztof Opasiak --- arch/arm/configs/tizen_tm1_defconfig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm/configs/tizen_tm1_defconfig b/arch/arm/configs/tizen_tm1_defconfig index a656cde..2498a75 100755 --- a/arch/arm/configs/tizen_tm1_defconfig +++ b/arch/arm/configs/tizen_tm1_defconfig @@ -2528,7 +2528,7 @@ CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2 # CONFIG_USB_MV_U3D is not set # CONFIG_USB_M66592 is not set # CONFIG_USB_NET2272 is not set -# CONFIG_USB_DUMMY_HCD is not set +CONFIG_USB_DUMMY_HCD=m CONFIG_USB_GADGET_SPRD_DWC=y CONFIG_USB_SPRD_DWC=y # CONFIG_USB_SPRD_SWITCH is not set @@ -2552,7 +2552,10 @@ CONFIG_USB_EXTERNAL_DETECT=y # CONFIG_USB_ETH is not set # CONFIG_USB_G_NCM is not set # CONFIG_USB_GADGETFS is not set -# CONFIG_USB_FUNCTIONFS is not set +CONFIG_USB_FUNCTIONFS=m +# CONFIG_USB_FUNCTIONFS_ETH is not set +# CONFIG_USB_FUNCTIONFS_RNDIS is not set +CONFIG_USB_FUNCTIONFS_GENERIC=y # CONFIG_USB_MASS_STORAGE is not set # CONFIG_USB_G_SERIAL is not set # CONFIG_USB_MIDI_GADGET is not set -- 2.7.4 From 4d0695a9e94f1e5979b4f56026ca589846b9afe0 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Mon, 5 Sep 2016 10:52:21 +0900 Subject: [PATCH 07/16] usb: gadget: f_fs: remove build warnings from ffs_epfile_io This patch removes build warnings to convert unsigned int pointer to char pointer from ffs_epfile_io(). Change-Id: I2b46093add10c647f3488220b123e3920a1cfeb4 Signed-off-by: Seung-Woo Kim --- drivers/usb/gadget/f_fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 1b35dea..250fc8a 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c @@ -772,9 +772,9 @@ static ssize_t ffs_epfile_io(struct file *file, int halt; if(read) - data = &recv_buffer[8]; + data = (char *)&recv_buffer[8]; else - data = &send_buffer[8]; + data = (char *)&send_buffer[8]; goto first_try; do { spin_unlock_irq(&epfile->ffs->eps_lock); -- 2.7.4 From 5064dad740bb7e17d810f55df540e837fff99969 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 7 Sep 2016 14:53:43 +0900 Subject: [PATCH 08/16] Input: ist30xxc: remove touch event log This patch removes touch event log. Change-Id: I4a3ec5ccaf8455a48a8f67769c2056162a97c4de Signed-off-by: Seung-Woo Kim Signed-off-by: Andi Shyti --- drivers/input/touchscreen/imagis_30xxc/ist30xxc.c | 50 ++--------------------- 1 file changed, 3 insertions(+), 47 deletions(-) diff --git a/drivers/input/touchscreen/imagis_30xxc/ist30xxc.c b/drivers/input/touchscreen/imagis_30xxc/ist30xxc.c index 09c93fa..4aa0fff 100644 --- a/drivers/input/touchscreen/imagis_30xxc/ist30xxc.c +++ b/drivers/input/touchscreen/imagis_30xxc/ist30xxc.c @@ -402,19 +402,7 @@ void print_tsp_event(struct ist30xx_data *data, finger_info *finger) /* touch down */ data->touch_pressed_num++; data->press_finger_cnt++; - tsp_noti("P [%d] x=%d y=%d z=%d\n", - idx, - finger->bit_field.x, - finger->bit_field.y, - finger->bit_field.area); data->tsp_touched[idx] = true; - } else { - /* touch move */ - tsp_debug("M [%d] x=%d y=%d z=%d\n", - idx, - finger->bit_field.x, - finger->bit_field.y, - finger->bit_field.area); } data->lx[idx] = finger->bit_field.x; @@ -427,13 +415,6 @@ void print_tsp_event(struct ist30xx_data *data, finger_info *finger) #ifdef CONFIG_SLEEP_MONITOR data->release_cnt++; #endif - tsp_noti("R [%d] x=%d y=%d z=%d c=%d v=0x%04x\n", - idx, - data->lx[idx], - data->ly[idx], - finger->bit_field.area, - data->press_cnt[idx], - data->fw.cur.fw_ver); data->tsp_touched[idx] = false; data->press_cnt[idx] = 0; if(data->press_finger_cnt > 0) @@ -452,17 +433,13 @@ void print_tkey_event(struct ist30xx_data *data, int id) bool press = PRESSED_KEY(data->t_status, id); if (press) { - if (tkey_pressed[idx] == false) { + if (tkey_pressed[idx] == false) /* tkey down */ - tsp_noti("k %s%d\n", TOUCH_DOWN_MESSAGE, id); tkey_pressed[idx] = true; - } } else { - if (tkey_pressed[idx] == true) { + if (tkey_pressed[idx] == true) /* tkey up */ - tsp_noti("k %s%d\n", TOUCH_UP_MESSAGE, id); tkey_pressed[idx] = false; - } } } #endif @@ -673,13 +650,9 @@ static irqreturn_t ist30xx_irq_thread(int irq, void *ptr) ms = get_milli_second(); if (intr_debug_addr >= 0 && intr_debug_size > 0) { - tsp_noti("Intr_debug (addr: 0x%08x)\n", intr_debug_addr); ist30xx_burst_read(data->client, IST30XX_DA_ADDR(intr_debug_addr), &msg[0], intr_debug_size, true); - for (i = 0; i < intr_debug_size; i++) - tsp_noti("\t%08x\n", msg[i]); - tracking_intr_debug_value = TRACKING_INTR_DEBUG1_VALID; ist30xx_put_track_ms(ms); ist30xx_put_track(&tracking_intr_debug_value, 1); @@ -687,13 +660,9 @@ static irqreturn_t ist30xx_irq_thread(int irq, void *ptr) } if (intr_debug2_addr >= 0 && intr_debug2_size > 0) { - tsp_noti("Intr_debug2 (addr: 0x%08x)\n", intr_debug2_addr); ist30xx_burst_read(data->client, IST30XX_DA_ADDR(intr_debug2_addr), &msg[0], intr_debug2_size, true); - for (i = 0; i < intr_debug2_size; i++) - tsp_noti("\t%08x\n", msg[i]); - tracking_intr_debug_value = TRACKING_INTR_DEBUG2_VALID; ist30xx_put_track_ms(ms); ist30xx_put_track(&tracking_intr_debug_value, 1); @@ -707,8 +676,6 @@ static irqreturn_t ist30xx_irq_thread(int irq, void *ptr) if (unlikely(ret)) goto irq_err; - tsp_verb("intr msg: 0x%08x\n", *msg); - /* TSP IC Exception */ if (unlikely((*msg & IST30XX_EXCEPT_MASK) == IST30XX_EXCEPT_VALUE)) { tsp_err("Occured IC exception(0x%02X)\n", *msg & 0xFF); @@ -826,15 +793,8 @@ static irqreturn_t ist30xx_irq_thread(int irq, void *ptr) data->z_values, finger_cnt, true); } - if (data->track_enable) { - + if (data->track_enable) ist30xx_put_track(msg + offset, finger_cnt); - for (i = 0; i < finger_cnt; i++) { - tsp_verb("intr msg(%d): 0x%08x, %d\n", - i + offset, msg[i + offset], data->z_values[i]); - } - - } } read_cnt = finger_cnt + 1; @@ -859,13 +819,9 @@ static irqreturn_t ist30xx_irq_thread(int irq, void *ptr) if (data->track_enable) { if (intr_debug3_addr >= 0 && intr_debug3_size > 0) { - tsp_noti("Intr_debug3 (addr: 0x%08x)\n", intr_debug3_addr); ist30xx_burst_read(data->client, IST30XX_DA_ADDR(intr_debug3_addr), &msg[0], intr_debug3_size, true); - for (i = 0; i < intr_debug3_size; i++) - tsp_noti("\t%08x\n", msg[i]); - tracking_intr_debug_value = TRACKING_INTR_DEBUG3_VALID; ist30xx_put_track_ms(ms); ist30xx_put_track(&tracking_intr_debug_value, 1); -- 2.7.4 From 21312b8e2fc715ceb13e216bd83e63ec646dce15 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 7 Sep 2016 14:56:10 +0900 Subject: [PATCH 09/16] Input: sprd_eic_keys: remove event log This patch removes event log. Change-Id: Iaeeaab3c71d3513edd3af51df5dbb870099fecd2 Signed-off-by: Seung-Woo Kim Signed-off-by: Andi Shyti --- drivers/input/keyboard/sprd_eic_keys.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/input/keyboard/sprd_eic_keys.c b/drivers/input/keyboard/sprd_eic_keys.c index 56f33ff..077d254 100644 --- a/drivers/input/keyboard/sprd_eic_keys.c +++ b/drivers/input/keyboard/sprd_eic_keys.c @@ -101,7 +101,6 @@ static irqreturn_t sprd_eic_irq_handle(int irq, void *dev_id) #endif input_report_key(this_pdata->input_dev, button->code, button_state_current); input_sync(this_pdata->input_dev); - PRINT_INFO("[P] %s\n", button->desc); if(1 == button->active_low) irq_set_irq_type(button->irq, IRQF_TRIGGER_HIGH); @@ -117,7 +116,6 @@ static irqreturn_t sprd_eic_irq_handle(int irq, void *dev_id) #endif input_report_key(this_pdata->input_dev, button->code, button_state_current); input_sync(this_pdata->input_dev); - PRINT_INFO("[R] %s\n", button->desc); if(1 == button->active_low) irq_set_irq_type(button->irq, IRQF_TRIGGER_LOW); -- 2.7.4 From 84a320692118483a871d97e90b9292e3f0b18bc4 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 7 Sep 2016 15:07:44 +0900 Subject: [PATCH 10/16] Input: sc_keypad: remove event log This patch removes key event log. Change-Id: I3cbe04efcd4e16b30616c59f96a30cafa72b6827 Signed-off-by: Seung-Woo Kim Signed-off-by: Andi Shyti --- drivers/input/keyboard/sc_keypad.c | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/drivers/input/keyboard/sc_keypad.c b/drivers/input/keyboard/sc_keypad.c index 8fdd948..2b5876d 100644 --- a/drivers/input/keyboard/sc_keypad.c +++ b/drivers/input/keyboard/sc_keypad.c @@ -221,8 +221,6 @@ static ssize_t key_show(struct device *dev, struct device_attribute *attr, char else is_key_checked = sprintf(buf, "%s\n", "RELEASE"); - printk("[KEY] Keyshort Press Check ==> keys_pressed : %x\n", keys_pressed); - return is_key_checked; } static ssize_t powerkey_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -233,9 +231,6 @@ static ssize_t powerkey_show(struct device *dev, struct device_attribute *attr, is_key_checked = sprintf(buf, "%s\n", sci_kpd->powerkey_state ? "PRESS" : "RELEASE"); - printk("[KEY] Keyshort Press Check ==> powerKeys_pressed : %ld \n", - sci_kpd->powerkey_state); - return is_key_checked; } @@ -310,25 +305,6 @@ static void dump_keypad_register(void) } #endif -static void sci_keypad_keydbg(unsigned short key, unsigned short state) -{ - const char* key_name[] = {"KEY_VOLUMEUP", "KEY_VOLUMEDOWN",\ - "KEY_HOME", "KEY_POWER", "UNKNOWN"}; - - if (key == KEY_VOLUMEUP) - key = 0; - else if (key == KEY_VOLUMEDOWN) - key = 1; - else if (key == KEY_MENU) - key = 2; - else if (key == KEY_POWER) - key = 3; - else - key = 4; - - printk("%s: [%s] %s\n", __func__, state ? "P":"R", key_name[key]); -} - static int sci_keypad_check_validity(unsigned short key) { if ((key == KEY_VOLUMEUP) || (key == KEY_VOLUMEDOWN) ||\ @@ -356,7 +332,6 @@ static void sci_keypad_report_event(struct sci_keypad_t *sci_kpd, int col, int r input_report_key(sci_kpd->input_dev, key, state); input_sync(sci_kpd->input_dev); sec_debug_check_crash_key(key, state); - sci_keypad_keydbg(key, state); return; } @@ -443,7 +418,6 @@ static irqreturn_t sci_powerkey_isr(int irq, void *dev_id) /* seems an event is missing, just report it */ input_report_key(sci_kpd->input_dev, key, last_value); input_sync(sci_kpd->input_dev); - sci_keypad_keydbg(key, !value); } if (value) { @@ -470,7 +444,6 @@ static irqreturn_t sci_powerkey_isr(int irq, void *dev_id) sec_debug_check_crash_key(key, value); #endif last_value = value; - sci_keypad_keydbg(key, !value); return IRQ_HANDLED; } -- 2.7.4 From f61f53eef2852f35ca9feaaec65a4a8c8ed256ee Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 7 Sep 2016 15:12:48 +0900 Subject: [PATCH 11/16] Input: tc305k: remove event log This patch removes key event log. Change-Id: I86f1967e54be571ab41d6025a1443e3aa2a25fda Signed-off-by: Seung-Woo Kim Signed-off-by: Andi Shyti --- drivers/input/keyboard/coreriver/tc350-touchkey.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/input/keyboard/coreriver/tc350-touchkey.c b/drivers/input/keyboard/coreriver/tc350-touchkey.c index 0d980a7..e834381 100644 --- a/drivers/input/keyboard/coreriver/tc350-touchkey.c +++ b/drivers/input/keyboard/coreriver/tc350-touchkey.c @@ -1954,8 +1954,6 @@ static irqreturn_t tc300k_interrupt(int irq, void *dev_id) goto out; } - dev_dbg(&client->dev, "%s: key_value=[0x%x]\n", __func__, key_val); - for (i = 0 ; i < data->num_key*2; i++) { if ((key_val & data->tsk_ev_val[i].tsk_bitmap)) { input_report_key(data->input_dev, @@ -1964,10 +1962,6 @@ static irqreturn_t tc300k_interrupt(int irq, void *dev_id) if (!data->tsk_ev_val[i].tsk_status) data->release_cnt++; - - dev_info(&client->dev, "%s:[%s] %s\n", __func__, - data->tsk_ev_val[i].tsk_status? "P" : "R", - data->tsk_ev_val[i].tsk_keyname); } } input_sync(data->input_dev); -- 2.7.4 From f510d3e4ccd7dcb769d11e34f4d0cf0474bbcffc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pawe=C5=82=20Szewczyk?= Date: Wed, 7 Sep 2016 21:24:12 +0200 Subject: [PATCH 12/16] usb: gadget: f_fs: add poll for endpoint 0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch adds poll function for file representing ep0. Ability of read from or write to ep0 file is related with actual state of ffs: - When desctiptors or strings are not written yet, POLLOUT flag is set. - If there is any event to read, POLLIN flag is set. - If setup request was read, POLLIN and POLLOUT flag is set, to allow send response (by performing I/O operation consistent with setup request direction) or set stall (by performing I/O operation opposite setup request direction). Signed-off-by: Robert Baldyga Acked-by: Michal Nazarewicz Signed-off-by: Felipe Balbi [Backported from mainline commit 23de91e] Signed-off-by: Paweł Szewczyk Signed-off-by: Krzysztof Opasiak Change-Id: I4286847252357b4796cc3794ce71d5a4ec2af9f5 --- drivers/usb/gadget/f_fs.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 250fc8a..ac03922 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c @@ -27,6 +27,8 @@ #include #include +#include + #define FUNCTIONFS_MAGIC 0xa647361 /* Chosen by a honest dice roll ;) */ @@ -736,6 +738,47 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value) return ret; } +static unsigned int ffs_ep0_poll(struct file *file, poll_table *wait) +{ + struct ffs_data *ffs = file->private_data; + unsigned int mask = POLLWRNORM; + int ret; + + poll_wait(file, &ffs->ev.waitq, wait); + + ret = ffs_mutex_lock(&ffs->mutex, file->f_flags & O_NONBLOCK); + if (unlikely(ret < 0)) + return mask; + + switch (ffs->state) { + case FFS_READ_DESCRIPTORS: + case FFS_READ_STRINGS: + mask |= POLLOUT; + break; + + case FFS_ACTIVE: + switch (ffs->setup_state) { + case FFS_NO_SETUP: + if (ffs->ev.count) + mask |= POLLIN; + break; + + case FFS_SETUP_PENDING: + case FFS_SETUP_CANCELED: + mask |= (POLLIN | POLLOUT); + break; + } + case FFS_CLOSING: + break; + case FFS_DEACTIVATED: + break; + } + + mutex_unlock(&ffs->mutex); + + return mask; +} + static const struct file_operations ffs_ep0_operations = { .llseek = no_llseek, @@ -744,6 +787,7 @@ static const struct file_operations ffs_ep0_operations = { .read = ffs_ep0_read, .release = ffs_ep0_release, .unlocked_ioctl = ffs_ep0_ioctl, + .poll = ffs_ep0_poll, }; -- 2.7.4 From 3e956052b234a4e71570083f3658720b03fb0d6a Mon Sep 17 00:00:00 2001 From: Krzysztof Opasiak Date: Mon, 12 Sep 2016 20:54:59 +0200 Subject: [PATCH 13/16] usb: gadget: fix: Call usb_gadget_connect() for dummy_udc Ugly hack which comes from Android removes a call to usb_gadget_connect() in udc_bind_to_driver() to prevent android/slp gadget from communication before userspace explicitly enables it. Mainline gadgets (like g_ffs) expect this function to be called as they don't have any sysfs interface to enable them later. As for usb-host API tests we need to use dummy_hcd and g_ffs let's call usb_gadget_connect() for all dummy_udc's. Change-Id: I782bbb51c54e0b87ff6ef976070b6d8870a1a745 Signed-off-by: Krzysztof Opasiak --- drivers/usb/gadget/udc-core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index 58a8613..63b6a76 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c @@ -342,8 +342,13 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct usb_gadget_driver *dri * the call to usb_gadget_connect bellow to avoid enabling the * pullup before userspace is ready. * - * usb_gadget_connect(udc->gadget); + * HACK: Apart from android and slp gadget we would like to use + * also standard mainline gadgets with dummy_hcd. Those gadgets + * expects to be connected right after bind(). */ + if (strstr(dev_name(&udc->dev), "dummy_udc") != NULL) + usb_gadget_connect(udc->gadget); + kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE); return 0; -- 2.7.4 From d1c4eebbacfc178fa31475d5c9a0021913af43fe Mon Sep 17 00:00:00 2001 From: Krzysztof Opasiak Date: Mon, 12 Sep 2016 22:23:26 +0200 Subject: [PATCH 14/16] usb: gadget: g_ffs: Allow to set configuration string usb host tests expect configuration string to have a predefined value. As on 3.10 kernel we cannot use ConfigFS to achieve this let's add a module parameter which allows us to set it. Change-Id: I7556ef87fb4da7ae1f86fa4f110f78ffd5d2b854 Signed-off-by: Krzysztof Opasiak --- drivers/usb/gadget/g_ffs.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 787a78e..6576186 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c @@ -124,11 +124,19 @@ static struct usb_string gfs_strings[] = { { .s = "FunctionFS + ECM" }, #endif #ifdef CONFIG_USB_FUNCTIONFS_GENERIC - { .s = "FunctionFS" }, + { }, /* set dynamically based on module param */ #endif { } /* end of list */ }; +#ifdef CONFIG_USB_FUNCTIONFS_GENERIC +static char *generic_ffs_config_str = "FunctionFS"; +module_param_named(generic_ffs_config_str, + generic_ffs_config_str, + charp, S_IRUGO); +MODULE_PARM_DESC(generic_ffs_config_str, + "Configuration string of generic FFS config"); +#endif static struct usb_gadget_strings *gfs_dev_strings[] = { &(struct usb_gadget_strings) { .language = 0x0409, /* en-us */ @@ -186,6 +194,14 @@ static int __init gfs_init(void) ENTER(); +#ifdef CONFIG_USB_FUNCTIONFS_GENERIC + /* Find first (but not last) config with a NULL str */ + for (i = 0; i < ARRAY_SIZE(gfs_strings) - 1 ; ++i) + if (!gfs_strings[i].s) { + gfs_strings[i].s = generic_ffs_config_str; + break; + } +#endif if (!func_num) { gfs_single_func = true; func_num = 1; -- 2.7.4 From b547e39d1482eeccf5a2b8f63151d2eb187aa85d Mon Sep 17 00:00:00 2001 From: Krzysztof Opasiak Date: Mon, 12 Sep 2016 22:19:31 +0200 Subject: [PATCH 15/16] usb: gadget: g_ffs: Allow to set bmAttributes of configuration usb host tests expect configuration bmAttributes to have a predefined value. As on 3.10 kernel we cannot use ConfigFS to achieve this let's add a module parameter which allows us to set it. Change-Id: Iecf773d98c398ce1d3c529e7202155fb1e5e9ba6 Signed-off-by: Krzysztof Opasiak --- drivers/usb/gadget/g_ffs.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 6576186..ee513fb 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c @@ -137,6 +137,13 @@ module_param_named(generic_ffs_config_str, MODULE_PARM_DESC(generic_ffs_config_str, "Configuration string of generic FFS config"); #endif + +static int bmAttrs_overwrite = -1; + +module_param_named(bmAttrs_overwrite, bmAttrs_overwrite, int, 0644); +MODULE_PARM_DESC(bmAttrs_overwrite, + "Overwrite default bmAttrributes value. -1 to use default."); + static struct usb_gadget_strings *gfs_dev_strings[] = { &(struct usb_gadget_strings) { .language = 0x0409, /* en-us */ @@ -202,6 +209,11 @@ static int __init gfs_init(void) break; } #endif + if (bmAttrs_overwrite > 255) { + pr_info("Invalid value of bmAttributes for configs."); + return -EINVAL; + } + if (!func_num) { gfs_single_func = true; func_num = 1; @@ -395,7 +407,9 @@ static int gfs_bind(struct usb_composite_dev *cdev) c->c.label = gfs_strings[sid].s; c->c.iConfiguration = gfs_strings[sid].id; c->c.bConfigurationValue = 1 + i; - c->c.bmAttributes = USB_CONFIG_ATT_SELFPOWER; + c->c.bmAttributes = bmAttrs_overwrite >= 0 ? + (unsigned char)bmAttrs_overwrite + : USB_CONFIG_ATT_SELFPOWER; ret = usb_add_config(cdev, &c->c, gfs_do_config); if (unlikely(ret < 0)) @@ -456,7 +470,7 @@ static int gfs_do_config(struct usb_configuration *c) if (missing_funcs) return -ENODEV; - if (gadget_is_otg(c->cdev->gadget)) { + if (gadget_is_otg(c->cdev->gadget) && bmAttrs_overwrite < 0) { c->descriptors = gfs_otg_desc; c->bmAttributes |= USB_CONFIG_ATT_WAKEUP; } -- 2.7.4 From 9807397c2e1c82653b1df12f5022f138b298d6f4 Mon Sep 17 00:00:00 2001 From: jooseong lee Date: Tue, 20 Sep 2016 19:36:24 +0900 Subject: [PATCH 16/16] ARM: tizen_tm1_defconfig: disable smack_netfilter temporarily smack_netfilter was enabled to check network permission in Nether. But it makes unintended Smack denial issue. For stability, we disable smack_netfilter temporarily untill fixing the problem. Change-Id: I63636e6bda95c35976c0fed5c49ff6bf359aa657 Signed-off-by: jooseong lee --- arch/arm/configs/tizen_tm1_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/configs/tizen_tm1_defconfig b/arch/arm/configs/tizen_tm1_defconfig index 2498a75..d54a70c 100755 --- a/arch/arm/configs/tizen_tm1_defconfig +++ b/arch/arm/configs/tizen_tm1_defconfig @@ -3439,7 +3439,7 @@ CONFIG_SECURITY_NETWORK=y # CONFIG_SECURITY_PATH is not set # CONFIG_SECURITY_SELINUX is not set CONFIG_SECURITY_SMACK=y -CONFIG_SECURITY_SMACK_NETFILTER=y +# CONFIG_SECURITY_SMACK_NETFILTER is not set # CONFIG_SECURITY_TOMOYO is not set # CONFIG_SECURITY_APPARMOR is not set # CONFIG_SECURITY_YAMA is not set -- 2.7.4