From patchwork Sun Dec 4 10:43:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Philipp Klemm X-Patchwork-Id: 630904 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 D47A6C4332F for ; Sun, 4 Dec 2022 10:59:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229834AbiLDK7F convert rfc822-to-8bit (ORCPT ); Sun, 4 Dec 2022 05:59:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229917AbiLDK7E (ORCPT ); Sun, 4 Dec 2022 05:59:04 -0500 Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A719317E2A; Sun, 4 Dec 2022 02:59:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670150627; cv=none; d=zohomail.eu; s=zohoarc; b=ec07gctNe7R/k5thMNk5OBHzQJ2NeGUC4l6vEKG48GQySl5qKMGwU//mYM+a/PAf26AvPyiCRxp4ai8EXFbOi50OLTa6pdJI+C411d/Q0ow3fUH4cM/An4cbZ1nohovoVghc0iwDT/0f38pCpgcyZGgWL/zG/QzNB81Kdzcyq/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1670150627; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=jHe0jGTJmF7m6cDleOyuTXJHSDg7MvwwuBD3IegP5zw=; b=d55LpoLSjWZrEus9peQWyawsEV9D7+A6k++BwKslGOI5XpFGdAWFge3TkTRPpCKvlO/OMcqiHL7IvCY0fpbmVfsXRP0691KUhjQXJ1dL9Vo/7UNlEn3SU6xX59JQANb0zEBthg5s7NnYv5GwHNKNtd9IWCAWP6qK4luuMFbnbZ8= ARC-Authentication-Results: i=1; mx.zohomail.eu; spf=pass smtp.mailfrom=philipp@uvos.xyz; dmarc=pass header.from= Received: from localhost.localdomain (ip-095-222-026-199.um34.pools.vodafone-ip.de [95.222.26.199]) by mx.zoho.eu with SMTPS id 167015062549041.40231813979858; Sun, 4 Dec 2022 11:43:45 +0100 (CET) From: Carl Philipp Klemm To: linux-omap@vger.kernel.org, tony@atomide.com, sre@kernel.org Cc: devicetree@vger.kernel.org, Carl Philipp Klemm Message-ID: <20221204104313.17478-2-philipp@uvos.xyz> Subject: [PATCH 2/4] leds: cpcap: make leds-cpcap an independent platform device to allow varying led setups Date: Sun, 4 Dec 2022 11:43:11 +0100 X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221204104313.17478-1-philipp@uvos.xyz> References: <20221204104313.17478-1-philipp@uvos.xyz> MIME-Version: 1.0 X-ZohoMailClient: External Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Previously led-cpcap devices where defined statically in mfd_cell of the parent mdf device. This causes issues for devices like xt875 that have less and different leds than xt894. Splitting the device like this is posssible, as in reality the cpcap led ip block is totaly independent from the mdf device and cpcap core. Signed-off-by: Carl Philipp Klemm --- drivers/leds/leds-cpcap.c | 19 +++++++++++++++++-- drivers/mfd/motorola-cpcap.c | 24 ------------------------ 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/drivers/leds/leds-cpcap.c b/drivers/leds/leds-cpcap.c index 11a9b857d8ea..7a1dd050fdf0 100644 --- a/drivers/leds/leds-cpcap.c +++ b/drivers/leds/leds-cpcap.c @@ -11,6 +11,7 @@ #include #include #include +#include #define CPCAP_LED_NO_CURRENT 0x0001 @@ -170,6 +171,18 @@ static int cpcap_led_probe(struct platform_device *pdev) { struct cpcap_led *led; int err; + struct device_node *mfd_node; + struct device *cpcap_dev; + + mfd_node = of_parse_phandle(pdev->dev.of_node, "cpcap-phandle", 0); + if (!mfd_node) { + dev_err(&pdev->dev, "cpcap-phandle is missing in device tree\n"); + return -ENODEV; + } + + cpcap_dev = bus_find_device_by_of_node(&spi_bus_type, mfd_node); + if (IS_ERR_OR_NULL(cpcap_dev)) + return -EAGAIN; led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); if (!led) @@ -188,9 +201,11 @@ static int cpcap_led_probe(struct platform_device *pdev) return -ENODEV; } - led->regmap = dev_get_regmap(pdev->dev.parent, NULL); - if (!led->regmap) + led->regmap = dev_get_regmap(cpcap_dev, NULL); + if (!led->regmap) { + dev_err(led->dev, "Couldn't get regmap from cpcap mdf device"); return -ENODEV; + } led->vdd = devm_regulator_get(&pdev->dev, "vdd"); if (IS_ERR(led->vdd)) { diff --git a/drivers/mfd/motorola-cpcap.c b/drivers/mfd/motorola-cpcap.c index 57b3378a8829..e1ae14e0e651 100644 --- a/drivers/mfd/motorola-cpcap.c +++ b/drivers/mfd/motorola-cpcap.c @@ -265,30 +265,6 @@ static const struct mfd_cell cpcap_mfd_devices[] = { }, { .name = "cpcap-usb-phy", .of_compatible = "motorola,mapphone-cpcap-usb-phy", - }, { - .name = "cpcap-led", - .id = 0, - .of_compatible = "motorola,cpcap-led-red", - }, { - .name = "cpcap-led", - .id = 1, - .of_compatible = "motorola,cpcap-led-green", - }, { - .name = "cpcap-led", - .id = 2, - .of_compatible = "motorola,cpcap-led-blue", - }, { - .name = "cpcap-led", - .id = 3, - .of_compatible = "motorola,cpcap-led-adl", - }, { - .name = "cpcap-led", - .id = 4, - .of_compatible = "motorola,cpcap-led-cp", - }, { - .name = "cpcap-led", - .id = 5, - .of_compatible = "motorola,cpcap-led-kl", }, { .name = "cpcap-codec", } From patchwork Sun Dec 4 10:43:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Philipp Klemm X-Patchwork-Id: 630903 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 E8519C4708E for ; Sun, 4 Dec 2022 10:59:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229983AbiLDK7M convert rfc822-to-8bit (ORCPT ); Sun, 4 Dec 2022 05:59:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229938AbiLDK7J (ORCPT ); Sun, 4 Dec 2022 05:59:09 -0500 Received: from sender11-of-o51.zoho.eu (sender11-of-o51.zoho.eu [31.186.226.237]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B00D218344; Sun, 4 Dec 2022 02:59:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670150631; cv=none; d=zohomail.eu; s=zohoarc; b=XV8U0fIewNZMDyRQfh1ndXul/l8myE4FgPeN4LNja3joTSpD4lNJcZOuseOn2/jGzL1R50D3rO6q+AiWnDUWOJ5/ImWPS+wiSVGNc9ixEZu57mfjA0D7Q80aL2emm46nb2IqVMbqmvl2sPQYH5Da68QLWVtssk40JH2eU+YCZrw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1670150631; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=tnqaXZrkk+J8/iyv+u9EIdqT2hYanUoFYILAn5CMJ+s=; b=jcM+O5KfnvMwtltAZzCXjVerZB/7026DlMRRtF2PjXnD2UtYHmi0tvBmtEKehDlcOu9Qm2PgrcW4vkO+LLhSqE8KZXWDvibQPxf+iWjY60vueIVIw2VqEQQG76SCv02GMg84YI1RpMRfzqrqy9mFVhADTNEq9K8q08KoXmjhfLI= ARC-Authentication-Results: i=1; mx.zohomail.eu; spf=pass smtp.mailfrom=philipp@uvos.xyz; dmarc=pass header.from= Received: from localhost.localdomain (ip-095-222-026-199.um34.pools.vodafone-ip.de [95.222.26.199]) by mx.zoho.eu with SMTPS id 1670150628750701.5439332715536; Sun, 4 Dec 2022 11:43:48 +0100 (CET) From: Carl Philipp Klemm To: linux-omap@vger.kernel.org, tony@atomide.com, sre@kernel.org Cc: devicetree@vger.kernel.org, Carl Philipp Klemm Message-ID: <20221204104313.17478-4-philipp@uvos.xyz> Subject: [PATCH 4/4] arch: arm: dts: cpcap-mapphone: Move cpcap leds from common dts file to devices as apropriate Date: Sun, 4 Dec 2022 11:43:13 +0100 X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221204104313.17478-1-philipp@uvos.xyz> References: <20221204104313.17478-1-philipp@uvos.xyz> MIME-Version: 1.0 X-ZohoMailClient: External Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Removes non-functional leds from xt875 and adds its touchscreen button light Signed-off-by: Carl Philipp Klemm --- .../arm/boot/dts/motorola-cpcap-mapphone.dtsi | 47 ++++++++----------- .../arm/boot/dts/omap4-droid-bionic-xt875.dts | 7 +++ arch/arm/boot/dts/omap4-droid4-xt894.dts | 14 ++++++ 3 files changed, 41 insertions(+), 27 deletions(-) diff --git a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi index ea02fd403a9b..f7ddcf122404 100644 --- a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi +++ b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi @@ -115,36 +115,29 @@ cpcap_usb2_phy: phy { io-channel-names = "vbus", "id"; vusb-supply = <&vusb>; }; + }; +}; - led_red: led-red { - compatible = "motorola,cpcap-led-red"; - vdd-supply = <&sw5>; - label = "status-led:red"; - }; - - led_green: led-green { - compatible = "motorola,cpcap-led-green"; - vdd-supply = <&sw5>; - label = "status-led:green"; - }; - - led_blue: led-blue { - compatible = "motorola,cpcap-led-blue"; - vdd-supply = <&sw5>; - label = "status-led:blue"; - }; +/ { + led_red: led-red { + compatible = "motorola,cpcap-led-red"; + vdd-supply = <&sw5>; + label = "status-led:red"; + cpcap-phandle = <&cpcap>; + }; - led_adl: led-adl { - compatible = "motorola,cpcap-led-adl"; - vdd-supply = <&sw5>; - label = "button-backlight"; - }; + led_green: led-green { + compatible = "motorola,cpcap-led-green"; + vdd-supply = <&sw5>; + label = "status-led:green"; + cpcap-phandle = <&cpcap>; + }; - led_cp: led-cp { - compatible = "motorola,cpcap-led-cp"; - vdd-supply = <&sw5>; - label = "shift-key-light"; - }; + led_blue: led-blue { + compatible = "motorola,cpcap-led-blue"; + vdd-supply = <&sw5>; + label = "status-led:blue"; + cpcap-phandle = <&cpcap>; }; }; diff --git a/arch/arm/boot/dts/omap4-droid-bionic-xt875.dts b/arch/arm/boot/dts/omap4-droid-bionic-xt875.dts index ccf03a743678..eae69ec9b3f1 100644 --- a/arch/arm/boot/dts/omap4-droid-bionic-xt875.dts +++ b/arch/arm/boot/dts/omap4-droid-bionic-xt875.dts @@ -6,6 +6,13 @@ / { model = "Motorola Droid Bionic XT875"; compatible = "motorola,droid-bionic", "ti,omap4430", "ti,omap4"; + + led_kl: led-kl { + compatible = "motorola,cpcap-led-kl"; + vdd-supply = <&sw5>; + label = "button-backlight"; + cpcap-phandle = <&cpcap>; + }; }; &keypad { diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index e833c21f1c01..a590f28edbf6 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts @@ -31,6 +31,20 @@ slider { debounce-interval = <10>; }; }; + + led_adl: led-adl { + compatible = "motorola,cpcap-led-adl"; + vdd-supply = <&sw5>; + label = "button-backlight"; + cpcap-phandle = <&cpcap>; + }; + + led_cp: led-cp { + compatible = "motorola,cpcap-led-cp"; + vdd-supply = <&sw5>; + label = "shift-key-light"; + cpcap-phandle = <&cpcap>; + }; }; / {