Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1843500ybz; Thu, 23 Apr 2020 07:01:38 -0700 (PDT) X-Google-Smtp-Source: APiQypJU+yT2lnh10fntSV/lhaHc9/eZcFaOeiBM1j8pNHxJwt/sfETsgGERyYkch888aNAZDCpy X-Received: by 2002:aa7:c38a:: with SMTP id k10mr2850655edq.74.1587650498310; Thu, 23 Apr 2020 07:01:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587650498; cv=none; d=google.com; s=arc-20160816; b=dpebY4d2owVilQNV9RYgFSKHd5r42Tvoao9sk145DF//G5hY1Sz/bTfte3fCTogOCP Q5KMajFZIrg5rNibpunz5wyfKToCxWzTI0Qbm7hztlw3mTYLGiCJbaR1QpEn0+8nA5pi 3SEg1rWE47s0RbOJwuex6NLQH+u4arQJmtkdkuomsrdVk74HB8Jfo6nK6S0v4gmrCfyx oUyyGv4Id3xxNQDZfG9MKuAqilJyMa7CnJFe1dAiNrTE06N88mjAgpSEMSgo/w5ZwwU6 v0q8C9EyPMsM1zRZeYe9wbuEk2BeD6Eftjr8A9F7FpP55HPAoxog4QmAkpvAYztv8mYY IP1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=32DkuINxmGb0Gh3Yn0zcdCa7UHTz4GuphAt8o/QOmXw=; b=XAaZFLnmRcWk7cn8u5Sf5swkCFV1PrFzZ8+m+yHY6qLL0rEYFjBP8Hf7VLKbmM+tuQ v6QK5Oeg4ZMBstu1FZR1gNnRHrg6ZKB8k7XK0Kfqw5NU/yx5ydsjOHCXUL37ET3jaffp Kecdj2vqRKdy+LDQYPUf1ahl7cK7cEVw68gHg65tpREKvCPM3PrMhXId/HBCa7zzdRp6 Zg66FI7PPQDDHHM34E5w+9lM00whGRPgfSQuwaAxif4xxefQ4pwp+zrM9VD8DcrOGD2B mYHGbBQLnq197qpUic9whBVd298RJZU3+fctmpR0Ura87MTTC5VUMv/XmpMnId6FmxWZ Sm5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=MDjRu9lm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 30si1313920edr.255.2020.04.23.07.01.05; Thu, 23 Apr 2020 07:01:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=MDjRu9lm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728241AbgDWL40 (ORCPT + 99 others); Thu, 23 Apr 2020 07:56:26 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:34623 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728197AbgDWL4Z (ORCPT ); Thu, 23 Apr 2020 07:56:25 -0400 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03NBrJ4n027364; Thu, 23 Apr 2020 13:56:15 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=STMicroelectronics; bh=32DkuINxmGb0Gh3Yn0zcdCa7UHTz4GuphAt8o/QOmXw=; b=MDjRu9lmwq13W44Bf+SYWnQbzlxhBnm8ekXRN0vdPB4oA1IaZM6jEzHNUIqMFS6ClLPr SL6UiDPpShLk/mN8pf9nJG2LY5zFXos21jsP4/cZilGnW8dNMa29t9YPw7n1ZFTstrY/ UfjHXccPeNmsFblASLU0A53aYuoz5fqI3IgkOZ9aJFuMU8ddaMNGGy64lJCRj7I01iCa J0dIyX1RW/XrN6WSj2jikaUPR5wcA7xjboTx6yjvYAaDYe57I3DI7h38w7UmJ+LeNPRZ Y5DjZGEyaSBAmlUXvuBaMfDXA+y58aLxZVZbmR4O4sx95hscO0mWlaKzEhIZlWOUUW1n Ww== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 30fqawmghn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Apr 2020 13:56:15 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id EE800100039; Thu, 23 Apr 2020 13:56:14 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag5node3.st.com [10.75.127.15]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id D7D292BC7CE; Thu, 23 Apr 2020 13:56:14 +0200 (CEST) Received: from localhost (10.75.127.47) by SFHDAG5NODE3.st.com (10.75.127.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 23 Apr 2020 13:56:14 +0200 From: Fabrice Gasnier To: , , CC: , , , , Subject: [PATCH v2 0/4] usb: gadget: serial: add supend resume support Date: Thu, 23 Apr 2020 13:55:52 +0200 Message-ID: <1587642956-8157-1-git-send-email-fabrice.gasnier@st.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG1NODE3.st.com (10.75.127.3) To SFHDAG5NODE3.st.com (10.75.127.15) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-23_07:2020-04-22,2020-04-23 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series handles an issue seen when doing basic testing using ACM or SERIAL gadget functions like in [1], and using the DWC2 gadget driver. It occurs when the HOST has suspended the bus before testing, in this order: - On the device: cat /dev/ttyGS Dmesg error log is seen on device side: configfs-gadget gadget: acm ttyGS0 can't notify serial state, -11 - On the host: echo test > /dev/ttyACM The bus resumes, but the serial link isn't functional. So, implement suspend/resume callbacks in gadget serial drivers to handle this. There is a precursor patch in DWC2 to enable submitting usb requests from the gadget resume routine, once in L0 state. [1] https://www.kernel.org/doc/html/latest/usb/gadget-testing.html#testing-the-acm-function Changes in v2: - update dwc2 with Minas suggestions Fabrice Gasnier (4): usb: dwc2: gadget: move gadget resume after the core is in L0 state usb: gadget: u_serial: add suspend resume callbacks usb: gadget: f_serial: add suspend resume callbacks usb: gadget: f_acm: add suspend resume callbacks drivers/usb/dwc2/core_intr.c | 7 +++-- drivers/usb/gadget/function/f_acm.c | 16 ++++++++++ drivers/usb/gadget/function/f_serial.c | 16 ++++++++++ drivers/usb/gadget/function/u_serial.c | 57 +++++++++++++++++++++++++++++----- drivers/usb/gadget/function/u_serial.h | 2 ++ 5 files changed, 88 insertions(+), 10 deletions(-) -- 2.7.4