From nobody Sun Feb 8 15:53:21 2026 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EC601FAC4D for ; Wed, 18 Dec 2024 18:20:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734546014; cv=none; b=mqwDf4bHzPXgAQW4dUk3q2pn08OFrH6fxLEQZ1p1t7mcf0s0QC6o1W1Nxtox3QcrIbvCL8RDAA7lY7+fOAu/X81Q36+L0WCWUdMA898tV780KfR/4OjbDi9PurwGdzuMixhkDNS1WfHm7fhoqAqPhD/7RfVy3X6SQ/zRNPb+7V0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734546014; c=relaxed/simple; bh=yUgm/e00b9okvL8FQIt1pQWjJRf7o7EajmQsEBPWpCM=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=X5ALV27gzLnVxGH1Px3lc3k7WldEDYnQCI0WHWCLk8hEgpniT/63PYaW/tYxIxFXOb/JEs7comwRDKByqKpwlTxXThPQQQ6VQycb3QPzPLsIOxrU2Gdz8TNZDkxvh2pVXHY1HjnBHAonol4nMcZr0jR+lrE41sZcAw3I6/nyus4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=remote-tech.co.uk; spf=pass smtp.mailfrom=remote-tech.co.uk; dkim=pass (2048-bit key) header.d=remote-tech-co-uk.20230601.gappssmtp.com header.i=@remote-tech-co-uk.20230601.gappssmtp.com header.b=lwy+j4Wc; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=remote-tech.co.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=remote-tech.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=remote-tech-co-uk.20230601.gappssmtp.com header.i=@remote-tech-co-uk.20230601.gappssmtp.com header.b="lwy+j4Wc" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-aa67ac42819so1092404666b.0 for ; Wed, 18 Dec 2024 10:20:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=remote-tech-co-uk.20230601.gappssmtp.com; s=20230601; t=1734546011; x=1735150811; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=4xgYTs1uKZic+a0Z84dr8kghnwyat7Njf7fQHRkX1TM=; b=lwy+j4WcrtJx/LRKjeMBfjtnk5Q+i+uggdhpnaKngFK2Ngq48KInFL/3kre8g+WQ2N Xrvtc44IjuxC3/Um/aGKVJnIUIbYaC06PdU+pqAE+CzXkOKFQSnLnKpfOkvwZhPCnDAX QaVX8hjGdFJn0NLlK47BJLVZocmjM5hIG73kTtdp9e+RqlBc8pgn5BEYDaOiIIV6dGlV 4zJS7UAJDmdcv9/sp4Csqeqys7SiGiQVyVytcOJ1opClBNiqww2yyQO4XTK86JgrQu0F CcNLupHpGU7qu+4AeWSv09JYlSgcU8kBo9RYvcKAhnLV5sL7Rd38hgYZuZZtJKIMrFah a+UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734546011; x=1735150811; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4xgYTs1uKZic+a0Z84dr8kghnwyat7Njf7fQHRkX1TM=; b=j0Hl5tE/9yoofQk4XP2JBm67dvSQ+09xdBHqLgZv4fy1YBJPfmN2PavlrkTXl2UTWF V/uRE4z7XQy3crZUQ3LHM+4aVpkJC864pgifyFzHkgmiwGjbHYrmZpOZelPBgoFUMwqS gSq5GfF+T1wLuFhhUpnVuLqRRWvpcV0ISZ6oQNr7B45Ze58DnheMmSRQVwL+xkyebJmr /9ULUkl5yAnjRJUV3435swEmxul4w+6b9h21L1VbGG+02RlDU4GiLSkYrjXP5h72Yt3W FEUGenyRt9KVBfRbtOj7NDlqDynETpmhXVuLX18kPYPpDTHfcPxST6QuY6lgmN6SJ/7M nJYQ== X-Forwarded-Encrypted: i=1; AJvYcCVjeWKJ22yUg15O8E6TSkg8QuEA7XY4Sh+n3eOaZv66cAJ0OtoyaVzFNsdPOzPv6a13NkH4JgOLS0NVeec=@vger.kernel.org X-Gm-Message-State: AOJu0YxWeblNnrFjJnsaPc8rF+yLPxvDva8y7k/wMutqb1iDbJT+rsY4 48yZggTNYf8IcXnGCksjRt4vEP/vLd4gDz/Qa7qhzUEBQv680+T0+PEi/VXhUE1MvlZ0tHT6bt/ GqPYWtNXk4o4ETWRK43hxnlwkLW97Ha8VWHrHWe6iGOnPdfWIrGxyDZwgH+6UdbSdR//sYhc5EO xpZdEMzekqnwx2CUSpPbfF0QwtNA4= X-Gm-Gg: ASbGnctT/VUr/s3LcEgmgO1ZkbnNTOY9v/3PWjFSHQ1JXg9dazFcQw+H5DvsiB2kegH 9eNN5OoKn1YKtmoxfhmc1KhrURT9sPGLYCaWZ/5p/oNDt1MOUHq8cOHw6Q2QOfDdVRWAa+zXN3q Ho0IndyKc1ZdkltE2A/gT8eML/WUHcexUIRkvV3vc5P0G3ARdGrtLLjLtnOGvyBnwsqzoRxfIoT ITrhnfu226hQkMGx87nNKXymk2sPnU5bEIul70q5wFybr5uytiHZRIvf4RaeGDhkW8X0sTlyfXN 4szoMzyOZCIX8fKiBQmUaXf+96X8opPa X-Google-Smtp-Source: AGHT+IGqkZCbHBeaeQDkO34rckU4JQ+A5yErdOL+yP/X6itJuFkgf6vt4ylr0sO5NrVVZ7UUhNuxRg== X-Received: by 2002:a17:907:7850:b0:aa6:81e4:99b5 with SMTP id a640c23a62f3a-aabf471f8a2mr370930466b.3.1734546010576; Wed, 18 Dec 2024 10:20:10 -0800 (PST) Received: from localhost.localdomain ([178.27.36.125]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aab96359fdfsm584825066b.93.2024.12.18.10.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 10:20:09 -0800 (PST) From: Vicentiu Galanopulo To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Vicentiu Galanopulo , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v10 1/3] Documentation:leds: Add leds-st1202.rst Date: Wed, 18 Dec 2024 18:19:53 +0000 Message-Id: <20241218182001.41476-2-vicentiu.galanopulo@remote-tech.co.uk> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241218182001.41476-1-vicentiu.galanopulo@remote-tech.co.uk> References: <20241218182001.41476-1-vicentiu.galanopulo@remote-tech.co.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add usage for sysfs hw_pattern entry for leds-st1202 Signed-off-by: Vicentiu Galanopulo --- Documentation/leds/index.rst | 1 + Documentation/leds/leds-st1202.rst | 34 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Documentation/leds/leds-st1202.rst diff --git a/Documentation/leds/index.rst b/Documentation/leds/index.rst index 3ade16c18328..0ab0a2128a11 100644 --- a/Documentation/leds/index.rst +++ b/Documentation/leds/index.rst @@ -28,4 +28,5 @@ LEDs leds-mlxcpld leds-mt6370-rgb leds-sc27xx + leds-st1202.rst leds-qcom-lpg diff --git a/Documentation/leds/leds-st1202.rst b/Documentation/leds/leds-s= t1202.rst new file mode 100644 index 000000000000..1a09fbfcedcf --- /dev/null +++ b/Documentation/leds/leds-st1202.rst @@ -0,0 +1,34 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Kernel driver for STMicroelectronics LED1202 +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +/sys/class/leds//hw_pattern +-------------------------------- + +Specify a hardware pattern for the ST1202 LED. The LED controller +implements 12 low-side current generators with independent dimming +control. Internal volatile memory allows the user to store up to 8 +different patterns. Each pattern is a particular output configuration +in terms of PWM duty-cycle and duration (ms). + +To be compatible with the hardware pattern format, maximum 8 tuples of +brightness (PWM) and duration must be written to hw_pattern. + +- Min pattern duration: 22 ms +- Max pattern duration: 5660 ms + +The format of the hardware pattern values should be: +"brightness duration brightness duration ..." + +/sys/class/leds//repeat +---------------------------- + +Specify a pattern repeat number, which is common for all channels. +Default is 1; negative numbers and 0 are invalid. + +This file will always return the originally written repeat number. + +When the 255 value is written to it, all patterns will repeat +indefinitely. --=20 2.39.3 (Apple Git-145) From nobody Sun Feb 8 15:53:21 2026 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2B101FA8EB for ; Wed, 18 Dec 2024 18:20:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734546019; cv=none; b=rbF6qGDulKCWo2YCo1OU/HrZ0ujFVDS89JFVeERbg3DJmSdNFXL6ZBP04udmKkQtULE6lp5o169i3mq965iQXsiVUlAmRhDWVjnN0T+dE48PTN2+ZxStZRv+EBBVQ+jctn7hD5CAGB2hpJmGZyZCInW8Cv+8XCtSTiQMSukbZ9Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734546019; c=relaxed/simple; bh=+A6+s66LjKOEISFmiH3UzxHaJ3ydgiODVCNvmcUtVWg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SMCBCCkLCAHBh80yIthVUbhda7/2g4bsgDp7facS1jXjQbB9aNwAp+5w2/TEaQWNDng1Rq7OPFIXL4LEtBS/OzAurjxxGrE4gb2lM84iKAiIIrhfT35G/fUVwtoXYuDNzm5Xj+mMzXAN/Jr08dOl44WPGY2ab3Noe2eWEyZ/XiA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=remote-tech.co.uk; spf=pass smtp.mailfrom=remote-tech.co.uk; dkim=pass (2048-bit key) header.d=remote-tech-co-uk.20230601.gappssmtp.com header.i=@remote-tech-co-uk.20230601.gappssmtp.com header.b=CVyvjKFZ; arc=none smtp.client-ip=209.85.218.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=remote-tech.co.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=remote-tech.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=remote-tech-co-uk.20230601.gappssmtp.com header.i=@remote-tech-co-uk.20230601.gappssmtp.com header.b="CVyvjKFZ" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-aa543c4db92so89585366b.0 for ; Wed, 18 Dec 2024 10:20:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=remote-tech-co-uk.20230601.gappssmtp.com; s=20230601; t=1734546015; x=1735150815; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=V6InofCGGPfJvamdN7P/ZHJUTNfj1oFLPk/qKVvBUNk=; b=CVyvjKFZRpyKp30voQqq9LlRuR0VbkHok9k/mAUyMnOryXZPzyUW92+wccOI7NZIOn 9Ld45JiDGUsuEryjsJYrx3JrpFFHl2qdC661j59eX6NI9OBXignjMCbMU4tLfLoQD72Y UvAf1+Vx4SBUw0EQExU6gBnilNZfo+xhb6ma8vvAZEjXy+tFpKHTQEZiRxqqgZ2yWb+O w1gFHde8BA9eIC/c9s4rCY7aG9uyyz2neWsy+iyUAItYhikrgp2AHXoP5zBqnUNI6HXo FtAowKlTMwZ2cotbYKnfchyU6gAHc23n17rvaOb79jLDn+i+va9VKV5UmufTNB2YtpeV Nq1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734546015; x=1735150815; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V6InofCGGPfJvamdN7P/ZHJUTNfj1oFLPk/qKVvBUNk=; b=W9Q6qUQNOafvRKy5rwgG41OI/Dq8w2Pb3U/nReWhz1NrqeySsYo9BmB0lnKFLH38XC dd7MKenjgNP8qNsKvmo5fdoEoLXbsINE4EE3V+DnPjd1Yszw2MbfEWa9vXLeSl/+b/hq cwavKRA1BBQLCEXbHT+a4vGGrNC/uQBwACeUhLloj1FY6fle2C9swUGtkaTw6PPAoczr aanTuyBGFjbesgjozDN0vu/GbfFgd8q3vzuOK55q6q5v3ZBZugr/fSTlCcMwaWBBLNEU 6pk/++gIK8v5Ea7HZYQS5W9/J/0zPP9EgDyPv8/CD57sgB+JmDWz4APAyUsNv6hYTnNc yFaQ== X-Forwarded-Encrypted: i=1; AJvYcCVAKRsT/K1WjQIdFjrFpIkDN78QwRUhCbapwFzXlbOPJcc3zW9ih5IYIQr+DAFtXws9iRyno1fHyZoBcM0=@vger.kernel.org X-Gm-Message-State: AOJu0YwttCaALJHCy0IihUzdodKIao/lVS7mKckCiClKBQgDq2Ni8Nrc GAycNyNHdJbGJhfaWfXCQQaCI8eBIj3Fn0p9izlZxQX29sbVxdeLqRxksliCCRiI5f4Rq7L97T8 iIvhMr8uO+J7MkR+6Rg2hbLzPQjBqTP00H5Qqva6vTIQ7YZg4kYI3t9csV2UBQ83QxdC5Muoorc AKuphoT8D/7L4dtM6HnibkZCl//Ek= X-Gm-Gg: ASbGncueCKjtIbOX/qDuFvIlO1fVC7MMtgQgUW4Pk+YS58zJEZKzgzQe8aBDOkWjnXt 0c4YdWpwx9O4CbWC6Rz66t0PQufY723V37rZIpNCo6yTtBed6GqFxl1yFe7dMP3K2UzErDpiqMe bdI/mDyC7ML+CaKkUAfNwMYAXecMWWHxjqUpibI+iEIsDlhOI+A1aciMZff43iI2PlIvZT4a5xN 71j0G/I6RsW1u4tOuBOOEfRI9jmdaCKxY4SPWh/yufLxNxJK1CnHssGawne4tF5/xDhQs3e8rp/ /V5JSrm4dF5IULO3Z2qShcTu/svLEod2 X-Google-Smtp-Source: AGHT+IGC33UPzFkjqqTdfe9mJzS0AIOGuRfgJF2o1SS4QqUEVX6cCiTXFhdt23FgVBqzyUHbbbkklg== X-Received: by 2002:a17:907:60cf:b0:aab:c6a5:7c71 with SMTP id a640c23a62f3a-aac07900e07mr36642066b.14.1734546014914; Wed, 18 Dec 2024 10:20:14 -0800 (PST) Received: from localhost.localdomain ([178.27.36.125]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aab96359fdfsm584825066b.93.2024.12.18.10.20.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 10:20:13 -0800 (PST) From: Vicentiu Galanopulo To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Vicentiu Galanopulo , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH v10 2/3] dt-bindings: leds: Add LED1202 LED Controller Date: Wed, 18 Dec 2024 18:19:54 +0000 Message-Id: <20241218182001.41476-3-vicentiu.galanopulo@remote-tech.co.uk> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241218182001.41476-1-vicentiu.galanopulo@remote-tech.co.uk> References: <20241218182001.41476-1-vicentiu.galanopulo@remote-tech.co.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The LED1202 is a 12-channel low quiescent current LED driver with: * Supply range from 2.6 V to 5 V * 20 mA current capability per channel * 1.8 V compatible I2C control interface * 8-bit analog dimming individual control * 12-bit local PWM resolution * 8 programmable patterns If the led node is present in the controller then the channel is set to active. Signed-off-by: Vicentiu Galanopulo Reviewed-by: Krzysztof Kozlowski --- .../devicetree/bindings/leds/st,led1202.yaml | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/st,led1202.yaml diff --git a/Documentation/devicetree/bindings/leds/st,led1202.yaml b/Docum= entation/devicetree/bindings/leds/st,led1202.yaml new file mode 100644 index 000000000000..f1e5e4efaa3a --- /dev/null +++ b/Documentation/devicetree/bindings/leds/st,led1202.yaml @@ -0,0 +1,132 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/st,led1202.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ST LED1202 LED controllers + +maintainers: + - Vicentiu Galanopulo + +description: | + The LED1202 is a 12-channel low quiescent current LED controller + programmable via I2C; The output current can be adjusted separately + for each channel by 8-bit analog and 12-bit digital dimming control. + Datasheet available at + https://www.st.com/en/power-management/led1202.html + +properties: + compatible: + const: st,led1202 + + reg: + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + +patternProperties: + "^led@[0-9a-f]$": + type: object + $ref: common.yaml# + unevaluatedProperties: false + + properties: + reg: + minimum: 0 + maximum: 11 + + required: + - reg + +required: + - compatible + - reg + - "#address-cells" + - "#size-cells" + +additionalProperties: false + +examples: + - | + #include + + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + + led-controller@58 { + compatible =3D "st,led1202"; + reg =3D <0x58>; + #address-cells =3D <1>; + #size-cells =3D <0>; + + led@0 { + reg =3D <0x0>; + function =3D LED_FUNCTION_STATUS; + color =3D ; + function-enumerator =3D <1>; + }; + + led@1 { + reg =3D <0x1>; + function =3D LED_FUNCTION_STATUS; + color =3D ; + function-enumerator =3D <2>; + }; + + led@2 { + reg =3D <0x2>; + function =3D LED_FUNCTION_STATUS; + color =3D ; + function-enumerator =3D <3>; + }; + + led@3 { + reg =3D <0x3>; + function =3D LED_FUNCTION_STATUS; + color =3D ; + function-enumerator =3D <4>; + }; + + led@4 { + reg =3D <0x4>; + function =3D LED_FUNCTION_STATUS; + color =3D ; + function-enumerator =3D <5>; + }; + + led@5 { + reg =3D <0x5>; + function =3D LED_FUNCTION_STATUS; + color =3D ; + function-enumerator =3D <6>; + }; + + led@6 { + reg =3D <0x6>; + function =3D LED_FUNCTION_STATUS; + color =3D ; + function-enumerator =3D <7>; + }; + + led@7 { + reg =3D <0x7>; + function =3D LED_FUNCTION_STATUS; + color =3D ; + function-enumerator =3D <8>; + }; + + led@8 { + reg =3D <0x8>; + function =3D LED_FUNCTION_STATUS; + color =3D ; + function-enumerator =3D <9>; + }; + }; + }; +... --=20 2.39.3 (Apple Git-145) From nobody Sun Feb 8 15:53:21 2026 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 191891FC101 for ; Wed, 18 Dec 2024 18:20:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734546024; cv=none; b=au1glSLLSy+jyZNs6jJsJxuKTUxetck67KTvxQMmv7WwnSo9jXM5c2yQ9Xs0T2pmjdG2oXcwP3/pfq6e/pdGOsqfNQE2jTmerX2tLrZ8eswUvISJnlb/E0R0QWXglDk5i7YZFcQ3Qs6T+YoxjEBWAFsXbUA3QPPFo+GMjnVMrq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734546024; c=relaxed/simple; bh=Xgyf1ZvrPDJy6PZ/RdrnLlcrS5z7jRA51myxFVIwyL4=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=FUfSEaHHmrztzKQyDKXSsYIvLPTi/iG94H9GefxPxh0+H4QxWQBH5mWTxbYxCQUMjzeIMT2pNB8Hr+0H6GVW9Scx8UUyUaW0lDWVZExo8gE74//M1QXp5Wb5qkx1xHfX6irrdwq4Eza01/F6foCcrrvZ5ve7rPOSgSbUX1Sl2F8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=remote-tech.co.uk; spf=pass smtp.mailfrom=remote-tech.co.uk; dkim=pass (2048-bit key) header.d=remote-tech-co-uk.20230601.gappssmtp.com header.i=@remote-tech-co-uk.20230601.gappssmtp.com header.b=FbRk4l8P; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=remote-tech.co.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=remote-tech.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=remote-tech-co-uk.20230601.gappssmtp.com header.i=@remote-tech-co-uk.20230601.gappssmtp.com header.b="FbRk4l8P" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-aa69107179cso1247780866b.0 for ; Wed, 18 Dec 2024 10:20:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=remote-tech-co-uk.20230601.gappssmtp.com; s=20230601; t=1734546019; x=1735150819; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=imjxxRaL6nl/xaoFdtUZvQwC3tkVoZO1/0xi/BT9wlg=; b=FbRk4l8PWrZqhu5kJO8URLNT5rWwvE3TJesX5mfnjYEi0/CuIsg+ZhNlDiYmso5aTN enhwryw6MjKWwaZ8+ldl33+ZrKPL1P0ncnnUIn1/A2w6GLQYM/UO/+KoFulo7m5/dpoq yhAn9/CG4QoAXquZEma9+4LTedbn0ELR2ho4S3RKUq+cy2BhtbaL1+WWn5Rph7KGXJJD 3CrK2SZ0v2yabDB+mp8wA6K8Yu3d4WBKRDbOBnmaYXoQPTrgH0yeTFxTxLqe07Tqk79m f+BZOy9ByMRdDh/rhFiVh6czLiT2vL2fbgKYNY6EFufbdMMZvKkJ5K5TPbE50VxsVZK4 Mb+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734546019; x=1735150819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=imjxxRaL6nl/xaoFdtUZvQwC3tkVoZO1/0xi/BT9wlg=; b=hvjJ8qz/OUXrSOJw2IIJmC0hO1he0ipaaWXWlmzx0LE2ndvSTeKcSuNRkJVSuLhrEI z2O86qyJcdcpyHLbU9DERInQ2Tym+o0dTGyJ6sNKiGJGV8C50du3ZtRGWV9bTD9ndWFh otXr5Inj7fn33FIWhK8tD/JW1ZuUSgBAsFHwfzD/0jtdUkSzgihI27CrozV6ki4puLHJ 7732al7O7+ReH/xzMtchbmI1sedoX2eJafft5RComDXGBDdLpRQASZwf2ucVfwqmM0Jl wsGBNBbchssE+ELerG+7rCVdgmp8vzNlcdoPLoj0E5zrunHvryvflI+XUjeo8ImF/eow lMHQ== X-Forwarded-Encrypted: i=1; AJvYcCXySWUyo50YAZxcJMUrAgR9U03AQ9tzohgKslJkqL4gaV52JA9KX4UwlSh6hbVW6rcyaee/CBbHAKvNuWI=@vger.kernel.org X-Gm-Message-State: AOJu0YzMtJ2hoOXkUvsl6zYHQ1WYGVQk7B0g14TpnrX9GX/zZIDGSsqd KuQeAulbSxNlwkoxzgPyeYHimudrUEKitUSjfvypH5jZBX7eVhvd++r5S2o9DwV5Yi/W9I02nuG YpMudq4nFtmOYxxZcL1Qy3UnzJSdRFZsovhWPLyjINTrtmE4QIfJPZW0M2PWqnp8XNMWRiLcvvs PdzLBcmxwJIIYo28CjhdE3ip7Wm7E= X-Gm-Gg: ASbGncvT1wZcHOveCjf17MqzmDEcvuszXuD0sDX8uekyIs226G5ZI+cMkD6LLhy2r88 919qk9+8vUbyFDa+zX2HsHux41NVCQ+dlD7AMkUfABMpIftLmM25LYBUFfeXqMM2ocNYG7icmnk NowqtbkkT+fPZGMPwkyPnXbGatVeFnsWckSL0aQ5IoEONGH2gg8zHjY46gDZnzKi7YCl3WXWBVE i4g9ee8IB/a1/qaUzN+squyVhzLrd9YFGDytglai+I0Rn3kvjl06vgVo1LVGJ0Pvf+6EHfZ7j6o 6/NpFGxeu3/EukLaxfTLcsU5v0gqCSSe X-Google-Smtp-Source: AGHT+IFZo3rm/5Pgn3kIKH8yO2gRC17NwNgNK4f+eytXvakA6B22Taja8zM3yNoR6OdZ8NxBkQVtFw== X-Received: by 2002:a17:907:7f0b:b0:aac:4f1:c332 with SMTP id a640c23a62f3a-aac07b964famr30744466b.60.1734546018914; Wed, 18 Dec 2024 10:20:18 -0800 (PST) Received: from localhost.localdomain ([178.27.36.125]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aab96359fdfsm584825066b.93.2024.12.18.10.20.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 10:20:18 -0800 (PST) From: Vicentiu Galanopulo To: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , Vicentiu Galanopulo , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v10 3/3] leds: Add LED1202 I2C driver Date: Wed, 18 Dec 2024 18:19:55 +0000 Message-Id: <20241218182001.41476-4-vicentiu.galanopulo@remote-tech.co.uk> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241218182001.41476-1-vicentiu.galanopulo@remote-tech.co.uk> References: <20241218182001.41476-1-vicentiu.galanopulo@remote-tech.co.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The output current can be adjusted separately for each channel by 8-bit analog (current sink input) and 12-bit digital (PWM) dimming control. The LED1202 implements 12 low-side current generators with independent dimming control. Internal volatile memory allows the user to store up to 8 different pattern= s, each pattern is a particular output configuration in terms of PWM duty-cycle (on 4096 steps). Analog dimming (on 256 steps) is per channel but common to all patterns. Each device tree LED node will have a corresponding entry in /sys/class/leds with the label name. The brightness property corresponds to the per channel analog dimming, while the patterns[1-8] to t= he PWM dimming control. Signed-off-by: Vicentiu Galanopulo --- drivers/leds/Kconfig | 10 + drivers/leds/Makefile | 1 + drivers/leds/leds-st1202.c | 416 +++++++++++++++++++++++++++++++++++++ 3 files changed, 427 insertions(+) create mode 100644 drivers/leds/leds-st1202.c diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index b784bb74a837..c275963c498c 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -931,6 +931,16 @@ config LEDS_LM36274 Say Y to enable the LM36274 LED driver for TI LMU devices. This supports the LED device LM36274. =20 +config LEDS_ST1202 + tristate "LED Support for STMicroelectronics LED1202 I2C chips" + depends on LEDS_CLASS + depends on I2C + depends on OF + select LEDS_TRIGGERS + help + Say Y to enable support for LEDs connected to LED1202 + LED driver chips accessed via the I2C bus. + config LEDS_TPS6105X tristate "LED support for TI TPS6105X" depends on LEDS_CLASS diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 18afbb5a23ee..e8b39ef760cc 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -81,6 +81,7 @@ obj-$(CONFIG_LEDS_POWERNV) +=3D leds-powernv.o obj-$(CONFIG_LEDS_PWM) +=3D leds-pwm.o obj-$(CONFIG_LEDS_REGULATOR) +=3D leds-regulator.o obj-$(CONFIG_LEDS_SC27XX_BLTC) +=3D leds-sc27xx-bltc.o +obj-$(CONFIG_LEDS_ST1202) +=3D leds-st1202.o obj-$(CONFIG_LEDS_SUN50I_A100) +=3D leds-sun50i-a100.o obj-$(CONFIG_LEDS_SUNFIRE) +=3D leds-sunfire.o obj-$(CONFIG_LEDS_SYSCON) +=3D leds-syscon.o diff --git a/drivers/leds/leds-st1202.c b/drivers/leds/leds-st1202.c new file mode 100644 index 000000000000..b691c4886993 --- /dev/null +++ b/drivers/leds/leds-st1202.c @@ -0,0 +1,416 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * LED driver for STMicroelectronics LED1202 chip + * + * Copyright (C) 2024 Remote-Tech Ltd. UK + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ST1202_CHAN_DISABLE_ALL 0x00 +#define ST1202_CHAN_ENABLE_HIGH 0x03 +#define ST1202_CHAN_ENABLE_LOW 0x02 +#define ST1202_CONFIG_REG 0x04 +/* PATS: Pattern sequence feature enable */ +#define ST1202_CONFIG_REG_PATS BIT(7) +/* PATSR: Pattern sequence runs (self-clear when sequence is finished) */ +#define ST1202_CONFIG_REG_PATSR BIT(6) +#define ST1202_CONFIG_REG_SHFT BIT(3) +#define ST1202_DEV_ENABLE 0x01 +#define ST1202_DEV_ENABLE_ON BIT(0) +#define ST1202_DEV_ENABLE_RESET BIT(7) +#define ST1202_DEVICE_ID 0x00 +#define ST1202_ILED_REG0 0x09 +#define ST1202_MAX_LEDS 12 +#define ST1202_MAX_PATTERNS 8 +#define ST1202_MILLIS_PATTERN_DUR_MAX 5660 +#define ST1202_MILLIS_PATTERN_DUR_MIN 22 +#define ST1202_PATTERN_DUR 0x16 +#define ST1202_PATTERN_PWM 0x1E +#define ST1202_PATTERN_REP 0x15 + +struct st1202_led { + struct fwnode_handle *fwnode; + struct led_classdev led_cdev; + struct st1202_chip *chip; + bool is_active; + int led_num; +}; + +struct st1202_chip { + struct i2c_client *client; + struct mutex lock; + struct st1202_led leds[ST1202_MAX_LEDS]; +}; + +static struct st1202_led *cdev_to_st1202_led(struct led_classdev *cdev) +{ + return container_of(cdev, struct st1202_led, led_cdev); +} + +static int st1202_read_reg(struct st1202_chip *chip, int reg, uint8_t *val) +{ + struct device *dev =3D &chip->client->dev; + int ret; + + ret =3D i2c_smbus_read_byte_data(chip->client, reg); + if (ret < 0) { + dev_err(dev, "Failed to read register [0x%x]: %d\n", reg, ret); + return ret; + } + + *val =3D (uint8_t)ret; + return 0; +} + +static int st1202_write_reg(struct st1202_chip *chip, int reg, uint8_t val) +{ + struct device *dev =3D &chip->client->dev; + int ret; + + ret =3D i2c_smbus_write_byte_data(chip->client, reg, val); + if (ret !=3D 0) + dev_err(dev, "Failed to write %d to register [0x%x]: %d\n", val, reg, re= t); + + return ret; +} + +static uint8_t st1202_prescalar_to_miliseconds(unsigned int value) +{ + return value / ST1202_MILLIS_PATTERN_DUR_MIN - 1; +} + +static int st1202_pwm_pattern_write(struct st1202_chip *chip, int led_num, + int pattern, unsigned int value) +{ + u8 value_l, value_h; + int ret; + + value_l =3D (u8)value; + value_h =3D (u8)(value >> 8); + + /* + * Datasheet: Register address low =3D 1Eh + 2*(xh) + 18h*(yh), + * where x is the channel number (led number) in hexadecimal (x =3D 00h = .. 0Bh) + * and y is the pattern number in hexadecimal (y =3D 00h .. 07h) + */ + ret =3D st1202_write_reg(chip, (ST1202_PATTERN_PWM + (led_num * 2) + 0x18= * pattern), + value_l); + if (ret !=3D 0) + return ret; + + /* + * Datasheet: Register address high =3D 1Eh + 01h + 2(xh) +18h*(yh), + * where x is the channel number in hexadecimal (x =3D 00h .. 0Bh) + * and y is the pattern number in hexadecimal (y =3D 00h .. 07h) + */ + ret =3D st1202_write_reg(chip, (ST1202_PATTERN_PWM + 0x1 + (led_num * 2) = + 0x18 * pattern), + value_h); + if (ret !=3D 0) + return ret; + + return 0; +} + +static int st1202_duration_pattern_write(struct st1202_chip *chip, int pat= tern, + unsigned int value) +{ + return st1202_write_reg(chip, (ST1202_PATTERN_DUR + pattern), + st1202_prescalar_to_miliseconds(value)); +} + +static void st1202_brightness_set(struct led_classdev *led_cdev, + enum led_brightness value) +{ + struct st1202_led *led =3D cdev_to_st1202_led(led_cdev); + struct st1202_chip *chip =3D led->chip; + + guard(mutex)(&chip->lock); + + st1202_write_reg(chip, ST1202_ILED_REG0 + led->led_num, value); +} + +static enum led_brightness st1202_brightness_get(struct led_classdev *led_= cdev) +{ + struct st1202_led *led =3D cdev_to_st1202_led(led_cdev); + struct st1202_chip *chip =3D led->chip; + u8 value =3D 0; + + guard(mutex)(&chip->lock); + + st1202_read_reg(chip, ST1202_ILED_REG0 + led->led_num, &value); + + return value; +} + +static int st1202_channel_set(struct st1202_chip *chip, int led_num, bool = active) +{ + u8 chan_low, chan_high; + int ret; + + guard(mutex)(&chip->lock); + + if (led_num <=3D 7) { + ret =3D st1202_read_reg(chip, ST1202_CHAN_ENABLE_LOW, &chan_low); + if (ret < 0) + return ret; + + chan_low =3D active ? chan_low | BIT(led_num) : chan_low & ~BIT(led_num); + + ret =3D st1202_write_reg(chip, ST1202_CHAN_ENABLE_LOW, chan_low); + if (ret < 0) + return ret; + + } else { + ret =3D st1202_read_reg(chip, ST1202_CHAN_ENABLE_HIGH, &chan_high); + if (ret < 0) + return ret; + + chan_high =3D active ? chan_high | (BIT(led_num) >> 8) : + chan_high & ~(BIT(led_num) >> 8); + + ret =3D st1202_write_reg(chip, ST1202_CHAN_ENABLE_HIGH, chan_high); + if (ret < 0) + return ret; + } + + return 0; +} + +static int st1202_led_set(struct led_classdev *ldev, enum led_brightness v= alue) +{ + struct st1202_led *led =3D cdev_to_st1202_led(ldev); + struct st1202_chip *chip =3D led->chip; + + return st1202_channel_set(chip, led->led_num, value =3D=3D LED_OFF ? fals= e : true); +} + +static int st1202_led_pattern_clear(struct led_classdev *ldev) +{ + struct st1202_led *led =3D cdev_to_st1202_led(ldev); + struct st1202_chip *chip =3D led->chip; + int ret; + + guard(mutex)(&chip->lock); + + for (int patt =3D 0; patt < ST1202_MAX_PATTERNS; patt++) { + ret =3D st1202_pwm_pattern_write(chip, led->led_num, patt, LED_OFF); + if (ret !=3D 0) + return ret; + + ret =3D st1202_duration_pattern_write(chip, patt, ST1202_MILLIS_PATTERN_= DUR_MIN); + if (ret !=3D 0) + return ret; + } + + return 0; +} + +static int st1202_led_pattern_set(struct led_classdev *ldev, + struct led_pattern *pattern, + u32 len, int repeat) +{ + struct st1202_led *led =3D cdev_to_st1202_led(ldev); + struct st1202_chip *chip =3D led->chip; + int ret; + + if (len > ST1202_MAX_PATTERNS) + return -EINVAL; + + guard(mutex)(&chip->lock); + + for (int patt =3D 0; patt < len; patt++) { + if (pattern[patt].delta_t < ST1202_MILLIS_PATTERN_DUR_MIN || + pattern[patt].delta_t > ST1202_MILLIS_PATTERN_DUR_MAX) + return -EINVAL; + + ret =3D st1202_pwm_pattern_write(chip, led->led_num, patt, pattern[patt]= .brightness); + if (ret !=3D 0) + return ret; + + ret =3D st1202_duration_pattern_write(chip, patt, pattern[patt].delta_t); + if (ret !=3D 0) + return ret; + } + + ret =3D st1202_write_reg(chip, ST1202_PATTERN_REP, repeat); + if (ret !=3D 0) + return ret; + + ret =3D st1202_write_reg(chip, ST1202_CONFIG_REG, (ST1202_CONFIG_REG_PATS= R | + ST1202_CONFIG_REG_PATS | ST1202_CONFIG_REG_SHFT)); + if (ret !=3D 0) + return ret; + + return 0; +} + +static int st1202_dt_init(struct st1202_chip *chip) +{ + struct device *dev =3D &chip->client->dev; + struct st1202_led *led; + int err, reg; + + for_each_available_child_of_node_scoped(dev_of_node(dev), child) { + struct led_init_data init_data =3D {}; + + err =3D of_property_read_u32(child, "reg", ®); + if (err) + return dev_err_probe(dev, err, "Invalid register\n"); + + led =3D &chip->leds[reg]; + led->is_active =3D true; + led->fwnode =3D of_fwnode_handle(child); + + led->led_cdev.max_brightness =3D U8_MAX; + led->led_cdev.brightness_set_blocking =3D st1202_led_set; + led->led_cdev.pattern_set =3D st1202_led_pattern_set; + led->led_cdev.pattern_clear =3D st1202_led_pattern_clear; + led->led_cdev.default_trigger =3D "pattern"; + + init_data.fwnode =3D led->fwnode; + init_data.devicename =3D "st1202"; + init_data.default_label =3D ":"; + + err =3D devm_led_classdev_register_ext(dev, &led->led_cdev, &init_data); + if (err < 0) + return dev_err_probe(dev, err, "Failed to register LED class device\n"); + + led->led_cdev.brightness_set =3D st1202_brightness_set; + led->led_cdev.brightness_get =3D st1202_brightness_get; + } + + return 0; +} + +static int st1202_setup(struct st1202_chip *chip) +{ + int ret; + + guard(mutex)(&chip->lock); + + /* + * Once the supply voltage is applied, the LED1202 executes some internal= checks, + * afterwords it stops the oscillator and puts the internal LDO in quiesc= ent mode. + * To start the device, EN bit must be set inside the =E2=80=9CDevice Ena= ble=E2=80=9D register at + * address 01h. As soon as EN is set, the LED1202 loads the adjustment pa= rameters + * from the internal non-volatile memory and performs an auto-calibration= procedure + * in order to increase the output current precision. + * Such initialization lasts about 6.5 ms. + */ + + /* Reset the chip during setup */ + ret =3D st1202_write_reg(chip, ST1202_DEV_ENABLE, ST1202_DEV_ENABLE_RESET= ); + if (ret < 0) + return ret; + + /* Enable phase-shift delay feature */ + ret =3D st1202_write_reg(chip, ST1202_CONFIG_REG, ST1202_CONFIG_REG_SHFT); + if (ret < 0) + return ret; + + /* Enable the device */ + ret =3D st1202_write_reg(chip, ST1202_DEV_ENABLE, ST1202_DEV_ENABLE_ON); + if (ret < 0) + return ret; + + /* Duration of initialization */ + usleep_range(6500, 10000); + + /* Deactivate all LEDS (channels) and activate only the ones found in Dev= ice Tree */ + ret =3D st1202_write_reg(chip, ST1202_CHAN_ENABLE_LOW, ST1202_CHAN_DISABL= E_ALL); + if (ret < 0) + return ret; + + ret =3D st1202_write_reg(chip, ST1202_CHAN_ENABLE_HIGH, ST1202_CHAN_DISAB= LE_ALL); + if (ret < 0) + return ret; + + ret =3D st1202_write_reg(chip, ST1202_CONFIG_REG, + ST1202_CONFIG_REG_PATS | ST1202_CONFIG_REG_PATSR); + if (ret < 0) + return ret; + + return 0; +} + +static int st1202_probe(struct i2c_client *client) +{ + struct st1202_chip *chip; + struct st1202_led *led; + int ret; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) + return dev_err_probe(&client->dev, -EIO, "SMBUS Byte Data not Supported\= n"); + + chip =3D devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); + if (!chip) + return -ENOMEM; + + devm_mutex_init(&client->dev, &chip->lock); + chip->client =3D client; + + ret =3D st1202_dt_init(chip); + if (ret < 0) + return ret; + + ret =3D st1202_setup(chip); + if (ret < 0) + return ret; + + for (int i =3D 0; i < ST1202_MAX_LEDS; i++) { + led =3D &chip->leds[i]; + led->chip =3D chip; + led->led_num =3D i; + + if (!led->is_active) + continue; + + ret =3D st1202_channel_set(led->chip, led->led_num, true); + if (ret < 0) + return dev_err_probe(&client->dev, ret, + "Failed to activate LED channel\n"); + + ret =3D st1202_led_pattern_clear(&led->led_cdev); + if (ret < 0) + return dev_err_probe(&client->dev, ret, + "Failed to clear LED pattern\n"); + } + + return 0; +} + +static const struct i2c_device_id st1202_id[] =3D { + { "st1202-i2c" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(i2c, st1202_id); + +static const struct of_device_id st1202_dt_ids[] =3D { + { .compatible =3D "st,led1202" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, st1202_dt_ids); + +static struct i2c_driver st1202_driver =3D { + .driver =3D { + .name =3D "leds-st1202", + .of_match_table =3D of_match_ptr(st1202_dt_ids), + }, + .probe =3D st1202_probe, + .id_table =3D st1202_id, +}; +module_i2c_driver(st1202_driver); + +MODULE_AUTHOR("Remote Tech LTD"); +MODULE_DESCRIPTION("STMicroelectronics LED1202 : 12-channel constant curre= nt LED driver"); +MODULE_LICENSE("GPL"); --=20 2.39.3 (Apple Git-145)