linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cosmin Tanislav <demonsingur@gmail.com>
To: Jakub Kostiw <jakub.kostiw@videtronic.com>
Cc: "Tomi Valkeinen" <tomi.valkeinen@ideasonboard.com>,
	"Cosmin Tanislav" <cosmin.tanislav@analog.com>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
	"Julien Massot" <julien.massot@collabora.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Bjorn Andersson" <quic_bjorande@quicinc.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Taniya Das" <quic_tdas@quicinc.com>,
	"Biju Das" <biju.das.jz@bp.renesas.com>,
	"Nícolas F . R . A . Prado" <nfraprado@collabora.com>,
	"Eric Biggers" <ebiggers@google.com>,
	"Javier Carrasco" <javier.carrasco@wolfvision.net>,
	"Ross Burton" <ross.burton@arm.com>,
	"Hans Verkuil" <hverkuil@xs4all.nl>,
	"Sakari Ailus" <sakari.ailus@linux.intel.com>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Zhi Mao" <zhi.mao@mediatek.com>,
	"Kieran Bingham" <kieran.bingham@ideasonboard.com>,
	"Dongcheng Yan" <dongcheng.yan@intel.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Benjamin Mugnier" <benjamin.mugnier@foss.st.com>,
	"Tommaso Merciai" <tomm.merciai@gmail.com>,
	"Dan Carpenter" <dan.carpenter@linaro.org>,
	"Ihor Matushchak" <ihor.matushchak@foobox.net>,
	"Laurentiu Palcu" <laurentiu.palcu@oss.nxp.com>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-staging@lists.linux.dev, linux-gpio@vger.kernel.org
Subject: Re: [RFC PATCH v2 12/16] media: i2c: add Maxim GMSL2/3 serializer and deserializer drivers
Date: Wed, 7 May 2025 11:49:06 +0300	[thread overview]
Message-ID: <c56d03cb-14a4-4a7f-82e7-80368c3ca4ec@gmail.com> (raw)
In-Reply-To: <29eea52b-a512-4948-b4e0-e6d19d09ded4@videtronic.com>



On 5/7/25 10:28 AM, Jakub Kostiw wrote:
>> Can you revert the change you made to polarity_on_physical_lanes, and
>> try the following?
>>
>> diff --git a/drivers/media/i2c/maxim-serdes/max9296a.c b/drivers/ 
>> media/i2c/maxim-serdes/max9296a.c
>> index f48f5b68a750..dea0518fd790 100644
>> --- a/drivers/media/i2c/maxim-serdes/max9296a.c
>> +++ b/drivers/media/i2c/maxim-serdes/max9296a.c
>> @@ -474,7 +474,7 @@ static int max9296a_init_phy(struct max_des *des, 
>> struct max_des_phy *phy)
>>                  */
>>
>>                 if (priv->info->polarity_on_physical_lanes)
>> -                       map = phy->mipi.data_lanes[i];
>> +                       map = phy->mipi.data_lanes[i] - 1;
>>                 else
>>                         map = i;
>>
>> data_lanes is 1-based (since 0 is the clock lane), but the bits
>> in register 0x335 start from 0. That means we should adjust the
>> values in data_lanes to be 0-based. 
> 
> I have applied your patch and polarity settings seems to be correct now 
> (based on register contents).
> However, I have came across another issue.
> When I was debugging the driver for MAX96714, before I found out that 
> the issue was with polarity settings, I have commented out calls to 
> MAX9296A_DPLL_0. Probably because I thought it was there by mistake. I 
> totally forgot about that change.
> Before applying your patch I reverted any changes to the driver, so 
> MAX9296A_DPLL_0 writes were back again. Sadly, video stream did not 
> work. So I began to wonder, and just for sake of testing, commented 
> these calls again (added some logs for quick tracing purposes):
> 
> diff --git a/drivers/media/i2c/maxim-serdes/max9296a.c b/drivers/media/ 
> i2c/maxim-serdes/max9296a.c
> index f48f5b68a..b24a8e2d6 100644
> --- a/drivers/media/i2c/maxim-serdes/max9296a.c
> +++ b/drivers/media/i2c/maxim-serdes/max9296a.c
> @@ -391,6 +391,8 @@ static int max9296a_init_phy(struct max_des *des, 
> struct max_des_phy *phy)
>           * PHY1 Lane 1 = D3
>           */
> 
> +       dev_info(priv->dev, "Using  %d lanes", num_data_lanes);
> +
>          /* Configure a lane count. */
>          ret = regmap_update_bits(priv->regmap, 
> MAX9296A_MIPI_TX10(hw_index),
>                                   MAX9296A_MIPI_TX10_CSI2_LANE_CNT,
> @@ -474,7 +476,7 @@ static int max9296a_init_phy(struct max_des *des, 
> struct max_des_phy *phy)
>                   */
> 
>                  if (priv->info->polarity_on_physical_lanes)
> -                       map = phy->mipi.data_lanes[i];
> +                       map = phy->mipi.data_lanes[i] - 1;
>                  else
>                          map = i;
> 
> @@ -484,6 +486,9 @@ static int max9296a_init_phy(struct max_des *des, 
> struct max_des_phy *phy)
>          if (phy->index == 0 && priv->info->phy0_lanes_0_1_on_second_phy)
>                  val = ((val & 0x3) << 2) | ((val >> 2) & 0x3);
> 
> +       dev_info(priv->dev, "Val for MIPI_PHY5 (0_1): %lx", 
> FIELD_PREP(MAX9296A_MIPI_PHY5_PHY_POL_MAP_0_1, val));
> +       dev_info(priv->dev, "Val for MIPI_PHY5 (2_3): %lx", 
> FIELD_PREP(MAX9296A_MIPI_PHY5_PHY_POL_MAP_2_3, val >> 2));
> +
>          ret = regmap_update_bits(priv->regmap, MAX9296A_MIPI_PHY5(index),
> MAX9296A_MIPI_PHY5_PHY_POL_MAP_0_1 |
> MAX9296A_MIPI_PHY5_PHY_POL_MAP_2_3,
> @@ -499,10 +504,10 @@ static int max9296a_init_phy(struct max_des *des, 
> struct max_des_phy *phy)
>                  return ret;
> 
>          /* Put DPLL block into reset. */
> -       ret = regmap_clear_bits(priv->regmap, MAX9296A_DPLL_0(hw_index),
> - MAX9296A_DPLL_0_CONFIG_SOFT_RST_N);
> -       if (ret)
> -               return ret;
> +       //ret = regmap_clear_bits(priv->regmap, MAX9296A_DPLL_0(hw_index),
> +       // MAX9296A_DPLL_0_CONFIG_SOFT_RST_N);
> +       //if (ret)
> +       //      return ret;
> 
>          /* Set DPLL frequency. */
>          ret = regmap_update_bits(priv->regmap, MAX9296A_BACKTOP22(index),
> @@ -519,10 +524,10 @@ static int max9296a_init_phy(struct max_des *des, 
> struct max_des_phy *phy)
>                  return ret;
> 
>          /* Pull DPLL block out of reset. */
> -       ret = regmap_set_bits(priv->regmap, MAX9296A_DPLL_0(index),
> -                             MAX9296A_DPLL_0_CONFIG_SOFT_RST_N);
> -       if (ret)
> -               return ret;
> +       //ret = regmap_set_bits(priv->regmap, MAX9296A_DPLL_0(index),
> +       //                    MAX9296A_DPLL_0_CONFIG_SOFT_RST_N);
> +       //if (ret)
> +       //      return ret;
> 
>          if (dpll_freq > 1500000000ull) {
>                  /* Enable initial deskew with 2 x 32k UI. */
> 
> To my surprise it works this way. I tested this 2 times back and forth. 
> Can these calls really cause some issues?


Can you revert your changes and try this?

diff --git a/drivers/media/i2c/maxim-serdes/max9296a.c 
b/drivers/media/i2c/maxim-serdes/max9296a.c
index dea0518fd790..3bb80fe42a22 100644
--- a/drivers/media/i2c/maxim-serdes/max9296a.c
+++ b/drivers/media/i2c/maxim-serdes/max9296a.c
@@ -519,7 +519,7 @@ static int max9296a_init_phy(struct max_des *des, 
struct max_des_phy *phy)
  		return ret;

  	/* Pull DPLL block out of reset. */
-	ret = regmap_set_bits(priv->regmap, MAX9296A_DPLL_0(index),
+	ret = regmap_set_bits(priv->regmap, MAX9296A_DPLL_0(hw_index),
  			      MAX9296A_DPLL_0_CONFIG_SOFT_RST_N);
  	if (ret)
  		return ret;



  reply	other threads:[~2025-05-07  8:49 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-09  8:47 [RFC PATCH v2 00/16] media: i2c: add Maxim GMSL2/3 serializer and deserializer drivers Cosmin Tanislav
2025-03-09  8:47 ` [RFC PATCH v2 01/16] dt-bindings: media: i2c: max96717: add myself as maintainer Cosmin Tanislav
2025-03-11 18:06   ` Rob Herring (Arm)
2025-03-09  8:47 ` [RFC PATCH v2 02/16] dt-bindings: media: i2c: max96717: reflow text Cosmin Tanislav
2025-03-11 18:09   ` Rob Herring
2025-03-09  8:47 ` [RFC PATCH v2 03/16] dt-bindings: media: i2c: max96717: add support for I2C ATR Cosmin Tanislav
2025-03-11 18:15   ` Rob Herring
2025-03-09  8:47 ` [RFC PATCH v2 04/16] dt-bindings: media: i2c: max96717: add support for pinctrl/pinconf Cosmin Tanislav
2025-03-11 18:23   ` Rob Herring
2025-03-09  8:47 ` [RFC PATCH v2 05/16] dt-bindings: media: i2c: max96717: add support for MAX9295A Cosmin Tanislav
2025-03-11 18:28   ` Rob Herring
2025-03-09  8:47 ` [RFC PATCH v2 06/16] dt-bindings: media: i2c: max96717: add support for MAX96793 Cosmin Tanislav
2025-03-11 18:30   ` Rob Herring (Arm)
2025-03-13 12:25   ` Sakari Ailus
2025-03-09  8:47 ` [RFC PATCH v2 07/16] dt-bindings: media: i2c: max96712: add myself as maintainer Cosmin Tanislav
2025-03-11 18:54   ` Rob Herring (Arm)
2025-03-09  8:48 ` [RFC PATCH v2 08/16] dt-bindings: media: i2c: max96712: use pattern properties for ports Cosmin Tanislav
2025-03-11 19:00   ` Rob Herring
2025-03-09  8:48 ` [RFC PATCH v2 09/16] dt-bindings: media: i2c: max96712: add support for I2C MUX Cosmin Tanislav
2025-03-11 19:01   ` Rob Herring (Arm)
2025-03-09  8:48 ` [RFC PATCH v2 10/16] dt-bindings: media: i2c: max96712: add support for POC supplies Cosmin Tanislav
2025-03-11 19:02   ` Rob Herring (Arm)
2025-03-09  8:48 ` [RFC PATCH v2 11/16] dt-bindings: media: i2c: add MAX9296A, MAX96716A, MAX96792A Cosmin Tanislav
2025-03-11 19:07   ` Rob Herring
2025-03-11 22:26     ` Cosmin Tanislav
2025-03-09  8:48 ` [RFC PATCH v2 12/16] media: i2c: add Maxim GMSL2/3 serializer and deserializer drivers Cosmin Tanislav
2025-05-06 18:33   ` Jakub Kostiw
2025-05-06 19:01     ` Cosmin Tanislav
2025-05-06 19:15       ` Jakub Kostiw
2025-05-06 19:46         ` Cosmin Tanislav
2025-05-07  7:28           ` Jakub Kostiw
2025-05-07  8:49             ` Cosmin Tanislav [this message]
2025-05-07  9:02               ` Jakub Kostiw
2025-05-07 11:22     ` Dave Stevenson
2025-05-07 11:38       ` Cosmin Tanislav
2025-05-07 11:41       ` Jakub Kostiw
2025-03-09  8:48 ` [RFC PATCH v2 13/16] arm64: defconfig: disable deprecated MAX96712 driver Cosmin Tanislav
2025-03-09  8:48 ` [RFC PATCH v2 14/16] staging: media: remove " Cosmin Tanislav
2025-03-09  8:48 ` [RFC PATCH v2 15/16] media: i2c: remove MAX96717 driver Cosmin Tanislav
2025-03-09  8:48 ` [RFC PATCH v2 16/16] media: i2c: remove MAX96714 driver Cosmin Tanislav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c56d03cb-14a4-4a7f-82e7-80368c3ca4ec@gmail.com \
    --to=demonsingur@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=arnd@arndb.de \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=cosmin.tanislav@analog.com \
    --cc=dan.carpenter@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dongcheng.yan@intel.com \
    --cc=ebiggers@google.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil@xs4all.nl \
    --cc=ihor.matushchak@foobox.net \
    --cc=jakub.kostiw@videtronic.com \
    --cc=javier.carrasco@wolfvision.net \
    --cc=julien.massot@collabora.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=laurentiu.palcu@oss.nxp.com \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=nfraprado@collabora.com \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=quic_bjorande@quicinc.com \
    --cc=quic_tdas@quicinc.com \
    --cc=robh@kernel.org \
    --cc=ross.burton@arm.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=tomm.merciai@gmail.com \
    --cc=will@kernel.org \
    --cc=zhi.mao@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).