mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-29 06:31:28 +01:00
video: arm: rpi: Move the video query out of the driver
Add a function to get the video size to the msg handler and remove it from the video driver. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Anatolij Gustschin <agust@denx.de>
This commit is contained in:
parent
25877d4e4c
commit
2e4170b63b
@ -22,4 +22,13 @@ int bcm2835_power_on_module(u32 module);
|
|||||||
*/
|
*/
|
||||||
int bcm2835_get_mmc_clock(void);
|
int bcm2835_get_mmc_clock(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bcm2835_get_video_size() - get the current display size
|
||||||
|
*
|
||||||
|
* @widthp: Returns the width in pixels
|
||||||
|
* @heightp: Returns the height in pixels
|
||||||
|
* @return 0 if OK, -ve on error
|
||||||
|
*/
|
||||||
|
int bcm2835_get_video_size(int *widthp, int *heightp);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <memalign.h>
|
#include <memalign.h>
|
||||||
|
#include <phys2bus.h>
|
||||||
#include <asm/arch/mbox.h>
|
#include <asm/arch/mbox.h>
|
||||||
|
|
||||||
struct msg_set_power_state {
|
struct msg_set_power_state {
|
||||||
@ -20,6 +21,12 @@ struct msg_get_clock_rate {
|
|||||||
u32 end_tag;
|
u32 end_tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct msg_query {
|
||||||
|
struct bcm2835_mbox_hdr hdr;
|
||||||
|
struct bcm2835_mbox_tag_physical_w_h physical_w_h;
|
||||||
|
u32 end_tag;
|
||||||
|
};
|
||||||
|
|
||||||
int bcm2835_power_on_module(u32 module)
|
int bcm2835_power_on_module(u32 module)
|
||||||
{
|
{
|
||||||
ALLOC_CACHE_ALIGN_BUFFER(struct msg_set_power_state, msg_pwr, 1);
|
ALLOC_CACHE_ALIGN_BUFFER(struct msg_set_power_state, msg_pwr, 1);
|
||||||
@ -65,3 +72,22 @@ int bcm2835_get_mmc_clock(void)
|
|||||||
|
|
||||||
return msg_clk->get_clock_rate.body.resp.rate_hz;
|
return msg_clk->get_clock_rate.body.resp.rate_hz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bcm2835_get_video_size(int *widthp, int *heightp)
|
||||||
|
{
|
||||||
|
ALLOC_CACHE_ALIGN_BUFFER(struct msg_query, msg_query, 1);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
BCM2835_MBOX_INIT_HDR(msg_query);
|
||||||
|
BCM2835_MBOX_INIT_TAG_NO_REQ(&msg_query->physical_w_h,
|
||||||
|
GET_PHYSICAL_W_H);
|
||||||
|
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg_query->hdr);
|
||||||
|
if (ret) {
|
||||||
|
printf("bcm2835: Could not query display resolution\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
*widthp = msg_query->physical_w_h.body.resp.width;
|
||||||
|
*heightp = msg_query->physical_w_h.body.resp.height;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
#include <memalign.h>
|
#include <memalign.h>
|
||||||
#include <phys2bus.h>
|
#include <phys2bus.h>
|
||||||
#include <asm/arch/mbox.h>
|
#include <asm/arch/mbox.h>
|
||||||
|
#include <asm/arch/msg.h>
|
||||||
#include <asm/global_data.h>
|
#include <asm/global_data.h>
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
@ -18,12 +19,6 @@ vidinfo_t panel_info;
|
|||||||
|
|
||||||
static u32 bcm2835_pitch;
|
static u32 bcm2835_pitch;
|
||||||
|
|
||||||
struct msg_query {
|
|
||||||
struct bcm2835_mbox_hdr hdr;
|
|
||||||
struct bcm2835_mbox_tag_physical_w_h physical_w_h;
|
|
||||||
u32 end_tag;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct msg_setup {
|
struct msg_setup {
|
||||||
struct bcm2835_mbox_hdr hdr;
|
struct bcm2835_mbox_hdr hdr;
|
||||||
struct bcm2835_mbox_tag_physical_w_h physical_w_h;
|
struct bcm2835_mbox_tag_physical_w_h physical_w_h;
|
||||||
@ -40,27 +35,18 @@ struct msg_setup {
|
|||||||
|
|
||||||
void lcd_ctrl_init(void *lcdbase)
|
void lcd_ctrl_init(void *lcdbase)
|
||||||
{
|
{
|
||||||
ALLOC_CACHE_ALIGN_BUFFER(struct msg_query, msg_query, 1);
|
|
||||||
ALLOC_CACHE_ALIGN_BUFFER(struct msg_setup, msg_setup, 1);
|
ALLOC_CACHE_ALIGN_BUFFER(struct msg_setup, msg_setup, 1);
|
||||||
int ret;
|
int ret;
|
||||||
u32 w, h;
|
int w, h;
|
||||||
u32 fb_start, fb_end;
|
u32 fb_start, fb_end;
|
||||||
|
|
||||||
debug("bcm2835: Query resolution...\n");
|
debug("bcm2835: Query resolution...\n");
|
||||||
|
ret = bcm2835_get_video_size(&w, &h);
|
||||||
BCM2835_MBOX_INIT_HDR(msg_query);
|
|
||||||
BCM2835_MBOX_INIT_TAG_NO_REQ(&msg_query->physical_w_h,
|
|
||||||
GET_PHYSICAL_W_H);
|
|
||||||
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg_query->hdr);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printf("bcm2835: Could not query display resolution\n");
|
|
||||||
/* FIXME: How to disable the LCD to prevent errors? hang()? */
|
/* FIXME: How to disable the LCD to prevent errors? hang()? */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
w = msg_query->physical_w_h.body.resp.width;
|
|
||||||
h = msg_query->physical_w_h.body.resp.height;
|
|
||||||
|
|
||||||
debug("bcm2835: Setting up display for %d x %d\n", w, h);
|
debug("bcm2835: Setting up display for %d x %d\n", w, h);
|
||||||
|
|
||||||
BCM2835_MBOX_INIT_HDR(msg_setup);
|
BCM2835_MBOX_INIT_HDR(msg_setup);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user