linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb
@ 2017-06-19 20:32 Sudip Mukherjee
  2017-06-19 20:32 ` [PATCH 2/2] staging: sm750fb: change default screen resolution Sudip Mukherjee
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Sudip Mukherjee @ 2017-06-19 20:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-fbdev, devel

From: Teddy Wang <teddy.wang@siliconmotion.com>

If vesafb is enabled in the config then /dev/fb0 is created by vesa
and this sm750 driver gets fb1, fb2. But we need to be fb0 and fb1 to
effectively work with xorg.
So if it has been alloted fb1, then try to remove the other fb0.

Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/staging/sm750fb/sm750.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index d5934f3..8199dbe 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1053,6 +1053,26 @@ static int sm750fb_frambuffer_alloc(struct sm750_dev *sm750_dev, int fbidx)
 	return err;
 }
 
+static int lynxfb_kick_out_firmware_fb(struct pci_dev *pdev)
+{
+	struct apertures_struct *ap;
+	bool primary = false;
+
+	ap = alloc_apertures(1);
+	if (!ap)
+		return -ENOMEM;
+
+	ap->ranges[0].base = pci_resource_start(pdev, 0);
+	ap->ranges[0].size = pci_resource_len(pdev, 0);
+#ifdef CONFIG_X86
+	primary = pdev->resource[PCI_ROM_RESOURCE].flags &
+					IORESOURCE_ROM_SHADOW;
+#endif
+	remove_conflicting_framebuffers(ap, "sm750_fb1", primary);
+	kfree(ap);
+	return 0;
+}
+
 static int lynxfb_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *ent)
 {
@@ -1061,6 +1081,10 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
 	int fbidx;
 	int err;
 
+	err = lynxfb_kick_out_firmware_fb(pdev);
+	if (err)
+		return err;
+
 	/* enable device */
 	err = pcim_enable_device(pdev);
 	if (err)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-06-29 12:57 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-19 20:32 [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb Sudip Mukherjee
2017-06-19 20:32 ` [PATCH 2/2] staging: sm750fb: change default screen resolution Sudip Mukherjee
2017-06-19 20:47 ` [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb Andy Shevchenko
2017-06-20 20:08   ` Sudip Mukherjee
2017-06-20 20:20     ` Dan Carpenter
2017-06-20 20:40       ` Andy Shevchenko
2017-06-20 20:44         ` Sudip Mukherjee
2017-06-20 20:41       ` Sudip Mukherjee
2017-06-25 12:43 ` Sudip Mukherjee
2017-06-25 12:54   ` Greg Kroah-Hartman
2017-06-25 13:54     ` Sudip Mukherjee
2017-06-25 14:27       ` Greg Kroah-Hartman
2017-06-25 15:07         ` Sudip Mukherjee
     [not found]           ` <31608A86C142F84E93092EC1B170B676743012DD@TWMBS01.tw.smi.ad>
2017-06-29 12:57             ` 答复: " Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).