Re: [PATCH v8 02/12] drm/panel: panel-hitachi-tx10d07vm0baa: Convert to use MIPI DBI bus

From: Svyatoslav Ryhel

Date: Fri Nov 27 2026 - 08:08:44 EST


пт, 27 лист. 2026 р. о 14:20 Mikko Perttunen <mperttunen@xxxxxxxxxx> пише:
>
> On Friday, November 27, 2026 6:10 PM Svyatoslav Ryhel wrote:
> > пт, 27 лист. 2026 р. о 06:23 Mikko Perttunen <mperttunen@xxxxxxxxxx> пише:
> > >
> > > On Sunday, November 22, 2026 5:18 PM Svyatoslav Ryhel wrote:
> > > > Switch from a generic platform driver to a dedicated MIPI DBI Type B
> > > > driver.
> > > >
> > > > Signed-off-by: Svyatoslav Ryhel <clamor95@xxxxxxxxx>
> > > > ---
> > > > .../drm/panel/panel-hitachi-tx10d07vm0baa.c | 25 +++++++++----------
> > > > 1 file changed, 12 insertions(+), 13 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/panel/panel-hitachi-tx10d07vm0baa.c b/drivers/gpu/drm/panel/panel-hitachi-tx10d07vm0baa.c
> > > > index 83c2af1be9755..318ece68b7806 100644
> > > > --- a/drivers/gpu/drm/panel/panel-hitachi-tx10d07vm0baa.c
> > > > +++ b/drivers/gpu/drm/panel/panel-hitachi-tx10d07vm0baa.c
> > > > @@ -14,6 +14,7 @@
> > > > #include <video/mipi_display.h>
> > > >
> > > > #include <drm/drm_mipi_dbi.h>
> > > > +#include <drm/drm_mipi_dbi_bus.h>
> > > > #include <drm/drm_modes.h>
> > > > #include <drm/drm_of.h>
> > > > #include <drm/drm_panel.h>
> > >
> > > You should now be able to get rid of includes of of_platform.h
> > > (replacing with of.h) and platform_device.h. Agent says drm_of.h and
> > > property.h are also unused.
> > >
> > > > @@ -25,7 +26,7 @@ static const struct regulator_bulk_data hitachi_tx10d07vm0baa_supplies[] = {
> > > >
> > > > struct hitachi_tx10d07vm0baa {
> > > > struct drm_panel panel;
> > > > - struct mipi_dbi *dbi;
> > > > + struct mipi_dbi_device *dbidev;
> > > >
> > > > struct regulator_bulk_data *supplies;
> > > > struct gpio_desc *reset_gpio;
> > > > @@ -40,9 +41,10 @@ static inline struct hitachi_tx10d07vm0baa *to_hitachi_tx10d07vm0baa(struct drm_
> > > > ({ \
> > > > const u8 d[] = { seq }; \
> > > > struct drm_panel *panel = &(priv)->panel; \
> > > > + struct mipi_dbi_device *dbidev = (priv)->dbidev; \
> > > > struct device *dev = panel->dev; \
> > > > int ret; \
> > > > - ret = mipi_dbi_command_stackbuf((priv)->dbi, cmd, d, ARRAY_SIZE(d)); \
> > > > + ret = mipi_dbi_command_stackbuf((dbidev)->dbi, cmd, d, ARRAY_SIZE(d)); \
> > > > if (ret) \
> > > > dev_err_ratelimited(dev, "error %d when sending command %#02x\n", ret, cmd); \
> > > > ret; \
> > > > @@ -54,10 +56,6 @@ static int hitachi_tx10d07vm0baa_prepare(struct drm_panel *panel)
> > > > struct device *dev = panel->dev;
> > > > int ret;
> > > >
> > > > - priv->dbi = dev_get_drvdata(dev->parent);
> > > > - if (!priv->dbi)
> > > > - return -ENODEV;
> > > > -
> > > > gpiod_set_value_cansleep(priv->reset_gpio, 1);
> > > >
> > > > ret = regulator_bulk_enable(ARRAY_SIZE(hitachi_tx10d07vm0baa_supplies), priv->supplies);
> > > > @@ -243,9 +241,9 @@ static const struct drm_panel_funcs hitachi_tx10d07vm0baa_panel_funcs = {
> > > > .get_modes = hitachi_tx10d07vm0baa_get_modes,
> > > > };
> > >
> > > Unnecessary semicolon here.
> > >
> > > >
> > > > -static int hitachi_tx10d07vm0baa_probe(struct platform_device *pdev)
> > > > +static int hitachi_tx10d07vm0baa_probe(struct mipi_dbi_device *dbidev)
> > > > {
> > > > - struct device *dev = &pdev->dev;
> > > > + struct device *dev = &dbidev->dev;
> > > > struct hitachi_tx10d07vm0baa *priv;
> > > > int ret;
> > > >
> > > > @@ -264,6 +262,9 @@ static int hitachi_tx10d07vm0baa_probe(struct platform_device *pdev)
> > > > return dev_err_probe(dev, PTR_ERR(priv->reset_gpio),
> > > > "Failed to get reset gpio\n");
> > > >
> > > > + priv->dbidev = dbidev;
> > > > + mipi_dbi_set_drvdata(dbidev, priv);
> > > > +
> > > > ret = drm_panel_of_backlight(&priv->panel);
> > > > if (ret)
> > > > return dev_err_probe(dev, ret, "Failed to get backlight\n");
> > > > @@ -272,9 +273,7 @@ static int hitachi_tx10d07vm0baa_probe(struct platform_device *pdev)
> > > > if (ret)
> > > > return dev_err_probe(dev, ret, "Failed to add panel\n");
> > > >
> > > > - platform_set_drvdata(pdev, priv);
> > > > -
> > > > - return 0;
> > > > + return devm_mipi_dbi_attach(dev, dbidev);
> > > > }
> > > >
> > > > static const struct of_device_id hitachi_tx10d07vm0baa_of_match[] = {
> > > > @@ -283,14 +282,14 @@ static const struct of_device_id hitachi_tx10d07vm0baa_of_match[] = {
> > > > };
> > > > MODULE_DEVICE_TABLE(of, hitachi_tx10d07vm0baa_of_match);
> > > >
> > > > -static struct platform_driver hitachi_tx10d07vm0baa_driver = {
> > > > +static struct mipi_dbi_driver hitachi_tx10d07vm0baa_driver = {
> > > > .driver = {
> > > > .name = "panel-hitachi-tx10d07vm0baa",
> > > > .of_match_table = hitachi_tx10d07vm0baa_of_match,
> > > > },
> > > > .probe = hitachi_tx10d07vm0baa_probe,
> > > > };
> > > > -module_platform_driver(hitachi_tx10d07vm0baa_driver);
> > > > +module_mipi_dbi_driver(hitachi_tx10d07vm0baa_driver);
> > > >
> > > > MODULE_AUTHOR("Svyatoslav Ryhel <clamor95@xxxxxxxxx>");
> > > > MODULE_DESCRIPTION("HITACHI TX10D07VM0BAA MIPI DBI Type B panel driver");
> > > > --
> > > > 2.53.0
> > > >
> > > >
> >
> > I agree that your suggestions are ok, but they are out of scope of
> > this patch. They would require either dedicated commits or can be sent
> > as followups later on since they do not cause bugs.
>
> I don't see why the include changes are out of scope. The platform
> driver was including platform includes but now it's no longer a platform
> driver so it shouldn't include platform driver stuff. The rest are minor
> enough that I think they can be included as well.
>

I can remove headers, sure. Regarding semicolon, here is a bigger code fragment

static const struct drm_panel_funcs hitachi_tx10d07vm0baa_panel_funcs = {
.prepare = hitachi_tx10d07vm0baa_prepare,
.enable = hitachi_tx10d07vm0baa_enable,
.disable = hitachi_tx10d07vm0baa_disable,
.unprepare = hitachi_tx10d07vm0baa_unprepare,
.get_modes = hitachi_tx10d07vm0baa_get_modes,
};

- static int hitachi_tx10d07vm0baa_probe(struct platform_device *pdev)
+ static int hitachi_tx10d07vm0baa_probe(struct mipi_dbi_device *dbidev)
{
- struct device *dev = &pdev->dev;
+struct device *dev = &dbidev->dev;
struct hitachi_tx10d07vm0baa *priv;
int ret;


>
>