Message ID | 20221013094838.1529153-2-Naresh.Solanki@9elements.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp179674wrs; Thu, 13 Oct 2022 02:49:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fCTQZl5ClKbrgYN0r6CcY2S5TKSa21fVXWR1lRgUMXZkzU5uEeUjMfRUx7tiQwtbKtPbD X-Received: by 2002:a63:fb01:0:b0:440:6e9b:1e86 with SMTP id o1-20020a63fb01000000b004406e9b1e86mr28521352pgh.26.1665654564043; Thu, 13 Oct 2022 02:49:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665654564; cv=none; d=google.com; s=arc-20160816; b=EPkrJ2U+tiDnx21/qfBI0iQtbWjI9tHBny136Bl7qe3QWJ5HlIoEM405eEkdofbuHq wQVKG5rDWWl/iqXUxwAmt0wt2B3fTnHsF9veY7ZSzfDRa9r5v9u5AWVX601JkAsd4ezo 9prPLLZ+ZdCB/w89/F1vaFuqmV7vK05nlucga5bHScUMN+IHj9m695tgev/bCh/cuvS7 mEzw2bUpAmr1R4mVUyRvCNfZ021YVcR8GWGXSZNtfVnq4l9Rez6XZALmgOpW1PcTQIem sSX7CDFib6kZgkuY0Og+6iv9zVsdqsGkh3Dav+7xzcf6EnsCPYVqj722JwoPLaGl9NIE +MZg== 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=WTl7droVltKnXDsBoh0Qb/I0hZgySD4P2UJsI4/mO+E=; b=MXQXgyU/7W2zrSIIAxkD2e75ddGwZpqSrSBS7al53Z7jZf9jNYo7X3z2VmuFtidy0f eXApmxv3yariksP9D1EH5f2yvEl6m+cX3m7utqCpRQcTSj/YkC4tA3JP0kY4spOMQaVW nJjsE3vT7nndsZlh7jGg9wXepYquhPlw2Eib71GN225rxhUa/F/uYKIPxnQDVLamKy6P CfMi/rii/IlGPvgQzx4lABwmfwi/BlYdooVcHikVwwzJtIEaLN70pNHubggILTrG1Zw8 lCuEdMUV48U8aBSIgSwTu56g+gSjQOMLtuZk/QLXHtseGfmzsA746M5s/HKGOO0+51GA PyFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=VcpBLoI2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b14-20020a056a000cce00b00562fc008395si17917600pfv.341.2022.10.13.02.49.11; Thu, 13 Oct 2022 02:49:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@9elements.com header.s=google header.b=VcpBLoI2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=9elements.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229587AbiJMJst (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Thu, 13 Oct 2022 05:48:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229548AbiJMJsq (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 13 Oct 2022 05:48:46 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A76B9104537 for <linux-kernel@vger.kernel.org>; Thu, 13 Oct 2022 02:48:45 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id sc25so2659111ejc.12 for <linux-kernel@vger.kernel.org>; Thu, 13 Oct 2022 02:48:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; 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=WTl7droVltKnXDsBoh0Qb/I0hZgySD4P2UJsI4/mO+E=; b=VcpBLoI2GZnFQeZ10p9jSVjI2ovSK6WLIhf1cD/WeK7vjOV+a/mi71G01oUTaDG9HY uX7LtYmSLtlo2i//Hg6RU7kr8zHq1eU+MJsqay6jTioLELp6ZxRV7DqHkKc5m0euXO/G ecXpb9faVxqjgYixI4uv7vejFPx9VqGQXV+JtBFegC52xyECEveXo4FVY0iA4qKp8HvY PQ8Ylyq4N90WcGHwYTSuIeBMWZpy/wYTc5T5KvmjKKHymXbajALB1/ZFCKI90+4ZlzE4 l695xSHTF7Gm4tF3itf1YfVpy+TiyI/V2TA9fOeL6vpPspVqc366VkF8pyMpGKJoW968 F9WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=WTl7droVltKnXDsBoh0Qb/I0hZgySD4P2UJsI4/mO+E=; b=UV80gCUNF/t9gv0FYFgDoHLG++8cByqMncx9TqV0WDe8J6C52Lg1VIp6ItTA7i49QJ YT7cfyee5XB6/WvNqwcpuTuV48UWJ+L1N7mH2WY2vBcxpKCqeOVV3oBnIbg/j9pJYFVL dpwopNaE8sWPro59ZHl/aa7nWF2/P0r4a5uDvqRbgdg2Rg9NODI9gtYWJNhv6Rpy7uNz A5+gcGq1IkGdw4Tx5ORbXs0iALD1d8rOlDU0xHkz+SWmFLRu+8QmMNUFZcYyrpuCfyeB 6AxqESP1iTat7jOGrtK6DT9zhAIdVDFkclpli6yRPzix5xXEFbDxEq8rAm7pLV4fwzJ5 9Xag== X-Gm-Message-State: ACrzQf2pOpy5AIyunyhfEuRkabMPcXXeCtFbW39JMG27mz5GgiJXlXvP GfdOP6gZ0M/T+g+yktcsZLeiTg== X-Received: by 2002:a17:906:7945:b0:73b:e605:f31 with SMTP id l5-20020a170906794500b0073be6050f31mr25947222ejo.129.1665654524224; Thu, 13 Oct 2022 02:48:44 -0700 (PDT) Received: from stroh80.sec.9e.network (ip-078-094-000-051.um19.pools.vodafone-ip.de. [78.94.0.51]) by smtp.gmail.com with ESMTPSA id e14-20020a170906080e00b0078d25e0f74bsm2685353ejd.46.2022.10.13.02.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 02:48:43 -0700 (PDT) From: Naresh Solanki <naresh.solanki@9elements.com> X-Google-Original-From: Naresh Solanki <Naresh.Solanki@9elements.com> To: devicetree@vger.kernel.org, Guenter Roeck <linux@roeck-us.net>, Jean Delvare <jdelvare@suse.com>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Naresh Solanki <naresh.solanki@9elements.com> Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Patrick Rudolph <patrick.rudolph@9elements.com>, Naresh Solanki <Naresh.Solanki@9elements.com> Subject: [PATCH v4 1/3] dt-bindings: hwmon: fan: Add fan binding to schema Date: Thu, 13 Oct 2022 11:48:36 +0200 Message-Id: <20221013094838.1529153-2-Naresh.Solanki@9elements.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221013094838.1529153-1-Naresh.Solanki@9elements.com> References: <20221013094838.1529153-1-Naresh.Solanki@9elements.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746565400088453050?= X-GMAIL-MSGID: =?utf-8?q?1746565400088453050?= |
Series |
Add devicetree support for max6639
|
|
Commit Message
Naresh Solanki
Oct. 13, 2022, 9:48 a.m. UTC
Add common fan properties bindings to a schema.
Bindings for fan controllers can reference the common schema for the
fan
child nodes:
patternProperties:
"^fan@[0-2]":
type: object
$ref: fan-common.yaml#
Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>
---
.../devicetree/bindings/hwmon/fan-common.yaml | 48 +++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 Documentation/devicetree/bindings/hwmon/fan-common.yaml
base-commit: 0cf46a653bdae56683fece68dc50340f7520e6c4
Comments
On Thu, Oct 13, 2022 at 11:48:36AM +0200, Naresh Solanki wrote: > Add common fan properties bindings to a schema. > > Bindings for fan controllers can reference the common schema for the > fan > > child nodes: > > patternProperties: > "^fan@[0-2]": > type: object > $ref: fan-common.yaml# > > Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com> > --- > .../devicetree/bindings/hwmon/fan-common.yaml | 48 +++++++++++++++++++ > 1 file changed, 48 insertions(+) > create mode 100644 Documentation/devicetree/bindings/hwmon/fan-common.yaml > > diff --git a/Documentation/devicetree/bindings/hwmon/fan-common.yaml b/Documentation/devicetree/bindings/hwmon/fan-common.yaml > new file mode 100644 > index 000000000000..224f5013c93f > --- /dev/null > +++ b/Documentation/devicetree/bindings/hwmon/fan-common.yaml > @@ -0,0 +1,48 @@ > +# SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/hwmon/fan-common.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Common fan properties > + > +maintainers: > + - Naresh Solanki <naresh.solanki@9elements.com> > + > +properties: > + max-rpm: > + description: > + Max RPM supported by fan. > + $ref: /schemas/types.yaml#/definitions/uint32 > + > + pulses-per-revolution: > + description: > + The number of pulse from fan sensor per revolution. > + $ref: /schemas/types.yaml#/definitions/uint32 > + > + default-rpm: > + description: > + Target RPM the fan should be configured during driver probe. So if we unload and reload the driver module, it should go back to the default? I think it is really, 'target RPM if not already configured' which could be keep the setting from a register (e.g. what the bootloader set) or perhaps you already have temperature information to use... > + $ref: /schemas/types.yaml#/definitions/uint32 > + pwm-frequency: > + description: > + PWM frequency for fan in Hertz(Hz). > + $ref: /schemas/types.yaml#/definitions/uint32 > + > + pwm-polarity-inverse: > + description: > + Inverse PWM polarity for fan. > + type: boolean As I said before, the PWM binding handles these 2 settings. Use it. Yes, it's a bit of an overkill when the child is the consumer of the parent. Until some 'clever' h/w engineer decides to use one of the PWMs for something else like a backlight. Rob
On 24-10-2022 09:48 pm, Rob Herring wrote: > So if we unload and reload the driver module, it should go back to the > default? This is RPM to be set during probe if desired. > > I think it is really, 'target RPM if not already configured' which could > be keep the setting from a register (e.g. what the bootloader set) or > perhaps you already have temperature information to use... Yes. missed it. It should be target-rpm will correct this. in next version. > >> + $ref: /schemas/types.yaml#/definitions/uint32 >> + pwm-frequency: >> + description: >> + PWM frequency for fan in Hertz(Hz). >> + $ref: /schemas/types.yaml#/definitions/uint32 >> + >> + pwm-polarity-inverse: >> + description: >> + Inverse PWM polarity for fan. >> + type: boolean > As I said before, the PWM binding handles these 2 settings. Use it. Yes, > it's a bit of an overkill when the child is the consumer of the parent. > Until some 'clever' h/w engineer decides to use one of the PWMs for > something else like a backlight. I would like you to consider this as something recommended by fan datasheet for the given fan instance. This info can be used by fan controller driver to configure PWM source/provider accordingly. If you still feel that may not make sense then I'll remove this property. Thanks, Naresh
On Tue, Oct 25, 2022 at 4:16 AM Naresh Solanki <naresh.solanki@9elements.com> wrote: > > > > On 24-10-2022 09:48 pm, Rob Herring wrote: > > So if we unload and reload the driver module, it should go back to the > > default? > This is RPM to be set during probe if desired. > > > > I think it is really, 'target RPM if not already configured' which could > > be keep the setting from a register (e.g. what the bootloader set) or > > perhaps you already have temperature information to use... > Yes. missed it. It should be target-rpm will correct this. in next version. > > > >> + $ref: /schemas/types.yaml#/definitions/uint32 > >> + pwm-frequency: > >> + description: > >> + PWM frequency for fan in Hertz(Hz). > >> + $ref: /schemas/types.yaml#/definitions/uint32 > >> + > >> + pwm-polarity-inverse: > >> + description: > >> + Inverse PWM polarity for fan. > >> + type: boolean > > As I said before, the PWM binding handles these 2 settings. Use it. Yes, > > it's a bit of an overkill when the child is the consumer of the parent. > > Until some 'clever' h/w engineer decides to use one of the PWMs for > > something else like a backlight. > I would like you to consider this as something recommended by fan > datasheet for the given fan instance. > This info can be used by fan controller driver to configure PWM > source/provider accordingly. > > If you still feel that may not make sense then I'll remove this property. You evidently don't understand my comments. My suggestion is to do this: fanc: fan-controller { #pwm-cells = <3>; ... fan { pwms = <&fanc 0 500000 PWM_POLARITY_INVERTED>; ... }; }; 0 is PWM number and 500000 is the PWM frequency. The 3rd cell are per consumer flags. See pwm.txt for more details. Rob
Hi Rob, On 26-10-2022 07:07 pm, Rob Herring wrote: > fanc: fan-controller { > #pwm-cells = <3>; > ... > > fan { > pwms = <&fanc 0 500000 PWM_POLARITY_INVERTED>; > ... > }; > }; > > 0 is PWM number and 500000 is the PWM frequency. The 3rd cell are per > consumer flags. See pwm.txt for more details. Did the implementation & while testing getting the below err: [63.626505] max6639 166-002e: failed to create device link to 166-002e
On Mon, Oct 31, 2022 at 01:35:09PM +0530, Naresh Solanki wrote: > Hi Rob, > > On 26-10-2022 07:07 pm, Rob Herring wrote: > > fanc: fan-controller { > > #pwm-cells = <3>; > > ... > > > > fan { > > pwms = <&fanc 0 500000 PWM_POLARITY_INVERTED>; > > ... > > }; > > }; > > > > 0 is PWM number and 500000 is the PWM frequency. The 3rd cell are per > > consumer flags. See pwm.txt for more details. > > Did the implementation & while testing getting the below err: > [63.626505] max6639 166-002e: failed to create device link to 166-002e Does turning off fw_devlink help (fw_devlink=off)? Rob
Hi Rob,
On 02-11-2022 12:14 am, Rob Herring wrote:
> Does turning off fw_devlink help (fw_devlink=off)?
This didn't bring any difference for the error.
Failing due to same consumer & supplier.
Returning from here:
https://github.com/torvalds/linux/blob/master/drivers/base/core.c#L702
Also this can cause return:
https://github.com/torvalds/linux/blob/master/drivers/base/core.c#L732
Regards,
Naresh
Hi Rob, On 02-11-2022 12:14 am, Rob Herring wrote: > On Mon, Oct 31, 2022 at 01:35:09PM +0530, Naresh Solanki wrote: >> Hi Rob, >> >> On 26-10-2022 07:07 pm, Rob Herring wrote: >>> fanc: fan-controller { >>> #pwm-cells = <3>; >>> ... >>> >>> fan { >>> pwms = <&fanc 0 500000 PWM_POLARITY_INVERTED>; >>> ... >>> }; >>> }; >>> >>> 0 is PWM number and 500000 is the PWM frequency. The 3rd cell are per >>> consumer flags. See pwm.txt for more details. >> >> Did the implementation & while testing getting the below err: >> [63.626505] max6639 166-002e: failed to create device link to 166-002e > > Does turning off fw_devlink help (fw_devlink=off)? Will supplier == consumer, device link creation fails. Not sure what is best approach but not creating device link in this scenario help & for that below additional changes needed in pwm core. diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 4527f09a5c50..afea51c49138 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -730,6 +730,12 @@ static struct device_link *pwm_device_link_add(struct device *dev, return NULL; } + /* + * Do not attempt to create link if consumer itself is supplier. + */ + if (dev == pwm->chip->dev) + return 0; + dl = device_link_add(dev, pwm->chip->dev, DL_FLAG_AUTOREMOVE_CONSUMER); if (!dl) { dev_err(dev, "failed to create device link to %s\n", Regards, Naresh
diff --git a/Documentation/devicetree/bindings/hwmon/fan-common.yaml b/Documentation/devicetree/bindings/hwmon/fan-common.yaml new file mode 100644 index 000000000000..224f5013c93f --- /dev/null +++ b/Documentation/devicetree/bindings/hwmon/fan-common.yaml @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwmon/fan-common.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Common fan properties + +maintainers: + - Naresh Solanki <naresh.solanki@9elements.com> + +properties: + max-rpm: + description: + Max RPM supported by fan. + $ref: /schemas/types.yaml#/definitions/uint32 + + pulses-per-revolution: + description: + The number of pulse from fan sensor per revolution. + $ref: /schemas/types.yaml#/definitions/uint32 + + default-rpm: + description: + Target RPM the fan should be configured during driver probe. + $ref: /schemas/types.yaml#/definitions/uint32 + + pwm-frequency: + description: + PWM frequency for fan in Hertz(Hz). + $ref: /schemas/types.yaml#/definitions/uint32 + + pwm-polarity-inverse: + description: + Inverse PWM polarity for fan. + type: boolean + + label: + description: + Optional fan label + + fan-supply: + description: + Power supply for fan. + +additionalProperties: true + +...