Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2816217rwb; Mon, 15 Aug 2022 11:56:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR7xR+Uv7MFTaKb6humxBLfliXhH/MEpBLCuq13ED2vJXYE89dlT6CDfIKJ8yFKDTrFcXDMX X-Received: by 2002:a17:906:6d98:b0:715:76eb:9e33 with SMTP id h24-20020a1709066d9800b0071576eb9e33mr11333199ejt.729.1660589781629; Mon, 15 Aug 2022 11:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660589781; cv=none; d=google.com; s=arc-20160816; b=YE84eGcYC73dJHD7naah3/PFH41q0KCEfdcKA3ll+9KyqvBjhysaQ6WdWJ7UUoQy/d LTTPMIfq8T9LW5dixflIAkKz8CBWOPJ85TBdl4CpHInZ5Ek4/R7XlkFCDALdiB/PxyMp HlyQc4PISXuTIPqm32SjE79d89bmdYOEvZa+or0AY3QGyDFKzPRRKgTzP5PdfVozYIpi KA3TtEkLNOQ9AtC0a9tJqi9CsNY3EK8LGkM4x7JE3+j6rvekUOYP5u49b+5djFJHhGZ1 pdc9ajAXP+vC/50GMHy/uGQKIMyu0SWGAhbQBwisu/N0qs1O7sJU6HCwPL6sEOBrNPJV yo4A== 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=GVTBLjly6Jady3JO2PbuRt6Vi2Hw5kddrbFC6L2MxkI=; b=p/d6FhXxTi1vdxJSV/gdo2FzytDl+J3gQBgvZuBjWyW7ea68Y/YbXGC7ocS/EPrERF nOWvtfIimAMNHHDKfDzashBvH7yafbbl8LZb9IDv7GW2d5Vljt+T4l48A0XkJsWVaXpA PcrfNtMCgcrXREucoalgCsNiZpiyrynu/fZC0XTAnRtMINhvruxDJ6RHHHXDBvJBIW21 t8MBfUK1bYNwcp4UagguOwta/D2x16OLR9+UR5ISxCJ9cfKfDynIKGXM1zYwHFtDa/Yq prHzviB6n5/3faHJQNQIh1im9LgikWtwvuLlUKuwQv1uZBZlrxrXz6qlVtTWseJ2o3p0 uQAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JHmw0ZR0; 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 l23-20020aa7c3d7000000b0043a7c11a542si7329330edr.147.2022.08.15.11.55.54; Mon, 15 Aug 2022 11:56:21 -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=JHmw0ZR0; 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 S244223AbiHOSuk (ORCPT + 99 others); Mon, 15 Aug 2022 14:50:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243937AbiHOSqH (ORCPT ); Mon, 15 Aug 2022 14:46:07 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FB663F309; Mon, 15 Aug 2022 11:27:52 -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 sin.source.kernel.org (Postfix) with ESMTPS id 71C96CE125F; Mon, 15 Aug 2022 18:27:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 692C4C433D6; Mon, 15 Aug 2022 18:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588068; bh=Km42Bxm6yHHfHS41fGN5FwzM/bDyy4QOKUQuJLMLkqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JHmw0ZR0xQhy6jIhAjMQrHdvr+ufhIVvTw9brsk54BwrtQYKO1cLr4EijQycQ9C0n 1dAloPRwEKGVyLDE2uyZ9/YoWnPmnaKHmvYjy5LjxIby4bluGivzqkieE502GZizVN 5USc7gZYrvqBZ0Bf+/1xYd8ylEE9CBrztmP3fUzw= 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.15 258/779] drm: adv7511: override i2c address of cec before accessing it Date: Mon, 15 Aug 2022 19:58:22 +0200 Message-Id: <20220815180348.375452011@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 8c2025584f1b..1aadc6e94fde 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