public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Sebastian Reichel <sre@kernel.org>,
	Nikhil Devshatwar <nikhil.nd@ti.com>,
	linux-omap@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Sekhar Nori <nsekhar@ti.com>, Tony Lindgren <tony@atomide.com>,
	"H . Nikolaus Schaller" <hns@goldelico.com>,
	Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: Re: [PATCH v3 13/56] drm/omap: dsi: introduce mipi_dsi_host
Date: Mon, 9 Nov 2020 10:38:10 +0200	[thread overview]
Message-ID: <20201109083810.GJ6029@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20201105120333.947408-14-tomi.valkeinen@ti.com>

Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:50PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel <sebastian.reichel@collabora.com>
> 
> This moves from custom platform driver infrastructure to mipi_dsi_host
> and mipi_dsi_device. Note, that this is a graduate step and the driver
> only uses the devices types and transfer function, but not yet the new
> device binding style or drm_panel.
> 
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 121 +++++++++---------
>  drivers/gpu/drm/omapdrm/dss/dsi.c             |  54 ++++++--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h         |   4 -
>  3 files changed, 103 insertions(+), 76 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index ea76a89d1833..c3190223d192 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -14,7 +14,6 @@
>  #include <linux/interrupt.h>
>  #include <linux/jiffies.h>
>  #include <linux/module.h>
> -#include <linux/platform_device.h>
>  #include <linux/sched/signal.h>
>  #include <linux/slab.h>
>  #include <linux/workqueue.h>
> @@ -39,13 +38,13 @@
>  #define DCS_GET_ID3		0xdc
>  
>  struct panel_drv_data {
> +	struct mipi_dsi_device *dsi;
> +
>  	struct omap_dss_device dssdev;
>  	struct omap_dss_device *src;
>  
>  	struct videomode vm;
>  
> -	struct platform_device *pdev;
> -
>  	struct mutex lock;
>  
>  	struct backlight_device *bldev;
> @@ -139,7 +138,7 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
>  
>  static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	const struct mipi_dsi_msg msg = {
>  		.channel = ddata->channel,
>  		.type = MIPI_DSI_DCS_READ,
> @@ -149,12 +148,12 @@ static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
>  		.rx_buf = data
>  	};
>  
> -	return src->ops->dsi.transfer(src, &msg);
> +	return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	const struct mipi_dsi_msg msg = {
>  		.channel = ddata->channel,
>  		.type = MIPI_DSI_DCS_SHORT_WRITE,
> @@ -162,12 +161,12 @@ static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
>  		.tx_len = 1,
>  	};
>  
> -	return src->ops->dsi.transfer(src, &msg);
> +	return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	const u8 buf[] = { dcs_cmd, param };
>  	const struct mipi_dsi_msg msg = {
>  		.channel = ddata->channel,
> @@ -176,13 +175,13 @@ static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 param)
>  		.tx_len = 2,
>  	};
>  
> -	return src->ops->dsi.transfer(src, &msg);
> +	return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_sleep_in(struct panel_drv_data *ddata)
>  
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	int r;
>  	const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
>  	const struct mipi_dsi_msg msg = {
> @@ -194,7 +193,7 @@ static int dsicm_sleep_in(struct panel_drv_data *ddata)
>  
>  	hw_guard_wait(ddata);
>  
> -	r = src->ops->dsi.transfer(src, &msg);
> +	r = dsi->host->ops->transfer(dsi->host, &msg);
>  	if (r)
>  		return r;
>  
> @@ -242,7 +241,7 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3)
>  static int dsicm_set_update_window(struct panel_drv_data *ddata,
>  		u16 x, u16 y, u16 w, u16 h)
>  {
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	int r;
>  	u16 x1 = x;
>  	u16 x2 = x + w - 1;
> @@ -279,11 +278,11 @@ static int dsicm_set_update_window(struct panel_drv_data *ddata,
>  		.tx_len = 5,
>  	};
>  
> -	r = src->ops->dsi.transfer(src, &msgX);
> +	r = dsi->host->ops->transfer(dsi->host, &msgX);
>  	if (r)
>  		return r;
>  
> -	r = src->ops->dsi.transfer(src, &msgY);
> +	r = dsi->host->ops->transfer(dsi->host, &msgY);
>  	if (r)
>  		return r;
>  
> @@ -326,7 +325,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>  	return 0;
>  
>  err:
> -	dev_err(&ddata->pdev->dev, "enter ULPS failed");
> +	dev_err(&ddata->dsi->dev, "enter ULPS failed");
>  	dsicm_panel_reset(ddata);
>  
>  	ddata->ulps_enabled = false;
> @@ -349,7 +348,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  
>  	r = _dsicm_enable_te(ddata, true);
>  	if (r) {
> -		dev_err(&ddata->pdev->dev, "failed to re-enable TE");
> +		dev_err(&ddata->dsi->dev, "failed to re-enable TE");
>  		goto err2;
>  	}
>  
> @@ -363,7 +362,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>  	return 0;
>  
>  err2:
> -	dev_err(&ddata->pdev->dev, "failed to exit ULPS");
> +	dev_err(&ddata->dsi->dev, "failed to exit ULPS");
>  
>  	r = dsicm_panel_reset(ddata);
>  	if (!r) {
> @@ -400,7 +399,7 @@ static int dsicm_bl_update_status(struct backlight_device *dev)
>  	else
>  		level = 0;
>  
> -	dev_dbg(&ddata->pdev->dev, "update brightness to %d\n", level);
> +	dev_dbg(&ddata->dsi->dev, "update brightness to %d\n", level);
>  
>  	mutex_lock(&ddata->lock);
>  
> @@ -637,7 +636,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	if (ddata->vpnl) {
>  		r = regulator_enable(ddata->vpnl);
>  		if (r) {
> -			dev_err(&ddata->pdev->dev,
> +			dev_err(&ddata->dsi->dev,
>  				"failed to enable VPNL: %d\n", r);
>  			return r;
>  		}
> @@ -646,7 +645,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	if (ddata->vddi) {
>  		r = regulator_enable(ddata->vddi);
>  		if (r) {
> -			dev_err(&ddata->pdev->dev,
> +			dev_err(&ddata->dsi->dev,
>  				"failed to enable VDDI: %d\n", r);
>  			goto err_vpnl;
>  		}
> @@ -654,7 +653,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>  	r = src->ops->dsi.set_config(src, &dsi_config);
>  	if (r) {
> -		dev_err(&ddata->pdev->dev, "failed to configure DSI\n");
> +		dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
>  		goto err_vddi;
>  	}
>  
> @@ -701,7 +700,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  	ddata->enabled = true;
>  
>  	if (!ddata->intro_printed) {
> -		dev_info(&ddata->pdev->dev, "panel revision %02x.%02x.%02x\n",
> +		dev_info(&ddata->dsi->dev, "panel revision %02x.%02x.%02x\n",
>  			id1, id2, id3);
>  		ddata->intro_printed = true;
>  	}
> @@ -710,7 +709,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>  	return 0;
>  err:
> -	dev_err(&ddata->pdev->dev, "error while enabling panel, issuing HW reset\n");
> +	dev_err(&ddata->dsi->dev, "error while enabling panel, issuing HW reset\n");
>  
>  	dsicm_hw_reset(ddata);
>  
> @@ -737,7 +736,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  		r = dsicm_sleep_in(ddata);
>  
>  	if (r) {
> -		dev_err(&ddata->pdev->dev,
> +		dev_err(&ddata->dsi->dev,
>  				"error disabling panel, issuing HW reset\n");
>  		dsicm_hw_reset(ddata);
>  	}
> @@ -754,7 +753,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  
>  static int dsicm_panel_reset(struct panel_drv_data *ddata)
>  {
> -	dev_err(&ddata->pdev->dev, "performing LCD reset\n");
> +	dev_err(&ddata->dsi->dev, "performing LCD reset\n");
>  
>  	dsicm_power_off(ddata);
>  	dsicm_hw_reset(ddata);
> @@ -765,7 +764,7 @@ static int dsicm_connect(struct omap_dss_device *src,
>  			 struct omap_dss_device *dst)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dst);
> -	struct device *dev = &ddata->pdev->dev;
> +	struct device *dev = &ddata->dsi->dev;
>  	int r;
>  
>  	r = src->ops->dsi.request_vc(src, ddata->channel);
> @@ -810,7 +809,7 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
>  
>  	return;
>  err:
> -	dev_dbg(&ddata->pdev->dev, "enable failed (%d)\n", r);
> +	dev_dbg(&ddata->dsi->dev, "enable failed (%d)\n", r);
>  	mutex_unlock(&ddata->lock);
>  }
>  
> @@ -842,7 +841,7 @@ static void dsicm_framedone_cb(int err, void *data)
>  	struct panel_drv_data *ddata = data;
>  	struct omap_dss_device *src = ddata->src;
>  
> -	dev_dbg(&ddata->pdev->dev, "framedone, err %d\n", err);
> +	dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
>  	src->ops->dsi.bus_unlock(src);
>  }
>  
> @@ -866,7 +865,7 @@ static irqreturn_t dsicm_te_isr(int irq, void *data)
>  
>  	return IRQ_HANDLED;
>  err:
> -	dev_err(&ddata->pdev->dev, "start update failed\n");
> +	dev_err(&ddata->dsi->dev, "start update failed\n");
>  	src->ops->dsi.bus_unlock(src);
>  	return IRQ_HANDLED;
>  }
> @@ -877,7 +876,7 @@ static void dsicm_te_timeout_work_callback(struct work_struct *work)
>  					te_timeout_work.work);
>  	struct omap_dss_device *src = ddata->src;
>  
> -	dev_err(&ddata->pdev->dev, "TE not received for 250ms!\n");
> +	dev_err(&ddata->dsi->dev, "TE not received for 250ms!\n");
>  
>  	atomic_set(&ddata->do_update, 0);
>  	src->ops->dsi.bus_unlock(src);
> @@ -890,7 +889,7 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  	struct omap_dss_device *src = ddata->src;
>  	int r;
>  
> -	dev_dbg(&ddata->pdev->dev, "update %d, %d, %d x %d\n", x, y, w, h);
> +	dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
>  
>  	mutex_lock(&ddata->lock);
>  	src->ops->dsi.bus_lock(src);
> @@ -935,14 +934,14 @@ static int dsicm_sync(struct omap_dss_device *dssdev)
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
>  	struct omap_dss_device *src = ddata->src;
>  
> -	dev_dbg(&ddata->pdev->dev, "sync\n");
> +	dev_dbg(&ddata->dsi->dev, "sync\n");
>  
>  	mutex_lock(&ddata->lock);
>  	src->ops->dsi.bus_lock(src);
>  	src->ops->dsi.bus_unlock(src);
>  	mutex_unlock(&ddata->lock);
>  
> -	dev_dbg(&ddata->pdev->dev, "sync done\n");
> +	dev_dbg(&ddata->dsi->dev, "sync done\n");
>  
>  	return 0;
>  }
> @@ -1019,7 +1018,7 @@ static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
>  					u16 size)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
> -	struct omap_dss_device *src = ddata->src;
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  
>  	const u8 buf[] = {
>  		size & 0xff,
> @@ -1033,7 +1032,7 @@ static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
>  		.tx_len = 2,
>  	};
>  
> -	return src->ops->dsi.transfer(src, &msg);
> +	return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_memory_read(struct omap_dss_device *dssdev,
> @@ -1041,6 +1040,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  		u16 x, u16 y, u16 w, u16 h)
>  {
>  	struct panel_drv_data *ddata = to_panel_data(dssdev);
> +	struct mipi_dsi_device *dsi = ddata->dsi;
>  	struct omap_dss_device *src = ddata->src;
>  	int r;
>  	int first = 1;
> @@ -1092,7 +1092,7 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  		};
>  		first = 0;
>  
> -		r = src->ops->dsi.transfer(src, &msg);
> +		r = dsi->host->ops->transfer(dsi->host, &msg);
>  		if (r < 0) {
>  			dev_err(dssdev->dev, "read error\n");
>  			goto err3;
> @@ -1101,12 +1101,12 @@ static int dsicm_memory_read(struct omap_dss_device *dssdev,
>  		buf_used += r;
>  
>  		if (r < plen) {
> -			dev_err(&ddata->pdev->dev, "short read\n");
> +			dev_err(&ddata->dsi->dev, "short read\n");
>  			break;
>  		}
>  
>  		if (signal_pending(current)) {
> -			dev_err(&ddata->pdev->dev, "signal pending, "
> +			dev_err(&ddata->dsi->dev, "signal pending, "
>  					"aborting memory read\n");
>  			r = -ERESTARTSYS;
>  			goto err3;
> @@ -1200,28 +1200,28 @@ static const struct omap_dss_driver dsicm_dss_driver = {
>  	.memory_read	= dsicm_memory_read,
>  };
>  
> -static int dsicm_probe_of(struct platform_device *pdev)
> +static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  {
> -	struct device_node *node = pdev->dev.of_node;
> +	struct device_node *node = dsi->dev.of_node;
>  	struct backlight_device *backlight;
> -	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
> +	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>  	struct display_timing timing;
>  	int err;
>  
>  	ddata->channel = TCH;
>  
> -	ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
> +	ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
>  	if (IS_ERR(ddata->reset_gpio)) {
>  		err = PTR_ERR(ddata->reset_gpio);
> -		dev_err(&pdev->dev, "reset gpio request failed: %d", err);
> +		dev_err(&dsi->dev, "reset gpio request failed: %d", err);
>  		return err;
>  	}
>  
> -	ddata->ext_te_gpio = devm_gpiod_get_optional(&pdev->dev, "te",
> +	ddata->ext_te_gpio = devm_gpiod_get_optional(&dsi->dev, "te",
>  						     GPIOD_IN);
>  	if (IS_ERR(ddata->ext_te_gpio)) {
>  		err = PTR_ERR(ddata->ext_te_gpio);
> -		dev_err(&pdev->dev, "TE gpio request failed: %d", err);
> +		dev_err(&dsi->dev, "TE gpio request failed: %d", err);
>  		return err;
>  	}
>  
> @@ -1232,7 +1232,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  			ddata->vm.pixelclock =
>  				ddata->vm.hactive * ddata->vm.vactive * 60;
>  	} else {
> -		dev_warn(&pdev->dev,
> +		dev_warn(&dsi->dev,
>  			 "failed to get video timing, using defaults\n");
>  	}
>  
> @@ -1242,7 +1242,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  	ddata->height_mm = 0;
>  	of_property_read_u32(node, "height-mm", &ddata->height_mm);
>  
> -	ddata->vpnl = devm_regulator_get_optional(&pdev->dev, "vpnl");
> +	ddata->vpnl = devm_regulator_get_optional(&dsi->dev, "vpnl");
>  	if (IS_ERR(ddata->vpnl)) {
>  		err = PTR_ERR(ddata->vpnl);
>  		if (err == -EPROBE_DEFER)
> @@ -1250,7 +1250,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  		ddata->vpnl = NULL;
>  	}
>  
> -	ddata->vddi = devm_regulator_get_optional(&pdev->dev, "vddi");
> +	ddata->vddi = devm_regulator_get_optional(&dsi->dev, "vddi");
>  	if (IS_ERR(ddata->vddi)) {
>  		err = PTR_ERR(ddata->vddi);
>  		if (err == -EPROBE_DEFER)
> @@ -1258,7 +1258,7 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  		ddata->vddi = NULL;
>  	}
>  
> -	backlight = devm_of_find_backlight(&pdev->dev);
> +	backlight = devm_of_find_backlight(&dsi->dev);
>  	if (IS_ERR(backlight))
>  		return PTR_ERR(backlight);
>  
> @@ -1273,11 +1273,11 @@ static int dsicm_probe_of(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int dsicm_probe(struct platform_device *pdev)
> +static int dsicm_probe(struct mipi_dsi_device *dsi)
>  {
>  	struct panel_drv_data *ddata;
>  	struct backlight_device *bldev = NULL;
> -	struct device *dev = &pdev->dev;
> +	struct device *dev = &dsi->dev;
>  	struct omap_dss_device *dssdev;
>  	int r;
>  
> @@ -1287,14 +1287,14 @@ static int dsicm_probe(struct platform_device *pdev)
>  	if (!ddata)
>  		return -ENOMEM;
>  
> -	platform_set_drvdata(pdev, ddata);
> -	ddata->pdev = pdev;
> +	mipi_dsi_set_drvdata(dsi, ddata);
> +	ddata->dsi = dsi;
>  
>  	ddata->vm.hactive = 864;
>  	ddata->vm.vactive = 480;
>  	ddata->vm.pixelclock = 864 * 480 * 60;
>  
> -	r = dsicm_probe_of(pdev);
> +	r = dsicm_probe_of(dsi);
>  	if (r)
>  		return r;
>  
> @@ -1376,12 +1376,12 @@ static int dsicm_probe(struct platform_device *pdev)
>  	return r;
>  }
>  
> -static int __exit dsicm_remove(struct platform_device *pdev)
> +static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
>  {
> -	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
> +	struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>  	struct omap_dss_device *dssdev = &ddata->dssdev;
>  
> -	dev_dbg(&pdev->dev, "remove\n");
> +	dev_dbg(&dsi->dev, "remove\n");
>  
>  	omapdss_device_unregister(dssdev);
>  
> @@ -1389,7 +1389,7 @@ static int __exit dsicm_remove(struct platform_device *pdev)
>  		dsicm_disable(dssdev);
>  	omapdss_device_disconnect(ddata->src, dssdev);
>  
> -	sysfs_remove_group(&pdev->dev.kobj, &dsicm_attr_group);
> +	sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>  
>  	if (ddata->extbldev)
>  		put_device(&ddata->extbldev->dev);
> @@ -1410,7 +1410,7 @@ static const struct of_device_id dsicm_of_match[] = {
>  
>  MODULE_DEVICE_TABLE(of, dsicm_of_match);
>  
> -static struct platform_driver dsicm_driver = {
> +static struct mipi_dsi_driver dsicm_driver = {
>  	.probe = dsicm_probe,
>  	.remove = __exit_p(dsicm_remove),
>  	.driver = {
> @@ -1419,8 +1419,7 @@ static struct platform_driver dsicm_driver = {
>  		.suppress_bind_attrs = true,
>  	},
>  };
> -
> -module_platform_driver(dsicm_driver);
> +module_mipi_dsi_driver(dsicm_driver);
>  
>  MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
>  MODULE_DESCRIPTION("Generic DSI Command Mode Panel Driver");
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 6fa7833e32ad..d1187a8af37f 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -334,6 +334,8 @@ struct dsi_data {
>  	struct regmap *syscon;
>  	struct dss_device *dss;
>  
> +	struct mipi_dsi_host host;
> +
>  	struct dispc_clock_info user_dispc_cinfo;
>  	struct dss_pll_clock_info user_dsi_cinfo;
>  
> @@ -432,6 +434,11 @@ static inline struct dsi_data *to_dsi_data(struct omap_dss_device *dssdev)
>  	return dev_get_drvdata(dssdev->dev);
>  }
>  
> +static inline struct dsi_data *host_to_omap(struct mipi_dsi_host *host)
> +{
> +	return container_of(host, struct dsi_data, host);
> +}
> +
>  static inline void dsi_write_reg(struct dsi_data *dsi,
>  				 const struct dsi_reg idx, u32 val)
>  {
> @@ -4711,9 +4718,12 @@ static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
>  	}
>  }
>  
> -static ssize_t omap_dsi_transfer(struct omap_dss_device *dssdev,
> -				 const struct mipi_dsi_msg *msg)
> +static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
> +				      const struct mipi_dsi_msg *msg)
>  {
> +	struct dsi_data *dsi = host_to_omap(host);
> +	struct omap_dss_device *dssdev = &dsi->output;
> +
>  	switch (msg->type) {
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
>  	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
> @@ -4787,11 +4797,30 @@ static const struct omap_dss_device_ops dsi_ops = {
>  
>  		.request_vc = dsi_request_vc,
>  		.release_vc = dsi_release_vc,
> -
> -		.transfer = omap_dsi_transfer,
>  	},
>  };
>  
> +static int omap_dsi_host_attach(struct mipi_dsi_host *host,
> +			 struct mipi_dsi_device *dsi)
> +{
> +	/* TODO: convert driver from custom binding method to this one */
> +	return 0;
> +}
> +
> +static int omap_dsi_host_detach(struct mipi_dsi_host *host,
> +			 struct mipi_dsi_device *dsi)
> +{
> +	/* TODO: convert driver from custom binding method to this one */
> +	return 0;
> +}
> +
> +static const struct mipi_dsi_host_ops omap_dsi_host_ops = {
> +	.attach = omap_dsi_host_attach,
> +	.detach = omap_dsi_host_detach,
> +	.transfer = omap_dsi_host_transfer,
> +};
> +
> +

A single blank line is enough.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  /* -----------------------------------------------------------------------------
>   * PLL
>   */
> @@ -5260,15 +5289,18 @@ static int dsi_probe(struct platform_device *pdev)
>  		dsi->num_lanes_supported = 3;
>  	}
>  
> -	r = of_platform_populate(dev->of_node, NULL, NULL, dev);
> -	if (r) {
> -		DSSERR("Failed to populate DSI child devices: %d\n", r);
> +	dsi->host.ops = &omap_dsi_host_ops;
> +	dsi->host.dev = &pdev->dev;
> +
> +	r = mipi_dsi_host_register(&dsi->host);
> +	if (r < 0) {
> +		dev_err(&pdev->dev, "failed to register DSI host: %d\n", r);
>  		goto err_pm_disable;
>  	}
>  
>  	r = dsi_init_output(dsi);
>  	if (r)
> -		goto err_of_depopulate;
> +		goto err_dsi_host_unregister;
>  
>  	r = dsi_probe_of(dsi);
>  	if (r) {
> @@ -5284,8 +5316,8 @@ static int dsi_probe(struct platform_device *pdev)
>  
>  err_uninit_output:
>  	dsi_uninit_output(dsi);
> -err_of_depopulate:
> -	of_platform_depopulate(dev);
> +err_dsi_host_unregister:
> +	mipi_dsi_host_unregister(&dsi->host);
>  err_pm_disable:
>  	pm_runtime_disable(dev);
>  	return r;
> @@ -5299,7 +5331,7 @@ static int dsi_remove(struct platform_device *pdev)
>  
>  	dsi_uninit_output(dsi);
>  
> -	of_platform_depopulate(&pdev->dev);
> +	mipi_dsi_host_unregister(&dsi->host);
>  
>  	pm_runtime_disable(&pdev->dev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 40e1ce9e256e..8cd2c800922e 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -304,10 +304,6 @@ struct omapdss_dsi_ops {
>  
>  	int (*request_vc)(struct omap_dss_device *dssdev, int channel);
>  	void (*release_vc)(struct omap_dss_device *dssdev, int channel);
> -
> -	/* data transfer */
> -	ssize_t (*transfer)(struct omap_dss_device *dssdev,
> -			    const struct mipi_dsi_msg *msg);
>  };
>  
>  struct omap_dss_device_ops {

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2020-11-09  8:38 UTC|newest]

Thread overview: 164+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 12:02 [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel Tomi Valkeinen
2020-11-05 12:02 ` [PATCH v3 01/56] drm/dsi: add MIPI_DSI_MODE_ULPS_IDLE Tomi Valkeinen
2020-11-06  4:41   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 02/56] Revert "drm/omap: dss: Remove unused omap_dss_device operations" Tomi Valkeinen
2020-11-05 21:27   ` Sam Ravnborg
2020-11-06  4:50   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 03/56] drm/omap: drop unused dsi.configure_pins Tomi Valkeinen
2020-11-06  4:50   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 04/56] drm/omap: dsi: use MIPI_DSI_FMT_* instead of OMAP_DSS_DSI_FMT_* Tomi Valkeinen
2020-11-06  4:56   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 05/56] drm/omap: constify write buffers Tomi Valkeinen
2020-11-06  4:57   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 06/56] drm/omap: dsi: add generic transfer function Tomi Valkeinen
2020-11-06  5:05   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 07/56] drm/omap: panel-dsi-cm: convert to transfer API Tomi Valkeinen
2020-11-06  5:08   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 08/56] drm/omap: dsi: unexport specific data transfer functions Tomi Valkeinen
2020-11-09  8:10   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 09/56] drm/omap: dsi: drop virtual channel logic Tomi Valkeinen
2020-11-09  8:14   ` Laurent Pinchart
2020-11-09  8:20     ` Tomi Valkeinen
2020-11-09  8:18   ` Tomi Valkeinen
2020-11-05 12:02 ` [PATCH v3 10/56] drm/omap: dsi: simplify write function Tomi Valkeinen
2020-11-09  8:21   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 11/56] drm/omap: dsi: simplify read functions Tomi Valkeinen
2020-11-09  8:28   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 12/56] drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg Tomi Valkeinen
2020-11-09  8:33   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 13/56] drm/omap: dsi: introduce mipi_dsi_host Tomi Valkeinen
2020-11-09  8:38   ` Laurent Pinchart [this message]
2020-11-05 12:02 ` [PATCH v3 14/56] drm/omap: panel-dsi-cm: use DSI helpers Tomi Valkeinen
2020-11-09  8:40   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 15/56] drm/omap: dsi: request VC via mipi_dsi_attach Tomi Valkeinen
2020-11-09  8:42   ` Laurent Pinchart
2020-11-09 11:16     ` Tomi Valkeinen
2020-11-05 12:02 ` [PATCH v3 16/56] drm/omap: panel-dsi-cm: drop hardcoded VC Tomi Valkeinen
2020-11-09  8:43   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 17/56] drm/omap: panel-dsi-cm: use common MIPI DCS 1.3 defines Tomi Valkeinen
2020-11-09  8:44   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 18/56] drm/omap: dsi: drop unused memory_read() Tomi Valkeinen
2020-11-09  8:45   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 19/56] drm/omap: dsi: drop unused get_te() Tomi Valkeinen
2020-11-09  8:45   ` Laurent Pinchart
2020-11-09  9:49     ` Tomi Valkeinen
2020-11-05 12:02 ` [PATCH v3 20/56] drm/omap: dsi: drop unused enable_te() Tomi Valkeinen
2020-11-09  8:46   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 21/56] drm/omap: dsi: drop useless sync() Tomi Valkeinen
2020-11-09  8:46   ` Laurent Pinchart
2020-11-05 12:02 ` [PATCH v3 22/56] drm/omap: dsi: use pixel-format and mode from attach Tomi Valkeinen
2020-11-09  8:49   ` Laurent Pinchart
2020-11-09  9:45     ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 23/56] drm/omap: panel-dsi-cm: use bulk regulator API Tomi Valkeinen
2020-11-09  8:51   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 24/56] drm/omap: dsi: lp/hs switching support for transfer() Tomi Valkeinen
2020-11-09  8:53   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 25/56] drm/omap: dsi: move TE GPIO handling into core Tomi Valkeinen
2020-11-09  9:19   ` Laurent Pinchart
2020-11-11 13:26     ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 26/56] drm/omap: dsi: drop custom enable_te() API Tomi Valkeinen
2020-11-09  9:32   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver Tomi Valkeinen
2020-11-09  9:52   ` Laurent Pinchart
2020-11-09 10:08     ` Tomi Valkeinen
2020-11-09 13:27       ` Sebastian Reichel
2020-11-09 14:25         ` Tomi Valkeinen
2020-11-11 13:35         ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 28/56] drm/omap: dsi: untangle ulps ops from enable/disable Tomi Valkeinen
2020-11-09  9:57   ` Laurent Pinchart
2020-11-11 14:05     ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 29/56] drm/omap: dsi: do ULPS in host driver Tomi Valkeinen
2020-11-09 10:03   ` Laurent Pinchart
2020-11-11 15:29     ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host Tomi Valkeinen
2020-11-09 10:10   ` Laurent Pinchart
2020-11-11 15:34     ` Tomi Valkeinen
2020-11-11 15:58       ` Laurent Pinchart
2020-11-12  8:08         ` Tomi Valkeinen
2020-11-16  9:22           ` Laurent Pinchart
2020-11-17 10:04             ` Sebastian Reichel
2020-11-05 12:03 ` [PATCH v3 31/56] drm/omap: dsi: Reverse direction of the DSS device enable/disable operations Tomi Valkeinen
2020-11-09 10:17   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 32/56] drm/omap: dsi: drop custom panel capability support Tomi Valkeinen
2020-11-09 10:20   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 33/56] drm/omap: dsi: convert to drm_panel Tomi Valkeinen
2020-11-09 10:39   ` Laurent Pinchart
2020-11-11 15:54     ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 34/56] drm/omap: drop omapdss-boot-init Tomi Valkeinen
2020-11-09 10:40   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 35/56] drm/omap: dsi: implement check timings Tomi Valkeinen
2020-11-09 10:47   ` Laurent Pinchart
2020-11-11 12:36     ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 36/56] drm/omap: panel-dsi-cm: use DEVICE_ATTR_RO Tomi Valkeinen
2020-11-09 10:48   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 37/56] drm/omap: panel-dsi-cm: support unbinding Tomi Valkeinen
2020-11-09 10:49   ` Laurent Pinchart
2020-11-11 12:03     ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 38/56] drm/omap: panel-dsi-cm: fix remove() Tomi Valkeinen
2020-11-09 10:50   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 39/56] drm/omap: remove global dss_device variable Tomi Valkeinen
2020-11-09 10:51   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 40/56] drm/panel: Move OMAP's DSI command mode panel driver Tomi Valkeinen
2020-11-05 15:16   ` Sam Ravnborg
2020-11-05 15:27   ` Tomi Valkeinen
2020-11-09 10:53   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 41/56] drm/omap: dsi: Register a drm_bridge Tomi Valkeinen
2020-11-09 10:54   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 42/56] drm/omap: remove legacy DSS device operations Tomi Valkeinen
2020-11-09 11:01   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 43/56] drm/omap: remove unused omap_connector Tomi Valkeinen
2020-11-09 11:02   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 44/56] drm/omap: simplify omap_display_id Tomi Valkeinen
2020-11-09 11:03   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 45/56] drm/omap: drop unused DSS next pointer Tomi Valkeinen
2020-11-09 11:04   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 46/56] drm/omap: drop empty omap_encoder helper functions Tomi Valkeinen
2020-11-09 11:05   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 47/56] drm/omap: drop DSS ops_flags Tomi Valkeinen
2020-11-09 11:05   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 48/56] drm/omap: drop dssdev display field Tomi Valkeinen
2020-11-09 11:06   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 49/56] drm/omap: simplify DSI manual update code Tomi Valkeinen
2020-11-09 11:07   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 50/56] drm/omap: dsi: simplify pin config Tomi Valkeinen
2020-11-09 11:09   ` Laurent Pinchart
2020-11-11 12:24     ` Tomi Valkeinen
2020-11-05 12:03 ` [PATCH v3 51/56] ARM: omap2plus_defconfig: Update for moved DSI command mode panel Tomi Valkeinen
2020-11-09 11:10   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 52/56] drm/omap: squash omapdrm sub-modules into one Tomi Valkeinen
2020-11-09 11:15   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 53/56] drm/omap: remove unused display.c Tomi Valkeinen
2020-11-09 11:16   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 54/56] drm/omap: drop unused owner field Tomi Valkeinen
2020-11-09 11:16   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 55/56] drm/omap: remove dispc_ops Tomi Valkeinen
2020-11-09 11:17   ` Laurent Pinchart
2020-11-05 12:03 ` [PATCH v3 56/56] drm/omap: remove dss_mgr_ops Tomi Valkeinen
2020-11-09 11:18   ` Laurent Pinchart
2020-11-05 17:15 ` [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel H. Nikolaus Schaller
2020-11-05 17:36   ` Tomi Valkeinen
2020-11-05 18:14     ` H. Nikolaus Schaller
2020-11-05 18:28       ` Tomi Valkeinen
2020-11-05 18:56         ` H. Nikolaus Schaller
2020-11-06 14:37           ` Tomi Valkeinen
2020-11-06 15:04             ` Tomi Valkeinen
2020-11-07 12:19               ` H. Nikolaus Schaller
2020-11-09  8:04                 ` Tomi Valkeinen
2020-11-09  9:30                   ` H. Nikolaus Schaller
2020-11-09 10:22                     ` Tomi Valkeinen
2020-11-09 10:31                       ` H. Nikolaus Schaller
2020-11-09 10:34                         ` Tomi Valkeinen
2020-11-09 11:09                           ` H. Nikolaus Schaller
2020-11-09 11:33                             ` Tomi Valkeinen
2020-11-10 13:49                               ` H. Nikolaus Schaller
2020-11-10 15:25                                 ` Tomi Valkeinen
2020-11-10 16:49                                 ` H. Nikolaus Schaller
2020-11-10 16:52                                   ` Tomi Valkeinen
2020-11-10 21:04                                     ` H. Nikolaus Schaller
2020-11-11  6:40                                       ` Tomi Valkeinen
2020-11-11  7:48                                         ` H. Nikolaus Schaller
2020-11-11 10:11                                           ` Tomi Valkeinen
2020-11-11 19:27                                             ` H. Nikolaus Schaller
2020-11-05 21:31 ` Sam Ravnborg
2020-11-08 16:33 ` Nikhil Devshatwar
     [not found] ` <BAFBC885-9BBE-46D1-B4C4-79910705864A@goldelico.com>
     [not found]   ` <74abbdc4-cc1e-9caf-d4ee-0a5cdb557643@ti.com>
     [not found]     ` <b0677958-02ad-1d2f-d755-! 25a9d384eddc@ti.com>
     [not found]       ` <1A09B4DA-F726-4F37-8CF4-BC192C659950@goldelico.com>
     [not found]         ` <9a4e373e-9092-6d82-937a-bc663d2376b4@ti.com>
     [not found]           ` <09ebc3e3-72c7-41fb-fb21-bf28c! f883d3f@ti.com>
     [not found]             ` <E738362A-8ECE-4ED5-8057-2ABB6F5C3056@goldelico.com>
     [not found]               ` <9a21b475-eff0-9882-8d65-d1f! dd2139dc4@ti.com>
     [not found]                 ` <A1DEB54D-FEC0-493A-858C-E5C0DB24B35E@goldelico.com>
     [not found]                   ` <1150ba22-1ae2-39f3-0924-7! a1f1b468597@ti.com>
     [not found]                     ` <2999ED77-B9F7-4197-81B8-F1AFF329A1E9@goldelico.com>
     [not found]                       ` <cbc147d2-af41-2bed-5670-530d45cfb24e@ti.com>
     [not found]                         ` <106bfbee-c472-c04c-0f7b-db108a090a63@ti.com>
     [not found]                           ` <420b81bd-fc95-e294-fcbe-f34db1ef! f9e7@ti.c om>
     [not found]                             ` <B2FBCAE4-FAD9-4C0D-9C75-63A701215886@goldelico.com>
     [not found]                               ` <826B2E97-8B77-412A-8093-753BF7A65EE1@goldelico.com>
     [not found]                                 ` <acad2006-53a2-6587-b8e6-787e358! 8932a@ti.com>
     [not found]                                   ` <AF87C7B4-DCD2-4207-A300-567DB65B08ED@goldelico.com>
     [not found]                                     ` <27cfb13a-62e3-0a53-153f-92641c437cee@ti. com>
     [not found]                                       ` <27cfb13a-62e3-0a53-153f-92641c437cee@ti.com>
2020-11-16  9:16                                         ` H. Nikolaus Schaller

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=20201109083810.GJ6029@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hns@goldelico.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=nikhil.nd@ti.com \
    --cc=nsekhar@ti.com \
    --cc=sebastian.reichel@collabora.com \
    --cc=sre@kernel.org \
    --cc=tomi.valkeinen@ti.com \
    --cc=tony@atomide.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