Skip to content

Commit 25bcc0c

Browse files
author
Jostar Yang
committed
Modify SN offset and include path
1 parent cd235ab commit 25bcc0c

2 files changed

Lines changed: 7 additions & 29 deletions

File tree

platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ obj-m:= accton_i2c_cpld.o \
33
accton_as7326_56x_fan.o accton_as7326_56x_leds.o \
44
accton_as7326_56x_psu.o ym2651y.o \
55
pddf_custom_psu.o
6-
6+
7+
8+
CFLAGS_pddf_custom_psu.o := -I$(M)/../../../../pddf/i2c/modules/include
9+
KBUILD_EXTRA_SYMBOLS := $(M)/../../../../pddf/i2c/Module.symvers.PDDF
10+
711
else
812
ifeq (,$(KERNEL_SRC))
913
$(error KERNEL_SRC is not defined)

platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/pddf_custom_psu.c

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <linux/sysfs.h>
1010
#include <linux/slab.h>
1111
#include <linux/dmi.h>
12-
#include "../../../../pddf/i2c/modules/include/pddf_psu_defs.h"
12+
#include "pddf_psu_defs.h"
1313

1414
ssize_t pddf_get_custom_psu_model_name(struct device *dev, struct device_attribute *da, char *buf);
1515
ssize_t pddf_get_custom_psu_serial_num(struct device *dev, struct device_attribute *da, char *buf);
@@ -51,7 +51,7 @@ struct model_name_info models[] = {
5151
};
5252

5353
struct serial_number_info serials[] = {
54-
{PSU_TYPE_AC_110V, 0x35, 18, 18, "YM-2651Y"},
54+
{PSU_TYPE_AC_110V, 0x2e, 18, 18, "YM-2651Y"},
5555
{PSU_TYPE_DC_48V, 0x2e, 18, 18, "YM-2651V"},
5656
{PSU_TYPE_DC_12V, 0x2e, 18, 18, "PSU-12V-750"},
5757
{PSU_TYPE_AC_ACBEL_FSF019, 0x2e, 16, 16, "FSF019-"}
@@ -97,7 +97,6 @@ ssize_t pddf_get_custom_psu_serial_num(struct device *dev, struct device_attribu
9797
{
9898
struct i2c_client *client = to_i2c_client(dev);
9999
struct pddf_psu_data data;
100-
char sub_type[4];
101100
int i, status;
102101

103102
for (i = 0; i < ARRAY_SIZE(models); i++) {
@@ -118,30 +117,6 @@ ssize_t pddf_get_custom_psu_serial_num(struct device *dev, struct device_attribu
118117
/* Determine if the model name is known, if not, read next index
119118
*/
120119
if (strncmp(data.model_name, models[i].model_name, models[i].chk_length) == 0) {
121-
/*For YM-2651Y BR. BR use offset-0x2e to store SN.
122-
*B01R use offset-0x35 to store store SN. Default use 0x35 for YM-2651Y
123-
*/
124-
if(!strncmp(models[i].model_name, "YM-2651Y", sizeof(models[i].model_name)))
125-
{
126-
memset(sub_type, 0, sizeof(sub_type));
127-
status = pddf_psu_read_block(client, 0x29,
128-
sub_type, sizeof(sub_type));
129-
130-
if (status < 0) {
131-
data.serial_number[0] = '\0';
132-
dev_dbg(&client->dev, "unable to read sub_type from (0x%x) offset(0x%x)\n",
133-
client->addr, 0x29);
134-
return status;
135-
}
136-
else
137-
{
138-
if(!strncmp(sub_type,"BR" , 2))
139-
{
140-
serials[i].offset=0x2e;
141-
}
142-
}
143-
}
144-
145120
status = pddf_psu_read_block(client, serials[i].offset,
146121
data.serial_number, serials[i].length);
147122

@@ -216,7 +191,6 @@ static int __init pddf_custom_psu_init(void)
216191

217192
static void __exit pddf_custom_psu_exit(void)
218193
{
219-
printk(KERN_ERR "pddf_custom_psu_exit\n");
220194
return;
221195
}
222196

0 commit comments

Comments
 (0)