免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3206 | 回复: 1
打印 上一主题 下一主题

[硬件及驱动] 关于clk_enable()的奇怪问题 [复制链接]

论坛徽章:
17
水瓶座
日期:2013-08-29 12:09:27白羊座
日期:2014-08-07 12:36:42丑牛
日期:2014-07-24 12:44:41寅虎
日期:2014-04-16 16:15:33寅虎
日期:2014-03-12 09:28:43摩羯座
日期:2014-03-06 13:22:04技术图书徽章
日期:2014-03-06 11:34:50天蝎座
日期:2014-01-09 11:31:44寅虎
日期:2013-12-27 17:01:44双子座
日期:2013-12-27 12:32:29双子座
日期:2013-12-25 09:03:33丑牛
日期:2013-12-24 16:18:44
1 [报告]
发表于 2014-06-17 15:33 |显示全部楼层
回复 1# fjaygrfjaygr

git blame drivers/clk/clk.c

查下 commit 533ddeb1,解释的非常清楚!clk: allow reentrant calls into the clk framework!

论坛徽章:
17
水瓶座
日期:2013-08-29 12:09:27白羊座
日期:2014-08-07 12:36:42丑牛
日期:2014-07-24 12:44:41寅虎
日期:2014-04-16 16:15:33寅虎
日期:2014-03-12 09:28:43摩羯座
日期:2014-03-06 13:22:04技术图书徽章
日期:2014-03-06 11:34:50天蝎座
日期:2014-01-09 11:31:44寅虎
日期:2013-12-27 17:01:44双子座
日期:2013-12-27 12:32:29双子座
日期:2013-12-25 09:03:33丑牛
日期:2013-12-24 16:18:44
2 [报告]
发表于 2014-06-17 20:56 |显示全部楼层
回复 4# humjb_1983

commit 533ddeb1e86f506129ee388a6cc13796dcf31311
Author: Mike Turquette <mturquette@linaro.org>
Date:   Thu Mar 28 13:59:02 2013 -0700

    clk: allow reentrant calls into the clk framework

    Reentrancy into the clock framework is necessary for clock operations
    that result in nested calls to the clk api.  A common example is a clock
    that is prepared via an i2c transaction, such as a clock inside of a
    discrete audio chip or a power management IC.  The i2c subsystem itself
    will use the clk api resulting in a deadlock:

    clk_prepare(audio_clk)
        i2c_transfer(..)
                clk_prepare(i2c_controller_clk)

    The ability to reenter the clock framework prevents this deadlock.

    Other use cases exist such as allowing .set_rate callbacks to call
    clk_set_parent to achieve the best rate, or to save power in certain
    configurations.  Yet another example is performing pinctrl operations
    from a clk_ops callback.  Calls into the pinctrl subsystem may call
    clk_{un}prepare on an unrelated clock.  Allowing for nested calls to
    reenter the clock framework enables both of these use cases.

    Reentrancy is implemented by two global pointers that track the owner
    currently holding a global lock.  One pointer tracks the owner during
    sleepable, mutex-protected operations and the other one tracks the owner
    during non-interruptible, spinlock-protected operations.

    When the clk framework is entered we try to hold the global lock.  If it
    is held we compare the current task against the current owner; a match
    implies a nested call and we reenter.  If the values do not match then
    we block on the lock until it is released.

    Signed-off-by: Mike Turquette <mturquette@linaro.org>
    Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
    Cc: David Brown <davidb@codeaurora.org>
    Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP