mbox series

[0/2] MediaTek Helio X10 MT6795 - MT6331/6332 PMIC MFD integration

Message ID 20220520124617.228808-1-angelogioacchino.delregno@collabora.com
Headers show
Series MediaTek Helio X10 MT6795 - MT6331/6332 PMIC MFD integration | expand

Message

AngeloGioacchino Del Regno May 20, 2022, 12:46 p.m. UTC
In an effort to give some love to the apparently forgotten MT6795 SoC,
I am upstreaming more components that are necessary to support platforms
powered by this one apart from a simple boot to serial console.

This series adds the necessary headers and support for the MT6331 with
MT6332 companion PMIC in the mt6397 MFD driver, along with some basic
devices.

Adding support to each driver in each subsystem will be done in different
patch series as to avoid spamming uninteresting patches to maintainers.

This series depends on another series [1] named
"MediaTek Helio X10 MT6795 - MT6331/6332 PMIC Wrapper"

Tested on a MT6795 Sony Xperia M5 (codename "Holly") smartphone.


[1]: https://lore.kernel.org/lkml/20220520124039.228314-1-angelogioacchino.delregno@collabora.com/T/#t

AngeloGioacchino Del Regno (2):
  dt-bindings: mfd: mt6397: Add compatibles for MT6331 RTC and keys
  mfd: mt6397: Add basic support for MT6331+MT6332 PMIC

 .../devicetree/bindings/mfd/mt6397.txt        |   2 +
 drivers/mfd/mt6397-core.c                     |  47 ++
 drivers/mfd/mt6397-irq.c                      |   9 +-
 include/linux/mfd/mt6331/core.h               |  53 ++
 include/linux/mfd/mt6331/registers.h          | 584 ++++++++++++++++
 include/linux/mfd/mt6332/core.h               |  53 ++
 include/linux/mfd/mt6332/registers.h          | 642 ++++++++++++++++++
 include/linux/mfd/mt6397/core.h               |   2 +
 8 files changed, 1391 insertions(+), 1 deletion(-)
 create mode 100644 include/linux/mfd/mt6331/core.h
 create mode 100644 include/linux/mfd/mt6331/registers.h
 create mode 100644 include/linux/mfd/mt6332/core.h
 create mode 100644 include/linux/mfd/mt6332/registers.h

Comments

AngeloGioacchino Del Regno June 1, 2022, 11:03 a.m. UTC | #1
Il 20/05/22 14:46, AngeloGioacchino Del Regno ha scritto:
> In an effort to give some love to the apparently forgotten MT6795 SoC,
> I am upstreaming more components that are necessary to support platforms
> powered by this one apart from a simple boot to serial console.
> 
> This series adds the necessary headers and support for the MT6331 with
> MT6332 companion PMIC in the mt6397 MFD driver, along with some basic
> devices.
> 
> Adding support to each driver in each subsystem will be done in different
> patch series as to avoid spamming uninteresting patches to maintainers.
> 
> This series depends on another series [1] named
> "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC Wrapper"
> 
> Tested on a MT6795 Sony Xperia M5 (codename "Holly") smartphone.
> 
> 

Gentle ping to not let this big effort (with drivers depending on this one) get
forgotten and wasted.

P.S.: Mark wanted to merge the regulator drivers for MT6331/6332 from another
       series that depends on this one (but compile errors due to said dependency)

P.P.S.: Lee: Reporting what Mark said (Full context in [2]):
"I'll need a pull request for the MFD bits I guess, please make sure Lee knows 
that's going to be needed."

[2]: 
https://patchwork.kernel.org/project/linux-mediatek/patch/20220523154709.118663-5-angelogioacchino.delregno@collabora.com/#24876722

Thank you,
Angelo

> [1]: https://lore.kernel.org/lkml/20220520124039.228314-1-angelogioacchino.delregno@collabora.com/T/#t
> 
> AngeloGioacchino Del Regno (2):
>    dt-bindings: mfd: mt6397: Add compatibles for MT6331 RTC and keys
>    mfd: mt6397: Add basic support for MT6331+MT6332 PMIC
> 
>   .../devicetree/bindings/mfd/mt6397.txt        |   2 +
>   drivers/mfd/mt6397-core.c                     |  47 ++
>   drivers/mfd/mt6397-irq.c                      |   9 +-
>   include/linux/mfd/mt6331/core.h               |  53 ++
>   include/linux/mfd/mt6331/registers.h          | 584 ++++++++++++++++
>   include/linux/mfd/mt6332/core.h               |  53 ++
>   include/linux/mfd/mt6332/registers.h          | 642 ++++++++++++++++++
>   include/linux/mfd/mt6397/core.h               |   2 +
>   8 files changed, 1391 insertions(+), 1 deletion(-)
>   create mode 100644 include/linux/mfd/mt6331/core.h
>   create mode 100644 include/linux/mfd/mt6331/registers.h
>   create mode 100644 include/linux/mfd/mt6332/core.h
>   create mode 100644 include/linux/mfd/mt6332/registers.h
>
Krzysztof Kozlowski June 1, 2022, 11:07 a.m. UTC | #2
On 01/06/2022 13:03, AngeloGioacchino Del Regno wrote:
> Il 20/05/22 14:46, AngeloGioacchino Del Regno ha scritto:
>> In an effort to give some love to the apparently forgotten MT6795 SoC,
>> I am upstreaming more components that are necessary to support platforms
>> powered by this one apart from a simple boot to serial console.
>>
>> This series adds the necessary headers and support for the MT6331 with
>> MT6332 companion PMIC in the mt6397 MFD driver, along with some basic
>> devices.
>>
>> Adding support to each driver in each subsystem will be done in different
>> patch series as to avoid spamming uninteresting patches to maintainers.
>>
>> This series depends on another series [1] named
>> "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC Wrapper"
>>
>> Tested on a MT6795 Sony Xperia M5 (codename "Holly") smartphone.
>>
>>
> 
> Gentle ping to not let this big effort (with drivers depending on this one) get
> forgotten and wasted.

Yeah, but it was not even 2 weeks since posting and we are in merge
window. Please resend after the merge window.

> 
> P.S.: Mark wanted to merge the regulator drivers for MT6331/6332 from another
>        series that depends on this one (but compile errors due to said dependency)
> 
> P.P.S.: Lee: Reporting what Mark said (Full context in [2]):
> "I'll need a pull request for the MFD bits I guess, please make sure Lee knows 
> that's going to be needed."
> 

Best regards,
Krzysztof
AngeloGioacchino Del Regno June 1, 2022, 11:08 a.m. UTC | #3
Il 01/06/22 13:07, Krzysztof Kozlowski ha scritto:
> On 01/06/2022 13:03, AngeloGioacchino Del Regno wrote:
>> Il 20/05/22 14:46, AngeloGioacchino Del Regno ha scritto:
>>> In an effort to give some love to the apparently forgotten MT6795 SoC,
>>> I am upstreaming more components that are necessary to support platforms
>>> powered by this one apart from a simple boot to serial console.
>>>
>>> This series adds the necessary headers and support for the MT6331 with
>>> MT6332 companion PMIC in the mt6397 MFD driver, along with some basic
>>> devices.
>>>
>>> Adding support to each driver in each subsystem will be done in different
>>> patch series as to avoid spamming uninteresting patches to maintainers.
>>>
>>> This series depends on another series [1] named
>>> "MediaTek Helio X10 MT6795 - MT6331/6332 PMIC Wrapper"
>>>
>>> Tested on a MT6795 Sony Xperia M5 (codename "Holly") smartphone.
>>>
>>>
>>
>> Gentle ping to not let this big effort (with drivers depending on this one) get
>> forgotten and wasted.
> 
> Yeah, but it was not even 2 weeks since posting and we are in merge
> window. Please resend after the merge window.
> 

Understood!

Cheers,
Angelo

>>
>> P.S.: Mark wanted to merge the regulator drivers for MT6331/6332 from another
>>         series that depends on this one (but compile errors due to said dependency)
>>
>> P.P.S.: Lee: Reporting what Mark said (Full context in [2]):
>> "I'll need a pull request for the MFD bits I guess, please make sure Lee knows
>> that's going to be needed."
>>
> 
> Best regards,
> Krzysztof
Lee Jones June 15, 2022, 9:52 p.m. UTC | #4
On Fri, 20 May 2022, AngeloGioacchino Del Regno wrote:

> Add support for the MT6331 PMIC with MT6332 Companion PMIC, found
> in MT6795 Helio X10 smartphone platforms.
> 
> This combo has support for multiple devices but, for a start,
> only the following have been implemented:
> - Regulators (two instances, one in MT6331, one in MT6332)
> - RTC (MT6331)
> - Keys (MT6331)
> - Interrupts (MT6331 also dispatches MT6332's interrupts)
> 
> There's more to be implemented, especially for MT6332, which
> will come at a later stage.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/mfd/mt6397-core.c            |  47 ++
>  drivers/mfd/mt6397-irq.c             |   9 +-
>  include/linux/mfd/mt6331/core.h      |  53 +++
>  include/linux/mfd/mt6331/registers.h | 584 ++++++++++++++++++++++++
>  include/linux/mfd/mt6332/core.h      |  53 +++
>  include/linux/mfd/mt6332/registers.h | 642 +++++++++++++++++++++++++++
>  include/linux/mfd/mt6397/core.h      |   2 +
>  7 files changed, 1389 insertions(+), 1 deletion(-)
>  create mode 100644 include/linux/mfd/mt6331/core.h
>  create mode 100644 include/linux/mfd/mt6331/registers.h
>  create mode 100644 include/linux/mfd/mt6332/core.h
>  create mode 100644 include/linux/mfd/mt6332/registers.h

[...]

> +#endif /* __MFD_MT6332_REGISTERS_H__ */
> diff --git a/include/linux/mfd/mt6397/core.h b/include/linux/mfd/mt6397/core.h
> index 1cf78726503b..4d2b80319db3 100644
> --- a/include/linux/mfd/mt6397/core.h
> +++ b/include/linux/mfd/mt6397/core.h
> @@ -12,6 +12,8 @@
>  
>  enum chip_id {
>  	MT6323_CHIP_ID = 0x23,

> +	MT6331_CHIP_ID = 0x20,
> +	MT6332_CHIP_ID = 0x20,

Are these meant to be the same?

>  	MT6358_CHIP_ID = 0x58,
>  	MT6359_CHIP_ID = 0x59,
>  	MT6366_CHIP_ID = 0x66,
AngeloGioacchino Del Regno June 16, 2022, 8:43 a.m. UTC | #5
Il 15/06/22 23:52, Lee Jones ha scritto:
> On Fri, 20 May 2022, AngeloGioacchino Del Regno wrote:
> 
>> Add support for the MT6331 PMIC with MT6332 Companion PMIC, found
>> in MT6795 Helio X10 smartphone platforms.
>>
>> This combo has support for multiple devices but, for a start,
>> only the following have been implemented:
>> - Regulators (two instances, one in MT6331, one in MT6332)
>> - RTC (MT6331)
>> - Keys (MT6331)
>> - Interrupts (MT6331 also dispatches MT6332's interrupts)
>>
>> There's more to be implemented, especially for MT6332, which
>> will come at a later stage.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   drivers/mfd/mt6397-core.c            |  47 ++
>>   drivers/mfd/mt6397-irq.c             |   9 +-
>>   include/linux/mfd/mt6331/core.h      |  53 +++
>>   include/linux/mfd/mt6331/registers.h | 584 ++++++++++++++++++++++++
>>   include/linux/mfd/mt6332/core.h      |  53 +++
>>   include/linux/mfd/mt6332/registers.h | 642 +++++++++++++++++++++++++++
>>   include/linux/mfd/mt6397/core.h      |   2 +
>>   7 files changed, 1389 insertions(+), 1 deletion(-)
>>   create mode 100644 include/linux/mfd/mt6331/core.h
>>   create mode 100644 include/linux/mfd/mt6331/registers.h
>>   create mode 100644 include/linux/mfd/mt6332/core.h
>>   create mode 100644 include/linux/mfd/mt6332/registers.h
> 
> [...]
> 
>> +#endif /* __MFD_MT6332_REGISTERS_H__ */
>> diff --git a/include/linux/mfd/mt6397/core.h b/include/linux/mfd/mt6397/core.h
>> index 1cf78726503b..4d2b80319db3 100644
>> --- a/include/linux/mfd/mt6397/core.h
>> +++ b/include/linux/mfd/mt6397/core.h
>> @@ -12,6 +12,8 @@
>>   
>>   enum chip_id {
>>   	MT6323_CHIP_ID = 0x23,
> 
>> +	MT6331_CHIP_ID = 0x20,
>> +	MT6332_CHIP_ID = 0x20,
> 
> Are these meant to be the same?
> 

Yes, because this list is referring to the first 8 bits of the CID register,
which is the same for both 6331 and 6332, this is because these two chips are
meant to be used together (at least from my understanding), one as main PMIC
and one as a companion PMIC.

The difference belongs in the higher 8 bits, but there's no support for this
check in the mt6397 driver (yet), and I chose not to implement that to not
complicate this work *at least for now*, as I have no idea about what the
already implemented PMICs read in the high 8 bits (I can check only two of
them, but not the others as I don't have the hardware).

Besides, checking the lower 8 bits is important only because we get knowledge
of the chip *revision* and not the actual model (for which, we use devicetree
anyway).

Regards,
Angelo
Lee Jones June 16, 2022, 6:40 p.m. UTC | #6
On Fri, 20 May 2022, AngeloGioacchino Del Regno wrote:
65;6800;1c
> Add support for the MT6331 PMIC with MT6332 Companion PMIC, found
> in MT6795 Helio X10 smartphone platforms.
> 
> This combo has support for multiple devices but, for a start,
> only the following have been implemented:
> - Regulators (two instances, one in MT6331, one in MT6332)
> - RTC (MT6331)
> - Keys (MT6331)
> - Interrupts (MT6331 also dispatches MT6332's interrupts)
> 
> There's more to be implemented, especially for MT6332, which
> will come at a later stage.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/mfd/mt6397-core.c            |  47 ++
>  drivers/mfd/mt6397-irq.c             |   9 +-
>  include/linux/mfd/mt6331/core.h      |  53 +++
>  include/linux/mfd/mt6331/registers.h | 584 ++++++++++++++++++++++++
>  include/linux/mfd/mt6332/core.h      |  53 +++
>  include/linux/mfd/mt6332/registers.h | 642 +++++++++++++++++++++++++++
>  include/linux/mfd/mt6397/core.h      |   2 +
>  7 files changed, 1389 insertions(+), 1 deletion(-)
>  create mode 100644 include/linux/mfd/mt6331/core.h
>  create mode 100644 include/linux/mfd/mt6331/registers.h
>  create mode 100644 include/linux/mfd/mt6332/core.h
>  create mode 100644 include/linux/mfd/mt6332/registers.h

For my own reference (apply this as-is to your sign-off block):

  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
AngeloGioacchino Del Regno June 17, 2022, 7:35 a.m. UTC | #7
Il 16/06/22 20:40, Lee Jones ha scritto:
> On Fri, 20 May 2022, AngeloGioacchino Del Regno wrote:
> 65;6800;1c
>> Add support for the MT6331 PMIC with MT6332 Companion PMIC, found
>> in MT6795 Helio X10 smartphone platforms.
>>
>> This combo has support for multiple devices but, for a start,
>> only the following have been implemented:
>> - Regulators (two instances, one in MT6331, one in MT6332)
>> - RTC (MT6331)
>> - Keys (MT6331)
>> - Interrupts (MT6331 also dispatches MT6332's interrupts)
>>
>> There's more to be implemented, especially for MT6332, which
>> will come at a later stage.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   drivers/mfd/mt6397-core.c            |  47 ++
>>   drivers/mfd/mt6397-irq.c             |   9 +-
>>   include/linux/mfd/mt6331/core.h      |  53 +++
>>   include/linux/mfd/mt6331/registers.h | 584 ++++++++++++++++++++++++
>>   include/linux/mfd/mt6332/core.h      |  53 +++
>>   include/linux/mfd/mt6332/registers.h | 642 +++++++++++++++++++++++++++
>>   include/linux/mfd/mt6397/core.h      |   2 +
>>   7 files changed, 1389 insertions(+), 1 deletion(-)
>>   create mode 100644 include/linux/mfd/mt6331/core.h
>>   create mode 100644 include/linux/mfd/mt6331/registers.h
>>   create mode 100644 include/linux/mfd/mt6332/core.h
>>   create mode 100644 include/linux/mfd/mt6332/registers.h
> 
> For my own reference (apply this as-is to your sign-off block):
> 
>    Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
> 

I've already pushed a v2 of this one :-)
Should I resend?