forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/i2c/busses/i2c-imx.c
....@@ -20,6 +20,7 @@
2020 *
2121 */
2222
23
+#include <linux/acpi.h>
2324 #include <linux/clk.h>
2425 #include <linux/completion.h>
2526 #include <linux/delay.h>
....@@ -33,6 +34,7 @@
3334 #include <linux/init.h>
3435 #include <linux/interrupt.h>
3536 #include <linux/io.h>
37
+#include <linux/iopoll.h>
3638 #include <linux/kernel.h>
3739 #include <linux/module.h>
3840 #include <linux/of.h>
....@@ -47,9 +49,6 @@
4749
4850 /* This will be the driver name the kernel reports */
4951 #define DRIVER_NAME "imx-i2c"
50
-
51
-/* Default value */
52
-#define IMX_I2C_BIT_RATE 100000 /* 100kHz */
5352
5453 /*
5554 * Enable DMA if transfer byte size is bigger than this threshold.
....@@ -255,6 +254,12 @@
255254 };
256255 MODULE_DEVICE_TABLE(of, i2c_imx_dt_ids);
257256
257
+static const struct acpi_device_id i2c_imx_acpi_ids[] = {
258
+ {"NXP0001", .driver_data = (kernel_ulong_t)&vf610_i2c_hwdata},
259
+ { }
260
+};
261
+MODULE_DEVICE_TABLE(acpi, i2c_imx_acpi_ids);
262
+
258263 static inline int is_imx1_i2c(struct imx_i2c_struct *i2c_imx)
259264 {
260265 return i2c_imx->hwdata->devtype == IMX1_I2C;
....@@ -285,9 +290,11 @@
285290 if (!dma)
286291 return;
287292
288
- dma->chan_tx = dma_request_slave_channel(dev, "tx");
289
- if (!dma->chan_tx) {
290
- dev_dbg(dev, "can't request DMA tx channel\n");
293
+ dma->chan_tx = dma_request_chan(dev, "tx");
294
+ if (IS_ERR(dma->chan_tx)) {
295
+ ret = PTR_ERR(dma->chan_tx);
296
+ if (ret != -ENODEV && ret != -EPROBE_DEFER)
297
+ dev_err(dev, "can't request DMA tx channel (%d)\n", ret);
291298 goto fail_al;
292299 }
293300
....@@ -298,13 +305,15 @@
298305 dma_sconfig.direction = DMA_MEM_TO_DEV;
299306 ret = dmaengine_slave_config(dma->chan_tx, &dma_sconfig);
300307 if (ret < 0) {
301
- dev_dbg(dev, "can't configure tx channel\n");
308
+ dev_err(dev, "can't configure tx channel (%d)\n", ret);
302309 goto fail_tx;
303310 }
304311
305
- dma->chan_rx = dma_request_slave_channel(dev, "rx");
306
- if (!dma->chan_rx) {
307
- dev_dbg(dev, "can't request DMA rx channel\n");
312
+ dma->chan_rx = dma_request_chan(dev, "rx");
313
+ if (IS_ERR(dma->chan_rx)) {
314
+ ret = PTR_ERR(dma->chan_rx);
315
+ if (ret != -ENODEV && ret != -EPROBE_DEFER)
316
+ dev_err(dev, "can't request DMA rx channel (%d)\n", ret);
308317 goto fail_tx;
309318 }
310319
....@@ -315,7 +324,7 @@
315324 dma_sconfig.direction = DMA_DEV_TO_MEM;
316325 ret = dmaengine_slave_config(dma->chan_rx, &dma_sconfig);
317326 if (ret < 0) {
318
- dev_dbg(dev, "can't configure rx channel\n");
327
+ dev_err(dev, "can't configure rx channel (%d)\n", ret);
319328 goto fail_rx;
320329 }
321330
....@@ -332,7 +341,6 @@
332341 dma_release_channel(dma->chan_tx);
333342 fail_al:
334343 devm_kfree(dev, dma);
335
- dev_info(dev, "can't use DMA, using PIO instead.\n");
336344 }
337345
338346 static void i2c_imx_dma_callback(void *arg)
....@@ -417,7 +425,7 @@
417425 imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR);
418426 }
419427
420
-static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy)
428
+static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy, bool atomic)
421429 {
422430 unsigned long orig_jiffies = jiffies;
423431 unsigned int temp;
....@@ -446,15 +454,37 @@
446454 "<%s> I2C bus is busy\n", __func__);
447455 return -ETIMEDOUT;
448456 }
449
- schedule();
457
+ if (atomic)
458
+ udelay(100);
459
+ else
460
+ schedule();
450461 }
451462
452463 return 0;
453464 }
454465
455
-static int i2c_imx_trx_complete(struct imx_i2c_struct *i2c_imx)
466
+static int i2c_imx_trx_complete(struct imx_i2c_struct *i2c_imx, bool atomic)
456467 {
457
- wait_event_timeout(i2c_imx->queue, i2c_imx->i2csr & I2SR_IIF, HZ / 10);
468
+ if (atomic) {
469
+ void __iomem *addr = i2c_imx->base + (IMX_I2C_I2SR << i2c_imx->hwdata->regshift);
470
+ unsigned int regval;
471
+
472
+ /*
473
+ * The formula for the poll timeout is documented in the RM
474
+ * Rev.5 on page 1878:
475
+ * T_min = 10/F_scl
476
+ * Set the value hard as it is done for the non-atomic use-case.
477
+ * Use 10 kHz for the calculation since this is the minimum
478
+ * allowed SMBus frequency. Also add an offset of 100us since it
479
+ * turned out that the I2SR_IIF bit isn't set correctly within
480
+ * the minimum timeout in polling mode.
481
+ */
482
+ readb_poll_timeout_atomic(addr, regval, regval & I2SR_IIF, 5, 1000 + 100);
483
+ i2c_imx->i2csr = regval;
484
+ i2c_imx_clear_irq(i2c_imx, I2SR_IIF | I2SR_IAL);
485
+ } else {
486
+ wait_event_timeout(i2c_imx->queue, i2c_imx->i2csr & I2SR_IIF, HZ / 10);
487
+ }
458488
459489 if (unlikely(!(i2c_imx->i2csr & I2SR_IIF))) {
460490 dev_dbg(&i2c_imx->adapter.dev, "<%s> Timeout\n", __func__);
....@@ -542,7 +572,7 @@
542572 return NOTIFY_OK;
543573 }
544574
545
-static int i2c_imx_start(struct imx_i2c_struct *i2c_imx)
575
+static int i2c_imx_start(struct imx_i2c_struct *i2c_imx, bool atomic)
546576 {
547577 unsigned int temp = 0;
548578 int result;
....@@ -555,23 +585,29 @@
555585 imx_i2c_write_reg(i2c_imx->hwdata->i2cr_ien_opcode, i2c_imx, IMX_I2C_I2CR);
556586
557587 /* Wait controller to be stable */
558
- usleep_range(50, 150);
588
+ if (atomic)
589
+ udelay(50);
590
+ else
591
+ usleep_range(50, 150);
559592
560593 /* Start I2C transaction */
561594 temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);
562595 temp |= I2CR_MSTA;
563596 imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR);
564
- result = i2c_imx_bus_busy(i2c_imx, 1);
597
+ result = i2c_imx_bus_busy(i2c_imx, 1, atomic);
565598 if (result)
566599 return result;
567600
568601 temp |= I2CR_IIEN | I2CR_MTX | I2CR_TXAK;
602
+ if (atomic)
603
+ temp &= ~I2CR_IIEN; /* Disable interrupt */
604
+
569605 temp &= ~I2CR_DMAEN;
570606 imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR);
571607 return result;
572608 }
573609
574
-static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
610
+static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx, bool atomic)
575611 {
576612 unsigned int temp = 0;
577613
....@@ -595,7 +631,7 @@
595631 }
596632
597633 if (!i2c_imx->stopped)
598
- i2c_imx_bus_busy(i2c_imx, 0);
634
+ i2c_imx_bus_busy(i2c_imx, 0, atomic);
599635
600636 /* Disable I2C controller */
601637 temp = i2c_imx->hwdata->i2cr_ien_opcode ^ I2CR_IEN,
....@@ -674,7 +710,7 @@
674710 /* The last data byte must be transferred by the CPU. */
675711 imx_i2c_write_reg(msgs->buf[msgs->len-1],
676712 i2c_imx, IMX_I2C_I2DR);
677
- result = i2c_imx_trx_complete(i2c_imx);
713
+ result = i2c_imx_trx_complete(i2c_imx, false);
678714 if (result)
679715 return result;
680716
....@@ -733,7 +769,7 @@
733769
734770 msgs->buf[msgs->len-2] = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2DR);
735771 /* read n byte data */
736
- result = i2c_imx_trx_complete(i2c_imx);
772
+ result = i2c_imx_trx_complete(i2c_imx, false);
737773 if (result)
738774 return result;
739775
....@@ -749,7 +785,7 @@
749785 temp &= ~(I2CR_MSTA | I2CR_MTX);
750786 imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR);
751787 if (!i2c_imx->stopped)
752
- i2c_imx_bus_busy(i2c_imx, 0);
788
+ i2c_imx_bus_busy(i2c_imx, 0, false);
753789 } else {
754790 /*
755791 * For i2c master receiver repeat restart operation like:
....@@ -767,7 +803,8 @@
767803 return 0;
768804 }
769805
770
-static int i2c_imx_write(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs)
806
+static int i2c_imx_write(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs,
807
+ bool atomic)
771808 {
772809 int i, result;
773810
....@@ -776,7 +813,7 @@
776813
777814 /* write slave address */
778815 imx_i2c_write_reg(i2c_8bit_addr_from_msg(msgs), i2c_imx, IMX_I2C_I2DR);
779
- result = i2c_imx_trx_complete(i2c_imx);
816
+ result = i2c_imx_trx_complete(i2c_imx, atomic);
780817 if (result)
781818 return result;
782819 result = i2c_imx_acked(i2c_imx);
....@@ -790,7 +827,7 @@
790827 "<%s> write byte: B%d=0x%X\n",
791828 __func__, i, msgs->buf[i]);
792829 imx_i2c_write_reg(msgs->buf[i], i2c_imx, IMX_I2C_I2DR);
793
- result = i2c_imx_trx_complete(i2c_imx);
830
+ result = i2c_imx_trx_complete(i2c_imx, atomic);
794831 if (result)
795832 return result;
796833 result = i2c_imx_acked(i2c_imx);
....@@ -800,12 +837,14 @@
800837 return 0;
801838 }
802839
803
-static int i2c_imx_read(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs, bool is_lastmsg)
840
+static int i2c_imx_read(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs,
841
+ bool is_lastmsg, bool atomic)
804842 {
805843 int i, result;
806844 unsigned int temp;
807845 int block_data = msgs->flags & I2C_M_RECV_LEN;
808
- int use_dma = i2c_imx->dma && msgs->len >= DMA_THRESHOLD && !block_data;
846
+ int use_dma = i2c_imx->dma && msgs->flags & I2C_M_DMA_SAFE &&
847
+ msgs->len >= DMA_THRESHOLD && !block_data;
809848
810849 dev_dbg(&i2c_imx->adapter.dev,
811850 "<%s> write slave address: addr=0x%x\n",
....@@ -813,7 +852,7 @@
813852
814853 /* write slave address */
815854 imx_i2c_write_reg(i2c_8bit_addr_from_msg(msgs), i2c_imx, IMX_I2C_I2DR);
816
- result = i2c_imx_trx_complete(i2c_imx);
855
+ result = i2c_imx_trx_complete(i2c_imx, atomic);
817856 if (result)
818857 return result;
819858 result = i2c_imx_acked(i2c_imx);
....@@ -846,7 +885,7 @@
846885 for (i = 0; i < msgs->len; i++) {
847886 u8 len = 0;
848887
849
- result = i2c_imx_trx_complete(i2c_imx);
888
+ result = i2c_imx_trx_complete(i2c_imx, atomic);
850889 if (result)
851890 return result;
852891 /*
....@@ -877,7 +916,7 @@
877916 temp &= ~(I2CR_MSTA | I2CR_MTX);
878917 imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR);
879918 if (!i2c_imx->stopped)
880
- i2c_imx_bus_busy(i2c_imx, 0);
919
+ i2c_imx_bus_busy(i2c_imx, 0, atomic);
881920 } else {
882921 /*
883922 * For i2c master receiver repeat restart operation like:
....@@ -908,8 +947,8 @@
908947 return 0;
909948 }
910949
911
-static int i2c_imx_xfer(struct i2c_adapter *adapter,
912
- struct i2c_msg *msgs, int num)
950
+static int i2c_imx_xfer_common(struct i2c_adapter *adapter,
951
+ struct i2c_msg *msgs, int num, bool atomic)
913952 {
914953 unsigned int i, temp;
915954 int result;
....@@ -918,16 +957,16 @@
918957
919958 dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__);
920959
921
- result = pm_runtime_get_sync(i2c_imx->adapter.dev.parent);
922
- if (result < 0)
923
- goto out;
924
-
925960 /* Start I2C transfer */
926
- result = i2c_imx_start(i2c_imx);
961
+ result = i2c_imx_start(i2c_imx, atomic);
927962 if (result) {
928
- if (i2c_imx->adapter.bus_recovery_info) {
963
+ /*
964
+ * Bus recovery uses gpiod_get_value_cansleep() which is not
965
+ * allowed within atomic context.
966
+ */
967
+ if (!atomic && i2c_imx->adapter.bus_recovery_info) {
929968 i2c_recover_bus(&i2c_imx->adapter);
930
- result = i2c_imx_start(i2c_imx);
969
+ result = i2c_imx_start(i2c_imx, atomic);
931970 }
932971 }
933972
....@@ -945,7 +984,7 @@
945984 temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);
946985 temp |= I2CR_RSTA;
947986 imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR);
948
- result = i2c_imx_bus_busy(i2c_imx, 1);
987
+ result = i2c_imx_bus_busy(i2c_imx, 1, atomic);
949988 if (result)
950989 goto fail0;
951990 }
....@@ -969,13 +1008,15 @@
9691008 (temp & I2SR_SRW ? 1 : 0), (temp & I2SR_IIF ? 1 : 0),
9701009 (temp & I2SR_RXAK ? 1 : 0));
9711010 #endif
972
- if (msgs[i].flags & I2C_M_RD)
973
- result = i2c_imx_read(i2c_imx, &msgs[i], is_lastmsg);
974
- else {
975
- if (i2c_imx->dma && msgs[i].len >= DMA_THRESHOLD)
1011
+ if (msgs[i].flags & I2C_M_RD) {
1012
+ result = i2c_imx_read(i2c_imx, &msgs[i], is_lastmsg, atomic);
1013
+ } else {
1014
+ if (!atomic &&
1015
+ i2c_imx->dma && msgs[i].len >= DMA_THRESHOLD &&
1016
+ msgs[i].flags & I2C_M_DMA_SAFE)
9761017 result = i2c_imx_dma_write(i2c_imx, &msgs[i]);
9771018 else
978
- result = i2c_imx_write(i2c_imx, &msgs[i]);
1019
+ result = i2c_imx_write(i2c_imx, &msgs[i], atomic);
9791020 }
9801021 if (result)
9811022 goto fail0;
....@@ -983,16 +1024,47 @@
9831024
9841025 fail0:
9851026 /* Stop I2C transfer */
986
- i2c_imx_stop(i2c_imx);
1027
+ i2c_imx_stop(i2c_imx, atomic);
9871028
988
- pm_runtime_mark_last_busy(i2c_imx->adapter.dev.parent);
989
- pm_runtime_put_autosuspend(i2c_imx->adapter.dev.parent);
990
-
991
-out:
9921029 dev_dbg(&i2c_imx->adapter.dev, "<%s> exit with: %s: %d\n", __func__,
9931030 (result < 0) ? "error" : "success msg",
9941031 (result < 0) ? result : num);
9951032 return (result < 0) ? result : num;
1033
+}
1034
+
1035
+static int i2c_imx_xfer(struct i2c_adapter *adapter,
1036
+ struct i2c_msg *msgs, int num)
1037
+{
1038
+ struct imx_i2c_struct *i2c_imx = i2c_get_adapdata(adapter);
1039
+ int result;
1040
+
1041
+ result = pm_runtime_resume_and_get(i2c_imx->adapter.dev.parent);
1042
+ if (result < 0)
1043
+ return result;
1044
+
1045
+ result = i2c_imx_xfer_common(adapter, msgs, num, false);
1046
+
1047
+ pm_runtime_mark_last_busy(i2c_imx->adapter.dev.parent);
1048
+ pm_runtime_put_autosuspend(i2c_imx->adapter.dev.parent);
1049
+
1050
+ return result;
1051
+}
1052
+
1053
+static int i2c_imx_xfer_atomic(struct i2c_adapter *adapter,
1054
+ struct i2c_msg *msgs, int num)
1055
+{
1056
+ struct imx_i2c_struct *i2c_imx = i2c_get_adapdata(adapter);
1057
+ int result;
1058
+
1059
+ result = clk_enable(i2c_imx->clk);
1060
+ if (result)
1061
+ return result;
1062
+
1063
+ result = i2c_imx_xfer_common(adapter, msgs, num, true);
1064
+
1065
+ clk_disable(i2c_imx->clk);
1066
+
1067
+ return result;
9961068 }
9971069
9981070 static void i2c_imx_prepare_recovery(struct i2c_adapter *adap)
....@@ -1067,28 +1139,26 @@
10671139 }
10681140
10691141 static const struct i2c_algorithm i2c_imx_algo = {
1070
- .master_xfer = i2c_imx_xfer,
1071
- .functionality = i2c_imx_func,
1142
+ .master_xfer = i2c_imx_xfer,
1143
+ .master_xfer_atomic = i2c_imx_xfer_atomic,
1144
+ .functionality = i2c_imx_func,
10721145 };
10731146
10741147 static int i2c_imx_probe(struct platform_device *pdev)
10751148 {
1076
- const struct of_device_id *of_id = of_match_device(i2c_imx_dt_ids,
1077
- &pdev->dev);
10781149 struct imx_i2c_struct *i2c_imx;
10791150 struct resource *res;
10801151 struct imxi2c_platform_data *pdata = dev_get_platdata(&pdev->dev);
10811152 void __iomem *base;
10821153 int irq, ret;
10831154 dma_addr_t phy_addr;
1155
+ const struct imx_i2c_hwdata *match;
10841156
10851157 dev_dbg(&pdev->dev, "<%s>\n", __func__);
10861158
10871159 irq = platform_get_irq(pdev, 0);
1088
- if (irq < 0) {
1089
- dev_err(&pdev->dev, "can't get irq number\n");
1160
+ if (irq < 0)
10901161 return irq;
1091
- }
10921162
10931163 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
10941164 base = devm_ioremap_resource(&pdev->dev, res);
....@@ -1100,8 +1170,9 @@
11001170 if (!i2c_imx)
11011171 return -ENOMEM;
11021172
1103
- if (of_id)
1104
- i2c_imx->hwdata = of_id->data;
1173
+ match = device_get_match_data(&pdev->dev);
1174
+ if (match)
1175
+ i2c_imx->hwdata = match;
11051176 else
11061177 i2c_imx->hwdata = (struct imx_i2c_hwdata *)
11071178 platform_get_device_id(pdev)->driver_data;
....@@ -1114,14 +1185,13 @@
11141185 i2c_imx->adapter.nr = pdev->id;
11151186 i2c_imx->adapter.dev.of_node = pdev->dev.of_node;
11161187 i2c_imx->base = base;
1188
+ ACPI_COMPANION_SET(&i2c_imx->adapter.dev, ACPI_COMPANION(&pdev->dev));
11171189
11181190 /* Get I2C clock */
11191191 i2c_imx->clk = devm_clk_get(&pdev->dev, NULL);
1120
- if (IS_ERR(i2c_imx->clk)) {
1121
- if (PTR_ERR(i2c_imx->clk) != -EPROBE_DEFER)
1122
- dev_err(&pdev->dev, "can't get I2C clock\n");
1123
- return PTR_ERR(i2c_imx->clk);
1124
- }
1192
+ if (IS_ERR(i2c_imx->clk))
1193
+ return dev_err_probe(&pdev->dev, PTR_ERR(i2c_imx->clk),
1194
+ "can't get I2C clock\n");
11251195
11261196 ret = clk_prepare_enable(i2c_imx->clk);
11271197 if (ret) {
....@@ -1156,7 +1226,7 @@
11561226 }
11571227
11581228 /* Set up clock divider */
1159
- i2c_imx->bitrate = IMX_I2C_BIT_RATE;
1229
+ i2c_imx->bitrate = I2C_MAX_STANDARD_MODE_FREQ;
11601230 ret = of_property_read_u32(pdev->dev.of_node,
11611231 "clock-frequency", &i2c_imx->bitrate);
11621232 if (ret < 0 && pdata && pdata->bitrate)
....@@ -1213,8 +1283,6 @@
12131283 int irq, ret;
12141284
12151285 ret = pm_runtime_get_sync(&pdev->dev);
1216
- if (ret < 0)
1217
- return ret;
12181286
12191287 /* remove adapter */
12201288 dev_dbg(&i2c_imx->adapter.dev, "adapter removed\n");
....@@ -1223,17 +1291,21 @@
12231291 if (i2c_imx->dma)
12241292 i2c_imx_dma_free(i2c_imx);
12251293
1226
- /* setup chip registers to defaults */
1227
- imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IADR);
1228
- imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IFDR);
1229
- imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2CR);
1230
- imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2SR);
1294
+ if (ret >= 0) {
1295
+ /* setup chip registers to defaults */
1296
+ imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IADR);
1297
+ imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IFDR);
1298
+ imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2CR);
1299
+ imx_i2c_write_reg(0, i2c_imx, IMX_I2C_I2SR);
1300
+ clk_disable(i2c_imx->clk);
1301
+ }
12311302
12321303 clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb);
12331304 irq = platform_get_irq(pdev, 0);
12341305 if (irq >= 0)
12351306 free_irq(irq, i2c_imx);
1236
- clk_disable_unprepare(i2c_imx->clk);
1307
+
1308
+ clk_unprepare(i2c_imx->clk);
12371309
12381310 pm_runtime_put_noidle(&pdev->dev);
12391311 pm_runtime_disable(&pdev->dev);
....@@ -1241,8 +1313,7 @@
12411313 return 0;
12421314 }
12431315
1244
-#ifdef CONFIG_PM
1245
-static int i2c_imx_runtime_suspend(struct device *dev)
1316
+static int __maybe_unused i2c_imx_runtime_suspend(struct device *dev)
12461317 {
12471318 struct imx_i2c_struct *i2c_imx = dev_get_drvdata(dev);
12481319
....@@ -1251,7 +1322,7 @@
12511322 return 0;
12521323 }
12531324
1254
-static int i2c_imx_runtime_resume(struct device *dev)
1325
+static int __maybe_unused i2c_imx_runtime_resume(struct device *dev)
12551326 {
12561327 struct imx_i2c_struct *i2c_imx = dev_get_drvdata(dev);
12571328 int ret;
....@@ -1267,18 +1338,15 @@
12671338 SET_RUNTIME_PM_OPS(i2c_imx_runtime_suspend,
12681339 i2c_imx_runtime_resume, NULL)
12691340 };
1270
-#define I2C_IMX_PM_OPS (&i2c_imx_pm_ops)
1271
-#else
1272
-#define I2C_IMX_PM_OPS NULL
1273
-#endif /* CONFIG_PM */
12741341
12751342 static struct platform_driver i2c_imx_driver = {
12761343 .probe = i2c_imx_probe,
12771344 .remove = i2c_imx_remove,
12781345 .driver = {
12791346 .name = DRIVER_NAME,
1280
- .pm = I2C_IMX_PM_OPS,
1347
+ .pm = &i2c_imx_pm_ops,
12811348 .of_match_table = i2c_imx_dt_ids,
1349
+ .acpi_match_table = i2c_imx_acpi_ids,
12821350 },
12831351 .id_table = imx_i2c_devtype,
12841352 };