mbox series

[v4,0/2] RTQ6056: Add compatible for the same chip family

Message ID cover.1704357933.git.cy_huang@richtek.com
Headers show
Series RTQ6056: Add compatible for the same chip family | expand

Message

ChiYuan Huang Jan. 4, 2024, 9:03 a.m. UTC
From: ChiYuan Huang <cy_huang@richtek.com>

RTQ6053 and RTQ6059 are the same RTQ6056 family.
The differences are listed below
- RTQ6053
  Only change chip package type
- RTQ6059
  1. Enlarge the shunt voltage sensing range
  2. Shrink the pinout for VBUS sense pin
  3. Due to 1, the scale value is also changed

Since v4:
- Remove the unused chip type enum
- Directly return in switch case of read_channel function
- Refine in write_raw switch case for IIO_CHAN_INFO_SAMP_FREQ
  If sample frequency is fixed, return invalid and break switch case
- Use devdata->num_channels to replace the predefined constant
- Change the rtq6059 difference part for the control bitfield name from
  the general 'F_xxx' to 'F_RTQ6059_xxx'
- Fix rtq6059 average sample variable store problem in 'set_average' function

Since v3:
- Add Reviewed-by tag in binding document patch
- Resotre the enum for control field.
- Put all the predefined datas/callbacks in dev_data.
- Remove the unused 'rtq6059_info'.
- Change 'default_conv_time' to 'default_conv_time_us'.
- Move the comment for default config above the dev_data setting line.

Since v2:
- Refine the description of 'compatible' property

ChiYuan Huang (2):
  dt-bindings: iio: adc: rtq6056: add support for the whole RTQ6056
    family
  iio: adc: rtq6056: Add support for the whole RTQ6056 family

 .../bindings/iio/adc/richtek,rtq6056.yaml     |   9 +-
 drivers/iio/adc/rtq6056.c                     | 275 ++++++++++++++++--
 2 files changed, 263 insertions(+), 21 deletions(-)


base-commit: 610a9b8f49fbcf1100716370d3b5f6f884a2835a

Comments

Jonathan Cameron Jan. 7, 2024, 4:19 p.m. UTC | #1
On Thu, 4 Jan 2024 17:03:31 +0800
<cy_huang@richtek.com> wrote:

> From: ChiYuan Huang <cy_huang@richtek.com>
> 
> RTQ6053 and RTQ6059 are the same series of RTQ6056.
> 
> The respective differences with RTQ6056 are listed below
> RTQ6053
> - chip package type
> 
> RTQ6059
> - Reduce the pinout for vbus sensing pin
> - Some internal ADC scaling change
> 
> Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Hi. 

One last follow on comment based on v4 changes to the enum naming.
I think you missed one place they should be updated - the reg_field
definitions.

Thanks,

Jonathan


>  
> +/*
> + * The enum is to present the 0x00 CONFIG RG bitfield for the 16bit RG value
> + * field value order from LSB to MSB
> + * RTQ6053/6 is OPMODE->VSHUNTCT->VBUSCT->AVG->RESET
> + * RTQ6059 is OPMODE->SADC->BADC->PGA->RESET
> + */
>  enum {
>  	F_OPMODE = 0,
>  	F_VSHUNTCT,
> +	F_RTQ6059_SADC = F_VSHUNTCT,
>  	F_VBUSCT,
> +	F_RTQ6059_BADC = F_VBUSCT,
>  	F_AVG,
> +	F_RTQ6059_PGA = F_AVG,
>  	F_RESET,
>  	F_MAX_FIELDS
>  };

>  
> +static const struct reg_field rtq6059_reg_fields[F_MAX_FIELDS] = {
> +	[F_OPMODE] = REG_FIELD(RTQ6056_REG_CONFIG, 0, 2),
> +	[F_VSHUNTCT] = REG_FIELD(RTQ6056_REG_CONFIG, 3, 6),
> +	[F_VBUSCT] = REG_FIELD(RTQ6056_REG_CONFIG, 7, 10),
> +	[F_AVG]	= REG_FIELD(RTQ6056_REG_CONFIG, 11, 12),
> +	[F_RESET] = REG_FIELD(RTQ6056_REG_CONFIG, 15, 15),

Given these are the rtq6059 regfield definitions should they not be
using the new enum names?

> +};
> +