Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: gpio: max22190: Add MAX22190 octal input with diagnostics #71141

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bogdanovs
Copy link
Contributor

Add max22190 gpio driver with input functionality, since device support only input with output.

Implemented diagnostic funcionality for all 8 channels which include various check to over/under voltage and wire break. Filtering configuration is done from devicetree on per channel bases and is configured on chip start.

In case of some fault condition occure FAULT pin drive LOW which prop to FAULT registers to be read. Data is stored in data structure for furter analizes and ERR message is prited in console.

@zephyrbot zephyrbot added area: Devicetree Binding PR modifies or adds a Device Tree binding area: GPIO platform: ADI Analog Devices, Inc. labels Apr 5, 2024
@bogdanovs bogdanovs force-pushed the adi-max22190-gpio branch 2 times, most recently from 5ac5f2c to 823f4da Compare April 8, 2024 11:07
@zephyrbot zephyrbot requested a review from decsny April 22, 2024 10:09
@bogdanovs bogdanovs force-pushed the adi-max22190-gpio branch 2 times, most recently from d903a24 to 1aa75d3 Compare April 22, 2024 11:58
decsny
decsny previously requested changes Apr 22, 2024
type: phandle-array
max22190-mode:
type: int
default: 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default value requires justification in description (same for other properties)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I add clarification for all. Could you take a look if it is enough ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for the mode you should just remove the default value, it needs to be specified in the board DT, it is hardwired signals on the board after all, needs to be described

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I specified default value because this was mode set on the devkit it self, but it make sens to have it in DT.

type: phandle-array
max22190-mode:
type: int
default: 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for the mode you should just remove the default value, it needs to be specified in the board DT, it is hardwired signals on the board after all, needs to be described

description: |
Wire break functionality is enabled by default on all channels.
WBE bit in all Filter registers stand for wire break enable on each
channel, so to enable WB functionality set 1.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should clarify that this default value is not the default value of the hardware

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better all filter-wbes , filter-fbps and filter-delays to have for default values from datasheet.
This mean:

  • wire break - 0 disable
  • fbps - 1 bypass
  • delays - 50

Value which was set is the one which is in use in case WBE is 1. In that case delays is 20000.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, but now the description seems wrong, it still says set 1? is it intentional, it seems unclear at best

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe my language here is not quiet clear. I want to state that by default every channel is with disabled Wire Break functionality - WBEx bit = 0.
To enable specific channel Wire Break functionality WBEx bit = 1.
Example for channel first 4 channels enabled WB and last 4 disabled WB
[ 1, 1, 1, 1, 0, 0, 0, 0]

If you have some suggestions how to make it clearer please share it.

type: array
default: [1, 1, 1, 1, 1, 1, 1, 1]
description: |
By default all channels are set to bypass mode from documentation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

word this more like "The default value corresponds to the default value of the hardware"

type: array
default: [20000, 20000, 20000, 20000, 20000, 20000, 20000, 20000]
description: |
Default value in documentation is 20ms which corespond to 200000us.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar comment as above

Copy link
Member

@MaureenHelm MaureenHelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add to drivers/build_all/gpio/app.overlay

drivers/gpio/Kconfig.max22190 Show resolved Hide resolved
drivers/gpio/gpio_max22190.c Show resolved Hide resolved
drivers/gpio/gpio_max22190.c Outdated Show resolved Hide resolved
drivers/gpio/gpio_max22190.c Outdated Show resolved Hide resolved
drivers/gpio/gpio_max22190.c Outdated Show resolved Hide resolved
drivers/gpio/gpio_max22190.c Outdated Show resolved Hide resolved
dts/bindings/gpio/adi,max22190-gpio.yaml Outdated Show resolved Hide resolved
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Jul 29, 2024
drivers/gpio/Kconfig Outdated Show resolved Hide resolved
drivers/gpio/gpio_max22190.c Outdated Show resolved Hide resolved
drivers/gpio/gpio_max22190.c Outdated Show resolved Hide resolved
drivers/gpio/gpio_max22190.c Show resolved Hide resolved
drivers/gpio/gpio_max22190.c Show resolved Hide resolved
drivers/gpio/gpio_max22190.c Outdated Show resolved Hide resolved
drivers/gpio/gpio_max22190.c Outdated Show resolved Hide resolved
dts/bindings/gpio/adi,max22190-gpio.yaml Outdated Show resolved Hide resolved
dts/bindings/gpio/adi,max22190-gpio.yaml Outdated Show resolved Hide resolved
dts/bindings/gpio/adi,max22190-gpio.yaml Outdated Show resolved Hide resolved
@bogdanovs
Copy link
Contributor Author

Thanks @MaureenHelm ,typos are fixed and branch is rebased on latest main

@MaureenHelm MaureenHelm added this to the v4.0.0 milestone Sep 11, 2024
MaureenHelm
MaureenHelm previously approved these changes Sep 23, 2024
Add max22190 gpio driver with input functionality, since device
support only input without output.

Implemented diagnostic funcionality for all 8 channels
which include various check to over/under voltage and wire break.
Filtering configuration is done from devicetree on per channel
bases and is configured on chip start.

In case of some fault condition occure FAULT pin drive LOW which
prop to FAULT registers to be read. Data is stored in data structure
for furter analizes and ERR message is prited in console.

Signed-off-by: Stoyan Bogdanov <sbogdanov@baylibre.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree Binding PR modifies or adds a Device Tree binding area: GPIO platform: ADI Analog Devices, Inc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants