[PATCH 0/4][SRU][B][D][E][OEM-B][OEM-OSP1-B] Can't adjust brightness on

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/4][SRU][B][D][E][OEM-B][OEM-OSP1-B] Can't adjust brightness on

AceLan Kao
BugLink: https://bugs.launchpad.net/bugs/1813877

[Impact]
The dell-uart-backlight driver has been loaded, but the backlight is
controller by graphics driver instead of scalar IC. The old way to
determinate weather the driver should be loaded is not working anymore,
since the behavior of scalar command, show firmware version, is not the
same as old platforms.

[Fix]
Using more a reliable command, get_scalar_status, to check if scalar is in
charge of the AIO backlight.
For the old platforms which don't have the new command, I add a list to
list them all and use the old way to determinate the scalar IC.

[Test]
Verified on old and new Dell AIO platforms.

[Regression Potential]
Low. The quirk lists all old platforms which use the old way to check if
scalar IC is in use. So, it won't change the behavior on old platforms,
and apply the new method on new platforms.

AceLan Kao (4):
  UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add missing status
    command
  UBUNTU: SAUCE: platform/x86: dell-uart-backlight: load driver by
    scalar status
  UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add force parameter
  UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add quirk for old
    platforms

 drivers/platform/x86/dell-uart-backlight.c | 73 +++++++++++++++++++---
 1 file changed, 64 insertions(+), 9 deletions(-)

--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/4][B][D][E][OEM-B][OEM-OSP1-B] UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add missing status command

AceLan Kao
BugLink: https://bugs.launchpad.net/bugs/1813877

DELL_UART_GET_SCALAR has been declared in
drivers/platform/x86/dell-uart-backlight.h, but its definition is
missing. It won't lead to issues on old AIO platforms, since this
command is newly introduced and is not supported by all old AIOs.

Signed-off-by: AceLan Kao <[hidden email]>
---
 drivers/platform/x86/dell-uart-backlight.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/platform/x86/dell-uart-backlight.c b/drivers/platform/x86/dell-uart-backlight.c
index ce9a5e200af8..f957da1a452a 100644
--- a/drivers/platform/x86/dell-uart-backlight.c
+++ b/drivers/platform/x86/dell-uart-backlight.c
@@ -52,6 +52,18 @@ static struct dell_uart_bl_cmd uart_cmd[] = {
  .cmd = {0x6A, 0x06, 0x8F},
  .tx_len = 3,
  },
+ /*
+ * Get Scalar Status: Tool uses this command to check if scalar IC controls brightness.
+ * Command: 0x6A 0x1F 0x8F (Length:3 Type: 0x0A, Cmd:0x1F Checksum:0x76)
+ * Return data: 0x04 0x1F Data checksum
+ * (Data = 0: scalar cannot adjust brightness, Data = 1: scalar can adjust brightness)
+ */
+ [DELL_UART_GET_SCALAR] = {
+ .cmd = {0x6A,0x1F,0x76},
+ .ret = {0x04,0x1F,0x00,0x00},
+ .tx_len = 3,
+ .rx_len = 4,
+ },
  /*
  * Get Brightness level: Application uses this command for scaler to
  *                       get brightness.
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 2/4][B][D][E][OEM-B][OEM-OSP1-B] UBUNTU: SAUCE: platform/x86: dell-uart-backlight: load driver by scalar status

AceLan Kao
In reply to this post by AceLan Kao
BugLink: https://bugs.launchpad.net/bugs/1813877

Leverage the scalar status command to determinate whether the driver
should be loaded or not.

Signed-off-by: AceLan Kao <[hidden email]>
---
 drivers/platform/x86/dell-uart-backlight.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/x86/dell-uart-backlight.c b/drivers/platform/x86/dell-uart-backlight.c
index f957da1a452a..a1ec0067291f 100644
--- a/drivers/platform/x86/dell-uart-backlight.c
+++ b/drivers/platform/x86/dell-uart-backlight.c
@@ -382,14 +382,11 @@ static int dell_uart_bl_add(struct acpi_device *dev)
  mutex_init(&dell_pdata->brightness_mutex);
 
  if (!dell_uart_get_scalar_status(dell_pdata)) {
- udelay(50);
- /* try another command to make sure there is no scalar IC */
- if (dell_uart_show_firmware_ver(dell_pdata) <= 0) {
- pr_debug("Scalar is not in charge of brightness adjustment.\n");
- kzfree(dell_pdata);
- return -1;
- }
+ pr_debug("Scalar is not in charge of brightness adjustment.\n");
+ kzfree(dell_pdata);
+ return -1;
  }
+ dell_uart_show_firmware_ver(dell_pdata);
 
  memset(&props, 0, sizeof(struct backlight_properties));
  props.type = BACKLIGHT_PLATFORM;
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 3/4][B][D][E][OEM-B][OEM-OSP1-B] UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add force parameter

AceLan Kao
In reply to this post by AceLan Kao
BugLink: https://bugs.launchpad.net/bugs/1813877

Add force parameter to force load the driver if the platform doesn't
provide a working scalar status command.

Signed-off-by: AceLan Kao <[hidden email]>
---
 drivers/platform/x86/dell-uart-backlight.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/dell-uart-backlight.c b/drivers/platform/x86/dell-uart-backlight.c
index a1ec0067291f..f81fc01606d0 100644
--- a/drivers/platform/x86/dell-uart-backlight.c
+++ b/drivers/platform/x86/dell-uart-backlight.c
@@ -40,6 +40,10 @@ unsigned int (*io_serial_in)(struct uart_port *p, int offset);
 int (*uart_write)(struct tty_struct *tty, const unsigned char *buf, int count);
 int (*uart_chars_in_buffer)(struct tty_struct *tty);
 
+static bool force;
+module_param(force, bool, 0444);
+MODULE_PARM_DESC(force, "load the driver regardless of the scalar status");
+
 static struct dell_uart_bl_cmd uart_cmd[] = {
  /*
  * Get Firmware Version: Tool uses this command to get firmware version.
@@ -381,7 +385,7 @@ static int dell_uart_bl_add(struct acpi_device *dev)
 
  mutex_init(&dell_pdata->brightness_mutex);
 
- if (!dell_uart_get_scalar_status(dell_pdata)) {
+ if (!force && !dell_uart_get_scalar_status(dell_pdata)) {
  pr_debug("Scalar is not in charge of brightness adjustment.\n");
  kzfree(dell_pdata);
  return -1;
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 4/4] UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add quirk for old platforms

AceLan Kao
In reply to this post by AceLan Kao
BugLink: https://bugs.launchpad.net/bugs/1813877

Old platforms do not support DELL_UART_GET_SCALAR command and the
behavior of DELL_UART_GET_FIRMWARE_VER command is different as the new
firmware, so the new way to check if the backlight is controlled by
scalar IC doesn't work on old platforms. We now add them into a list and
use the old way to do the check.

Signed-off-by: AceLan Kao <[hidden email]>
---
 drivers/platform/x86/dell-uart-backlight.c | 58 +++++++++++++++++++---
 1 file changed, 50 insertions(+), 8 deletions(-)

diff --git a/drivers/platform/x86/dell-uart-backlight.c b/drivers/platform/x86/dell-uart-backlight.c
index f81fc01606d0..90b28865896a 100644
--- a/drivers/platform/x86/dell-uart-backlight.c
+++ b/drivers/platform/x86/dell-uart-backlight.c
@@ -21,6 +21,7 @@
 #include <linux/serial_8250.h>
 #include <linux/delay.h>
 #include <linux/backlight.h>
+#include <linux/dmi.h>
 #include <acpi/video.h>
 
 #include "dell-uart-backlight.h"
@@ -116,6 +117,38 @@ static struct dell_uart_bl_cmd uart_cmd[] = {
  },
 };
 
+static const struct dmi_system_id dell_uart_backlight_alpha_platform[] __initconst = {
+ {
+ .ident = "Dell Inspiron 7777 AIO",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7777 AIO"),
+ },
+ },
+ {
+ .ident = "Dell Inspiron 5477 AIO",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 5477 AIO"),
+ },
+ },
+ {
+ .ident = "Dell OptiPlex 7769 AIO",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 7769 AIO"),
+ },
+ },
+ {
+ .ident = "Dell OptiPlex 5260 AIO",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 5260 AIO"),
+ },
+ },
+ { }
+};
+
 static int dell_uart_write(struct uart_8250_port *up, __u8 *buf, int len)
 {
  int actual = 0;
@@ -285,8 +318,7 @@ static int dell_uart_get_scalar_status(struct dell_uart_backlight *dell_pdata)
  struct dell_uart_bl_cmd *bl_cmd = &uart_cmd[DELL_UART_GET_SCALAR];
  struct uart_8250_port *uart = serial8250_get_port(dell_pdata->line);
  int rx_len;
- /* assume the scalar IC controls backlight if the command failed */
- int status = 1;
+ int status = 0;
 
  dell_uart_dump_cmd(__func__, "tx: ", bl_cmd->cmd, bl_cmd->tx_len);
 
@@ -377,7 +409,7 @@ static int dell_uart_bl_add(struct acpi_device *dev)
  dell_pdata = kzalloc(sizeof(struct dell_uart_backlight), GFP_KERNEL);
  if (!dell_pdata) {
  pr_debug("Failed to allocate memory for dell_uart_backlight\n");
- return -1;
+ return -ENOMEM;
  }
  dell_pdata->dev = &dev->dev;
  dell_uart_startup(dell_pdata);
@@ -385,10 +417,20 @@ static int dell_uart_bl_add(struct acpi_device *dev)
 
  mutex_init(&dell_pdata->brightness_mutex);
 
- if (!force && !dell_uart_get_scalar_status(dell_pdata)) {
- pr_debug("Scalar is not in charge of brightness adjustment.\n");
- kzfree(dell_pdata);
- return -1;
+ if (!force) {
+ if (dmi_check_system(dell_uart_backlight_alpha_platform)) {
+ /* try another command to make sure there is no scalar IC */
+ if (dell_uart_show_firmware_ver(dell_pdata) <= 4) {
+ pr_debug("Scalar is not in charge of brightness adjustment.\n");
+ kzfree(dell_pdata);
+ return -ENODEV;
+ }
+ }
+ else if (!dell_uart_get_scalar_status(dell_pdata)) {
+ pr_debug("Scalar is not in charge of brightness adjustment.\n");
+ kzfree(dell_pdata);
+ return -ENODEV;
+ }
  }
  dell_uart_show_firmware_ver(dell_pdata);
 
@@ -404,7 +446,7 @@ static int dell_uart_bl_add(struct acpi_device *dev)
  if (IS_ERR(dell_uart_bd)) {
  kzfree(dell_pdata);
  pr_debug("Backlight registration failed\n");
- return -1;
+ return PTR_ERR(dell_uart_bd);
  }
 
  dell_pdata->dell_uart_bd = dell_uart_bd;
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK / APPLIED[Unstable]: [PATCH 0/4][SRU][B][D][E][OEM-B][OEM-OSP1-B] Can't adjust brightness on

Seth Forshee
In reply to this post by AceLan Kao
On Thu, Nov 07, 2019 at 02:36:40PM +0800, AceLan Kao wrote:

> BugLink: https://bugs.launchpad.net/bugs/1813877
>
> [Impact]
> The dell-uart-backlight driver has been loaded, but the backlight is
> controller by graphics driver instead of scalar IC. The old way to
> determinate weather the driver should be loaded is not working anymore,
> since the behavior of scalar command, show firmware version, is not the
> same as old platforms.
>
> [Fix]
> Using more a reliable command, get_scalar_status, to check if scalar is in
> charge of the AIO backlight.
> For the old platforms which don't have the new command, I add a list to
> list them all and use the old way to determinate the scalar IC.
>
> [Test]
> Verified on old and new Dell AIO platforms.
>
> [Regression Potential]
> Low. The quirk lists all old platforms which use the old way to check if
> scalar IC is in use. So, it won't change the behavior on old platforms,
> and apply the new method on new platforms.

Acked-by: Seth Forshee <[hidden email]>

Applied to unstable/master, thanks!

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [PATCH 0/4][SRU][B][D][E][OEM-B][OEM-OSP1-B] Can't adjust brightness on

Connor Kuehl
In reply to this post by AceLan Kao
On 11/6/19 10:36 PM, AceLan Kao wrote:

> BugLink: https://bugs.launchpad.net/bugs/1813877
>
> [Impact]
> The dell-uart-backlight driver has been loaded, but the backlight is
> controller by graphics driver instead of scalar IC. The old way to
> determinate weather the driver should be loaded is not working anymore,
> since the behavior of scalar command, show firmware version, is not the
> same as old platforms.
>
> [Fix]
> Using more a reliable command, get_scalar_status, to check if scalar is in
> charge of the AIO backlight.
> For the old platforms which don't have the new command, I add a list to
> list them all and use the old way to determinate the scalar IC.
>
> [Test]
> Verified on old and new Dell AIO platforms.
>
> [Regression Potential]
> Low. The quirk lists all old platforms which use the old way to check if
> scalar IC is in use. So, it won't change the behavior on old platforms,
> and apply the new method on new platforms.
>
> AceLan Kao (4):
>    UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add missing status
>      command
>    UBUNTU: SAUCE: platform/x86: dell-uart-backlight: load driver by
>      scalar status
>    UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add force parameter
>    UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add quirk for old
>      platforms
>
>   drivers/platform/x86/dell-uart-backlight.c | 73 +++++++++++++++++++---
>   1 file changed, 64 insertions(+), 9 deletions(-)
>

Acked-by: Connor Kuehl <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED[OSP1] Re: [PATCH 0/4][SRU][B][D][E][OEM-B][OEM-OSP1-B] Can't adjust brightness on

Timo Aaltonen-6
In reply to this post by AceLan Kao
On 7.11.2019 8.36, AceLan Kao wrote:

> BugLink: https://bugs.launchpad.net/bugs/1813877
>
> [Impact]
> The dell-uart-backlight driver has been loaded, but the backlight is
> controller by graphics driver instead of scalar IC. The old way to
> determinate weather the driver should be loaded is not working anymore,
> since the behavior of scalar command, show firmware version, is not the
> same as old platforms.
>
> [Fix]
> Using more a reliable command, get_scalar_status, to check if scalar is in
> charge of the AIO backlight.
> For the old platforms which don't have the new command, I add a list to
> list them all and use the old way to determinate the scalar IC.
>
> [Test]
> Verified on old and new Dell AIO platforms.
>
> [Regression Potential]
> Low. The quirk lists all old platforms which use the old way to check if
> scalar IC is in use. So, it won't change the behavior on old platforms,
> and apply the new method on new platforms.
>
> AceLan Kao (4):
>   UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add missing status
>     command
>   UBUNTU: SAUCE: platform/x86: dell-uart-backlight: load driver by
>     scalar status
>   UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add force parameter
>   UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add quirk for old
>     platforms
>
>  drivers/platform/x86/dell-uart-backlight.c | 73 +++++++++++++++++++---
>  1 file changed, 64 insertions(+), 9 deletions(-)
>

applied to osp1 oem-next, thanks

--
t

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED: [PATCH 0/4][SRU][B][D][E][OEM-B][OEM-OSP1-B] Can't adjust brightness on

Stefan Bader-2
In reply to this post by AceLan Kao
On 07.11.19 07:36, AceLan Kao wrote:

> BugLink: https://bugs.launchpad.net/bugs/1813877
>
> [Impact]
> The dell-uart-backlight driver has been loaded, but the backlight is
> controller by graphics driver instead of scalar IC. The old way to
> determinate weather the driver should be loaded is not working anymore,
> since the behavior of scalar command, show firmware version, is not the
> same as old platforms.
>
> [Fix]
> Using more a reliable command, get_scalar_status, to check if scalar is in
> charge of the AIO backlight.
> For the old platforms which don't have the new command, I add a list to
> list them all and use the old way to determinate the scalar IC.
>
> [Test]
> Verified on old and new Dell AIO platforms.
>
> [Regression Potential]
> Low. The quirk lists all old platforms which use the old way to check if
> scalar IC is in use. So, it won't change the behavior on old platforms,
> and apply the new method on new platforms.
>
> AceLan Kao (4):
>   UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add missing status
>     command
>   UBUNTU: SAUCE: platform/x86: dell-uart-backlight: load driver by
>     scalar status
>   UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add force parameter
>   UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add quirk for old
>     platforms
>
>  drivers/platform/x86/dell-uart-backlight.c | 73 +++++++++++++++++++---
>  1 file changed, 64 insertions(+), 9 deletions(-)
>
Applied to eoan,disco,bionic/master-next. Thanks.

-Stefan


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (849 bytes) Download Attachment