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

[ACCTON][AS5915-18X] Remove 7segment led #1010

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -80,7 +80,6 @@ static struct as5915_18x_led_data *ledctl = NULL;
static const u8 led_reg[] = {
0x40, /* LOC LED */
0x41, /* ALARM / DIAG LED */
0xBD, /* 7-segment LED */
};

enum led_type {
Expand All @@ -90,7 +89,6 @@ enum led_type {
LED_TYPE_FAN,
LED_TYPE_PSU1,
LED_TYPE_PSU2,
LED_TYPE_7SEGMENT
};

/* LED mode */
Expand Down Expand Up @@ -179,16 +177,6 @@ static int as5915_18x_led_write_value(u8 reg, u8 value)
return as5915_18x_fpga_write(LED_CNTRLER_FPGA_I2C_ADDRESS, reg, value);
}

static int as5915_18x_7segment_led_read_value(void)
{
return as5915_18x_cpld_read(LED_CNTRLER_CPLD_ADDRESS, 0xBD);
}

static int as5915_18x_7segment_led_write_value(u8 value)
{
return as5915_18x_cpld_write(LED_CNTRLER_CPLD_ADDRESS, 0xBD, value);
}

static void as5915_18x_led_update(void)
{
mutex_lock(&ledctl->update_lock);
Expand Down Expand Up @@ -301,32 +289,6 @@ static enum led_brightness as5915_18x_led_fan_get(struct led_classdev *cdev)
return led_reg_val_to_light_mode(LED_TYPE_FAN, ledctl->reg_val[0]);
}

static void as5915_18x_led_7segment_set(struct led_classdev *led_cdev,
enum led_brightness led_light_mode)
{
mutex_lock(&ledctl->update_lock);
if (led_light_mode > 15) {
goto exit;
}

as5915_18x_7segment_led_write_value(led_light_mode);
ledctl->valid = 0;

exit:
mutex_unlock(&ledctl->update_lock);
}

static enum led_brightness as5915_18x_led_7segment_get(struct led_classdev *cdev)
{
int reg_val = 0;

mutex_lock(&ledctl->update_lock);
reg_val = as5915_18x_7segment_led_read_value();
mutex_unlock(&ledctl->update_lock);

return (reg_val & 0xF);
}

static struct led_classdev as5915_18x_leds[] = {
[LED_TYPE_ALARM] = {
.name = "as5915_18x_led::alarm",
Expand Down Expand Up @@ -370,13 +332,6 @@ static struct led_classdev as5915_18x_leds[] = {
.brightness_get = as5915_18x_led_fan_get,
.max_brightness = LED_MODE_AMBER,
},
[LED_TYPE_7SEGMENT] = {
.name = "as5915_18x_led::7segment",
.default_trigger = "unused",
.brightness_set = as5915_18x_led_7segment_set,
.brightness_get = as5915_18x_led_7segment_get,
.max_brightness = 15,
},
};

static int as5915_18x_led_probe(struct platform_device *pdev)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ static char *leds[] = /* must map with onlp_led_id */
"psu2",
"fan",
"alarm",
"7segment",
};

/*
Expand Down Expand Up @@ -124,11 +123,6 @@ static onlp_led_info_t linfo[] =
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN_BLINKING | ONLP_LED_CAPS_RED,
},
{
{ ONLP_LED_ID_CREATE(LED_7SEGMENT), "Chassis LED 7 (7-SEGMENT LED)", 0 },
ONLP_LED_STATUS_PRESENT,
ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_CHAR,
},
};

static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode)
Expand Down Expand Up @@ -173,7 +167,6 @@ onlp_ledi_init(void)
/*
* Set the character
* Set c as 0 to 9 will set the character accordingly.
* Set c as 10 to 14 will turn off the 7-segment led
* Set c as 15 will turn on the dot led
* */
int onlp_ledi_char_set(onlp_oid_t id, char c)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define CHASSIS_FAN_COUNT 4
#define CHASSIS_THERMAL_COUNT 5
#define CHASSIS_PSU_COUNT 2
#define CHASSIS_LED_COUNT 7
#define CHASSIS_LED_COUNT 6

#define PSU1_ID 1
#define PSU2_ID 2
Expand Down Expand Up @@ -67,8 +67,7 @@ enum onlp_led_id
LED_PSU1,
LED_PSU2,
LED_FAN,
LED_ALARM,
LED_7SEGMENT
LED_ALARM
};

#endif /* __PLATFORM_LIB_H__ */
Expand Down