Re: [PATCH 3/6] OMAP: PM: register to the per-device PM QoS framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 17, 2011 at 10:24 PM, Kevin Hilman <khilman@xxxxxx> wrote:
> jean.pihet@xxxxxxxxxxxxxx writes:
>
>> From: Jean Pihet <j-pihet@xxxxxx>
>>
>> Implement the devices wake-up latency constraints using the global
>> device PM QoS notification handler which applies the constraints to the
>> underlying layer by calling the corresponding function at hwmod level.
>>
>> Tested on OMAP3 Beagleboard and OMAP4 Pandaboard in RET/OFF using wake-up
>> latency constraints on MPU, CORE and PER.
>>
>> Signed-off-by: Jean Pihet <j-pihet@xxxxxx>
...

>> +/* Interface to the per-device PM QoS framework */
>> +static int omap2_dev_pm_qos_handler(struct notifier_block *nb,
>> +                                 unsigned long new_value,
>> +                                 void *req)
>> +{
>> +     struct omap_device *od;
>> +     struct omap_hwmod *oh;
>> +     struct platform_device *pdev;
>> +     struct dev_pm_qos_request *dev_pm_qos_req = req;
>> +
>> +     pr_debug("OMAP PM CONSTRAINTS: req@0x%p, new_value=%lu\n",
>
> s/CONSTRAINTS/constraints/
> another one below.
Ok

>
>> +              req, new_value);
>> +
>> +     /* Look for the platform device for the constraint target device */
>> +     pdev = to_platform_device(dev_pm_qos_req->dev);
>> +
>> +     /* Try to catch non platform devices */
>
> why?
The constraints targets are the power domains, which you find by
walking through the chain of structs dev, pdev, omap_device, hwmod and
finally pwrdm.

>
>> +     if (pdev->name == NULL) {
>> +             pr_err("%s: Error: platform device for device %s not valid\n",
>> +                    __func__, dev_name(dev_pm_qos_req->dev));
>> +             return -EINVAL;
>> +     }
>> +
>> +     /* Find the associated omap_device for dev */
>> +     od = container_of(pdev, struct omap_device, pdev);
>
> What about devices that are valid platform_devices, but not omap_devices?
Do you mean that od should be tested for NULL value?

>
>> +     if (od->hwmods_cnt != 1) {
>> +             pr_err("%s: Error: No unique hwmod for device %s\n",
>> +                    __func__, dev_name(dev_pm_qos_req->dev));
>> +             return -EINVAL;
>> +     }
>> +
>> +     /* Find the primary omap_hwmod for dev */
>> +     oh = od->hwmods[0];
>> +
>> +     pr_debug("OMAP PM CONSTRAINTS: req@0x%p, dev=0x%p, new_value=%lu\n",
>> +              req, dev_pm_qos_req->dev, new_value);
>> +
>> +     /* Apply the constraint */
>> +     return omap_hwmod_set_wkup_lat_constraint(oh, dev_pm_qos_req,
>> +                                               new_value);
>> +}
>> +
>> +static struct notifier_block omap2_dev_pm_qos_notifier = {
>> +     .notifier_call  = omap2_dev_pm_qos_handler,
>> +};
>> +
>> +static int __init omap2_dev_pm_qos_init(void)
>> +{
>> +     int ret;
>> +
>> +     ret = dev_pm_qos_add_global_notifier(&omap2_dev_pm_qos_notifier);
>> +     if (ret)
>> +             WARN(1, KERN_ERR "Cannot add global notifier for dev PM QoS\n");
>
> minor: could use WARN_ON()
Ok

>
>> +     return ret;
>> +}
>> +
>>  static int __init omap2_common_pm_init(void)
>>  {
>>       omap2_init_processor_devices();
>>       omap_pm_if_init();
>>
>> +     /* Register to the per-device PM QoS framework */
>> +     omap2_dev_pm_qos_init();
>> +
>>       return 0;
>>  }
>>  postcore_initcall(omap2_common_pm_init);
>
> Kevin
>

Thanks,
Jean
_______________________________________________
linux-pm mailing list
linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/linux-pm



[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux