From: Sam Ravnborg <sam@ravnborg.org>
To: Jitao Shi <jitao.shi@mediatek.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Matthias Brugger <matthias.bgg@gmail.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com,
yingjoe.chen@mediatek.com, eddie.huang@mediatek.com,
cawa.cheng@mediatek.com, bibby.hsieh@mediatek.com,
ck.hu@mediatek.com, stonea168@163.com
Subject: Re: [PATCH v8 2/8] drm/panel: support for BOE tv101wum-nl6 wuxga dsi video mode panel
Date: Wed, 15 Jan 2020 22:14:04 +0100 [thread overview]
Message-ID: <20200115211404.GC28904@ravnborg.org> (raw)
In-Reply-To: <20200115135958.126303-3-jitao.shi@mediatek.com>
Hi Jitao.
> +
> +static int boe_panel_add(struct boe_panel *boe)
> +{
> + struct device *dev = &boe->dsi->dev;
> + int err;
> +
> + boe->avdd = devm_regulator_get(dev, "avdd");
> + if (IS_ERR(boe->avdd))
> + return PTR_ERR(boe->avdd);
> +
> + boe->avee = devm_regulator_get(dev, "avee");
> + if (IS_ERR(boe->avee))
> + return PTR_ERR(boe->avee);
> +
> + boe->pp1800 = devm_regulator_get(dev, "pp1800");
> + if (IS_ERR(boe->pp1800))
> + return PTR_ERR(boe->pp1800);
> +
> + boe->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
> + if (IS_ERR(boe->enable_gpio)) {
> + dev_err(dev, "cannot get reset-gpios %ld\n",
> + PTR_ERR(boe->enable_gpio));
> + return PTR_ERR(boe->enable_gpio);
> + }
> +
> + gpiod_set_value(boe->enable_gpio, 0);
> +
> + err = drm_panel_of_backlight(&boe->base);
> + if (err)
> + return err;
From the descrition of drm_panel_of_backlight():
""
drm_panel_of_backlight() must be called after the call to drm_panel_init().
""
Please do as documented.
Sam
> +
> + drm_panel_init(&boe->base, dev, &boe_panel_funcs,
> + DRM_MODE_CONNECTOR_DSI);
> +
> + boe->base.funcs = &boe_panel_funcs;
> + boe->base.dev = &boe->dsi->dev;
> +
> + return drm_panel_add(&boe->base);
> +}
> +
> +static int boe_panel_probe(struct mipi_dsi_device *dsi)
> +{
> + struct boe_panel *boe;
> + int ret;
> + const struct panel_desc *desc;
> +
> + boe = devm_kzalloc(&dsi->dev, sizeof(*boe), GFP_KERNEL);
> + if (!boe)
> + return -ENOMEM;
> +
> + desc = of_device_get_match_data(&dsi->dev);
> + dsi->lanes = desc->lanes;
> + dsi->format = desc->format;
> + dsi->mode_flags = desc->mode_flags;
> + boe->desc = desc;
> + boe->dsi = dsi;
> + ret = boe_panel_add(boe);
> + if (ret < 0)
> + return ret;
> +
> + mipi_dsi_set_drvdata(dsi, boe);
> +
> + ret = mipi_dsi_attach(dsi);
> + if (ret)
> + drm_panel_remove(&boe->base);
> +
> + return ret;
> +}
> +
> +static void boe_panel_shutdown(struct mipi_dsi_device *dsi)
> +{
> + struct boe_panel *boe = mipi_dsi_get_drvdata(dsi);
> +
> + drm_panel_disable(&boe->base);
> + drm_panel_unprepare(&boe->base);
> +}
> +
> +static int boe_panel_remove(struct mipi_dsi_device *dsi)
> +{
> + struct boe_panel *boe = mipi_dsi_get_drvdata(dsi);
> + int ret;
> +
> + boe_panel_shutdown(dsi);
> +
> + ret = mipi_dsi_detach(dsi);
> + if (ret < 0)
> + dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
> +
> + if (boe->base.dev)
> + drm_panel_remove(&boe->base);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id boe_of_match[] = {
> + { .compatible = "boe,tv101wum-nl6",
> + .data = &boe_tv101wum_nl6_desc
> + },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, boe_of_match);
> +
> +static struct mipi_dsi_driver boe_panel_driver = {
> + .driver = {
> + .name = "panel-boe-tv101wum-nl6",
> + .of_match_table = boe_of_match,
> + },
> + .probe = boe_panel_probe,
> + .remove = boe_panel_remove,
> + .shutdown = boe_panel_shutdown,
> +};
> +module_mipi_dsi_driver(boe_panel_driver);
> +
> +MODULE_AUTHOR("Jitao Shi <jitao.shi@mediatek.com>");
> +MODULE_DESCRIPTION("BOE tv101wum-nl6 1200x1920 video mode panel driver");
> +MODULE_LICENSE("GPL v2");
> --
> 2.21.0
next prev parent reply other threads:[~2020-01-15 21:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-15 13:59 [PATCH v8 0/8] add driver for "boe, tv101wum-nl6", "boe, tv101wum-n53", "auo, kd101n80-45na" and "auo, b101uan08.3" panels Jitao Shi
2020-01-15 13:59 ` [PATCH v8 1/8] dt-bindings: display: panel: Add BOE tv101wum-n16 panel bindings Jitao Shi
2020-01-15 21:21 ` Sam Ravnborg
2020-01-15 13:59 ` [PATCH v8 2/8] drm/panel: support for BOE tv101wum-nl6 wuxga dsi video mode panel Jitao Shi
2020-01-15 21:14 ` Sam Ravnborg [this message]
2020-01-15 13:59 ` [PATCH v8 3/8] dt-bindings: display: panel: add auo kd101n80-45na panel bindings Jitao Shi
2020-01-15 13:59 ` [PATCH v8 4/8] drm/panel: support for auo,kd101n80-45na wuxga dsi video mode panel Jitao Shi
2020-01-15 13:59 ` [PATCH v8 5/8] dt-bindings: display: panel: add boe tv101wum-n53 panel documentation Jitao Shi
2020-01-15 13:59 ` [PATCH v8 6/8] drm/panel: support for boe,tv101wum-n53 wuxga dsi video mode panel Jitao Shi
2020-01-15 13:59 ` [PATCH v8 7/8] dt-bindings: display: panel: add AUO auo, b101uan08.3 panel documentation Jitao Shi
2020-01-15 13:59 ` [PATCH v8 8/8] drm/panel: support for auo,b101uan08.3 wuxga dsi video mode panel Jitao Shi
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=20200115211404.GC28904@ravnborg.org \
--to=sam@ravnborg.org \
--cc=airlied@linux.ie \
--cc=bibby.hsieh@mediatek.com \
--cc=cawa.cheng@mediatek.com \
--cc=ck.hu@mediatek.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=eddie.huang@mediatek.com \
--cc=jitao.shi@mediatek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=srv_heupstream@mediatek.com \
--cc=stonea168@163.com \
--cc=thierry.reding@gmail.com \
--cc=yingjoe.chen@mediatek.com \
/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