mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
backlight: add backlight pwm debug node for tvapi [1/1]
PD#SWPL-3110 Problem: add backlight pwm debug node for tvapi Solution: 1,change pwm node for pwm main parameters(duty, freq, pol) 2,add pwm_info node to display all pwm state Verify: verified by t962x_r311 Change-Id: Ibd9575412ca9704a0002073679d19c5426c1838c Signed-off-by: Shaochan Liu <shaochan.liu@amlogic.com>
This commit is contained in:
committed by
Dongjin Kim
parent
11fe2d13cd
commit
585580816c
@@ -2550,7 +2550,7 @@ static ssize_t bl_status_read(struct class *class,
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t bl_debug_pwm_show(struct class *class,
|
||||
static ssize_t bl_debug_pwm_info_show(struct class *class,
|
||||
struct class_attribute *attr, char *buf)
|
||||
{
|
||||
struct bl_config_s *bconf = bl_drv->bconf;
|
||||
@@ -2559,7 +2559,7 @@ static ssize_t bl_debug_pwm_show(struct class *class,
|
||||
unsigned int value;
|
||||
ssize_t len = 0;
|
||||
|
||||
len = sprintf(buf, "read backlight pwm state:\n");
|
||||
len = sprintf(buf, "read backlight pwm info:\n");
|
||||
switch (bconf->method) {
|
||||
case BL_CTRL_PWM:
|
||||
len += sprintf(buf+len,
|
||||
@@ -2794,6 +2794,76 @@ static ssize_t bl_debug_pwm_show(struct class *class,
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t bl_debug_pwm_show(struct class *class,
|
||||
struct class_attribute *attr, char *buf)
|
||||
{
|
||||
struct bl_config_s *bconf = bl_drv->bconf;
|
||||
struct bl_pwm_config_s *bl_pwm;
|
||||
ssize_t len = 0;
|
||||
|
||||
switch (bconf->method) {
|
||||
case BL_CTRL_PWM:
|
||||
if (bconf->bl_pwm) {
|
||||
bl_pwm = bconf->bl_pwm;
|
||||
len += sprintf(buf+len,
|
||||
"pwm: freq=%d, pol=%d, duty_max=%d, duty_min=%d, ",
|
||||
bl_pwm->pwm_freq, bl_pwm->pwm_method,
|
||||
bl_pwm->pwm_duty_max, bl_pwm->pwm_duty_min);
|
||||
if (bl_pwm->pwm_duty_max > 100) {
|
||||
len += sprintf(buf+len,
|
||||
"duty_value=%d(%d%%)\n",
|
||||
bl_pwm->pwm_duty,
|
||||
bl_pwm->pwm_duty*100/255);
|
||||
} else {
|
||||
len += sprintf(buf+len,
|
||||
"duty_value=%d%%\n",
|
||||
bl_pwm->pwm_duty);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BL_CTRL_PWM_COMBO:
|
||||
if (bconf->bl_pwm_combo0) {
|
||||
bl_pwm = bconf->bl_pwm_combo0;
|
||||
len += sprintf(buf+len,
|
||||
"pwm_0: freq=%d, pol=%d, duty_max=%d, duty_min=%d, ",
|
||||
bl_pwm->pwm_freq, bl_pwm->pwm_method,
|
||||
bl_pwm->pwm_duty_max, bl_pwm->pwm_duty_min);
|
||||
if (bl_pwm->pwm_duty_max > 100) {
|
||||
len += sprintf(buf+len,
|
||||
"duty_value=%d(%d%%)\n",
|
||||
bl_pwm->pwm_duty,
|
||||
bl_pwm->pwm_duty*100/255);
|
||||
} else {
|
||||
len += sprintf(buf+len,
|
||||
"duty_value=%d%%\n",
|
||||
bl_pwm->pwm_duty);
|
||||
}
|
||||
}
|
||||
|
||||
if (bconf->bl_pwm_combo1) {
|
||||
bl_pwm = bconf->bl_pwm_combo1;
|
||||
len += sprintf(buf+len,
|
||||
"pwm_1: freq=%d, pol=%d, duty_max=%d, duty_min=%d, ",
|
||||
bl_pwm->pwm_freq, bl_pwm->pwm_method,
|
||||
bl_pwm->pwm_duty_max, bl_pwm->pwm_duty_min);
|
||||
if (bl_pwm->pwm_duty_max > 100) {
|
||||
len += sprintf(buf+len,
|
||||
"duty_value=%d(%d%%)\n",
|
||||
bl_pwm->pwm_duty,
|
||||
bl_pwm->pwm_duty*100/255);
|
||||
} else {
|
||||
len += sprintf(buf+len,
|
||||
"duty_value=%d%%\n",
|
||||
bl_pwm->pwm_duty);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
#define BL_DEBUG_PWM_FREQ 0
|
||||
#define BL_DEBUG_PWM_DUTY 1
|
||||
#define BL_DEBUG_PWM_POL 2
|
||||
@@ -3179,6 +3249,7 @@ static ssize_t bl_debug_brightness_store(struct class *class,
|
||||
static struct class_attribute bl_debug_class_attrs[] = {
|
||||
__ATTR(help, 0444, bl_debug_help, NULL),
|
||||
__ATTR(status, 0444, bl_status_read, NULL),
|
||||
__ATTR(pwm_info, 0644, bl_debug_pwm_info_show, NULL),
|
||||
__ATTR(pwm, 0644, bl_debug_pwm_show, bl_debug_pwm_store),
|
||||
__ATTR(power, 0644, bl_debug_power_show, bl_debug_power_store),
|
||||
__ATTR(step_on, 0644, bl_debug_step_on_show, bl_debug_step_on_store),
|
||||
|
||||
Reference in New Issue
Block a user