drivers/goldfish_fb: optimize goldfish fb register
The Goldfish FB register should be optimized by considering the need to pass in parameters for base and irq. Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
This commit is contained in:
parent
f4c8a17837
commit
2a92748c42
@ -74,16 +74,6 @@ config GOLDFISH_FB_VIDEO_MODE
|
||||
GOLDFISH_FB_VIDEO_MODE = y enable video mode
|
||||
GOLDFISH_FB_VIDEO_MODE = n enable command mode
|
||||
|
||||
config GOLDFISH_FB_IRQ
|
||||
int "Goldfish fb irq"
|
||||
depends on GOLDFISH_FB
|
||||
default 48
|
||||
|
||||
config GOLDFISH_FB_BASE
|
||||
hex "Goldfish fb base"
|
||||
depends on GOLDFISH_FB
|
||||
default 0x0a020000
|
||||
|
||||
config GOLDFISH_FB_FRAME_NBUFFER
|
||||
int "Goldfish fb vsync size"
|
||||
depends on GOLDFISH_FB
|
||||
|
@ -223,10 +223,10 @@ static int goldfish_getplaneinfo(FAR struct fb_vtable_s *vtable, int planeno,
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_fbinitialize
|
||||
* Name: goldfish_fb_register
|
||||
****************************************************************************/
|
||||
|
||||
int up_fbinitialize(int display)
|
||||
int goldfish_fb_register(int display, FAR void *regs, int irq)
|
||||
{
|
||||
FAR struct goldfish_fb_s *fb;
|
||||
uint32_t fmt;
|
||||
@ -256,8 +256,8 @@ int up_fbinitialize(int display)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
fb->base = (FAR void *)CONFIG_GOLDFISH_FB_BASE;
|
||||
fb->irq = CONFIG_GOLDFISH_FB_IRQ;
|
||||
fb->base = regs;
|
||||
fb->irq = irq;
|
||||
|
||||
fmt = getreg32(fb->base + GOLDFISH_FB_GET_FORMAT);
|
||||
|
||||
@ -300,38 +300,20 @@ int up_fbinitialize(int display)
|
||||
putreg32((uintptr_t)fb->planeinfo.fbmem,
|
||||
fb->base + GOLDFISH_FB_SET_BASE);
|
||||
|
||||
ret = fb_register_device(display, 0, (FAR struct fb_vtable_s *)fb);
|
||||
if (ret < 0)
|
||||
{
|
||||
goto err_fb_register_failed;
|
||||
}
|
||||
|
||||
g_goldfish_fb = fb;
|
||||
return OK;
|
||||
|
||||
err_fb_register_failed:
|
||||
irq_detach(fb->irq);
|
||||
err_irq_attach_failed:
|
||||
kmm_free(fb->planeinfo.fbmem);
|
||||
err_fbmem_alloc_failed:
|
||||
kmm_free(fb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_fbgetvplane
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane)
|
||||
{
|
||||
return vplane || display ? NULL : &(g_goldfish_fb->vtable);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_fbuninitialize
|
||||
****************************************************************************/
|
||||
|
||||
void up_fbuninitialize(int display)
|
||||
{
|
||||
if (display == 0)
|
||||
{
|
||||
FAR struct goldfish_fb_s *fb = g_goldfish_fb;
|
||||
|
||||
irq_detach(fb->irq);
|
||||
kmm_free(fb->planeinfo.fbmem);
|
||||
kmm_free(fb);
|
||||
g_goldfish_fb = NULL;
|
||||
}
|
||||
}
|
||||
|
63
include/nuttx/video/goldfish_fb.h
Normal file
63
include/nuttx/video/goldfish_fb.h
Normal file
@ -0,0 +1,63 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/video/goldfish_fb.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_VIDEO_GOLDFISH_FB_H
|
||||
#define __INCLUDE_NUTTX_VIDEO_GOLDFISH_FB_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_GOLDFISH_FB
|
||||
int goldfish_fb_register(int display, FAR void *regs, int irq);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_VIDEO_GOLDFISH_FB_H */
|
Loading…
Reference in New Issue
Block a user