Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[as4630-54pe]Modify to read correct psu SN and ID #5389

Merged
merged 24 commits into from
Jul 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e0870a7
Add support as9716 platform
jostar-yang Jun 12, 2019
b580e8a
Merge branch 'master' of https://github.com/jostar-yang/sonic-buildimage
jostar-yang Jun 12, 2019
7973485
remove as9716
jostar-yang Jun 12, 2019
78f4fc3
remove as9716 needed mk
jostar-yang Jun 12, 2019
8a6c679
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
jostar-yang Jun 17, 2019
f7826e3
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
jostar-yang Jun 20, 2019
94006a5
Add to support as9716 platform
jostar-yang Jul 17, 2019
a893a68
Add support build as9716 platform to mk file
jostar-yang Jul 17, 2019
4c21d0a
Add support AS5835_54T platform
jostar-yang Jul 17, 2019
f3220df
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
jostar-yang Jul 19, 2019
2e2b8ac
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
jostar-yang Aug 5, 2019
c517556
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
jostar-yang Sep 5, 2019
5ded80f
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
jostar-yang Sep 11, 2019
e9aba06
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
jostar-yang Sep 25, 2019
c148f54
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
jostar-yang Oct 25, 2019
fa793e0
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
jostar-yang Jan 6, 2020
48a537c
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
jostar-yang Jan 7, 2020
531f583
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
jostar-yang Mar 5, 2020
9002b0f
Merge remote-tracking branch 'upstream/master'
Apr 8, 2021
9da12fb
Fix control file fail issue
Apr 9, 2021
8fe11e3
Fix file conflict
Apr 9, 2021
dd1644b
Remove extra 'import'
Apr 9, 2021
d37b43a
[as4630-54pe]Modify to read correct psu SN and ID
jostar-yang Sep 16, 2020
630d9de
[as4630-54pe]Aligne code to 4 space
jostar-yang Sep 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <linux/dmi.h>

#define MAX_MODEL_NAME 20
#define MAX_SERIAL_NUMBER 18
#define MAX_SERIAL_NUMBER 19

static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf);
static ssize_t show_string(struct device *dev, struct device_attribute *da, char *buf);
Expand Down Expand Up @@ -90,8 +90,7 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da,
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct as4630_54pe_psu_data *data = as4630_54pe_psu_update_device(dev);
u8 status = 0;

//printk("data->status=0x%x, attr->index=%d,data->index=%d \n", data->status, attr->index, data->index);

if (attr->index == PSU_PRESENT) {
if(data->index==0)
status = !( (data->status >> 5) & 0x1);
Expand Down Expand Up @@ -267,7 +266,6 @@ static struct as4630_54pe_psu_data *as4630_54pe_psu_update_device(struct device

/* Read psu status */
status = as4630_54pe_cpld_read(0x60, 0x22);
//printk("status=0x%x in %s\n", status, __FUNCTION__);
if (status < 0) {
dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status);
}
Expand All @@ -286,21 +284,36 @@ static struct as4630_54pe_psu_data *as4630_54pe_psu_update_device(struct device
if (status < 0) {
data->model_name[0] = '\0';
dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr);
printk("unable to read model name from (0x%x)\n", client->addr);
}
else {
else if(!strncmp(data->model_name, "YPEB1200", strlen("YPEB1200")))
{
if (data->model_name[9]=='A' && data->model_name[10]=='M')
{
data->model_name[8]='A';
data->model_name[9]='M';
data->model_name[strlen("YPEB1200AM")]='\0';
}
else
data->model_name[strlen("YPEB1200")]='\0';
}
else
{
data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0';

}
/* Read from offset 0x2e ~ 0x3d (16 bytes) */
/* Read from offset 0x35 ~ 0x46 (18 bytes) */
status = as4630_54pe_psu_read_block(client, 0x35,data->serial_number, MAX_SERIAL_NUMBER);
if (status < 0)
{
data->serial_number[0] = '\0';
dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x2e)\n", client->addr);
printk("unable to read model name from (0x%x) offset(0x2e)\n", client->addr);
dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x35)\n", client->addr);
}
if (!strncmp(data->model_name, "YPEB1200AM", strlen("YPEB1200AM"))) /*for YPEB1200AM, SN length=18*/
{
data->serial_number[MAX_SERIAL_NUMBER-1]='\0';
}
data->serial_number[MAX_SERIAL_NUMBER-1]='\0';
else
data->serial_number[MAX_SERIAL_NUMBER-2]='\0';

}

data->last_updated = jiffies;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

try:
import commands
import getopt
import sys
import getopt, sys
import logging
import logging.config
import logging.handlers
Expand Down