]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
platform: tegra: MC: Add new LA API
authorAlex Waterman <alexw@nvidia.com>
Thu, 30 Apr 2015 19:22:20 +0000 (12:22 -0700)
committerAlex Waterman <alexw@nvidia.com>
Mon, 11 May 2015 21:26:48 +0000 (14:26 -0700)
Add a new latency allowance API to check if a possible LA value exists
for a given frequency/BW combination. The other API for this always
programs the LA if it turns out there is a possible LA value. This new
API is just a check and as such does not program the computed LA.

Bug 1637311

Change-Id: Ie71762f50d093d6482c7c088615dd198cf65dc84
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/737900
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
drivers/platform/tegra/mc/la_priv.h
drivers/platform/tegra/mc/latency_allowance.c
drivers/platform/tegra/mc/tegra12x_la.c
drivers/platform/tegra/mc/tegra21x_la.c

index 6afac027472ac07be970dead46cd8481bb43671d..5fd055d49c25a584f8fb30b9c33e75ed94451542 100644 (file)
@@ -443,6 +443,10 @@ struct la_chip_specific {
                                unsigned long emc_freq_hz,
                                unsigned int bw_mbps,
                                struct dc_to_la_params disp_params);
+       int (*check_disp_la)(enum tegra_la_id id,
+                               unsigned long emc_freq_hz,
+                               unsigned int bw_mbps,
+                               struct dc_to_la_params disp_params);
        int (*set_la)(enum tegra_la_id id, unsigned int bw_mbps);
        int (*enable_la_scaling)(enum tegra_la_id id,
                                unsigned int threshold_low,
index 6f0ac797cd606968506a198b773e33110717d3ec..effdc7413af4e83f0b87e9f3b8ff6010d4614303 100644 (file)
@@ -286,6 +286,22 @@ int tegra_set_disp_latency_allowance(enum tegra_la_id id,
        return 0;
 }
 
+/*
+ * Check if the passed bandwidth is possible.
+ *
+ * Returns zero if there is a possible LA value that can satifsy @bw_mbps at
+ * @emc_freq_hz. If no function has been defined for the active chip then this
+ * this function returns true (i.e 0).
+ */
+int tegra_check_disp_latency_allowance(enum tegra_la_id id,
+                                      unsigned long emc_freq_hz,
+                                      unsigned int bw_mbps,
+                                      struct dc_to_la_params disp_params) {
+       if (cs.check_disp_la)
+               return cs.check_disp_la(id, emc_freq_hz, bw_mbps, disp_params);
+       return 0;
+}
+
 /* Sets latency allowance based on clients memory bandwitdh requirement.
  * Bandwidth passed is in mega bytes per second.
  */
index 7b34a9787251dbb1ec23dd383f58fed742320b86..cceab1d510118a2e4197b8f4a22f67d1bcad4e36 100644 (file)
@@ -1018,10 +1018,11 @@ static unsigned int t12x_min_la(struct dc_to_la_params *disp_params)
        return T12X_LA_FP_TO_REAL(min_la_fp);
 }
 
-static int t12x_set_disp_la(enum tegra_la_id id,
-                               unsigned long emc_freq_hz,
-                               unsigned int bw_mbps,
-                               struct dc_to_la_params disp_params)
+static int t12x_handle_disp_la(enum tegra_la_id id,
+                              unsigned long emc_freq_hz,
+                              unsigned int bw_mbps,
+                              struct dc_to_la_params disp_params,
+                              int write_la)
 {
        int idx = 0;
        struct la_client_info *ci = NULL;
@@ -1095,10 +1096,27 @@ static int t12x_set_disp_la(enum tegra_la_id id,
        if (la_to_set < t12x_min_la(&disp_params))
                return -1;
 
-       program_la(ci, la_to_set);
+       if (write_la)
+               program_la(ci, la_to_set);
        return 0;
 }
 
+static int t12x_set_disp_la(enum tegra_la_id id,
+                           unsigned long emc_freq_hz,
+                           unsigned int bw_mbps,
+                           struct dc_to_la_params disp_params)
+{
+       return t12x_handle_disp_la(id, emc_freq_hz, bw_mbps, disp_params, 1);
+}
+
+static int t12x_check_disp_la(enum tegra_la_id id,
+                             unsigned long emc_freq_hz,
+                             unsigned int bw_mbps,
+                             struct dc_to_la_params disp_params)
+{
+       return t12x_handle_disp_la(id, emc_freq_hz, bw_mbps, disp_params, 0);
+}
+
 void tegra_la_get_t12x_specific(struct la_chip_specific *cs_la)
 {
        int i = 0;
@@ -1123,6 +1141,7 @@ void tegra_la_get_t12x_specific(struct la_chip_specific *cs_la)
        cs_la->update_camera_ptsa_rate = t12x_update_camera_ptsa_rate;
        cs_la->set_la = t12x_set_la;
        cs_la->set_disp_la = t12x_set_disp_la;
+       cs_la->check_disp_la = t12x_check_disp_la;
        cs_la->save_ptsa = save_ptsa;
        cs_la->program_ptsa = program_ptsa;
        cs_la->suspend = la_suspend;
index d5a9d0c1d23f554d6edd11b6d9fdd8a70b26fec8..a1d2760ba5385ee59e2b1f1f3efbaaa9ec60a544 100644 (file)
@@ -593,10 +593,11 @@ static unsigned int t21x_min_la(struct dc_to_la_params *disp_params)
        return LA_FP_TO_REAL(min_la_fp);
 }
 
-static int t21x_set_disp_la(enum tegra_la_id id,
-                               unsigned long emc_freq_hz,
-                               unsigned int bw_mbps,
-                               struct dc_to_la_params disp_params)
+static int t21x_handle_disp_la(enum tegra_la_id id,
+                              unsigned long emc_freq_hz,
+                              unsigned int bw_mbps,
+                              struct dc_to_la_params disp_params,
+                              int write_la)
 {
        int idx = 0;
        struct la_client_info *ci = NULL;
@@ -670,10 +671,27 @@ static int t21x_set_disp_la(enum tegra_la_id id,
        if ((la_to_set < t21x_min_la(&disp_params)) || (la_to_set > 255))
                return -1;
 
-       program_la(ci, la_to_set);
+       if (write_la)
+               program_la(ci, la_to_set);
        return 0;
 }
 
+static int t21x_set_disp_la(enum tegra_la_id id,
+                           unsigned long emc_freq_hz,
+                           unsigned int bw_mbps,
+                           struct dc_to_la_params disp_params)
+{
+       return t21x_handle_disp_la(id, emc_freq_hz, bw_mbps, disp_params, 1);
+}
+
+static int t21x_check_disp_la(enum tegra_la_id id,
+                             unsigned long emc_freq_hz,
+                             unsigned int bw_mbps,
+                             struct dc_to_la_params disp_params)
+{
+       return t21x_handle_disp_la(id, emc_freq_hz, bw_mbps, disp_params, 0);
+}
+
 void tegra_la_get_t21x_specific(struct la_chip_specific *cs_la)
 {
        int i = 0;
@@ -697,6 +715,7 @@ void tegra_la_get_t21x_specific(struct la_chip_specific *cs_la)
        cs_la->update_camera_ptsa_rate = t21x_update_camera_ptsa_rate;
        cs_la->set_la = t21x_set_la;
        cs_la->set_disp_la = t21x_set_disp_la;
+       cs_la->set_disp_la = t21x_check_disp_la;
        cs_la->save_ptsa = save_ptsa;
        cs_la->program_ptsa = program_ptsa;
        cs_la->suspend = la_suspend;