arm: tegra: Fix broken boardinfo support in NCT
Q-Ha Park [Sun, 1 Dec 2013 23:23:24 +0000 (15:23 -0800)]
Fixes a mismatch between NCT definition for board_info fields.
Adds sysfs support for board_info as well.

Bug 1412441

Change-Id: I527312e0c73a5ec477b3cea4cf3a4bffee056d31
Reviewed-on: http://git-master/r/337868
Reviewed-by: Automatic_Commit_Validation_User
Tested-by: Q-Ha Park <qpark@nvidia.com>
Reviewed-by: Mitch Luban <mluban@nvidia.com>

arch/arm/mach-tegra/include/mach/nct.h
arch/arm/mach-tegra/nct_sysfs.c

index 2cee12a..fe8dfbd 100644 (file)
@@ -89,11 +89,15 @@ struct nct_ramdump_type {
 };
 
 struct nct_board_info_type {
-       u16 board_id;
-       u16 sku;
-       u16 fab;
-       u16 major_revision;
-       u16 minor_revision;
+       u32 proc_board_id;
+       u32 proc_sku;
+       u32 proc_fab;
+       u32 pmu_board_id;
+       u32 pmu_sku;
+       u32 pmu_fab;
+       u32 display_board_id;
+       u32 display_sku;
+       u32 display_fab;
 };
 
 union nct_tegra_emc_table_type {
index 0f81689..44d6b2e 100644 (file)
@@ -51,6 +51,8 @@ static const struct kobj_attribute cm_id_attr =
        __ATTR(cm_id, 0444, nct_item_show, 0);
 static const struct kobj_attribute lbh_id_attr =
        __ATTR(lbh_id, 0444, nct_item_show, 0);
+static const struct kobj_attribute boardinfo_id_attr =
+       __ATTR(boardinfo_id, 0444, nct_item_show, 0);
 static const struct kobj_attribute gps_id_attr =
        __ATTR(gps_id, 0444, nct_item_show, 0);
 static const struct kobj_attribute lcd_id_attr =
@@ -74,6 +76,7 @@ static const struct attribute *nct_item_attrs[] = {
        &bt_addr_attr.attr,
        &cm_id_attr.attr,
        &lbh_id_attr.attr,
+       &boardinfo_id_attr.attr,
        &gps_id_attr.attr,
        &lcd_id_attr.attr,
        &accelerometer_id_attr.attr,
@@ -129,6 +132,23 @@ static ssize_t nct_item_show(struct kobject *kobj,
                if (err < 0)
                        return 0;
                rval = sprintf(buf, "%04d\n", item.lbh_id.id);
+       } else if (attr == &boardinfo_id_attr) {
+               err = tegra_nct_read_item(NCT_ID_BOARD_INFO, &item);
+               if (err < 0)
+                       return 0;
+               rval = sprintf(buf,
+                       "Proc: %4u (sku: %u, fab: %u)\n"
+                       "PMU : %4u (sku: %u, fab: %u)\n"
+                       "Disp: %4u (sku: %u, fab: %u)\n",
+                       item.board_info.proc_board_id,
+                       item.board_info.proc_sku,
+                       item.board_info.proc_fab,
+                       item.board_info.pmu_board_id,
+                       item.board_info.pmu_sku,
+                       item.board_info.pmu_fab,
+                       item.board_info.display_board_id,
+                       item.board_info.display_sku,
+                       item.board_info.display_fab);
        } else if (attr == &gps_id_attr) {
                err = tegra_nct_read_item(NCT_ID_GPS_ID, &item);
                if (err < 0)