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

[as9716_32d] Modify to support new PSU SN #6691

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
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
edc3acd
[as9716_32d] Modify to support new PSU SN
Feb 5, 2021
8bd858d
Merge branch 'master' into as9716_20210205_new_psu_psn
jostar-yang Feb 10, 2022
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 16
#define MAX_SERIAL_NUMBER 19
#define MAX_SERIAL_NUMBER 20

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 @@ -280,18 +280,45 @@ static struct as9716_32d_psu_data *as9716_32d_psu_update_device(struct device *d
data->model_name[0] = '\0';
dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr);
}
else {
data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0';
else
{
if (!strncmp(data->model_name, "FSH082", strlen("FSH082")))
{
data->model_name[strlen("FSH082")]='\0';
}
else if (!strncmp(data->model_name, "YESM1300", strlen("YESM1300")))
{
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("YESM1300AM")]='\0';
}
else
data->model_name[strlen("YESM1300")]='\0';
}
else if (!strncmp(data->model_name, "YM-2651Y", strlen("YM-2651Y")))
{
data->model_name[strlen("YM-2651Y")]='\0';
}
else
data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0';

}
/* Read from offset 0x2e ~ 0x3d (16 bytes) */
status = as9716_32d_psu_read_block(client, 0x2e,data->serial_number, MAX_SERIAL_NUMBER);
/* Read from offset 0x35 ~ 0x47 */
status = as9716_32d_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);
}
data->serial_number[MAX_SERIAL_NUMBER-1]='\0';
if (!strncmp(data->model_name, "YESM1300AM", strlen("YESM1300AM"))) /*for YESM1300AM, SN length=19*/
{
data->serial_number[MAX_SERIAL_NUMBER-1]='\0';
}
else /*for FSH082, SN length=18*/
data->serial_number[MAX_SERIAL_NUMBER-2]='\0';

}

data->last_updated = jiffies;
Expand All @@ -308,4 +335,3 @@ module_i2c_driver(as9716_32d_psu_driver);
MODULE_AUTHOR("Jostar Yang <jostar_yang@accton.com.tw>");
MODULE_DESCRIPTION("as9716_32d_psu driver");
MODULE_LICENSE("GPL");