1 // SPDX-License-Identifier: GPL-2.0+
3 * This is i.MX low power i2c controller driver.
5 * Copyright 2016 Freescale Semiconductor, Inc.
9 #include <linux/completion.h>
10 #include <linux/delay.h>
11 #include <linux/err.h>
12 #include <linux/errno.h>
13 #include <linux/i2c.h>
14 #include <linux/init.h>
15 #include <linux/interrupt.h>
17 #include <linux/kernel.h>
18 #include <linux/module.h>
20 #include <linux/pinctrl/consumer.h>
21 #include <linux/platform_device.h>
22 #include <linux/pm_runtime.h>
23 #include <linux/sched.h>
24 #include <linux/slab.h>
26 #define DRIVER_NAME "imx-lpi2c"
28 #define LPI2C_PARAM 0x04 /* i2c RX/TX FIFO size */
29 #define LPI2C_MCR 0x10 /* i2c contrl register */
30 #define LPI2C_MSR 0x14 /* i2c status register */
31 #define LPI2C_MIER 0x18 /* i2c interrupt enable */
32 #define LPI2C_MCFGR0 0x20 /* i2c master configuration */
33 #define LPI2C_MCFGR1 0x24 /* i2c master configuration */
34 #define LPI2C_MCFGR2 0x28 /* i2c master configuration */
35 #define LPI2C_MCFGR3 0x2C /* i2c master configuration */
36 #define LPI2C_MCCR0 0x48 /* i2c master clk configuration */
37 #define LPI2C_MCCR1 0x50 /* i2c master clk configuration */
38 #define LPI2C_MFCR 0x58 /* i2c master FIFO control */
39 #define LPI2C_MFSR 0x5C /* i2c master FIFO status */
40 #define LPI2C_MTDR 0x60 /* i2c master TX data register */
41 #define LPI2C_MRDR 0x70 /* i2c master RX data register */
44 #define TRAN_DATA 0X00
45 #define RECV_DATA 0X01
47 #define RECV_DISCARD 0X03
48 #define GEN_START 0X04
49 #define START_NACK 0X05
50 #define START_HIGH 0X06
51 #define START_HIGH_NACK 0X07
53 #define MCR_MEN BIT(0)
54 #define MCR_RST BIT(1)
55 #define MCR_DOZEN BIT(2)
56 #define MCR_DBGEN BIT(3)
57 #define MCR_RTF BIT(8)
58 #define MCR_RRF BIT(9)
59 #define MSR_TDF BIT(0)
60 #define MSR_RDF BIT(1)
61 #define MSR_SDF BIT(9)
62 #define MSR_NDF BIT(10)
63 #define MSR_ALF BIT(11)
64 #define MSR_MBF BIT(24)
65 #define MSR_BBF BIT(25)
66 #define MIER_TDIE BIT(0)
67 #define MIER_RDIE BIT(1)
68 #define MIER_SDIE BIT(9)
69 #define MIER_NDIE BIT(10)
70 #define MCFGR1_AUTOSTOP BIT(8)
71 #define MCFGR1_IGNACK BIT(9)
72 #define MRDR_RXEMPTY BIT(14)
74 #define I2C_CLK_RATIO 2
75 #define CHUNK_DATA 256
77 #define I2C_PM_TIMEOUT 10 /* ms */
80 STANDARD
, /* 100+Kbps */
82 FAST_PLUS
, /* 1.0+Mbps */
84 ULTRA_FAST
, /* 5.0+Mbps */
87 enum lpi2c_imx_pincfg
{
94 struct lpi2c_imx_struct
{
95 struct i2c_adapter adapter
;
97 struct clk_bulk_data
*clks
;
101 struct completion complete
;
102 unsigned long rate_per
;
104 unsigned int delivered
;
105 unsigned int block_data
;
106 unsigned int bitrate
;
107 unsigned int txfifosize
;
108 unsigned int rxfifosize
;
109 enum lpi2c_imx_mode mode
;
110 struct i2c_bus_recovery_info rinfo
;
113 static void lpi2c_imx_intctrl(struct lpi2c_imx_struct
*lpi2c_imx
,
116 writel(enable
, lpi2c_imx
->base
+ LPI2C_MIER
);
119 static int lpi2c_imx_bus_busy(struct lpi2c_imx_struct
*lpi2c_imx
)
121 unsigned long orig_jiffies
= jiffies
;
125 temp
= readl(lpi2c_imx
->base
+ LPI2C_MSR
);
127 /* check for arbitration lost, clear if set */
128 if (temp
& MSR_ALF
) {
129 writel(temp
, lpi2c_imx
->base
+ LPI2C_MSR
);
133 if (temp
& (MSR_BBF
| MSR_MBF
))
136 if (time_after(jiffies
, orig_jiffies
+ msecs_to_jiffies(500))) {
137 dev_dbg(&lpi2c_imx
->adapter
.dev
, "bus not work\n");
138 if (lpi2c_imx
->adapter
.bus_recovery_info
)
139 i2c_recover_bus(&lpi2c_imx
->adapter
);
148 static void lpi2c_imx_set_mode(struct lpi2c_imx_struct
*lpi2c_imx
)
150 unsigned int bitrate
= lpi2c_imx
->bitrate
;
151 enum lpi2c_imx_mode mode
;
153 if (bitrate
< I2C_MAX_FAST_MODE_FREQ
)
155 else if (bitrate
< I2C_MAX_FAST_MODE_PLUS_FREQ
)
157 else if (bitrate
< I2C_MAX_HIGH_SPEED_MODE_FREQ
)
159 else if (bitrate
< I2C_MAX_ULTRA_FAST_MODE_FREQ
)
164 lpi2c_imx
->mode
= mode
;
167 static int lpi2c_imx_start(struct lpi2c_imx_struct
*lpi2c_imx
,
168 struct i2c_msg
*msgs
)
172 temp
= readl(lpi2c_imx
->base
+ LPI2C_MCR
);
173 temp
|= MCR_RRF
| MCR_RTF
;
174 writel(temp
, lpi2c_imx
->base
+ LPI2C_MCR
);
175 writel(0x7f00, lpi2c_imx
->base
+ LPI2C_MSR
);
177 temp
= i2c_8bit_addr_from_msg(msgs
) | (GEN_START
<< 8);
178 writel(temp
, lpi2c_imx
->base
+ LPI2C_MTDR
);
180 return lpi2c_imx_bus_busy(lpi2c_imx
);
183 static void lpi2c_imx_stop(struct lpi2c_imx_struct
*lpi2c_imx
)
185 unsigned long orig_jiffies
= jiffies
;
188 writel(GEN_STOP
<< 8, lpi2c_imx
->base
+ LPI2C_MTDR
);
191 temp
= readl(lpi2c_imx
->base
+ LPI2C_MSR
);
195 if (time_after(jiffies
, orig_jiffies
+ msecs_to_jiffies(500))) {
196 dev_dbg(&lpi2c_imx
->adapter
.dev
, "stop timeout\n");
197 if (lpi2c_imx
->adapter
.bus_recovery_info
)
198 i2c_recover_bus(&lpi2c_imx
->adapter
);
206 /* CLKLO = I2C_CLK_RATIO * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI/2 */
207 static int lpi2c_imx_config(struct lpi2c_imx_struct
*lpi2c_imx
)
209 u8 prescale
, filt
, sethold
, datavd
;
210 unsigned int clk_rate
, clk_cycle
, clkhi
, clklo
;
211 enum lpi2c_imx_pincfg pincfg
;
214 lpi2c_imx_set_mode(lpi2c_imx
);
216 clk_rate
= lpi2c_imx
->rate_per
;
218 if (lpi2c_imx
->mode
== HS
|| lpi2c_imx
->mode
== ULTRA_FAST
)
223 for (prescale
= 0; prescale
<= 7; prescale
++) {
224 clk_cycle
= clk_rate
/ ((1 << prescale
) * lpi2c_imx
->bitrate
)
226 clkhi
= DIV_ROUND_UP(clk_cycle
, I2C_CLK_RATIO
+ 1);
227 clklo
= clk_cycle
- clkhi
;
235 /* set MCFGR1: PINCFG, PRESCALE, IGNACK */
236 if (lpi2c_imx
->mode
== ULTRA_FAST
)
240 temp
= prescale
| pincfg
<< 24;
242 if (lpi2c_imx
->mode
== ULTRA_FAST
)
243 temp
|= MCFGR1_IGNACK
;
245 writel(temp
, lpi2c_imx
->base
+ LPI2C_MCFGR1
);
247 /* set MCFGR2: FILTSDA, FILTSCL */
248 temp
= (filt
<< 16) | (filt
<< 24);
249 writel(temp
, lpi2c_imx
->base
+ LPI2C_MCFGR2
);
251 /* set MCCR: DATAVD, SETHOLD, CLKHI, CLKLO */
254 temp
= datavd
<< 24 | sethold
<< 16 | clkhi
<< 8 | clklo
;
256 if (lpi2c_imx
->mode
== HS
)
257 writel(temp
, lpi2c_imx
->base
+ LPI2C_MCCR1
);
259 writel(temp
, lpi2c_imx
->base
+ LPI2C_MCCR0
);
264 static int lpi2c_imx_master_enable(struct lpi2c_imx_struct
*lpi2c_imx
)
269 ret
= pm_runtime_resume_and_get(lpi2c_imx
->adapter
.dev
.parent
);
274 writel(temp
, lpi2c_imx
->base
+ LPI2C_MCR
);
275 writel(0, lpi2c_imx
->base
+ LPI2C_MCR
);
277 ret
= lpi2c_imx_config(lpi2c_imx
);
281 temp
= readl(lpi2c_imx
->base
+ LPI2C_MCR
);
283 writel(temp
, lpi2c_imx
->base
+ LPI2C_MCR
);
288 pm_runtime_mark_last_busy(lpi2c_imx
->adapter
.dev
.parent
);
289 pm_runtime_put_autosuspend(lpi2c_imx
->adapter
.dev
.parent
);
294 static int lpi2c_imx_master_disable(struct lpi2c_imx_struct
*lpi2c_imx
)
298 temp
= readl(lpi2c_imx
->base
+ LPI2C_MCR
);
300 writel(temp
, lpi2c_imx
->base
+ LPI2C_MCR
);
302 pm_runtime_mark_last_busy(lpi2c_imx
->adapter
.dev
.parent
);
303 pm_runtime_put_autosuspend(lpi2c_imx
->adapter
.dev
.parent
);
308 static int lpi2c_imx_msg_complete(struct lpi2c_imx_struct
*lpi2c_imx
)
310 unsigned long time_left
;
312 time_left
= wait_for_completion_timeout(&lpi2c_imx
->complete
, HZ
);
314 return time_left
? 0 : -ETIMEDOUT
;
317 static int lpi2c_imx_txfifo_empty(struct lpi2c_imx_struct
*lpi2c_imx
)
319 unsigned long orig_jiffies
= jiffies
;
323 txcnt
= readl(lpi2c_imx
->base
+ LPI2C_MFSR
) & 0xff;
325 if (readl(lpi2c_imx
->base
+ LPI2C_MSR
) & MSR_NDF
) {
326 dev_dbg(&lpi2c_imx
->adapter
.dev
, "NDF detected\n");
330 if (time_after(jiffies
, orig_jiffies
+ msecs_to_jiffies(500))) {
331 dev_dbg(&lpi2c_imx
->adapter
.dev
, "txfifo empty timeout\n");
332 if (lpi2c_imx
->adapter
.bus_recovery_info
)
333 i2c_recover_bus(&lpi2c_imx
->adapter
);
343 static void lpi2c_imx_set_tx_watermark(struct lpi2c_imx_struct
*lpi2c_imx
)
345 writel(lpi2c_imx
->txfifosize
>> 1, lpi2c_imx
->base
+ LPI2C_MFCR
);
348 static void lpi2c_imx_set_rx_watermark(struct lpi2c_imx_struct
*lpi2c_imx
)
350 unsigned int temp
, remaining
;
352 remaining
= lpi2c_imx
->msglen
- lpi2c_imx
->delivered
;
354 if (remaining
> (lpi2c_imx
->rxfifosize
>> 1))
355 temp
= lpi2c_imx
->rxfifosize
>> 1;
359 writel(temp
<< 16, lpi2c_imx
->base
+ LPI2C_MFCR
);
362 static void lpi2c_imx_write_txfifo(struct lpi2c_imx_struct
*lpi2c_imx
)
364 unsigned int data
, txcnt
;
366 txcnt
= readl(lpi2c_imx
->base
+ LPI2C_MFSR
) & 0xff;
368 while (txcnt
< lpi2c_imx
->txfifosize
) {
369 if (lpi2c_imx
->delivered
== lpi2c_imx
->msglen
)
372 data
= lpi2c_imx
->tx_buf
[lpi2c_imx
->delivered
++];
373 writel(data
, lpi2c_imx
->base
+ LPI2C_MTDR
);
377 if (lpi2c_imx
->delivered
< lpi2c_imx
->msglen
)
378 lpi2c_imx_intctrl(lpi2c_imx
, MIER_TDIE
| MIER_NDIE
);
380 complete(&lpi2c_imx
->complete
);
383 static void lpi2c_imx_read_rxfifo(struct lpi2c_imx_struct
*lpi2c_imx
)
385 unsigned int blocklen
, remaining
;
386 unsigned int temp
, data
;
389 data
= readl(lpi2c_imx
->base
+ LPI2C_MRDR
);
390 if (data
& MRDR_RXEMPTY
)
393 lpi2c_imx
->rx_buf
[lpi2c_imx
->delivered
++] = data
& 0xff;
397 * First byte is the length of remaining packet in the SMBus block
398 * data read. Add it to msgs->len.
400 if (lpi2c_imx
->block_data
) {
401 blocklen
= lpi2c_imx
->rx_buf
[0];
402 lpi2c_imx
->msglen
+= blocklen
;
405 remaining
= lpi2c_imx
->msglen
- lpi2c_imx
->delivered
;
408 complete(&lpi2c_imx
->complete
);
412 /* not finished, still waiting for rx data */
413 lpi2c_imx_set_rx_watermark(lpi2c_imx
);
415 /* multiple receive commands */
416 if (lpi2c_imx
->block_data
) {
417 lpi2c_imx
->block_data
= 0;
419 temp
|= (RECV_DATA
<< 8);
420 writel(temp
, lpi2c_imx
->base
+ LPI2C_MTDR
);
421 } else if (!(lpi2c_imx
->delivered
& 0xff)) {
422 temp
= (remaining
> CHUNK_DATA
? CHUNK_DATA
: remaining
) - 1;
423 temp
|= (RECV_DATA
<< 8);
424 writel(temp
, lpi2c_imx
->base
+ LPI2C_MTDR
);
427 lpi2c_imx_intctrl(lpi2c_imx
, MIER_RDIE
);
430 static void lpi2c_imx_write(struct lpi2c_imx_struct
*lpi2c_imx
,
431 struct i2c_msg
*msgs
)
433 lpi2c_imx
->tx_buf
= msgs
->buf
;
434 lpi2c_imx_set_tx_watermark(lpi2c_imx
);
435 lpi2c_imx_write_txfifo(lpi2c_imx
);
438 static void lpi2c_imx_read(struct lpi2c_imx_struct
*lpi2c_imx
,
439 struct i2c_msg
*msgs
)
443 lpi2c_imx
->rx_buf
= msgs
->buf
;
444 lpi2c_imx
->block_data
= msgs
->flags
& I2C_M_RECV_LEN
;
446 lpi2c_imx_set_rx_watermark(lpi2c_imx
);
447 temp
= msgs
->len
> CHUNK_DATA
? CHUNK_DATA
- 1 : msgs
->len
- 1;
448 temp
|= (RECV_DATA
<< 8);
449 writel(temp
, lpi2c_imx
->base
+ LPI2C_MTDR
);
451 lpi2c_imx_intctrl(lpi2c_imx
, MIER_RDIE
| MIER_NDIE
);
454 static int lpi2c_imx_xfer(struct i2c_adapter
*adapter
,
455 struct i2c_msg
*msgs
, int num
)
457 struct lpi2c_imx_struct
*lpi2c_imx
= i2c_get_adapdata(adapter
);
461 result
= lpi2c_imx_master_enable(lpi2c_imx
);
465 for (i
= 0; i
< num
; i
++) {
466 result
= lpi2c_imx_start(lpi2c_imx
, &msgs
[i
]);
471 if (num
== 1 && msgs
[0].len
== 0)
474 lpi2c_imx
->rx_buf
= NULL
;
475 lpi2c_imx
->tx_buf
= NULL
;
476 lpi2c_imx
->delivered
= 0;
477 lpi2c_imx
->msglen
= msgs
[i
].len
;
478 init_completion(&lpi2c_imx
->complete
);
480 if (msgs
[i
].flags
& I2C_M_RD
)
481 lpi2c_imx_read(lpi2c_imx
, &msgs
[i
]);
483 lpi2c_imx_write(lpi2c_imx
, &msgs
[i
]);
485 result
= lpi2c_imx_msg_complete(lpi2c_imx
);
489 if (!(msgs
[i
].flags
& I2C_M_RD
)) {
490 result
= lpi2c_imx_txfifo_empty(lpi2c_imx
);
497 lpi2c_imx_stop(lpi2c_imx
);
499 temp
= readl(lpi2c_imx
->base
+ LPI2C_MSR
);
500 if ((temp
& MSR_NDF
) && !result
)
504 lpi2c_imx_master_disable(lpi2c_imx
);
506 dev_dbg(&lpi2c_imx
->adapter
.dev
, "<%s> exit with: %s: %d\n", __func__
,
507 (result
< 0) ? "error" : "success msg",
508 (result
< 0) ? result
: num
);
510 return (result
< 0) ? result
: num
;
513 static irqreturn_t
lpi2c_imx_isr(int irq
, void *dev_id
)
515 struct lpi2c_imx_struct
*lpi2c_imx
= dev_id
;
516 unsigned int enabled
;
519 enabled
= readl(lpi2c_imx
->base
+ LPI2C_MIER
);
521 lpi2c_imx_intctrl(lpi2c_imx
, 0);
522 temp
= readl(lpi2c_imx
->base
+ LPI2C_MSR
);
526 complete(&lpi2c_imx
->complete
);
527 else if (temp
& MSR_RDF
)
528 lpi2c_imx_read_rxfifo(lpi2c_imx
);
529 else if (temp
& MSR_TDF
)
530 lpi2c_imx_write_txfifo(lpi2c_imx
);
535 static int lpi2c_imx_init_recovery_info(struct lpi2c_imx_struct
*lpi2c_imx
,
536 struct platform_device
*pdev
)
538 struct i2c_bus_recovery_info
*bri
= &lpi2c_imx
->rinfo
;
540 bri
->pinctrl
= devm_pinctrl_get(&pdev
->dev
);
541 if (IS_ERR(bri
->pinctrl
))
542 return PTR_ERR(bri
->pinctrl
);
544 lpi2c_imx
->adapter
.bus_recovery_info
= bri
;
549 static u32
lpi2c_imx_func(struct i2c_adapter
*adapter
)
551 return I2C_FUNC_I2C
| I2C_FUNC_SMBUS_EMUL
|
552 I2C_FUNC_SMBUS_READ_BLOCK_DATA
;
555 static const struct i2c_algorithm lpi2c_imx_algo
= {
556 .master_xfer
= lpi2c_imx_xfer
,
557 .functionality
= lpi2c_imx_func
,
560 static const struct of_device_id lpi2c_imx_of_match
[] = {
561 { .compatible
= "fsl,imx7ulp-lpi2c" },
564 MODULE_DEVICE_TABLE(of
, lpi2c_imx_of_match
);
566 static int lpi2c_imx_probe(struct platform_device
*pdev
)
568 struct lpi2c_imx_struct
*lpi2c_imx
;
572 lpi2c_imx
= devm_kzalloc(&pdev
->dev
, sizeof(*lpi2c_imx
), GFP_KERNEL
);
576 lpi2c_imx
->base
= devm_platform_ioremap_resource(pdev
, 0);
577 if (IS_ERR(lpi2c_imx
->base
))
578 return PTR_ERR(lpi2c_imx
->base
);
580 irq
= platform_get_irq(pdev
, 0);
584 lpi2c_imx
->adapter
.owner
= THIS_MODULE
;
585 lpi2c_imx
->adapter
.algo
= &lpi2c_imx_algo
;
586 lpi2c_imx
->adapter
.dev
.parent
= &pdev
->dev
;
587 lpi2c_imx
->adapter
.dev
.of_node
= pdev
->dev
.of_node
;
588 strscpy(lpi2c_imx
->adapter
.name
, pdev
->name
,
589 sizeof(lpi2c_imx
->adapter
.name
));
591 ret
= devm_clk_bulk_get_all(&pdev
->dev
, &lpi2c_imx
->clks
);
593 return dev_err_probe(&pdev
->dev
, ret
, "can't get I2C peripheral clock\n");
594 lpi2c_imx
->num_clks
= ret
;
596 ret
= of_property_read_u32(pdev
->dev
.of_node
,
597 "clock-frequency", &lpi2c_imx
->bitrate
);
599 lpi2c_imx
->bitrate
= I2C_MAX_STANDARD_MODE_FREQ
;
601 ret
= devm_request_irq(&pdev
->dev
, irq
, lpi2c_imx_isr
, 0,
602 pdev
->name
, lpi2c_imx
);
604 return dev_err_probe(&pdev
->dev
, ret
, "can't claim irq %d\n", irq
);
606 i2c_set_adapdata(&lpi2c_imx
->adapter
, lpi2c_imx
);
607 platform_set_drvdata(pdev
, lpi2c_imx
);
609 ret
= clk_bulk_prepare_enable(lpi2c_imx
->num_clks
, lpi2c_imx
->clks
);
614 * Lock the parent clock rate to avoid getting parent clock upon
617 ret
= devm_clk_rate_exclusive_get(&pdev
->dev
, lpi2c_imx
->clks
[0].clk
);
619 return dev_err_probe(&pdev
->dev
, ret
,
620 "can't lock I2C peripheral clock rate\n");
622 lpi2c_imx
->rate_per
= clk_get_rate(lpi2c_imx
->clks
[0].clk
);
623 if (!lpi2c_imx
->rate_per
)
624 return dev_err_probe(&pdev
->dev
, -EINVAL
,
625 "can't get I2C peripheral clock rate\n");
627 pm_runtime_set_autosuspend_delay(&pdev
->dev
, I2C_PM_TIMEOUT
);
628 pm_runtime_use_autosuspend(&pdev
->dev
);
629 pm_runtime_get_noresume(&pdev
->dev
);
630 pm_runtime_set_active(&pdev
->dev
);
631 pm_runtime_enable(&pdev
->dev
);
633 temp
= readl(lpi2c_imx
->base
+ LPI2C_PARAM
);
634 lpi2c_imx
->txfifosize
= 1 << (temp
& 0x0f);
635 lpi2c_imx
->rxfifosize
= 1 << ((temp
>> 8) & 0x0f);
637 /* Init optional bus recovery function */
638 ret
= lpi2c_imx_init_recovery_info(lpi2c_imx
, pdev
);
639 /* Give it another chance if pinctrl used is not ready yet */
640 if (ret
== -EPROBE_DEFER
)
643 ret
= i2c_add_adapter(&lpi2c_imx
->adapter
);
647 pm_runtime_mark_last_busy(&pdev
->dev
);
648 pm_runtime_put_autosuspend(&pdev
->dev
);
650 dev_info(&lpi2c_imx
->adapter
.dev
, "LPI2C adapter registered\n");
655 pm_runtime_put(&pdev
->dev
);
656 pm_runtime_disable(&pdev
->dev
);
657 pm_runtime_dont_use_autosuspend(&pdev
->dev
);
662 static void lpi2c_imx_remove(struct platform_device
*pdev
)
664 struct lpi2c_imx_struct
*lpi2c_imx
= platform_get_drvdata(pdev
);
666 i2c_del_adapter(&lpi2c_imx
->adapter
);
668 pm_runtime_disable(&pdev
->dev
);
669 pm_runtime_dont_use_autosuspend(&pdev
->dev
);
672 static int __maybe_unused
lpi2c_runtime_suspend(struct device
*dev
)
674 struct lpi2c_imx_struct
*lpi2c_imx
= dev_get_drvdata(dev
);
676 clk_bulk_disable(lpi2c_imx
->num_clks
, lpi2c_imx
->clks
);
677 pinctrl_pm_select_sleep_state(dev
);
682 static int __maybe_unused
lpi2c_runtime_resume(struct device
*dev
)
684 struct lpi2c_imx_struct
*lpi2c_imx
= dev_get_drvdata(dev
);
687 pinctrl_pm_select_default_state(dev
);
688 ret
= clk_bulk_enable(lpi2c_imx
->num_clks
, lpi2c_imx
->clks
);
690 dev_err(dev
, "failed to enable I2C clock, ret=%d\n", ret
);
697 static const struct dev_pm_ops lpi2c_pm_ops
= {
698 SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend
,
699 pm_runtime_force_resume
)
700 SET_RUNTIME_PM_OPS(lpi2c_runtime_suspend
,
701 lpi2c_runtime_resume
, NULL
)
704 static struct platform_driver lpi2c_imx_driver
= {
705 .probe
= lpi2c_imx_probe
,
706 .remove_new
= lpi2c_imx_remove
,
709 .of_match_table
= lpi2c_imx_of_match
,
714 module_platform_driver(lpi2c_imx_driver
);
716 MODULE_AUTHOR("Gao Pan <pandy.gao@nxp.com>");
717 MODULE_DESCRIPTION("I2C adapter driver for LPI2C bus");
718 MODULE_LICENSE("GPL");