Lines Matching refs:i2c_dev

430 static void stm32f7_i2c_disable_irq(struct stm32f7_i2c_dev *i2c_dev, u32 mask)  in stm32f7_i2c_disable_irq()  argument
432 stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1, mask); in stm32f7_i2c_disable_irq()
447 static int stm32f7_i2c_compute_timing(struct stm32f7_i2c_dev *i2c_dev, in stm32f7_i2c_compute_timing() argument
471 dev_err(i2c_dev->dev, "speed out of bound {%d}\n", in stm32f7_i2c_compute_timing()
478 dev_err(i2c_dev->dev, in stm32f7_i2c_compute_timing()
485 i2c_dev->dnf = DIV_ROUND_CLOSEST(i2c_dev->dnf_dt, i2cclk); in stm32f7_i2c_compute_timing()
486 if (i2c_dev->dnf > STM32F7_I2C_DNF_MAX) { in stm32f7_i2c_compute_timing()
487 dev_err(i2c_dev->dev, in stm32f7_i2c_compute_timing()
489 i2c_dev->dnf * i2cclk, STM32F7_I2C_DNF_MAX * i2cclk); in stm32f7_i2c_compute_timing()
495 (i2c_dev->analog_filter ? in stm32f7_i2c_compute_timing()
498 (i2c_dev->analog_filter ? in stm32f7_i2c_compute_timing()
500 dnf_delay = i2c_dev->dnf * i2cclk; in stm32f7_i2c_compute_timing()
503 af_delay_min - (i2c_dev->dnf + 3) * i2cclk; in stm32f7_i2c_compute_timing()
506 af_delay_max - (i2c_dev->dnf + 4) * i2cclk; in stm32f7_i2c_compute_timing()
515 dev_dbg(i2c_dev->dev, "SDADEL(min/max): %i/%i, SCLDEL(Min): %i\n", in stm32f7_i2c_compute_timing()
556 dev_err(i2c_dev->dev, "no Prescaler solution\n"); in stm32f7_i2c_compute_timing()
613 dev_err(i2c_dev->dev, "no solution at all\n"); in stm32f7_i2c_compute_timing()
624 dev_dbg(i2c_dev->dev, in stm32f7_i2c_compute_timing()
651 static int stm32f7_i2c_setup_timing(struct stm32f7_i2c_dev *i2c_dev, in stm32f7_i2c_setup_timing() argument
658 t->scl_rise_ns = i2c_dev->setup.rise_time; in stm32f7_i2c_setup_timing()
659 t->scl_fall_ns = i2c_dev->setup.fall_time; in stm32f7_i2c_setup_timing()
661 i2c_parse_fw_timings(i2c_dev->dev, t, false); in stm32f7_i2c_setup_timing()
664 dev_err(i2c_dev->dev, "Invalid bus speed (%i>%i)\n", in stm32f7_i2c_setup_timing()
670 i2c_dev->setup.rise_time = t->scl_rise_ns; in stm32f7_i2c_setup_timing()
671 i2c_dev->setup.fall_time = t->scl_fall_ns; in stm32f7_i2c_setup_timing()
672 i2c_dev->dnf_dt = t->digital_filter_width_ns; in stm32f7_i2c_setup_timing()
673 setup->clock_src = clk_get_rate(i2c_dev->clk); in stm32f7_i2c_setup_timing()
676 dev_err(i2c_dev->dev, "clock rate is 0\n"); in stm32f7_i2c_setup_timing()
680 if (!of_property_read_bool(i2c_dev->dev->of_node, "i2c-digital-filter")) in stm32f7_i2c_setup_timing()
681 i2c_dev->dnf_dt = STM32F7_I2C_DNF_DEFAULT; in stm32f7_i2c_setup_timing()
684 ret = stm32f7_i2c_compute_timing(i2c_dev, setup, in stm32f7_i2c_setup_timing()
685 &i2c_dev->timing); in stm32f7_i2c_setup_timing()
687 dev_err(i2c_dev->dev, in stm32f7_i2c_setup_timing()
693 dev_warn(i2c_dev->dev, in stm32f7_i2c_setup_timing()
700 dev_err(i2c_dev->dev, "Impossible to compute I2C timings.\n"); in stm32f7_i2c_setup_timing()
704 i2c_dev->analog_filter = of_property_read_bool(i2c_dev->dev->of_node, in stm32f7_i2c_setup_timing()
707 dev_dbg(i2c_dev->dev, "I2C Speed(%i), Clk Source(%i)\n", in stm32f7_i2c_setup_timing()
709 dev_dbg(i2c_dev->dev, "I2C Rise(%i) and Fall(%i) Time\n", in stm32f7_i2c_setup_timing()
711 dev_dbg(i2c_dev->dev, "I2C Analog Filter(%s), DNF(%i)\n", in stm32f7_i2c_setup_timing()
712 (i2c_dev->analog_filter ? "On" : "Off"), i2c_dev->dnf); in stm32f7_i2c_setup_timing()
714 i2c_dev->bus_rate = setup->speed_freq; in stm32f7_i2c_setup_timing()
719 static void stm32f7_i2c_disable_dma_req(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_disable_dma_req() argument
721 void __iomem *base = i2c_dev->base; in stm32f7_i2c_disable_dma_req()
729 struct stm32f7_i2c_dev *i2c_dev = (struct stm32f7_i2c_dev *)arg; in stm32f7_i2c_dma_callback() local
730 struct stm32_i2c_dma *dma = i2c_dev->dma; in stm32f7_i2c_dma_callback()
733 stm32f7_i2c_disable_dma_req(i2c_dev); in stm32f7_i2c_dma_callback()
738 static void stm32f7_i2c_hw_config(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_hw_config() argument
740 struct stm32f7_i2c_timings *t = &i2c_dev->timing; in stm32f7_i2c_hw_config()
749 writel_relaxed(timing, i2c_dev->base + STM32F7_I2C_TIMINGR); in stm32f7_i2c_hw_config()
752 if (i2c_dev->analog_filter) in stm32f7_i2c_hw_config()
753 stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1, in stm32f7_i2c_hw_config()
756 stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1, in stm32f7_i2c_hw_config()
760 stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1, in stm32f7_i2c_hw_config()
762 stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1, in stm32f7_i2c_hw_config()
763 STM32F7_I2C_CR1_DNF(i2c_dev->dnf)); in stm32f7_i2c_hw_config()
765 stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1, in stm32f7_i2c_hw_config()
769 static void stm32f7_i2c_write_tx_data(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_write_tx_data() argument
771 struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg; in stm32f7_i2c_write_tx_data()
772 void __iomem *base = i2c_dev->base; in stm32f7_i2c_write_tx_data()
780 static void stm32f7_i2c_read_rx_data(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_read_rx_data() argument
782 struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg; in stm32f7_i2c_read_rx_data()
783 void __iomem *base = i2c_dev->base; in stm32f7_i2c_read_rx_data()
794 static void stm32f7_i2c_reload(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_reload() argument
796 struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg; in stm32f7_i2c_reload()
799 if (i2c_dev->use_dma) in stm32f7_i2c_reload()
802 cr2 = readl_relaxed(i2c_dev->base + STM32F7_I2C_CR2); in stm32f7_i2c_reload()
812 writel_relaxed(cr2, i2c_dev->base + STM32F7_I2C_CR2); in stm32f7_i2c_reload()
815 static void stm32f7_i2c_smbus_reload(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_smbus_reload() argument
817 struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg; in stm32f7_i2c_smbus_reload()
825 stm32f7_i2c_read_rx_data(i2c_dev); in stm32f7_i2c_smbus_reload()
832 cr2 = readl_relaxed(i2c_dev->base + STM32F7_I2C_CR2); in stm32f7_i2c_smbus_reload()
835 writel_relaxed(cr2, i2c_dev->base + STM32F7_I2C_CR2); in stm32f7_i2c_smbus_reload()
840 struct stm32f7_i2c_dev *i2c_dev = i2c_get_adapdata(i2c_adap); in stm32f7_i2c_release_bus() local
842 stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1, in stm32f7_i2c_release_bus()
845 stm32f7_i2c_hw_config(i2c_dev); in stm32f7_i2c_release_bus()
848 static int stm32f7_i2c_wait_free_bus(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_wait_free_bus() argument
853 ret = readl_relaxed_poll_timeout(i2c_dev->base + STM32F7_I2C_ISR, in stm32f7_i2c_wait_free_bus()
860 stm32f7_i2c_release_bus(&i2c_dev->adap); in stm32f7_i2c_wait_free_bus()
865 static void stm32f7_i2c_xfer_msg(struct stm32f7_i2c_dev *i2c_dev, in stm32f7_i2c_xfer_msg() argument
868 struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg; in stm32f7_i2c_xfer_msg()
869 void __iomem *base = i2c_dev->base; in stm32f7_i2c_xfer_msg()
877 f7_msg->stop = (i2c_dev->msg_id >= i2c_dev->msg_num - 1); in stm32f7_i2c_xfer_msg()
879 reinit_completion(&i2c_dev->complete); in stm32f7_i2c_xfer_msg()
918 i2c_dev->use_dma = false; in stm32f7_i2c_xfer_msg()
919 if (i2c_dev->dma && f7_msg->count >= STM32F7_I2C_DMA_LEN_MIN in stm32f7_i2c_xfer_msg()
920 && !i2c_dev->atomic) { in stm32f7_i2c_xfer_msg()
921 ret = stm32_i2c_prep_dma_xfer(i2c_dev->dev, i2c_dev->dma, in stm32f7_i2c_xfer_msg()
925 i2c_dev); in stm32f7_i2c_xfer_msg()
927 i2c_dev->use_dma = true; in stm32f7_i2c_xfer_msg()
929 dev_warn(i2c_dev->dev, "can't use DMA\n"); in stm32f7_i2c_xfer_msg()
932 if (!i2c_dev->use_dma) { in stm32f7_i2c_xfer_msg()
944 if (i2c_dev->atomic) in stm32f7_i2c_xfer_msg()
950 i2c_dev->master_mode = true; in stm32f7_i2c_xfer_msg()
957 static int stm32f7_i2c_smbus_xfer_msg(struct stm32f7_i2c_dev *i2c_dev, in stm32f7_i2c_smbus_xfer_msg() argument
961 struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg; in stm32f7_i2c_smbus_xfer_msg()
962 struct device *dev = i2c_dev->dev; in stm32f7_i2c_smbus_xfer_msg()
963 void __iomem *base = i2c_dev->base; in stm32f7_i2c_smbus_xfer_msg()
968 reinit_completion(&i2c_dev->complete); in stm32f7_i2c_smbus_xfer_msg()
1089 i2c_dev->use_dma = false; in stm32f7_i2c_smbus_xfer_msg()
1090 if (i2c_dev->dma && f7_msg->count >= STM32F7_I2C_DMA_LEN_MIN) { in stm32f7_i2c_smbus_xfer_msg()
1091 ret = stm32_i2c_prep_dma_xfer(i2c_dev->dev, i2c_dev->dma, in stm32f7_i2c_smbus_xfer_msg()
1095 i2c_dev); in stm32f7_i2c_smbus_xfer_msg()
1097 i2c_dev->use_dma = true; in stm32f7_i2c_smbus_xfer_msg()
1099 dev_warn(i2c_dev->dev, "can't use DMA\n"); in stm32f7_i2c_smbus_xfer_msg()
1102 if (!i2c_dev->use_dma) { in stm32f7_i2c_smbus_xfer_msg()
1117 i2c_dev->master_mode = true; in stm32f7_i2c_smbus_xfer_msg()
1126 static void stm32f7_i2c_smbus_rep_start(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_smbus_rep_start() argument
1128 struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg; in stm32f7_i2c_smbus_rep_start()
1129 void __iomem *base = i2c_dev->base; in stm32f7_i2c_smbus_rep_start()
1181 i2c_dev->use_dma = false; in stm32f7_i2c_smbus_rep_start()
1182 if (i2c_dev->dma && f7_msg->count >= STM32F7_I2C_DMA_LEN_MIN && in stm32f7_i2c_smbus_rep_start()
1185 ret = stm32_i2c_prep_dma_xfer(i2c_dev->dev, i2c_dev->dma, in stm32f7_i2c_smbus_rep_start()
1189 i2c_dev); in stm32f7_i2c_smbus_rep_start()
1192 i2c_dev->use_dma = true; in stm32f7_i2c_smbus_rep_start()
1194 dev_warn(i2c_dev->dev, "can't use DMA\n"); in stm32f7_i2c_smbus_rep_start()
1197 if (!i2c_dev->use_dma) in stm32f7_i2c_smbus_rep_start()
1210 static int stm32f7_i2c_smbus_check_pec(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_smbus_check_pec() argument
1212 struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg; in stm32f7_i2c_smbus_check_pec()
1215 internal_pec = readl_relaxed(i2c_dev->base + STM32F7_I2C_PECR); in stm32f7_i2c_smbus_check_pec()
1232 dev_err(i2c_dev->dev, "Unsupported smbus protocol for PEC\n"); in stm32f7_i2c_smbus_check_pec()
1237 dev_err(i2c_dev->dev, "Bad PEC 0x%02x vs. 0x%02x\n", in stm32f7_i2c_smbus_check_pec()
1271 static void stm32f7_i2c_slave_start(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_slave_start() argument
1273 struct i2c_client *slave = i2c_dev->slave_running; in stm32f7_i2c_slave_start()
1274 void __iomem *base = i2c_dev->base; in stm32f7_i2c_slave_start()
1278 if (i2c_dev->slave_dir) { in stm32f7_i2c_slave_start()
1319 static void stm32f7_i2c_slave_addr(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_slave_addr() argument
1321 void __iomem *base = i2c_dev->base; in stm32f7_i2c_slave_addr()
1325 isr = readl_relaxed(i2c_dev->base + STM32F7_I2C_ISR); in stm32f7_i2c_slave_addr()
1330 if (stm32f7_i2c_is_addr_match(i2c_dev->slave[i], addcode)) { in stm32f7_i2c_slave_addr()
1331 i2c_dev->slave_running = i2c_dev->slave[i]; in stm32f7_i2c_slave_addr()
1332 i2c_dev->slave_dir = dir; in stm32f7_i2c_slave_addr()
1335 stm32f7_i2c_slave_start(i2c_dev); in stm32f7_i2c_slave_addr()
1345 static int stm32f7_i2c_get_slave_id(struct stm32f7_i2c_dev *i2c_dev, in stm32f7_i2c_get_slave_id() argument
1351 if (i2c_dev->slave[i] == slave) { in stm32f7_i2c_get_slave_id()
1357 dev_err(i2c_dev->dev, "Slave 0x%x not registered\n", slave->addr); in stm32f7_i2c_get_slave_id()
1362 static int stm32f7_i2c_get_free_slave_id(struct stm32f7_i2c_dev *i2c_dev, in stm32f7_i2c_get_free_slave_id() argument
1365 struct device *dev = i2c_dev->dev; in stm32f7_i2c_get_free_slave_id()
1373 if (i2c_dev->smbus_mode && (slave->addr == 0x08)) { in stm32f7_i2c_get_free_slave_id()
1374 if (i2c_dev->slave[STM32F7_SLAVE_HOSTNOTIFY]) in stm32f7_i2c_get_free_slave_id()
1384 if (!i2c_dev->slave[i]) { in stm32f7_i2c_get_free_slave_id()
1396 static bool stm32f7_i2c_is_slave_registered(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_is_slave_registered() argument
1401 if (i2c_dev->slave[i]) in stm32f7_i2c_is_slave_registered()
1408 static bool stm32f7_i2c_is_slave_busy(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_is_slave_busy() argument
1414 if (i2c_dev->slave[i]) in stm32f7_i2c_is_slave_busy()
1421 static irqreturn_t stm32f7_i2c_slave_isr_event(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_slave_isr_event() argument
1423 void __iomem *base = i2c_dev->base; in stm32f7_i2c_slave_isr_event()
1428 status = readl_relaxed(i2c_dev->base + STM32F7_I2C_ISR); in stm32f7_i2c_slave_isr_event()
1432 i2c_slave_event(i2c_dev->slave_running, in stm32f7_i2c_slave_isr_event()
1446 val = readb_relaxed(i2c_dev->base + STM32F7_I2C_RXDR); in stm32f7_i2c_slave_isr_event()
1447 ret = i2c_slave_event(i2c_dev->slave_running, in stm32f7_i2c_slave_isr_event()
1451 cr2 = readl_relaxed(i2c_dev->base + STM32F7_I2C_CR2); in stm32f7_i2c_slave_isr_event()
1453 writel_relaxed(cr2, i2c_dev->base + STM32F7_I2C_CR2); in stm32f7_i2c_slave_isr_event()
1462 dev_dbg(i2c_dev->dev, "<%s>: Receive NACK\n", __func__); in stm32f7_i2c_slave_isr_event()
1469 stm32f7_i2c_disable_irq(i2c_dev, STM32F7_I2C_XFER_IRQ_MASK); in stm32f7_i2c_slave_isr_event()
1471 if (i2c_dev->slave_dir) { in stm32f7_i2c_slave_isr_event()
1484 i2c_slave_event(i2c_dev->slave_running, I2C_SLAVE_STOP, &val); in stm32f7_i2c_slave_isr_event()
1486 i2c_dev->slave_running = NULL; in stm32f7_i2c_slave_isr_event()
1491 stm32f7_i2c_slave_addr(i2c_dev); in stm32f7_i2c_slave_isr_event()
1498 struct stm32f7_i2c_dev *i2c_dev = data; in stm32f7_i2c_isr_event() local
1499 struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg; in stm32f7_i2c_isr_event()
1500 struct stm32_i2c_dma *dma = i2c_dev->dma; in stm32f7_i2c_isr_event()
1501 void __iomem *base = i2c_dev->base; in stm32f7_i2c_isr_event()
1506 if (!i2c_dev->master_mode) { in stm32f7_i2c_isr_event()
1507 ret = stm32f7_i2c_slave_isr_event(i2c_dev); in stm32f7_i2c_isr_event()
1511 status = readl_relaxed(i2c_dev->base + STM32F7_I2C_ISR); in stm32f7_i2c_isr_event()
1515 stm32f7_i2c_write_tx_data(i2c_dev); in stm32f7_i2c_isr_event()
1519 stm32f7_i2c_read_rx_data(i2c_dev); in stm32f7_i2c_isr_event()
1523 dev_dbg(i2c_dev->dev, "<%s>: Receive NACK (addr %x)\n", in stm32f7_i2c_isr_event()
1526 if (i2c_dev->use_dma) { in stm32f7_i2c_isr_event()
1527 stm32f7_i2c_disable_dma_req(i2c_dev); in stm32f7_i2c_isr_event()
1536 if (stm32f7_i2c_is_slave_registered(i2c_dev)) in stm32f7_i2c_isr_event()
1540 stm32f7_i2c_disable_irq(i2c_dev, mask); in stm32f7_i2c_isr_event()
1545 if (i2c_dev->use_dma && !f7_msg->result) { in stm32f7_i2c_isr_event()
1548 i2c_dev->master_mode = false; in stm32f7_i2c_isr_event()
1549 complete(&i2c_dev->complete); in stm32f7_i2c_isr_event()
1558 } else if (i2c_dev->use_dma && !f7_msg->result) { in stm32f7_i2c_isr_event()
1561 stm32f7_i2c_smbus_rep_start(i2c_dev); in stm32f7_i2c_isr_event()
1563 i2c_dev->msg_id++; in stm32f7_i2c_isr_event()
1564 i2c_dev->msg++; in stm32f7_i2c_isr_event()
1565 stm32f7_i2c_xfer_msg(i2c_dev, i2c_dev->msg); in stm32f7_i2c_isr_event()
1571 stm32f7_i2c_smbus_reload(i2c_dev); in stm32f7_i2c_isr_event()
1573 stm32f7_i2c_reload(i2c_dev); in stm32f7_i2c_isr_event()
1581 struct stm32f7_i2c_dev *i2c_dev = data; in stm32f7_i2c_isr_event_thread() local
1582 struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg; in stm32f7_i2c_isr_event_thread()
1583 struct stm32_i2c_dma *dma = i2c_dev->dma; in stm32f7_i2c_isr_event_thread()
1591 ret = wait_for_completion_timeout(&i2c_dev->dma->dma_complete, HZ); in stm32f7_i2c_isr_event_thread()
1593 dev_dbg(i2c_dev->dev, "<%s>: Timed out\n", __func__); in stm32f7_i2c_isr_event_thread()
1594 stm32f7_i2c_disable_dma_req(i2c_dev); in stm32f7_i2c_isr_event_thread()
1599 status = readl_relaxed(i2c_dev->base + STM32F7_I2C_ISR); in stm32f7_i2c_isr_event_thread()
1603 stm32f7_i2c_smbus_rep_start(i2c_dev); in stm32f7_i2c_isr_event_thread()
1605 i2c_dev->msg_id++; in stm32f7_i2c_isr_event_thread()
1606 i2c_dev->msg++; in stm32f7_i2c_isr_event_thread()
1607 stm32f7_i2c_xfer_msg(i2c_dev, i2c_dev->msg); in stm32f7_i2c_isr_event_thread()
1610 i2c_dev->master_mode = false; in stm32f7_i2c_isr_event_thread()
1611 complete(&i2c_dev->complete); in stm32f7_i2c_isr_event_thread()
1619 struct stm32f7_i2c_dev *i2c_dev = data; in stm32f7_i2c_isr_error() local
1620 struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg; in stm32f7_i2c_isr_error()
1621 void __iomem *base = i2c_dev->base; in stm32f7_i2c_isr_error()
1622 struct device *dev = i2c_dev->dev; in stm32f7_i2c_isr_error()
1623 struct stm32_i2c_dma *dma = i2c_dev->dma; in stm32f7_i2c_isr_error()
1626 status = readl_relaxed(i2c_dev->base + STM32F7_I2C_ISR); in stm32f7_i2c_isr_error()
1633 stm32f7_i2c_release_bus(&i2c_dev->adap); in stm32f7_i2c_isr_error()
1655 i2c_handle_smbus_alert(i2c_dev->alert->ara); in stm32f7_i2c_isr_error()
1659 if (!i2c_dev->slave_running) { in stm32f7_i2c_isr_error()
1662 if (stm32f7_i2c_is_slave_registered(i2c_dev)) in stm32f7_i2c_isr_error()
1666 stm32f7_i2c_disable_irq(i2c_dev, mask); in stm32f7_i2c_isr_error()
1670 if (i2c_dev->use_dma) { in stm32f7_i2c_isr_error()
1671 stm32f7_i2c_disable_dma_req(i2c_dev); in stm32f7_i2c_isr_error()
1675 i2c_dev->master_mode = false; in stm32f7_i2c_isr_error()
1676 complete(&i2c_dev->complete); in stm32f7_i2c_isr_error()
1681 static int stm32f7_i2c_wait_polling(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_wait_polling() argument
1683 ktime_t timeout = ktime_add_ms(ktime_get(), i2c_dev->adap.timeout); in stm32f7_i2c_wait_polling()
1687 stm32f7_i2c_isr_event(0, i2c_dev); in stm32f7_i2c_wait_polling()
1689 if (completion_done(&i2c_dev->complete)) in stm32f7_i2c_wait_polling()
1699 struct stm32f7_i2c_dev *i2c_dev = i2c_get_adapdata(i2c_adap); in stm32f7_i2c_xfer_core() local
1700 struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg; in stm32f7_i2c_xfer_core()
1701 struct stm32_i2c_dma *dma = i2c_dev->dma; in stm32f7_i2c_xfer_core()
1705 i2c_dev->msg = msgs; in stm32f7_i2c_xfer_core()
1706 i2c_dev->msg_num = num; in stm32f7_i2c_xfer_core()
1707 i2c_dev->msg_id = 0; in stm32f7_i2c_xfer_core()
1710 ret = pm_runtime_resume_and_get(i2c_dev->dev); in stm32f7_i2c_xfer_core()
1714 ret = stm32f7_i2c_wait_free_bus(i2c_dev); in stm32f7_i2c_xfer_core()
1718 stm32f7_i2c_xfer_msg(i2c_dev, msgs); in stm32f7_i2c_xfer_core()
1720 if (!i2c_dev->atomic) in stm32f7_i2c_xfer_core()
1721 time_left = wait_for_completion_timeout(&i2c_dev->complete, in stm32f7_i2c_xfer_core()
1722 i2c_dev->adap.timeout); in stm32f7_i2c_xfer_core()
1724 time_left = stm32f7_i2c_wait_polling(i2c_dev); in stm32f7_i2c_xfer_core()
1728 if (i2c_dev->use_dma) in stm32f7_i2c_xfer_core()
1737 i2c_dev->base + STM32F7_I2C_ISR); in stm32f7_i2c_xfer_core()
1742 dev_dbg(i2c_dev->dev, "Access to slave 0x%x timed out\n", in stm32f7_i2c_xfer_core()
1743 i2c_dev->msg->addr); in stm32f7_i2c_xfer_core()
1744 if (i2c_dev->use_dma) in stm32f7_i2c_xfer_core()
1746 stm32f7_i2c_wait_free_bus(i2c_dev); in stm32f7_i2c_xfer_core()
1751 pm_runtime_mark_last_busy(i2c_dev->dev); in stm32f7_i2c_xfer_core()
1752 pm_runtime_put_autosuspend(i2c_dev->dev); in stm32f7_i2c_xfer_core()
1760 struct stm32f7_i2c_dev *i2c_dev = i2c_get_adapdata(i2c_adap); in stm32f7_i2c_xfer() local
1762 i2c_dev->atomic = false; in stm32f7_i2c_xfer()
1769 struct stm32f7_i2c_dev *i2c_dev = i2c_get_adapdata(i2c_adap); in stm32f7_i2c_xfer_atomic() local
1771 i2c_dev->atomic = true; in stm32f7_i2c_xfer_atomic()
1780 struct stm32f7_i2c_dev *i2c_dev = i2c_get_adapdata(adapter); in stm32f7_i2c_smbus_xfer() local
1781 struct stm32f7_i2c_msg *f7_msg = &i2c_dev->f7_msg; in stm32f7_i2c_smbus_xfer()
1782 struct stm32_i2c_dma *dma = i2c_dev->dma; in stm32f7_i2c_smbus_xfer()
1783 struct device *dev = i2c_dev->dev; in stm32f7_i2c_smbus_xfer()
1796 ret = stm32f7_i2c_wait_free_bus(i2c_dev); in stm32f7_i2c_smbus_xfer()
1800 ret = stm32f7_i2c_smbus_xfer_msg(i2c_dev, flags, command, data); in stm32f7_i2c_smbus_xfer()
1804 timeout = wait_for_completion_timeout(&i2c_dev->complete, in stm32f7_i2c_smbus_xfer()
1805 i2c_dev->adap.timeout); in stm32f7_i2c_smbus_xfer()
1808 if (i2c_dev->use_dma) in stm32f7_i2c_smbus_xfer()
1817 i2c_dev->base + STM32F7_I2C_ISR); in stm32f7_i2c_smbus_xfer()
1823 if (i2c_dev->use_dma) in stm32f7_i2c_smbus_xfer()
1825 stm32f7_i2c_wait_free_bus(i2c_dev); in stm32f7_i2c_smbus_xfer()
1832 ret = stm32f7_i2c_smbus_check_pec(i2c_dev); in stm32f7_i2c_smbus_xfer()
1865 static void stm32f7_i2c_enable_wakeup(struct stm32f7_i2c_dev *i2c_dev, in stm32f7_i2c_enable_wakeup() argument
1868 void __iomem *base = i2c_dev->base; in stm32f7_i2c_enable_wakeup()
1871 if (!i2c_dev->wakeup_src) in stm32f7_i2c_enable_wakeup()
1875 device_set_wakeup_enable(i2c_dev->dev, true); in stm32f7_i2c_enable_wakeup()
1878 device_set_wakeup_enable(i2c_dev->dev, false); in stm32f7_i2c_enable_wakeup()
1885 struct stm32f7_i2c_dev *i2c_dev = i2c_get_adapdata(slave->adapter); in stm32f7_i2c_reg_slave() local
1886 void __iomem *base = i2c_dev->base; in stm32f7_i2c_reg_slave()
1887 struct device *dev = i2c_dev->dev; in stm32f7_i2c_reg_slave()
1896 if (stm32f7_i2c_is_slave_busy(i2c_dev)) { in stm32f7_i2c_reg_slave()
1901 ret = stm32f7_i2c_get_free_slave_id(i2c_dev, slave, &id); in stm32f7_i2c_reg_slave()
1909 if (!stm32f7_i2c_is_slave_registered(i2c_dev)) in stm32f7_i2c_reg_slave()
1910 stm32f7_i2c_enable_wakeup(i2c_dev, true); in stm32f7_i2c_reg_slave()
1915 i2c_dev->slave[id] = slave; in stm32f7_i2c_reg_slave()
1920 oar1 = readl_relaxed(i2c_dev->base + STM32F7_I2C_OAR1); in stm32f7_i2c_reg_slave()
1929 i2c_dev->slave[id] = slave; in stm32f7_i2c_reg_slave()
1930 writel_relaxed(oar1, i2c_dev->base + STM32F7_I2C_OAR1); in stm32f7_i2c_reg_slave()
1935 oar2 = readl_relaxed(i2c_dev->base + STM32F7_I2C_OAR2); in stm32f7_i2c_reg_slave()
1944 i2c_dev->slave[id] = slave; in stm32f7_i2c_reg_slave()
1945 writel_relaxed(oar2, i2c_dev->base + STM32F7_I2C_OAR2); in stm32f7_i2c_reg_slave()
1964 if (!stm32f7_i2c_is_slave_registered(i2c_dev)) in stm32f7_i2c_reg_slave()
1965 stm32f7_i2c_enable_wakeup(i2c_dev, false); in stm32f7_i2c_reg_slave()
1975 struct stm32f7_i2c_dev *i2c_dev = i2c_get_adapdata(slave->adapter); in stm32f7_i2c_unreg_slave() local
1976 void __iomem *base = i2c_dev->base; in stm32f7_i2c_unreg_slave()
1980 ret = stm32f7_i2c_get_slave_id(i2c_dev, slave, &id); in stm32f7_i2c_unreg_slave()
1984 WARN_ON(!i2c_dev->slave[id]); in stm32f7_i2c_unreg_slave()
1986 ret = pm_runtime_resume_and_get(i2c_dev->dev); in stm32f7_i2c_unreg_slave()
1998 i2c_dev->slave[id] = NULL; in stm32f7_i2c_unreg_slave()
2000 if (!stm32f7_i2c_is_slave_registered(i2c_dev)) { in stm32f7_i2c_unreg_slave()
2001 stm32f7_i2c_disable_irq(i2c_dev, STM32F7_I2C_ALL_IRQ_MASK); in stm32f7_i2c_unreg_slave()
2002 stm32f7_i2c_enable_wakeup(i2c_dev, false); in stm32f7_i2c_unreg_slave()
2005 pm_runtime_mark_last_busy(i2c_dev->dev); in stm32f7_i2c_unreg_slave()
2006 pm_runtime_put_autosuspend(i2c_dev->dev); in stm32f7_i2c_unreg_slave()
2011 static int stm32f7_i2c_write_fm_plus_bits(struct stm32f7_i2c_dev *i2c_dev, in stm32f7_i2c_write_fm_plus_bits() argument
2016 if (i2c_dev->bus_rate <= I2C_MAX_FAST_MODE_FREQ || in stm32f7_i2c_write_fm_plus_bits()
2017 IS_ERR_OR_NULL(i2c_dev->regmap)) in stm32f7_i2c_write_fm_plus_bits()
2021 if (i2c_dev->fmp_sreg == i2c_dev->fmp_creg) in stm32f7_i2c_write_fm_plus_bits()
2022 ret = regmap_update_bits(i2c_dev->regmap, in stm32f7_i2c_write_fm_plus_bits()
2023 i2c_dev->fmp_sreg, in stm32f7_i2c_write_fm_plus_bits()
2024 i2c_dev->fmp_mask, in stm32f7_i2c_write_fm_plus_bits()
2025 enable ? i2c_dev->fmp_mask : 0); in stm32f7_i2c_write_fm_plus_bits()
2027 ret = regmap_write(i2c_dev->regmap, in stm32f7_i2c_write_fm_plus_bits()
2028 enable ? i2c_dev->fmp_sreg : in stm32f7_i2c_write_fm_plus_bits()
2029 i2c_dev->fmp_creg, in stm32f7_i2c_write_fm_plus_bits()
2030 i2c_dev->fmp_mask); in stm32f7_i2c_write_fm_plus_bits()
2036 struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_setup_fm_plus_bits() argument
2041 i2c_dev->regmap = syscon_regmap_lookup_by_phandle(np, "st,syscfg-fmp"); in stm32f7_i2c_setup_fm_plus_bits()
2042 if (IS_ERR(i2c_dev->regmap)) in stm32f7_i2c_setup_fm_plus_bits()
2047 &i2c_dev->fmp_sreg); in stm32f7_i2c_setup_fm_plus_bits()
2051 i2c_dev->fmp_creg = i2c_dev->fmp_sreg + in stm32f7_i2c_setup_fm_plus_bits()
2052 i2c_dev->setup.fmp_clr_offset; in stm32f7_i2c_setup_fm_plus_bits()
2055 &i2c_dev->fmp_mask); in stm32f7_i2c_setup_fm_plus_bits()
2058 static int stm32f7_i2c_enable_smbus_host(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_enable_smbus_host() argument
2060 struct i2c_adapter *adap = &i2c_dev->adap; in stm32f7_i2c_enable_smbus_host()
2061 void __iomem *base = i2c_dev->base; in stm32f7_i2c_enable_smbus_host()
2068 i2c_dev->host_notify_client = client; in stm32f7_i2c_enable_smbus_host()
2076 static void stm32f7_i2c_disable_smbus_host(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_disable_smbus_host() argument
2078 void __iomem *base = i2c_dev->base; in stm32f7_i2c_disable_smbus_host()
2080 if (i2c_dev->host_notify_client) { in stm32f7_i2c_disable_smbus_host()
2084 i2c_free_slave_host_notify_device(i2c_dev->host_notify_client); in stm32f7_i2c_disable_smbus_host()
2088 static int stm32f7_i2c_enable_smbus_alert(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_enable_smbus_alert() argument
2091 struct i2c_adapter *adap = &i2c_dev->adap; in stm32f7_i2c_enable_smbus_alert()
2092 struct device *dev = i2c_dev->dev; in stm32f7_i2c_enable_smbus_alert()
2093 void __iomem *base = i2c_dev->base; in stm32f7_i2c_enable_smbus_alert()
2103 i2c_dev->alert = alert; in stm32f7_i2c_enable_smbus_alert()
2111 static void stm32f7_i2c_disable_smbus_alert(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_disable_smbus_alert() argument
2113 struct stm32f7_i2c_alert *alert = i2c_dev->alert; in stm32f7_i2c_disable_smbus_alert()
2114 void __iomem *base = i2c_dev->base; in stm32f7_i2c_disable_smbus_alert()
2126 struct stm32f7_i2c_dev *i2c_dev = i2c_get_adapdata(adap); in stm32f7_i2c_func() local
2135 if (i2c_dev->smbus_mode) in stm32f7_i2c_func()
2152 struct stm32f7_i2c_dev *i2c_dev; in stm32f7_i2c_probe() local
2160 i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL); in stm32f7_i2c_probe()
2161 if (!i2c_dev) in stm32f7_i2c_probe()
2164 i2c_dev->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in stm32f7_i2c_probe()
2165 if (IS_ERR(i2c_dev->base)) in stm32f7_i2c_probe()
2166 return PTR_ERR(i2c_dev->base); in stm32f7_i2c_probe()
2177 i2c_dev->wakeup_src = of_property_read_bool(pdev->dev.of_node, in stm32f7_i2c_probe()
2180 i2c_dev->clk = devm_clk_get(&pdev->dev, NULL); in stm32f7_i2c_probe()
2181 if (IS_ERR(i2c_dev->clk)) in stm32f7_i2c_probe()
2182 return dev_err_probe(&pdev->dev, PTR_ERR(i2c_dev->clk), in stm32f7_i2c_probe()
2185 ret = clk_prepare_enable(i2c_dev->clk); in stm32f7_i2c_probe()
2201 i2c_dev->dev = &pdev->dev; in stm32f7_i2c_probe()
2207 pdev->name, i2c_dev); in stm32f7_i2c_probe()
2215 pdev->name, i2c_dev); in stm32f7_i2c_probe()
2228 i2c_dev->setup = *setup; in stm32f7_i2c_probe()
2230 ret = stm32f7_i2c_setup_timing(i2c_dev, &i2c_dev->setup); in stm32f7_i2c_probe()
2235 if (i2c_dev->bus_rate > I2C_MAX_FAST_MODE_FREQ) { in stm32f7_i2c_probe()
2236 ret = stm32f7_i2c_setup_fm_plus_bits(pdev, i2c_dev); in stm32f7_i2c_probe()
2239 ret = stm32f7_i2c_write_fm_plus_bits(i2c_dev, true); in stm32f7_i2c_probe()
2244 adap = &i2c_dev->adap; in stm32f7_i2c_probe()
2245 i2c_set_adapdata(adap, i2c_dev); in stm32f7_i2c_probe()
2255 init_completion(&i2c_dev->complete); in stm32f7_i2c_probe()
2258 i2c_dev->dma = stm32_i2c_dma_request(i2c_dev->dev, phy_addr, in stm32f7_i2c_probe()
2261 if (IS_ERR(i2c_dev->dma)) { in stm32f7_i2c_probe()
2262 ret = PTR_ERR(i2c_dev->dma); in stm32f7_i2c_probe()
2266 dev_dbg(i2c_dev->dev, "No DMA option: fallback using interrupts\n"); in stm32f7_i2c_probe()
2267 i2c_dev->dma = NULL; in stm32f7_i2c_probe()
2270 if (i2c_dev->wakeup_src) { in stm32f7_i2c_probe()
2271 device_set_wakeup_capable(i2c_dev->dev, true); in stm32f7_i2c_probe()
2273 ret = dev_pm_set_wake_irq(i2c_dev->dev, irq_event); in stm32f7_i2c_probe()
2275 dev_err(i2c_dev->dev, "Failed to set wake up irq\n"); in stm32f7_i2c_probe()
2280 platform_set_drvdata(pdev, i2c_dev); in stm32f7_i2c_probe()
2282 pm_runtime_set_autosuspend_delay(i2c_dev->dev, in stm32f7_i2c_probe()
2284 pm_runtime_use_autosuspend(i2c_dev->dev); in stm32f7_i2c_probe()
2285 pm_runtime_set_active(i2c_dev->dev); in stm32f7_i2c_probe()
2286 pm_runtime_enable(i2c_dev->dev); in stm32f7_i2c_probe()
2290 stm32f7_i2c_hw_config(i2c_dev); in stm32f7_i2c_probe()
2292 i2c_dev->smbus_mode = of_property_read_bool(pdev->dev.of_node, "smbus"); in stm32f7_i2c_probe()
2298 if (i2c_dev->smbus_mode) { in stm32f7_i2c_probe()
2299 ret = stm32f7_i2c_enable_smbus_host(i2c_dev); in stm32f7_i2c_probe()
2301 dev_err(i2c_dev->dev, in stm32f7_i2c_probe()
2309 ret = stm32f7_i2c_enable_smbus_alert(i2c_dev); in stm32f7_i2c_probe()
2311 dev_err(i2c_dev->dev, in stm32f7_i2c_probe()
2318 dev_info(i2c_dev->dev, "STM32F7 I2C-%d bus adapter\n", adap->nr); in stm32f7_i2c_probe()
2320 pm_runtime_mark_last_busy(i2c_dev->dev); in stm32f7_i2c_probe()
2321 pm_runtime_put_autosuspend(i2c_dev->dev); in stm32f7_i2c_probe()
2326 stm32f7_i2c_disable_smbus_host(i2c_dev); in stm32f7_i2c_probe()
2332 pm_runtime_put_noidle(i2c_dev->dev); in stm32f7_i2c_probe()
2333 pm_runtime_disable(i2c_dev->dev); in stm32f7_i2c_probe()
2334 pm_runtime_set_suspended(i2c_dev->dev); in stm32f7_i2c_probe()
2335 pm_runtime_dont_use_autosuspend(i2c_dev->dev); in stm32f7_i2c_probe()
2337 if (i2c_dev->wakeup_src) in stm32f7_i2c_probe()
2338 dev_pm_clear_wake_irq(i2c_dev->dev); in stm32f7_i2c_probe()
2341 if (i2c_dev->wakeup_src) in stm32f7_i2c_probe()
2342 device_set_wakeup_capable(i2c_dev->dev, false); in stm32f7_i2c_probe()
2344 if (i2c_dev->dma) { in stm32f7_i2c_probe()
2345 stm32_i2c_dma_free(i2c_dev->dma); in stm32f7_i2c_probe()
2346 i2c_dev->dma = NULL; in stm32f7_i2c_probe()
2350 stm32f7_i2c_write_fm_plus_bits(i2c_dev, false); in stm32f7_i2c_probe()
2353 clk_disable_unprepare(i2c_dev->clk); in stm32f7_i2c_probe()
2360 struct stm32f7_i2c_dev *i2c_dev = platform_get_drvdata(pdev); in stm32f7_i2c_remove() local
2362 stm32f7_i2c_disable_smbus_alert(i2c_dev); in stm32f7_i2c_remove()
2363 stm32f7_i2c_disable_smbus_host(i2c_dev); in stm32f7_i2c_remove()
2365 i2c_del_adapter(&i2c_dev->adap); in stm32f7_i2c_remove()
2366 pm_runtime_get_sync(i2c_dev->dev); in stm32f7_i2c_remove()
2368 if (i2c_dev->wakeup_src) { in stm32f7_i2c_remove()
2369 dev_pm_clear_wake_irq(i2c_dev->dev); in stm32f7_i2c_remove()
2374 device_init_wakeup(i2c_dev->dev, false); in stm32f7_i2c_remove()
2377 pm_runtime_put_noidle(i2c_dev->dev); in stm32f7_i2c_remove()
2378 pm_runtime_disable(i2c_dev->dev); in stm32f7_i2c_remove()
2379 pm_runtime_set_suspended(i2c_dev->dev); in stm32f7_i2c_remove()
2380 pm_runtime_dont_use_autosuspend(i2c_dev->dev); in stm32f7_i2c_remove()
2382 if (i2c_dev->dma) { in stm32f7_i2c_remove()
2383 stm32_i2c_dma_free(i2c_dev->dma); in stm32f7_i2c_remove()
2384 i2c_dev->dma = NULL; in stm32f7_i2c_remove()
2387 stm32f7_i2c_write_fm_plus_bits(i2c_dev, false); in stm32f7_i2c_remove()
2389 clk_disable_unprepare(i2c_dev->clk); in stm32f7_i2c_remove()
2394 struct stm32f7_i2c_dev *i2c_dev = dev_get_drvdata(dev); in stm32f7_i2c_runtime_suspend() local
2396 if (!stm32f7_i2c_is_slave_registered(i2c_dev)) in stm32f7_i2c_runtime_suspend()
2397 clk_disable(i2c_dev->clk); in stm32f7_i2c_runtime_suspend()
2404 struct stm32f7_i2c_dev *i2c_dev = dev_get_drvdata(dev); in stm32f7_i2c_runtime_resume() local
2407 if (!stm32f7_i2c_is_slave_registered(i2c_dev)) { in stm32f7_i2c_runtime_resume()
2408 ret = clk_enable(i2c_dev->clk); in stm32f7_i2c_runtime_resume()
2418 static int __maybe_unused stm32f7_i2c_regs_backup(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_regs_backup() argument
2421 struct stm32f7_i2c_regs *backup_regs = &i2c_dev->backup_regs; in stm32f7_i2c_regs_backup()
2423 ret = pm_runtime_resume_and_get(i2c_dev->dev); in stm32f7_i2c_regs_backup()
2427 backup_regs->cr1 = readl_relaxed(i2c_dev->base + STM32F7_I2C_CR1); in stm32f7_i2c_regs_backup()
2428 backup_regs->cr2 = readl_relaxed(i2c_dev->base + STM32F7_I2C_CR2); in stm32f7_i2c_regs_backup()
2429 backup_regs->oar1 = readl_relaxed(i2c_dev->base + STM32F7_I2C_OAR1); in stm32f7_i2c_regs_backup()
2430 backup_regs->oar2 = readl_relaxed(i2c_dev->base + STM32F7_I2C_OAR2); in stm32f7_i2c_regs_backup()
2431 backup_regs->tmgr = readl_relaxed(i2c_dev->base + STM32F7_I2C_TIMINGR); in stm32f7_i2c_regs_backup()
2432 stm32f7_i2c_write_fm_plus_bits(i2c_dev, false); in stm32f7_i2c_regs_backup()
2434 pm_runtime_put_sync(i2c_dev->dev); in stm32f7_i2c_regs_backup()
2439 static int __maybe_unused stm32f7_i2c_regs_restore(struct stm32f7_i2c_dev *i2c_dev) in stm32f7_i2c_regs_restore() argument
2443 struct stm32f7_i2c_regs *backup_regs = &i2c_dev->backup_regs; in stm32f7_i2c_regs_restore()
2445 ret = pm_runtime_resume_and_get(i2c_dev->dev); in stm32f7_i2c_regs_restore()
2449 cr1 = readl_relaxed(i2c_dev->base + STM32F7_I2C_CR1); in stm32f7_i2c_regs_restore()
2451 stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1, in stm32f7_i2c_regs_restore()
2454 writel_relaxed(backup_regs->tmgr, i2c_dev->base + STM32F7_I2C_TIMINGR); in stm32f7_i2c_regs_restore()
2456 i2c_dev->base + STM32F7_I2C_CR1); in stm32f7_i2c_regs_restore()
2458 stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1, in stm32f7_i2c_regs_restore()
2460 writel_relaxed(backup_regs->cr2, i2c_dev->base + STM32F7_I2C_CR2); in stm32f7_i2c_regs_restore()
2461 writel_relaxed(backup_regs->oar1, i2c_dev->base + STM32F7_I2C_OAR1); in stm32f7_i2c_regs_restore()
2462 writel_relaxed(backup_regs->oar2, i2c_dev->base + STM32F7_I2C_OAR2); in stm32f7_i2c_regs_restore()
2463 stm32f7_i2c_write_fm_plus_bits(i2c_dev, true); in stm32f7_i2c_regs_restore()
2465 pm_runtime_put_sync(i2c_dev->dev); in stm32f7_i2c_regs_restore()
2472 struct stm32f7_i2c_dev *i2c_dev = dev_get_drvdata(dev); in stm32f7_i2c_suspend() local
2475 i2c_mark_adapter_suspended(&i2c_dev->adap); in stm32f7_i2c_suspend()
2478 ret = stm32f7_i2c_regs_backup(i2c_dev); in stm32f7_i2c_suspend()
2480 i2c_mark_adapter_resumed(&i2c_dev->adap); in stm32f7_i2c_suspend()
2493 struct stm32f7_i2c_dev *i2c_dev = dev_get_drvdata(dev); in stm32f7_i2c_resume() local
2502 ret = stm32f7_i2c_regs_restore(i2c_dev); in stm32f7_i2c_resume()
2507 i2c_mark_adapter_resumed(&i2c_dev->adap); in stm32f7_i2c_resume()