Re: [RFC PATCH 4/6] drm/bridge/nwl-dsi: Drop mux handling

From: Rob Herring
Date: Thu May 28 2020 - 15:57:26 EST


On Fri, May 15, 2020 at 03:12:13PM +0200, Guido Günther wrote:
> This will be handled via the mux-input-bridge.

You can't do this. What happens booting a kernel with this change and an
un-modified dtb? You just broke it.

>
> Signed-off-by: Guido Günther <agx@xxxxxxxxxxx>
> ---
> drivers/gpu/drm/bridge/Kconfig | 1 -
> drivers/gpu/drm/bridge/nwl-dsi.c | 61 --------------------------------
> 2 files changed, 62 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 3886c0f41bdd..11444f841e35 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -78,7 +78,6 @@ config DRM_NWL_MIPI_DSI
> select DRM_PANEL_BRIDGE
> select GENERIC_PHY_MIPI_DPHY
> select MFD_SYSCON
> - select MULTIPLEXER
> select REGMAP_MMIO
> help
> This enables the Northwest Logic MIPI DSI Host controller as
> diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
> index b14d725bf609..8839f333f39c 100644
> --- a/drivers/gpu/drm/bridge/nwl-dsi.c
> +++ b/drivers/gpu/drm/bridge/nwl-dsi.c
> @@ -12,7 +12,6 @@
> #include <linux/math64.h>
> #include <linux/mfd/syscon.h>
> #include <linux/module.h>
> -#include <linux/mux/consumer.h>
> #include <linux/of.h>
> #include <linux/of_platform.h>
> #include <linux/phy/phy.h>
> @@ -44,9 +43,6 @@ enum transfer_direction {
> DSI_PACKET_RECEIVE,
> };
>
> -#define NWL_DSI_ENDPOINT_LCDIF 0
> -#define NWL_DSI_ENDPOINT_DCSS 1
> -
> struct nwl_dsi_plat_clk_config {
> const char *id;
> struct clk *clk;
> @@ -94,7 +90,6 @@ struct nwl_dsi {
> struct reset_control *rst_esc;
> struct reset_control *rst_dpi;
> struct reset_control *rst_pclk;
> - struct mux_control *mux;
>
> /* DSI clocks */
> struct clk *phy_ref_clk;
> @@ -1018,14 +1013,6 @@ static int nwl_dsi_parse_dt(struct nwl_dsi *dsi)
> }
> dsi->tx_esc_clk = clk;
>
> - dsi->mux = devm_mux_control_get(dsi->dev, NULL);
> - if (IS_ERR(dsi->mux)) {
> - ret = PTR_ERR(dsi->mux);
> - if (ret != -EPROBE_DEFER)
> - DRM_DEV_ERROR(dsi->dev, "Failed to get mux: %d\n", ret);
> - return ret;
> - }
> -
> base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(base))
> return PTR_ERR(base);
> @@ -1073,47 +1060,6 @@ static int nwl_dsi_parse_dt(struct nwl_dsi *dsi)
> return 0;
> }
>
> -static int nwl_dsi_select_input(struct nwl_dsi *dsi)
> -{
> - struct device_node *remote;
> - u32 use_dcss = 1;
> - int ret;
> -
> - remote = of_graph_get_remote_node(dsi->dev->of_node, 0,
> - NWL_DSI_ENDPOINT_LCDIF);
> - if (remote) {
> - use_dcss = 0;
> - } else {
> - remote = of_graph_get_remote_node(dsi->dev->of_node, 0,
> - NWL_DSI_ENDPOINT_DCSS);
> - if (!remote) {
> - DRM_DEV_ERROR(dsi->dev,
> - "No valid input endpoint found\n");
> - return -EINVAL;
> - }
> - }
> -
> - DRM_DEV_INFO(dsi->dev, "Using %s as input source\n",
> - (use_dcss) ? "DCSS" : "LCDIF");
> - ret = mux_control_try_select(dsi->mux, use_dcss);
> - if (ret < 0)
> - DRM_DEV_ERROR(dsi->dev, "Failed to select input: %d\n", ret);
> -
> - of_node_put(remote);
> - return ret;
> -}

You could however make these functions generic for any bridge to use.
Define a function that checks for mux-control property and if found sets
up the mux (IIRC, there's already a concept of a default state). That
should be callable from somewhere generic too.

Rob