From patchwork Sun Jul 7 18:07:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 11034181 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 89EE513BD for ; Sun, 7 Jul 2019 18:11:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 785CB28355 for ; Sun, 7 Jul 2019 18:11:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B4062837E; Sun, 7 Jul 2019 18:11:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B28A828355 for ; Sun, 7 Jul 2019 18:11:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 10CC289904; Sun, 7 Jul 2019 18:11:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by gabe.freedesktop.org (Postfix) with ESMTPS id E7C9089904 for ; Sun, 7 Jul 2019 18:11:09 +0000 (UTC) Received: from pendragon.nordic-sky.finnair.com (unknown [38.98.37.142]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 30E79CC; Sun, 7 Jul 2019 20:10:49 +0200 (CEST) From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH 03/60] drm/bridge: dumb-vga-dac: Rename internal symbols to simple-bridge Date: Sun, 7 Jul 2019 21:07:55 +0300 Message-Id: <20190707180852.5512-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190707180852.5512-1-laurent.pinchart@ideasonboard.com> References: <20190707180852.5512-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1562523068; bh=paIorR406+8qldTQAZ1yzRIgMQsVgh6nLpEHiNxq3r0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mWEFfkVIS4g9haYkMM9RRkedRyNtul2QaPdK/PMlJd+YR4I1GkjQ76DXCDd9tIvzn YG2AW5ImOSLYNIEAnSJJUcF41PxNOhLVLEP8WMCf2PlY6wFSbQhhoyoxiFJag/y27z wVbtPNfJouQhaVuNUb09WQNbpxD3uU/baSYLjpEE= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maxime Ripard , Sebastian Reichel , Tomi Valkeinen , Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The dumb-vga-dac driver is a simple DRM bridge driver for simple VGA DACs that don't require configuration. Other non-VGA bridges fall in a similar category, and would benefit from a common driver. Prepare for this by renaming the internal symbols from dumb-vga-dac to simple-bridge. Signed-off-by: Laurent Pinchart Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/dumb-vga-dac.c | 149 +++++++++++++------------- 1 file changed, 75 insertions(+), 74 deletions(-) diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c index d32885b906ae..d46e461ae039 100644 --- a/drivers/gpu/drm/bridge/dumb-vga-dac.c +++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c @@ -16,7 +16,7 @@ #include #include -struct dumb_vga { +struct simple_bridge { struct drm_bridge bridge; struct drm_connector connector; @@ -24,28 +24,28 @@ struct dumb_vga { struct regulator *vdd; }; -static inline struct dumb_vga * -drm_bridge_to_dumb_vga(struct drm_bridge *bridge) +static inline struct simple_bridge * +drm_bridge_to_simple_bridge(struct drm_bridge *bridge) { - return container_of(bridge, struct dumb_vga, bridge); + return container_of(bridge, struct simple_bridge, bridge); } -static inline struct dumb_vga * -drm_connector_to_dumb_vga(struct drm_connector *connector) +static inline struct simple_bridge * +drm_connector_to_simple_bridge(struct drm_connector *connector) { - return container_of(connector, struct dumb_vga, connector); + return container_of(connector, struct simple_bridge, connector); } -static int dumb_vga_get_modes(struct drm_connector *connector) +static int simple_bridge_get_modes(struct drm_connector *connector) { - struct dumb_vga *vga = drm_connector_to_dumb_vga(connector); + struct simple_bridge *sbridge = drm_connector_to_simple_bridge(connector); struct edid *edid; int ret; - if (IS_ERR(vga->ddc)) + if (IS_ERR(sbridge->ddc)) goto fallback; - edid = drm_get_edid(connector, vga->ddc); + edid = drm_get_edid(connector, sbridge->ddc); if (!edid) { DRM_INFO("EDID readout failed, falling back to standard modes\n"); goto fallback; @@ -69,14 +69,14 @@ static int dumb_vga_get_modes(struct drm_connector *connector) return ret; } -static const struct drm_connector_helper_funcs dumb_vga_con_helper_funcs = { - .get_modes = dumb_vga_get_modes, +static const struct drm_connector_helper_funcs simple_bridge_con_helper_funcs = { + .get_modes = simple_bridge_get_modes, }; static enum drm_connector_status -dumb_vga_connector_detect(struct drm_connector *connector, bool force) +simple_bridge_connector_detect(struct drm_connector *connector, bool force) { - struct dumb_vga *vga = drm_connector_to_dumb_vga(connector); + struct simple_bridge *sbridge = drm_connector_to_simple_bridge(connector); /* * Even if we have an I2C bus, we can't assume that the cable @@ -84,14 +84,14 @@ dumb_vga_connector_detect(struct drm_connector *connector, bool force) * wire the DDC pins, or the I2C bus might not be working at * all. */ - if (!IS_ERR(vga->ddc) && drm_probe_ddc(vga->ddc)) + if (!IS_ERR(sbridge->ddc) && drm_probe_ddc(sbridge->ddc)) return connector_status_connected; return connector_status_unknown; } -static const struct drm_connector_funcs dumb_vga_con_funcs = { - .detect = dumb_vga_connector_detect, +static const struct drm_connector_funcs simple_bridge_con_funcs = { + .detect = simple_bridge_connector_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = drm_connector_cleanup, .reset = drm_atomic_helper_connector_reset, @@ -99,9 +99,9 @@ static const struct drm_connector_funcs dumb_vga_con_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static int dumb_vga_attach(struct drm_bridge *bridge) +static int simple_bridge_attach(struct drm_bridge *bridge) { - struct dumb_vga *vga = drm_bridge_to_dumb_vga(bridge); + struct simple_bridge *sbridge = drm_bridge_to_simple_bridge(bridge); int ret; if (!bridge->encoder) { @@ -109,48 +109,49 @@ static int dumb_vga_attach(struct drm_bridge *bridge) return -ENODEV; } - drm_connector_helper_add(&vga->connector, - &dumb_vga_con_helper_funcs); - ret = drm_connector_init(bridge->dev, &vga->connector, - &dumb_vga_con_funcs, DRM_MODE_CONNECTOR_VGA); + drm_connector_helper_add(&sbridge->connector, + &simple_bridge_con_helper_funcs); + ret = drm_connector_init(bridge->dev, &sbridge->connector, + &simple_bridge_con_funcs, + DRM_MODE_CONNECTOR_VGA); if (ret) { DRM_ERROR("Failed to initialize connector\n"); return ret; } - drm_connector_attach_encoder(&vga->connector, + drm_connector_attach_encoder(&sbridge->connector, bridge->encoder); return 0; } -static void dumb_vga_enable(struct drm_bridge *bridge) +static void simple_bridge_enable(struct drm_bridge *bridge) { - struct dumb_vga *vga = drm_bridge_to_dumb_vga(bridge); + struct simple_bridge *sbridge = drm_bridge_to_simple_bridge(bridge); int ret = 0; - if (vga->vdd) - ret = regulator_enable(vga->vdd); + if (sbridge->vdd) + ret = regulator_enable(sbridge->vdd); if (ret) DRM_ERROR("Failed to enable vdd regulator: %d\n", ret); } -static void dumb_vga_disable(struct drm_bridge *bridge) +static void simple_bridge_disable(struct drm_bridge *bridge) { - struct dumb_vga *vga = drm_bridge_to_dumb_vga(bridge); + struct simple_bridge *sbridge = drm_bridge_to_simple_bridge(bridge); - if (vga->vdd) - regulator_disable(vga->vdd); + if (sbridge->vdd) + regulator_disable(sbridge->vdd); } -static const struct drm_bridge_funcs dumb_vga_bridge_funcs = { - .attach = dumb_vga_attach, - .enable = dumb_vga_enable, - .disable = dumb_vga_disable, +static const struct drm_bridge_funcs simple_bridge_bridge_funcs = { + .attach = simple_bridge_attach, + .enable = simple_bridge_enable, + .disable = simple_bridge_disable, }; -static struct i2c_adapter *dumb_vga_retrieve_ddc(struct device *dev) +static struct i2c_adapter *simple_bridge_retrieve_ddc(struct device *dev) { struct device_node *phandle, *remote; struct i2c_adapter *ddc; @@ -172,52 +173,52 @@ static struct i2c_adapter *dumb_vga_retrieve_ddc(struct device *dev) return ddc; } -static int dumb_vga_probe(struct platform_device *pdev) +static int simple_bridge_probe(struct platform_device *pdev) { - struct dumb_vga *vga; + struct simple_bridge *sbridge; - vga = devm_kzalloc(&pdev->dev, sizeof(*vga), GFP_KERNEL); - if (!vga) + sbridge = devm_kzalloc(&pdev->dev, sizeof(*sbridge), GFP_KERNEL); + if (!sbridge) return -ENOMEM; - platform_set_drvdata(pdev, vga); + platform_set_drvdata(pdev, sbridge); - vga->vdd = devm_regulator_get_optional(&pdev->dev, "vdd"); - if (IS_ERR(vga->vdd)) { - int ret = PTR_ERR(vga->vdd); + sbridge->vdd = devm_regulator_get_optional(&pdev->dev, "vdd"); + if (IS_ERR(sbridge->vdd)) { + int ret = PTR_ERR(sbridge->vdd); if (ret == -EPROBE_DEFER) return -EPROBE_DEFER; - vga->vdd = NULL; + sbridge->vdd = NULL; dev_dbg(&pdev->dev, "No vdd regulator found: %d\n", ret); } - vga->ddc = dumb_vga_retrieve_ddc(&pdev->dev); - if (IS_ERR(vga->ddc)) { - if (PTR_ERR(vga->ddc) == -ENODEV) { + sbridge->ddc = simple_bridge_retrieve_ddc(&pdev->dev); + if (IS_ERR(sbridge->ddc)) { + if (PTR_ERR(sbridge->ddc) == -ENODEV) { dev_dbg(&pdev->dev, "No i2c bus specified. Disabling EDID readout\n"); } else { dev_err(&pdev->dev, "Couldn't retrieve i2c bus\n"); - return PTR_ERR(vga->ddc); + return PTR_ERR(sbridge->ddc); } } - vga->bridge.funcs = &dumb_vga_bridge_funcs; - vga->bridge.of_node = pdev->dev.of_node; - vga->bridge.timings = of_device_get_match_data(&pdev->dev); + sbridge->bridge.funcs = &simple_bridge_bridge_funcs; + sbridge->bridge.of_node = pdev->dev.of_node; + sbridge->bridge.timings = of_device_get_match_data(&pdev->dev); - drm_bridge_add(&vga->bridge); + drm_bridge_add(&sbridge->bridge); return 0; } -static int dumb_vga_remove(struct platform_device *pdev) +static int simple_bridge_remove(struct platform_device *pdev) { - struct dumb_vga *vga = platform_get_drvdata(pdev); + struct simple_bridge *sbridge = platform_get_drvdata(pdev); - drm_bridge_remove(&vga->bridge); + drm_bridge_remove(&sbridge->bridge); - if (!IS_ERR(vga->ddc)) - i2c_put_adapter(vga->ddc); + if (!IS_ERR(sbridge->ddc)) + i2c_put_adapter(sbridge->ddc); return 0; } @@ -228,7 +229,7 @@ static int dumb_vga_remove(struct platform_device *pdev) * NOTE: the ADV7123EP seems to have other timings and need a new timings * set if used. */ -static const struct drm_bridge_timings default_dac_timings = { +static const struct drm_bridge_timings default_bridge_timings = { /* Timing specifications, datasheet page 7 */ .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE, .setup_time_ps = 500, @@ -239,7 +240,7 @@ static const struct drm_bridge_timings default_dac_timings = { * Information taken from the THS8134, THS8134A, THS8134B datasheet named * "SLVS205D", dated May 1990, revised March 2000. */ -static const struct drm_bridge_timings ti_ths8134_dac_timings = { +static const struct drm_bridge_timings ti_ths8134_bridge_timings = { /* From timing diagram, datasheet page 9 */ .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE, /* From datasheet, page 12 */ @@ -252,7 +253,7 @@ static const struct drm_bridge_timings ti_ths8134_dac_timings = { * Information taken from the THS8135 datasheet named "SLAS343B", dated * May 2001, revised April 2013. */ -static const struct drm_bridge_timings ti_ths8135_dac_timings = { +static const struct drm_bridge_timings ti_ths8135_bridge_timings = { /* From timing diagram, datasheet page 14 */ .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE, /* From datasheet, page 16 */ @@ -260,37 +261,37 @@ static const struct drm_bridge_timings ti_ths8135_dac_timings = { .hold_time_ps = 500, }; -static const struct of_device_id dumb_vga_match[] = { +static const struct of_device_id simple_bridge_match[] = { { .compatible = "dumb-vga-dac", .data = NULL, }, { .compatible = "adi,adv7123", - .data = &default_dac_timings, + .data = &default_bridge_timings, }, { .compatible = "ti,ths8135", - .data = &ti_ths8135_dac_timings, + .data = &ti_ths8135_bridge_timings, }, { .compatible = "ti,ths8134", - .data = &ti_ths8134_dac_timings, + .data = &ti_ths8134_bridge_timings, }, {}, }; -MODULE_DEVICE_TABLE(of, dumb_vga_match); +MODULE_DEVICE_TABLE(of, simple_bridge_match); -static struct platform_driver dumb_vga_driver = { - .probe = dumb_vga_probe, - .remove = dumb_vga_remove, +static struct platform_driver simple_bridge_driver = { + .probe = simple_bridge_probe, + .remove = simple_bridge_remove, .driver = { .name = "dumb-vga-dac", - .of_match_table = dumb_vga_match, + .of_match_table = simple_bridge_match, }, }; -module_platform_driver(dumb_vga_driver); +module_platform_driver(simple_bridge_driver); MODULE_AUTHOR("Maxime Ripard "); -MODULE_DESCRIPTION("Dumb VGA DAC bridge driver"); +MODULE_DESCRIPTION("Simple DRM bridge driver"); MODULE_LICENSE("GPL");