Lines Matching full:mcu
5 * Sophgo power control mcu for SG2042
17 /* fixed MCU registers */
41 struct sg2042_mcu_data *mcu = seqf->private; \
43 ret = i2c_smbus_read_byte_data(mcu->client, (_reg)); \
60 struct sg2042_mcu_data *mcu = dev_get_drvdata(dev); in reset_count_show() local
63 ret = i2c_smbus_read_byte_data(mcu->client, REG_RST_COUNT); in reset_count_show()
74 struct sg2042_mcu_data *mcu = dev_get_drvdata(dev); in uptime_show() local
78 ret = i2c_smbus_read_i2c_block_data(mcu->client, REG_UPTIME, in uptime_show()
91 struct sg2042_mcu_data *mcu = dev_get_drvdata(dev); in reset_reason_show() local
94 ret = i2c_smbus_read_byte_data(mcu->client, REG_RESET_REASON); in reset_reason_show()
105 struct sg2042_mcu_data *mcu = dev_get_drvdata(dev); in repower_policy_show() local
109 ret = i2c_smbus_read_byte_data(mcu->client, REG_REPOWER_POLICY); in repower_policy_show()
127 struct sg2042_mcu_data *mcu = dev_get_drvdata(dev); in repower_policy_store() local
138 ret = i2c_smbus_write_byte_data(mcu->client, in repower_policy_store()
185 struct sg2042_mcu_data *mcu = dev_get_drvdata(dev); in sg2042_mcu_read() local
203 tmp = i2c_smbus_read_byte_data(mcu->client, reg); in sg2042_mcu_read()
215 struct sg2042_mcu_data *mcu = dev_get_drvdata(dev); in sg2042_mcu_write() local
222 guard(mutex)(&mcu->mutex); in sg2042_mcu_write()
226 hyst_temp = i2c_smbus_read_byte_data(mcu->client, in sg2042_mcu_write()
235 crit_temp = i2c_smbus_read_byte_data(mcu->client, in sg2042_mcu_write()
248 * ensure hyst_temp is smaller to avoid MCU from in sg2042_mcu_write()
254 return i2c_smbus_write_byte_data(mcu->client, reg, temp); in sg2042_mcu_write()
292 static void sg2042_mcu_debugfs_init(struct sg2042_mcu_data *mcu) in sg2042_mcu_debugfs_init() argument
294 debugfs_create_file("firmware_version", 0444, mcu->client->debugfs, in sg2042_mcu_debugfs_init()
295 mcu, &firmware_version_fops); in sg2042_mcu_debugfs_init()
296 debugfs_create_file("pcb_version", 0444, mcu->client->debugfs, mcu, in sg2042_mcu_debugfs_init()
298 debugfs_create_file("mcu_type", 0444, mcu->client->debugfs, mcu, in sg2042_mcu_debugfs_init()
300 debugfs_create_file("board_type", 0444, mcu->client->debugfs, mcu, in sg2042_mcu_debugfs_init()
307 struct sg2042_mcu_data *mcu; in sg2042_mcu_i2c_probe() local
314 mcu = devm_kmalloc(dev, sizeof(*mcu), GFP_KERNEL); in sg2042_mcu_i2c_probe()
315 if (!mcu) in sg2042_mcu_i2c_probe()
318 mutex_init(&mcu->mutex); in sg2042_mcu_i2c_probe()
319 mcu->client = client; in sg2042_mcu_i2c_probe()
321 i2c_set_clientdata(client, mcu); in sg2042_mcu_i2c_probe()
324 mcu, in sg2042_mcu_i2c_probe()
330 sg2042_mcu_debugfs_init(mcu); in sg2042_mcu_i2c_probe()
336 { "sg2042-hwmon-mcu" },
342 { .compatible = "sophgo,sg2042-hwmon-mcu" },
349 .name = "sg2042-mcu",
359 MODULE_DESCRIPTION("MCU I2C driver for SG2042 soc platform");