]> git.baikalelectronics.ru Git - kernel.git/commitdiff
platform/x86: intel_mid_powerbtn: Convert to use new SCU IPC API
authorMika Westerberg <mika.westerberg@linux.intel.com>
Thu, 16 Apr 2020 08:15:37 +0000 (11:15 +0300)
committerLee Jones <lee.jones@linaro.org>
Fri, 24 Apr 2020 10:17:32 +0000 (11:17 +0100)
This converts the power button driver to use the new SCU IPC API where
the SCU IPC instance is passed to the functions.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/platform/x86/intel_mid_powerbtn.c

index 9c9f209c8a334b35f7d450bbd5f7695f265b8768..df434abbb66f18c20a9920314c33eace4a403a72 100644 (file)
@@ -46,6 +46,7 @@ struct mid_pb_ddata {
        unsigned short mirqlvl1_addr;
        unsigned short pbstat_addr;
        u8 pbstat_mask;
+       struct intel_scu_ipc_dev *scu;
        int (*setup)(struct mid_pb_ddata *ddata);
 };
 
@@ -55,7 +56,8 @@ static int mid_pbstat(struct mid_pb_ddata *ddata, int *value)
        int ret;
        u8 pbstat;
 
-       ret = intel_scu_ipc_ioread8(ddata->pbstat_addr, &pbstat);
+       ret = intel_scu_ipc_dev_ioread8(ddata->scu, ddata->pbstat_addr,
+                                       &pbstat);
        if (ret)
                return ret;
 
@@ -67,14 +69,15 @@ static int mid_pbstat(struct mid_pb_ddata *ddata, int *value)
 
 static int mid_irq_ack(struct mid_pb_ddata *ddata)
 {
-       return intel_scu_ipc_update_register(ddata->mirqlvl1_addr, 0, MSIC_PWRBTNM);
+       return intel_scu_ipc_dev_update(ddata->scu, ddata->mirqlvl1_addr, 0,
+                                       MSIC_PWRBTNM);
 }
 
 static int mrfld_setup(struct mid_pb_ddata *ddata)
 {
        /* Unmask the PBIRQ and MPBIRQ on Tangier */
-       intel_scu_ipc_update_register(BCOVE_PBIRQ, 0, MSIC_PWRBTNM);
-       intel_scu_ipc_update_register(BCOVE_PBIRQMASK, 0, MSIC_PWRBTNM);
+       intel_scu_ipc_dev_update(ddata->scu, BCOVE_PBIRQ, 0, MSIC_PWRBTNM);
+       intel_scu_ipc_dev_update(ddata->scu, BCOVE_PBIRQMASK, 0, MSIC_PWRBTNM);
 
        return 0;
 }
@@ -161,6 +164,10 @@ static int mid_pb_probe(struct platform_device *pdev)
                        return error;
        }
 
+       ddata->scu = devm_intel_scu_ipc_dev_get(&pdev->dev);
+       if (!ddata->scu)
+               return -EPROBE_DEFER;
+
        error = devm_request_threaded_irq(&pdev->dev, irq, NULL, mid_pb_isr,
                                          IRQF_ONESHOT, DRIVER_NAME, ddata);
        if (error) {