From patchwork Thu Dec 7 11:51:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 175098 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4723504vqy; Thu, 7 Dec 2023 03:52:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNbXlP72yNJetX/w2R93MB3bxWbaGtLOcUVdUmcIFfX0KMk9uS0iNAtbdGQoPCzOx1t1at X-Received: by 2002:a05:6a20:4308:b0:18f:97c:9269 with SMTP id h8-20020a056a20430800b0018f097c9269mr2265224pzk.78.1701949922761; Thu, 07 Dec 2023 03:52:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701949922; cv=pass; d=google.com; s=arc-20160816; b=0KzT2/yAmmRRcRmyx4OVj8vuLC2x6zWfW9AbBMYE3nu3BkKRit0nXkrQ+Ityv8Cku0 BNSJU0AW29oMzC0Tl1eDYtNFztZOMkYYZ8H0wKhBZ8CqE07iA76ZsTYi+0yqPNyFbthl reMFoAINaxufhb390aH/XsxjFerL24L9VtEBu1aR51qYOjZu5seahd8P7BmySTnPCJoX 3JjDjeNYrBSSBw8fdoaig5zzhLQWwies9vWzuFg0DnOuNEDYILxjVtZ6R0i3wJ/2Jmc7 qVES4A2CKQn5anXZdwn+lQnafnK5DXRT/6VZEyR1qFtOgGy5mkrBTWC03d4Ktdy9TGlU yA0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:cc:to:in-reply-to:references :message-id:content-transfer-encoding:subject:date:from :dkim-signature; bh=dFinOaArdwIYeAM3WtAo6SpWlNlZf6708hGd1TSt4Uo=; fh=skg4aWcIne/NkBvGBSxiPFt6u1LkY77F5jj9Umi9ZmE=; b=Gw22MHb3Q+JGPwKHIBTSD0J5eTBTjASIazXPF7Q78cAGNNQ5w5+bsIQoTYQeKlHOfq 2PzR4PK6EtgWDJBP68b0Ti+PQB7oFnHS1VOP3Kf6lAYWQ5EXP5r0mGtlqeWFwspf2veD syimOccmwcbCUGU0OIH3dkVi0dkOXi0klzvHf9OSb9b0WB9u4wuoqCKOygTnYLPd3Muu c6FTUQkY5Q+CP405f0Aontq/JjrJPzLHwS4OjRnjgzahgnMA+lnmggV+8UkMi/6w+UnL y5RTKmRA8efMoXY2jJYixx0YNlZWdin9Ac2Iw1OLinRSXS0Jsv6/c0W/gYqxBU4/Edoq mz3g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=xsJAimzX; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bb12-20020a17090b008c00b002865781c521si997770pjb.95.2023.12.07.03.52.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 03:52:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=xsJAimzX; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 97BDD80713F9; Thu, 7 Dec 2023 03:51:32 -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 S1379020AbjLGLvP (ORCPT + 99 others); Thu, 7 Dec 2023 06:51:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232467AbjLGLvN (ORCPT ); Thu, 7 Dec 2023 06:51:13 -0500 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2064.outbound.protection.outlook.com [40.107.20.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DED0D13D; Thu, 7 Dec 2023 03:51:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D0hgflg5McTaRha/AlwLFK7wa9RXzMQLFnhTlzZtbANQSh/nA0PWmHqdSUsrdbmx4vWbMtGnIc0aw8xxhqb/ZG1+9KfX/Og5GYgjQUWAXmSLD+ML+1BBbKFpNRTiuJfrsKzKslbR8kET6T6Ja35IgowzR3E5Er6nAvva6lZDspAOtNOAwakUNAG/0la7dMda9T/fS6BNorzH8x0lxzqQdFjjwFyzZLufK5fiZPOknL9FBMT615Y7F9OIQ88COxhEL2l1lh6N4dpDIWJ95OkPdr7VfCHoLh4BXwAP7DhyXDA4kJ3dwqxxoMawpxZbI6b+qKIsVRmZeGlL1Wz4tBfm+A== 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=dFinOaArdwIYeAM3WtAo6SpWlNlZf6708hGd1TSt4Uo=; b=lH4PvKWA0uv8aoPcyIvZmPqHyY7A0XunllI4HhK1q5gmQoA8XpVdXxy7gHAcLH1cYf764DTMserNkcyE9mBMMQS20rh+v9aWtmUupd578PkkWwta1QugabGu9dnfFV8EUnev+4IRF1griYr3VF8w8/mT6d3dTeMuYc5y1QQdd8GTPn4gg2sRB8V2jEtALo060eCe+Qo2oEFOsbMcqbXG9W4kgCYQZVriceFYU+VIZg2+40xtSnPp1ZDQXNsOcapPPDYk1QRxv7cende3UZrvpg5PDAI3w2Fdemdq6fMDNneVLlpYafLnQqDMZRdMIqgaZPuypuRH1FnHEABZDVemaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dFinOaArdwIYeAM3WtAo6SpWlNlZf6708hGd1TSt4Uo=; b=xsJAimzXQ55SN8sYh427ZgPRUce97CBahiVF3A0U64f0jCSRRLcL7JbfP65N+z1yXYDQsCAz+I4bm+GtXbEGnf0zgzoesKUoQzORjHnzmZQvIvjIuL5kkKAhRHhW9xEaetAwLu0Gt0TIIgz3qZycxADcZVy9GjY9ZdyvyPm0Yw8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by DB4PR08MB8054.eurprd08.prod.outlook.com (2603:10a6:10:389::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Thu, 7 Dec 2023 11:51:13 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6b40:1e6f:7c94:71dc%4]) with mapi id 15.20.7068.027; Thu, 7 Dec 2023 11:51:13 +0000 From: Javier Carrasco Date: Thu, 07 Dec 2023 12:51:06 +0100 Subject: [PATCH 1/4] usb: typec: tipd: add init and reset functions to tipd_data Message-Id: <20231207-tps6598x_update-v1-1-dc21b5301d91@wolfvision.net> References: <20231207-tps6598x_update-v1-0-dc21b5301d91@wolfvision.net> In-Reply-To: <20231207-tps6598x_update-v1-0-dc21b5301d91@wolfvision.net> To: Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701949872; l=4687; i=javier.carrasco@wolfvision.net; s=20230509; h=from:subject:message-id; bh=uuzBZoVgbfJRVw/uB3TAQ/14SQq/Je6fi5f+9uL7q9I=; b=Tjnkl8FGz7MALGsw64W3FrE2xGXZgF7q7SP9ZAkBDy2kYAJpHEd0nJA3D3Hg5IHX74lUZTmvO hJb8w+UZAuYA7i41qje4kkhIKYqNra7DcdARxT+N6cV6CT/R34rofB3 X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=tIGJV7M+tCizagNijF0eGMBGcOsPD+0cWGfKjl4h6K8= X-ClientProxiedBy: VI1PR08CA0248.eurprd08.prod.outlook.com (2603:10a6:803:dc::21) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|DB4PR08MB8054:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a300ac7-1023-4cf6-6901-08dbf71acfe6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: otga8B/eBym2dD76zNAxQrSx1hp1oKTkgqmuRYkEKTXry8g76ccUSL0bIKrwHU6nVluzzXndr8ngcwCdlrF+kZJbAIWQL2W5+JUYRcGi+4Ku/VgWVURW9aZnWHhvD4KVXvblpYI7aaUUwsaAPAM/22jU7eW1jgx+3kP+EAI3BeRh1yoIXtgX6A+9bBBlbd6DQ9ZQjIY+ZarmMAcjKZywu/pvFdC2Ccr9TbZvF0SLm/eWgsF474eWJcRCGpp6MLFymATqO8N01HpipY0lnZbvWtaDyqV9K1bnNd7HGIezqLOqqDAO5UmppGRIqtXpEtRlRbc49wTkSWP7rRYQ+6JnHu3GpNnI/wntj0oC52i0xCKTG+Dw29mPVqgot4ALNMbaDZEqatI5FzLbqFz2DceV80yqBHKa2p3HWaqT7ipp7IqzihUGeBC5B53Hwn3HiKWifxqVeFnbH6pF+rmm6z7Cw+j2VUBzaR5ph0I2c1sdD7cMlDE0uWQLmlgGeAc+dSAjE9LXlLCwUeUUx9yKbZquyz7lJk4nv6jVnHAWK+sZikJL21dBGNKvNrLX0d9IKQ/GzR7roA3WyTovFsdVq5MEo1sr/wCFsPS2RN39WwcOaig6sc+sQoePVnfBfjzZTat4 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4974.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39840400004)(136003)(396003)(376002)(366004)(346002)(230922051799003)(1800799012)(186009)(64100799003)(451199024)(52116002)(38100700002)(5660300002)(38350700005)(2906002)(2616005)(6512007)(83380400001)(6666004)(6506007)(107886003)(26005)(110136005)(36756003)(6486002)(478600001)(41300700001)(44832011)(66946007)(66556008)(66476007)(86362001)(8936002)(4326008)(66899024)(316002)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?EQ3LtIBBHoSXm6IqrPVj5XRu8PfH?= =?utf-8?q?hi0rs8AfcnZ/rBUu6hX9zqtbgx/djqYbdHZKBfrEQk1CCOulUO/E0YQMVEtbFh1B4?= =?utf-8?q?rNXCDTSnDhk6jix2LeBvwonmruN4dT7bp8FQRr8tzcMelhjnYwUfhFMfbbNSshsSo?= =?utf-8?q?Ygi/WJtjdDJDTxtt2mIbVHbbm5egk1KecLo/THe4DoSQ66CTFElhHsQ0TE+sc1kFz?= =?utf-8?q?X8aMtqFEBue/CxgPxmk2nKz9FnhIsXdK5/R+NyuHhw3Kki+EjSv4Xy4OffGUWg2Mx?= =?utf-8?q?ooMiz0gulN1+6kWpniY2JXh2a92NomjNyLXqLb7mzFO91O54OSSpONKHUP1WQuXoI?= =?utf-8?q?oZsCr6aXFMO3aGwWKqh6Z6xSOMrsQJZ4uxktHzuoB6oNBAFsUxWUS+o6ctIGctlxT?= =?utf-8?q?oWZcS9yxnnq8FteyOVCpiHvWyKvsU5MtsIqbipmvNYCiZzp1IcQUvapc2z7m1AkAs?= =?utf-8?q?cbhX6WihnrV9OoqGeoKDNzQDdARbtdmoRc0WbPposGL6inelq3o0ripwURLwmFUc1?= =?utf-8?q?jlghbT50czzpTMVmOdvIqbof+f1vcREo5voW0K+gWCMOcqXbLyzhV/ZYVFuyF+mmm?= =?utf-8?q?VOs6HILl3zhkp7nhBjRlR0SUXMrogCS9SnDxfmLDBPquD4yhub2Ii7havryodM2XY?= =?utf-8?q?FtRw32bMEKuUfPpk5408/3IuJYn8RzQRZBrIiwZmSrBcQ8+epSFCJXhbNFHEgp4ty?= =?utf-8?q?HoQvCubAv1P2vVmcuB7PVC4rWaRHS81Lc2+3BZuAAE8NqcwX+lXGFDf6hSte9pjE/?= =?utf-8?q?Bo1S5M92EJHIkW9U6tYkKXBNcOzRYBnrsz7XLkMZQoKr4s/PydPW2WtbnlechAw9o?= =?utf-8?q?jVqegP399YBqazXOKh7/IksfkPzk4l7qfXbYVQ6ELm1bNctUqfNXRM0RrFE0zVesu?= =?utf-8?q?8C68i976N4FjGDxStZzEx1yuOyeIIocFmlp+U+jKA01Nd+4i4T6nQYsshNIw9Ne1s?= =?utf-8?q?vaouLL8+dscKyQSAeO9DQBhTddF6VlIsLD2xorC237SXEnFSlazM7TjnSriYs6+kl?= =?utf-8?q?iyysm7+I+DpIqMZjoqtMf1SSAEjovRZZWgiFqhh39iiNkihumy5HM9v5+iI/TyGh3?= =?utf-8?q?U8MSr63Qm5JO6eX3JWLMY1mcLdCXXvzgqpGUTh2+RKuItRNJu6+uzkjZ48sk8/yic?= =?utf-8?q?LKCO063gTPp1tKct5eHQAr9qEuQdCL0gEA/flHJbWIW4955Ahi5NB8SXsVyZvvYFB?= =?utf-8?q?T4tLB9ZsDb2Z70hJh6wbx1sj6Kb7WxfywW7fIepyYDbilGPdPvs92+BNvPAghLZij?= =?utf-8?q?Sciu6vc9Pi1U+TQL/ILozG2O8GZX9efvdlXApcSwHMVhhbFi2cpCDNxYoyCrhYQEz?= =?utf-8?q?Llqb2SVXTq4RK1huBs4fOkNzZNGA9x+MjzwXakO7VaOvRpZazswa+HUfpC0+NzP2y?= =?utf-8?q?JJkP5g0L1i9mCV+PM2S8Md+p/xE+/DZtsS2W+f7fin7NcVZ6noV3N5g6ld3urhHNJ?= =?utf-8?q?cQOL6bhvlOJz/c5Z/l8wWt2RSalejfRknHkQ5skHjtDOrhj5s9sCdOXbSTyNSlsKj?= =?utf-8?q?oKpv+XHYQQ8d4bFZK5n1Nrz8YDT/3YoEwozM1ivF+5hOWVbTmv1+O9s=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 4a300ac7-1023-4cf6-6901-08dbf71acfe6 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2023 11:51:13.3313 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HgGgmNZ5atsQ2e0wanZcB/6zCkKs9kdxCbu1+xj8vTQab+zDdZgl5lApsG5ma0pjCSMM+rbgFfLeugOuX4CDDizG8TQ+2TCagpkxjpBjPWs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8054 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, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 07 Dec 2023 03:51:32 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784623841765022114 X-GMAIL-MSGID: 1784623841765022114 The current implementation includes a number of special cases for the tps25750. Nevertheless, init and reset functions can be generalized by adding function pointers to the tipd_data structure in order to offer that functionality to other parts without additional conditional clauses. Some functionality like the cold reset request (GAID) is shared by the tps25750 and the tps6598x, so they can use the same reset function. Signed-off-by: Javier Carrasco --- drivers/usb/typec/tipd/core.c | 45 +++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 806ef68273ca..f0c4cd571a37 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -115,6 +115,8 @@ struct tipd_data { void (*trace_power_status)(u16 status); void (*trace_status)(u32 status); int (*apply_patch)(struct tps6598x *tps); + int (*init)(struct tps6598x *tps); + int (*reset)(struct tps6598x *tps); }; struct tps6598x { @@ -1106,6 +1108,11 @@ static int tps25750_apply_patch(struct tps6598x *tps) return 0; }; +static int cd321x_init(struct tps6598x *tps) +{ + return 0; +} + static int tps25750_init(struct tps6598x *tps) { int ret; @@ -1124,6 +1131,21 @@ static int tps25750_init(struct tps6598x *tps) return 0; } +static int tps6598x_init(struct tps6598x *tps) +{ + return 0; +} + +static int cd321x_reset(struct tps6598x *tps) +{ + return 0; +} + +static int tps6598x_reset(struct tps6598x *tps) +{ + return tps6598x_exec_cmd_tmo(tps, "GAID", 0, NULL, 0, NULL, 2000, 0); +} + static int tps25750_register_port(struct tps6598x *tps, struct fwnode_handle *fwnode) { @@ -1187,7 +1209,6 @@ static int tps6598x_probe(struct i2c_client *client) u32 vid; int ret; u64 mask1; - bool is_tps25750; tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); if (!tps) @@ -1207,8 +1228,7 @@ static int tps6598x_probe(struct i2c_client *client) if (IS_ERR(tps->regmap)) return PTR_ERR(tps->regmap); - is_tps25750 = device_is_compatible(tps->dev, "ti,tps25750"); - if (!is_tps25750) { + if (!device_is_compatible(tps->dev, "ti,tps25750")) { ret = tps6598x_read32(tps, TPS_REG_VID, &vid); if (ret < 0 || !vid) return -ENODEV; @@ -1251,8 +1271,8 @@ static int tps6598x_probe(struct i2c_client *client) if (ret < 0) return ret; - if (is_tps25750 && ret == TPS_MODE_PTCH) { - ret = tps25750_init(tps); + if (ret == TPS_MODE_PTCH) { + ret = tps->data->init(tps); if (ret) return ret; } @@ -1340,8 +1360,8 @@ static int tps6598x_probe(struct i2c_client *client) tps6598x_write64(tps, TPS_REG_INT_MASK1, 0); err_reset_controller: /* Reset PD controller to remove any applied patch */ - if (is_tps25750) - tps6598x_exec_cmd_tmo(tps, "GAID", 0, NULL, 0, NULL, 2000, 0); + tps->data->reset(tps); + return ret; } @@ -1358,8 +1378,7 @@ static void tps6598x_remove(struct i2c_client *client) usb_role_switch_put(tps->role_sw); /* Reset PD controller to remove any applied patch */ - if (device_is_compatible(tps->dev, "ti,tps25750")) - tps6598x_exec_cmd_tmo(tps, "GAID", 0, NULL, 0, NULL, 2000, 0); + tps->data->reset(tps); if (tps->reset) gpiod_set_value_cansleep(tps->reset, 1); @@ -1393,7 +1412,7 @@ static int __maybe_unused tps6598x_resume(struct device *dev) if (ret < 0) return ret; - if (device_is_compatible(tps->dev, "ti,tps25750") && ret == TPS_MODE_PTCH) { + if (ret == TPS_MODE_PTCH) { ret = tps25750_init(tps); if (ret) return ret; @@ -1423,6 +1442,8 @@ static const struct tipd_data cd321x_data = { .register_port = tps6598x_register_port, .trace_power_status = trace_tps6598x_power_status, .trace_status = trace_tps6598x_status, + .init = cd321x_init, + .reset = cd321x_reset, }; static const struct tipd_data tps6598x_data = { @@ -1430,6 +1451,8 @@ static const struct tipd_data tps6598x_data = { .register_port = tps6598x_register_port, .trace_power_status = trace_tps6598x_power_status, .trace_status = trace_tps6598x_status, + .init = tps6598x_init, + .reset = tps6598x_reset, }; static const struct tipd_data tps25750_data = { @@ -1438,6 +1461,8 @@ static const struct tipd_data tps25750_data = { .trace_power_status = trace_tps25750_power_status, .trace_status = trace_tps25750_status, .apply_patch = tps25750_apply_patch, + .init = tps25750_init, + .reset = tps6598x_reset, }; static const struct of_device_id tps6598x_of_match[] = {