-
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
drivers: power: lt3074: add driver for LT3074 #2408
base: main
Are you sure you want to change the base?
Conversation
The LT3074 is a low voltage, ultralow noise, and ultrafast transient response linear regulator with a PMBus serial interface. The device supplies up to 3A with a typical dropout voltage of 45mV. Signed-off-by: Cedric Encarnacion <[email protected]>
43aab10
to
6a215c2
Compare
This adds tinyIIO support for the LT3074 device. This exposes output voltage and current, temperature, and bias voltage channels. Signed-off-by: Cedric Encarnacion <[email protected]>
Add initial project files for both basic and IIO examples for LT3074. Signed-off-by: Cedric Encarnacion <[email protected]>
Add README.rst documentation file for LT3074 alongside other documentation related files. Signed-off-by: Cedric Encarnacion <[email protected]>
Add README.rst documentation file for project alongside other documentation related files. Signed-off-by: Cedric Encarnacion <[email protected]>
6a215c2
to
2a25709
Compare
v2:
|
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.
} | ||
|
||
mant = no_os_clamp(NO_OS_DIV_ROUND_CLOSEST_ULL(data, MILLI), | ||
0, 0x3FF); |
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_OS_GENMASK()
if (!iio_desc) | ||
return -ENODEV; | ||
|
||
no_os_free(iio_desc->iio_dev->channels); |
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 lt3074_channels
array is statically allocated.
vals[0] = (int32_t)(word / MILLI); | ||
vals[1] = (int32_t)((word * MILLI) % MICRO); |
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.
These are implicit casts, so they don't have any effect.
case LT3074_IOUT_OC_FAULT_RESPONSE: | ||
case LT3074_REVISION: | ||
case LT3074_MFR_DEFAULT_CONFIG: | ||
ret = lt3074_read_byte(lt3074, (uint8_t)reg, &byte); |
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.
this will definitely work but i expect this kind of register level access size to be handled in the device driver so at the lower level, not 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.
this is how we prefer to do it:
no-OS/drivers/adc/ad9250/ad9250.h
Line 54 in 2d0e5d5
#define AD9250_R2B (2 << 8) |
each register has size information coded into the register "address" macro so the lowest level spi/i2c/whatever read/write, knows how many bytes to read/write
static struct iio_attribute lt3074_global_attrs[] = { | ||
{ | ||
.name = "vout_margin_low", | ||
.show = lt3074_iio_read_vout_margin, |
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.
please use a single function for all of these if they are similar enough to avoid code duplication
@@ -0,0 +1,9 @@ | |||
# Select the example you want to enable by choosing y for enabling and n for disabling | |||
BASIC_EXAMPLE = n |
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.
and i see you didn't yet update the project structure, please update it as per my other comment
Pull Request Description
The LT3074 is a low voltage, ultralow noise, and ultrafast transient
response linear regulator with a PMBus serial interface. The device
supplies up to 3A with a typical dropout voltage of 45mV.
This pull request adds the no-OS and IIO driver, as well as examples
and documentations, to quickly evaluate the LT3074.
PR Type
PR Checklist