MLK-12932-01: pwm backlight: Add fb name check feature
Add fb name check function pwm_backlight_check_fb_name(), pwm driver can banding to fb with fb name when driver working in device tree architecture. Signed-off-by: Sandor Yu <Sandor.yu@nxp.com> Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
This commit is contained in:
parent
219d54332a
commit
4fa439eff9
|
@ -38,6 +38,7 @@ struct pwm_bl_data {
|
||||||
int brightness);
|
int brightness);
|
||||||
int (*check_fb)(struct device *, struct fb_info *);
|
int (*check_fb)(struct device *, struct fb_info *);
|
||||||
void (*exit)(struct device *);
|
void (*exit)(struct device *);
|
||||||
|
char fb_id[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
static void pwm_backlight_power_on(struct pwm_bl_data *pb)
|
static void pwm_backlight_power_on(struct pwm_bl_data *pb)
|
||||||
|
@ -222,6 +223,17 @@ int pwm_backlight_brightness_default(struct device *dev,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int pwm_backlight_check_fb_name(struct device *dev, struct fb_info *info)
|
||||||
|
{
|
||||||
|
struct backlight_device *bl = dev_get_drvdata(dev);
|
||||||
|
struct pwm_bl_data *pb = bl_get_data(bl);
|
||||||
|
|
||||||
|
if (strcmp(info->fix.id, pb->fb_id) == 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static int pwm_backlight_parse_dt(struct device *dev,
|
static int pwm_backlight_parse_dt(struct device *dev,
|
||||||
struct platform_pwm_backlight_data *data)
|
struct platform_pwm_backlight_data *data)
|
||||||
{
|
{
|
||||||
|
@ -234,12 +246,18 @@ static int pwm_backlight_parse_dt(struct device *dev,
|
||||||
int length;
|
int length;
|
||||||
u32 value;
|
u32 value;
|
||||||
int ret;
|
int ret;
|
||||||
|
const char *names;
|
||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
memset(data, 0, sizeof(*data));
|
memset(data, 0, sizeof(*data));
|
||||||
|
|
||||||
|
if (!of_property_read_string(node, "fb-names", &names)) {
|
||||||
|
strcpy(data->fb_id, names);
|
||||||
|
data->check_fb = &pwm_backlight_check_fb_name;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These values are optional and set as 0 by default, the out values
|
* These values are optional and set as 0 by default, the out values
|
||||||
* are modified only if a valid u32 value can be decoded.
|
* are modified only if a valid u32 value can be decoded.
|
||||||
|
@ -361,7 +379,6 @@ static int pwm_backlight_parse_dt(struct device *dev,
|
||||||
|
|
||||||
data->max_brightness--;
|
data->max_brightness--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,6 +501,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
|
||||||
pb->enabled = false;
|
pb->enabled = false;
|
||||||
pb->post_pwm_on_delay = data->post_pwm_on_delay;
|
pb->post_pwm_on_delay = data->post_pwm_on_delay;
|
||||||
pb->pwm_off_delay = data->pwm_off_delay;
|
pb->pwm_off_delay = data->pwm_off_delay;
|
||||||
|
strcpy(pb->fb_id, data->fb_id);
|
||||||
|
|
||||||
pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable",
|
pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable",
|
||||||
GPIOD_ASIS);
|
GPIOD_ASIS);
|
||||||
|
|
|
@ -23,6 +23,7 @@ struct platform_pwm_backlight_data {
|
||||||
void (*notify_after)(struct device *dev, int brightness);
|
void (*notify_after)(struct device *dev, int brightness);
|
||||||
void (*exit)(struct device *dev);
|
void (*exit)(struct device *dev);
|
||||||
int (*check_fb)(struct device *dev, struct fb_info *info);
|
int (*check_fb)(struct device *dev, struct fb_info *info);
|
||||||
|
char fb_id[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue