All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jianhua Lu <lujianhua000@gmail.com>
To: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Konrad Dybcio <konrad.dybcio@linaro.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Sam Ravnborg <sam@ravnborg.org>, David Airlie <airlied@gmail.com>,
	Daniel Vetter <daniel@ffwll.ch>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht,
	phone-devel@vger.kernel.org
Subject: Re: [PATCH v5 2/2] drm/panel: Add driver for Novatek NT36523
Date: Mon, 13 Mar 2023 17:34:23 +0800	[thread overview]
Message-ID: <ZA7uH173ZmbGWzv8@Gentoo> (raw)
In-Reply-To: <6c02557d-372d-05b1-2998-7c2cde99fac7@linaro.org>

On Mon, Mar 13, 2023 at 09:06:50AM +0100, Neil Armstrong wrote:
> On 11/03/2023 13:46, Jianhua Lu wrote:
> > On Sat, Mar 11, 2023 at 01:38:52PM +0100, Konrad Dybcio wrote:
> >>
> >>
> >> On 11.03.2023 13:32, Jianhua Lu wrote:
> >>> Add a driver for panels using the Novatek NT36523 display driver IC.
> >>>
> >>> Signed-off-by: Jianhua Lu <lujianhua000@gmail.com>
> >>> ---
> >> [...]
> >>
> >>> +
> >>> +static int nt36523_get_modes(struct drm_panel *panel,
> >>> +			       struct drm_connector *connector)
> >>> +{
> >>> +	struct panel_info *pinfo = to_panel_info(panel);
> >>> +	int i;
> >>> +
> >>> +	for (i = 0; i < pinfo->desc->num_modes; i++) {
> >>> +		const struct drm_display_mode *m = &pinfo->desc->modes[i];
> >>> +		struct drm_display_mode *mode;
> >>> +
> >>> +		mode = drm_mode_duplicate(connector->dev, m);
> >>> +		if (!mode) {
> >>> +			dev_err(panel->dev, "failed to add mode %ux%u@%u\n",
> >>> +				m->hdisplay, m->vdisplay, drm_mode_vrefresh(m));
> >>> +			return -ENOMEM;
> >>> +		}
> >>> +
> >>> +		mode->type = DRM_MODE_TYPE_DRIVER;
> >>> +		if (pinfo->desc->num_modes == 1)
> >>> +			mode->type |= DRM_MODE_TYPE_PREFERRED;
> >> That's not quite correct, as that means "if you have more than one
> >> defined panel mode (say 60Hz and 120 Hz), there will be no preferred one".
> > This piece of code I see in the other panels, so I'm not sure if it is
> > correct. Should
> > if (pinfo->desc->num_modes > 1)
> > 			mode->type |= DRM_MODE_TYPE_PREFERRED;
> > is correct?
> 
> I think only a single mode with DRM_MODE_TYPE_PREFERRED is preferred,
> so:
> if (i == 0)
> 	mode->type |= DRM_MODE_TYPE_PREFERRED;		
> 
> would be the right thing to do.
Thanks for your explanation.
> 
> 
> Neil
> >>
> >> Konrad
> >>>
> 

WARNING: multiple messages have this Message-ID (diff)
From: Jianhua Lu <lujianhua000@gmail.com>
To: Neil Armstrong <neil.armstrong@linaro.org>
Cc: devicetree@vger.kernel.org,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Sam Ravnborg <sam@ravnborg.org>,
	linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	dri-devel@lists.freedesktop.org, phone-devel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht
Subject: Re: [PATCH v5 2/2] drm/panel: Add driver for Novatek NT36523
Date: Mon, 13 Mar 2023 17:34:23 +0800	[thread overview]
Message-ID: <ZA7uH173ZmbGWzv8@Gentoo> (raw)
In-Reply-To: <6c02557d-372d-05b1-2998-7c2cde99fac7@linaro.org>

On Mon, Mar 13, 2023 at 09:06:50AM +0100, Neil Armstrong wrote:
> On 11/03/2023 13:46, Jianhua Lu wrote:
> > On Sat, Mar 11, 2023 at 01:38:52PM +0100, Konrad Dybcio wrote:
> >>
> >>
> >> On 11.03.2023 13:32, Jianhua Lu wrote:
> >>> Add a driver for panels using the Novatek NT36523 display driver IC.
> >>>
> >>> Signed-off-by: Jianhua Lu <lujianhua000@gmail.com>
> >>> ---
> >> [...]
> >>
> >>> +
> >>> +static int nt36523_get_modes(struct drm_panel *panel,
> >>> +			       struct drm_connector *connector)
> >>> +{
> >>> +	struct panel_info *pinfo = to_panel_info(panel);
> >>> +	int i;
> >>> +
> >>> +	for (i = 0; i < pinfo->desc->num_modes; i++) {
> >>> +		const struct drm_display_mode *m = &pinfo->desc->modes[i];
> >>> +		struct drm_display_mode *mode;
> >>> +
> >>> +		mode = drm_mode_duplicate(connector->dev, m);
> >>> +		if (!mode) {
> >>> +			dev_err(panel->dev, "failed to add mode %ux%u@%u\n",
> >>> +				m->hdisplay, m->vdisplay, drm_mode_vrefresh(m));
> >>> +			return -ENOMEM;
> >>> +		}
> >>> +
> >>> +		mode->type = DRM_MODE_TYPE_DRIVER;
> >>> +		if (pinfo->desc->num_modes == 1)
> >>> +			mode->type |= DRM_MODE_TYPE_PREFERRED;
> >> That's not quite correct, as that means "if you have more than one
> >> defined panel mode (say 60Hz and 120 Hz), there will be no preferred one".
> > This piece of code I see in the other panels, so I'm not sure if it is
> > correct. Should
> > if (pinfo->desc->num_modes > 1)
> > 			mode->type |= DRM_MODE_TYPE_PREFERRED;
> > is correct?
> 
> I think only a single mode with DRM_MODE_TYPE_PREFERRED is preferred,
> so:
> if (i == 0)
> 	mode->type |= DRM_MODE_TYPE_PREFERRED;		
> 
> would be the right thing to do.
Thanks for your explanation.
> 
> 
> Neil
> >>
> >> Konrad
> >>>
> 

  reply	other threads:[~2023-03-13  9:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-11 12:32 [PATCH v5 1/2] dt-bindings: display: panel: Add Novatek NT36523 bindings Jianhua Lu
2023-03-11 12:32 ` Jianhua Lu
2023-03-11 12:32 ` [PATCH v5 2/2] drm/panel: Add driver for Novatek NT36523 Jianhua Lu
2023-03-11 12:32   ` Jianhua Lu
2023-03-11 12:38   ` Konrad Dybcio
2023-03-11 12:38     ` Konrad Dybcio
2023-03-11 12:46     ` Jianhua Lu
2023-03-11 12:46       ` Jianhua Lu
2023-03-13  8:06       ` Neil Armstrong
2023-03-13  8:06         ` Neil Armstrong
2023-03-13  9:34         ` Jianhua Lu [this message]
2023-03-13  9:34           ` Jianhua Lu
2023-03-13 18:53         ` Sam Ravnborg
2023-03-13 18:53           ` Sam Ravnborg
2023-03-14 11:40           ` Jianhua Lu
2023-03-14 11:40             ` Jianhua Lu

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=ZA7uH173ZmbGWzv8@Gentoo \
    --to=lujianhua000@gmail.com \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=phone-devel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=thierry.reding@gmail.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.