drivers: ddcci: upstream DDCCI driver
PATCH v8 1/2 drivers: ddcci: upstream DDCCI driver
This patch upstreams the DDCCI driver by Christoph Grenz into the kernel. The original gitlab page is loacted at https://gitlab
.com/ddcci-driver-linux/ddcci-driver-linux/-/tree/master.
DDC/CI is a control protocol for monitor settings supported by most monitors since about 2005. A chardev and sysfs interface is provided. The seccond patch in this series provides a backlight driver using DDC/CI.
---
v2: Fix typos.
v3: Add documentation, move files around, replace semaphores with mutexes, and replaced <asm-generic/fcntl.h> with <linux/fcntl.h>. "imirkin"(which due to his involvement in the dri-devel irc channel I cant help but assume to be a DRM developer) said that the DDC/CI bus does not intefere with the buses that DRM is involved with.
v4: Move some documentation, fix grammer mistakes, remove usages of likely(), and clarify some documentation.
v5: Fix grammer mistakes, remove usages of likely(), and clarify some documentation.
v6: Change contact information to reference Christoph Grenz.
v7: Remove all instances of the unlikely() macro.
v8: Modify documentation to provide updated date and kernel documentation, fix SPDX lines, use isalpha instead of redefining logic, change maximum amount of bytes that can be written to be conformant with DDC/CI specification, prevent userspace from holding locks with the open file descriptor, remove ddcci_cdev_seek, dont refine sysfs_emit() logic, use EXPORT_SYMBOL_GPL instead of EXPORT_SYMBOL, remove ddcci_device_remove_void, remove module paramaters and version, and split into 2 patches.
--- Documentation/ABI/testing/sysfs-driver-ddcci | 57 + Documentation/driver-api/ddcci.rst | 122 ++ drivers/char/Kconfig | 13 +- drivers/char/Makefile | 1 + drivers/char/ddcci.c | 1805 ++++++++++++++++++ include/linux/ddcci.h | 163 ++ 6 files changed, 2160 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-ddcci create mode 100644 Documentation/driver-api/ddcci.rst create mode 100644 drivers/char/ddcci.c create mode 100644 include/linux/ddcci.h
Documentation/ABI/testing/sysfs-driver-ddcci new file +57 -0
@@ -0,0 +1,57 @@ +What: /sys/bus/ddcci/ddcci<I²C bus number>i<hex address> +Date: March 2022 +KernelVersion: 5.18 +Contact: Christoph Grenz <[email protected]> +Description: This file is a user interface for an internal + dependent device on the I2C bus, it exports the same + information as the master device(/sys/bus/ddcci/ + ddcci<I²C bus number>) that is referenced in this + document. + +What: /sys/bus/ddcci/ddcci<I²C bus number>e<hex address> +Date: March 2022 +KernelVersion: 5.18 +Contact: Christoph Grenz <[email protected]> +Description: This file is a user interface for an external + dependent device on the I2C bus, it exports the same + information as the master device(/sys/bus/ddcci/ + ddcci<I²C bus number>) that is referenced in this + document. + +What: /sys/bus/ddcci/ddcci<I²C bus number> +Date: March 2022 +KernelVersion: 5.18 +Contact: Christoph Grenz <[email protected]> +Description: This file provides the user interface for the + master device on the I2C bus. It exports the following + peices of information: + - idProt + ACCESS.bus protocol supported by the device. Usually + "monitor". + + - idType + ACCESS.bus device subtype. Usually "LCD" or "CRT". + + - idModel + ACCESS.bus device model identifier. Usually a + shortened form of the device model name. + + - idVendor + ACCESS.bus device vendor identifier. Empty if the + Identification command is not supported. + + - idModule + ACCESS.bus device module identifier. Empty if the + Identification command is not supported. + + - idSerial + 32 bit device number. A fixed serial number if it's + positive, a temporary serial number if negative and zero + if the Identification command is not supported. + + - modalias + A combined identifier for driver selection. It has the form: + ddcci:<idProt>-<idType>-<idModel>-<idVendor>-<idModule>. + All non-alphanumeric characters (including whitespace) + in the model, vendor or module parts are replaced by + underscores to prevent issues with software like systemd-udevd.
Documentation/driver-api/ddcci.rst new file +122 -0
122 lines not on this page · raw message
drivers/char/Kconfig +12 -1
@@ -1,4 +1,4 @@ -# SPDX-License-Identifier: GPL-2.0 +# SPDX-License-Identifier: GPL-2.0-or-later # # Character device configuration #
@@ -451,4 +451,15 @@ config RANDOM_TRUST_BOOTLOADER pool. Otherwise, say N here so it will be regarded as device input that only mixes the entropy pool. +config DDCCI + tristate "DDCCI display protocol support" + depends on I2C + help + Display Data Channel Command Interface is an + interface that allows the kernel to "talk" + to most displays made after 2005. Check your + display's specification to see if it has + support for this. This depends on I2C to + compile. + endmenu
drivers/char/Makefile +1 -0
@@ -3,6 +3,7 @@ # Makefile for the kernel character device drivers. # +obj-$(CONFIG_DDCCI) += ddcci.o obj-y += mem.o random.o obj-$(CONFIG_TTY_PRINTK) += ttyprintk.o obj-y += misc.o
drivers/char/ddcci.c new file +1805 -0
1,805 lines not on this page · raw message
include/linux/ddcci.h new file +163 -0
163 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v8 2/2 drivers: ddcci: upstream DDCCI driver
This patch upstreams the DDCCI driver by Christoph Grenz into the kernel. The original gitlab page is loacted at https://gitlab
.com/ddcci-driver-linux/ddcci-driver-linux/-/tree/master.
DDC/CI is a control protocol for monitor settings supported by most monitors since about 2005. A chardev and sysfs interface is provided. The seccond patch in this series provides a backlight driver using DDC/CI.
---
v2: Fix typos.
v3: Add documentation, move files around, replace semaphores with mutexes, and replaced <asm-generic/fcntl.h> with <linux/fcntl.h>. "imirkin"(which due to his involvement in the dri-devel irc channel I cant help but assume to be a DRM developer) said that the DDC/CI bus does not intefere with the buses that DRM is involved with.
v4: Move some documentation, fix grammer mistakes, remove usages of likely(), and clarify some documentation.
v5: Fix grammer mistakes, remove usages of likely(), and clarify some documentation.
v6: Change contact information to reference Christoph Grenz.
v7: Remove all instances of the unlikely() macro.
v8: Modify documentation to provide updated date and kernel documentation, fix SPDX lines, use isalpha instead of redefining logic, change maximum amount of bytes that can be written to be conformant with DDC/CI specification, prevent userspace from holding locks with the open file descriptor, remove ddcci_cdev_seek, dont refine sysfs_emit() logic, use EXPORT_SYMBOL_GPL instead of EXPORT_SYMBOL, remove ddcci_device_remove_void, remove module paramaters and version, and split into 2 patches.
--- drivers/video/backlight/Kconfig | 11 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/ddcci-backlight.c | 411 ++++++++++++++++++++++ 3 files changed, 423 insertions(+) create mode 100644 drivers/video/backlight/ddcci-backlight.c
drivers/video/backlight/Kconfig +11 -0
@@ -289,6 +289,17 @@ config BACKLIGHT_QCOM_WLED If you have the Qualcomm PMIC, say Y to enable a driver for the WLED block. Currently it supports PM8941 and PMI8998. +config BACKLIGHT_DDCCI + tristate "DDCCI Backlight Driver" + depends on DDCCI + help + If you have a DDC/CI supporing monitor, say Y to enable a driver + to control its backlight using DDC/CI. This could be useful if + your monitor does not include a backlight driver. For this to be + useful you need to enable DDCCI support which can be found in + Device Drivers -> Character devices and that further depends on + I2C. + config BACKLIGHT_RT4831 tristate "Richtek RT4831 Backlight Driver" depends on MFD_RT4831
drivers/video/backlight/Makefile +1 -0
@@ -58,3 +58,4 @@ obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o obj-$(CONFIG_BACKLIGHT_ARCXCNN) += arcxcnn_bl.o obj-$(CONFIG_BACKLIGHT_RAVE_SP) += rave-sp-backlight.o obj-$(CONFIG_BACKLIGHT_LED) += led_bl.o +obj-$(CONFIG_BACKLIGHT_DDCCI) += ddcci-backlight.o
drivers/video/backlight/ddcci-backlight.c new file +411 -0
411 lines not on this page · raw message
Signature · 1 line
2.25.1
Greg KH
maintainerQuoted 9 lines · Yusuf Khan
This patch upstreams the DDCCI driver by Christoph Grenz into the kernel. The original gitlab page is loacted at https://gitlab
.com/ddcci-driver-linux/ddcci-driver-linux/-/tree/master.DDC/CI is a control protocol for monitor settings supported by most monitors since about 2005. A chardev and sysfs interface is provided. The seccond patch in this series provides a backlight driver using DDC/CI.
Quoted 4 lines
Signed-off-by Yusuf Khan <[email protected]>Signed-off-by Christoph Grenz <[email protected]>---
v2: Fix typos.
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.
You are receiving this message because of the following common error(s) as indicated below:
- You did not write a descriptive Subject: for the patch, allowing Greg, and everyone else, to know what this patch is all about. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what a proper Subject: line should look like.
If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.
thanks,
greg k-h's patch email bot
kernel test robot
build botThank you for the patch! Perhaps something to improve:
Hi Yusuf,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on linux/master linus/master lee-backlight/for-backlight-next v5.17 next-20220318] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Yusuf-Khan/drivers-ddcci-upstream-DDCCI-driver/20220321-111557 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 37fd83916da2e4cae03d350015c82a67b1b334c4 config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20220321/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 85e9b2687a13d1908aa86d1b89c5ce398a06cd39)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/42317fc284bbedc623892f2b20e404df80f8c393
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yusuf-Khan/drivers-ddcci-upstream-DDCCI-driver/20220321-111557
git checkout 42317fc284bbedc623892f2b20e404df80f8c393
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/char/ drivers/soc/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
drivers/char/ddcci.c:1157:8: warning: result of comparison of constant -1 with expression of type 'const char' is always false [-Wtautological-constant-out-of-range-compare]
&& (IS_ANY_ID(id->module) || (strcmp(device->module, id->module) == 0))) {
^~~~~~~~~~~~~~~~~~~~~
drivers/char/ddcci.c:1146:49: note: expanded from macro 'IS_ANY_ID'
#define IS_ANY_ID(x) (((x)[0] == -1) && ((x)[7] == -1))
~~~~~~ ^ ~~
drivers/char/ddcci.c:1157:8: warning: result of comparison of constant -1 with expression of type 'const char' is always false [-Wtautological-constant-out-of-range-compare]
&& (IS_ANY_ID(id->module) || (strcmp(device->module, id->module) == 0))) {
^~~~~~~~~~~~~~~~~~~~~
drivers/char/ddcci.c:1146:31: note: expanded from macro 'IS_ANY_ID'
#define IS_ANY_ID(x) (((x)[0] == -1) && ((x)[7] == -1))
~~~~~~ ^ ~~
drivers/char/ddcci.c:1156:8: warning: result of comparison of constant -1 with expression of type 'const char' is always false [-Wtautological-constant-out-of-range-compare]
&& (IS_ANY_ID(id->vendor) || (strcmp(device->vendor, id->vendor) == 0))
^~~~~~~~~~~~~~~~~~~~~
drivers/char/ddcci.c:1146:49: note: expanded from macro 'IS_ANY_ID'
#define IS_ANY_ID(x) (((x)[0] == -1) && ((x)[7] == -1))
~~~~~~ ^ ~~
drivers/char/ddcci.c:1156:8: warning: result of comparison of constant -1 with expression of type 'const char' is always false [-Wtautological-constant-out-of-range-compare]
&& (IS_ANY_ID(id->vendor) || (strcmp(device->vendor, id->vendor) == 0))
^~~~~~~~~~~~~~~~~~~~~
drivers/char/ddcci.c:1146:31: note: expanded from macro 'IS_ANY_ID'
#define IS_ANY_ID(x) (((x)[0] == -1) && ((x)[7] == -1))
~~~~~~ ^ ~~
drivers/char/ddcci.c:1155:8: warning: result of comparison of constant -1 with expression of type 'const char' is always false [-Wtautological-constant-out-of-range-compare]
&& (IS_ANY_ID(id->model) || (strcmp(device->model, id->model) == 0))
^~~~~~~~~~~~~~~~~~~~
drivers/char/ddcci.c:1146:49: note: expanded from macro 'IS_ANY_ID'
#define IS_ANY_ID(x) (((x)[0] == -1) && ((x)[7] == -1))
~~~~~~ ^ ~~
drivers/char/ddcci.c:1155:8: warning: result of comparison of constant -1 with expression of type 'const char' is always false [-Wtautological-constant-out-of-range-compare]
&& (IS_ANY_ID(id->model) || (strcmp(device->model, id->model) == 0))
^~~~~~~~~~~~~~~~~~~~
drivers/char/ddcci.c:1146:31: note: expanded from macro 'IS_ANY_ID'
#define IS_ANY_ID(x) (((x)[0] == -1) && ((x)[7] == -1))
~~~~~~ ^ ~~
drivers/char/ddcci.c:1154:8: warning: result of comparison of constant -1 with expression of type 'const char' is always false [-Wtautological-constant-out-of-range-compare]
&& (IS_ANY_ID(id->type) || (strcmp(device->type, id->type) == 0))
^~~~~~~~~~~~~~~~~~~
drivers/char/ddcci.c:1146:49: note: expanded from macro 'IS_ANY_ID'
#define IS_ANY_ID(x) (((x)[0] == -1) && ((x)[7] == -1))
~~~~~~ ^ ~~
drivers/char/ddcci.c:1154:8: warning: result of comparison of constant -1 with expression of type 'const char' is always false [-Wtautological-constant-out-of-range-compare]
&& (IS_ANY_ID(id->type) || (strcmp(device->type, id->type) == 0))
^~~~~~~~~~~~~~~~~~~
drivers/char/ddcci.c:1146:31: note: expanded from macro 'IS_ANY_ID'
#define IS_ANY_ID(x) (((x)[0] == -1) && ((x)[7] == -1))
~~~~~~ ^ ~~
drivers/char/ddcci.c:1153:8: warning: result of comparison of constant -1 with expression of type 'const char' is always false [-Wtautological-constant-out-of-range-compare]
if ((IS_ANY_ID(id->prot) || (strcmp(device->prot, id->prot) == 0))
^~~~~~~~~~~~~~~~~~~
drivers/char/ddcci.c:1146:49: note: expanded from macro 'IS_ANY_ID'
#define IS_ANY_ID(x) (((x)[0] == -1) && ((x)[7] == -1))
~~~~~~ ^ ~~
drivers/char/ddcci.c:1153:8: warning: result of comparison of constant -1 with expression of type 'const char' is always false [-Wtautological-constant-out-of-range-compare]
if ((IS_ANY_ID(id->prot) || (strcmp(device->prot, id->prot) == 0))
^~~~~~~~~~~~~~~~~~~
drivers/char/ddcci.c:1146:31: note: expanded from macro 'IS_ANY_ID'
#define IS_ANY_ID(x) (((x)[0] == -1) && ((x)[7] == -1))
~~~~~~ ^ ~~
>> drivers/char/ddcci.c:1206:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
int ret = 0;
^11 warnings generated.
vim +/ret +1206 drivers/char/ddcci.c
1201
1202 static void ddcci_device_remove(struct device *dev)
1203 {
1204 struct ddcci_device *device = ddcci_verify_device(dev);
1205 struct ddcci_driver *driver;
> 1206 int ret = 0;
1207
1208 if (!device)
1209 return;
1210 driver = to_ddcci_driver(dev->driver);
1211
1212 if (driver->remove)
1213 ret = driver->remove(device);
1214 }
1215
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
kernel test robot
build botThank you for the patch! Perhaps something to improve:
Hi Yusuf,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on linux/master linus/master lee-backlight/for-backlight-next v5.17 next-20220318] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Yusuf-Khan/drivers-ddcci-upstream-DDCCI-driver/20220321-111557 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 37fd83916da2e4cae03d350015c82a67b1b334c4 config: ia64-allmodconfig (https://download.01.org/0day-ci/archive/20220321/[email protected]/config) compiler: ia64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/42317fc284bbedc623892f2b20e404df80f8c393
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yusuf-Khan/drivers-ddcci-upstream-DDCCI-driver/20220321-111557 git checkout 42317fc284bbedc623892f2b20e404df80f8c393
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/char/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
drivers/char/ddcci.c: In function 'ddcci_device_remove':
>> drivers/char/ddcci.c:1206:13: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
1206 | int ret = 0;
| ^~~vim +/ret +1206 drivers/char/ddcci.c
1201
1202 static void ddcci_device_remove(struct device *dev)
1203 {
1204 struct ddcci_device *device = ddcci_verify_device(dev);
1205 struct ddcci_driver *driver;
> 1206 int ret = 0;
1207
1208 if (!device)
1209 return;
1210 driver = to_ddcci_driver(dev->driver);
1211
1212 if (driver->remove)
1213 ret = driver->remove(device);
1214 }
1215
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp