Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2929193rwb; Mon, 15 Aug 2022 14:14:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR53ksYQOAOnUS2S2Cy+hEtb48f2dL2OHakYhXKFpbE793HU2Us0lWi8EpTeharGlZrg2iDb X-Received: by 2002:a05:6402:540f:b0:440:d9a4:aebf with SMTP id ev15-20020a056402540f00b00440d9a4aebfmr15910878edb.196.1660598093875; Mon, 15 Aug 2022 14:14:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598093; cv=none; d=google.com; s=arc-20160816; b=GfuuuD503P8blfAIVMGBCs1hDApzMSuIjuLc+QonKld+Ao0PPtFABteZEeIUSu9yMK h8/oU/A951ofbJAAjQ26OKy1nfSlMYS5kcYcVWgyikQP7rwBivby1WI+a3tNNj1YVu0k DqsAr6P1A5bO+XbBDJqwRdmDs+3cmaIH3zUCFq0w7iZaXpsnN7ITn6FMCKE9UDoZ5DZN QPe+M88LYp12zJLJhs+VdkJ1PGt0GpkSmE8C7QEV2y/LvkeEOlQqGMnbBBco90JZi004 ZZ7aF0E/fU98StEqdkfbOl2Sc/4qU6zsypZs48FRVyckHx0gbaqmE8Gs/0gDlUAsgR00 Z0Hg== 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=q/n1yGkh+trB3RWhqpUx8mKLN9QdBEJls+8hOPlK+JA=; b=FW+ChOFnYl4JP0CoQl/sI/my54hMHRxSnzMGBcYJPoG7IubrXAvS014xT3xukp6Jbv nyHTrhM8/41bKrKtl/0Y2NSarlfJMkGYiTi0e9VTRfVmaJDabXx5MmsFfXR2ADlyfkxJ GNwJpx60DJ+rGTiE/Ag5SK9r3pAPecMCQeWR4IKew/uMa97/oQS5Xi/OU1qRhGkRPzvn CUaH62CyYz1P4bpwnQv2xi+wJtqx/yfdSuL4tEyHqMcAAOHrh1BHTjS/ORP8zShRr5DP +NCwoMsKpLPeVPYUC96tXs4AmeMXKdft8CmbSxRl+wVODm8ZO2LMNP8DccBrECSeaFSg OVqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=c0d0IdKo; 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 b22-20020a1709065e5600b0072f579adddcsi7438012eju.519.2022.08.15.14.14.23; Mon, 15 Aug 2022 14:14:53 -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=c0d0IdKo; 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 S239528AbiHOU7x (ORCPT + 99 others); Mon, 15 Aug 2022 16:59:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243237AbiHOU7P (ORCPT ); Mon, 15 Aug 2022 16:59:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D9B1C12F5; Mon, 15 Aug 2022 12:12:44 -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 8B563B81115; Mon, 15 Aug 2022 19:12:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D167EC433C1; Mon, 15 Aug 2022 19:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590761; bh=lk2zibXRueDTL0wCxC95DGvLzHBQdWK43EkDL47d7qM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c0d0IdKouN+C0e8LSqdlOI+U0EKfz9wp9URgllk7W0wSU02H2s+zD9H7SDIDhvKcm zfWIZu/dYuJZG0YizTao3+A141CxYABo5GP3CaJfFwPTFdGpMA/pZXV/LOMNIYN4cZ Qv2hfSLXQGBjT9tDxfhSxE8GwYNrsT8JFAi6K8/M= 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.18 0332/1095] drm: adv7511: override i2c address of cec before accessing it Date: Mon, 15 Aug 2022 19:55:31 +0200 Message-Id: <20220815180443.526274369@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 668dcefbae17..fba6ad3bb6ad 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1060,6 +1060,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, @@ -1264,9 +1268,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