[PATCH v2] psb_intel_lvds: add support for MM platform to fixi2c adapter
number mismatch issue

v2: fix typo and remove unused callback

Patch against kernel-adaptation-mrst-2.6.37.6-8.1.

For the I2C adapter number to read EDID in MM platform is 0, add a new
DMI match list to solve this issue.
And, there are 3 I2C adapter numbers in Moorestown platform, using
driver_data to denote which I2C adapter number is selected.

Reported-and-tested-by: Jeff Cheng <[email protected]>
Signed-off-by: Major Lee <[email protected]>
---
 psb_intel_lvds.c |   30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

--- linux-2.6.37.6.bak/drivers/staging/mrst/drv/psb_intel_lvds.c
2011-04-12 09:59:52.500482563 +0800
+++ linux-2.6.37.6/drivers/staging/mrst/drv/psb_intel_lvds.c
2011-04-26 13:28:21.531250000 +0800
@@ -1225,19 +1225,27 @@ mrst_lvds_get_configuration_mode(struct 
        return mode;
 }
 
-static int __init psb_lvds_i2c_adap_callback(const struct dmi_system_id
*id)
-{
-       DRM_DEBUG_KMS("This is an Intel platform of %s\n", id->ident);
-       return 1;
-}
-
 static const struct dmi_system_id psb_lvds_i2c_adap_table[] = {
        {
-               .callback = psb_lvds_i2c_adap_callback,
                .ident = "Intel OakTrail",
                .matches = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "OakTrail
platform"),
                },
+               .driver_data = (void *)1,
+       },
+       {
+               .ident = "Intel Moorestown",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "MM"),
+               },
+               .driver_data = (void *)0,
+       },
+       {
+               .ident = "Intel Moorestown",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "MM 10"),
+               },
+               .driver_data = (void *)0,
        },
 
        { }     /* terminating entry */
@@ -1263,6 +1271,7 @@ void mrst_lvds_init(struct drm_device *d
        int i2c_adap_num;
        struct i2c_adapter *i2c_adap;
        struct drm_display_mode *scan;  /* *modes, *bios_mode; */
+       const struct dmi_system_id *dmi;
 
        PSB_DEBUG_ENTRY("\n");
 
@@ -1314,10 +1323,11 @@ void mrst_lvds_init(struct drm_device *d
         * 4) make sure lid is open
         *    if closed, act like it's not there for now
         */
-        if (dmi_check_system(psb_lvds_i2c_adap_table))
-               i2c_adap_num = 1;
+       dmi = dmi_first_match(psb_lvds_i2c_adap_table);
+       if (dmi)
+               i2c_adap_num = (int)dmi->driver_data;
        else
-               i2c_adap_num = 2;
+               i2c_adap_num = 2; /* default num if not match */
 
        i2c_adap = i2c_get_adapter(i2c_adap_num);
 
[PATCH v2] psb_intel_lvds: add support for MM platform to fixi2c adapter
number mismatch issue

v2: fix typo and remove unesed callback

Patch against kernel-adaptation-mrst-2.6.37.6-8.1.

For the I2C adapter number to read EDID in MM platform is 0, add a new
DMI match list to solve this issue.
And, there are 3 I2C adapter numbers in Moorestown platform, using
driver_data to denote which I2C adapter number is selected.

Reported-and-tested-by: Jeff Cheng <[email protected]>
Signed-off-by: Major Lee <[email protected]>
---
 psb_intel_lvds.c |   30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

--- linux-2.6.37.6.bak/drivers/staging/mrst/drv/psb_intel_lvds.c
2011-04-12 09:59:52.500482563 +0800
+++ linux-2.6.37.6/drivers/staging/mrst/drv/psb_intel_lvds.c
2011-04-26 13:28:21.531250000 +0800
@@ -1225,19 +1225,27 @@ mrst_lvds_get_configuration_mode(struct 
        return mode;
 }
 
-static int __init psb_lvds_i2c_adap_callback(const struct dmi_system_id
*id)
-{
-       DRM_DEBUG_KMS("This is an Intel platform of %s\n", id->ident);
-       return 1;
-}
-
 static const struct dmi_system_id psb_lvds_i2c_adap_table[] = {
        {
-               .callback = psb_lvds_i2c_adap_callback,
                .ident = "Intel OakTrail",
                .matches = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "OakTrail
platform"),
                },
+               .driver_data = (void *)1,
+       },
+       {
+               .ident = "Intel Moorestown",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "MM"),
+               },
+               .driver_data = (void *)0,
+       },
+       {
+               .ident = "Intel Moorestown",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "MM 10"),
+               },
+               .driver_data = (void *)0,
        },
 
        { }     /* terminating entry */
@@ -1263,6 +1271,7 @@ void mrst_lvds_init(struct drm_device *d
        int i2c_adap_num;
        struct i2c_adapter *i2c_adap;
        struct drm_display_mode *scan;  /* *modes, *bios_mode; */
+       const struct dmi_system_id *dmi;
 
        PSB_DEBUG_ENTRY("\n");
 
@@ -1314,10 +1323,11 @@ void mrst_lvds_init(struct drm_device *d
         * 4) make sure lid is open
         *    if closed, act like it's not there for now
         */
-        if (dmi_check_system(psb_lvds_i2c_adap_table))
-               i2c_adap_num = 1;
+       dmi = dmi_first_match(psb_lvds_i2c_adap_table);
+       if (dmi)
+               i2c_adap_num = (int)dmi->driver_data;
        else
-               i2c_adap_num = 2;
+               i2c_adap_num = 2; /* default num if not match */
 
        i2c_adap = i2c_get_adapter(i2c_adap_num);
 

Attachment: psb_intel_lvds-add-support-for-mm-to-fix-i2c-adap-num-v2.patch
Description: psb_intel_lvds-add-support-for-mm-to-fix-i2c-adap-num-v2.patch

_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to