Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp633612pxv; Thu, 15 Jul 2021 12:03:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpvpS07jcHihkpiqiOjFQYTRxVRhvaZUzVkz3Jy6mdj9BoQBofAlGu6vwVKh1VhXyG/vVt X-Received: by 2002:a05:6638:34aa:: with SMTP id t42mr5300227jal.128.1626375803893; Thu, 15 Jul 2021 12:03:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626375803; cv=none; d=google.com; s=arc-20160816; b=XHhbSLiqbhqVr7iJ5MaUJXVDbIw2azO2CUeL2xSDEViJjEmscqskzO9cw3FYTUUkYH aYTl2h5MA9YBSs3vHcY37pdiMXE98i5AWI9L2dSl2JCJfwkPfcnq2q18cySK9LIECKWj AOA04YPHirGMsreb5G20nXYQ3hOgV5U/AgRTR3AvBH2E2B4a/wrxph3Lz5npEzE+Z7A1 kTnfLFPfWgibHFdT7Cb5zQf7fYL46UPL4BTkJ6REuJuOFEgolgKgR8N/xt+cqV2O1nJC hlQiSZ8Woakq2fPbhYsqQtTMUkfKi8zXXnpSD5riTtXBxqnkrzLGmA4d0Q0pL7eU4ba3 nvtw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K2TqFj+sUmMwI5FNx9uqFu1kEOPPJY+zbDsVbSUdU7w=; b=cYTAgtcwVGn+lMEDr+L3y5qT74ZrsynvYk6UQCHPad4DyFPya7uOPLbbdADc+HVnR1 ypzA80dSKKn//WOXQhMXpiWK+sGYUYIUWkx1pzILNQoJtsVk07diOaWWO4kXdzfTVt05 D/DJajDe/kRRkPsUJ79Kn1iT2mNIXr+nDY4Nr+SQu4VMh7ehfP6JIEOlCdTvOQf9ZMM8 1nTTBibJSbUpNPDgt0Io5CnfV6kF2PLRUNALyvKp+O44Z1KRZkqDxNsK2A6l5z7jq9rA /74nzTL7fsXk80CnznX8MWeFlQacja8QqDVmll1BAs4/m9S99gZXqZ71HNOxc9bU/SAP Zvuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s3pDV7Lp; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y9si7355923ilv.11.2021.07.15.12.03.11; Thu, 15 Jul 2021 12:03:23 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=s3pDV7Lp; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241950AbhGOTEp (ORCPT + 99 others); Thu, 15 Jul 2021 15:04:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:59828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241803AbhGOSzu (ORCPT ); Thu, 15 Jul 2021 14:55:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 488CA613D1; Thu, 15 Jul 2021 18:52:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375169; bh=2wcLH/MjR6vnjHJ+bCuMtovL+XwRk6NvzTwRJB2jEXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s3pDV7LptHn+IhFhKpmLvwQV1sxhbIP/vT2FszhldnD4mlKMIqkJ+XFnzsJHQRsQk vIbMt+Sep6MQJoy7SGcB8VW7glvUg7lNve1u87jY1tghqV/cDJahPubb/aefIYrr4F OYXFkYy0nrqkG14pH/PWgjHyOxZg2t13nMcnNMlA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Ferry Toth , Chanwoo Choi Subject: [PATCH 5.10 187/215] extcon: intel-mrfld: Sync hardware and software state on init Date: Thu, 15 Jul 2021 20:39:19 +0200 Message-Id: <20210715182632.285294831@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182558.381078833@linuxfoundation.org> References: <20210715182558.381078833@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ferry Toth commit ecb5bdff901139850fb3ca3ae2d0cccac045bc52 upstream. extcon driver for Basin Cove PMIC shadows the switch status used for dwc3 DRD to detect a change in the switch position. This change initializes the status at probe time. Cc: stable@vger.kernel.org Fixes: 492929c54791 ("extcon: mrfld: Introduce extcon driver for Basin Cove PMIC") Reviewed-by: Andy Shevchenko Signed-off-by: Ferry Toth Signed-off-by: Chanwoo Choi Signed-off-by: Greg Kroah-Hartman --- drivers/extcon/extcon-intel-mrfld.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/extcon/extcon-intel-mrfld.c +++ b/drivers/extcon/extcon-intel-mrfld.c @@ -197,6 +197,7 @@ static int mrfld_extcon_probe(struct pla struct intel_soc_pmic *pmic = dev_get_drvdata(dev->parent); struct regmap *regmap = pmic->regmap; struct mrfld_extcon_data *data; + unsigned int status; unsigned int id; int irq, ret; @@ -244,6 +245,14 @@ static int mrfld_extcon_probe(struct pla /* Get initial state */ mrfld_extcon_role_detect(data); + /* + * Cached status value is used for cable detection, see comments + * in mrfld_extcon_cable_detect(), we need to sync cached value + * with a real state of the hardware. + */ + regmap_read(regmap, BCOVE_SCHGRIRQ1, &status); + data->status = status; + mrfld_extcon_clear(data, BCOVE_MIRQLVL1, BCOVE_LVL1_CHGR); mrfld_extcon_clear(data, BCOVE_MCHGRIRQ1, BCOVE_CHGRIRQ_ALL);