• Tony Lindgren's avatar
    w1: omap-hdq: Simplify driver with PM runtime autosuspend · 27d13da8
    Tony Lindgren authored
    We've had generic code handling module sysconfig and OCP reset registers
    for omap variants for many years now and all the drivers really needs to
    do is just call runtime PM functions.
    
    Looks like the omap-hdq driver got only partially updated over the years
    to use runtime PM, and still has lots of custom PM code left.
    
    We can replace all the custom code for sysconfig, OCP reset, and PM with
    just a few lines of runtime PM autosuspend code.
    
    In order to set the device mode properly when pm_runtime_get_sync() is
    called during probe, we need to also move parsing of "ti,mode" to happen
    earlier before we call pm_runtime_enable().
    
    Since we now disable interrupts lazily in omap_hdq_runtime_suspend(), we
    must remove the call to hdq_disable_interrupt() in omap_w1_read_byte().
    And we must clear irqstatus calling wait_event_timeout() on it, so let's
    add hdq_reset_irqstatus() for that.
    
    Note that the earlier driver specific usage count limit of four seems
    completely artificial and should not be an issue in normal use.
    
    Cc: Adam Ford <aford173@gmail.com>
    Cc: Andrew F. Davis <afd@ti.com>
    Cc: Andreas Kemnade <andreas@kemnade.info>
    Cc: H. Nikolaus Schaller <hns@goldelico.com>
    Cc: Vignesh R <vigneshr@ti.com>
    Tested-by: Andreas Kemnade <andreas@kemnade.info> # gta04
    Tested-by: Adam Ford <aford173@gmail.com> #logicpd-torpedo-37xx-devkit
    Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
    Link: https://lore.kernel.org/r/20191217004048.46298-1-tony@atomide.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    27d13da8
omap_hdq.c 16.2 KB