Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1862780rwb; Fri, 19 Aug 2022 10:37:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR4JM9D9XKfCPGEyDNC0F2LaQpr7wIY/X/4IwSnbBhY6/VdyqyCOA/kq2xaUR5m3HuFKFLRs X-Received: by 2002:a63:d10f:0:b0:429:e6ee:780a with SMTP id k15-20020a63d10f000000b00429e6ee780amr7219533pgg.31.1660930660467; Fri, 19 Aug 2022 10:37:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930660; cv=none; d=google.com; s=arc-20160816; b=em8H4FyCz7nZm/85LHkSKBZ6pnEzFtnl3nZqKkSKSZQvFcro32gTTrQ1797kTJgfyv 1JQJKSfb1m5ugvvRQE5PMK7IGrACMa+pb5XpwVoR5b/6rK0QmdntpHNHsOwRyzBN27Uy 2dOwky1puEtHHBdmHJokZ+GliELMjRCi+FbOVFK3c/RCyD9KXbAvSeJHnthzIpF3q2SU jEZ7vZoU4EQRoWqgPNTaVxiiJHw72VqPK8upe8GD2nYZgE0zk5YUJ8Q08TlCAxdBX8zd Y9br6fNKymZcM43im0+N1iT7dPpXnXRkw+r3T2hPQTcUt2qY746jzMqyA4Zp5TCFm3LP 4GwA== 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=FuAkFLNfi29l8NVmnC+40WziZq1o08M3J3SaUH1GCYk=; b=vbX1ktn5Holo2hEaWI7ACb4caoLD2DbIV8hNoAlCAc5wYUQmoldtfWtftj2I2kh+sR 8LZpvTZhvWXjeGBOEZZGh3OYydY2PTJwyx7IfMOwH5CYRu7ipfLdTfPV9oxd23zY3U/7 eWHUa8FzoeQBKOR2xY+NthEKixocIGlB5bM0ZUxmIHdVwMhE/fB0waJQvhjKKqhpA9sq cvHwoYJ5AdWMCG7kTnlTyNNb9hkbOXl5xzg3/gRSU9dYyMdLuYlZBDTymdZ+FWAbXWCn ZO1vSVZ8bzVnOXriWCmZtSUBG7d+/ITRLAWBEPwXdEWWemL8SLPuF6S16Z79udbTRcG6 oLQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GerEcomt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n12-20020a1709026a8c00b0016f8f52c95bsi4238931plk.71.2022.08.19.10.37.29; Fri, 19 Aug 2022 10:37:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GerEcomt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1351316AbiHSQHC (ORCPT + 99 others); Fri, 19 Aug 2022 12:07:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351636AbiHSQCS (ORCPT ); Fri, 19 Aug 2022 12:02:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CB99D4199; Fri, 19 Aug 2022 08:54:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2F162B8280C; Fri, 19 Aug 2022 15:54:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 165EEC433D6; Fri, 19 Aug 2022 15:54:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924445; bh=vlLaho7aPIYCSWSRoTd5tegJqakUGZ2amDCR2GU2kVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GerEcomtk5ahfTCQbdD9S1WgZLLlvRjPcHimKePh0CdJSP9fZPXwTxaVjAyOwDofg vVNbfEqfC7tEbT+x4a6ZMovowjgftP1NBcWFYZpvfnKuIaVxBh5yh2yTYd4nXm9Y3t 7PVFFF2P8+BcHbZR3002P1om5/5vXUrSPrdh3zcw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antonio Borneo , Kieran Bingham , Robert Foss , Sasha Levin Subject: [PATCH 5.10 172/545] drm: adv7511: override i2c address of cec before accessing it Date: Fri, 19 Aug 2022 17:39:02 +0200 Message-Id: <20220819153837.055998390@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Antonio Borneo [ Upstream commit 9cc4853e4781bf0dd0f35355dc92d97c9da02f5d ] Commit 680532c50bca ("drm: adv7511: Add support for i2c_new_secondary_device") allows a device tree node to override the default addresses of the secondary i2c devices. This is useful for solving address conflicts on the i2c bus. In adv7511_init_cec_regmap() the new i2c address of cec device is read from device tree and immediately accessed, well before it is written in the proper register to override the default address. This can cause an i2c error during probe and a consequent probe failure. Once the new i2c address is read from the device tree, override the default address before any attempt to access the cec. Tested with adv7533 and stm32mp157f. Signed-off-by: Antonio Borneo Fixes: 680532c50bca ("drm: adv7511: Add support for i2c_new_secondary_device") Reviewed-by: Kieran Bingham Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220607213144.427177-1-antonio.borneo@foss.st.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index aca2f14f04c2..8bac392cab79 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1063,6 +1063,10 @@ static int adv7511_init_cec_regmap(struct adv7511 *adv) ADV7511_CEC_I2C_ADDR_DEFAULT); if (IS_ERR(adv->i2c_cec)) return PTR_ERR(adv->i2c_cec); + + regmap_write(adv->regmap, ADV7511_REG_CEC_I2C_ADDR, + adv->i2c_cec->addr << 1); + i2c_set_clientdata(adv->i2c_cec, adv); adv->regmap_cec = devm_regmap_init_i2c(adv->i2c_cec, @@ -1267,9 +1271,6 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id) if (ret) goto err_i2c_unregister_packet; - regmap_write(adv7511->regmap, ADV7511_REG_CEC_I2C_ADDR, - adv7511->i2c_cec->addr << 1); - INIT_WORK(&adv7511->hpd_work, adv7511_hpd_work); if (i2c->irq) { -- 2.35.1