From: Francesco Dolcini <francesco@dolcini.it>
To: Alexandru Ardelean <alex@shruggie.ro>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
devicetree@vger.kernel.org, adrien.grassein@gmail.com,
andrzej.hajda@intel.com, neil.armstrong@linaro.org,
rfoss@kernel.org, Laurent.pinchart@ideasonboard.com,
jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com,
daniel@ffwll.ch, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, tzimmermann@suse.de, robh@kernel.org,
krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
stefan.eichenberger@toradex.com, francesco.dolcini@toradex.com,
marius.muresan@mxt.ro, irina.muresan@mxt.ro
Subject: Re: [PATCH 1/2] drm/bridge: lt8912b: add support for P/N pin swap
Date: Tue, 2 Apr 2024 18:53:07 +0200 [thread overview]
Message-ID: <20240402165307.GA31874@francesco-nb> (raw)
In-Reply-To: <20240402105925.905144-1-alex@shruggie.ro>
Hello Alexandru, thanks for your patch.
On Tue, Apr 02, 2024 at 01:59:24PM +0300, Alexandru Ardelean wrote:
> On some HW designs, it's easier for the layout if the P/N pins are swapped.
> In those cases, we need to adjust (for this) by configuring the MIPI analog
> registers differently. Specifically, register 0x3e needs to be 0xf6
> (instead of 0xd6).
>
> This change adds a 'lontium,pn-swap' device-tree property to configure the
> MIPI analog registers for P/N swap.
>
> Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
> ---
> drivers/gpu/drm/bridge/lontium-lt8912b.c | 25 +++++++++++++++++++++---
> 1 file changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> index 4b2ae27f0a57f..154126bb922b4 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c
> @@ -47,6 +47,7 @@ struct lt8912 {
>
> u8 data_lanes;
> bool is_power_on;
> + bool do_pn_swap;
> };
>
> static int lt8912_write_init_config(struct lt8912 *lt)
> @@ -78,15 +79,31 @@ static int lt8912_write_init_config(struct lt8912 *lt)
> {0x55, 0x44},
> {0x57, 0x01},
> {0x5a, 0x02},
> -
> - /*MIPI Analog*/
> + };
> + const struct reg_sequence mipi_analog_seq[] = {
> {0x3e, 0xd6},
> {0x3f, 0xd4},
> {0x41, 0x3c},
> {0xB2, 0x00},
> };
> + const struct reg_sequence mipi_analog_pn_swap_seq[] = {
> + {0x3e, 0xf6},
> + {0x3f, 0xd4},
> + {0x41, 0x3c},
> + {0xB2, 0x00},
> + };
> + int ret;
>
> - return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, ARRAY_SIZE(seq));
> + ret = regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, ARRAY_SIZE(seq));
> + if (ret < 0)
> + return ret;
> +
> + if (!lt->do_pn_swap)
> + return regmap_multi_reg_write(lt->regmap[I2C_MAIN], mipi_analog_seq,
> + ARRAY_SIZE(mipi_analog_seq));
> +
> + return regmap_multi_reg_write(lt->regmap[I2C_MAIN], mipi_analog_pn_swap_seq,
> + ARRAY_SIZE(mipi_analog_pn_swap_seq));
Can you just remove {0x3e, 0xd6} from the register/value array and write
it afterward depending on `do_pn_swap` value? Or keep it with the
current value and only overwrite it when do_pn_swap is true?
If you do it this way is a 4 line change.
> static int lt8912_write_mipi_basic_config(struct lt8912 *lt)
> @@ -702,6 +719,8 @@ static int lt8912_parse_dt(struct lt8912 *lt)
> }
> lt->gp_reset = gp_reset;
>
> + lt->do_pn_swap = device_property_read_bool(dev, "lontium,pn-swap");
I would call this variable the same that is called in the lontium
documentation, mipirx_diff_swap
Francesco
next prev parent reply other threads:[~2024-04-02 16:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 10:59 [PATCH 1/2] drm/bridge: lt8912b: add support for P/N pin swap Alexandru Ardelean
2024-04-02 10:59 ` [PATCH 2/2] dt-bindings: display: bridge: lt8912b: document 'lontium,pn-swap' property Alexandru Ardelean
2024-04-02 18:06 ` Conor Dooley
2024-04-03 6:16 ` Alexandru Ardelean
2024-04-03 16:02 ` Conor Dooley
2024-04-07 20:31 ` [PATCH 2/2] dt-bindings: display: bridge: lt8912b: document 'lontium, pn-swap' property Dmitry Baryshkov
2024-04-11 7:23 ` Alexandru Ardelean
2024-04-02 16:53 ` Francesco Dolcini [this message]
2024-04-03 6:32 ` [PATCH 1/2] drm/bridge: lt8912b: add support for P/N pin swap Alexandru Ardelean
2024-04-03 6:52 ` Francesco Dolcini
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=20240402165307.GA31874@francesco-nb \
--to=francesco@dolcini.it \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=adrien.grassein@gmail.com \
--cc=airlied@gmail.com \
--cc=alex@shruggie.ro \
--cc=andrzej.hajda@intel.com \
--cc=conor+dt@kernel.org \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=francesco.dolcini@toradex.com \
--cc=irina.muresan@mxt.ro \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marius.muresan@mxt.ro \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=robh@kernel.org \
--cc=stefan.eichenberger@toradex.com \
--cc=tzimmermann@suse.de \
/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