|
|
@@ -33,6 +33,20 @@
|
|
|
|
|
|
static LIST_HEAD(module_list);
|
|
|
|
|
|
+static const u32 tilcdc_rev1_formats[] = { DRM_FORMAT_RGB565 };
|
|
|
+
|
|
|
+static const u32 tilcdc_straight_formats[] = { DRM_FORMAT_RGB565,
|
|
|
+ DRM_FORMAT_BGR888,
|
|
|
+ DRM_FORMAT_XBGR8888 };
|
|
|
+
|
|
|
+static const u32 tilcdc_crossed_formats[] = { DRM_FORMAT_BGR565,
|
|
|
+ DRM_FORMAT_RGB888,
|
|
|
+ DRM_FORMAT_XRGB8888 };
|
|
|
+
|
|
|
+static const u32 tilcdc_legacy_formats[] = { DRM_FORMAT_RGB565,
|
|
|
+ DRM_FORMAT_RGB888,
|
|
|
+ DRM_FORMAT_XRGB8888 };
|
|
|
+
|
|
|
void tilcdc_module_init(struct tilcdc_module *mod, const char *name,
|
|
|
const struct tilcdc_module_ops *funcs)
|
|
|
{
|
|
|
@@ -226,7 +240,6 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags)
|
|
|
struct platform_device *pdev = dev->platformdev;
|
|
|
struct device_node *node = pdev->dev.of_node;
|
|
|
struct tilcdc_drm_private *priv;
|
|
|
- struct tilcdc_module *mod;
|
|
|
struct resource *res;
|
|
|
u32 bpp = 0;
|
|
|
int ret;
|
|
|
@@ -318,6 +331,37 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags)
|
|
|
|
|
|
pm_runtime_put_sync(dev->dev);
|
|
|
|
|
|
+ if (priv->rev == 1) {
|
|
|
+ DBG("Revision 1 LCDC supports only RGB565 format");
|
|
|
+ priv->pixelformats = tilcdc_rev1_formats;
|
|
|
+ priv->num_pixelformats = ARRAY_SIZE(tilcdc_rev1_formats);
|
|
|
+ bpp = 16;
|
|
|
+ } else {
|
|
|
+ const char *str = "\0";
|
|
|
+
|
|
|
+ of_property_read_string(node, "blue-and-red-wiring", &str);
|
|
|
+ if (0 == strcmp(str, "crossed")) {
|
|
|
+ DBG("Configured for crossed blue and red wires");
|
|
|
+ priv->pixelformats = tilcdc_crossed_formats;
|
|
|
+ priv->num_pixelformats =
|
|
|
+ ARRAY_SIZE(tilcdc_crossed_formats);
|
|
|
+ bpp = 32; /* Choose bpp with RGB support for fbdef */
|
|
|
+ } else if (0 == strcmp(str, "straight")) {
|
|
|
+ DBG("Configured for straight blue and red wires");
|
|
|
+ priv->pixelformats = tilcdc_straight_formats;
|
|
|
+ priv->num_pixelformats =
|
|
|
+ ARRAY_SIZE(tilcdc_straight_formats);
|
|
|
+ bpp = 16; /* Choose bpp with RGB support for fbdef */
|
|
|
+ } else {
|
|
|
+ DBG("Blue and red wiring '%s' unknown, use legacy mode",
|
|
|
+ str);
|
|
|
+ priv->pixelformats = tilcdc_legacy_formats;
|
|
|
+ priv->num_pixelformats =
|
|
|
+ ARRAY_SIZE(tilcdc_legacy_formats);
|
|
|
+ bpp = 16; /* This is just a guess */
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
ret = modeset_init(dev);
|
|
|
if (ret < 0) {
|
|
|
dev_err(dev->dev, "failed to initialize mode setting\n");
|
|
|
@@ -331,7 +375,7 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags)
|
|
|
if (ret < 0)
|
|
|
goto fail_mode_config_cleanup;
|
|
|
|
|
|
- ret = tilcdc_add_external_encoders(dev, &bpp);
|
|
|
+ ret = tilcdc_add_external_encoders(dev);
|
|
|
if (ret < 0)
|
|
|
goto fail_component_cleanup;
|
|
|
}
|
|
|
@@ -354,15 +398,6 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags)
|
|
|
goto fail_vblank_cleanup;
|
|
|
}
|
|
|
|
|
|
- list_for_each_entry(mod, &module_list, list) {
|
|
|
- DBG("%s: preferred_bpp: %d", mod->name, mod->preferred_bpp);
|
|
|
- bpp = mod->preferred_bpp;
|
|
|
- if (bpp > 0)
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- drm_helper_disable_unused_functions(dev);
|
|
|
-
|
|
|
drm_mode_config_reset(dev);
|
|
|
|
|
|
priv->fbdev = drm_fbdev_cma_init(dev, bpp,
|