From: Andrzej Hajda <a.hajda@samsung.com>
To: Vasily Khoruzhick <anarsoul@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
devicetree <devicetree@vger.kernel.org>,
Archit Taneja <architt@codeaurora.org>,
David Airlie <airlied@linux.ie>,
linux-sunxi <linux-sunxi@googlegroups.com>,
dri-devel <dri-devel@lists.freedesktop.org>,
Maxime Ripard <maxime.ripard@bootlin.com>,
Chen-Yu Tsai <wens@csie.org>, Rob Herring <robh+dt@kernel.org>,
Thierry Reding <thierry.reding@gmail.com>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Daniel Vetter <daniel@ffwll.ch>,
Sean Paul <seanpaul@chromium.org>,
arm-linux <linux-arm-kernel@lists.infradead.org>,
Icenowy Zheng <icenowy@aosc.io>
Subject: Re: [PATCH v3 05/11] drm/bridge: Add Analogix anx6345 support
Date: Tue, 26 Feb 2019 08:12:32 +0100 [thread overview]
Message-ID: <8f0e5932-7dba-e7a8-9adc-d15e67ffde46@samsung.com> (raw)
In-Reply-To: <CA+E=qVe1UOxprkG+zm1OX87f9vOPyHom=hxhnzGxidBA54WxkA@mail.gmail.com>
On 15.02.2019 20:36, Vasily Khoruzhick wrote:
> On Fri, Feb 15, 2019 at 1:13 AM Andrzej Hajda <a.hajda@samsung.com> wrote:
>
> Hi Andrzej,
>
> Thanks for review!
>
>>> +#include <linux/of_gpio.h>
>> Do you need this header?
> I'll drop it.
>
>>> +#include <drm/drmP.h>
>> drmP.h is/should be deprecated.
> Same here
>
>>> +struct anx6345_platform_data {
>>> + struct regulator *dvdd12;
>>> + struct regulator *dvdd25;
>>> + struct gpio_desc *gpiod_reset;
>>> +};
>> Why do you need this struct, why just do not embed it's fields directly
>> into struct anx6345 ?
> OK, I'll embed it into struct anx6345
>
>>> + if (WARN_ON(anx6345->powered))
>>> + return;
>> It should not happen, you can remove this warn.
> OK
>
>>> + if (pdata->dvdd12) {
>> If regulators are required this will be never null.
> Right, and regulator subsystem will return dummy regulator if it's
> missing in dts.
> I'll remove redundant checks.
>
>>> +
>>> + if (pdata->dvdd25) {
>> ditto
> OK
>
>>> +
>>> + if (anx6345->panel)
>>> + drm_panel_prepare(anx6345->panel);
>> again, here and below: panel is never null, check can be removed.
> That's not true, panel is optional. It can be DP connector, not a panel.
>
>>> +
>>> + gpiod_set_value_cansleep(pdata->gpiod_reset, 0);
>>> + usleep_range(1000, 2000);
>>> +
>>> + gpiod_set_value_cansleep(pdata->gpiod_reset, 1);
>>
>> Start/stop sequence seems odd regarding reset gpio:
>>
>> 1. In probe reset is set to low, in poweroff to high - incosistent.
>>
>> 2. If in case of disabled device reset should be 0, there is no point to
>> set it again to 0 three lines above.
>>
>> 3. I suspect in dts reset gpio should be declared as active_low, and the
>> logic in the driver should be reverted, in power off it should be set to
>> high, in power on it should be lowered (logically).
> OK, I'll look into it.
>
>>> +err_poweroff:
>>> + DRM_ERROR("Failed DisplayPort transmitter initialization: %d\n", err);
>> redundant message
> OK, will drop.
>
>>> + DRM_ERROR("Get sink count failed %d\n", err);
>> The rule of thumb I heard is that if you start message capitalized you
>> should end with dot. Since I do not know if it is enforced in kernel I
>> leave the decision up to you.
> I grepped DRM_ERROR in driver/gpu/drm and they do exactly the same as here.
> So I'll just keep it as is for consistency.
>
>>> +static bool anx6345_bridge_mode_fixup(struct drm_bridge *bridge,
>>> + const struct drm_display_mode *mode,
>>> + struct drm_display_mode *adjusted_mode)
>>> +{
>>> + if (mode->flags & DRM_MODE_FLAG_INTERLACE)
>>> + return false;
>>> +
>>> + /* Max 1200p at 5.4 Ghz, one lane */
>>> + if (mode->clock > 154000)
>>> + return false;
>> These checks should be in mode_valid callback.
> OK
>
>>> + /* Map slave addresses of ANX6345 */
>>> + for (i = 0; i < I2C_NUM_ADDRESSES; i++) {
>>> + if (anx6345_i2c_addresses[i] >> 1 != client->addr)
>>> + anx6345->i2c_clients[i] = i2c_new_dummy(client->adapter,
>>> + anx6345_i2c_addresses[i] >> 1);
>>> + else
>>> + anx6345->i2c_clients[i] = client;
>>
>> I see this contredanse is copy/pasted from anx78*, but it looks quite
>> complicated. As I understand there are two i2c addresses, why we cannot
>> assume one address is for control interfaces and another is dummy? It would
>> simplify the code here and in other places.
> Sorry, I don't get you, could you elaborate? Note that anx6345 uses
> both addresses,
> i2c_new_dummy() just registers new i2c device bound to a dummy driver and it's
> supposed to be used for devices that consume more than one i2c address.
My idea was to assume that ANALOGIX_I2C_DPTX is the main address, ie.
address which should be set in dts in device node reg property.
Other addresses should be registered as dummy devices during probe -
simple loop without conditionals, without redundant fields in anx6345
context - i2c_clients, client.
I do not insist on this change but I suggest as it should simplify the code.
And moreover, you can consider removing direction bit from i2c
addresses, it could be also confusing and against i2c kernel api.
>
>>> + if (!found) {
>>> + DRM_ERROR("ANX%x (ver. %d) not supported by this driver\n",
>>> + anx6345->chipid, version);
>>> + err = -ENODEV;
>>> + goto err_poweroff;
>>> + }
>>
>> As I see chip becomes powered forever, is it OK? Usually it should be
>> powered only when pipeline starts, and powered-off after pipeline stops.
> I'll look into how hard it would be to implement but personally I
> think it's OK for now.
> We can add more sophisticated power management once this driver is merged.
But the rule is every resource allocated/set during lifetime of the
driver should be dropped on driver removal, so please do it at least in
remove callback.
Regards
Andrzej
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-02-26 7:12 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-15 5:09 [PATCH v3 00/11] Analogix ANX6345 RGB-(e)DP bridge support Vasily Khoruzhick
2019-02-15 5:09 ` [PATCH v3 01/11] drm/bridge: move ANA78xx driver to analogix subdirectory Vasily Khoruzhick
2019-02-15 5:09 ` [PATCH v3 02/11] drm/bridge: split some definitions of ANX78xx to dedicated headers Vasily Khoruzhick
2019-02-15 5:09 ` [PATCH v3 03/11] drm/bridge: extract some Analogix I2C DP common code Vasily Khoruzhick
2019-02-15 5:09 ` [PATCH v3 04/11] dt-bindings: Add ANX6345 DP/eDP transmitter binding Vasily Khoruzhick
2019-02-18 18:13 ` Rob Herring
2019-02-15 5:09 ` [PATCH v3 05/11] drm/bridge: Add Analogix anx6345 support Vasily Khoruzhick
2019-02-15 8:23 ` [linux-sunxi] " Priit Laes
2019-02-15 19:21 ` Vasily Khoruzhick
2019-02-15 9:13 ` Andrzej Hajda
2019-02-15 19:36 ` Vasily Khoruzhick
2019-02-26 7:12 ` Andrzej Hajda [this message]
2019-02-15 5:09 ` [PATCH v3 06/11] drm/sun4i: rgb: Add DT property to disable strict clock rate check Vasily Khoruzhick
2019-02-18 18:26 ` Rob Herring
2019-02-18 19:33 ` Vasily Khoruzhick
2019-02-19 8:56 ` Maxime Ripard
2019-02-19 15:44 ` Vasily Khoruzhick
2019-02-20 10:33 ` Maxime Ripard
2019-02-21 6:39 ` Vasily Khoruzhick
2019-02-21 6:41 ` Vasily Khoruzhick
2019-02-15 5:09 ` [PATCH v3 07/11] arm64: allwinner: a64: add pinmux for RGB666 LCD Vasily Khoruzhick
2019-02-15 5:09 ` [PATCH v3 08/11] drm/panel: simple: Add BOE HB140WX1-501 panel support Vasily Khoruzhick
2019-02-16 20:43 ` Sam Ravnborg
2019-02-16 20:48 ` Vasily Khoruzhick
2019-02-16 21:12 ` Sam Ravnborg
2019-02-15 5:09 ` [PATCH v3 09/11] dt-bindings: Add Guangdong Neweast Optoelectronics CO. LTD vendor prefix Vasily Khoruzhick
2019-02-18 18:27 ` Rob Herring
2019-02-15 5:09 ` [PATCH v3 10/11] drm/panel: simple: Add NewEast Optoelectronics CO., LTD WJFH116008A panel support Vasily Khoruzhick
2019-02-18 18:33 ` Rob Herring
2019-02-18 19:06 ` Vasily Khoruzhick
2019-02-19 14:54 ` Rob Herring
2019-02-19 21:35 ` Vasily Khoruzhick
2019-02-22 18:37 ` Rob Herring
2019-03-07 6:12 ` Vasily Khoruzhick
2019-02-15 5:09 ` [PATCH v3 11/11] arm64: allwinner: a64: enable LCD-related hardware for Pinebook Vasily Khoruzhick
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=8f0e5932-7dba-e7a8-9adc-d15e67ffde46@samsung.com \
--to=a.hajda@samsung.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@linux.ie \
--cc=anarsoul@gmail.com \
--cc=architt@codeaurora.org \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=icenowy@aosc.io \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-sunxi@googlegroups.com \
--cc=mark.rutland@arm.com \
--cc=maxime.ripard@bootlin.com \
--cc=robh+dt@kernel.org \
--cc=seanpaul@chromium.org \
--cc=thierry.reding@gmail.com \
--cc=wens@csie.org \
/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).