ARM: tegra12: set CPU rate to 2.2GHz for sku 0x87
[linux-3.10.git] / arch / arm / mach-tegra / nct_sysfs.c
index 1f71961..44d6b2e 100644 (file)
@@ -51,6 +51,24 @@ 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 =
+       __ATTR(lcd_id, 0444, nct_item_show, 0);
+static const struct kobj_attribute accelerometer_id_attr =
+       __ATTR(accelerometer_id, 0444, nct_item_show, 0);
+static const struct kobj_attribute compass_id_attr =
+       __ATTR(compass_id, 0444, nct_item_show, 0);
+static const struct kobj_attribute gyroscope_id_attr =
+       __ATTR(gyroscope_id, 0444, nct_item_show, 0);
+static const struct kobj_attribute light_id_attr =
+       __ATTR(light_id, 0444, nct_item_show, 0);
+static const struct kobj_attribute charger_id_attr =
+       __ATTR(charger_id, 0444, nct_item_show, 0);
+static const struct kobj_attribute touch_id_attr =
+       __ATTR(touch_id, 0444, nct_item_show, 0);
 
 static const struct attribute *nct_item_attrs[] = {
        &serial_number_attr.attr,
@@ -58,6 +76,15 @@ 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,
+       &compass_id_attr.attr,
+       &gyroscope_id_attr.attr,
+       &light_id_attr.attr,
+       &charger_id_attr.attr,
+       &touch_id_attr.attr,
        NULL
 };
 
@@ -105,6 +132,63 @@ 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)
+                       return 0;
+               rval = sprintf(buf, "%04d\n", item.gps_id.id);
+       } else if (attr == &lcd_id_attr) {
+               err = tegra_nct_read_item(NCT_ID_LCD_ID, &item);
+               if (err < 0)
+                       return 0;
+               rval = sprintf(buf, "%04d\n", item.lcd_id.id);
+       } else if (attr == &accelerometer_id_attr) {
+               err = tegra_nct_read_item(NCT_ID_ACCELEROMETER_ID, &item);
+               if (err < 0)
+                       return 0;
+               rval = sprintf(buf, "%04d\n", item.accelerometer_id.id);
+       } else if (attr == &compass_id_attr) {
+               err = tegra_nct_read_item(NCT_ID_COMPASS_ID, &item);
+               if (err < 0)
+                       return 0;
+               rval = sprintf(buf, "%04d\n", item.compass_id.id);
+       } else if (attr == &gyroscope_id_attr) {
+               err = tegra_nct_read_item(NCT_ID_GYROSCOPE_ID, &item);
+               if (err < 0)
+                       return 0;
+               rval = sprintf(buf, "%04d\n", item.gyroscope_id.id);
+       } else if (attr == &light_id_attr) {
+               err = tegra_nct_read_item(NCT_ID_LIGHT_ID, &item);
+               if (err < 0)
+                       return 0;
+               rval = sprintf(buf, "%04d\n", item.light_id.id);
+       } else if (attr == &charger_id_attr) {
+               err = tegra_nct_read_item(NCT_ID_CHARGER_ID, &item);
+               if (err < 0)
+                       return 0;
+               rval = sprintf(buf, "%04d\n", item.charger_id.id);
+       } else if (attr == &touch_id_attr) {
+               err = tegra_nct_read_item(NCT_ID_TOUCH_ID, &item);
+               if (err < 0)
+                       return 0;
+               rval = sprintf(buf, "%04d\n", item.touch_id.id);
        }
 
        return rval;