Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+69 -44
+9 -4
drivers/gpu/drm/tegra/dpaux.c
··· 485 485 return err; 486 486 } 487 487 488 - dpaux->vdd = devm_regulator_get(&pdev->dev, "vdd"); 488 + dpaux->vdd = devm_regulator_get_optional(&pdev->dev, "vdd"); 489 489 if (IS_ERR(dpaux->vdd)) { 490 - dev_err(&pdev->dev, "failed to get VDD supply: %ld\n", 491 - PTR_ERR(dpaux->vdd)); 492 - return PTR_ERR(dpaux->vdd); 490 + if (PTR_ERR(dpaux->vdd) != -ENODEV) { 491 + if (PTR_ERR(dpaux->vdd) != -EPROBE_DEFER) 492 + dev_err(&pdev->dev, 493 + "failed to get VDD supply: %ld\n", 494 + PTR_ERR(dpaux->vdd)); 495 + 496 + return PTR_ERR(dpaux->vdd); 497 + } 493 498 } 494 499 495 500 platform_set_drvdata(pdev, dpaux);
+1 -2
drivers/gpu/drm/tegra/drm.h
··· 127 127 const struct edid *edid; 128 128 struct cec_notifier *cec; 129 129 unsigned int hpd_irq; 130 - int hpd_gpio; 131 - enum of_gpio_flags hpd_gpio_flags; 130 + struct gpio_desc *hpd_gpio; 132 131 133 132 struct drm_encoder encoder; 134 133 struct drm_connector connector;
+19 -33
drivers/gpu/drm/tegra/output.c
··· 53 53 struct tegra_output *output = connector_to_output(connector); 54 54 enum drm_connector_status status = connector_status_unknown; 55 55 56 - if (gpio_is_valid(output->hpd_gpio)) { 57 - if (output->hpd_gpio_flags & OF_GPIO_ACTIVE_LOW) { 58 - if (gpio_get_value(output->hpd_gpio) != 0) 59 - status = connector_status_disconnected; 60 - else 61 - status = connector_status_connected; 62 - } else { 63 - if (gpio_get_value(output->hpd_gpio) == 0) 64 - status = connector_status_disconnected; 65 - else 66 - status = connector_status_connected; 67 - } 56 + if (output->hpd_gpio) { 57 + if (gpiod_get_value(output->hpd_gpio) == 0) 58 + status = connector_status_disconnected; 59 + else 60 + status = connector_status_connected; 68 61 } else { 69 62 if (!output->panel) 70 63 status = connector_status_disconnected; ··· 95 102 int tegra_output_probe(struct tegra_output *output) 96 103 { 97 104 struct device_node *ddc, *panel; 105 + unsigned long flags; 98 106 int err, size; 99 107 100 108 if (!output->of_node) ··· 124 130 of_node_put(ddc); 125 131 } 126 132 127 - output->hpd_gpio = of_get_named_gpio_flags(output->of_node, 128 - "nvidia,hpd-gpio", 0, 129 - &output->hpd_gpio_flags); 130 - if (gpio_is_valid(output->hpd_gpio)) { 131 - unsigned long flags; 133 + output->hpd_gpio = devm_gpiod_get_from_of_node(output->dev, 134 + output->of_node, 135 + "nvidia,hpd-gpio", 0, 136 + GPIOD_IN, 137 + "HDMI hotplug detect"); 138 + if (IS_ERR(output->hpd_gpio)) 139 + return PTR_ERR(output->hpd_gpio); 132 140 133 - err = gpio_request_one(output->hpd_gpio, GPIOF_DIR_IN, 134 - "HDMI hotplug detect"); 141 + if (output->hpd_gpio) { 142 + err = gpiod_to_irq(output->hpd_gpio); 135 143 if (err < 0) { 136 - dev_err(output->dev, "gpio_request_one(): %d\n", err); 137 - return err; 138 - } 139 - 140 - err = gpio_to_irq(output->hpd_gpio); 141 - if (err < 0) { 142 - dev_err(output->dev, "gpio_to_irq(): %d\n", err); 143 - gpio_free(output->hpd_gpio); 144 + dev_err(output->dev, "gpiod_to_irq(): %d\n", err); 144 145 return err; 145 146 } 146 147 ··· 149 160 if (err < 0) { 150 161 dev_err(output->dev, "failed to request IRQ#%u: %d\n", 151 162 output->hpd_irq, err); 152 - gpio_free(output->hpd_gpio); 153 163 return err; 154 164 } 155 165 ··· 174 186 if (output->cec) 175 187 cec_notifier_put(output->cec); 176 188 177 - if (gpio_is_valid(output->hpd_gpio)) { 189 + if (output->hpd_gpio) 178 190 free_irq(output->hpd_irq, output); 179 - gpio_free(output->hpd_gpio); 180 - } 181 191 182 192 if (output->ddc) 183 193 put_device(&output->ddc->dev); ··· 195 209 * The connector is now registered and ready to receive hotplug events 196 210 * so the hotplug interrupt can be enabled. 197 211 */ 198 - if (gpio_is_valid(output->hpd_gpio)) 212 + if (output->hpd_gpio) 199 213 enable_irq(output->hpd_irq); 200 214 201 215 return 0; ··· 207 221 * The connector is going away, so the interrupt must be disabled to 208 222 * prevent the hotplug interrupt handler from potentially crashing. 209 223 */ 210 - if (gpio_is_valid(output->hpd_gpio)) 224 + if (output->hpd_gpio) 211 225 disable_irq(output->hpd_irq); 212 226 213 227 if (output->panel)
+34 -1
drivers/gpu/host1x/bus.c
··· 305 305 return strcmp(dev_name(dev), drv->name) == 0; 306 306 } 307 307 308 + static int host1x_device_uevent(struct device *dev, 309 + struct kobj_uevent_env *env) 310 + { 311 + struct device_node *np = dev->parent->of_node; 312 + unsigned int count = 0; 313 + struct property *p; 314 + const char *compat; 315 + 316 + /* 317 + * This duplicates most of of_device_uevent(), but the latter cannot 318 + * be called from modules and operates on dev->of_node, which is not 319 + * available in this case. 320 + * 321 + * Note that this is really only needed for backwards compatibility 322 + * with libdrm, which parses this information from sysfs and will 323 + * fail if it can't find the OF_FULLNAME, specifically. 324 + */ 325 + add_uevent_var(env, "OF_NAME=%pOFn", np); 326 + add_uevent_var(env, "OF_FULLNAME=%pOF", np); 327 + 328 + of_property_for_each_string(np, "compatible", p, compat) { 329 + add_uevent_var(env, "OF_COMPATIBLE_%u=%s", count, compat); 330 + count++; 331 + } 332 + 333 + add_uevent_var(env, "OF_COMPATIBLE_N=%u", count); 334 + 335 + return 0; 336 + } 337 + 308 338 static int host1x_dma_configure(struct device *dev) 309 339 { 310 340 return of_dma_configure(dev, dev->of_node, true); ··· 352 322 struct bus_type host1x_bus_type = { 353 323 .name = "host1x", 354 324 .match = host1x_device_match, 325 + .uevent = host1x_device_uevent, 355 326 .dma_configure = host1x_dma_configure, 356 327 .pm = &host1x_device_pm_ops, 357 328 }; ··· 439 408 device->dev.dma_mask = &device->dev.coherent_dma_mask; 440 409 dev_set_name(&device->dev, "%s", driver->driver.name); 441 410 device->dev.release = host1x_device_release; 442 - device->dev.of_node = host1x->dev->of_node; 443 411 device->dev.bus = &host1x_bus_type; 444 412 device->dev.parent = host1x->dev; 445 413 446 414 of_dma_configure(&device->dev, host1x->dev->of_node, true); 415 + 416 + device->dev.dma_parms = &device->dma_parms; 417 + dma_set_max_seg_size(&device->dev, SZ_4M); 447 418 448 419 err = host1x_device_parse_dt(device, driver); 449 420 if (err < 0) {
-3
drivers/gpu/host1x/debug.c
··· 162 162 { 163 163 struct dentry *de = debugfs_create_dir("tegra-host1x", NULL); 164 164 165 - if (!de) 166 - return; 167 - 168 165 /* Store the created entry */ 169 166 host1x->debugfs = de; 170 167
+4 -1
drivers/gpu/host1x/dev.c
··· 247 247 248 248 host->clk = devm_clk_get(&pdev->dev, NULL); 249 249 if (IS_ERR(host->clk)) { 250 - dev_err(&pdev->dev, "failed to get clock\n"); 251 250 err = PTR_ERR(host->clk); 251 + 252 + if (err != -EPROBE_DEFER) 253 + dev_err(&pdev->dev, "failed to get clock: %d\n", err); 254 + 252 255 return err; 253 256 } 254 257
+2
include/linux/host1x.h
··· 297 297 struct list_head clients; 298 298 299 299 bool registered; 300 + 301 + struct device_dma_parameters dma_parms; 300 302 }; 301 303 302 304 static inline struct host1x_device *to_host1x_device(struct device *dev)