mbox series

[v2,0/3] drm/panel: add fannal c3004 panel

Message ID 20230605153539.497602-1-pavacic.p@gmail.com
Headers show
Series drm/panel: add fannal c3004 panel | expand

Message

Paulo Pavacic June 5, 2023, 3:35 p.m. UTC
Fannal C3004 is a 2 lane MIPI DSI 480x800 panel which requires initialization with DSI DCS
commands. After few initialization commands delay is required.

Paulo Pavacic (3):
  dt-bindings: add fannal vendor prefix
  dt-bindings: display: panel: add fannal,c3004
  drm/panel-fannal-c3003: Add fannal c3004 DSI panel

 .../bindings/display/panel/fannal,c3004.yaml  |  78 +++++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 MAINTAINERS                                   |   7 +
 drivers/gpu/drm/panel/Kconfig                 |  11 +
 drivers/gpu/drm/panel/Makefile                |   1 +
 drivers/gpu/drm/panel/panel-fannal-c3004.c    | 319 ++++++++++++++++++
 6 files changed, 418 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/fannal,c3004.yaml
 create mode 100644 drivers/gpu/drm/panel/panel-fannal-c3004.c

Comments

Krzysztof Kozlowski June 6, 2023, 7:14 a.m. UTC | #1
On 05/06/2023 17:35, Paulo Pavacic wrote:
> Fannal C3004 is a 480x800 display made by fannal that requires
> DCS initialization sequences.
> 
> Signed-off-by: Paulo Pavacic <pavacic.p@gmail.com>
> ---

> v3 changelog:
>  - using generic mipi_dsi_dcs_write_seq

This is marked as v2?

>  - removed success prints
>  - removed some comments
>  - simplified code/removed support for different panels
>  - changed namespace from fann to fannal
> v2 changelog:
>  - renamed from panel-mipi-dsi-bringup
>  - only one MAINTAINER e-mail
> ---
>  MAINTAINERS     


> +static int fannal_panel_probe(struct mipi_dsi_device *dsi)
> +{
> +	struct device *dev = &dsi->dev;
> +	struct fannal_panel_data *panel_data;
> +	int ret;
> +
> +	panel_data = devm_kzalloc(&dsi->dev, sizeof(*panel_data), GFP_KERNEL);
> +
> +	if (!panel_data)
> +		return -ENOMEM;
> +
> +	panel_data->reset = devm_gpiod_get_optional(
> +		dev, "reset", GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);

dev should be in previous line

Why this is nonexclusive? How many instances of same driver are
expecting to get this on one system?

> +
> +	if (IS_ERR(panel_data->reset)) {
> +		ret = PTR_ERR(panel_data->reset);
> +		dev_err(dev,
> +			"error: probe: get reset GPIO: (%d) Check the fdt\n",
> +			ret);

return dev_err_probe

> +		return ret;
> +	}
> +
> +	mipi_dsi_set_drvdata(dsi, panel_data);
> +
> +	dsi->format = MIPI_DSI_FMT_RGB888;
> +	dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS |
> +			  MIPI_DSI_MODE_VSYNC_FLUSH | MIPI_DSI_MODE_VIDEO_HSE |
> +			  MIPI_DSI_MODE_NO_EOT_PACKET |
> +			  MIPI_DSI_MODE_VIDEO_SYNC_PULSE | MIPI_DSI_MODE_VIDEO;
> +	dsi->lanes = 2;
> +
> +	gpiod_set_value_cansleep(panel_data->reset, 1);

So you leave the panel in reset state?
> +
> +	drm_panel_init(&panel_data->panel, dev, &fannal_panel_funcs,
> +		       DRM_MODE_CONNECTOR_DSI);
> +	dev_set_drvdata(dev, panel_data);
> +
> +	drm_panel_add(&panel_data->panel);
> +
> +	ret = mipi_dsi_attach(dsi);
> +	if (ret) {
> +		drm_panel_remove(&panel_data->panel);
> +		dev_err(dev, "error: probe fail: can't attach mipi_dsi!\n");

No need to shout, skip exclamation mark.


Best regards,
Krzysztof
Paulo Pavacic June 6, 2023, 7:36 a.m. UTC | #2
Hello Krzysztof,

uto, 6. lip 2023. u 09:14 Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> napisao je:
>
> On 05/06/2023 17:35, Paulo Pavacic wrote:
> > Fannal C3004 is a 480x800 display made by fannal that requires
> > DCS initialization sequences.
> >
> > Signed-off-by: Paulo Pavacic <pavacic.p@gmail.com>
> > ---
>
> > v3 changelog:
> >  - using generic mipi_dsi_dcs_write_seq
>
> This is marked as v2?

I have ruined numbering. At first this driver was named
panel-mipi-dsi-bringup and parts of it weren't handled under patchset.

>
> >  - removed success prints
> >  - removed some comments
> >  - simplified code/removed support for different panels
> >  - changed namespace from fann to fannal
> > v2 changelog:
> >  - renamed from panel-mipi-dsi-bringup
> >  - only one MAINTAINER e-mail
> > ---
> >  MAINTAINERS
>
>
> > +static int fannal_panel_probe(struct mipi_dsi_device *dsi)
> > +{
> > +     struct device *dev = &dsi->dev;
> > +     struct fannal_panel_data *panel_data;
> > +     int ret;
> > +
> > +     panel_data = devm_kzalloc(&dsi->dev, sizeof(*panel_data), GFP_KERNEL);
> > +
> > +     if (!panel_data)
> > +             return -ENOMEM;
> > +
> > +     panel_data->reset = devm_gpiod_get_optional(
> > +             dev, "reset", GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
>
> dev should be in previous line
>
> Why this is nonexclusive? How many instances of same driver are
> expecting to get this on one system?
>
> > +
> > +     if (IS_ERR(panel_data->reset)) {
> > +             ret = PTR_ERR(panel_data->reset);
> > +             dev_err(dev,
> > +                     "error: probe: get reset GPIO: (%d) Check the fdt\n",
> > +                     ret);
>
> return dev_err_probe
>
> > +             return ret;
> > +     }
> > +
> > +     mipi_dsi_set_drvdata(dsi, panel_data);
> > +
> > +     dsi->format = MIPI_DSI_FMT_RGB888;
> > +     dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS |
> > +                       MIPI_DSI_MODE_VSYNC_FLUSH | MIPI_DSI_MODE_VIDEO_HSE |
> > +                       MIPI_DSI_MODE_NO_EOT_PACKET |
> > +                       MIPI_DSI_MODE_VIDEO_SYNC_PULSE | MIPI_DSI_MODE_VIDEO;
> > +     dsi->lanes = 2;
> > +
> > +     gpiod_set_value_cansleep(panel_data->reset, 1);
>
> So you leave the panel in reset state?
yes

> > +
> > +     drm_panel_init(&panel_data->panel, dev, &fannal_panel_funcs,
> > +                    DRM_MODE_CONNECTOR_DSI);
> > +     dev_set_drvdata(dev, panel_data);
> > +
> > +     drm_panel_add(&panel_data->panel);
> > +
> > +     ret = mipi_dsi_attach(dsi);
> > +     if (ret) {
> > +             drm_panel_remove(&panel_data->panel);
> > +             dev_err(dev, "error: probe fail: can't attach mipi_dsi!\n");
>
> No need to shout, skip exclamation mark.
>
>
> Best regards,
> Krzysztof
>

Thanks,
Paulo