+/*
+ * This function gets called when a part of the kernel has a new latency
+ * requirement. We record this requirement to instruct us to get temperature.
+ */
+static int tsadc_latency_notify(struct notifier_block *b,
+ unsigned long l, void *v)
+{
+ struct rk3368_thermal_data *ctx = rk3368_thermal_get_data();
+
+ if (!ctx)
+ return NOTIFY_OK;
+
+ mutex_lock(&thermal_lat_mutex);
+ ctx->latency_req = (int)l;
+ mutex_unlock(&thermal_lat_mutex);
+
+ return NOTIFY_OK;
+}
+
+static struct notifier_block tsadc_latency_notifier = {
+ .notifier_call = tsadc_latency_notify,
+};
+
+static inline int tsadc_add_latency_notifier(struct notifier_block *n)
+{
+ return pm_qos_add_notifier(PM_QOS_CPU_DMA_LATENCY, n);
+}
+
+static inline int tsadc_remove_latency_notifier(struct notifier_block *n)
+{
+ return pm_qos_remove_notifier(PM_QOS_CPU_DMA_LATENCY, n);
+}
+