Ben Skeggs 71e9b6
From 74ef65374ae6d0eead4a631aea3aca80d016ff0f Mon Sep 17 00:00:00 2001
Ben Skeggs 71e9b6
From: Francisco Jerez <currojerez@riseup.net>
Ben Skeggs 71e9b6
Date: Thu, 22 Jul 2010 17:07:38 +0200
Ben Skeggs 71e9b6
Subject: [PATCH 1/5] drm-simplify-i2c-config
Ben Skeggs 71e9b6
Ben Skeggs 71e9b6
drm/kms: Simplify setup of the initial I2C encoder config.
Ben Skeggs 71e9b6
Ben Skeggs 71e9b6
In most use cases the driver will be using the same static config all
Ben Skeggs 71e9b6
the time: interpreting i2c_board_info::platform_data as the default
Ben Skeggs 71e9b6
config we can can save the GPU driver a redundant set_config() call.
Ben Skeggs 71e9b6
Ben Skeggs 71e9b6
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Ben Skeggs 71e9b6
Signed-off-by: Dave Airlie <airlied@redhat.com>
Ben Skeggs 71e9b6
---
Ben Skeggs 71e9b6
 drivers/gpu/drm/drm_encoder_slave.c |    7 +++++++
Ben Skeggs 71e9b6
 1 files changed, 7 insertions(+), 0 deletions(-)
Ben Skeggs 71e9b6
Ben Skeggs 71e9b6
diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c
Ben Skeggs 71e9b6
index f018469..d62c064 100644
Ben Skeggs 71e9b6
--- a/drivers/gpu/drm/drm_encoder_slave.c
Ben Skeggs 71e9b6
+++ b/drivers/gpu/drm/drm_encoder_slave.c
Ben Skeggs 71e9b6
@@ -41,6 +41,9 @@
Ben Skeggs 71e9b6
  * &drm_encoder_slave. The @slave_funcs field will be initialized with
Ben Skeggs 71e9b6
  * the hooks provided by the slave driver.
Ben Skeggs 71e9b6
  *
Ben Skeggs 71e9b6
+ * If @info->platform_data is non-NULL it will be used as the initial
Ben Skeggs 71e9b6
+ * slave config.
Ben Skeggs 71e9b6
+ *
Ben Skeggs 71e9b6
  * Returns 0 on success or a negative errno on failure, in particular,
Ben Skeggs 71e9b6
  * -ENODEV is returned when no matching driver is found.
Ben Skeggs 71e9b6
  */
Ben Skeggs 71e9b6
@@ -85,6 +88,10 @@ int drm_i2c_encoder_init(struct drm_device *dev,
Ben Skeggs 71e9b6
 	if (err)
Ben Skeggs 71e9b6
 		goto fail_unregister;
Ben Skeggs 71e9b6
 
Ben Skeggs 71e9b6
+	if (info->platform_data)
Ben Skeggs 71e9b6
+		encoder->slave_funcs->set_config(&encoder->base,
Ben Skeggs 71e9b6
+						 info->platform_data);
Ben Skeggs 71e9b6
+
Ben Skeggs 71e9b6
 	return 0;
Ben Skeggs 71e9b6
 
Ben Skeggs 71e9b6
 fail_unregister:
Ben Skeggs 71e9b6
-- 
Ben Skeggs 71e9b6
1.7.2
Ben Skeggs 71e9b6