drm/tegra: Changes for v5.3-rc1
This contains a couple of small improvements and cleanups for the Tegra DRM driver. -----BEGIN PGP SIGNATURE----- iQJHBAABCAAxFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAl0M8jsTHHRyZWRpbmdA bnZpZGlhLmNvbQAKCRDdI6zXfz6zoU0MEACZhCSKLvinuCw2pWdsc2A5rZN3r0Mr 9TpdIKXYwcHO2G2gYC1mXv0wlp2pzIOr5y3VHLl1VboWXlPZjvgH0OiDtmwZk/vU jjFOGZO5ZjwyVNAZ8SlQrpdBNIAm3wseVfrhVURIL+9dANDgXsxWiqTkgnEmVclZ Kj2SpXfysTM9TJyXfQW8op6jKtP3NJ/IPEtTguNL1R9ho0phlcRYBUMEIYqtgBVE aRsjrrbM27OGf+JFPY3C7bW90hzgVqZLeK9R4AAMPS8iZ91k9njlFZ20LI9Yk/P1 GBVyemiRtcG3owbli3NlfFzaeNjmM2PmcMZJsOyf6T+UH5juH2XZ/TV5O6i/jq0z /8DWsuFdEMX5tdP0t4B3vnbGQTYMOo/6bRsZHceLXcpKFNuJcC6lY233/Fc3D1bw gWm5ZHTs3SmPm2JoWmA54h2oiXU8/hGiPZGoUDHUTxf/h7DOGhK2hfaNdB6ZYXJu be4yS5TidFlFKi911JuXblCDeFf0VPsOfemQtJW4OvKg9FD6WmRuehYPytJ8ifB1 dByXh5siOVMcyE0a2bsMPAvsxK6z4pPwyDz34AJUETJ0DSmSfWeEMSbCmpJwt6m5 35IiMossSULJXWjqtc5bcK1gmbYMJSEwj+Xe33O+H67THSgo4GLxqKdb++5QK5Ky svluhQIjYYx3pw== =T2hU -----END PGP SIGNATURE----- Merge tag 'drm/tegra/for-5.3-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next drm/tegra: Changes for v5.3-rc1 This contains a couple of small improvements and cleanups for the Tegra DRM driver. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thierry Reding <thierry.reding@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190621150753.19550-1-thierry.reding@gmail.com
This commit is contained in:
Коммит
dfd03396d7
|
@ -485,11 +485,16 @@ static int tegra_dpaux_probe(struct platform_device *pdev)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
dpaux->vdd = devm_regulator_get(&pdev->dev, "vdd");
|
dpaux->vdd = devm_regulator_get_optional(&pdev->dev, "vdd");
|
||||||
if (IS_ERR(dpaux->vdd)) {
|
if (IS_ERR(dpaux->vdd)) {
|
||||||
dev_err(&pdev->dev, "failed to get VDD supply: %ld\n",
|
if (PTR_ERR(dpaux->vdd) != -ENODEV) {
|
||||||
PTR_ERR(dpaux->vdd));
|
if (PTR_ERR(dpaux->vdd) != -EPROBE_DEFER)
|
||||||
return PTR_ERR(dpaux->vdd);
|
dev_err(&pdev->dev,
|
||||||
|
"failed to get VDD supply: %ld\n",
|
||||||
|
PTR_ERR(dpaux->vdd));
|
||||||
|
|
||||||
|
return PTR_ERR(dpaux->vdd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_set_drvdata(pdev, dpaux);
|
platform_set_drvdata(pdev, dpaux);
|
||||||
|
|
|
@ -127,8 +127,7 @@ struct tegra_output {
|
||||||
const struct edid *edid;
|
const struct edid *edid;
|
||||||
struct cec_notifier *cec;
|
struct cec_notifier *cec;
|
||||||
unsigned int hpd_irq;
|
unsigned int hpd_irq;
|
||||||
int hpd_gpio;
|
struct gpio_desc *hpd_gpio;
|
||||||
enum of_gpio_flags hpd_gpio_flags;
|
|
||||||
|
|
||||||
struct drm_encoder encoder;
|
struct drm_encoder encoder;
|
||||||
struct drm_connector connector;
|
struct drm_connector connector;
|
||||||
|
|
|
@ -53,18 +53,11 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force)
|
||||||
struct tegra_output *output = connector_to_output(connector);
|
struct tegra_output *output = connector_to_output(connector);
|
||||||
enum drm_connector_status status = connector_status_unknown;
|
enum drm_connector_status status = connector_status_unknown;
|
||||||
|
|
||||||
if (gpio_is_valid(output->hpd_gpio)) {
|
if (output->hpd_gpio) {
|
||||||
if (output->hpd_gpio_flags & OF_GPIO_ACTIVE_LOW) {
|
if (gpiod_get_value(output->hpd_gpio) == 0)
|
||||||
if (gpio_get_value(output->hpd_gpio) != 0)
|
status = connector_status_disconnected;
|
||||||
status = connector_status_disconnected;
|
else
|
||||||
else
|
status = connector_status_connected;
|
||||||
status = connector_status_connected;
|
|
||||||
} else {
|
|
||||||
if (gpio_get_value(output->hpd_gpio) == 0)
|
|
||||||
status = connector_status_disconnected;
|
|
||||||
else
|
|
||||||
status = connector_status_connected;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (!output->panel)
|
if (!output->panel)
|
||||||
status = connector_status_disconnected;
|
status = connector_status_disconnected;
|
||||||
|
@ -102,6 +95,7 @@ static irqreturn_t hpd_irq(int irq, void *data)
|
||||||
int tegra_output_probe(struct tegra_output *output)
|
int tegra_output_probe(struct tegra_output *output)
|
||||||
{
|
{
|
||||||
struct device_node *ddc, *panel;
|
struct device_node *ddc, *panel;
|
||||||
|
unsigned long flags;
|
||||||
int err, size;
|
int err, size;
|
||||||
|
|
||||||
if (!output->of_node)
|
if (!output->of_node)
|
||||||
|
@ -130,23 +124,18 @@ int tegra_output_probe(struct tegra_output *output)
|
||||||
of_node_put(ddc);
|
of_node_put(ddc);
|
||||||
}
|
}
|
||||||
|
|
||||||
output->hpd_gpio = of_get_named_gpio_flags(output->of_node,
|
output->hpd_gpio = devm_gpiod_get_from_of_node(output->dev,
|
||||||
"nvidia,hpd-gpio", 0,
|
output->of_node,
|
||||||
&output->hpd_gpio_flags);
|
"nvidia,hpd-gpio", 0,
|
||||||
if (gpio_is_valid(output->hpd_gpio)) {
|
GPIOD_IN,
|
||||||
unsigned long flags;
|
"HDMI hotplug detect");
|
||||||
|
if (IS_ERR(output->hpd_gpio))
|
||||||
|
return PTR_ERR(output->hpd_gpio);
|
||||||
|
|
||||||
err = gpio_request_one(output->hpd_gpio, GPIOF_DIR_IN,
|
if (output->hpd_gpio) {
|
||||||
"HDMI hotplug detect");
|
err = gpiod_to_irq(output->hpd_gpio);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
dev_err(output->dev, "gpio_request_one(): %d\n", err);
|
dev_err(output->dev, "gpiod_to_irq(): %d\n", err);
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = gpio_to_irq(output->hpd_gpio);
|
|
||||||
if (err < 0) {
|
|
||||||
dev_err(output->dev, "gpio_to_irq(): %d\n", err);
|
|
||||||
gpio_free(output->hpd_gpio);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +149,6 @@ int tegra_output_probe(struct tegra_output *output)
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
dev_err(output->dev, "failed to request IRQ#%u: %d\n",
|
dev_err(output->dev, "failed to request IRQ#%u: %d\n",
|
||||||
output->hpd_irq, err);
|
output->hpd_irq, err);
|
||||||
gpio_free(output->hpd_gpio);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,10 +174,8 @@ void tegra_output_remove(struct tegra_output *output)
|
||||||
if (output->cec)
|
if (output->cec)
|
||||||
cec_notifier_put(output->cec);
|
cec_notifier_put(output->cec);
|
||||||
|
|
||||||
if (gpio_is_valid(output->hpd_gpio)) {
|
if (output->hpd_gpio)
|
||||||
free_irq(output->hpd_irq, output);
|
free_irq(output->hpd_irq, output);
|
||||||
gpio_free(output->hpd_gpio);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (output->ddc)
|
if (output->ddc)
|
||||||
put_device(&output->ddc->dev);
|
put_device(&output->ddc->dev);
|
||||||
|
@ -209,7 +195,7 @@ int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
|
||||||
* The connector is now registered and ready to receive hotplug events
|
* The connector is now registered and ready to receive hotplug events
|
||||||
* so the hotplug interrupt can be enabled.
|
* so the hotplug interrupt can be enabled.
|
||||||
*/
|
*/
|
||||||
if (gpio_is_valid(output->hpd_gpio))
|
if (output->hpd_gpio)
|
||||||
enable_irq(output->hpd_irq);
|
enable_irq(output->hpd_irq);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -221,7 +207,7 @@ void tegra_output_exit(struct tegra_output *output)
|
||||||
* The connector is going away, so the interrupt must be disabled to
|
* The connector is going away, so the interrupt must be disabled to
|
||||||
* prevent the hotplug interrupt handler from potentially crashing.
|
* prevent the hotplug interrupt handler from potentially crashing.
|
||||||
*/
|
*/
|
||||||
if (gpio_is_valid(output->hpd_gpio))
|
if (output->hpd_gpio)
|
||||||
disable_irq(output->hpd_irq);
|
disable_irq(output->hpd_irq);
|
||||||
|
|
||||||
if (output->panel)
|
if (output->panel)
|
||||||
|
|
|
@ -305,6 +305,36 @@ static int host1x_device_match(struct device *dev, struct device_driver *drv)
|
||||||
return strcmp(dev_name(dev), drv->name) == 0;
|
return strcmp(dev_name(dev), drv->name) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int host1x_device_uevent(struct device *dev,
|
||||||
|
struct kobj_uevent_env *env)
|
||||||
|
{
|
||||||
|
struct device_node *np = dev->parent->of_node;
|
||||||
|
unsigned int count = 0;
|
||||||
|
struct property *p;
|
||||||
|
const char *compat;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This duplicates most of of_device_uevent(), but the latter cannot
|
||||||
|
* be called from modules and operates on dev->of_node, which is not
|
||||||
|
* available in this case.
|
||||||
|
*
|
||||||
|
* Note that this is really only needed for backwards compatibility
|
||||||
|
* with libdrm, which parses this information from sysfs and will
|
||||||
|
* fail if it can't find the OF_FULLNAME, specifically.
|
||||||
|
*/
|
||||||
|
add_uevent_var(env, "OF_NAME=%pOFn", np);
|
||||||
|
add_uevent_var(env, "OF_FULLNAME=%pOF", np);
|
||||||
|
|
||||||
|
of_property_for_each_string(np, "compatible", p, compat) {
|
||||||
|
add_uevent_var(env, "OF_COMPATIBLE_%u=%s", count, compat);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_uevent_var(env, "OF_COMPATIBLE_N=%u", count);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int host1x_dma_configure(struct device *dev)
|
static int host1x_dma_configure(struct device *dev)
|
||||||
{
|
{
|
||||||
return of_dma_configure(dev, dev->of_node, true);
|
return of_dma_configure(dev, dev->of_node, true);
|
||||||
|
@ -322,6 +352,7 @@ static const struct dev_pm_ops host1x_device_pm_ops = {
|
||||||
struct bus_type host1x_bus_type = {
|
struct bus_type host1x_bus_type = {
|
||||||
.name = "host1x",
|
.name = "host1x",
|
||||||
.match = host1x_device_match,
|
.match = host1x_device_match,
|
||||||
|
.uevent = host1x_device_uevent,
|
||||||
.dma_configure = host1x_dma_configure,
|
.dma_configure = host1x_dma_configure,
|
||||||
.pm = &host1x_device_pm_ops,
|
.pm = &host1x_device_pm_ops,
|
||||||
};
|
};
|
||||||
|
@ -408,12 +439,14 @@ static int host1x_device_add(struct host1x *host1x,
|
||||||
device->dev.dma_mask = &device->dev.coherent_dma_mask;
|
device->dev.dma_mask = &device->dev.coherent_dma_mask;
|
||||||
dev_set_name(&device->dev, "%s", driver->driver.name);
|
dev_set_name(&device->dev, "%s", driver->driver.name);
|
||||||
device->dev.release = host1x_device_release;
|
device->dev.release = host1x_device_release;
|
||||||
device->dev.of_node = host1x->dev->of_node;
|
|
||||||
device->dev.bus = &host1x_bus_type;
|
device->dev.bus = &host1x_bus_type;
|
||||||
device->dev.parent = host1x->dev;
|
device->dev.parent = host1x->dev;
|
||||||
|
|
||||||
of_dma_configure(&device->dev, host1x->dev->of_node, true);
|
of_dma_configure(&device->dev, host1x->dev->of_node, true);
|
||||||
|
|
||||||
|
device->dev.dma_parms = &device->dma_parms;
|
||||||
|
dma_set_max_seg_size(&device->dev, SZ_4M);
|
||||||
|
|
||||||
err = host1x_device_parse_dt(device, driver);
|
err = host1x_device_parse_dt(device, driver);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
kfree(device);
|
kfree(device);
|
||||||
|
|
|
@ -162,9 +162,6 @@ static void host1x_debugfs_init(struct host1x *host1x)
|
||||||
{
|
{
|
||||||
struct dentry *de = debugfs_create_dir("tegra-host1x", NULL);
|
struct dentry *de = debugfs_create_dir("tegra-host1x", NULL);
|
||||||
|
|
||||||
if (!de)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Store the created entry */
|
/* Store the created entry */
|
||||||
host1x->debugfs = de;
|
host1x->debugfs = de;
|
||||||
|
|
||||||
|
|
|
@ -247,8 +247,11 @@ static int host1x_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
host->clk = devm_clk_get(&pdev->dev, NULL);
|
host->clk = devm_clk_get(&pdev->dev, NULL);
|
||||||
if (IS_ERR(host->clk)) {
|
if (IS_ERR(host->clk)) {
|
||||||
dev_err(&pdev->dev, "failed to get clock\n");
|
|
||||||
err = PTR_ERR(host->clk);
|
err = PTR_ERR(host->clk);
|
||||||
|
|
||||||
|
if (err != -EPROBE_DEFER)
|
||||||
|
dev_err(&pdev->dev, "failed to get clock: %d\n", err);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,6 +297,8 @@ struct host1x_device {
|
||||||
struct list_head clients;
|
struct list_head clients;
|
||||||
|
|
||||||
bool registered;
|
bool registered;
|
||||||
|
|
||||||
|
struct device_dma_parameters dma_parms;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct host1x_device *to_host1x_device(struct device *dev)
|
static inline struct host1x_device *to_host1x_device(struct device *dev)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче