drm/omap: Switch the HDMI and VENC outputs to drm_bridge
The TPD12S015, OPA362 and analog and HDMI connectors are now supported by DRM bridge drivers, and the omapdrm HDMI and VENC outputs can be handled through the drm_bridge API. Switch the outputs to drm_bridge by making the next bridge mandatory and removing the related omapdrm-specific display drivers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200226112514.12455-40-laurent.pinchart@ideasonboard.com
This commit is contained in:
parent
f40f4e45df
commit
e7e67d9a2f
|
@ -350,14 +350,13 @@ CONFIG_DRM_OMAP=m
|
|||
CONFIG_OMAP5_DSS_HDMI=y
|
||||
CONFIG_OMAP2_DSS_SDI=y
|
||||
CONFIG_OMAP2_DSS_DSI=y
|
||||
CONFIG_DRM_OMAP_ENCODER_OPA362=m
|
||||
CONFIG_DRM_OMAP_ENCODER_TPD12S015=m
|
||||
CONFIG_DRM_OMAP_CONNECTOR_HDMI=m
|
||||
CONFIG_DRM_OMAP_CONNECTOR_ANALOG_TV=m
|
||||
CONFIG_DRM_OMAP_PANEL_DSI_CM=m
|
||||
CONFIG_DRM_TILCDC=m
|
||||
CONFIG_DRM_PANEL_SIMPLE=m
|
||||
CONFIG_DRM_DISPLAY_CONNECTOR=m
|
||||
CONFIG_DRM_SIMPLE_BRIDGE=m
|
||||
CONFIG_DRM_TI_TFP410=m
|
||||
CONFIG_DRM_TI_TPD12S015=m
|
||||
CONFIG_DRM_PANEL_LG_LB035Q02=m
|
||||
CONFIG_DRM_PANEL_NEC_NL8048HL11=m
|
||||
CONFIG_DRM_PANEL_SHARP_LS037V7DW01=m
|
||||
|
|
|
@ -1,28 +1,6 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
menu "OMAPDRM External Display Device Drivers"
|
||||
|
||||
config DRM_OMAP_ENCODER_OPA362
|
||||
tristate "OPA362 external analog amplifier"
|
||||
help
|
||||
Driver for OPA362 external analog TV amplifier controlled
|
||||
through a GPIO.
|
||||
|
||||
config DRM_OMAP_ENCODER_TPD12S015
|
||||
tristate "TPD12S015 HDMI ESD protection and level shifter"
|
||||
help
|
||||
Driver for TPD12S015, which offers HDMI ESD protection and level
|
||||
shifting.
|
||||
|
||||
config DRM_OMAP_CONNECTOR_HDMI
|
||||
tristate "HDMI Connector"
|
||||
help
|
||||
Driver for a generic HDMI connector.
|
||||
|
||||
config DRM_OMAP_CONNECTOR_ANALOG_TV
|
||||
tristate "Analog TV Connector"
|
||||
help
|
||||
Driver for a generic analog TV connector.
|
||||
|
||||
config DRM_OMAP_PANEL_DSI_CM
|
||||
tristate "Generic DSI Command Mode Panel"
|
||||
depends on BACKLIGHT_CLASS_DEVICE
|
||||
|
|
|
@ -1,6 +1,2 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
obj-$(CONFIG_DRM_OMAP_ENCODER_OPA362) += encoder-opa362.o
|
||||
obj-$(CONFIG_DRM_OMAP_ENCODER_TPD12S015) += encoder-tpd12s015.o
|
||||
obj-$(CONFIG_DRM_OMAP_CONNECTOR_HDMI) += connector-hdmi.o
|
||||
obj-$(CONFIG_DRM_OMAP_CONNECTOR_ANALOG_TV) += connector-analog-tv.o
|
||||
obj-$(CONFIG_DRM_OMAP_PANEL_DSI_CM) += panel-dsi-cm.o
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Analog TV Connector driver
|
||||
*
|
||||
* Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
|
||||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/of.h>
|
||||
|
||||
#include "../dss/omapdss.h"
|
||||
|
||||
struct panel_drv_data {
|
||||
struct omap_dss_device dssdev;
|
||||
|
||||
struct device *dev;
|
||||
};
|
||||
|
||||
#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
|
||||
|
||||
static int tvc_connect(struct omap_dss_device *src,
|
||||
struct omap_dss_device *dst)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void tvc_disconnect(struct omap_dss_device *src,
|
||||
struct omap_dss_device *dst)
|
||||
{
|
||||
}
|
||||
|
||||
static const struct omap_dss_device_ops tvc_ops = {
|
||||
.connect = tvc_connect,
|
||||
.disconnect = tvc_disconnect,
|
||||
};
|
||||
|
||||
static int tvc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct panel_drv_data *ddata;
|
||||
struct omap_dss_device *dssdev;
|
||||
|
||||
ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
|
||||
if (!ddata)
|
||||
return -ENOMEM;
|
||||
|
||||
platform_set_drvdata(pdev, ddata);
|
||||
ddata->dev = &pdev->dev;
|
||||
|
||||
dssdev = &ddata->dssdev;
|
||||
dssdev->ops = &tvc_ops;
|
||||
dssdev->dev = &pdev->dev;
|
||||
dssdev->type = OMAP_DISPLAY_TYPE_VENC;
|
||||
dssdev->display = true;
|
||||
dssdev->owner = THIS_MODULE;
|
||||
dssdev->of_port = 0;
|
||||
|
||||
omapdss_display_init(dssdev);
|
||||
omapdss_device_register(dssdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __exit tvc_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
|
||||
|
||||
omapdss_device_unregister(&ddata->dssdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id tvc_of_match[] = {
|
||||
{ .compatible = "omapdss,svideo-connector", },
|
||||
{ .compatible = "omapdss,composite-video-connector", },
|
||||
{},
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(of, tvc_of_match);
|
||||
|
||||
static struct platform_driver tvc_connector_driver = {
|
||||
.probe = tvc_probe,
|
||||
.remove = __exit_p(tvc_remove),
|
||||
.driver = {
|
||||
.name = "connector-analog-tv",
|
||||
.of_match_table = tvc_of_match,
|
||||
.suppress_bind_attrs = true,
|
||||
},
|
||||
};
|
||||
|
||||
module_platform_driver(tvc_connector_driver);
|
||||
|
||||
MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
|
||||
MODULE_DESCRIPTION("Analog TV Connector driver");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -1,183 +0,0 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* HDMI Connector driver
|
||||
*
|
||||
* Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
|
||||
*/
|
||||
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "../dss/omapdss.h"
|
||||
|
||||
struct panel_drv_data {
|
||||
struct omap_dss_device dssdev;
|
||||
void (*hpd_cb)(void *cb_data, enum drm_connector_status status);
|
||||
void *hpd_cb_data;
|
||||
struct mutex hpd_lock;
|
||||
|
||||
struct device *dev;
|
||||
|
||||
struct gpio_desc *hpd_gpio;
|
||||
};
|
||||
|
||||
#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
|
||||
|
||||
static int hdmic_connect(struct omap_dss_device *src,
|
||||
struct omap_dss_device *dst)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void hdmic_disconnect(struct omap_dss_device *src,
|
||||
struct omap_dss_device *dst)
|
||||
{
|
||||
}
|
||||
|
||||
static bool hdmic_detect(struct omap_dss_device *dssdev)
|
||||
{
|
||||
struct panel_drv_data *ddata = to_panel_data(dssdev);
|
||||
|
||||
return gpiod_get_value_cansleep(ddata->hpd_gpio);
|
||||
}
|
||||
|
||||
static void hdmic_register_hpd_cb(struct omap_dss_device *dssdev,
|
||||
void (*cb)(void *cb_data,
|
||||
enum drm_connector_status status),
|
||||
void *cb_data)
|
||||
{
|
||||
struct panel_drv_data *ddata = to_panel_data(dssdev);
|
||||
|
||||
mutex_lock(&ddata->hpd_lock);
|
||||
ddata->hpd_cb = cb;
|
||||
ddata->hpd_cb_data = cb_data;
|
||||
mutex_unlock(&ddata->hpd_lock);
|
||||
}
|
||||
|
||||
static void hdmic_unregister_hpd_cb(struct omap_dss_device *dssdev)
|
||||
{
|
||||
struct panel_drv_data *ddata = to_panel_data(dssdev);
|
||||
|
||||
mutex_lock(&ddata->hpd_lock);
|
||||
ddata->hpd_cb = NULL;
|
||||
ddata->hpd_cb_data = NULL;
|
||||
mutex_unlock(&ddata->hpd_lock);
|
||||
}
|
||||
|
||||
static const struct omap_dss_device_ops hdmic_ops = {
|
||||
.connect = hdmic_connect,
|
||||
.disconnect = hdmic_disconnect,
|
||||
|
||||
.detect = hdmic_detect,
|
||||
.register_hpd_cb = hdmic_register_hpd_cb,
|
||||
.unregister_hpd_cb = hdmic_unregister_hpd_cb,
|
||||
};
|
||||
|
||||
static irqreturn_t hdmic_hpd_isr(int irq, void *data)
|
||||
{
|
||||
struct panel_drv_data *ddata = data;
|
||||
|
||||
mutex_lock(&ddata->hpd_lock);
|
||||
if (ddata->hpd_cb) {
|
||||
enum drm_connector_status status;
|
||||
|
||||
if (hdmic_detect(&ddata->dssdev))
|
||||
status = connector_status_connected;
|
||||
else
|
||||
status = connector_status_disconnected;
|
||||
|
||||
ddata->hpd_cb(ddata->hpd_cb_data, status);
|
||||
}
|
||||
mutex_unlock(&ddata->hpd_lock);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int hdmic_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct panel_drv_data *ddata;
|
||||
struct omap_dss_device *dssdev;
|
||||
struct gpio_desc *gpio;
|
||||
int r;
|
||||
|
||||
ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
|
||||
if (!ddata)
|
||||
return -ENOMEM;
|
||||
|
||||
platform_set_drvdata(pdev, ddata);
|
||||
ddata->dev = &pdev->dev;
|
||||
|
||||
mutex_init(&ddata->hpd_lock);
|
||||
|
||||
/* HPD GPIO */
|
||||
gpio = devm_gpiod_get_optional(&pdev->dev, "hpd", GPIOD_IN);
|
||||
if (IS_ERR(gpio)) {
|
||||
dev_err(&pdev->dev, "failed to parse HPD gpio\n");
|
||||
return PTR_ERR(gpio);
|
||||
}
|
||||
|
||||
ddata->hpd_gpio = gpio;
|
||||
|
||||
if (ddata->hpd_gpio) {
|
||||
r = devm_request_threaded_irq(&pdev->dev,
|
||||
gpiod_to_irq(ddata->hpd_gpio),
|
||||
NULL, hdmic_hpd_isr,
|
||||
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
|
||||
IRQF_ONESHOT,
|
||||
"hdmic hpd", ddata);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
|
||||
dssdev = &ddata->dssdev;
|
||||
dssdev->ops = &hdmic_ops;
|
||||
dssdev->dev = &pdev->dev;
|
||||
dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
|
||||
dssdev->display = true;
|
||||
dssdev->owner = THIS_MODULE;
|
||||
dssdev->of_port = 0;
|
||||
dssdev->ops_flags = ddata->hpd_gpio
|
||||
? OMAP_DSS_DEVICE_OP_DETECT | OMAP_DSS_DEVICE_OP_HPD
|
||||
: 0;
|
||||
|
||||
omapdss_display_init(dssdev);
|
||||
omapdss_device_register(dssdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __exit hdmic_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
|
||||
|
||||
omapdss_device_unregister(&ddata->dssdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id hdmic_of_match[] = {
|
||||
{ .compatible = "omapdss,hdmi-connector", },
|
||||
{},
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(of, hdmic_of_match);
|
||||
|
||||
static struct platform_driver hdmi_connector_driver = {
|
||||
.probe = hdmic_probe,
|
||||
.remove = __exit_p(hdmic_remove),
|
||||
.driver = {
|
||||
.name = "connector-hdmi",
|
||||
.of_match_table = hdmic_of_match,
|
||||
.suppress_bind_attrs = true,
|
||||
},
|
||||
};
|
||||
|
||||
module_platform_driver(hdmi_connector_driver);
|
||||
|
||||
MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
|
||||
MODULE_DESCRIPTION("HDMI Connector driver");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -1,137 +0,0 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* OPA362 analog video amplifier with output/power control
|
||||
*
|
||||
* Copyright (C) 2014 Golden Delicious Computers
|
||||
* Author: H. Nikolaus Schaller <hns@goldelico.com>
|
||||
*
|
||||
* based on encoder-tfp410
|
||||
*
|
||||
* Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
|
||||
*/
|
||||
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "../dss/omapdss.h"
|
||||
|
||||
struct panel_drv_data {
|
||||
struct omap_dss_device dssdev;
|
||||
|
||||
struct gpio_desc *enable_gpio;
|
||||
};
|
||||
|
||||
#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
|
||||
|
||||
static int opa362_connect(struct omap_dss_device *src,
|
||||
struct omap_dss_device *dst)
|
||||
{
|
||||
return omapdss_device_connect(dst->dss, dst, dst->next);
|
||||
}
|
||||
|
||||
static void opa362_disconnect(struct omap_dss_device *src,
|
||||
struct omap_dss_device *dst)
|
||||
{
|
||||
omapdss_device_disconnect(dst, dst->next);
|
||||
}
|
||||
|
||||
static void opa362_enable(struct omap_dss_device *dssdev)
|
||||
{
|
||||
struct panel_drv_data *ddata = to_panel_data(dssdev);
|
||||
|
||||
if (ddata->enable_gpio)
|
||||
gpiod_set_value_cansleep(ddata->enable_gpio, 1);
|
||||
}
|
||||
|
||||
static void opa362_disable(struct omap_dss_device *dssdev)
|
||||
{
|
||||
struct panel_drv_data *ddata = to_panel_data(dssdev);
|
||||
|
||||
if (ddata->enable_gpio)
|
||||
gpiod_set_value_cansleep(ddata->enable_gpio, 0);
|
||||
}
|
||||
|
||||
static const struct omap_dss_device_ops opa362_ops = {
|
||||
.connect = opa362_connect,
|
||||
.disconnect = opa362_disconnect,
|
||||
.enable = opa362_enable,
|
||||
.disable = opa362_disable,
|
||||
};
|
||||
|
||||
static int opa362_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct panel_drv_data *ddata;
|
||||
struct omap_dss_device *dssdev;
|
||||
struct gpio_desc *gpio;
|
||||
|
||||
dev_dbg(&pdev->dev, "probe\n");
|
||||
|
||||
ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
|
||||
if (!ddata)
|
||||
return -ENOMEM;
|
||||
|
||||
platform_set_drvdata(pdev, ddata);
|
||||
|
||||
gpio = devm_gpiod_get_optional(&pdev->dev, "enable", GPIOD_OUT_LOW);
|
||||
if (IS_ERR(gpio))
|
||||
return PTR_ERR(gpio);
|
||||
|
||||
ddata->enable_gpio = gpio;
|
||||
|
||||
dssdev = &ddata->dssdev;
|
||||
dssdev->ops = &opa362_ops;
|
||||
dssdev->dev = &pdev->dev;
|
||||
dssdev->type = OMAP_DISPLAY_TYPE_VENC;
|
||||
dssdev->owner = THIS_MODULE;
|
||||
dssdev->of_port = 1;
|
||||
|
||||
dssdev->next = omapdss_of_find_connected_device(pdev->dev.of_node, 1);
|
||||
if (IS_ERR(dssdev->next)) {
|
||||
if (PTR_ERR(dssdev->next) != -EPROBE_DEFER)
|
||||
dev_err(&pdev->dev, "failed to find video sink\n");
|
||||
return PTR_ERR(dssdev->next);
|
||||
}
|
||||
|
||||
omapdss_device_register(dssdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __exit opa362_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
|
||||
struct omap_dss_device *dssdev = &ddata->dssdev;
|
||||
|
||||
if (dssdev->next)
|
||||
omapdss_device_put(dssdev->next);
|
||||
omapdss_device_unregister(&ddata->dssdev);
|
||||
|
||||
opa362_disable(dssdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id opa362_of_match[] = {
|
||||
{ .compatible = "omapdss,ti,opa362", },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, opa362_of_match);
|
||||
|
||||
static struct platform_driver opa362_driver = {
|
||||
.probe = opa362_probe,
|
||||
.remove = __exit_p(opa362_remove),
|
||||
.driver = {
|
||||
.name = "amplifier-opa362",
|
||||
.of_match_table = opa362_of_match,
|
||||
.suppress_bind_attrs = true,
|
||||
},
|
||||
};
|
||||
|
||||
module_platform_driver(opa362_driver);
|
||||
|
||||
MODULE_AUTHOR("H. Nikolaus Schaller <hns@goldelico.com>");
|
||||
MODULE_DESCRIPTION("OPA362 analog video amplifier with output/power control");
|
||||
MODULE_LICENSE("GPL v2");
|
|
@ -1,217 +0,0 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* TPD12S015 HDMI ESD protection & level shifter chip driver
|
||||
*
|
||||
* Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
|
||||
* Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
|
||||
*/
|
||||
|
||||
#include <linux/completion.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
#include "../dss/omapdss.h"
|
||||
|
||||
struct panel_drv_data {
|
||||
struct omap_dss_device dssdev;
|
||||
void (*hpd_cb)(void *cb_data, enum drm_connector_status status);
|
||||
void *hpd_cb_data;
|
||||
struct mutex hpd_lock;
|
||||
|
||||
struct gpio_desc *ct_cp_hpd_gpio;
|
||||
struct gpio_desc *ls_oe_gpio;
|
||||
struct gpio_desc *hpd_gpio;
|
||||
};
|
||||
|
||||
#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
|
||||
|
||||
static int tpd_connect(struct omap_dss_device *src,
|
||||
struct omap_dss_device *dst)
|
||||
{
|
||||
struct panel_drv_data *ddata = to_panel_data(dst);
|
||||
int r;
|
||||
|
||||
r = omapdss_device_connect(dst->dss, dst, dst->next);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
gpiod_set_value_cansleep(ddata->ct_cp_hpd_gpio, 1);
|
||||
gpiod_set_value_cansleep(ddata->ls_oe_gpio, 1);
|
||||
|
||||
/* DC-DC converter needs at max 300us to get to 90% of 5V */
|
||||
udelay(300);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void tpd_disconnect(struct omap_dss_device *src,
|
||||
struct omap_dss_device *dst)
|
||||
{
|
||||
struct panel_drv_data *ddata = to_panel_data(dst);
|
||||
|
||||
gpiod_set_value_cansleep(ddata->ct_cp_hpd_gpio, 0);
|
||||
gpiod_set_value_cansleep(ddata->ls_oe_gpio, 0);
|
||||
|
||||
omapdss_device_disconnect(dst, dst->next);
|
||||
}
|
||||
|
||||
static bool tpd_detect(struct omap_dss_device *dssdev)
|
||||
{
|
||||
struct panel_drv_data *ddata = to_panel_data(dssdev);
|
||||
|
||||
return gpiod_get_value_cansleep(ddata->hpd_gpio);
|
||||
}
|
||||
|
||||
static void tpd_register_hpd_cb(struct omap_dss_device *dssdev,
|
||||
void (*cb)(void *cb_data,
|
||||
enum drm_connector_status status),
|
||||
void *cb_data)
|
||||
{
|
||||
struct panel_drv_data *ddata = to_panel_data(dssdev);
|
||||
|
||||
mutex_lock(&ddata->hpd_lock);
|
||||
ddata->hpd_cb = cb;
|
||||
ddata->hpd_cb_data = cb_data;
|
||||
mutex_unlock(&ddata->hpd_lock);
|
||||
}
|
||||
|
||||
static void tpd_unregister_hpd_cb(struct omap_dss_device *dssdev)
|
||||
{
|
||||
struct panel_drv_data *ddata = to_panel_data(dssdev);
|
||||
|
||||
mutex_lock(&ddata->hpd_lock);
|
||||
ddata->hpd_cb = NULL;
|
||||
ddata->hpd_cb_data = NULL;
|
||||
mutex_unlock(&ddata->hpd_lock);
|
||||
}
|
||||
|
||||
static const struct omap_dss_device_ops tpd_ops = {
|
||||
.connect = tpd_connect,
|
||||
.disconnect = tpd_disconnect,
|
||||
.detect = tpd_detect,
|
||||
.register_hpd_cb = tpd_register_hpd_cb,
|
||||
.unregister_hpd_cb = tpd_unregister_hpd_cb,
|
||||
};
|
||||
|
||||
static irqreturn_t tpd_hpd_isr(int irq, void *data)
|
||||
{
|
||||
struct panel_drv_data *ddata = data;
|
||||
|
||||
mutex_lock(&ddata->hpd_lock);
|
||||
if (ddata->hpd_cb) {
|
||||
enum drm_connector_status status;
|
||||
|
||||
if (tpd_detect(&ddata->dssdev))
|
||||
status = connector_status_connected;
|
||||
else
|
||||
status = connector_status_disconnected;
|
||||
|
||||
ddata->hpd_cb(ddata->hpd_cb_data, status);
|
||||
}
|
||||
mutex_unlock(&ddata->hpd_lock);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int tpd_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct omap_dss_device *dssdev;
|
||||
struct panel_drv_data *ddata;
|
||||
int r;
|
||||
struct gpio_desc *gpio;
|
||||
|
||||
ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
|
||||
if (!ddata)
|
||||
return -ENOMEM;
|
||||
|
||||
platform_set_drvdata(pdev, ddata);
|
||||
|
||||
gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 0,
|
||||
GPIOD_OUT_LOW);
|
||||
if (IS_ERR(gpio))
|
||||
return PTR_ERR(gpio);
|
||||
|
||||
ddata->ct_cp_hpd_gpio = gpio;
|
||||
|
||||
gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 1,
|
||||
GPIOD_OUT_LOW);
|
||||
if (IS_ERR(gpio))
|
||||
return PTR_ERR(gpio);
|
||||
|
||||
ddata->ls_oe_gpio = gpio;
|
||||
|
||||
gpio = devm_gpiod_get_index(&pdev->dev, NULL, 2,
|
||||
GPIOD_IN);
|
||||
if (IS_ERR(gpio))
|
||||
return PTR_ERR(gpio);
|
||||
|
||||
ddata->hpd_gpio = gpio;
|
||||
|
||||
mutex_init(&ddata->hpd_lock);
|
||||
|
||||
r = devm_request_threaded_irq(&pdev->dev, gpiod_to_irq(ddata->hpd_gpio),
|
||||
NULL, tpd_hpd_isr,
|
||||
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
|
||||
"tpd12s015 hpd", ddata);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
dssdev = &ddata->dssdev;
|
||||
dssdev->ops = &tpd_ops;
|
||||
dssdev->dev = &pdev->dev;
|
||||
dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
|
||||
dssdev->owner = THIS_MODULE;
|
||||
dssdev->of_port = 1;
|
||||
dssdev->ops_flags = OMAP_DSS_DEVICE_OP_DETECT
|
||||
| OMAP_DSS_DEVICE_OP_HPD;
|
||||
|
||||
dssdev->next = omapdss_of_find_connected_device(pdev->dev.of_node, 1);
|
||||
if (IS_ERR(dssdev->next)) {
|
||||
if (PTR_ERR(dssdev->next) != -EPROBE_DEFER)
|
||||
dev_err(&pdev->dev, "failed to find video sink\n");
|
||||
return PTR_ERR(dssdev->next);
|
||||
}
|
||||
|
||||
omapdss_device_register(dssdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __exit tpd_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
|
||||
struct omap_dss_device *dssdev = &ddata->dssdev;
|
||||
|
||||
if (dssdev->next)
|
||||
omapdss_device_put(dssdev->next);
|
||||
omapdss_device_unregister(&ddata->dssdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id tpd_of_match[] = {
|
||||
{ .compatible = "omapdss,ti,tpd12s015", },
|
||||
{},
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(of, tpd_of_match);
|
||||
|
||||
static struct platform_driver tpd_driver = {
|
||||
.probe = tpd_probe,
|
||||
.remove = __exit_p(tpd_remove),
|
||||
.driver = {
|
||||
.name = "tpd12s015",
|
||||
.of_match_table = tpd_of_match,
|
||||
.suppress_bind_attrs = true,
|
||||
},
|
||||
};
|
||||
|
||||
module_platform_driver(tpd_driver);
|
||||
|
||||
MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
|
||||
MODULE_DESCRIPTION("TPD12S015 driver");
|
||||
MODULE_LICENSE("GPL");
|
|
@ -444,8 +444,8 @@ static int hdmi4_bridge_attach(struct drm_bridge *bridge,
|
|||
{
|
||||
struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
|
||||
|
||||
if (!hdmi->output.next_bridge)
|
||||
return 0;
|
||||
if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
|
||||
return -EINVAL;
|
||||
|
||||
return drm_bridge_attach(bridge->encoder, hdmi->output.next_bridge,
|
||||
bridge, flags);
|
||||
|
|
|
@ -422,8 +422,8 @@ static int hdmi5_bridge_attach(struct drm_bridge *bridge,
|
|||
{
|
||||
struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
|
||||
|
||||
if (!hdmi->output.next_bridge)
|
||||
return 0;
|
||||
if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
|
||||
return -EINVAL;
|
||||
|
||||
return drm_bridge_attach(bridge->encoder, hdmi->output.next_bridge,
|
||||
bridge, flags);
|
||||
|
|
|
@ -174,12 +174,7 @@ static const struct of_device_id omapdss_of_match[] __initconst = {
|
|||
};
|
||||
|
||||
static const struct of_device_id omapdss_of_fixups_whitelist[] __initconst = {
|
||||
{ .compatible = "composite-video-connector" },
|
||||
{ .compatible = "hdmi-connector" },
|
||||
{ .compatible = "panel-dsi-cm" },
|
||||
{ .compatible = "svideo-connector" },
|
||||
{ .compatible = "ti,opa362" },
|
||||
{ .compatible = "ti,tpd12s015" },
|
||||
{},
|
||||
};
|
||||
|
||||
|
|
|
@ -60,6 +60,11 @@ int omapdss_device_init_output(struct omap_dss_device *out,
|
|||
}
|
||||
|
||||
if (local_bridge) {
|
||||
if (!out->bridge) {
|
||||
ret = -EPROBE_DEFER;
|
||||
goto error;
|
||||
}
|
||||
|
||||
out->next_bridge = out->bridge;
|
||||
out->bridge = local_bridge;
|
||||
}
|
||||
|
|
|
@ -626,8 +626,8 @@ static int venc_bridge_attach(struct drm_bridge *bridge,
|
|||
{
|
||||
struct venc_device *venc = drm_bridge_to_venc(bridge);
|
||||
|
||||
if (venc->output.next_bridge)
|
||||
return 0;
|
||||
if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
|
||||
return -EINVAL;
|
||||
|
||||
return drm_bridge_attach(bridge->encoder, venc->output.next_bridge,
|
||||
bridge, flags);
|
||||
|
|
Loading…
Reference in New Issue