linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
	Rob Clark <robdclark@gmail.com>,
	devicetree@vger.kernel.org,
	Jernej Skrabec <jernej.skrabec@siol.net>,
	Neil Armstrong <narmstrong@baylibre.com>,
	linux-arm-msm@vger.kernel.org, Jonas Karlman <jonas@kwiboo.se>,
	Emil Velikov <emil.l.velikov@gmail.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Rob Herring <robh+dt@kernel.org>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Subject: Re: [PATCH v3 3/3] drm/bridge: Introduce LT9611 DSI to HDMI bridge
Date: Mon, 22 Jun 2020 12:39:34 +0530	[thread overview]
Message-ID: <20200622070934.GG2324254@vkoul-mobl> (raw)
In-Reply-To: <20200620180516.GA27870@ravnborg.org>

Hello Sam,

On 20-06-20, 20:05, Sam Ravnborg wrote:
> Hi Vinod.
> 
> Looks good but some some of small nits.

Great :)

> And a few larger things in the following.
> The larger things is releated to prepare the bridge driver to live in a
> world with chained bridges.

Sure, so that entails adding the callbacks specified below right or is
there anything else required to do?

> > +#include <linux/gpio/consumer.h>
> > +#include <linux/interrupt.h>
> > +#include <linux/module.h>
> > +#include <linux/of_graph.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/regmap.h>
> > +#include <linux/regulator/consumer.h>
> > +#include <sound/hdmi-codec.h>
> > +#include <drm/drm_probe_helper.h>
> > +#include <drm/drm_atomic_helper.h>
> > +#include <drm/drm_bridge.h>
> > +#include <drm/drm_mipi_dsi.h>
> > +#include <drm/drm_print.h>
> Please add empty lines between each group of includes.
> They are already sorted within each group and in preferred order - good.

Okay if that is the preference, sure

> > +static int lt9611_mipi_input_analog(struct lt9611 *lt9611)
> > +{
> > +	const struct reg_sequence reg_cfg[] = {
> > +		{ 0x8106, 0x40 }, /*port A rx current*/
> > +		{ 0x810a, 0xfe }, /*port A ldo voltage set*/
> > +		{ 0x810b, 0xbf }, /*enable port A lprx*/
> > +		{ 0x8111, 0x40 }, /*port B rx current*/
> > +		{ 0x8115, 0xfe }, /*port B ldo voltage set*/
> > +		{ 0x8116, 0xbf }, /*enable port B lprx*/
> > +
> > +		{ 0x811c, 0x03 }, /*PortA clk lane no-LP mode*/
> > +		{ 0x8120, 0x03 }, /*PortB clk lane with-LP mode*/
> Add space after "/*" and before closing "*/".
> Like is done a few lines up in lt9611_modes[]

Oops seems to have missed these, will fix this and others if any

> > +static int lt9611_mipi_input_digital(struct lt9611 *lt9611,
> > +				     const struct drm_display_mode *mode)
> > +{
> > +	struct reg_sequence reg_cfg[] = {
> > +		{ 0x8300, LT9611_4LANES },
> > +		{ 0x830a, 0x00 },
> > +		{ 0x824f, 0x80 },
> > +		{ 0x8250, 0x10 },
> > +		{ 0x8302, 0x0a },
> > +		{ 0x8306, 0x0a },
> > +	};
> > +
> > +	if (mode->hdisplay == 3840)
> > +		reg_cfg[1].def = 0x03;
> Please check if some of these constants be replaced by something readable
> from the datasheet.
> Same goes for other places where constants are used.

The problem is that the datasheet I have doesn't define register names.
Worse some of them are not even documented. I did give it a shot to
define these, but gave up half way due to lack on inventive names :(

I would like to keep the registers and replace them in future if we get
a good spec from vendor.. or i can define REG_1...REG_N!

> > +static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
> > +				    const struct drm_display_mode *mode)
> > +{
> > +	u32 h_total, h_act, hpw, hfp, hss;
> > +	u32 v_total, v_act, vpw, vfp, vss;
> > +
> > +	h_total = mode->htotal;
> > +	v_total = mode->vtotal;
> > +
> > +	h_act = mode->hdisplay;
> > +	hpw = mode->hsync_end - mode->hsync_start;
> > +	hfp = mode->hsync_start - mode->hdisplay;
> > +	hss = (mode->hsync_end - mode->hsync_start) +
> > +	      (mode->htotal - mode->hsync_end);
> > +
> > +	v_act = mode->vdisplay;
> > +	vpw = mode->vsync_end - mode->vsync_start;
> > +	vfp = mode->vsync_start - mode->vdisplay;
> > +	vss = (mode->vsync_end - mode->vsync_start) +
> > +	      (mode->vtotal - mode->vsync_end);
> Using the names from display_timings would make this easier to recognize
> for the reader.
> Examples:
> vfp versus vfront_porch
> vss versus vsync_len
> 
> I do not say the names from display_timing are much better, only that they
> are more recognizeable.

okay will do

> > +static irqreturn_t lt9611_irq_thread_handler(int irq, void *dev_id)
> > +{
> > +	struct lt9611 *lt9611 = dev_id;
> > +	unsigned int irq_flag0 = 0;
> > +	unsigned int irq_flag3 = 0;
> > +
> > +	regmap_read(lt9611->regmap, 0x820f, &irq_flag3);
> > +	regmap_read(lt9611->regmap, 0x820c, &irq_flag0);
> > +
> > +	pr_debug("%s() irq_flag0: %#x irq_flag3: %#x\n",
> > +		 __func__, irq_flag0, irq_flag3);
> debug artifact you can delete now?

Okay, will remove this and rest

> 
> > +
> > +	 /* hpd changed low */
> Drop extra space in indent of this comment and following comments as
> well.

Ok

> > +static int lt9611_bridge_attach(struct drm_bridge *bridge,
> > +				enum drm_bridge_attach_flags flags)
> > +{
> > +	struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> > +	int ret;
> > +
> > +	dev_dbg(lt9611->dev, "bridge attach\n");
> > +
> > +	if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) {
> > +		DRM_ERROR("Fix bridge driver to make connector optional!");
> > +		return -EINVAL;
> > +	}
> Please fix bridge so connector creation is optional.
> for new bridge driver this is mandatory.

Can you elaborate what is means by fixing bridge here, what are the
things that should be done and are expected for new bridge drivers

> > +static const struct drm_bridge_funcs lt9611_bridge_funcs = {
> > +	.attach = lt9611_bridge_attach,
> > +	.detach = lt9611_bridge_detach,
> > +	.mode_valid = lt9611_bridge_mode_valid,
> > +	.enable = lt9611_bridge_enable,
> > +	.disable = lt9611_bridge_disable,
> > +	.post_disable = lt9611_bridge_post_disable,
> > +	.mode_set = lt9611_bridge_mode_set,
> 
> Add relevant bridge functions - .get_edid, .detect looks like
> candidates.
> See other bridge drivers for inspiration.

Any good examples?
-- 
~Vinod

  reply	other threads:[~2020-06-22  7:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17 10:59 [PATCH v3 0/3] Add LT9611 DSI to HDMI bridge Vinod Koul
2020-06-17 10:59 ` [PATCH v3 1/3] dt-bindings: vendor-prefixes: Add Lontium vendor prefix Vinod Koul
2020-06-17 10:59 ` [PATCH v3 2/3] dt-bindings: display: bridge: Add documentation for LT9611 Vinod Koul
2020-06-17 10:59 ` [PATCH v3 3/3] drm/bridge: Introduce LT9611 DSI to HDMI bridge Vinod Koul
2020-06-20 18:05   ` Sam Ravnborg
2020-06-22  7:09     ` Vinod Koul [this message]
2020-06-20  2:32 ` [PATCH v3 0/3] Add " John Stultz

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=20200622070934.GG2324254@vkoul-mobl \
    --to=vkoul@kernel.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=narmstrong@baylibre.com \
    --cc=robdclark@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=srinivas.kandagatla@linaro.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).