From patchwork Wed Sep 27 17:53:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abdel Alkuor X-Patchwork-Id: 145727 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3053560vqu; Wed, 27 Sep 2023 20:50:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzMhYJwncGhJmUIZBDNhog1LK+eHnTQ0xhnIz8UulDQ8wsiHeLhPHXdHPE8GaTZSAhCuF3 X-Received: by 2002:a17:90a:55c7:b0:274:4f21:deae with SMTP id o7-20020a17090a55c700b002744f21deaemr46179pjm.35.1695873013773; Wed, 27 Sep 2023 20:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695873013; cv=none; d=google.com; s=arc-20160816; b=GH6qG1sLFYBxkdj1ysBdJgOVkA6iokkIQGHhfRD86UHJ63yxUajm1CzuE1F9FQeQIo TIfZ8kH6HoFA5Fx0Mrka0y/+bX4F1J6oq+poW9s7VDzMZx1vxGtBG2aEbH6nxA8rVf85 mnxd9Ka0Fy4yvUeY6YexG3EpyGn7+k+is6hgLiLwHI8i5y81jrJBXS/bA38phbM1savW b3Eo3TTkms6lcIuJBdxBUUqCaaPXphXt1uQfRnDhJ58NdiNx+c4p86JT7N0xD0ndDKUX RxuS4QYIPi7bQdCvVZr1QVCcKlw6HhxTYx78K6cdHl4GnCZPxwgtewhzrrZljMCJnFtD +wVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZRvQEPSEiEBX2XgILYaykwXlkKwlukHcD1HvhPUf8VQ=; fh=NDkcCmflgZsGSiSjskszThji4SYIrQ1hJIxt3Zy9sPE=; b=TtX+9BTWQ8NJke3BZSCIt/B3HerSTc6zivd3U8olkeZ4J5XJFKImOOWWWlA8EnCB6u 40erd+ogQoUffkYWLs9PQx9spEZORJ2OyebxRZCFmjaZ1nFBbJkVTgVx84BdUaubclqk +2i0PO8VjvNgO1+xAOfvhorTUwX1a1Hf81uwk4bQeDLgtTLpf/BwqBNYUm7tc3WEom0+ 09TaZ4m2pWAn4VvjTF+Ttg8sJyyWSHVzNSimHu7SRw8EpqZ5rj0DWHaD7vPEAgddHaIy o1+TcepMiSDfnhAbsORhsleMB4wowrYjdZA4LT5UuqeA8i0b0PDowJtnAzbfgPOexd+X cdcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="Kv6E/GLJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id p1-20020a17090adf8100b0027540ebd2absi19241263pjv.187.2023.09.27.20.50.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 20:50:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="Kv6E/GLJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 560928060471; Wed, 27 Sep 2023 10:58:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229692AbjI0R5n (ORCPT + 20 others); Wed, 27 Sep 2023 13:57:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229668AbjI0R5i (ORCPT ); Wed, 27 Sep 2023 13:57:38 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6CF0F3; Wed, 27 Sep 2023 10:57:35 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2c012232792so200369041fa.0; Wed, 27 Sep 2023 10:57:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695837454; x=1696442254; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZRvQEPSEiEBX2XgILYaykwXlkKwlukHcD1HvhPUf8VQ=; b=Kv6E/GLJshZwmJmVNkVcbOuxJ/yU57YGeaSWbvI1ETHXwfNaHx8IyLNCR9CO5nA4WC WFMLLRs5lXxtyc0zdSu0DA3WUm/CUSs01hnQ0LasOszLMgvXXkYRzN7mJJaTdLLDUj4N m+iyx6dBfmRs2ZYXtlH+2GVuDx8lFtmrABkCmVG8Q5Wg9uPAq0GXtAzSr21kA+Ufim8B p7a8faA91Kbcz5UM+7sBCR9Ho/y/xoOTEq35Tw5zQeLyTg/5Cbgfn+u8Tj07si3413P5 Po2oBtA6nrnSmWRmK5+2iHNOPrh/BZCO3t/tMPlv6jQ/pamAJX2KKl0o81fJDUJYD8Tu Bd1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695837454; x=1696442254; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZRvQEPSEiEBX2XgILYaykwXlkKwlukHcD1HvhPUf8VQ=; b=oL4tcT/Pi84xSPmWS6U5g1QQxhzMjVZdph1NR3VMjDOEPy225u0tcHsc4EvuQdLkks MaozX5DPjJ4VQ1A4fWgv1TRJ8IzSODWHW1mG0YdMkg4Xkmm6M00ahfLXqpzPZyHYDHRv z2UgGatK7Smg4cCLwBf63/i9CfLPnrAGXPEKXhfJM+7pLhY0nrCIOxHQmIqIF9pCeh/W PxIxJPntUlbR3iSOg26FpcVzbIXtk5sn22JhVd/H/a7F7oPKsAUF6O9vYe14H5z9u3dN agte93HVbh+/yTMx/PB7vE2fFEUlmg+jxkQNKo2nOjP3nZQVWBSPVY0btvOrUM4dHtok Zyxw== X-Gm-Message-State: AOJu0YzMr1qH3z8qioL92m6zXxSl+PQNUAocxDNvzbDqQSEnDHDo94yW Pc8b3q21bAKAWw4nZkA61qc= X-Received: by 2002:a2e:9616:0:b0:2bc:cc1a:139c with SMTP id v22-20020a2e9616000000b002bccc1a139cmr2557448ljh.11.1695837453861; Wed, 27 Sep 2023 10:57:33 -0700 (PDT) Received: from primary.. ([212.34.12.50]) by smtp.gmail.com with ESMTPSA id d4-20020a170906370400b0099bd8c1f67esm9654593ejc.109.2023.09.27.10.57.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 10:57:33 -0700 (PDT) From: Abdel Alkuor To: heikki.krogerus@linux.intel.com, krzysztof.kozlowski+dt@linaro.org, bryan.odonoghue@linaro.org Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, ryan.eleceng@gmail.com, robh+dt@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org, Abdel Alkuor Subject: [PATCH v7 03/14] USB: typec: tps6598x: Add patch mode to tps6598x Date: Wed, 27 Sep 2023 13:53:37 -0400 Message-Id: <20230927175348.18041-4-alkuor@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230927175348.18041-1-alkuor@gmail.com> References: <20230927175348.18041-1-alkuor@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SORBS_WEB, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Wed, 27 Sep 2023 10:58:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778251741094135421 X-GMAIL-MSGID: 1778251741094135421 From: Abdel Alkuor TPS25750 has a patch mode indicating the device requires a configuration to get the device into operational mode Signed-off-by: Abdel Alkuor --- Changes in v7: - Add driver name to commit subject Changes in v6: - Return current mode and check it directly Changes in v5: - Incorporating tps25750 into tps6598x driver drivers/usb/typec/tipd/core.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 32420c61660d..58679b1c0cfe 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -68,6 +68,7 @@ enum { TPS_MODE_BOOT, TPS_MODE_BIST, TPS_MODE_DISC, + TPS_MODE_PTCH, }; static const char *const modes[] = { @@ -75,6 +76,7 @@ static const char *const modes[] = { [TPS_MODE_BOOT] = "BOOT", [TPS_MODE_BIST] = "BIST", [TPS_MODE_DISC] = "DISC", + [TPS_MODE_PTCH] = "PTCH", }; /* Unrecognized commands will be replaced with "!CMD" */ @@ -593,12 +595,15 @@ static int tps6598x_check_mode(struct tps6598x *tps) if (ret) return ret; - switch (match_string(modes, ARRAY_SIZE(modes), mode)) { + ret = match_string(modes, ARRAY_SIZE(modes), mode); + + switch (ret) { case TPS_MODE_APP: - return 0; + case TPS_MODE_PTCH: + return ret; case TPS_MODE_BOOT: dev_warn(tps->dev, "dead-battery condition\n"); - return 0; + return ret; case TPS_MODE_BIST: case TPS_MODE_DISC: default: @@ -765,7 +770,7 @@ static int tps6598x_probe(struct i2c_client *client) tps->irq_handler = irq_handler; /* Make sure the controller has application firmware running */ ret = tps6598x_check_mode(tps); - if (ret) + if (ret < 0) return ret; ret = tps6598x_write64(tps, TPS_REG_INT_MASK1, mask1);