Support INT3406 Display thermal device
Subsystems (5)
cover Support INT3406 Display thermal device
The display thermal device represents the LED/LCD display panel that may or may not include touch support. The main function of the display thermal device is to allow control of the display brightness in order to address a thermal condition or to reduce power consumed by display device.
Due to the way this thermal device changes brightness level is said to be deprecated so we are using the raw interface to do the actual backlight change. This requires the backlight core support so two new APIs are added and exported in patch 1/3. With this, the previous API backlight_device_registered can be removed and this is done in patch 2/3. Patch 3/3 adds the new int3406 thermal driver.
Happy new year and best wishes!
Aaron Lu (3):
video / backlight: add two APIs for drivers to use video / backlight: remove the backlight_device_registered API
Thermal: introduce INT3406 thermal driver
drivers/acpi/video.c | 79 ++++---- drivers/thermal/Kconfig | 26 +-- drivers/thermal/int340x_thermal/Kconfig | 41 ++++ drivers/thermal/int340x_thermal/Makefile | 1 + drivers/thermal/int340x_thermal/int3406_thermal.c | 229 ++++++++++++++++++++++ drivers/video/backlight/backlight.c | 40 ++-- include/acpi/video.h | 20 ++ include/linux/backlight.h | 3 +- 8 files changed, 362 insertions(+), 77 deletions(-) create mode 100644 drivers/thermal/int340x_thermal/Kconfig create mode 100644 drivers/thermal/int340x_thermal/int3406_thermal.c
Signature · 1 line
2.1.0
PATCH 1/3 video / backlight: add two APIs for drivers to use
It is useful to get the backlight device's pointer and use it to set backlight in some cases(the following patch will make use of it) so add the two APIs and export them.
--- drivers/video/backlight/backlight.c | 44 ++++++++++++++++++++++++------------- include/linux/backlight.h | 2 ++ 2 files changed, 31 insertions(+), 15 deletions(-)
drivers/video/backlight/backlight.c +29 -15
@@ -164,28 +164,19 @@ static ssize_t brightness_show(struct device *dev,return sprintf (buf,"%d\n" , bd->props.brightness); } -static ssize_t brightness_store (struct device *dev, -struct device_attribute *attr,const char *buf,size_t count) +int backlight_device_set_brightness (struct backlight_device *bd,int brightness) { -int rc; -struct backlight_device *bd =to_backlight_device (dev); -unsigned long brightness; - - rc =kstrtoul (buf,0 , &brightness); -if (rc) -return rc; - - rc = -ENXIO ; +int rc = -ENXIO ;mutex_lock (&bd->ops_lock);if (bd->ops) {if (brightness > bd->props.max_brightness) rc = -EINVAL ;else { -pr_debug ("set brightness to %lu\n" , brightness); +pr_debug ("set brightness to %u\n" , brightness); bd->props.brightness = brightness;backlight_update_status (bd); - rc = count; + rc =0 ; } }mutex_unlock (&bd->ops_lock);
@@ -194,6 +185,23 @@ static ssize_t brightness_store(struct device *dev,return rc; } +EXPORT_SYMBOL (backlight_device_set_brightness); + +static ssize_t brightness_store (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +int rc; +struct backlight_device *bd =to_backlight_device (dev); +unsigned long brightness; + + rc =kstrtoul (buf,0 , &brightness); +if (rc) +return rc; + + rc =backlight_device_set_brightness (bd, brightness); + +return rc ? rc : count; +}static DEVICE_ATTR_RW (brightness); static ssize_t type_show(struct device *dev, struct device_attribute *attr,
@@ -380,7 +388,7 @@ struct backlight_device *backlight_device_register(const char *name, }EXPORT_SYMBOL (backlight_device_register); -bool backlight_device_registered (enum backlight_type type) +struct backlight_device *backlight_device_get_by_type (enum backlight_type type) {bool found = false;struct backlight_device *bd;
@@ -394,7 +402,13 @@ bool backlight_device_registered(enum backlight_type type) }mutex_unlock (&backlight_dev_list_mutex); -return found; +return found ? bd :NULL ; +} +EXPORT_SYMBOL (backlight_device_get_by_type); + +bool backlight_device_registered (enum backlight_type type) +{ +return backlight_device_get_by_type (type) ? true : false; }EXPORT_SYMBOL (backlight_device_registered);
include/linux/backlight.h +2 -0
@@ -140,6 +140,8 @@ extern void backlight_force_update(struct backlight_device *bd,extern bool backlight_device_registered (enum backlight_type type);extern int backlight_register_notifier (struct notifier_block *nb);extern int backlight_unregister_notifier (struct notifier_block *nb); +extern struct backlight_device *backlight_device_get_by_type (enum backlight_type type); +extern int backlight_device_set_brightness (struct backlight_device *bd,int brightness);#define to_backlight_device (obj) container_of(obj, struct backlight_device, dev)
Signature · 1 line
2.1.0
Re: [PATCH 1/3] video / backlight: add two APIs for drivers to use
Quoted 6 lines · Aaron Lu
It is useful to get the backlight device's pointer and use it to set backlight in some cases(the following patch will make use of it) so add the two APIs and export them.
Signed-off-by Aaron Lu <[email protected]>
Best regards,
Jingoo Han
Quoted 105 lines
--- drivers/video/backlight/backlight.c | 44 ++++++++++++++++++++++++------------- include/linux/backlight.h | 2 ++ 2 files changed, 31 insertions(+), 15 deletions(-)drivers/video/backlight/backlight.c +29
-15@@ -164,28 +164,19 @@ static ssize_t brightness_show(struct device *dev,return sprintf (buf,"%d\n" , bd->props.brightness); } -static ssize_t brightness_store (struct device *dev, -struct device_attribute *attr,const char *buf,size_t count) +int backlight_device_set_brightness (struct backlight_device *bd,int brightness) { -int rc; -struct backlight_device *bd =to_backlight_device (dev); -unsigned long brightness; - - rc =kstrtoul (buf,0 , &brightness); -if (rc) -return rc; - - rc = -ENXIO ; +int rc = -ENXIO ;mutex_lock (&bd->ops_lock);if (bd->ops) {if (brightness > bd->props.max_brightness) rc = -EINVAL ;else { -pr_debug ("set brightness to %lu\n" , brightness); +pr_debug ("set brightness to %u\n" , brightness); bd->props.brightness = brightness;backlight_update_status (bd); - rc = count; + rc =0 ; } }mutex_unlock (&bd->ops_lock);@@ -194,6 +185,23 @@ static ssize_t brightness_store(struct device *dev,return rc; } +EXPORT_SYMBOL (backlight_device_set_brightness); + +static ssize_t brightness_store (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +int rc; +struct backlight_device *bd =to_backlight_device (dev); +unsigned long brightness; + + rc =kstrtoul (buf,0 , &brightness); +if (rc) +return rc; + + rc =backlight_device_set_brightness (bd, brightness); + +return rc ? rc : count; +}static DEVICE_ATTR_RW (brightness); static ssize_t type_show(struct device *dev, struct device_attribute *attr,@@ -380,7 +388,7 @@ struct backlight_device *backlight_device_register(const char *name, }EXPORT_SYMBOL (backlight_device_register); -bool backlight_device_registered (enum backlight_type type) +struct backlight_device *backlight_device_get_by_type (enum backlight_type type) {bool found = false;struct backlight_device *bd;@@ -394,7 +402,13 @@ bool backlight_device_registered(enum backlight_type type) }mutex_unlock (&backlight_dev_list_mutex); -return found; +return found ? bd :NULL ; +} +EXPORT_SYMBOL (backlight_device_get_by_type); + +bool backlight_device_registered (enum backlight_type type) +{ +return backlight_device_get_by_type (type) ? true : false; }EXPORT_SYMBOL (backlight_device_registered);include/linux/backlight.h +2
-1@@ -140,6 +140,8 @@ extern void backlight_force_update(struct backlight_device *bd,extern bool backlight_device_registered (enum backlight_type type);extern int backlight_register_notifier (struct notifier_block *nb);extern int backlight_unregister_notifier (struct notifier_block *nb); +extern struct backlight_device *backlight_device_get_by_type (enum backlight_type type); +extern int backlight_device_set_brightness (struct backlight_device *bd,int brightness);#define to_backlight_device (obj) container_of(obj, struct backlight_device, dev) --2.1.0
Re: [PATCH 1/3] video / backlight: add two APIs for drivers to use
Quoted 9 lines · Jingoo Han
Quoted 6 lines · Aaron Lu
It is useful to get the backlight device's pointer and use it to set backlight in some cases(the following patch will make use of it) so add the two APIs and export them.
Signed-off-by Aaron Lu <[email protected]>Acked-by Jingoo Han <[email protected]>
Thanks for the review!
Regards,
Aaron
Quoted 110 lines
Best regards,
Jingoo HanQuoted 105 lines
--- drivers/video/backlight/backlight.c | 44 ++++++++++++++++++++++++------------- include/linux/backlight.h | 2 ++ 2 files changed, 31 insertions(+), 15 deletions(-)drivers/video/backlight/backlight.c +29
-15@@ -164,28 +164,19 @@ static ssize_t brightness_show(struct device *dev,return sprintf (buf,"%d\n" , bd->props.brightness); } -static ssize_t brightness_store (struct device *dev, -struct device_attribute *attr,const char *buf,size_t count) +int backlight_device_set_brightness (struct backlight_device *bd,int brightness) { -int rc; -struct backlight_device *bd =to_backlight_device (dev); -unsigned long brightness; - - rc =kstrtoul (buf,0 , &brightness); -if (rc) -return rc; - - rc = -ENXIO ; +int rc = -ENXIO ;mutex_lock (&bd->ops_lock);if (bd->ops) {if (brightness > bd->props.max_brightness) rc = -EINVAL ;else { -pr_debug ("set brightness to %lu\n" , brightness); +pr_debug ("set brightness to %u\n" , brightness); bd->props.brightness = brightness;backlight_update_status (bd); - rc = count; + rc =0 ; } }mutex_unlock (&bd->ops_lock);@@ -194,6 +185,23 @@ static ssize_t brightness_store(struct device *dev,return rc; } +EXPORT_SYMBOL (backlight_device_set_brightness); + +static ssize_t brightness_store (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +int rc; +struct backlight_device *bd =to_backlight_device (dev); +unsigned long brightness; + + rc =kstrtoul (buf,0 , &brightness); +if (rc) +return rc; + + rc =backlight_device_set_brightness (bd, brightness); + +return rc ? rc : count; +}static DEVICE_ATTR_RW (brightness); static ssize_t type_show(struct device *dev, struct device_attribute *attr,@@ -380,7 +388,7 @@ struct backlight_device *backlight_device_register(const char *name, }EXPORT_SYMBOL (backlight_device_register); -bool backlight_device_registered (enum backlight_type type) +struct backlight_device *backlight_device_get_by_type (enum backlight_type type) {bool found = false;struct backlight_device *bd;@@ -394,7 +402,13 @@ bool backlight_device_registered(enum backlight_type type) }mutex_unlock (&backlight_dev_list_mutex); -return found; +return found ? bd :NULL ; +} +EXPORT_SYMBOL (backlight_device_get_by_type); + +bool backlight_device_registered (enum backlight_type type) +{ +return backlight_device_get_by_type (type) ? true : false; }EXPORT_SYMBOL (backlight_device_registered);include/linux/backlight.h +2
-1@@ -140,6 +140,8 @@ extern void backlight_force_update(struct backlight_device *bd,extern bool backlight_device_registered (enum backlight_type type);extern int backlight_register_notifier (struct notifier_block *nb);extern int backlight_unregister_notifier (struct notifier_block *nb); +extern struct backlight_device *backlight_device_get_by_type (enum backlight_type type); +extern int backlight_device_set_brightness (struct backlight_device *bd,int brightness);#define to_backlight_device (obj) container_of(obj, struct backlight_device, dev) --2.1.0
Zhang Rui
reviewerRe: [PATCH 1/3] video / backlight: add two APIs for drivers to use
Quoted 11 lines · Aaron Lu
Quoted 9 lines · Jingoo Han
Quoted 6 lines · Aaron Lu
It is useful to get the backlight device's pointer and use it to set backlight in some cases(the following patch will make use of it) so add the two APIs and export them.
Signed-off-by Aaron Lu <[email protected]>Acked-by Jingoo Han <[email protected]>
So Jingoo and Lee, will you take the first two patches, or you'd like me the take the whole patch set?
thanks,
rui
Quoted 116 lines
Thanks for the review!
Regards,
AaronQuoted 110 lines
Best regards,
Jingoo HanQuoted 105 lines
--- drivers/video/backlight/backlight.c | 44 ++++++++++++++++++++++++------------- include/linux/backlight.h | 2 ++ 2 files changed, 31 insertions(+), 15 deletions(-)drivers/video/backlight/backlight.c +29
-15@@ -164,28 +164,19 @@ static ssize_t brightness_show(struct device *dev,return sprintf (buf,"%d\n" , bd->props.brightness); } -static ssize_t brightness_store (struct device *dev, -struct device_attribute *attr,const char *buf,size_t count) +int backlight_device_set_brightness (struct backlight_device *bd,int brightness) { -int rc; -struct backlight_device *bd =to_backlight_device (dev); -unsigned long brightness; - - rc =kstrtoul (buf,0 , &brightness); -if (rc) -return rc; - - rc = -ENXIO ; +int rc = -ENXIO ;mutex_lock (&bd->ops_lock);if (bd->ops) {if (brightness > bd->props.max_brightness) rc = -EINVAL ;else { -pr_debug ("set brightness to %lu\n" , brightness); +pr_debug ("set brightness to %u\n" , brightness); bd->props.brightness = brightness;backlight_update_status (bd); - rc = count; + rc =0 ; } }mutex_unlock (&bd->ops_lock);@@ -194,6 +185,23 @@ static ssize_t brightness_store(struct device *dev,return rc; } +EXPORT_SYMBOL (backlight_device_set_brightness); + +static ssize_t brightness_store (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +int rc; +struct backlight_device *bd =to_backlight_device (dev); +unsigned long brightness; + + rc =kstrtoul (buf,0 , &brightness); +if (rc) +return rc; + + rc =backlight_device_set_brightness (bd, brightness); + +return rc ? rc : count; +}static DEVICE_ATTR_RW (brightness); static ssize_t type_show(struct device *dev, struct device_attribute *attr,@@ -380,7 +388,7 @@ struct backlight_device *backlight_device_register(const char *name, }EXPORT_SYMBOL (backlight_device_register); -bool backlight_device_registered (enum backlight_type type) +struct backlight_device *backlight_device_get_by_type (enum backlight_type type) {bool found = false;struct backlight_device *bd;@@ -394,7 +402,13 @@ bool backlight_device_registered(enum backlight_type type) }mutex_unlock (&backlight_dev_list_mutex); -return found; +return found ? bd :NULL ; +} +EXPORT_SYMBOL (backlight_device_get_by_type); + +bool backlight_device_registered (enum backlight_type type) +{ +return backlight_device_get_by_type (type) ? true : false; }EXPORT_SYMBOL (backlight_device_registered);include/linux/backlight.h +2
-1@@ -140,6 +140,8 @@ extern void backlight_force_update(struct backlight_device *bd,extern bool backlight_device_registered (enum backlight_type type);extern int backlight_register_notifier (struct notifier_block *nb);extern int backlight_unregister_notifier (struct notifier_block *nb); +extern struct backlight_device *backlight_device_get_by_type (enum backlight_type type); +extern int backlight_device_set_brightness (struct backlight_device *bd,int brightness);#define to_backlight_device (obj) container_of(obj, struct backlight_device, dev) --2.1.0
Re: [PATCH 1/3] video / backlight: add two APIs for drivers to use
Quoted 8 lines · Zhang Rui
Quoted 7 lines · Aaron Lu
Quoted 6 lines · Jingoo Han
Quoted 5 lines · Aaron Lu
It is useful to get the backlight device's pointer and use it to set backlight in some cases(the following patch will make use of it) so add the two APIs and export them.
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Aaron Lu <[email protected]>Acked-by Jingoo Han <[email protected]>So Jingoo and Lee, will you take the first two patches, or you'd like me the take the whole patch set?
Hi Zhang Rui,
I would like you to take the whole patch set.
This is because 3rd patch makes the build error
without 1st & 2nd patches. Thank you.
Best regards,
Jingoo Han
Quoted 119 lines
thanks,
ruiQuoted 116 lines
Thanks for the review!
Regards,
AaronQuoted 110 lines
Best regards,
Jingoo HanQuoted 105 lines
--- drivers/video/backlight/backlight.c | 44 ++++++++++++++++++++++++------------- include/linux/backlight.h | 2 ++ 2 files changed, 31 insertions(+), 15 deletions(-)drivers/video/backlight/backlight.c +29
-15@@ -164,28 +164,19 @@ static ssize_t brightness_show(struct device *dev,return sprintf (buf,"%d\n" , bd->props.brightness); } -static ssize_t brightness_store (struct device *dev, -struct device_attribute *attr,const char *buf,size_t count) +int backlight_device_set_brightness (struct backlight_device *bd,int brightness) { -int rc; -struct backlight_device *bd =to_backlight_device (dev); -unsigned long brightness; - - rc =kstrtoul (buf,0 , &brightness); -if (rc) -return rc; - - rc = -ENXIO ; +int rc = -ENXIO ;mutex_lock (&bd->ops_lock);if (bd->ops) {if (brightness > bd->props.max_brightness) rc = -EINVAL ;else { -pr_debug ("set brightness to %lu\n" , brightness); +pr_debug ("set brightness to %u\n" , brightness); bd->props.brightness = brightness;backlight_update_status (bd); - rc = count; + rc =0 ; } }mutex_unlock (&bd->ops_lock);@@ -194,6 +185,23 @@ static ssize_t brightness_store(struct device *dev,return rc; } +EXPORT_SYMBOL (backlight_device_set_brightness); + +static ssize_t brightness_store (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +int rc; +struct backlight_device *bd =to_backlight_device (dev); +unsigned long brightness; + + rc =kstrtoul (buf,0 , &brightness); +if (rc) +return rc; + + rc =backlight_device_set_brightness (bd, brightness); + +return rc ? rc : count; +}static DEVICE_ATTR_RW (brightness); static ssize_t type_show(struct device *dev, struct device_attribute *attr,@@ -380,7 +388,7 @@ struct backlight_device *backlight_device_register(const char *name, }EXPORT_SYMBOL (backlight_device_register); -bool backlight_device_registered (enum backlight_type type) +struct backlight_device *backlight_device_get_by_type (enum backlight_type type) {bool found = false;struct backlight_device *bd;@@ -394,7 +402,13 @@ bool backlight_device_registered(enum backlight_type type) }mutex_unlock (&backlight_dev_list_mutex); -return found; +return found ? bd :NULL ; +} +EXPORT_SYMBOL (backlight_device_get_by_type); + +bool backlight_device_registered (enum backlight_type type) +{ +return backlight_device_get_by_type (type) ? true : false; }EXPORT_SYMBOL (backlight_device_registered);include/linux/backlight.h +2
-1@@ -140,6 +140,8 @@ extern void backlight_force_update(struct backlight_device *bd,extern bool backlight_device_registered (enum backlight_type type);extern int backlight_register_notifier (struct notifier_block *nb);extern int backlight_unregister_notifier (struct notifier_block *nb); +extern struct backlight_device *backlight_device_get_by_type (enum backlight_type type); +extern int backlight_device_set_brightness (struct backlight_device *bd,int brightness);#define to_backlight_device (obj) container_of(obj, struct backlight_device, dev) --2.1.0
Zhang Rui
reviewerRe: [PATCH 1/3] video / backlight: add two APIs for drivers to use
Quoted 13 lines · Jingoo Han
Quoted 12 lines · Zhang Rui
Quoted 11 lines · Aaron Lu
Quoted 9 lines · Jingoo Han
Quoted 6 lines · Aaron Lu
It is useful to get the backlight device's pointer and use it to set backlight in some cases(the following patch will make use of it) so add the two APIs and export them.
Signed-off-by Aaron Lu <[email protected]>Acked-by Jingoo Han <[email protected]>
Quoted 9 lines
Quoted 2 lines
So Jingoo and Lee, will you take the first two patches, or you'd like me the take the whole patch set?
Hi Zhang Rui,
I would like you to take the whole patch set.
This is because 3rd patch makes the build error
without 1st & 2nd patches. Thank you.
okay, thanks!
-rui
Quoted 124 lines
Best regards,
Jingoo HanQuoted 119 lines
thanks,
ruiQuoted 116 lines
Thanks for the review!
Regards,
AaronQuoted 110 lines
Best regards,
Jingoo HanQuoted 105 lines
--- drivers/video/backlight/backlight.c | 44 ++++++++++++++++++++++++------------- include/linux/backlight.h | 2 ++ 2 files changed, 31 insertions(+), 15 deletions(-)drivers/video/backlight/backlight.c +29
-15@@ -164,28 +164,19 @@ static ssize_t brightness_show(struct device *dev,return sprintf (buf,"%d\n" , bd->props.brightness); } -static ssize_t brightness_store (struct device *dev, -struct device_attribute *attr,const char *buf,size_t count) +int backlight_device_set_brightness (struct backlight_device *bd,int brightness) { -int rc; -struct backlight_device *bd =to_backlight_device (dev); -unsigned long brightness; - - rc =kstrtoul (buf,0 , &brightness); -if (rc) -return rc; - - rc = -ENXIO ; +int rc = -ENXIO ;mutex_lock (&bd->ops_lock);if (bd->ops) {if (brightness > bd->props.max_brightness) rc = -EINVAL ;else { -pr_debug ("set brightness to %lu\n" , brightness); +pr_debug ("set brightness to %u\n" , brightness); bd->props.brightness = brightness;backlight_update_status (bd); - rc = count; + rc =0 ; } }mutex_unlock (&bd->ops_lock);@@ -194,6 +185,23 @@ static ssize_t brightness_store(struct device *dev,return rc; } +EXPORT_SYMBOL (backlight_device_set_brightness); + +static ssize_t brightness_store (struct device *dev, +struct device_attribute *attr,const char *buf,size_t count) +{ +int rc; +struct backlight_device *bd =to_backlight_device (dev); +unsigned long brightness; + + rc =kstrtoul (buf,0 , &brightness); +if (rc) +return rc; + + rc =backlight_device_set_brightness (bd, brightness); + +return rc ? rc : count; +}static DEVICE_ATTR_RW (brightness); static ssize_t type_show(struct device *dev, struct device_attribute *attr,@@ -380,7 +388,7 @@ struct backlight_device *backlight_device_register(const char *name, }EXPORT_SYMBOL (backlight_device_register); -bool backlight_device_registered (enum backlight_type type) +struct backlight_device *backlight_device_get_by_type (enum backlight_type type) {bool found = false;struct backlight_device *bd;@@ -394,7 +402,13 @@ bool backlight_device_registered(enum backlight_type type) }mutex_unlock (&backlight_dev_list_mutex); -return found; +return found ? bd :NULL ; +} +EXPORT_SYMBOL (backlight_device_get_by_type); + +bool backlight_device_registered (enum backlight_type type) +{ +return backlight_device_get_by_type (type) ? true : false; }EXPORT_SYMBOL (backlight_device_registered);include/linux/backlight.h +2
-1@@ -140,6 +140,8 @@ extern void backlight_force_update(struct backlight_device *bd,extern bool backlight_device_registered (enum backlight_type type);extern int backlight_register_notifier (struct notifier_block *nb);extern int backlight_unregister_notifier (struct notifier_block *nb); +extern struct backlight_device *backlight_device_get_by_type (enum backlight_type type); +extern int backlight_device_set_brightness (struct backlight_device *bd,int brightness);#define to_backlight_device (obj) container_of(obj, struct backlight_device, dev) --2.1.0
PATCH 2/3 video / backlight: remove the backlight_device_registered API
In reply to Aaron LuSince we will need the backlight_device_get_by_type API, we can use it instead of the backlight_device_registered API whenever necessary so remove the backlight_device_registered API.
--- drivers/acpi/video.c | 2 +- drivers/video/backlight/backlight.c | 6 ------ include/linux/backlight.h | 1 - 3 files changed, 1 insertion(+), 8 deletions(-)
drivers/acpi/video.c +1 -1
@@ -246,7 +246,7 @@ static bool acpi_video_use_native_backlight(void)bool acpi_video_verify_backlight_support (void ) {if (acpi_osi_is_win8 () &&acpi_video_use_native_backlight () && -backlight_device_registered (BACKLIGHT_RAW )) +backlight_device_get_by_type (BACKLIGHT_RAW ))return false;return acpi_video_backlight_support (); }
drivers/video/backlight/backlight.c +0 -6
@@ -406,12 +406,6 @@ struct backlight_device *backlight_device_get_by_type(enum backlight_type type) }EXPORT_SYMBOL (backlight_device_get_by_type); -bool backlight_device_registered (enum backlight_type type) -{ -return backlight_device_get_by_type (type) ? true : false; -} -EXPORT_SYMBOL (backlight_device_registered); -/** * backlight_device_unregister - unregisters a backlight device object. * @bd: the backlight device object to be unregistered and freed.
include/linux/backlight.h +0 -1
@@ -137,7 +137,6 @@ extern void devm_backlight_device_unregister(struct device *dev, struct backlight_device *bd);extern void backlight_force_update (struct backlight_device *bd,enum backlight_update_reason reason); -extern bool backlight_device_registered (enum backlight_type type);extern int backlight_register_notifier (struct notifier_block *nb);extern int backlight_unregister_notifier (struct notifier_block *nb);extern struct backlight_device *backlight_device_get_by_type (enum backlight_type type);
Signature · 1 line
2.1.0
Re: [PATCH 2/3] video / backlight: remove the backlight_device_registered API
Quoted 6 lines · Aaron Lu
Since we will need the
backlight_device_get_by_typeAPI, we can use it instead of thebacklight_device_registeredAPI whenever necessary so remove thebacklight_device_registeredAPI.Signed-off-by Aaron Lu <[email protected]>
Best regards,
Jingoo Han
Quoted 50 lines
--- drivers/acpi/video.c | 2 +- drivers/video/backlight/backlight.c | 6 ------ include/linux/backlight.h | 1 - 3 files changed, 1 insertion(+), 8 deletions(-)drivers/acpi/video.c +1
-1@@ -246,7 +246,7 @@ static bool acpi_video_use_native_backlight(void)bool acpi_video_verify_backlight_support (void ) {if (acpi_osi_is_win8 () &&acpi_video_use_native_backlight () && -backlight_device_registered (BACKLIGHT_RAW )) +backlight_device_get_by_type (BACKLIGHT_RAW ))return false;return acpi_video_backlight_support (); }drivers/video/backlight/backlight.c +0
-6@@ -406,12 +406,6 @@ struct backlight_device *backlight_device_get_by_type(enum backlight_type type) }EXPORT_SYMBOL (backlight_device_get_by_type); -bool backlight_device_registered (enum backlight_type type) -{ -return backlight_device_get_by_type (type) ? true : false; -} -EXPORT_SYMBOL (backlight_device_registered); -/** * backlight_device_unregister - unregisters a backlight device object. * @bd: the backlight device object to be unregistered and freed. include/linux/backlight.h +0
-2@@ -137,7 +137,6 @@ extern void devm_backlight_device_unregister(struct device *dev, struct backlight_device *bd);extern void backlight_force_update (struct backlight_device *bd,enum backlight_update_reason reason); -extern bool backlight_device_registered (enum backlight_type type);extern int backlight_register_notifier (struct notifier_block *nb);extern int backlight_unregister_notifier (struct notifier_block *nb);extern struct backlight_device *backlight_device_get_by_type (enum backlight_type type); --2.1.0
PATCH 3/3 Thermal: introduce INT3406 thermal driver
In reply to Aaron LuINT3406 ACPI device object resembles an ACPI video output device, but its _BCM is said to be deprecated and should not be used. So we will make use of the raw interface to do the actual cooling. Due to this, the APIs from backlight core are used to achieve this. Also, to re-use some of the ACPI video module's code, one function has been exported.
--- drivers/acpi/video.c | 77 ++++---- drivers/thermal/Kconfig | 26 +-- drivers/thermal/int340x_thermal/Kconfig | 41 ++++ drivers/thermal/int340x_thermal/Makefile | 1 + drivers/thermal/int340x_thermal/int3406_thermal.c | 229 ++++++++++++++++++++++ include/acpi/video.h | 20 ++ 6 files changed, 335 insertions(+), 59 deletions(-) create mode 100644 drivers/thermal/int340x_thermal/Kconfig create mode 100644 drivers/thermal/int340x_thermal/int3406_thermal.c
drivers/acpi/video.c +41 -36
@@ -187,19 +187,6 @@ struct acpi_video_device_cap { u8 _DDC:1; /* Return the EDID for this device */ }; -struct acpi_video_brightness_flags { -u8 _BCL_no_ac_battery_levels:1 ;/* no AC/Battery levels in _BCL */ -u8 _BCL_reversed:1 ;/* _BCL package is in a reversed order */ -u8 _BQC_use_index:1 ;/* _BQC returns an index value */ -}; - -struct acpi_video_device_brightness { -int curr; -int count; -int *levels; -struct acpi_video_brightness_flags flags; -}; -struct acpi_video_device {unsigned long device_id;struct acpi_video_device_flags flags;
@@ -345,7 +332,7 @@ static const struct thermal_cooling_device_ops video_cooling_ops = {*/ static int -acpi_video_device_lcd_query_levels (struct acpi_video_device *device, +acpi_video_device_lcd_query_levels (acpi_handle handle,union acpi_object **levels) {int status;
@@ -355,7 +342,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, *levels =NULL ; - status =acpi_evaluate_object (device->dev->handle,"_BCL" ,NULL , &buffer); + status =acpi_evaluate_object (handle,"_BCL" ,NULL , &buffer);if (!ACPI_SUCCESS (status))return status; obj = (union acpi_object *)buffer.pointer;
@@ -728,29 +715,18 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device,return 0 ; } - -/* -* Arg: -* device : video output device (LCD, CRT, ..) -* -* Return Value: -* Maximum brightness level -* -* Allocate and initialize device->brightness. -*/ - -static int -acpi_video_init_brightness (struct acpi_video_device *device) +int acpi_video_get_levels (struct acpi_device *device, +struct acpi_video_device_brightness **dev_br) {union acpi_object *obj =NULL ;int i, max_level =0 , count =0 , level_ac_battery =0 ; -unsigned long long level, level_old;union acpi_object *o;struct acpi_video_device_brightness *br =NULL ;int result = -EINVAL ;u32 value; -if (!ACPI_SUCCESS (acpi_video_device_lcd_query_levels (device, &obj))) { +if (!ACPI_SUCCESS (acpi_video_device_lcd_query_levels (device->handle, + &obj))) {ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"Could not query available " "LCD brightness level\n" )); goto out;
@@ -823,6 +799,39 @@ acpi_video_init_brightness(struct acpi_video_device *device) "Found unordered _BCL package")); br->count = count; + *dev_br = br; + result =0 ; + +out: +kfree (obj); +return result; +out_free: +kfree (br); + goto out; +} +EXPORT_SYMBOL (acpi_video_get_levels); + +/* +* Arg: +* device : video output device (LCD, CRT, ..) +* +* Return Value: +* Maximum brightness level +* +* Allocate and initialize device->brightness. +*/ + +static int +acpi_video_init_brightness (struct acpi_video_device *device) +{ +int i, max_level =0 ; +unsigned long long level, level_old; +struct acpi_video_device_brightness *br =NULL ; +int result = -EINVAL ; + + result =acpi_video_get_levels (device->dev, &br); +if (result) +return result; device->brightness = br;/* _BQC uses INDEX while _BCL uses VALUE in some laptops */
@@ -865,17 +874,13 @@ set_level: goto out_free_levels;ACPI_DEBUG_PRINT ((ACPI_DB_INFO , -"found %d brightness levels\n" , count -2 )); -kfree (obj); -return result; +"found %d brightness levels\n" , br->count -2 )); +return 0 ; out_free_levels:kfree (br->levels); -out_free:kfree (br); -out: device->brightness =NULL ; -kfree (obj);return result; }
drivers/thermal/Kconfig +3 -23
@@ -261,29 +261,9 @@ config INTEL_SOC_DTS_THERMAL notification methods.The other trip is a critical trip point, which was set by the driver based on the TJ MAX temperature. -config INT340X_THERMAL - tristate "ACPI INT340X thermal drivers" - depends on X86 && ACPI - select THERMAL_GOV_USER_SPACE - select ACPI_THERMAL_REL - select ACPI_FAN - help - Newer laptops and tablets that use ACPI may have thermal sensors and - other devices with thermal control capabilities outside the core - CPU/SOC, for thermal safety reasons. - They are exposed for the OS to use via the INT3400 ACPI device object - as the master, and INT3401~INT340B ACPI device objects as the slaves. - Enable this to expose the temperature information and cooling ability - from these objects to userspace via the normal thermal framework. - This means that a wide range of applications and GUI widgets can show - the information to the user or use this information for making - decisions. For example, the Intel Thermal Daemon can use this - information to allow the user to select his laptop to run without - turning on the fans. - -config ACPI_THERMAL_REL - tristate - depends on ACPI +menu "ACPI INT340X thermal drivers" +source drivers/thermal/int340x_thermal/Kconfig +endmenu menu "Texas Instruments thermal drivers" source "drivers/thermal/ti-soc-thermal/Kconfig"
drivers/thermal/int340x_thermal/Kconfig new file +41 -0
41 lines not on this page · raw message
drivers/thermal/int340x_thermal/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-$(CONFIG_INT340X_THERMAL) += int3400_thermal.o obj-$(CONFIG_INT340X_THERMAL) += int3402_thermal.o obj-$(CONFIG_INT340X_THERMAL) += int3403_thermal.o +obj-$(CONFIG_INT3406_THERMAL) += int3406_thermal.o obj-$(CONFIG_ACPI_THERMAL_REL) += acpi_thermal_rel.o
drivers/thermal/int340x_thermal/int3406_thermal.c new file +229 -0
229 lines not on this page · raw message
include/acpi/video.h +20 -0
@@ -3,6 +3,19 @@#include <linux/errno.h> /* for ENODEV */ +struct acpi_video_brightness_flags { +u8 _BCL_no_ac_battery_levels:1 ;/* no AC/Battery levels in _BCL */ +u8 _BCL_reversed:1 ;/* _BCL package is in a reversed order */ +u8 _BQC_use_index:1 ;/* _BQC returns an index value */ +}; + +struct acpi_video_device_brightness { +int curr; +int count; +int *levels; +struct acpi_video_brightness_flags flags; +}; +struct acpi_device ;#define ACPI_VIDEO_CLASS "video"
@@ -22,6 +35,8 @@ extern void acpi_video_unregister(void);extern void acpi_video_unregister_backlight (void );extern int acpi_video_get_edid (struct acpi_device *device,int type,int device_id,void **edid); +extern int acpi_video_get_levels (struct acpi_device *device, +struct acpi_video_device_brightness **dev_br);extern bool acpi_video_verify_backlight_support (void );#else static inline int acpi_video_register (void ) {return 0 ; }
@@ -32,6 +47,11 @@ static inline int acpi_video_get_edid(struct acpi_device *device, int type, {return -ENODEV ; } +static int acpi_video_get_levels (struct acpi_device *device, +struct acpi_video_device_brightness **dev_br) +{ +return -ENODEV ; +}static inline bool acpi_video_verify_backlight_support (void ) {return false; }#endif
Signature · 1 line
2.1.0