Commit b575b313 authored by Philipp Zabel's avatar Philipp Zabel

gpu: ipu-v3: ipu-dc: don't bug out on invalid bus_format

If imx-drm is combined with a bridge or panel that requests an
unsupported format, warn and use a default mapping instead of
hanging the machine. The worst that can happen here are wrong
colors.
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent 4f7a5129
...@@ -150,6 +150,9 @@ static void dc_write_tmpl(struct ipu_dc *dc, int word, u32 opcode, u32 operand, ...@@ -150,6 +150,9 @@ static void dc_write_tmpl(struct ipu_dc *dc, int word, u32 opcode, u32 operand,
static int ipu_bus_format_to_map(u32 fmt) static int ipu_bus_format_to_map(u32 fmt)
{ {
switch (fmt) { switch (fmt) {
default:
WARN_ON(1);
/* fall-through */
case MEDIA_BUS_FMT_RGB888_1X24: case MEDIA_BUS_FMT_RGB888_1X24:
return IPU_DC_MAP_RGB24; return IPU_DC_MAP_RGB24;
case MEDIA_BUS_FMT_RGB565_1X16: case MEDIA_BUS_FMT_RGB565_1X16:
...@@ -162,8 +165,6 @@ static int ipu_bus_format_to_map(u32 fmt) ...@@ -162,8 +165,6 @@ static int ipu_bus_format_to_map(u32 fmt)
return IPU_DC_MAP_LVDS666; return IPU_DC_MAP_LVDS666;
case MEDIA_BUS_FMT_BGR888_1X24: case MEDIA_BUS_FMT_BGR888_1X24:
return IPU_DC_MAP_BGR24; return IPU_DC_MAP_BGR24;
default:
return -EINVAL;
} }
} }
...@@ -178,7 +179,6 @@ int ipu_dc_init_sync(struct ipu_dc *dc, struct ipu_di *di, bool interlaced, ...@@ -178,7 +179,6 @@ int ipu_dc_init_sync(struct ipu_dc *dc, struct ipu_di *di, bool interlaced,
dc->di = ipu_di_get_num(di); dc->di = ipu_di_get_num(di);
map = ipu_bus_format_to_map(bus_format); map = ipu_bus_format_to_map(bus_format);
BUG_ON(map < 0);
/* /*
* In interlaced mode we need more counters to create the asymmetric * In interlaced mode we need more counters to create the asymmetric
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment