lkml.org 
[lkml]   [2018]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.9 05/74] i2c: i801: store and restore the SLVCMD register at load and unload
    Date
    4.9-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Benjamin Tissoires <benjamin.tissoires@redhat.com>

    commit 22e94bd6779e1140350c0792e85c79552ec43673 upstream.

    Also do not override any other configuration in this register.

    Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
    Cc: Jean Delvare <jdelvare@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/i2c/busses/i2c-i801.c | 17 ++++++++++++++++-
    1 file changed, 16 insertions(+), 1 deletion(-)

    --- a/drivers/i2c/busses/i2c-i801.c
    +++ b/drivers/i2c/busses/i2c-i801.c
    @@ -243,6 +243,7 @@ struct i801_priv {
    struct i2c_adapter adapter;
    unsigned long smba;
    unsigned char original_hstcfg;
    + unsigned char original_slvcmd;
    struct pci_dev *pci_dev;
    unsigned int features;

    @@ -962,13 +963,26 @@ static int i801_enable_host_notify(struc
    if (!priv->host_notify)
    return -ENOMEM;

    - outb_p(SMBSLVCMD_HST_NTFY_INTREN, SMBSLVCMD(priv));
    + priv->original_slvcmd = inb_p(SMBSLVCMD(priv));
    +
    + if (!(SMBSLVCMD_HST_NTFY_INTREN & priv->original_slvcmd))
    + outb_p(SMBSLVCMD_HST_NTFY_INTREN | priv->original_slvcmd,
    + SMBSLVCMD(priv));
    +
    /* clear Host Notify bit to allow a new notification */
    outb_p(SMBSLVSTS_HST_NTFY_STS, SMBSLVSTS(priv));

    return 0;
    }

    +static void i801_disable_host_notify(struct i801_priv *priv)
    +{
    + if (!(priv->features & FEATURE_HOST_NOTIFY))
    + return;
    +
    + outb_p(priv->original_slvcmd, SMBSLVCMD(priv));
    +}
    +
    static const struct i2c_algorithm smbus_algorithm = {
    .smbus_xfer = i801_access,
    .functionality = i801_func,
    @@ -1666,6 +1680,7 @@ static void i801_remove(struct pci_dev *
    pm_runtime_forbid(&dev->dev);
    pm_runtime_get_noresume(&dev->dev);

    + i801_disable_host_notify(priv);
    i801_del_mux(priv);
    i2c_del_adapter(&priv->adapter);
    i801_acpi_remove(priv);

    \
     
     \ /
      Last update: 2018-04-27 17:18    [W:4.778 / U:0.064 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site