fbelavenuto / redpill-lkm

Linux kernel module for RedPill
GNU General Public License v3.0
4 stars 9 forks source link

FS2500 and RS4021xs+ power issues #2

Open fbelavenuto opened 2 years ago

fbelavenuto commented 2 years ago

I got this messages below (no relative to the discs), maybe some work is necessary yet? image

Originally posted by @fbelavenuto in https://github.com/fbelavenuto/arpl-addons/issues/11#issuecomment-1212169916

PeterSuh-Q3 commented 2 years ago

I want to look at the changes in the warning messages of @Puri and dual PSUs and single PSU. RS3618xs, a single PSU model, is additionally included as an m shell model.

There was no power warning message on this RackStation model, which is a single PSU.

https://xpenology.com/forum/topic/64347-rs3618xs-single-psu-loader-development-thread/

Puri12 commented 2 years ago

I think we need to complete the psu code of redpill-lkm/shim/bios/bios_hwmon_shim.c by referring to the code below in linux-4.4.x/drivers/hwmon/pmbus/pmbus_core.c.

#ifdef CONFIG_SYNO_PMBUS_FEATURES
int syno_get_pmbus_status(struct _SYNO_HWMON_SENSOR_TYPE *PsuStatus, int psu_no)
{
    struct i2c_client *client;
    struct pmbus_data *data;
    struct pmbus_sensor *sensor;
    int ret = -1;
    int i = 0;

    if (NULL == PsuStatus){
        return -ENODEV;
    }

    for (i = 0 ; i < psu_no ; i++) {
        client = syno_find_pmbus_client(i+1);

        if (NULL == client) {
            printk("pmbus: client not found.\n");
            return -ENODEV;
        }

        data = i2c_get_clientdata(client);
        for (sensor = data->sensors; sensor; sensor = sensor->next) {
            if (!data->valid || sensor->update) {
                sensor->data= _pmbus_read_word_data(client, sensor->page,sensor->reg);
                if (!strcmp(sensor->name, "pin")) {
                    snprintf(PsuStatus[i].sensor[0].value, MAX_SENSOR_VALUE, "%ld", pmbus_reg2data(data, sensor)/1000000);
                } else if (!strcmp(sensor->name, "pout")) {
                    snprintf(PsuStatus[i].sensor[1].value, MAX_SENSOR_VALUE, "%ld", pmbus_reg2data(data, sensor)/1000000);
                } else if (!strcmp(sensor->name, "temp")) {
                    snprintf(PsuStatus[i].sensor[2].value, MAX_SENSOR_VALUE, "%ld", pmbus_reg2data(data, sensor)/1000);
                } else if (!strcmp(sensor->name, "fan")) {
                    snprintf(PsuStatus[i].sensor[3].value, MAX_SENSOR_VALUE, "%ld", pmbus_reg2data(data, sensor));
                } else if (!strcmp(sensor->name, "Status")) {
                    snprintf(PsuStatus[i].sensor[4].value, MAX_SENSOR_VALUE, "0x%x", sensor->data);
                }
            }
        }
    }
    ret = 0;

    return ret;
}
#endif /* CONFIG_SYNO_PMBUS_FEATURES */

And the code above seems to be related to this error as well.

[41347.736099] Cannot get i2c adapter!
[41347.738059] /source/synobios/broadwellnk/broadwellnk_common.c:1329 return error!