Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1726982
| Path | csiph.com!news.freedyn.net!open-news-network.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Rob Herring <robh@kernel.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] mfd: Add support for TI LMP92001 |
| Date | Tue, 05 Sep 2017 23:00:02 +0200 |
| Message-ID | <umt6W-7Sg-15@gated-at.bofh.it> (permalink) |
| References | <uhaRk-6SH-7@gated-at.bofh.it> <uirGp-7yg-1@gated-at.bofh.it> <umt6W-7Sg-17@gated-at.bofh.it> |
| X-Original-To | Abhisit Sangjan <s.abhisit@gmail.com> |
| Dmarc-Filter | OpenDMARC Filter v1.3.2 mail.kernel.org E6B9321E9A |
| Authentication-Results | mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org |
| Authentication-Results | mail.kernel.org; spf=none smtp.mailfrom=robh@kernel.org |
| X-Gm-Message-State | AHPjjUj2iD2YWSd3s03PyuhExvaPCYpGKv0Es6xvFzQUsWwG6HYA7S73 KPgG1YarjMM/URcPMqATu2OcnKj0Ug== |
| X-Google-SMTP-Source | AOwi7QBRvDatjom2Or6h8+UJ8MPkcN+WpiXUxGfPcob4dPc23ejxp3Ca9yk/Endn/AVh2SaAOFkKgwYjz63/ZeYMg6k= |
| X-Received | by 10.55.42.5 with SMTP id q5mr543573qkh.71.1504644840992; Tue, 05 Sep 2017 13:54:00 -0700 (PDT) |
| MIME-Version | 1.0 |
| X-Gmail-Original-Message-ID | <CAL_JsqK5qoBwb=07ocPyYs-4ZwJPFiAvAYVHu_KWGrzv3nOmAQ@mail.gmail.com> |
| Content-Type | text/plain; charset="UTF-8" |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 190 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Lee Jones <lee.jones@linaro.org>, Jonathan Cameron <Jonathan.Cameron@huawei.com>, Peter Meerwald-Stadler <pmeerw@pmeerw.net>, jmondi <jacopo@jmondi.org>, Linus Walleij <linus.walleij@linaro.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Hartmut Knaack <knaack.h@gmx.de>, Lars-Peter Clausen <lars@metafoo.de>, Fabrice Gasnier <fabrice.gasnier@st.com>, Akinobu Mita <akinobu.mita@gmail.com>, Marek Vasut <marek.vasut+renesas@gmail.com>, Jacopo Mondi <jacopo+renesas@jmondi.org>, Mike Looijmans <mike.looijmans@topic.nl>, Peter Rosin <peda@axentia.se>, Jean-François Dagenais <jeff.dagenais@gmail.com>, "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>, "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>, Mark Rutland <mark.rutland@arm.com>, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>, Lukas Wunner <lukas@wunner.de>, Adriana Reus <adi.reus@gmail.com> |
| X-Original-Date | Tue, 5 Sep 2017 15:53:40 -0500 |
| X-Original-Message-ID | <CAL_JsqK5qoBwb=07ocPyYs-4ZwJPFiAvAYVHu_KWGrzv3nOmAQ@mail.gmail.com> |
| X-Original-References | <1503383171-15515-1-git-send-email-s.abhisit@gmail.com> <20170825183520.doacpiit7mxgsk7v@rob-hp-laptop> <CAMV_pUaXQxcD_nrJ32wi0w=sBseL1ioAhYvDt1O-HTX=0QY0aw@mail.gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1726982 |
Show key headers only | View raw
On Wed, Aug 30, 2017 at 2:58 AM, Abhisit Sangjan <s.abhisit@gmail.com> wrote:
> Hi Rob,
>
> On Sat, Aug 26, 2017 at 1:35 AM, Rob Herring <robh@kernel.org> wrote:
>>
>> On Tue, Aug 22, 2017 at 01:26:11PM +0700, s.abhisit@gmail.com wrote:
>> > From: Abhisit Sangjan <s.abhisit@gmail.com>
>> >
>> > TI LMP92001 Analog System Monitor and Controller
>> >
>> > 8-bit GPIOs.
>> > 12 DACs with 12-bit resolution.
>> > The GPIOs and DACs are shared port function with Cy function pin to
>> > take control the pin suddenly from external hardware.
>> > DAC's referance voltage selectable for Internal/External.
>> >
>> > 16 + 1 ADCs with 12-bit resolution.
>> > Built-in internal Temperature Sensor on channel 17.
>> > Windows Comparator Function is supported on channel 1-3 and 9-11 for
>> > monitoring with interrupt signal (pending to implement for interrupt).
>> > ADC's referance voltage selectable for Internal/External.
>> >
>> > Signed-off-by: Abhisit Sangjan <s.abhisit@gmail.com>
>> > ---
>> > Documentation/ABI/testing/sysfs-bus-iio-lmp920001 | 92 ++++
>> > .../devicetree/bindings/gpio/gpio-lmp92001.txt | 22 +
>> > .../bindings/iio/adc/ti-lmp92001-adc.txt | 21 +
>> > .../bindings/iio/dac/ti-lmp92001-dac.txt | 35 ++
>>
>>
>> > diff --git a/Documentation/devicetree/bindings/gpio/gpio-lmp92001.txt
>> > b/Documentation/devicetree/bindings/gpio/gpio-lmp92001.txt
>> > new file mode 100644
>> > index 0000000..c68784e
>> > --- /dev/null
>> > +++ b/Documentation/devicetree/bindings/gpio/gpio-lmp92001.txt
>> > @@ -0,0 +1,22 @@
>> > +* Texas Instruments' LMP92001 GPIOs
>> > +
>> > +Required properties:
>> > + - compatible: Must be set to "ti,lmp92001-gpio".
>> > + - reg: i2c chip address for the device.
>>
>> No, you show this in the parent which needs to be described in
>> bindings/mtd/...
>>
>> You could have reg here too if all the registers for each sub-block are
>> in a well defined range.
>
>
> I am sorry, I do not understand.
>
>>
>>
>> > + - gpio-controller: Marks the device node as a gpio controller.
>> > + - #gpio-cells : Should be two. The first cell is the pin number and
>> > the
>> > + second cell is used to specify the gpio polarity:
>> > + 0 = Active high
>> > + 1 = Active low
>> > +
>> > +Example:
>> > +lmp92001@20 {
>> > + compatible = "ti,lmp92001";
>> > + reg = <0x20>;
>> > +
>> > + lmp92001_gpio: lmp92001-gpio {
>>
>> gpio-controller {
>
>
> I am sorry, I do not understand. I took this idea from some things like
Read the section of the DT specification on generic node names.
And actually, it should be just "gpio". I never can remember offhand.
> Documentation/devicetree/bindings/gpio/gpio-lp3943.txt
> ------------------------------------------------------------------------------------------------------------------------------
>
> TI/National Semiconductor LP3943 GPIO controller
>
> Required properties:
> - compatible: "ti,lp3943-gpio"
> - gpio-controller: Marks the device node as a GPIO controller.
> - #gpio-cells: Should be 2. See gpio.txt in this directory for a
> description of the cells format.
>
> Example:
> Simple LED controls with LP3943 GPIO controller
>
> &i2c4 {
> lp3943@60 {
> compatible = "ti,lp3943";
> reg = <0x60>;
>
> gpioex: gpio {
As you see here, the node name for the gpio block is just "gpio".
> compatible = "ti,lp3943-gpio";
> gpio-controller;
> #gpio-cells = <2>;
> };
> };
> };
>
> leds {
> compatible = "gpio-leds";
> indicator1 {
> label = "indi1";
> gpios = <&gpioex 9 GPIO_ACTIVE_LOW>;
> };
>
> indicator2 {
> label = "indi2";
> gpios = <&gpioex 10 GPIO_ACTIVE_LOW>;
> default-state = "off";
> };
> };
>
>>
>>
>> > + compatible = "ti,lmp92001-gpio";
>> > + gpio-controller;
>> > + #gpio-cells = <2>;
>> > + };
>> > +};
>> > diff --git
>> > a/Documentation/devicetree/bindings/iio/adc/ti-lmp92001-adc.txt
>> > b/Documentation/devicetree/bindings/iio/adc/ti-lmp92001-adc.txt
>> > new file mode 100644
>> > index 0000000..34d7809
>> > --- /dev/null
>> > +++ b/Documentation/devicetree/bindings/iio/adc/ti-lmp92001-adc.txt
>> > @@ -0,0 +1,21 @@
>> > +* Texas Instruments' LMP92001 ADCs
>> > +
>> > +Required properties:
>> > + - compatible: Must be set to "ti,lmp92001-adc".
>> > + - reg: i2c chip address for the device.
>>
>> Same comment here.
>>
>> > + - ti,lmp92001-adc-mode: adc operation, either continuous or
>> > single-shot.
>>
>> No standard property for this?
>
>
> I am removed this, regrading to Lukas Wunner (cc) and Adriana Reus discussed
> (cc)
> "it would be fine also as a sysfs property instead".
Depends on who would want to change this. If an end-user would at
run-time, then yes sysfs makes sense. If the h/w design dictates what
mode makes sense, then DT is fine.
>> > +Required properties:
>> > + - compatible: Must be set to "ti,lmp92001-dac".
>> > + - reg: i2c chip address for the device.
>> > + - ti,lmp92001-dac-hiz: hi-impedance control,
>> > + 1 = Forces all OUT[1:12] outputs to hi-z, 0 = normal
>>
>> Just make this a boolean (i.e. no value).
>
>
> Hi-Z will be or to cdac and it is unsigned int, u8 would be safe and work
> fine for this.
>
> lmp92001_dac_probe()
> ...
> u8 gang = 0, outx = 0, hiz = 0;
> unsigned int cdac = 0;
> ...
> of_property_read_u8(np, "ti,lmp92001-dac-hiz", &hiz);
> cdac = hiz;
Make it bool and just do this:
unsigned int cdac = of_property_read_bool(...);
or:
unsigned int cdac = of_property_read_bool(...) > 0 ? 1 : 0;
The DT property and kernel types don't have to match types.
Rob
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH] mfd: Add support for TI LMP92001 Rob Herring <robh@kernel.org> - 2017-08-25 20:40 +0200 Re: [PATCH] mfd: Add support for TI LMP92001 Rob Herring <robh@kernel.org> - 2017-09-05 23:00 +0200
csiph-web