public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Neil Armstrong <neil.armstrong@linaro.org>
To: Jerome Brunet <jbrunet@baylibre.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Jessica Zhang <quic_jesszhan@quicinc.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/3] drm/panel: add lincoln lcd197 support
Date: Wed, 26 Jun 2024 11:12:22 +0200	[thread overview]
Message-ID: <bb73744f-9b04-410b-b4ec-1c5071016d28@linaro.org> (raw)
In-Reply-To: <1jmsn8gjq6.fsf@starbuckisacylon.baylibre.com>

On 26/06/2024 11:02, Jerome Brunet wrote:
> On Wed 26 Jun 2024 at 07:41, Dmitry Baryshkov <dmitry.baryshkov@linaro.org> wrote:
> 
>> On Tue, Jun 25, 2024 at 04:25:50PM GMT, Jerome Brunet wrote:
>>> Add support for the Lincoln LCD197 1080x1920 DSI panel.
>>>
>>> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
>>> ---
>>>   drivers/gpu/drm/panel/Kconfig                |  11 +
>>>   drivers/gpu/drm/panel/Makefile               |   1 +
>>>   drivers/gpu/drm/panel/panel-lincoln-lcd197.c | 333 +++++++++++++++++++
>>>   3 files changed, 345 insertions(+)
>>>   create mode 100644 drivers/gpu/drm/panel/panel-lincoln-lcd197.c
>>>
>>
>> [...]
>>
>>> +
>>> +	mipi_dsi_dcs_write_seq(lcd->dsi, 0xB9, 0xFF, 0x83, 0x99);
>>
>> - Please use lowercase hex instead
>> - Please consider switching to _multi() functions.
> 
> Could you be a bit more specific about these '_multi' function ?
> I've looked at 'drm_mipi_dsi.h' and can't really make what you mean.
> 
> Maybe I'm not looking in the right place.
> 
>>
>>
>>> +	usleep_range(200, 300);
>>
>> This will require new helper msm_dsi_usleep_range(ctx, 200, 300);
> 
> I don't really understand why I would need something else to just sleep
> ? Could you add some context please ?
> 
> Isn't 'msm_' usually something Qcom specific ?
> 
>>
>>> +	mipi_dsi_dcs_write_seq(lcd->dsi, 0xB6, 0x92, 0x92);
>>> +	mipi_dsi_dcs_write_seq(lcd->dsi, 0xCC, 0x00);
>>> +	mipi_dsi_dcs_write_seq(lcd->dsi, 0xBF, 0x40, 0x41, 0x50, 0x49);
>>> +	mipi_dsi_dcs_write_seq(lcd->dsi, 0xC6, 0xFF, 0xF9);
>>> +	mipi_dsi_dcs_write_seq(lcd->dsi, 0xC0, 0x25, 0x5A);
>>> +	mipi_dsi_dcs_write_seq(lcd->dsi, MIPI_DCS_SET_ADDRESS_MODE, 0x02);
>>> +
>>> +	err = mipi_dsi_dcs_exit_sleep_mode(lcd->dsi);
>>> +	if (err < 0) {
>>> +		dev_err(panel->dev, "failed to exit sleep mode: %d\n", err);
>>> +		goto poweroff;
>>> +	}
>>> +	msleep(120);
>>> +
>>> +	err = mipi_dsi_dcs_read(lcd->dsi, MIPI_DCS_GET_DISPLAY_ID, display_id, 3);
>>
>> This probably needs new _multi helper too.
>>
>>> +	if (err < 0) {
>>> +		dev_err(panel->dev, "Failed to read display id: %d\n", err);
>>> +	} else {
>>> +		dev_dbg(panel->dev, "Display id: 0x%02x-0x%02x-0x%02x\n",
>>> +			display_id[0], display_id[1], display_id[2]);
>>> +	}
>>> +
>>> +	lcd->prepared = true;
>>
>> Should not be required anymore.
> 
> The whole driver is heavily inspired by what is already in
> drivers/gpu/drm/panel/ and a lot are doing something similar.
> 
> Maybe there has been a change since then and the existing have been
> reworked yet. Would you mind pointing me that change if that is
> the case ?
> 
>>
>>> +
>>> +	return 0;
>>> +
>>> +poweroff:
>>> +	gpiod_set_value_cansleep(lcd->enable_gpio, 0);
>>> +	gpiod_set_value_cansleep(lcd->reset_gpio, 1);
>>> +	regulator_disable(lcd->supply);
>>> +
>>> +	return err;
>>> +}
>>> +
>>
>>> +
>>> +static const struct drm_display_mode default_mode = {
>>> +	.clock = 154002,
>>> +	.hdisplay = 1080,
>>> +	.hsync_start = 1080 + 20,
>>> +	.hsync_end = 1080 + 20 + 6,
>>> +	.htotal = 1080 + 204,
>>> +	.vdisplay = 1920,
>>> +	.vsync_start = 1920 + 4,
>>> +	.vsync_end = 1920 + 4 + 4,
>>> +	.vtotal = 1920 + 79,
>>> +	.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
>>> +};
>>> +
>>> +static int lincoln_lcd197_panel_get_modes(struct drm_panel *panel,
>>> +					  struct drm_connector *connector)
>>> +{
>>> +	struct drm_display_mode *mode;
>>> +
>>> +	mode = drm_mode_duplicate(connector->dev, &default_mode);
>>> +	if (!mode) {
>>> +		dev_err(panel->dev, "failed to add mode %ux%u@%u\n",
>>> +			default_mode.hdisplay, default_mode.vdisplay,
>>> +			drm_mode_vrefresh(&default_mode));
>>> +		return -ENOMEM;
>>> +	}
>>> +
>>> +	drm_mode_set_name(mode);
>>> +	drm_mode_probed_add(connector, mode);
>>> +	connector->display_info.width_mm = 79;
>>> +	connector->display_info.height_mm = 125;
>>
>> drm_connector_helper_get_modes_fixed()
> 
> Thanks for the hint
> 
>>
>>> +
>>> +	return 1;
>>> +}
>>> +
>>
>>
>>> +
>>> +static void lincoln_lcd197_panel_shutdown(struct mipi_dsi_device *dsi)
>>> +{
>>> +	struct lincoln_lcd197_panel *lcd = mipi_dsi_get_drvdata(dsi);
>>> +
>>> +	drm_panel_disable(&lcd->panel);
>>> +	drm_panel_unprepare(&lcd->panel);
>>> +}
>>
>> I think the agreement was that there should be no need for the panel's
>> shutdown, the DRM driver should shutdown the panel.
> 
> I'm happy to drop that if there is such agreement. Again, most panel
> drivers do implement that callback so I just did the same.
> 
> Could you point me to this 'agreement' please, so I can get a better
> understanding of it ?
> 

please rebase on linux-next or drm-misc-next and use the new introduced macros
dmitry pointed out.

Neil

  reply	other threads:[~2024-06-26  9:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 14:25 [PATCH 0/3] drm: panel: add support lincoln LCD197 panel Jerome Brunet
2024-06-25 14:25 ` [PATCH 1/3] dt-bindings: vendor-prefixes: add prefix for lincoln Jerome Brunet
2024-06-25 16:24   ` Conor Dooley
2024-06-25 14:25 ` [PATCH 2/3] dt-bindings: panel-simple-dsi: add lincoln LCD197 panel bindings Jerome Brunet
2024-06-25 16:24   ` Conor Dooley
2024-06-25 14:25 ` [PATCH 3/3] drm/panel: add lincoln lcd197 support Jerome Brunet
2024-06-26  4:41   ` Dmitry Baryshkov
2024-06-26  9:02     ` Jerome Brunet
2024-06-26  9:12       ` Neil Armstrong [this message]
2024-06-26  9:15       ` Dmitry Baryshkov

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=bb73744f-9b04-410b-b4ec-1c5071016d28@linaro.org \
    --to=neil.armstrong@linaro.org \
    --cc=airlied@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jbrunet@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=quic_jesszhan@quicinc.com \
    --cc=robh@kernel.org \
    --cc=sam@ravnborg.org \
    --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