@@ -117,10 +117,15 @@ static inline int omap1_i2c_add_bus(int bus_id)
* XXX This function is a temporary compatibility wrapper - only
* needed until the I2C driver can be converted to call
* omap_pm_set_max_dev_wakeup_lat() and handle a return code.
+ *
+ * The PM QOS handle is stored in the corresponding omap_device struct.
*/
static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev, long t)
{
- omap_pm_set_max_mpu_wakeup_lat(dev, t);
+ struct omap_device *od = to_omap_device(to_platform_device(dev));
+
+ if (od->pm_qos_request)
+ omap_pm_set_max_mpu_wakeup_lat(od->pm_qos_request, t);
}
static struct omap_device_pm_latency omap_i2c_latency[] = {
@@ -160,11 +165,26 @@ static inline int omap2_i2c_add_bus(int bus_id)
*/
if (cpu_is_omap34xx())
pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
+
od = omap_device_build(name, bus_id, oh, pdata,
sizeof(struct omap_i2c_bus_platform_data),
omap_i2c_latency, ARRAY_SIZE(omap_i2c_latency), 0);
WARN(IS_ERR(od), "Could not build omap_device for %s\n", name);
+ /* Allocate the PM QOS handle and initialize it */
+ if ((!(IS_ERR(od))) && cpu_is_omap34xx()) {
+ od->pm_qos_request = kzalloc(sizeof(struct pm_qos_request_list),
+ GFP_KERNEL);
+ if (od->pm_qos_request) {
+ pm_qos_add_request(od->pm_qos_request,
+ PM_QOS_CPU_DMA_LATENCY,
+ PM_QOS_DEFAULT_VALUE);
+ } else {
+ WARN(1, "%s: could not reserve memory for "
+ "pm_qos_request\n", __func__);
+ }
+ }
+
return PTR_ERR(od);
}
#else