Merge tag 'for-5.19/parisc-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
[platform/kernel/linux-starfive.git] / drivers / video / console / sticore.c
index 837011b..fa23bf0 100644 (file)
 #include <asm/pdc.h>
 #include <asm/cacheflush.h>
 #include <asm/grfioctl.h>
+#include <asm/fb.h>
 
 #include "../fbdev/sticore.h"
 
-#define STI_DRIVERVERSION "Version 0.9b"
+#define STI_DRIVERVERSION "Version 0.9c"
 
 static struct sti_struct *default_sti __read_mostly;
 
@@ -502,7 +503,7 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
        if (!fbfont)
                return NULL;
 
-       pr_info("STI selected %ux%u framebuffer font %s for sticon\n",
+       pr_info("    using %ux%u framebuffer font %s\n",
                        fbfont->width, fbfont->height, fbfont->name);
                        
        bpc = ((fbfont->width+7)/8) * fbfont->height; 
@@ -967,6 +968,7 @@ out_err:
 
 static void sticore_check_for_default_sti(struct sti_struct *sti, char *path)
 {
+       pr_info("    located at [%s]\n", sti->pa_path);
        if (strcmp (path, default_sti_path) == 0)
                default_sti = sti;
 }
@@ -978,7 +980,6 @@ static void sticore_check_for_default_sti(struct sti_struct *sti, char *path)
  */
 static int __init sticore_pa_init(struct parisc_device *dev)
 {
-       char pa_path[21];
        struct sti_struct *sti = NULL;
        int hpa = dev->hpa.start;
 
@@ -991,8 +992,8 @@ static int __init sticore_pa_init(struct parisc_device *dev)
        if (!sti)
                return 1;
 
-       print_pa_hwpath(dev, pa_path);
-       sticore_check_for_default_sti(sti, pa_path);
+       print_pa_hwpath(dev, sti->pa_path);
+       sticore_check_for_default_sti(sti, sti->pa_path);
        return 0;
 }
 
@@ -1028,9 +1029,8 @@ static int sticore_pci_init(struct pci_dev *pd, const struct pci_device_id *ent)
 
        sti = sti_try_rom_generic(rom_base, fb_base, pd);
        if (sti) {
-               char pa_path[30];
-               print_pci_hwpath(pd, pa_path);
-               sticore_check_for_default_sti(sti, pa_path);
+               print_pci_hwpath(pd, sti->pa_path);
+               sticore_check_for_default_sti(sti, sti->pa_path);
        }
        
        if (!sti) {
@@ -1148,6 +1148,22 @@ int sti_call(const struct sti_struct *sti, unsigned long func,
        return ret;
 }
 
+/* check if given fb_info is the primary device */
+int fb_is_primary_device(struct fb_info *info)
+{
+       struct sti_struct *sti;
+
+       sti = sti_get_rom(0);
+
+       /* if no built-in graphics card found, allow any fb driver as default */
+       if (!sti)
+               return true;
+
+       /* return true if it's the default built-in framebuffer driver */
+       return (sti->info == info);
+}
+EXPORT_SYMBOL(fb_is_primary_device);
+
 MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer");
 MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines");
 MODULE_LICENSE("GPL v2");