Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp712919pxv; Thu, 15 Jul 2021 14:11:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybKFOzVIgeqPc33qvcMbhn1fNNjFLYrbGjDrT78MN7nqrupQjZXGoL1St8+FY2HSQ963zx X-Received: by 2002:aa7:c550:: with SMTP id s16mr9746028edr.130.1626383496935; Thu, 15 Jul 2021 14:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383496; cv=none; d=google.com; s=arc-20160816; b=sf8xOp2ymeA3tOjlvgaQokDcaESy6lJPtKKa1S7JiwTmO4K9XFWb9tPeGq2D8kN9XW n6DfFvnlm2E7+w5Y6kWU1ABCw5egvBwPEWItog2YbB3gQxfGxu3aOPCViMfHFBLButdy 2CzlqGqK/SmpROdmnwqCxZ3r9xiTwHMh7BNnPekDJB7CTixtyFGmk7uClsHntulPDseB eoTcYAJyZBAAb5ewWrgyzS0mas6olNbI+HCyNB58JPw3BK7RvVnxMf1KpuPcOv8+GgEz acD1kp4lajvvzg1Dfna/ZklRX9Rdgm7lSQrjiH+P4ODj4x6kYU4b19qMwI0FCFAHEBTI hwEQ== 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=qMO2Qml8bYMRg35dj3+PmVoii55Vh0yfB1o4uacdaTwW9XA67JoZXYr8dw5SO/FI2r AWGclGWjrlwHgCrJVW8/smViH+g1swe4MKrVZMSC/2a3vNIYw8kHCXFSthCx2caIE8da +7wNgeh0Zx4kohEd6/U9+2uWESJNsWBV3sO9ZbOkz3itC74PgxzMUGc/2pIa0FfkFKq3 yv4T9nXDJ3h9+AEJATLynNlahCsSTyhqxSXC4c32Grj9cwuuzqrNjwWQTkgKW+LV8d+Y xBCodJ5agjM8evMAcT3ZDeIr0r8Ba6SKfyJsDnaFyhjrUKlXaajmBYI7dGf8c86v3bqP 9yCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hNXSrVcy; 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 k5si8924658edx.484.2021.07.15.14.11.11; Thu, 15 Jul 2021 14:11:36 -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=hNXSrVcy; 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 S241195AbhGOTXV (ORCPT + 99 others); Thu, 15 Jul 2021 15:23:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:46406 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242159AbhGOTGx (ORCPT ); Thu, 15 Jul 2021 15:06:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 368936127C; Thu, 15 Jul 2021 19:03:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375780; bh=2wcLH/MjR6vnjHJ+bCuMtovL+XwRk6NvzTwRJB2jEXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hNXSrVcyZxHnI5b3Llj9hzxashOSkY2td+LNELrkblL8znqIRaX234OuF4trO3GLP phcJ3xyXsTgbYtpBjuY8N0ddBTF74VwaTqs8PT4XQCOvwu0TXrmTGkcsczO1pAGAxj j6pCqumqA8axjWB/81ph0MRxSkMiVgkw/I81HleM= 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.12 206/242] extcon: intel-mrfld: Sync hardware and software state on init Date: Thu, 15 Jul 2021 20:39:28 +0200 Message-Id: <20210715182629.540959036@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@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);