From patchwork Mon Jun 25 08:08:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10485263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AD743601D5 for ; Mon, 25 Jun 2018 08:27:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9839F28863 for ; Mon, 25 Jun 2018 08:27:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8CCBC288EF; Mon, 25 Jun 2018 08:27:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 198F52889E for ; Mon, 25 Jun 2018 08:27:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752580AbeFYI1A (ORCPT ); Mon, 25 Jun 2018 04:27:00 -0400 Received: from mail-eopbgr60084.outbound.protection.outlook.com ([40.107.6.84]:61952 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751469AbeFYI0z (ORCPT ); Mon, 25 Jun 2018 04:26:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OwTHPiM6T546g3jxJ3gIf3117HG7dd2IEaRToXadVfQ=; b=Ob9G4dXsxZkIPN+Q6SZynJasyuTRR/AKjbbviOA4SjDjwTvO0dUgWU+H2P+omRW3kdhWrDKiuFsjzwY5vT9xFPcC82Sn1PY3J/iCqJINzJ1tt+qpMd4o9wYniEvRZCHOmFw/iPpBw6TEdBYnAV89jhicqQasbBJhT1snVx4Q6cw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jun.li@nxp.com; Received: from b47624-OptiPlex-7040.ap.freescale.net (92.121.68.129) by VI1PR0402MB3920.eurprd04.prod.outlook.com (2603:10a6:803:23::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.24; Mon, 25 Jun 2018 08:26:47 +0000 From: Li Jun To: robh+dt@kernel.org, gregkh@linuxfoundation.org, heikki.krogerus@linux.intel.com, linux@roeck-us.net Cc: a.hajda@samsung.com, jun.li@nxp.com, cw00.choi@samsung.com, shufan_lee@richtek.com, peter.chen@nxp.com, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH v7 13/14] staging: typec: tcpci: Only touch target bit when enable vconn Date: Mon, 25 Jun 2018 16:08:45 +0800 Message-Id: <1529914126-22550-14-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529914126-22550-1-git-send-email-jun.li@nxp.com> References: <1529914126-22550-1-git-send-email-jun.li@nxp.com> MIME-Version: 1.0 X-Originating-IP: [92.121.68.129] X-ClientProxiedBy: HK0PR04CA0004.apcprd04.prod.outlook.com (2603:1096:203:36::16) To VI1PR0402MB3920.eurprd04.prod.outlook.com (2603:10a6:803:23::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ec131f2-c174-406c-cda8-08d5da756728 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:VI1PR0402MB3920; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3920; 3:dIsLDGczQlR5DJf4QJw2ZAX7rBtB+lt9pEtcVQ83qFYieiqHga5Ztfwd8GDd1yxScxpkpbWmo0fBBP6N7VFOwVamggB3dfJa7i5pWsIPgb9EBk3cn3KTONpbeHhYIIqFK/I8ig8aNxWYFwogIkDKOBHicnEGzHANjoOn6/492inVswxS2YR64hK13sisrZlXFsZ/OoD7ruNhUSH38vLNRzI9GSVsGI5YWmgcW7kYhd2K5Qs3OM+5Q/9C7BUydd8F; 25:c4BGdUzO1OzVgaNKLEC22osL04Adh6YJn63YnNNbkBpaiLihD9JogL8QapFR/OHskp01n9RRcfx/pJLKdSHFD4/YvFUlD4T2zOwbbtJe+G2KOkHIFg8/dMA3MjCly6f3Z5Nt3KDcq48JoI+FIMMsWbGM/QENjq8kIZxgfoFmKvXM1fW1TMK8QFR0kvqQNGlf+KYC6cmufjVQTvChTstQ+Q75mSMP6X9fgKfxEoE4TUJYUepSBlW6e8uEh87a1kSma4zoQRHqUsHyCN24IUJzMenTK5wBwYVXakt35iU2oW0fDA+RM+QVIIV0uWBTfB4fN/JccXs9L39XdzrdwNfFGw==; 31:kGSMxr3K+Rfo4vl7ehHNwvVBF+ENBIC7qL2b/dmhMJY4z1jwQnKW+AoeoafwKEI82SJ7Q4suLgf1pIQelgZ/7Kc/ML8xe/xU0Z16kjASzDKdknipQc3VAsW5XUdXJjSyhAu08Ncch404fl7OdgKd5pRMEKSg5t2EQBEB/8XyDqTsOzCvtdLkP4UzL2Y/no/+EKOPsCzqpJYax6hCXKNOAk3xMLIfooNZQXILAp7yMDo= X-MS-TrafficTypeDiagnostic: VI1PR0402MB3920: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3920; 20:V3wX6ArQLYYLR4GuCmz2XEX/MbQ1WSiB+s26Uo6+68hM/0/vUJhzGE5QEuqDbBKQPOUWqenHX0ZNMdWenvkhZ1aX40Je8q+BnRsn/GTkzDSFtr8vmGIu1W+Nw2EtB1wrNeft3ULiXAfusaOW4kP4/5lVHEmyT9nHzmMzAHfhhnNYL655uxNv6lE7OLMEakNNCvh9hiFge389/lQJJURSwCjOT+gos4ClBN6wmKl6ZWitHTTOXyU99fXh+n6NlnSdAOKTeTEeU4+vNVxo1/MPixcHWXhGclp59QlCqe4dLKp6q1fui0PQbJDjls1NNtJNLqYRR2UHrJ9Urj3O9hxCB6jeiHimmYsDlGZs5CTVMrMTDaBXkWV8rbhv+naOgSZ/w8A+HZDus+iN+eAlClg4nHSHy6TXI3V4yBPEZOuhlGwgS0EL+8vdRnHvEIUgO3XMYUWdLJmml3LMOyzuY2fUlpCmTH0AHDTFL7LTm1iIADCYq4lMFosyNve/KIsqf46b; 4:StQwFh0wV5UA6lO7Tfgb0AnDXkC6peyd7kl95GTkHmVF0+tXxignZclRdndj/+UXZENDz2pBf2gfXgqLNd8Fbg84xicNXeiH3jS4gYZu+dNjLtISp8dWh5Du2WzLb4WyDOtiALa7Gt45LdaAZ1W89DTbu8RHVlchXrGH5mfyzqry3jpSQjitiu/wBDntW1IX7uLD1AHgCoQ8Th8O6Vb6mu0FE3JhkPhvV9yqqKUlRgInP0hIb8tqOQnD/W6tdTbuu43viRefBBeZnw1MswUookUnFsaq/Gi0xhpwh3ZuE/5ol29/R5JGxICChq1b/QWMeUW2r36y4kPao98ppRtn6JALOHlS9+4pWDQYcMtTWig= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:VI1PR0402MB3920; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0402MB3920; X-Forefront-PRVS: 0714841678 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39380400002)(39860400002)(396003)(376002)(199004)(189003)(53936002)(25786009)(47776003)(316002)(2906002)(5890100001)(16586007)(6486002)(36756003)(4326008)(386003)(6506007)(186003)(6512007)(478600001)(26005)(16526019)(97736004)(8936002)(86362001)(59450400001)(50226002)(52116002)(476003)(81166006)(81156014)(486006)(76176011)(305945005)(51416003)(8676002)(2616005)(105586002)(68736007)(446003)(11346002)(66066001)(5660300001)(7736002)(50466002)(3846002)(106356001)(48376002)(6116002)(956004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0402MB3920; H:b47624-OptiPlex-7040.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0402MB3920; 23:sZO65ky60Hd5MZAxy0jsdqqsuGzNJHhs1/riGt2?= =?us-ascii?Q?+zpuQ9MzkYRnVM+CVCYfz0qh9dQ6CNztHLMEPfMQeDtnw3m2di5LUqBkmS3t?= =?us-ascii?Q?st9WkN+X5QJXUYdQrT/iOdYdGVscE4HGROdxLc0OpWlj4QHI/TQLk9iB7sOk?= =?us-ascii?Q?5ygYfjL444XHR6RvoBiENaqlyAqVFLGTxU9dLct68MaHqJ1Pr+KW6yPFxo2r?= =?us-ascii?Q?pO6y+nLoiQvgaOB704PzaBxL5s7DY7erd4UXnQgrT6kz0SsBzc0sa6VCZgCv?= =?us-ascii?Q?+YObc4UdTle/MZ00XM2oXBhRyI2OwPZA9NS8B+SrSd8fcWZONCSQE9xbdUj3?= =?us-ascii?Q?Nklmgytq/VJ1XrbIwzWSSvp6zFkhdxKh7SIr2TUY7voEHVvU5lyuPpB6l/ut?= =?us-ascii?Q?OjrKsjmKCOhkdWC2PfP62xmuc2WHlgZVz16npuVKOAalHD55yChdaOpeS4aX?= =?us-ascii?Q?PPEOy3R4nxI2QBmZlfNSq79yHcA4DyW6tnThEHeB8d6I28rRyZ3Q35T+s3bB?= =?us-ascii?Q?0ZFhSO4RVEsTYivUgPvXRdWKneWWXYH3NhezpYXbTc4sRkWvIIja1AExnFAy?= =?us-ascii?Q?0zM3ZcL9Xw7n052LpyjjekXyh5L0977BqKpjUX2QxrzkL42pW/VYX4/tM+P6?= =?us-ascii?Q?KZFkWZEO1mPyQ2ziQbv8UFkl/bTebF43ar/wUK7Udv+pcf5er4bykzKnwYy6?= =?us-ascii?Q?aXEpQzSyrFZB0Bjcon7Ha/CrdxlP1gYg0orLgSZH8eONZKZug14YhEeHxWNt?= =?us-ascii?Q?u4DEMi9apVunIWFxdynNtyjRkGgEv+yHr1s8EGqOHXvZxFFiyMe1tehDbiss?= =?us-ascii?Q?2vF8MCTsGw4kUTJo8gbXsZNPYMTlsCQaTPdSplwWt549fjo15njx9KOWttiD?= =?us-ascii?Q?piddvfJHj33157/f2bAVnCcT8l7NXG1TFJdxN9GPHbe/59Tf/pYnGXKIp8EO?= =?us-ascii?Q?ZvjvU3xrjhwKvbAwLyai17Tpteo12IUB1Gp3PYgAFc1A97J9WVDnFyczRcPX?= =?us-ascii?Q?TzYwLP9qSbOdyYnkuWY8KJj63er20SrJlNraVye/5Wi22qogCKDyxAL8FSgV?= =?us-ascii?Q?AjH9auJnQUb6W1bA9FvIp+dv80BFsGMlgjl+/ZXaVeha6r+FZt+ro+gMmAbX?= =?us-ascii?Q?GlIex1NeZSv3uf0w77oHk6PTqG2Hlt1/7xGu+tm/L3NEbcq/zEa/xT9TPiHw?= =?us-ascii?Q?Zd34f0kXXAn1z79g=3D?= X-Microsoft-Antispam-Message-Info: 683/97EkpfOK7fjlzLP4ujE6DYvYufTHk8gQnDXGruHLaTVPRRXvBZSTdbsbgkEVe/wSyis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IvQFLBaspD4B0C+WOHs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3920; 7:+iRPM7EfuOzTY2xTfobxX8Zs9yTjQ82uo/NDE7ZBeH0lU1bnQT5AGQz9AF7jTBlem8C1K4ycdCmNwHnl+BXUklD80GWmY5B8YVsEepPWsTXyQV7yH2XgPpuZKnvSDh5ehziMrySquzk2h7xYU3BiM7UkxrLXQXD8L0KcAEq2LLREFh7LNaC4cymkDXW0+V2Qw6lrrVDezX5mcDHE3Hs/6/13FRH1IyYMv6jWqzmjo50wU1PetCuW1h0MSfrhpy4F X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2018 08:26:47.3611 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ec131f2-c174-406c-cda8-08d5da756728 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3920 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We need regmap_update_bits to avoid touch any other bits when enable or disable vconn. Reviewed-by: Guenter Roeck Reviewed-by: Heikki Krogerus Signed-off-by: Li Jun --- drivers/staging/typec/tcpci.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c index 11c2d37..ac6b418 100644 --- a/drivers/staging/typec/tcpci.c +++ b/drivers/staging/typec/tcpci.c @@ -218,12 +218,9 @@ static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable) return ret; } - ret = regmap_write(tcpci->regmap, TCPC_POWER_CTRL, - enable ? TCPC_POWER_CTRL_VCONN_ENABLE : 0); - if (ret < 0) - return ret; - - return 0; + return regmap_update_bits(tcpci->regmap, TCPC_POWER_CTRL, + TCPC_POWER_CTRL_VCONN_ENABLE, + enable ? TCPC_POWER_CTRL_VCONN_ENABLE : 0); } static int tcpci_set_roles(struct tcpc_dev *tcpc, bool attached,