Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp5676714pxb; Sun, 7 Nov 2021 17:46:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1/jHL8apy5lSPegsT81VVd7PiVWrFSjamGDMOaEIdOPecSWTNBdiMKptZaUc2NgA8IJVW X-Received: by 2002:a05:6e02:17cf:: with SMTP id z15mr52063351ilu.214.1636335987912; Sun, 07 Nov 2021 17:46:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636335987; cv=none; d=google.com; s=arc-20160816; b=w7Mwprmy0mCguf3NlKpkVrDj1HTRqQuto/hofAnaIcsZfoEQ9MQU7W6LLGD2QBaPi6 Ua5y/mv3U/3zNY2oTkzm9Nomekrb+DmJ5Z6VsEfG1EmXXHXoi41lAQ7b3rSohalpm5mr Ll/APZP0lzI0eonxrEvYwSkVEdWQ1lWJEFwqKvA+92+SKfocYoIqPEr/o9KUbPPxMZU8 ODdfwvEwPnu/hR1bs1Ej7/6EpkFlRppSt/yDGrOPOFR3vMg5TnSu/OQTWseRgLfaakyU jlzUcWvpBViZoqdCzrYvm7n1GR0tuMO9s01XSTnZClswY/k6QwnoAEI4UM0YzSphbELL oWNA== 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 :message-id:date:subject:to:from:dkim-signature; bh=gieAb75EtWuIBGxgsiwoBM412MaGDomgwM3zyOyuX8Q=; b=DwdqYvfyeVf9Mo6a2IwRBLoCgCJyOmdeRP16EPJNF9otUIYVmdPN6k6hDj/GPSGHw6 9G0o/P6np9RxT8G4H1z+i7YUwLWR5dmm4XmG9CNp4Hkd18QU1RhEmxrMV4XksI5TF+0b ybc4YsngnpA0qi9Q1NiKXpU5UtRF/oKOJI7wWJMus3uFRXje7I2p39GoB/w03VXfOgHA hrff/vKNEOyJLlW+kobw3Rl6XLqjJvbbso5cX7k1KgMtIH4G5q3VDTJQlhUBWU3uMQbJ r4kxoybXX8Rq9mNIydBXUi1wWPG8JhrI/8XYamsYnoTu8UDn00hD261YXXo42Eenp27D 09gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=CgXQVNPl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=megous.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j3si22555121ilq.96.2021.11.07.17.46.15; Sun, 07 Nov 2021 17:46:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=CgXQVNPl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=megous.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236189AbhKGTEq (ORCPT + 99 others); Sun, 7 Nov 2021 14:04:46 -0500 Received: from vps.xff.cz ([195.181.215.36]:41346 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236173AbhKGTEl (ORCPT ); Sun, 7 Nov 2021 14:04:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1636311279; bh=Fb2lbIy0DxeOVrDEvMYpc879rA2zbBbnXd2+sxXDYNU=; h=From:To:Subject:Date:From; b=CgXQVNPlVcX3bB6kx3o3bjM5mqqymkTx1KFOMLQBlafOju0G6jv4uZBlNbJ/v/2zw i4epAT3uTOeSaDF7oWmi/8Ky3qSAEy65DN4pTMNIxkR56g8PVP+87WEXxPa4OKBj40 20n0lQ8VBnmFocwnQV10NewjusgY3TTtMzoVUOoA= From: Ondrej Jirman To: Guenter Roeck , Heikki Krogerus , Greg Kroah-Hartman , Ondrej Jirman , Badhri Jagan Sridharan , linux-usb@vger.kernel.org (open list:USB TYPEC PORT CONTROLLER DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 06/15] usb: typec: fusb302: Fix masking of comparator and bc_lvl interrupts Date: Sun, 7 Nov 2021 19:54:33 +0100 Message-Id: <20211107185435.2540185-1-megous@megous.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The masks are swapped (interrupts are enabled when the mask is 0). This caused inability of the driver to recognize cable unplug events in host mode (where only comparator interrupt is generated, and VBUS interrupt is not). Signed-off-by: Ondrej Jirman --- drivers/usb/typec/tcpm/fusb302.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c index 7a2a17866a823..72f9001b07921 100644 --- a/drivers/usb/typec/tcpm/fusb302.c +++ b/drivers/usb/typec/tcpm/fusb302.c @@ -669,25 +669,27 @@ static int tcpm_set_cc(struct tcpc_dev *dev, enum typec_cc_status cc) ret = fusb302_i2c_mask_write(chip, FUSB_REG_MASK, FUSB_REG_MASK_BC_LVL | FUSB_REG_MASK_COMP_CHNG, - FUSB_REG_MASK_COMP_CHNG); + FUSB_REG_MASK_BC_LVL); if (ret < 0) { fusb302_log(chip, "cannot set SRC interrupt, ret=%d", ret); goto done; } chip->intr_comp_chng = true; + chip->intr_bc_lvl = false; break; case TYPEC_CC_RD: ret = fusb302_i2c_mask_write(chip, FUSB_REG_MASK, FUSB_REG_MASK_BC_LVL | FUSB_REG_MASK_COMP_CHNG, - FUSB_REG_MASK_BC_LVL); + FUSB_REG_MASK_COMP_CHNG); if (ret < 0) { fusb302_log(chip, "cannot set SRC interrupt, ret=%d", ret); goto done; } chip->intr_bc_lvl = true; + chip->intr_comp_chng = false; break; default: break; -- 2.33.1