Lines Matching refs:control

47 static void smu_v11_0_i2c_set_clock_gating(struct i2c_adapter *control, bool en)  in smu_v11_0_i2c_set_clock_gating()  argument
49 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_set_clock_gating()
76 static int smu_v11_0_i2c_enable(struct i2c_adapter *control, bool enable) in smu_v11_0_i2c_enable() argument
78 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_enable()
102 static void smu_v11_0_i2c_clear_status(struct i2c_adapter *control) in smu_v11_0_i2c_clear_status() argument
104 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_clear_status()
113 static void smu_v11_0_i2c_configure(struct i2c_adapter *control) in smu_v11_0_i2c_configure() argument
115 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_configure()
135 static void smu_v11_0_i2c_set_clock(struct i2c_adapter *control) in smu_v11_0_i2c_set_clock() argument
137 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_set_clock()
159 static void smu_v11_0_i2c_set_address(struct i2c_adapter *control, u16 address) in smu_v11_0_i2c_set_address() argument
161 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_set_address()
171 static uint32_t smu_v11_0_i2c_poll_tx_status(struct i2c_adapter *control) in smu_v11_0_i2c_poll_tx_status() argument
173 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_poll_tx_status()
217 smu_v11_0_i2c_clear_status(control); in smu_v11_0_i2c_poll_tx_status()
223 static uint32_t smu_v11_0_i2c_poll_rx_status(struct i2c_adapter *control) in smu_v11_0_i2c_poll_rx_status() argument
225 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_poll_rx_status()
238 smu_v11_0_i2c_clear_status(control); in smu_v11_0_i2c_poll_rx_status()
268 static uint32_t smu_v11_0_i2c_transmit(struct i2c_adapter *control, in smu_v11_0_i2c_transmit() argument
272 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_transmit()
288 smu_v11_0_i2c_set_address(control, address); in smu_v11_0_i2c_transmit()
290 smu_v11_0_i2c_enable(control, true); in smu_v11_0_i2c_transmit()
293 smu_v11_0_i2c_clear_status(control); in smu_v11_0_i2c_transmit()
337 ret = smu_v11_0_i2c_poll_tx_status(control); in smu_v11_0_i2c_transmit()
367 static uint32_t smu_v11_0_i2c_receive(struct i2c_adapter *control, in smu_v11_0_i2c_receive() argument
371 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_receive()
378 smu_v11_0_i2c_set_address(control, address); in smu_v11_0_i2c_receive()
381 smu_v11_0_i2c_enable(control, true); in smu_v11_0_i2c_receive()
386 smu_v11_0_i2c_clear_status(control); in smu_v11_0_i2c_receive()
406 ret = smu_v11_0_i2c_poll_rx_status(control); in smu_v11_0_i2c_receive()
441 static void smu_v11_0_i2c_abort(struct i2c_adapter *control) in smu_v11_0_i2c_abort() argument
443 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_abort()
458 static bool smu_v11_0_i2c_activity_done(struct i2c_adapter *control) in smu_v11_0_i2c_activity_done() argument
460 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_activity_done()
476 smu_v11_0_i2c_abort(control); in smu_v11_0_i2c_activity_done()
497 static void smu_v11_0_i2c_init(struct i2c_adapter *control) in smu_v11_0_i2c_init() argument
502 smu_v11_0_i2c_set_clock_gating(control, false); in smu_v11_0_i2c_init()
504 if (!smu_v11_0_i2c_activity_done(control)) in smu_v11_0_i2c_init()
508 res = smu_v11_0_i2c_enable(control, false); in smu_v11_0_i2c_init()
510 smu_v11_0_i2c_abort(control); in smu_v11_0_i2c_init()
513 smu_v11_0_i2c_configure(control); in smu_v11_0_i2c_init()
516 smu_v11_0_i2c_set_clock(control); in smu_v11_0_i2c_init()
520 static void smu_v11_0_i2c_fini(struct i2c_adapter *control) in smu_v11_0_i2c_fini() argument
522 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_fini()
527 res = smu_v11_0_i2c_enable(control, false); in smu_v11_0_i2c_fini()
540 smu_v11_0_i2c_abort(control); in smu_v11_0_i2c_fini()
556 static bool smu_v11_0_i2c_bus_lock(struct i2c_adapter *control) in smu_v11_0_i2c_bus_lock() argument
558 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_bus_lock()
568 static bool smu_v11_0_i2c_bus_unlock(struct i2c_adapter *control) in smu_v11_0_i2c_bus_unlock() argument
570 struct amdgpu_smu_i2c_bus *smu_i2c = i2c_get_adapdata(control); in smu_v11_0_i2c_bus_unlock()
582 static uint32_t smu_v11_0_i2c_read_data(struct i2c_adapter *control, in smu_v11_0_i2c_read_data() argument
587 ret = smu_v11_0_i2c_receive(control, msg->addr, msg->buf, msg->len, i2c_flag); in smu_v11_0_i2c_read_data()
595 static uint32_t smu_v11_0_i2c_write_data(struct i2c_adapter *control, in smu_v11_0_i2c_write_data() argument
600 ret = smu_v11_0_i2c_transmit(control, msg->addr, msg->buf, msg->len, i2c_flag); in smu_v11_0_i2c_write_data()
728 struct i2c_adapter *control = &smu_i2c->adapter; in smu_v11_0_i2c_control_init() local
734 control->owner = THIS_MODULE; in smu_v11_0_i2c_control_init()
735 control->class = I2C_CLASS_HWMON; in smu_v11_0_i2c_control_init()
736 control->dev.parent = &adev->pdev->dev; in smu_v11_0_i2c_control_init()
737 control->algo = &smu_v11_0_i2c_algo; in smu_v11_0_i2c_control_init()
738 snprintf(control->name, sizeof(control->name), "AMDGPU SMU 0"); in smu_v11_0_i2c_control_init()
739 control->lock_ops = &smu_v11_0_i2c_i2c_lock_ops; in smu_v11_0_i2c_control_init()
740 control->quirks = &smu_v11_0_i2c_control_quirks; in smu_v11_0_i2c_control_init()
741 i2c_set_adapdata(control, smu_i2c); in smu_v11_0_i2c_control_init()
746 res = i2c_add_adapter(control); in smu_v11_0_i2c_control_init()
755 struct i2c_adapter *control = adev->pm.ras_eeprom_i2c_bus; in smu_v11_0_i2c_control_fini() local
757 i2c_del_adapter(control); in smu_v11_0_i2c_control_fini()
768 bool smu_v11_0_i2c_test_bus(struct i2c_adapter *control)
777 if (!smu_v11_0_i2c_bus_lock(control)) {
782 smu_v11_0_i2c_init(control);
785 ret = smu_v11_0_i2c_write_data(control, I2C_TARGET_ADDR, data, 6);
787 ret = smu_v11_0_i2c_read_data(control, I2C_TARGET_ADDR, data, 6);
789 smu_v11_0_i2c_fini(control);
791 smu_v11_0_i2c_bus_unlock(control);