fbdev: omap: pass irqs as resource
authorArnd Bergmann <arnd@arndb.de>
Fri, 9 Aug 2019 19:27:01 +0000 (21:27 +0200)
committerArnd Bergmann <arnd@arndb.de>
Thu, 21 Apr 2022 13:00:52 +0000 (15:00 +0200)
To avoid relying on the mach/irqs.h header, stop using
OMAP_LCDC_IRQ and INT_1610_SoSSI_MATCH directly in the driver
code, but instead pass these as resources.

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
arch/arm/mach-omap1/fb.c
drivers/video/fbdev/omap/lcdc.c
drivers/video/fbdev/omap/omapfb.h
drivers/video/fbdev/omap/omapfb_main.c
drivers/video/fbdev/omap/sossi.c

index 0e32a95..b093375 100644 (file)
 #include <linux/io.h>
 #include <linux/omapfb.h>
 #include <linux/dma-mapping.h>
+#include <linux/irq.h>
 
 #include <asm/mach/map.h>
 
+#include <mach/irqs.h>
+
 #if IS_ENABLED(CONFIG_FB_OMAP)
 
 static bool omapfb_lcd_configured;
@@ -27,6 +30,19 @@ static struct omapfb_platform_data omapfb_config;
 
 static u64 omap_fb_dma_mask = ~(u32)0;
 
+struct resource omap_fb_resources[] = {
+       {
+               .name  = "irq",
+               .start = INT_LCD_CTRL,
+               .flags = IORESOURCE_IRQ,
+       },
+       {
+               .name  = "irq",
+               .start = INT_SOSSI_MATCH,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
 static struct platform_device omap_fb_device = {
        .name           = "omapfb",
        .id             = -1,
@@ -35,7 +51,8 @@ static struct platform_device omap_fb_device = {
                .coherent_dma_mask      = DMA_BIT_MASK(32),
                .platform_data          = &omapfb_config,
        },
-       .num_resources = 0,
+       .num_resources = ARRAY_SIZE(omap_fb_resources),
+       .resource = omap_fb_resources,
 };
 
 void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
index d9a23f6..d9731d1 100644 (file)
@@ -713,7 +713,7 @@ static int omap_lcdc_init(struct omapfb_device *fbdev, int ext_mode,
        }
        clk_enable(lcdc.lcd_ck);
 
-       r = request_irq(OMAP_LCDC_IRQ, lcdc_irq_handler, 0, MODULE_NAME, fbdev);
+       r = request_irq(fbdev->int_irq, lcdc_irq_handler, 0, MODULE_NAME, fbdev);
        if (r) {
                dev_err(fbdev->dev, "unable to get IRQ\n");
                goto fail2;
@@ -744,7 +744,7 @@ fail5:
 fail4:
        omap_free_lcd_dma();
 fail3:
-       free_irq(OMAP_LCDC_IRQ, lcdc.fbdev);
+       free_irq(fbdev->int_irq, lcdc.fbdev);
 fail2:
        clk_disable(lcdc.lcd_ck);
 fail1:
@@ -759,7 +759,7 @@ static void omap_lcdc_cleanup(void)
                free_palette_ram();
        free_fbmem();
        omap_free_lcd_dma();
-       free_irq(OMAP_LCDC_IRQ, lcdc.fbdev);
+       free_irq(lcdc.fbdev->int_irq, lcdc.fbdev);
        clk_disable(lcdc.lcd_ck);
        clk_put(lcdc.lcd_ck);
 }
index d930152..313a051 100644 (file)
@@ -204,6 +204,8 @@ struct omapfb_device {
        struct lcd_panel        *panel;                 /* LCD panel */
        const struct lcd_ctrl   *ctrl;                  /* LCD controller */
        const struct lcd_ctrl   *int_ctrl;              /* internal LCD ctrl */
+       int                     ext_irq;
+       int                     int_irq;
        struct lcd_ctrl_extif   *ext_if;                /* LCD ctrl external
                                                           interface */
        struct device           *dev;
index 083388a..b8fd509 100644 (file)
@@ -1624,7 +1624,7 @@ static int omapfb_do_probe(struct platform_device *pdev,
 
        init_state = 0;
 
-       if (pdev->num_resources != 0) {
+       if (pdev->num_resources != 2) {
                dev_err(&pdev->dev, "probed for an unknown device\n");
                r = -ENODEV;
                goto cleanup;
@@ -1643,6 +1643,20 @@ static int omapfb_do_probe(struct platform_device *pdev,
                r = -ENOMEM;
                goto cleanup;
        }
+       fbdev->int_irq = platform_get_irq(pdev, 0);
+       if (!fbdev->int_irq) {
+               dev_err(&pdev->dev, "unable to get irq\n");
+               r = ENXIO;
+               goto cleanup;
+       }
+
+       fbdev->ext_irq = platform_get_irq(pdev, 1);
+       if (!fbdev->ext_irq) {
+               dev_err(&pdev->dev, "unable to get irq\n");
+               r = ENXIO;
+               goto cleanup;
+       }
+
        init_state++;
 
        fbdev->dev = &pdev->dev;
index d3c755b..ade9d45 100644 (file)
@@ -639,7 +639,7 @@ static int sossi_init(struct omapfb_device *fbdev)
        l &= ~(1 << 31); /* REORDERING */
        sossi_write_reg(SOSSI_INIT1_REG, l);
 
-       if ((r = request_irq(INT_1610_SoSSI_MATCH, sossi_match_irq,
+       if ((r = request_irq(fbdev->ext_irq, sossi_match_irq,
                             IRQ_TYPE_EDGE_FALLING,
             "sossi_match", sossi.fbdev->dev)) < 0) {
                dev_err(sossi.fbdev->dev, "can't get SoSSI match IRQ\n");