From patchwork Mon Mar 21 08:55:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 12786990 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E2702C9E for ; Mon, 21 Mar 2022 08:56:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D10B0C340F4; Mon, 21 Mar 2022 08:56:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647852987; bh=JOxBbU85PIDh5q8fQ7u3tZbk+aC74evCjtf8jSmnQJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GVj31NNC9haN0oT/wmRNbhOtPiJ0MDU/rdmyt/JATCvhKxY1s6cQ3O11/rYyv1yVi FArp0kGbpUUiM4f9yBCwJHMSFDJHtWHszg5j+nlDhfrPTMP3VROV78EOW0IsoHkmtA QYUDy0fIjj96CN6llz9TcOTlJwuDmmfLz5CmHXfBWnSy7ZGVS2F4is4dKJO+LLnDd+ TevaFSnZJQ5Ho4S5BR/QfAdSzmXbGIUQdQU0KPjhs2lnQ01vEs59vFuqICI78mnPGP ea+LVSV/njiHxnysuZOPpWuc/ygDGDzRIvT1Z7AnZ+U0GoGURe73xP7Z0PR1UXlL0l 1H7hNNFl5kfXw== From: Tzung-Bi Shih To: bleung@chromium.org, groeck@chromium.org, robh+dt@kernel.org Cc: chrome-platform@lists.linux.dev, tzungbi@kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck Subject: [PATCH v3 4/5] platform/chrome: cros_kbd_led_backlight: support OF match Date: Mon, 21 Mar 2022 16:55:46 +0800 Message-Id: <20220321085547.1162312-5-tzungbi@kernel.org> X-Mailer: git-send-email 2.35.1.894.gb6a874cedc-goog In-Reply-To: <20220321085547.1162312-1-tzungbi@kernel.org> References: <20220321085547.1162312-1-tzungbi@kernel.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 For letting device tree based machines to use the driver, support OF match. Reviewed-by: Guenter Roeck Signed-off-by: Tzung-Bi Shih --- Changes from v2: - Add commit message. - Add R-b tag. Changes from v1: (https://patchwork.kernel.org/project/chrome-platform/patch/20220214053646.3088298-5-tzungbi@google.com/) - Update email address accordingly. - Use device_get_match_data() per review comment in v1. drivers/platform/chrome/cros_kbd_led_backlight.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_kbd_led_backlight.c b/drivers/platform/chrome/cros_kbd_led_backlight.c index 05b4f274086b..5cbe27cb4610 100644 --- a/drivers/platform/chrome/cros_kbd_led_backlight.c +++ b/drivers/platform/chrome/cros_kbd_led_backlight.c @@ -10,7 +10,9 @@ #include #include #include +#include #include +#include #include /** @@ -127,7 +129,7 @@ static int keyboard_led_probe(struct platform_device *pdev) const struct keyboard_led_drvdata *drvdata; int error; - drvdata = acpi_device_get_match_data(&pdev->dev); + drvdata = device_get_match_data(&pdev->dev); if (!drvdata) return -EINVAL; @@ -163,10 +165,21 @@ static const struct acpi_device_id keyboard_led_acpi_match[] = { MODULE_DEVICE_TABLE(acpi, keyboard_led_acpi_match); #endif +#ifdef CONFIG_OF +static const struct of_device_id keyboard_led_of_match[] = { + { + .compatible = "google,cros-kbd-led-backlight", + }, + {} +}; +MODULE_DEVICE_TABLE(of, keyboard_led_of_match); +#endif + static struct platform_driver keyboard_led_driver = { .driver = { .name = "chromeos-keyboard-leds", .acpi_match_table = ACPI_PTR(keyboard_led_acpi_match), + .of_match_table = of_match_ptr(keyboard_led_of_match), }, .probe = keyboard_led_probe, };