hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/gpu/drm/rockchip/rockchip_drm_logo.c
....@@ -376,6 +376,69 @@
376376 return rockchip_drm_logo_fb_alloc(drm_dev, &mode_cmd, private->logo);
377377 }
378378
379
+static void of_parse_post_csc_info(struct device_node *route, struct rockchip_drm_mode_set *set)
380
+{
381
+ int val;
382
+
383
+ if (!of_property_read_u32(route, "post-csc,enable", &val))
384
+ set->csc.csc_enable = val;
385
+ else
386
+ set->csc.csc_enable = 0;
387
+
388
+ if (!set->csc.csc_enable)
389
+ return;
390
+
391
+ if (!of_property_read_u32(route, "post-csc,hue", &val))
392
+ set->csc.hue = val;
393
+ else
394
+ set->csc.hue = 256;
395
+
396
+ if (!of_property_read_u32(route, "post-csc,saturation", &val))
397
+ set->csc.saturation = val;
398
+ else
399
+ set->csc.saturation = 256;
400
+
401
+ if (!of_property_read_u32(route, "post-csc,contrast", &val))
402
+ set->csc.contrast = val;
403
+ else
404
+ set->csc.contrast = 256;
405
+
406
+ if (!of_property_read_u32(route, "post-csc,brightness", &val))
407
+ set->csc.brightness = val;
408
+ else
409
+ set->csc.brightness = 256;
410
+
411
+ if (!of_property_read_u32(route, "post-csc,r-gain", &val))
412
+ set->csc.r_gain = val;
413
+ else
414
+ set->csc.r_gain = 256;
415
+
416
+ if (!of_property_read_u32(route, "post-csc,g-gain", &val))
417
+ set->csc.g_gain = val;
418
+ else
419
+ set->csc.g_gain = 256;
420
+
421
+ if (!of_property_read_u32(route, "post-csc,b-gain", &val))
422
+ set->csc.b_gain = val;
423
+ else
424
+ set->csc.b_gain = 256;
425
+
426
+ if (!of_property_read_u32(route, "post-csc,r-offset", &val))
427
+ set->csc.r_offset = val;
428
+ else
429
+ set->csc.r_offset = 256;
430
+
431
+ if (!of_property_read_u32(route, "post-csc,g-offset", &val))
432
+ set->csc.g_offset = val;
433
+ else
434
+ set->csc.g_offset = 256;
435
+
436
+ if (!of_property_read_u32(route, "post-csc,b-offset", &val))
437
+ set->csc.b_offset = val;
438
+ else
439
+ set->csc.b_offset = 256;
440
+}
441
+
379442 static struct rockchip_drm_mode_set *
380443 of_parse_display_resource(struct drm_device *drm_dev, struct device_node *route)
381444 {
....@@ -469,6 +532,8 @@
469532 set->hue = val;
470533 else
471534 set->hue = 50;
535
+
536
+ of_parse_post_csc_info(route, set);
472537
473538 set->force_output = of_property_read_bool(route, "force-output");
474539
....@@ -746,7 +811,7 @@
746811
747812 if (priv->crtc_funcs[pipe] &&
748813 priv->crtc_funcs[pipe]->loader_protect)
749
- priv->crtc_funcs[pipe]->loader_protect(crtc, true);
814
+ priv->crtc_funcs[pipe]->loader_protect(crtc, true, &set->csc);
750815 }
751816
752817 if (!set->fb) {
....@@ -798,7 +863,7 @@
798863
799864 error_crtc:
800865 if (priv->crtc_funcs[pipe] && priv->crtc_funcs[pipe]->loader_protect)
801
- priv->crtc_funcs[pipe]->loader_protect(crtc, false);
866
+ priv->crtc_funcs[pipe]->loader_protect(crtc, false, NULL);
802867 error_conn:
803868 if (set->sub_dev->loader_protect)
804869 set->sub_dev->loader_protect(conn_state->best_encoder, false);
....@@ -994,11 +1059,12 @@
9941059 unset);
9951060 if (priv->crtc_funcs[pipe] &&
9961061 priv->crtc_funcs[pipe]->loader_protect)
997
- priv->crtc_funcs[pipe]->loader_protect(crtc, true);
1062
+ priv->crtc_funcs[pipe]->loader_protect(crtc, true,
1063
+ &unset->csc);
9981064 priv->crtc_funcs[pipe]->crtc_close(crtc);
9991065 if (priv->crtc_funcs[pipe] &&
10001066 priv->crtc_funcs[pipe]->loader_protect)
1001
- priv->crtc_funcs[pipe]->loader_protect(crtc, false);
1067
+ priv->crtc_funcs[pipe]->loader_protect(crtc, false, NULL);
10021068 }
10031069 }
10041070