Hi Alper, On Tue, 22 Aug 2023 at 06:10, Alper Nebi Yasak <alpernebiya...@gmail.com> wrote: > > From: Alexander Graf <ag...@csgraf.de> > > Now that we have a ramfb device driver, let's add the necessary glueing > magic to also spawn it when we find its qfw file node.
So then how do we select which video driver is used? I think we should have this in the DT so there is some control. > > Signed-off-by: Alexander Graf <ag...@csgraf.de> > [Alper: Use if IS_ENABLED() instead of #ifdef] > Signed-off-by: Alper Nebi Yasak <alpernebiya...@gmail.com> > --- > > Changes in v2: > - Use if (IS_ENABLED(CONFIG_VIDEO_RAMFB)) instead of #ifdef > > drivers/misc/qfw.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/drivers/misc/qfw.c b/drivers/misc/qfw.c > index 7c01bf23d53b..4e4260982cce 100644 > --- a/drivers/misc/qfw.c > +++ b/drivers/misc/qfw.c > @@ -16,6 +16,7 @@ > #include <malloc.h> > #include <qfw.h> > #include <dm.h> > +#include <dm/lists.h> > #include <misc.h> > #include <tables_csum.h> > #include <asm/acpi_table.h> > @@ -307,6 +308,27 @@ void qfw_read_entry(struct udevice *dev, u16 entry, u32 > size, void *address) > qfw_read_entry_io(qdev, entry, size, address); > } > > +static void qfw_bind_ramfb(struct udevice *dev) > +{ > + struct fw_file *file; > + int ret; > + > + if (!IS_ENABLED(CONFIG_VIDEO_RAMFB)) > + return; Needs an error-code return > + > + ret = qfw_read_firmware_list(dev); > + if (ret) > + return; > + > + file = qfw_find_file(dev, "etc/ramfb"); > + if (!file) { > + /* No ramfb available. */ > + return; > + } > + > + device_bind_driver(dev, "ramfb", "qfw-ramfb", NULL); check error > +} > + > int qfw_register(struct udevice *dev) > { > struct qfw_dev *qdev = dev_get_uclass_priv(dev); > @@ -323,6 +345,8 @@ int qfw_register(struct udevice *dev) > if (dma_enabled & FW_CFG_DMA_ENABLED) > qdev->dma_present = true; > > + qfw_bind_ramfb(dev); > + > return 0; > } > > -- > 2.40.1 > Regards, Simon