|
@@ -1,5 +1,5 @@
|
|
/*
|
|
/*
|
|
- * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
|
|
|
|
|
|
+ * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
|
|
*
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
@@ -143,30 +143,25 @@ gk20a_volt = {
|
|
};
|
|
};
|
|
|
|
|
|
int
|
|
int
|
|
-gk20a_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt)
|
|
|
|
|
|
+_gk20a_volt_ctor(struct nvkm_device *device, int index,
|
|
|
|
+ const struct cvb_coef *coefs, int nb_coefs,
|
|
|
|
+ struct gk20a_volt *volt)
|
|
{
|
|
{
|
|
struct nvkm_device_tegra *tdev = device->func->tegra(device);
|
|
struct nvkm_device_tegra *tdev = device->func->tegra(device);
|
|
- struct gk20a_volt *volt;
|
|
|
|
int i, uv;
|
|
int i, uv;
|
|
|
|
|
|
- if (!(volt = kzalloc(sizeof(*volt), GFP_KERNEL)))
|
|
|
|
- return -ENOMEM;
|
|
|
|
-
|
|
|
|
nvkm_volt_ctor(&gk20a_volt, device, index, &volt->base);
|
|
nvkm_volt_ctor(&gk20a_volt, device, index, &volt->base);
|
|
- *pvolt = &volt->base;
|
|
|
|
|
|
|
|
uv = regulator_get_voltage(tdev->vdd);
|
|
uv = regulator_get_voltage(tdev->vdd);
|
|
- nvkm_info(&volt->base.subdev, "The default voltage is %duV\n", uv);
|
|
|
|
|
|
+ nvkm_debug(&volt->base.subdev, "the default voltage is %duV\n", uv);
|
|
|
|
|
|
volt->vdd = tdev->vdd;
|
|
volt->vdd = tdev->vdd;
|
|
|
|
|
|
- volt->base.vid_nr = ARRAY_SIZE(gk20a_cvb_coef);
|
|
|
|
- nvkm_debug(&volt->base.subdev, "%s - vid_nr = %d\n", __func__,
|
|
|
|
- volt->base.vid_nr);
|
|
|
|
|
|
+ volt->base.vid_nr = nb_coefs;
|
|
for (i = 0; i < volt->base.vid_nr; i++) {
|
|
for (i = 0; i < volt->base.vid_nr; i++) {
|
|
volt->base.vid[i].vid = i;
|
|
volt->base.vid[i].vid = i;
|
|
volt->base.vid[i].uv =
|
|
volt->base.vid[i].uv =
|
|
- gk20a_volt_calc_voltage(&gk20a_cvb_coef[i],
|
|
|
|
|
|
+ gk20a_volt_calc_voltage(&coefs[i],
|
|
tdev->gpu_speedo);
|
|
tdev->gpu_speedo);
|
|
nvkm_debug(&volt->base.subdev, "%2d: vid=%d, uv=%d\n", i,
|
|
nvkm_debug(&volt->base.subdev, "%2d: vid=%d, uv=%d\n", i,
|
|
volt->base.vid[i].vid, volt->base.vid[i].uv);
|
|
volt->base.vid[i].vid, volt->base.vid[i].uv);
|
|
@@ -174,3 +169,17 @@ gk20a_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt)
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+int
|
|
|
|
+gk20a_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt)
|
|
|
|
+{
|
|
|
|
+ struct gk20a_volt *volt;
|
|
|
|
+
|
|
|
|
+ volt = kzalloc(sizeof(*volt), GFP_KERNEL);
|
|
|
|
+ if (!volt)
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+ *pvolt = &volt->base;
|
|
|
|
+
|
|
|
|
+ return _gk20a_volt_ctor(device, index, gk20a_cvb_coef,
|
|
|
|
+ ARRAY_SIZE(gk20a_cvb_coef), volt);
|
|
|
|
+}
|