-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
add support for LTC7841 #2397
base: main
Are you sure you want to change the base?
add support for LTC7841 #2397
Conversation
/AzurePipelines run |
Azure Pipelines successfully started running 2 pipeline(s). |
fcc8863
to
5b005cb
Compare
V2:
|
/AzurePipelines run |
Azure Pipelines successfully started running 2 pipeline(s). |
c57b81e
to
16af219
Compare
V3:
|
/AzurePipelines run |
Azure Pipelines successfully started running 2 pipeline(s). |
drivers/power/ltc7841/ltc7841.c
Outdated
uint8_t read_length; | ||
uint8_t write_length = 1; | ||
uint8_t size = get_register_size(cmd); | ||
uint8_t write_buffer[write_length]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't need to be an array
drivers/power/ltc7841/ltc7841.c
Outdated
if (ret) | ||
return ret; | ||
// read part of write_read, 1 at the end for stop bit sending | ||
ret = no_os_i2c_read(desc->comm_desc, g_i2c0_read_buffer, read_length, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should store the register value in data
.
drivers/power/ltc7841/iio_ltc7841.c
Outdated
static struct iio_attribute ltc7841_chan_attrs[] = { | ||
{ | ||
.name = "raw", | ||
.show = ltc7841_iio_read_raw | ||
}, | ||
END_ATTRIBUTES_ARRAY | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the scale of every channel equal to 1? Otherwise, you also need the scale attribute here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scale of every channel is the same at 10mV per bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on my next commit, I'll add as you stated below a scale attribute for the channel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When implementing review suggestions, you don't need to create a new commit (unless you add new functionality, which should have its own commit). Just modify the current one and push the changes again. After that, you should add a changelog comment in this PR stating what you did since the last push.
drivers/power/ltc7841/iio_ltc7841.c
Outdated
} | ||
case LTC7841_IIO_IIN_CHAN: | ||
ret = ltc7841_reg_read(ltc7841, (uint8_t)LTC7841_READ_IIN, read_value); | ||
if (0 == ret) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use inverse logic:
if (ret)
break;
drivers/power/ltc7841/ltc7841.h
Outdated
#define PEC_SIZE 0x100 | ||
#define BYTE_LENGTH 1 | ||
#define WORD_LENGTH 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the LTC7841_
prefix. Otherwise, generic names like these could create conflicts with other macros.
.max_speed_hz = LTC7841_I2C_CLK_SPEED, | ||
.slave_address = LTC7841_I2C_ADDR, | ||
.platform_ops = &max_i2c_ops, | ||
.extra = (void *)<c7841_i2c_extra, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to cast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unresolving this conversation since it's not resolved yet.
298e71f
to
6423294
Compare
V4:
|
/AzurePipelines run |
Azure Pipelines successfully started running 2 pipeline(s). |
34f8560
to
3674149
Compare
V5:
|
/AzurePipelines run |
Azure Pipelines successfully started running 2 pipeline(s). |
You have a typo in part number inside the README.rst. You can leave as it is for now, I'm currently going through the code and submit the comments today. |
b0d0011
to
228b995
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 2 pipeline(s). |
.max_speed_hz = LTC7841_I2C_CLK_SPEED, | ||
.slave_address = LTC7841_I2C_ADDR, | ||
.platform_ops = &max_i2c_ops, | ||
.extra = (void *)<c7841_i2c_extra, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unresolving this conversation since it's not resolved yet.
6646390
to
7d0d840
Compare
V9
|
/AzurePipelines run |
Azure Pipelines successfully started running 2 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The EXAMPLE= has been implemented in the previous comments so I just added the comments related to the other changes needed for the recently merged examples infra.
Addition minor changes on the rsense placement.
1e50ae5
to
34a77d8
Compare
V10
|
/AzurePipelines run |
Azure Pipelines successfully started running 2 pipeline(s). |
Add initial header and source files for LTC7841 driver Signed-off-by: Marvin Neil Cabuenas <MarvinNeil.Cabuenas@analog.com>
196fcc0
to
dc95dcb
Compare
Add initial header and source file for LTC7841 IIO driver. Signed-off-by: Marvin Neil Cabuenas <MarvinNeil.Cabuenas@analog.com>
Add README.rst documentation file for LTC7841 alongside other documentation related files. Signed-off-by: Marvin Neil Cabuenas <MarvinNeil.Cabuenas@analog.com>
V11
|
045ffa0
to
6b453ea
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 2 pipeline(s). |
Add initial project files for both basic and IIO examples for LTC7841. Signed-off-by: Marvin Neil Cabuenas <MarvinNeil.Cabuenas@analog.com>
dc99896
to
ec9a451
Compare
Add README.rst documentation file for project alongside other documentation related files. Signed-off-by: Marvin Neil Cabuenas <MarvinNeil.Cabuenas@analog.com>
V12
|
/AzurePipelines run |
Azure Pipelines successfully started running 2 pipeline(s). |
Pull Request Description
Please replace this with a detailed description and motivation of the changes.
You can tick the checkboxes below with an 'x' between square brackets or just check them after publishing the PR.
If this PR contains a breaking change, list dependent PRs and try to push all related PRs at the same time.
PR Type
PR Checklist