panel: Expand the backlight support

At present the panel can be turned on but not off, and the brightness
cannot be controlled at run-time. Add a new API function to both the panel
and backlight uclasses to handle this. Enhance the PWM backlight driver
to deal with custom levels properly and allow the backlight to be turned
on and off.

Update the test to cover thes new features.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/video/panel-uclass.c b/drivers/video/panel-uclass.c
index aec44a8..246d1b2 100644
--- a/drivers/video/panel-uclass.c
+++ b/drivers/video/panel-uclass.c
@@ -18,6 +18,24 @@
 	return ops->enable_backlight(dev);
 }
 
+/**
+ * panel_set_backlight - Set brightness for the panel backlight
+ *
+ * @dev:	Panel device containing the backlight to update
+ * @percent:	Brightness value (0=off, 1=min brightness,
+ *		100=full brightness)
+ * @return 0 if OK, -ve on error
+ */
+int panel_set_backlight(struct udevice *dev, int percent)
+{
+	struct panel_ops *ops = panel_get_ops(dev);
+
+	if (!ops->set_backlight)
+		return -ENOSYS;
+
+	return ops->set_backlight(dev, percent);
+}
+
 int panel_get_display_timing(struct udevice *dev,
 			     struct display_timing *timings)
 {