From patchwork Wed Jul 12 08:22:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 118959 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1007986vqm; Wed, 12 Jul 2023 01:56:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlHs/mwTd6L1BTuM7RagAMNysOZBjSdzyrdGP5fUGmeJwFi8kLuB2F5pvIoisMgyJzsd5qmF X-Received: by 2002:a05:6358:341a:b0:135:46d9:12f7 with SMTP id h26-20020a056358341a00b0013546d912f7mr16547261rwd.26.1689152192581; Wed, 12 Jul 2023 01:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689152192; cv=none; d=google.com; s=arc-20160816; b=xBbCcItM+gBAuHZwJQEDa3q/eJ0s6cArjOUL82suEfszZqwFSYts/5zRnykGXYZ2PO WFup7eDG2JP5JEdEBu0mWAakLmYBI+DZ/kl9ih4XuRVjxrID3kV96khtd1CWGczi8Zpn FDTw6qT5Z6zwjTFwAo7qEdGnh/OhuTMc6yuYpa9NW5phZNHM4BSFHbWLVSSWB/CqadQs ESzAkL9sY5IeGf/p5EzNiTJJoRIxpFT7doRnvtBKoIapDyRgld2nQUW0RWSnfFhVx+TT OmI6JcBthKaMRMBFn/wLoQnp+PX4RaILVbE1ClxLLl1G527aYPJCeIZ3QqoA6KI6GozX dfjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hVzf/h1iQ+R3J36zD1MxGrCE/cAMVqwUd+PVOholWlg=; fh=UtPIuTGaqaJJ37a+crxvtis5z5d56DzPHGVb5d0pt54=; b=hTq6IchbkNvTQsQObzWicUxyw5S3nVUKukYu4qRgSjzCdM9svT4HMNqH3RoMLviD40 ciOi7jnmKIQ01NGqka5kyASu9ytCNtNsjKjuGZgWqlB2Wk1rycysEz3zZ72XvXuAXaa3 THQDWJgMpEISwPcoyiFEdmMEA7y4smbWLjHU0Gg6heh/sP6SlqMsK1+2qQK0+QgR0YHM yL9jR162B/d/kLL8UlbV6M8YdBv8zwxussccrwOT0V7AD5gCRx3UTBhXn7DLndJSBFKK rDnGt9MyKniFJX0ecIIaCLcciclgDjiN/+RVtdCBBXCupZCu1clrkwoIGgrxMif6o5jE /SKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=p04CaScv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 69-20020a630048000000b005428de93a2bsi2789735pga.863.2023.07.12.01.56.19; Wed, 12 Jul 2023 01:56:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=p04CaScv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232461AbjGLI2b (ORCPT + 99 others); Wed, 12 Jul 2023 04:28:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232819AbjGLI2E (ORCPT ); Wed, 12 Jul 2023 04:28:04 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB6C22D6A; Wed, 12 Jul 2023 01:23:10 -0700 (PDT) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36C6ScJ7013338; Wed, 12 Jul 2023 08:23:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=hVzf/h1iQ+R3J36zD1MxGrCE/cAMVqwUd+PVOholWlg=; b=p04CaScvNvCruN5VQ4vqQxEKZlJNNUsceYXz+uq6aQKQDbK+aoqFVF7kV9+sAjeQ0C2g K4FYfliJLHC8A7uJOh2u+kJjf0KwFi+P1Vp+6V/2LibOcxwohwDjXDhGJNiPCeL87y5g NwkRq5nKKl+oxhY0ZgO4c0RPpoGq0Y7hcOUEXxu6KnTAtFTN9pSkOLifv78JRwhNqWNc DB3ZXHg4tbTZxBTaaSKziH+BHRYKsD7+Us/wp33l6z1r/UyB8OP2+ubeqbEBW0H5WtWe FvhwecTVEnKuO/5Yt16SpD3Tildd7T4AMvrCqZch9wVsINWc+YJjM1LDAkoDmmYOOZwO 1Q== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rsfeq0x7r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jul 2023 08:23:04 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 36C8N3lX014311 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jul 2023 08:23:03 GMT Received: from hu-schowdhu-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 12 Jul 2023 01:22:59 -0700 From: Souradeep Chowdhury To: , , Andy Gross , Konrad Dybcio , "Bjorn Andersson" , CC: , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V1 1/3] usb: misc: Add the interface for notifier call for Embedded USB Debugger(EUD) Date: Wed, 12 Jul 2023 13:52:38 +0530 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: HmumV-VRMaraD9yASJM1jw0BP7fj7PtJ X-Proofpoint-GUID: HmumV-VRMaraD9yASJM1jw0BP7fj7PtJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-12_05,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 malwarescore=0 spamscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=599 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307120073 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771204449676699792 X-GMAIL-MSGID: 1771204449676699792 Add the interface for notifier calls that can be made to check the role switch status of EUD. An external module can import this file and use the wrapper functions eud_register_notify to register a notifier to the EUD notifier chain, eud_unregister_notify to unregister the notifier from the chain, eud_notifier_call_chain to call the notifier chain to check the status of role-switch. These interfaces are provided to handle the case where multiple modules might go for a role-switch on the same port in which case EUD will be given priority over the rest. Signed-off-by: Souradeep Chowdhury --- drivers/usb/misc/qcom_eud_notifier.h | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 drivers/usb/misc/qcom_eud_notifier.h diff --git a/drivers/usb/misc/qcom_eud_notifier.h b/drivers/usb/misc/qcom_eud_notifier.h new file mode 100644 index 000000000000..0cae42a5f6bf --- /dev/null +++ b/drivers/usb/misc/qcom_eud_notifier.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Released under the GPLv2 only. + */ + +#include + +extern int eud_register_notify(struct notifier_block *nb); +extern void eud_unregister_notify(struct notifier_block *nb); +extern void eud_notifier_call_chain(unsigned long role_switch_state); From patchwork Wed Jul 12 08:22:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 118953 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1006529vqm; Wed, 12 Jul 2023 01:52:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlEAjVffk6jdjyJa55Y4is5026CVhqQmdJiTRiH4uaar7DtKcE4sI4IpsW7RkkYOaCqT8j1Y X-Received: by 2002:a05:6a00:1399:b0:682:616a:f910 with SMTP id t25-20020a056a00139900b00682616af910mr23019972pfg.20.1689151978521; Wed, 12 Jul 2023 01:52:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689151978; cv=none; d=google.com; s=arc-20160816; b=Qig8WQ7ABhnGoyGmuLYmOOUocxNw6GYofG99vvC+QWO3lPsUNGmsiVwjeMX6qi1fo3 g8B6LUsO0UwBJ+FwRby6wjnyGyMfkvCz6SMdvTUIeTpDVMj6Ibbyl0iamWpd/hxxGi+W +yaA1Z9LjFyW/PCV73V4QKqmzhm6947f18O2GbJi1MUiBrIfiAe+up5I1MAEuZPAnnKP 3OX4gIRB/rBnJT4cPY/cNvJYJaxBtaxfLEQgUCudYFgBW8KVtRjLSgwXia5ORmIWzbpM WStk+GcccWb7Rw9LvmBeIre8DyakTxD5UaxVnpFYOogN9BNSCz1B7UT/Fj3zfJt9Q1vH h9Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=40o+X8oKsX81WIYXOnfFG7rcPkNuQsSlDf08s1f+OFU=; fh=UtPIuTGaqaJJ37a+crxvtis5z5d56DzPHGVb5d0pt54=; b=r30hoCDQyoY1Jc3bM1hPx/gNTAjCXIbX7jkYAZuWkuIywqpUD2gkNXuNCxSA9j5PbO zKcE5PbPZ9FSJpWFDpZFn4NQzEOkz7elN6m30htsLt/G4b2lIfNy4jpJqSEquL3AjzUW pcleyPg1XerOLmJZhQBrHiFvs/iuGraUpqz2NxkM4q44P4t+NeLlKXXM+FWHExAqB9Lf WZm7RWFOmAzJxLYdpfo5IxS3/YxHZFcgR+2S3+YDb6HrzZC531VSn68W9NOV2+fg2xhs 3/vgw42UMRjLDMHOPOg8XDwZTFNDxlSxnwqH6MsOgRssONBSa+J2k3ZKAO/wZTt8tcdg QU1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=lbf3kT8W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020a056a00190b00b006824cda542fsi2855719pfi.395.2023.07.12.01.52.45; Wed, 12 Jul 2023 01:52:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=lbf3kT8W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232606AbjGLI2f (ORCPT + 99 others); Wed, 12 Jul 2023 04:28:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232876AbjGLI2H (ORCPT ); Wed, 12 Jul 2023 04:28:07 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 028101993; Wed, 12 Jul 2023 01:23:15 -0700 (PDT) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36C3mOZR032181; Wed, 12 Jul 2023 08:23:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=40o+X8oKsX81WIYXOnfFG7rcPkNuQsSlDf08s1f+OFU=; b=lbf3kT8WLHSNf58d+2fYPsgT/rfIM4BtAjGJ57ivrWQTbA9emg/XLa4X1BnEpQEge76+ YaaXlhf8J/eXsLXPJIlek2vuJRlUoyuHC0HnOu1twbU1yjzNuIKkEvNaj3BYFyBK6mLc 2Y2nXnTDCcIMnrfc+eCR/eQmd7uCu++vvOCiMDae4DdQFGXslUReGzo+NCt7IIZtZliX OuwuBK8gnpuZIM3YsPEg5eE3lcXyWm73RbNgTM99gUHUv/lIW9X7AJsuUT/5PNcTRpb2 /RCIxN7/1JzdJLwiWKxqvEIdOeTb4VoZsnJcDcuouaJc6STs9fVTOZi4xGD7+MWO+N9N Rw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rsgd38tv4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jul 2023 08:23:08 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 36C8N7mo031890 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jul 2023 08:23:07 GMT Received: from hu-schowdhu-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 12 Jul 2023 01:23:03 -0700 From: Souradeep Chowdhury To: , , Andy Gross , Konrad Dybcio , "Bjorn Andersson" , CC: , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V1 2/3] usb: misc: Add notifier call chain to Embedded USB Debug(EUD) driver Date: Wed, 12 Jul 2023 13:52:39 +0530 Message-ID: <18212c7abbb8c833cc07f8500d4905b79c49ec59.1689148711.git.quic_schowdhu@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: SXiq8Dlvs04sZERfyLzjmvM9owT8ZG2m X-Proofpoint-GUID: SXiq8Dlvs04sZERfyLzjmvM9owT8ZG2m X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-12_04,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 adultscore=0 mlxlogscore=955 priorityscore=1501 impostorscore=0 bulkscore=0 phishscore=0 malwarescore=0 mlxscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307120073 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771204225301982748 X-GMAIL-MSGID: 1771204225301982748 Add the notifier call chain to EUD driver. The notifier call chain is added to check the role-switch status of EUD. When multiple modules are switching roles on the same port, they need to call this notifier to check the role-switch status of EUD. If EUD is disabled, then the modules can go for the role-switch, otherwise it needs to be blocked. The notifier chain can be used to link multiple modules switching roles on the same port and create a ordering, priority and conflict resolution among them. The wrapper functions are defined here which can be used to register a notifier block to the chain, deregister it and also call the chain. Signed-off-by: Souradeep Chowdhury --- drivers/usb/misc/qcom_eud.c | 52 +++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/drivers/usb/misc/qcom_eud.c b/drivers/usb/misc/qcom_eud.c index 7f371ea1248c..e6c97a2cf2df 100644 --- a/drivers/usb/misc/qcom_eud.c +++ b/drivers/usb/misc/qcom_eud.c @@ -11,10 +11,13 @@ #include #include #include +#include +#include #include #include #include #include +#include "qcom_eud_notifier.h" #define EUD_REG_INT1_EN_MASK 0x0024 #define EUD_REG_INT_STATUS_1 0x0044 @@ -22,14 +25,16 @@ #define EUD_REG_VBUS_INT_CLR 0x0080 #define EUD_REG_CSR_EUD_EN 0x1014 #define EUD_REG_SW_ATTACH_DET 0x1018 -#define EUD_REG_EUD_EN2 0x0000 +#define EUD_REG_EUD_EN2 0x0000 #define EUD_ENABLE BIT(0) -#define EUD_INT_PET_EUD BIT(0) +#define EUD_INT_PET_EUD BIT(0) #define EUD_INT_VBUS BIT(2) #define EUD_INT_SAFE_MODE BIT(4) #define EUD_INT_ALL (EUD_INT_VBUS | EUD_INT_SAFE_MODE) +static RAW_NOTIFIER_HEAD(eud_nh); + struct eud_chip { struct device *dev; struct usb_role_switch *role_sw; @@ -41,6 +46,42 @@ struct eud_chip { bool usb_attached; }; +int eud_register_notify(struct notifier_block *nb) +{ + return raw_notifier_chain_register(&eud_nh, nb); +} +EXPORT_SYMBOL_GPL(eud_register_notify); + +void eud_unregister_notify(struct notifier_block *nb) +{ + raw_notifier_chain_unregister(&eud_nh, nb); +} +EXPORT_SYMBOL_GPL(eud_unregister_notify); + +void eud_notifier_call_chain(unsigned long role_switch_state) +{ + raw_notifier_call_chain(&eud_nh, role_switch_state, NULL); +} +EXPORT_SYMBOL_GPL(eud_notifier_call_chain); + +static int eud_vbus_spoof_attach_detach(struct notifier_block *nb, unsigned long event, + void *data) +{ + struct device_node *eud = of_find_compatible_node(NULL, NULL, "qcom,eud"); + struct device *eud_device = bus_find_device_by_of_node(&platform_bus_type, eud); + struct eud_chip *eud_data = dev_get_drvdata(eud_device); + + if (eud_data->enabled && event != USB_ROLE_DEVICE) + return NOTIFY_BAD; + else + return NOTIFY_OK; +} + +static struct notifier_block eud_notifier = { + .notifier_call = eud_vbus_spoof_attach_detach, + .priority = 1, +}; + static int enable_eud(struct eud_chip *priv) { writel(EUD_ENABLE, priv->base + EUD_REG_CSR_EUD_EN); @@ -196,6 +237,10 @@ static int eud_probe(struct platform_device *pdev) return dev_err_probe(chip->dev, ret, "failed to add role switch release action\n"); + ret = eud_register_notify(&eud_notifier); + if (ret) + return dev_err_probe(chip->dev, ret, "failed to register notifier\n"); + chip->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(chip->base)) return PTR_ERR(chip->base); @@ -226,6 +271,9 @@ static void eud_remove(struct platform_device *pdev) device_init_wakeup(&pdev->dev, false); disable_irq_wake(chip->irq); + eud_unregister_notify(&eud_notifier); + + return 0; } static const struct of_device_id eud_dt_match[] = { From patchwork Wed Jul 12 08:22:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Souradeep Chowdhury X-Patchwork-Id: 118942 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp999414vqm; Wed, 12 Jul 2023 01:35:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlHAp1Qh0ocNFWbINeJ2TUgrdyVYeCky0WJwzyWNbdpuAnt+7pcX3jatgaJRR1bgSHkqWg+C X-Received: by 2002:aa7:da98:0:b0:51e:1c18:dd99 with SMTP id q24-20020aa7da98000000b0051e1c18dd99mr15599821eds.38.1689150953233; Wed, 12 Jul 2023 01:35:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689150953; cv=none; d=google.com; s=arc-20160816; b=AtXjt81GjM/4HAlapZpGOGLaWUuFwPwSq2NK9VewlFYcbNRQ+rVbN3ieXcM20qtEU/ DaVTU0uxTnGuVwnbETN601CYI28K3tIXbmJ/KMEPYZ1hEXHD48U3tuhqr4pM9LEiDdlB Sm1UoIrDASERgfoqo5Bem0/ots7F6YbLNO4DMpMnQ6zERyiJg5byclYfsllF20zqMcaC Lk5feEF9sGE3PhGr2SQ6sAPCRIhkjVMntjlhsB6ClYxm83sHnxDI/XpIjZvK7smDFUrN 3vu9fLzckElkCzLr3kgn1VYyYoQ+Vc9uU7AOSLkqyCIWtXxMcBmMIF29xXVw+9dhKWCr AOxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=6EamwE1BRGAKf9o1e8li1V8LRV9RT7CZKpGuFkVLIGI=; fh=UtPIuTGaqaJJ37a+crxvtis5z5d56DzPHGVb5d0pt54=; b=z1RMCf0lPjcg3m5D869jkGk+CkSgEevoC4jEqPhuXdGmuZEaUB2IenPDHCDwsz+hh7 iT8yaPcEdVDf11bECpm9K56cCx1vUDblqZZHJjZB/V1e0FQHMfXV6SAWvAn4QEinWAoC 4maap0IXpcKHBmsVUxoXnjBSrEv6TQWHXASbAPA4Wr/ZAtxtEUcmUJ23+eK1BXPzgr5U k20dznYczz3h3GEw1QbapJp42nK+P2fjpDrw4graiH6jP7gw5bDBGOuyQROq9Ke5CJjN u80ceIBsGDXCTYhidWnk514dQS5rjHaVrmRCZZlKnbFkw39bL7ArtS7XJ/AafduJwVYS zdpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=akjsE7Ff; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e10-20020a50fb8a000000b0051e1a5947e9si3760858edq.367.2023.07.12.01.35.28; Wed, 12 Jul 2023 01:35:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=akjsE7Ff; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232626AbjGLI2j (ORCPT + 99 others); Wed, 12 Jul 2023 04:28:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232879AbjGLI2H (ORCPT ); Wed, 12 Jul 2023 04:28:07 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8B1A19B4; Wed, 12 Jul 2023 01:23:27 -0700 (PDT) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36C4dqva027194; Wed, 12 Jul 2023 08:23:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=6EamwE1BRGAKf9o1e8li1V8LRV9RT7CZKpGuFkVLIGI=; b=akjsE7Ff0xh5gTsdoTBHhQPvaHbqD2+HVIXWwMQCa+31mHKttJnhWRJKMIe/XKnA28Cr U3rhWHwmZVdijT5BetujKbWIbiGTMd3iQczpedaiZnbPBqgIH/6+9zFC/W3uU6xgmZrW 8PFWz4SVfe7VWmtcdrGcTwo4+M+jWKK3/MAgyeA2F5ZOb9T7nSryPnh0PZw8Ogn7iHw5 EsQcYyuKap2gP+kVdopyiaxnf8tikGVJuRJNR/tIiAdvcC2SNtjMj1prvoFVcuJsQpw0 5urh+Si9JWqGHQgCrxkkuDJtkaxDjGDEhlno+VdT3fdNbNKL1ajvoze559EAf+JEqFV7 wA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rshyu8qme-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jul 2023 08:23:12 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 36C8NBZp009460 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jul 2023 08:23:11 GMT Received: from hu-schowdhu-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 12 Jul 2023 01:23:07 -0700 From: Souradeep Chowdhury To: , , Andy Gross , Konrad Dybcio , "Bjorn Andersson" , CC: , , Sibi Sankar , Rajendra Nayak , Souradeep Chowdhury Subject: [PATCH V1 3/3] MAINTAINERS: Add the header file entry for Embedded USB debugger(EUD) Date: Wed, 12 Jul 2023 13:52:40 +0530 Message-ID: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: _yvdB73eKuYn8LPXLSgJzcoMtbz0e7-k X-Proofpoint-ORIG-GUID: _yvdB73eKuYn8LPXLSgJzcoMtbz0e7-k X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-12_04,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 bulkscore=0 spamscore=0 mlxlogscore=500 phishscore=0 clxscore=1015 mlxscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307120073 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771203149971834585 X-GMAIL-MSGID: 1771203149971834585 Add the entry for Embedded USB Debugger(EUD) header file which contains interface definitions for the EUD notifier chain. Signed-off-by: Souradeep Chowdhury --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3be1bdfe8ecc..6d395cc6f45c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17288,6 +17288,7 @@ L: linux-arm-msm@vger.kernel.org S: Maintained F: Documentation/ABI/testing/sysfs-driver-eud F: Documentation/devicetree/bindings/soc/qcom/qcom,eud.yaml +F: drivers/usb/misc/qcom_eud_notifier.h F: drivers/usb/misc/qcom_eud.c QCOM IPA DRIVER