Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp170867rdf; Mon, 20 Nov 2023 21:49:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHESwM2jNcgopR0kuMvyOW2NIQQRDbEieAMvQfCP1SlzU5gZWG9pmJ9pH5CTsC2njXN2WUk X-Received: by 2002:a62:e803:0:b0:6b1:5d1a:bd0c with SMTP id c3-20020a62e803000000b006b15d1abd0cmr2450878pfi.16.1700545762003; Mon, 20 Nov 2023 21:49:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700545761; cv=pass; d=google.com; s=arc-20160816; b=CSakmoPLsJn95wGaB9ifz/S+7UpzkzA5MQ4b9X/i1CZpQHjrNGSrQF/gQQAiAMMcEQ sZZBJXkeAivqOv/Uz5MzapzDbsT6zoQ24IJ9wKJwWF4ZcVaERE2jkxJ3w18PPrPL2+xX L5fPlSzvBM3jQj77nT37Yx6ODp2SXJ97MFWfElhZmOxvfGl8dVEGvfZdSxOInphI5UvF C6qJUA+BPH+crrXpb6qiRH5dYuZaUJV109K7cUq4bBsasaErvf687/zmH6VJ4Q/5RH6r UpgPmMkfUxsEFUYFsY+g1RGkpib9TTCVsDlWglz67T5XG5SIuokcHzpGfRSwiNn922A9 uwcg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:content-language:references:cc:to:subject :user-agent:date:message-id:dkim-signature; bh=OLYECJIn+OMMlktkYLP+kbnvCTuoK4OJLmIjJKn4zrQ=; fh=+tOUbUcIZCTqR/dQUdctS90A2eKzZff7z8eA1NbKCbs=; b=vTngWo3l5XaO9vIQhi8xueJ0mMqdFjfvMrhTtFcDsOQGP59xK/5pYdF8BZFsT2nBGO spzmuzeQ4jMdXqZMuB6WgUrHozwgq96qevTIyUu3kymmi5kyDplP8dx3sxlXx+vqBCVr KyKDFsJTR3ZTOBcqDuOc7t1YUmVXwELTuA3ulOKqLtDENRA0YXIOIit48Xoo5w3A+jrk 3cc6G7SqMvZLujEPgxqWJBOQZ6hNmPj3ZJYJFeiVJn57qhn80Fx8rCCfw0fx48cEHdPy S6sV2ZEDoeKIcGP75REmxVoriihp8geAbIYKZLnj6NE/ntyE79M2K9TwA0KgM/Ckp7Ry QO4w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="Q/EGeIJj"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q9-20020a056a00084900b006cb8980fce1si4330425pfk.356.2023.11.20.21.49.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 21:49:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="Q/EGeIJj"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A798A801BFCC; Mon, 20 Nov 2023 21:47:59 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233374AbjKUFrq (ORCPT + 99 others); Tue, 21 Nov 2023 00:47:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbjKUFro (ORCPT ); Tue, 21 Nov 2023 00:47:44 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2067.outbound.protection.outlook.com [40.107.243.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5358BA0; Mon, 20 Nov 2023 21:47:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZbSCfrXfj86y0U6KchffjEYp5z9sBoE8pDL2LUQ0xHxcxHPdImH0wTaZxYvkn+MLIrOL55HtfbYsdwmnSAPsR6mKQWiRClQO1hCO3+nEbDR3mB1vkIsESYeaQoNdMjusuJhFcEawXHPlje0WXe6o4iwACzId6cG327KxLz3VGtBH24sTtlXhbXTas7F6jTeSjvortucHUFcAg3Hl8lWNN+CNEno61dJesAW3kVOWEkb+rGLDjr6XEsJcZ5WPKbvAfJXT4GoM2Y0xNjeILQQiBz0tljDAdwV6pLvS902Yi8N88V1JjvzZyJXvmDKj7j8CrswZ5DX/w5gBbSZeMD/Jug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OLYECJIn+OMMlktkYLP+kbnvCTuoK4OJLmIjJKn4zrQ=; b=JoWXHMAIzwOnayUzETN1x23Awhv0Z6fG7e+A3Fz3pceSZL0Ee/fJbSIO1DKNvQtt4b0MoAsNANvBF4EARexocJLOou3nnVELRy7H5al0VdpgkNEOSIIqFI9wjTazdHy2RWgd/o4mSoWUHFOlbpVHlrJPHRjP3pyPJxql9YhTaQd+5AZ4GY5c7CuQfzJ+jBgFkFwbT2vGaLupmI7u6pLKiNUuG0fdqjgXUSI94cihPq8FV6Sg0EU/yjYxOLp4VUzv9hQ8Mk86V5Tqurb+tvjubFeYmC7p/rxa7zh6/4CjOiznn9NcrmsPFNaqh9OBwClysGlJXz1GQSfbOnmNPCIvgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OLYECJIn+OMMlktkYLP+kbnvCTuoK4OJLmIjJKn4zrQ=; b=Q/EGeIJj1C/Gm5zDkUNsKO0KcemQ25rj4VUFx8zFKtDO3i6A9ObilKQZjm/t6NTCwqJA1CDx+y0ZKi71w4zdXO2f914XN+ZiBaShxKfaUNhLAR5IeNew3XT0j5iniiXR6Uw3ZjiRy+gB1vgklw73VKn3mIcogetJLyJTk8RmFdo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BL1PR12MB5827.namprd12.prod.outlook.com (2603:10b6:208:396::19) by CY8PR12MB8242.namprd12.prod.outlook.com (2603:10b6:930:77::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.27; Tue, 21 Nov 2023 05:47:38 +0000 Received: from BL1PR12MB5827.namprd12.prod.outlook.com ([fe80::83bc:6ff8:d40e:a7fc]) by BL1PR12MB5827.namprd12.prod.outlook.com ([fe80::83bc:6ff8:d40e:a7fc%5]) with mapi id 15.20.7002.028; Tue, 21 Nov 2023 05:47:32 +0000 Message-ID: <2d234d31-3045-72f2-57db-db03515eebcf@amd.com> Date: Tue, 21 Nov 2023 11:17:21 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/4] phy: core: add notify_connect and notify_disconnect callback To: Stanley Chang , Greg Kroah-Hartman Cc: Vinod Koul , Johan Hovold , Kishon Vijay Abraham I , Geert Uytterhoeven , Jinjie Ruan , Rob Herring , Alan Stern , Yang Yingliang , Flavio Suligoi , Roy Luo , Heikki Krogerus , =?UTF-8?Q?Ricardo_Ca=C3=B1uelo?= , linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-usb@vger.kernel.org References: <20231110054738.23515-1-stanley_chang@realtek.com> Content-Language: en-US From: Kishon Vijay Abraham I In-Reply-To: <20231110054738.23515-1-stanley_chang@realtek.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PN3PR01CA0111.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:96::10) To BL1PR12MB5827.namprd12.prod.outlook.com (2603:10b6:208:396::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL1PR12MB5827:EE_|CY8PR12MB8242:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d7405ea-32e9-42f4-0876-08dbea555aac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sJlOzhk84k36T8qPPZos+8yaIZ6UAge1RWTMANxo8+XXIgJpiiD2ftWJhr4fe4hWbT017OnvIq3NpkbA3/O6q0ikkONpTQ/Ixgw2p9ZzsacDyb6JcL8lISy3XVsEiPA4hNuPyv0s694HF2LnxBUfwxWbbwnmakB5kGNvUBq9GJa/J8mZqcxWT55Nebe5Li3Y9y/FlA1tCzeauGdBXL6dOlHzCJW6lRvu8jfn7hE1FMZH8I/o0HvyssDKNlh8292OUoRZFhaWpRbFjvvbAj2LBFvmNHh/laNdRrEOW7zaDto/N6eQtvGiEXVH1p6e1McUF7xmOQh9O0kMdNCIzyK2sH2egxjicAb6wvWw8/DAIjv6p71FJRJm5NtfVtmS0xkpDB3PT8a4RTPEaTOkNmq5OAXmQy4TX4nwDHWeGgomiqMpexcgm5Fxcfic8arqf1vMXGfiOnKee+q+h5/DaVrsEZCoeQn0p1sL3j6D3VAiGNLPsKRO52xXZq/MdMAIQmzhjFhsimjkn+Rn5sVlDAyHevGmY7MebXBzaKcJ2GGFO5HoCrbZPPecxT7AqF0qixaERuYFzw1np7ql/dwkRmjzElRkXahxVoLktijkbeUynG+YUsWzNRC4hGDNPHazecLmSeK9CYrPxN02Gc3UdVmOgw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL1PR12MB5827.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(39860400002)(376002)(366004)(136003)(396003)(230922051799003)(186009)(64100799003)(1800799012)(451199024)(2616005)(31696002)(31686004)(110136005)(6486002)(6666004)(6506007)(66476007)(66556008)(316002)(54906003)(66946007)(36756003)(53546011)(6512007)(26005)(83380400001)(7416002)(2906002)(5660300002)(478600001)(41300700001)(38100700002)(8936002)(4326008)(8676002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Y0dMQ3oxUU1pQ0hBOHRva01lbTI3ZmdLaWJjUVNxcVd0MHhvc1JrTm02VEYr?= =?utf-8?B?QWtqOUNreXlaN0Eyb0ladnZSTXVKWTY4blVJUFBZZ0NMeSttdVVHc0NsTXdn?= =?utf-8?B?NGVYa1ptSk5ZYkhRdEVIcjdZZUdrdTFNejJSNGs1bEhKbzZxV0NXRmZYVVpN?= =?utf-8?B?STd3aXVWcjJrbHo4N0E2UDZEa3BkWDdwZjR2SENwS3RCYXVOME1PQ21oR3A5?= =?utf-8?B?NXdPektINXFJdzdCU3JMejU4ZmNvVGg2SWl3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z0w4b2RnQWU1RWl1MmlUa3QxVmxFd2dheHJsWS9rWXRNSGxBUTlvNWEwaDVo?= =?utf-8?Q?Lep9QGK6POfS806/p42umzjbB?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d7405ea-32e9-42f4-0876-08dbea555aac X-MS-Exchange-CrossTenant-AuthSource: BL1PR12MB5827.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2023 05:47:32.0710 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gxt7LMdrZurohbs3mvPrmPmK6nbsBJm0+MahIoVpW/tPDHV4ARHSsY547nzaGo5wbOwvqD/ybYXTxx7jQ970Tg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8242 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 21:47:59 -0800 (PST) Hi Stanley, On 11/10/2023 11:15 AM, Stanley Chang wrote: > In Realtek SoC, the parameter of usb phy is designed to can dynamic > tuning base on port status. Therefore, add a notify callback of phy > driver when usb connection/disconnection change. > > Signed-off-by: Stanley Chang > --- > v1 to v2: > No change > v2 to v3: > No change > --- > drivers/phy/phy-core.c | 47 +++++++++++++++++++++++++++++++++++++++++ > include/linux/phy/phy.h | 18 ++++++++++++++++ > 2 files changed, 65 insertions(+) > > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c > index 96a0b1e111f3..a84ad4896b7f 100644 > --- a/drivers/phy/phy-core.c > +++ b/drivers/phy/phy-core.c > @@ -489,6 +489,53 @@ int phy_calibrate(struct phy *phy) > } > EXPORT_SYMBOL_GPL(phy_calibrate); > > +/** > + * phy_notify_connect() - phy connect notify > + * @phy: the phy returned by phy_get() > + * @port: the port index for connect > + * > + * If phy need the get connection status, the callback can be used. > + * Returns: %0 if successful, a negative error code otherwise > + */ > +int phy_notify_connect(struct phy *phy, int port) > +{ > + int ret; > + > + if (!phy || !phy->ops->connect) > + return 0; > + > + mutex_lock(&phy->mutex); > + ret = phy->ops->connect(phy, port); > + mutex_unlock(&phy->mutex); > + > + return ret; > +} > +EXPORT_SYMBOL_GPL(phy_notify_connect); > + > +/** > + * phy_notify_disconnect() - phy disconnect notify > + * @phy: the phy returned by phy_get() > + * @port: the port index for disconnect > + * > + * If phy need the get disconnection status, the callback can be used. > + * > + * Returns: %0 if successful, a negative error code otherwise > + */ > +int phy_notify_disconnect(struct phy *phy, int port) > +{ > + int ret; > + > + if (!phy || !phy->ops->disconnect) > + return 0; > + > + mutex_lock(&phy->mutex); > + ret = phy->ops->disconnect(phy, port); > + mutex_unlock(&phy->mutex); > + > + return ret; > +} > +EXPORT_SYMBOL_GPL(phy_notify_disconnect); Please use EXTCON framework for notifying connect/disconnect. Thanks, Kishon