diff options
Diffstat (limited to 'drivers/gpu/drm/sti/sti_vtg.c')
| -rw-r--r-- | drivers/gpu/drm/sti/sti_vtg.c | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c index 2dcba1d3a122..3aa2fa6f2228 100644 --- a/drivers/gpu/drm/sti/sti_vtg.c +++ b/drivers/gpu/drm/sti/sti_vtg.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 11 | #include <linux/notifier.h> | 11 | #include <linux/notifier.h> |
| 12 | #include <linux/of_platform.h> | ||
| 12 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
| 13 | 14 | ||
| 14 | #include <drm/drmP.h> | 15 | #include <drm/drmP.h> |
| @@ -72,8 +73,6 @@ | |||
| 72 | #define AWG_DELAY_ED (-8) | 73 | #define AWG_DELAY_ED (-8) |
| 73 | #define AWG_DELAY_SD (-7) | 74 | #define AWG_DELAY_SD (-7) |
| 74 | 75 | ||
| 75 | static LIST_HEAD(vtg_lookup); | ||
| 76 | |||
| 77 | /* | 76 | /* |
| 78 | * STI VTG register offset structure | 77 | * STI VTG register offset structure |
| 79 | * | 78 | * |
| @@ -123,42 +122,31 @@ struct sti_vtg_sync_params { | |||
| 123 | /** | 122 | /** |
| 124 | * STI VTG structure | 123 | * STI VTG structure |
| 125 | * | 124 | * |
| 126 | * @dev: pointer to device driver | ||
| 127 | * @np: device node | ||
| 128 | * @regs: register mapping | 125 | * @regs: register mapping |
| 129 | * @sync_params: synchronisation parameters used to generate timings | 126 | * @sync_params: synchronisation parameters used to generate timings |
| 130 | * @irq: VTG irq | 127 | * @irq: VTG irq |
| 131 | * @irq_status: store the IRQ status value | 128 | * @irq_status: store the IRQ status value |
| 132 | * @notifier_list: notifier callback | 129 | * @notifier_list: notifier callback |
| 133 | * @crtc: the CRTC for vblank event | 130 | * @crtc: the CRTC for vblank event |
| 134 | * @link: List node to link the structure in lookup list | ||
| 135 | */ | 131 | */ |
| 136 | struct sti_vtg { | 132 | struct sti_vtg { |
| 137 | struct device *dev; | ||
| 138 | struct device_node *np; | ||
| 139 | void __iomem *regs; | 133 | void __iomem *regs; |
| 140 | struct sti_vtg_sync_params sync_params[VTG_MAX_SYNC_OUTPUT]; | 134 | struct sti_vtg_sync_params sync_params[VTG_MAX_SYNC_OUTPUT]; |
| 141 | int irq; | 135 | int irq; |
| 142 | u32 irq_status; | 136 | u32 irq_status; |
| 143 | struct raw_notifier_head notifier_list; | 137 | struct raw_notifier_head notifier_list; |
| 144 | struct drm_crtc *crtc; | 138 | struct drm_crtc *crtc; |
| 145 | struct list_head link; | ||
| 146 | }; | 139 | }; |
| 147 | 140 | ||
| 148 | static void vtg_register(struct sti_vtg *vtg) | ||
| 149 | { | ||
| 150 | list_add_tail(&vtg->link, &vtg_lookup); | ||
| 151 | } | ||
| 152 | |||
| 153 | struct sti_vtg *of_vtg_find(struct device_node *np) | 141 | struct sti_vtg *of_vtg_find(struct device_node *np) |
| 154 | { | 142 | { |
| 155 | struct sti_vtg *vtg; | 143 | struct platform_device *pdev; |
| 156 | 144 | ||
| 157 | list_for_each_entry(vtg, &vtg_lookup, link) { | 145 | pdev = of_find_device_by_node(np); |
| 158 | if (vtg->np == np) | 146 | if (!pdev) |
| 159 | return vtg; | 147 | return NULL; |
| 160 | } | 148 | |
| 161 | return NULL; | 149 | return (struct sti_vtg *)platform_get_drvdata(pdev); |
| 162 | } | 150 | } |
| 163 | 151 | ||
| 164 | static void vtg_reset(struct sti_vtg *vtg) | 152 | static void vtg_reset(struct sti_vtg *vtg) |
| @@ -397,9 +385,6 @@ static int vtg_probe(struct platform_device *pdev) | |||
| 397 | if (!vtg) | 385 | if (!vtg) |
| 398 | return -ENOMEM; | 386 | return -ENOMEM; |
| 399 | 387 | ||
| 400 | vtg->dev = dev; | ||
| 401 | vtg->np = pdev->dev.of_node; | ||
| 402 | |||
| 403 | /* Get Memory ressources */ | 388 | /* Get Memory ressources */ |
| 404 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 389 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 405 | if (!res) { | 390 | if (!res) { |
| @@ -428,16 +413,10 @@ static int vtg_probe(struct platform_device *pdev) | |||
| 428 | return ret; | 413 | return ret; |
| 429 | } | 414 | } |
| 430 | 415 | ||
| 431 | vtg_register(vtg); | ||
| 432 | platform_set_drvdata(pdev, vtg); | 416 | platform_set_drvdata(pdev, vtg); |
| 433 | 417 | ||
| 434 | DRM_INFO("%s %s\n", __func__, dev_name(vtg->dev)); | 418 | DRM_INFO("%s %s\n", __func__, dev_name(dev)); |
| 435 | |||
| 436 | return 0; | ||
| 437 | } | ||
| 438 | 419 | ||
| 439 | static int vtg_remove(struct platform_device *pdev) | ||
| 440 | { | ||
| 441 | return 0; | 420 | return 0; |
| 442 | } | 421 | } |
| 443 | 422 | ||
| @@ -454,7 +433,6 @@ struct platform_driver sti_vtg_driver = { | |||
| 454 | .of_match_table = vtg_of_match, | 433 | .of_match_table = vtg_of_match, |
| 455 | }, | 434 | }, |
| 456 | .probe = vtg_probe, | 435 | .probe = vtg_probe, |
| 457 | .remove = vtg_remove, | ||
| 458 | }; | 436 | }; |
| 459 | 437 | ||
| 460 | MODULE_AUTHOR("Benjamin Gaignard <benjamin.gaignard@st.com>"); | 438 | MODULE_AUTHOR("Benjamin Gaignard <benjamin.gaignard@st.com>"); |
