From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D1948C433EF for ; Mon, 20 Dec 2021 15:53:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F18410F30A; Mon, 20 Dec 2021 15:53:37 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id E85FC10F30A for ; Mon, 20 Dec 2021 15:53:35 +0000 (UTC) Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1BKB4Q9e022873; Mon, 20 Dec 2021 16:53:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=selector1; bh=Jgsa623SaViueGDOZhOSg8j75LYCq3JkOD9aq+r/VfQ=; b=Ldd5V86MOT/fE2WF4Lg2DS8jBjbIvCL4my+RuOlmH9NHg5Jz0/O/lZqlhOtJ4SKESwV+ 2wo+st4yxIOSOzjHtynk+FNnuMp5Ua1/1mJox/Co0VfeEHcBbTK5pT+04gvAuHQKTGGj odrpRrq+Zo4LPAhJTO00OjEErxPppMMtd+Yr5Y6MomCgCPOQ2tNskW43nFX7khUYIZCt iFTIRLEEfH9lrB3KgyHY9LzdErs2ZCs7ubnTmg+sowEQ4Cj4A3/BE7rjVYz0JCSzcRdA YCJRnM/Z5HOkW3T6eHaIKRVqV+EpBLodW1+iitopQBxJBNJlqrOhG1p3MfrrTLklEEgg zw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3d2kjnkbee-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 Dec 2021 16:53:20 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B828C10002A; Mon, 20 Dec 2021 16:53:18 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id AEF9D207546; Mon, 20 Dec 2021 16:53:18 +0100 (CET) Received: from [192.168.8.15] (10.75.127.46) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.26; Mon, 20 Dec 2021 16:53:17 +0100 Message-ID: <210c1e7c333b42702ac0c3ba0da639e82327d035.camel@foss.st.com> Subject: Re: [PATCH] drm: adv7511: override i2c address of cec before accessing it From: Antonio Borneo To: Kieran Bingham , Andrzej Hajda , Daniel Vetter , David Airlie , Jernej Skrabec , "Jonas Karlman" , Laurent Pinchart , Neil Armstrong , Robert Foss , Date: Mon, 20 Dec 2021 16:53:12 +0100 In-Reply-To: <164001209406.2512616.469307346369770543@Monstersaurus> References: <20211218182804.208906-1-antonio.borneo@foss.st.com> <164001209406.2512616.469307346369770543@Monstersaurus> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-20_07,2021-12-20_01,2021-12-02_01 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, 2021-12-20 at 14:54 +0000, Kieran Bingham wrote: > Hi Antonio, > > Quoting Antonio Borneo (2021-12-18 18:28:04) > > 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. > > Ouch, it does seem that way. I guess no one has used the CEC for > quite > some time, as it must have been like this for a while? Using the default i2c address for cec works without problem; apparently everyone is happy with such default. The issue appears only when you have to override the default cec address. The commit 680532c50bca landed in v4.18. > > Once the new i2c address is read from the device tree, override > > the default address before any attempt to access the cec. > > Reviewed-by: Kieran Bingham Thanks! Antonio > > Tested with adv7533 and stm32mp157f. > > > > Signed-off-by: Antonio Borneo > > Fixes: 680532c50bca ("drm: adv7511: Add support for > > i2c_new_secondary_device") > > --- > > To: Andrzej Hajda > > To: Neil Armstrong > > To: Robert Foss > > To: Laurent Pinchart > > To: Jonas Karlman > > To: Jernej Skrabec > > To: David Airlie > > To: Daniel Vetter > > To: Kieran Bingham > > To: dri-devel@lists.freedesktop.org > > Cc: linux-kernel@vger.kernel.org > > Cc: linux-stm32@st-md-mailman.stormreply.com > > --- > >  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 76555ae64e9c..629e05286fd9 100644 > > --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c > > @@ -1048,6 +1048,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, > > @@ -1252,9 +1256,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) { > > > > base-commit: fc74881c28d314b10efac016ef49df4ff40b8b97 > > -- > > 2.34.1 > >