From patchwork Fri Oct 6 10:03:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 13411227 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2834E92FFA for ; Fri, 6 Oct 2023 10:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231559AbjJFKDh (ORCPT ); Fri, 6 Oct 2023 06:03:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231535AbjJFKDh (ORCPT ); Fri, 6 Oct 2023 06:03:37 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 875EAAD for ; Fri, 6 Oct 2023 03:03:35 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231006100331euoutp023e661c7996f8b9968736e6e965627887~LfIjUNY8f0648406484euoutp02_ for ; Fri, 6 Oct 2023 10:03:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231006100331euoutp023e661c7996f8b9968736e6e965627887~LfIjUNY8f0648406484euoutp02_ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696586611; bh=26Lv+is9OakJ4x7WmOArKP1bVEUcRhQ+PNABYJruimA=; h=From:To:Cc:Subject:Date:References:From; b=MNX202t/lPaJW2/nRGgKMAZbdaY2kTNdnJi1snu9xYQ/9qnLqS9brwm1pktJnHeMw MdSalX71m+rdbATVhTwkvuj2OvMIMlvIneCOSHgCsPbydr47v7Mp+C3tfV6LXboy+Y rimoXwAj8FGfoU3zkDie7ghrN0f0rpkBpcuODB14= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231006100331eucas1p299bd17717fc99cb7d1a396ccabb5bb79~LfIjDikqN2220722207eucas1p2H; Fri, 6 Oct 2023 10:03:31 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 75.D3.42423.37BDF156; Fri, 6 Oct 2023 11:03:31 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231006100330eucas1p2c874f582336ed1de4dc1cd759c452ce2~LfIikuRin2220722207eucas1p2G; Fri, 6 Oct 2023 10:03:30 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231006100330eusmtrp10bd268b7432e420a68f9d8518074625c~LfIikKXZb2314123141eusmtrp1c; Fri, 6 Oct 2023 10:03:30 +0000 (GMT) X-AuditID: cbfec7f2-a3bff7000002a5b7-20-651fdb73496a Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 45.10.10549.27BDF156; Fri, 6 Oct 2023 11:03:30 +0100 (BST) Received: from AMDC4653.digital.local (unknown [106.120.51.32]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231006100330eusmtip2f3873f0c5b193a98db11e42c48717521~LfIiMf0Rj0569705697eusmtip2W; Fri, 6 Oct 2023 10:03:30 +0000 (GMT) From: Marek Szyprowski To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , Dmitry Torokhov , Krzysztof Kozlowski Subject: [PATCH v2] Input: max77693-haptic - add device-tree compatible strings Date: Fri, 6 Oct 2023 12:03:20 +0200 Message-Id: <20231006100320.2908210-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42LZduznOd3i2/KpBv0TxSwOL3rBaLH39VZ2 i5ufvrFaXN41h81i7ZG77A6sHjtn3WX3uHNtD5tH35ZVjB6fN8kFsERx2aSk5mSWpRbp2yVw ZVz+P5Gx4IxAxdLuQ8wNjB18XYycHBICJhI7/1xl7GLk4hASWMEo8fz1FSYI5wujxNsVPawQ zmdGiUNnP7HBtMy68BmqZTmjxMRVkxnhWvae28sIUsUmYCjR9bYLrENEwFZix4rpYHOZBaYx Six+fZIdJCEsECjx6vMHJhCbRUBV4untH2A2r4C9RFvDQhaIdfIS+w+eZYaIC0qcnPkELM4M FG/eOpsZZKiEQCeHxLG191khGlwkpp09DnWrsMSr41vYIWwZidOTe1ggGtoZJRb8vs8E4Uxg lGh4fosRospa4s65X0DdHEArNCXW79KHCDtKdBzawAISlhDgk7jxVhDiCD6JSdumM0OEeSU6 2oQgqtUkZh1fB7f24IVLzBC2h0RDK8g5HMDQipV41cs0gVFhFpLPZiH5bBbCCQsYmVcxiqeW FuempxYb5qWW6xUn5haX5qXrJefnbmIEJpTT/45/2sE499VHvUOMTByMhxglOJiVRHjTG2RS hXhTEiurUovy44tKc1KLDzFKc7AoifOqpsinCgmkJ5akZqemFqQWwWSZODilGphaFpunmH5O eHLszoV1DzsrQzdKhOxbvuu7eYlbspekqHeF2dy1D161Bcw6yrV8QfJR/ZmBAYXfHs80fG6U 5dx5/H1e/QEn7r2d2cprvhipLw1Ni+Wq9Vb8v90oUF7k/zJu8f5LMdVR5bPEtnNrqCQ73xWM +uu35cakx7Y3Jk7okFH9zGFiZ5D1uyFA+1JeXeqHN7Hbn34RUP3fcOui9Xk1Q510HuHYkFl+ 6d0NS4MP1c6JvZMVbP9K7fz3rGfdV6/flNw8+bXX85Bg+/Dt+rv3rrvjw7WoupbP55fXpX3n T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5O0CAAA= X-CMS-MailID: 20231006100330eucas1p2c874f582336ed1de4dc1cd759c452ce2 X-Msg-Generator: CA X-RootMTR: 20231006100330eucas1p2c874f582336ed1de4dc1cd759c452ce2 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231006100330eucas1p2c874f582336ed1de4dc1cd759c452ce2 References: Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Add the needed device-tree compatible strings to the MAX77693 haptic driver, so it can be automatically loaded when compiled as a kernel module and given device-tree contains separate (i.e. 'motor-driver') node under the main PMIC node. When device is instantiated from device-tree, the driver data cannot be read via platform_get_device_id(), so get device type from the parent MFD device instead, what works for both cases. Signed-off-by: Marek Szyprowski Reviewed-by: Krzysztof Kozlowski --- drivers/input/misc/max77693-haptic.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/input/misc/max77693-haptic.c b/drivers/input/misc/max77693-haptic.c index 80f4416ffe2f..0e646f1b257b 100644 --- a/drivers/input/misc/max77693-haptic.c +++ b/drivers/input/misc/max77693-haptic.c @@ -307,7 +307,7 @@ static int max77693_haptic_probe(struct platform_device *pdev) haptic->suspend_state = false; /* Variant-specific init */ - haptic->dev_type = platform_get_device_id(pdev)->driver_data; + haptic->dev_type = max77693->type; switch (haptic->dev_type) { case TYPE_MAX77693: haptic->regmap_haptic = max77693->regmap_haptic; @@ -406,16 +406,24 @@ static DEFINE_SIMPLE_DEV_PM_OPS(max77693_haptic_pm_ops, max77693_haptic_resume); static const struct platform_device_id max77693_haptic_id[] = { - { "max77693-haptic", TYPE_MAX77693 }, - { "max77843-haptic", TYPE_MAX77843 }, + { "max77693-haptic", }, + { "max77843-haptic", }, {}, }; MODULE_DEVICE_TABLE(platform, max77693_haptic_id); +static const struct of_device_id of_max77693_haptic_dt_match[] = { + { .compatible = "maxim,max77693-haptic", }, + { .compatible = "maxim,max77843-haptic", }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, of_max77693_haptic_dt_match); + static struct platform_driver max77693_haptic_driver = { .driver = { .name = "max77693-haptic", .pm = pm_sleep_ptr(&max77693_haptic_pm_ops), + .of_match_table = of_max77693_haptic_dt_match, }, .probe = max77693_haptic_probe, .id_table = max77693_haptic_id,