/* * I don't have specifications for the MCU firmware, I found this register * and bits positions by the trial&error method.
*/ #define MCU_REG_CTRL 0x20 #define MCU_CTRL_POFF 0x40 #define MCU_CTRL_BTN 0x80
while (!kthread_should_stop()) {
ret = i2c_smbus_read_byte_data(mcu->client, MCU_REG_CTRL); if (ret < 0)
pr_err("MCU status reg read failed.\n");
mcu->reg_ctrl = ret;
if (mcu->reg_ctrl & MCU_CTRL_BTN) {
i2c_smbus_write_byte_data(mcu->client, MCU_REG_CTRL,
mcu->reg_ctrl & ~MCU_CTRL_BTN);
ret = i2c_smbus_read_byte_data(mcu->client, MCU_REG_CTRL); if (ret < 0) goto err;
mcu->reg_ctrl = ret;
ret = mcu_gpiochip_add(mcu); if (ret) goto err;
/* XXX: this is potentially racy, but there is no lock for pm_power_off */ if (!pm_power_off) {
glob_mcu = mcu;
pm_power_off = mcu_power_off;
dev_info(&client->dev, "will provide power-off service\n");
}
if (device_create_file(&client->dev, &dev_attr_status))
dev_err(&client->dev, "couldn't create device file for status\n");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.