Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3088754rwb; Mon, 15 Aug 2022 17:51:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR4qsY2FlalieMFHDndV5wqdYmbRZ/P7yQFu5A3gFI/Gh4krHDjzvSz2bnEkhEEKOFP0CFmI X-Received: by 2002:a17:907:7d8c:b0:731:65f6:1f28 with SMTP id oz12-20020a1709077d8c00b0073165f61f28mr11345708ejc.91.1660611074400; Mon, 15 Aug 2022 17:51:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611074; cv=none; d=google.com; s=arc-20160816; b=YX4oSb7muvSTHNzCA+WjHQOzdg75qVMFBnAcCu2koKeQKneH4r36zaxcRNCrOvGbkp 2f3doCvebUwBk/Df4JbGO+dDbAjhpKUH2nMS4ULWPHpfd2bg64GYTP54+lA6WDY+p47b EZ09XwO3iedotplVGWoaHef+XKE0IZnVBxzP1XJVzo1AKP2r8aN25ssHgW6Licd3V7q6 pVMRlz80Ykgrt2jBy+KwFbqs24kHEzbYso+/tn+p3Kc6hDMt0AIPljZjEJMmN8wihIWA mHlG033b+eIKyl7WAWkisgEk/f6J1Vs6+3D2IBRFD8MAGfVkNmvjFthOBgt7BuTPv7dH wEoQ== 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=FMhgBS4gfZz4lqj3asEHQJG1SzoExXSa6FAFSdu5IdQ=; b=hbI9mvgiM4g+VvIr5QICJBhB1ZQe8faIkiXok6MbL4RBsJMZm0cgEl4YZyS4CWPifn qZ/MhVnIIHbPzLAuOP+Lw05Jl2nPBbgOrNmJ3klCWfKIDZoGqL3TwbymWd+/oGOJIV/M Rg4PhWgXue/SaiYt5m2eRNGq1ClxGbM5/5FKtVPQmH1MCtQx5tt0qhWmrMr0W1A1qRMU zJTfxiPaZfgmJwqoVuVBmHvcGU4ssqMBT6FypGBDiKbxXEfiTfeWJ6aosWoeTEQZfAzx h9IKIrIVWwbqoFbD3saTm52ccrQFc9z2189K6BIQg9fWDTZLC1yfJXq26rEb8X1/h1Kt lmCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bFUgOM2T; 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 s19-20020a50d493000000b0043dfb97250dsi9764217edi.599.2022.08.15.17.50.49; Mon, 15 Aug 2022 17:51:14 -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=bFUgOM2T; 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 S239993AbiHOXah (ORCPT + 99 others); Mon, 15 Aug 2022 19:30:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244651AbiHOXYP (ORCPT ); Mon, 15 Aug 2022 19:24:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54A5E83BC2; Mon, 15 Aug 2022 13:05:40 -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 295F1B80EAB; Mon, 15 Aug 2022 20:05:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83B50C433D6; Mon, 15 Aug 2022 20:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593937; bh=WrzGLFApLoZLo4blFQINQGoARKbOWdrNQe3OZezCUik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bFUgOM2TV8oXsaWxBuWIrxqGN0SecwgTgzHYx9p4YPLrRU3OyFSq/fb7UK8IPh5vB cK7J2SrsMHNAxZqoZfDSHEo1e1gMvu2EONz9QeidT/Yho5KBu7UWjyWh5XMwQjbvNl 77Je67IYyy4yLrywJYmWDCDhhGMzkmSV4iFgGXfI= 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.19 0351/1157] drm: adv7511: override i2c address of cec before accessing it Date: Mon, 15 Aug 2022 19:55:07 +0200 Message-Id: <20220815180453.758035376@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 5bb9300040dd..074c2e650cae 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1065,6 +1065,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, @@ -1271,9 +1275,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