fix: pull gpio after we initialize the panel struct

This commit is contained in:
James Ward 2023-07-11 02:42:51 -04:00
parent 6383900718
commit 6ef6fd88a5
No known key found for this signature in database
GPG Key ID: F53FE2DEDD7BBD79

View File

@ -527,6 +527,15 @@ int drm_probe(struct spi_device *spi)
} }
} }
// Allocate panel storage
panel = devm_drm_dev_alloc(dev, &sharp_memory_driver,
struct sharp_memory_panel, drm);
if (IS_ERR(panel)) {
printk(KERN_ERR "sharp_memory: failed to allocate panel\n");
return PTR_ERR(panel);
}
g_panel = panel;
// Initialize GPIO // Initialize GPIO
panel->gpio_scs = devm_gpiod_get_optional(dev, "scs", GPIOD_OUT_LOW); panel->gpio_scs = devm_gpiod_get_optional(dev, "scs", GPIOD_OUT_LOW);
if (IS_ERR(panel->gpio_scs)) if (IS_ERR(panel->gpio_scs))
@ -540,15 +549,6 @@ int drm_probe(struct spi_device *spi)
if (IS_ERR(panel->gpio_vcom)) if (IS_ERR(panel->gpio_vcom))
return dev_err_probe(dev, PTR_ERR(panel->gpio_vcom), "Failed to get GPIO 'vcom'\n"); return dev_err_probe(dev, PTR_ERR(panel->gpio_vcom), "Failed to get GPIO 'vcom'\n");
// Allocate panel storage
panel = devm_drm_dev_alloc(dev, &sharp_memory_driver,
struct sharp_memory_panel, drm);
if (IS_ERR(panel)) {
printk(KERN_ERR "sharp_memory: failed to allocate panel\n");
return PTR_ERR(panel);
}
g_panel = panel;
// Initalize DRM mode // Initalize DRM mode
drm = &panel->drm; drm = &panel->drm;
ret = drmm_mode_config_init(drm); ret = drmm_mode_config_init(drm);