[PATCH v2 06/50] drm/bridge: dumb-vga-dac: Rename internal symbols to simple-bridge
Boris Brezillon
boris.brezillon at collabora.com
Thu Aug 22 15:39:05 UTC 2019
On Tue, 20 Aug 2019 04:16:37 +0300
Laurent Pinchart <laurent.pinchart at ideasonboard.com> wrote:
> 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 <laurent.pinchart at ideasonboard.com>
> Reviewed-by: Andrzej Hajda <a.hajda at samsung.com>
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
> ---
> drivers/gpu/drm/bridge/dumb-vga-dac.c | 154 +++++++++++++-------------
> 1 file changed, 77 insertions(+), 77 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c
> index 74ebca58eb1f..03ceb0cd8b9e 100644
> --- a/drivers/gpu/drm/bridge/dumb-vga-dac.c
> +++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c
> @@ -16,7 +16,7 @@
> #include <drm/drm_print.h>
> #include <drm/drm_probe_helper.h>
>
> -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 (!vga->ddc)
> + if (!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 (vga->ddc && drm_probe_ddc(vga->ddc))
> + if (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,10 +99,10 @@ 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,
> - enum drm_bridge_attach_flags flags)
> +static int simple_bridge_attach(struct drm_bridge *bridge,
> + enum drm_bridge_attach_flags flags)
> {
> - struct dumb_vga *vga = drm_bridge_to_dumb_vga(bridge);
> + struct simple_bridge *sbridge = drm_bridge_to_simple_bridge(bridge);
> int ret;
>
> if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
> @@ -113,50 +113,50 @@ 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_with_ddc(bridge->dev, &vga->connector,
> - &dumb_vga_con_funcs,
> + drm_connector_helper_add(&sbridge->connector,
> + &simple_bridge_con_helper_funcs);
> + ret = drm_connector_init_with_ddc(bridge->dev, &sbridge->connector,
> + &simple_bridge_con_funcs,
> DRM_MODE_CONNECTOR_VGA,
> - vga->ddc);
> + sbridge->ddc);
> 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;
> @@ -178,53 +178,53 @@ 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");
> - vga->ddc = NULL;
> + sbridge->ddc = NULL;
> } 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 (vga->ddc)
> - i2c_put_adapter(vga->ddc);
> + if (sbridge->ddc)
> + i2c_put_adapter(sbridge->ddc);
>
> return 0;
> }
> @@ -235,7 +235,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,
> @@ -246,7 +246,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 */
> @@ -259,7 +259,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 */
> @@ -267,37 +267,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 <maxime.ripard at free-electrons.com>");
> -MODULE_DESCRIPTION("Dumb VGA DAC bridge driver");
> +MODULE_DESCRIPTION("Simple DRM bridge driver");
> MODULE_LICENSE("GPL");
More information about the dri-devel
mailing list