Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3480443pxb; Mon, 4 Apr 2022 18:19:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvnmPfjbUqP/GKCESdJb/xuYEiuawl0A23w+lq2sQUPJhR5onKD8PQrOJTVFxoi4vCVqfG X-Received: by 2002:a17:902:d511:b0:156:b9f5:6470 with SMTP id b17-20020a170902d51100b00156b9f56470mr988333plg.133.1649121552860; Mon, 04 Apr 2022 18:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649121552; cv=none; d=google.com; s=arc-20160816; b=aS225HsWGwuSbL66E+UnfSSaHqx6bRuF3NbKkWATD6j4lgfvS/octI4QSqC/jBjoJ9 UOFObJsCiIR0nUTvczifwjzmkteoWO8XU8NTB05LXFCs8b0Ou49sOSAa2MQ8zbfesl3U O7Su83e99zvVTsJIGWAGJTV911A/OC9rUVyvOdM9CRmOXtl169bvEknPrm7ISnhC+aBn 15zjPbuDcPH+cXYX7jEIfbGgPNajzGZKWDmiaqlYNh3GWjcY/KT2QlZvERS6KwL8dbJK lQEK6c+rS1bnNc1+wnyPr8mt0bqx07Y8b9a7jp9KJomvVaJ0Nx/5wvYmqryG8m1TkLX8 jUlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MnWAMe9I06uRHHkAV77SrUCEzn8s1KKpVwsFGsGBqTc=; b=QT22V1JAPaZ2yV/KbO2TTPE+B7awzV7YhZDoSKA6I4m8yYHa8MxTxcFn50N16NcMJI xdtdkPj9xo308I0zzeCuQAWFC4ibrR74OSk5Lb6fzfzWC3r73sfqBrMKTd0pp9vCleOm VluWqVjJ5YNSJn0azalmF6ogWJbNH5oM9AKNfqOCf0Pqej6O3traG5DV0QfES0sI7q3G oOJc2LX5Fd6KgG4AOZpJXElayLZuU0bKikCjv62cpjgzJLd71QebLaciZKWBOF6AzZTW 34Tbk3uRehGARX9c6dtvsVuU2v6ezJafnvsXbbsy0saJ+QpdlCmdEzsKbcGDzvyVjb54 ISzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OENDJJLM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t19-20020a170902b21300b00153b2d165b6si10406573plr.446.2022.04.04.18.19.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 18:19:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OENDJJLM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 669991D306F; Mon, 4 Apr 2022 17:21:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376634AbiDCXLd (ORCPT + 99 others); Sun, 3 Apr 2022 19:11:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376623AbiDCXLY (ORCPT ); Sun, 3 Apr 2022 19:11:24 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF4E924F07 for ; Sun, 3 Apr 2022 16:09:29 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id x14so3894677pjf.2 for ; Sun, 03 Apr 2022 16:09:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MnWAMe9I06uRHHkAV77SrUCEzn8s1KKpVwsFGsGBqTc=; b=OENDJJLMrKrgibNyXZIHPx034c5IwHJkxSipgUCS4XAyLvLx/fovUcBWIE6F3zmtIf vDZjQnBPDv5CO5lTKwJaP/7wVTd062woHDn+Bf8pMO09NWRnvAwoqdEOcEcEs4evomTV kD36uvehsggyi6+7qV4HMy9Bq0CG9/GLwE3POkdZfRtz5A+fS5SNAuRVskV5/i/HjkCd yPMLqNCqFxPTFGG6G+6HPU+q4EBFdKmtNTaqj4FL487B3xXEI/Bxi+MLjbrPtbP6EBej mRT9OMAEa0Eb1lmJ90A65LobaBDRLs96hC1JZb0Cof7Y6aCdrTmtD88YMwK3AjoM9wBR wgrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MnWAMe9I06uRHHkAV77SrUCEzn8s1KKpVwsFGsGBqTc=; b=UJVbGSek/rgGBnNmpvYeL3at1bzGVGOYfbMS8o0gOHrYP53DXRarl6PU/RfsDFNvQE LpYipj22PBzb1v9U7A8wT5yBOHTzkzVf7u7H7fHPJLBh7yNtS7rN9QGCX9IqXaNFi2RD opQN0Vbg9xw3LUGQoqwj0saOMAa6nALN4UaFR9J7RXSV/pMfsrd0iPxChegJkonQFcYG S0YBlTfXW51+xfHOeJEWVIISNK7y2fvlPbv/nA48S7osZyx2CAgoBowssqUe99aL53DJ KVct9PM0OU4W8HXsBUXyscQ9pGeHduoJj8Con4LFBGR6ywzxNDOsq1rmRrXSvuoBoF1h VbEw== X-Gm-Message-State: AOAM533MU8irzM1p9CkjNsoIvaZkr+wX2pbCtTUviVjp4oHHV70Qlpoz e6HzKD2vCdY5z2o9PxYliJUKjOZIiq9Ylw== X-Received: by 2002:a17:903:110c:b0:14d:8859:5c8 with SMTP id n12-20020a170903110c00b0014d885905c8mr56137469plh.156.1649027369110; Sun, 03 Apr 2022 16:09:29 -0700 (PDT) Received: from yusufkhan-MS-7B17.lan ([24.17.200.29]) by smtp.gmail.com with ESMTPSA id p16-20020a056a000b5000b004faed463907sm10164503pfo.0.2022.04.03.16.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Apr 2022 16:09:28 -0700 (PDT) From: Yusuf Khan To: linux-kernel@vger.kernel.org Cc: jasowang@redhat.com, mikelley@microsoft.com, mst@redhat.com, gregkh@linuxfoundation.org, javier@javigon.com, arnd@arndb.de, will@kernel.org, axboe@kernel.dk, Yusuf Khan , Christoph Grenz Subject: [PATCH v10 3/3] drivers: ddcci: add drivers for DDCCI Date: Sun, 3 Apr 2022 16:08:51 -0700 Message-Id: <20220403230850.2986-4-yusisamerican@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220403230850.2986-1-yusisamerican@gmail.com> References: <20220403230850.2986-1-yusisamerican@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds Documentation for the DDCCI drivers. Signed-off-by: Yusuf Khan Signed-off-by: Christoph Grenz --- Documentation/ABI/testing/sysfs-driver-ddcci | 57 +++++++++ Documentation/driver-api/ddcci.rst | 122 +++++++++++++++++++ 2 files changed, 179 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-ddcci create mode 100644 Documentation/driver-api/ddcci.rst diff --git a/Documentation/ABI/testing/sysfs-driver-ddcci b/Documentation/ABI/testing/sysfs-driver-ddcci new file mode 100644 index 000000000000..19f77ccf3ed0 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-driver-ddcci @@ -0,0 +1,57 @@ +What: /sys/bus/ddcci/ddccii +Date: March 2022 +KernelVersion: 5.18 +Contact: Christoph Grenz +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) that is referenced in this + document. + +What: /sys/bus/ddcci/ddccie +Date: March 2022 +KernelVersion: 5.18 +Contact: Christoph Grenz +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) that is referenced in this + document. + +What: /sys/bus/ddcci/ddcci +Date: March 2022 +KernelVersion: 5.18 +Contact: Christoph Grenz +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:----. + 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. diff --git a/Documentation/driver-api/ddcci.rst b/Documentation/driver-api/ddcci.rst new file mode 100644 index 000000000000..2b7de1ac2656 --- /dev/null +++ b/Documentation/driver-api/ddcci.rst @@ -0,0 +1,122 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +============== +DDC/CI +============== + +1. Introduction +=============== +DDC/CI is a control protocol for monitor settings supported by most +monitors since about 2005. It is based on ACCESS.bus (an early USB predecessor). +This could be used to create drivers that communicate with the DDCCI component, +see ddcci-backlight for an example. + +2. sysfs interface +================== +Each detected DDC/CI device gets a directory in /sys/bus/ddcci/devices. +The main device on a bus is named ddcci[I²C bus number]. +Internal dependent devices are named ddcci[I²C bus number]i[hex address] +External dependent devices are named ddcci[I²C bus number]e[hex address] +There the following files export information about the device: + +capabilities +The full ACCESS.bus capabilities string. It contains the protocol, +type and model of the device, a list of all supported command +codes, etc. See the ACCESS.bus spec for more 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:----. +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. + +3. Character device interface +============================= +For each DDC/CI device a character device in +/dev/bus/ddcci/[I²C bus number]/ is created, +127 devices are assigned in total. + +The main device on the bus is named display. + +Internal dependent devices are named i[hex address] + +External dependent devices are named e[hex address] + +These character devices can be used to issue commands to a DDC/CI device +more easily than over i2c-dev devices. They should be opened unbuffered. +To send a command just write the command byte and the arguments with a +single write() operation. The length byte and checksum are automatically +calculated. + +To read a response use read() with a buffer big enough for the expected answer. + +NOTE: The maximum length of a DDC/CI message is 32 bytes. + +4. ddcci-backlight (monitor backlight driver) +============================================= +[This is not specific to the DDC/CI backlight driver, if you already dealt with +backlight drivers, skip over this.] + +For each monitor that supports accessing the Backlight Level White +or the Luminance property, a backlight device of type "raw" named like the +corresponding ddcci device is created. You can find them in /sys/class/backlight/. +For convenience a symlink "ddcci_backlight" on the device associated with the +display connector in /sys/class/drm/ to the backlight device is created, as +long as the graphics driver allows to make this association. + +5. Limitations +============== + +-Dependent devices (sub devices using DDC/CI directly wired to the monitor, +like Calibration devices, IR remotes, etc.) aren't automatically detected. +You can force detection of external dependent devices by writing +"ddcci-dependent [address]" into /sys/bus/i2c/i2c-?/new_device. + +There is no direct synchronization if you manually change the luminance +with the buttons on your monitor, as this can only be realized through polling +and some monitors close their OSD every time a DDC/CI command is received. + +Monitor hotplugging is not detected. You need to detach/reattach the I²C driver +or reload the module. + +6. Debugging +============ +Both drivers use the dynamic debugging feature of the Linux kernel. +To get detailed debugging messages, set the dyndbg module parameter. +If you want to enable debugging permanently across reboots, create a file +/etc/modprobe.d/ddcci.conf containing lines like the following before loading the modules: + +options ddcci dyndbg +options ddcci-backlight dyndbg + +7. Origin +============ +This driver originally came from Christoph Grenz in DKMS form here: +https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux +with multiple backups available on the wayback machine. It also +inlcudes a example program for the usage of this driver in +userland. -- 2.25.1