[PATCH v14 0/3] mmc: mediatek: add support for SDIO async IRQ

Axe Yang posted 3 patches 1 year, 9 months ago
.../devicetree/bindings/mmc/mtk-sd.yaml       | 50 ++++++++++-
drivers/mmc/core/sdio.c                       | 14 +++
drivers/mmc/host/mtk-sd.c                     | 86 +++++++++++++++++--
include/linux/mmc/card.h                      |  8 +-
include/linux/mmc/sdio.h                      |  5 ++
5 files changed, 155 insertions(+), 8 deletions(-)
[PATCH v14 0/3] mmc: mediatek: add support for SDIO async IRQ
Posted by Axe Yang 1 year, 9 months ago
Changes in v14:
- add sdio_irq_claimed() judgement condition around msdc irq and pinctrl
  control in suspend|resume callback

Changes in v13:
- remove state_dat1 related description in mtk-sd.yaml
- move device_init_wakeup() to probe stage
- remove redundancy SDC_CFG_SDIOIDE bit control in msdc_runtime_suspend()
- replace SDC_CFG_SDIOIDE control with __msdc_enable_sdio_irq() function to
  disable sdio irq when sdio_irq_claimed() return true in msdc_runtime_resume()
- restore to use pm_runtime_force_resume|suspend(), to avoid go out directly
  in force resume, bump up runtime PM usage counter before force suspend. 

Changes in v12:
- assign NULL to pins_eint directly instead of using kfree()

Changes in v11:
- remove '_irq' suffix in interrupts-names property
- fix yaml example build error
- refactor msdc_enable_sdio_irq(), free pins_eint if async irq is not supported

Changes in v10:
- add sample node for SDIO host which support wakeup interrupt in yaml
- skip MMC_PM_WAKE_SDIO_IRQ check before enable SDIO async interrupt
- add MMC_PM_KEEP_POWER check before SDIO eint pinstate parsing
- use dev_pm_set_dedicated_wake_irq_reverse() to correct irq control sequence
- set dedicated irq in msdc_enable_sdio_irq() rather than msdc_drv_probe()
- remove unnecessary wake irq control, rpm/dpm system shall manage that
- move wake irq/msdc irq control back to system suspend phase, use rpm_suspend
  and rpm_resume to ensure irq control sequence:
     disable msdc irq -> enable wake irq -> disable wake irq -> enable msdc irq
- simplify variables, check pins_eint to know whether wakeup settings are managed

Changes in v9:
- remove pinctrl "state_dat1"

Changes in v8:
- remove maxItems property under pinctrl-names property

Changes in v7:
- add device_init_wakeup() to register SDIO host as wakeup source

Changes in v6:
- abandon cap-sdio-async-irq flag, use wakeup-source flag instead
- extend interrupts and pinctrls in mediatek mmc host controller DT documents
- add mmc_card_enable_async_irq() to access enable_async_irq flag
- simplify wakeup irq implementation with dedicate wake up irq related interface

Changes in v5:
- resort variables to reversed xmas tree order
- restore old copyright year range and add current year back

Changes in v4:
- add MMC_CAP2_SDIO_ASYNC_IRQ judge before lookup eint pinctrl
- replace spin_lock_irqsave() variant with spin_lock() in eint irq handler

Changes in v3:
- correct abbreviations with capital letters in commit message
- replace copyright year with 2022 in mtk-sd.c
- remove unnessary pointer casting
- adjust variable order to reversed xmas tree
- remove a redundant blank line
- refine if statement, following standard pattern

Changes in v2:
- change flag name from 'cap-sdio-async-int' to 'cap-sdio-async-irq'
- change corresponding macro names from xxx_INT to xxx_IRQ
- resort new member in msdc_host structure
- refine function msdc_request_dat1_eint_irq()
- rename msdc_{suspend,resume} function names, add suffix '_noirq'
- add MMC_CAP2_NO_SDIO judgement before parse eint related pin setting

Axe Yang (3):
  dt-bindings: mmc: mtk-sd: extend interrupts and pinctrls properties
  mmc: core: Add support for SDIO wakeup interrupt
  mmc: mediatek: add support for SDIO eint wakup IRQ

 .../devicetree/bindings/mmc/mtk-sd.yaml       | 50 ++++++++++-
 drivers/mmc/core/sdio.c                       | 14 +++
 drivers/mmc/host/mtk-sd.c                     | 86 +++++++++++++++++--
 include/linux/mmc/card.h                      |  8 +-
 include/linux/mmc/sdio.h                      |  5 ++
 5 files changed, 155 insertions(+), 8 deletions(-)

-- 
2.25.1
Re: [PATCH v14 0/3] mmc: mediatek: add support for SDIO async IRQ
Posted by Ulf Hansson 1 year, 9 months ago
On Tue, 26 Jul 2022 at 08:28, Axe Yang <axe.yang@mediatek.com> wrote:
>
> Changes in v14:
> - add sdio_irq_claimed() judgement condition around msdc irq and pinctrl
>   control in suspend|resume callback

Version 14, applied for next, thanks!

FYI; Since we are relying on an updated behaviour in the
pm_runtime_force_suspend|resume() helpers, which are queued as a patch
via Rafael's tree, I am going to withhold my pull-request for a few
days longer than usual, until Linus has picked up Rafael's
pull-request, for v5.20-rc1.

Kind regards
Uffe


>
> Changes in v13:
> - remove state_dat1 related description in mtk-sd.yaml
> - move device_init_wakeup() to probe stage
> - remove redundancy SDC_CFG_SDIOIDE bit control in msdc_runtime_suspend()
> - replace SDC_CFG_SDIOIDE control with __msdc_enable_sdio_irq() function to
>   disable sdio irq when sdio_irq_claimed() return true in msdc_runtime_resume()
> - restore to use pm_runtime_force_resume|suspend(), to avoid go out directly
>   in force resume, bump up runtime PM usage counter before force suspend.
>
> Changes in v12:
> - assign NULL to pins_eint directly instead of using kfree()
>
> Changes in v11:
> - remove '_irq' suffix in interrupts-names property
> - fix yaml example build error
> - refactor msdc_enable_sdio_irq(), free pins_eint if async irq is not supported
>
> Changes in v10:
> - add sample node for SDIO host which support wakeup interrupt in yaml
> - skip MMC_PM_WAKE_SDIO_IRQ check before enable SDIO async interrupt
> - add MMC_PM_KEEP_POWER check before SDIO eint pinstate parsing
> - use dev_pm_set_dedicated_wake_irq_reverse() to correct irq control sequence
> - set dedicated irq in msdc_enable_sdio_irq() rather than msdc_drv_probe()
> - remove unnecessary wake irq control, rpm/dpm system shall manage that
> - move wake irq/msdc irq control back to system suspend phase, use rpm_suspend
>   and rpm_resume to ensure irq control sequence:
>      disable msdc irq -> enable wake irq -> disable wake irq -> enable msdc irq
> - simplify variables, check pins_eint to know whether wakeup settings are managed
>
> Changes in v9:
> - remove pinctrl "state_dat1"
>
> Changes in v8:
> - remove maxItems property under pinctrl-names property
>
> Changes in v7:
> - add device_init_wakeup() to register SDIO host as wakeup source
>
> Changes in v6:
> - abandon cap-sdio-async-irq flag, use wakeup-source flag instead
> - extend interrupts and pinctrls in mediatek mmc host controller DT documents
> - add mmc_card_enable_async_irq() to access enable_async_irq flag
> - simplify wakeup irq implementation with dedicate wake up irq related interface
>
> Changes in v5:
> - resort variables to reversed xmas tree order
> - restore old copyright year range and add current year back
>
> Changes in v4:
> - add MMC_CAP2_SDIO_ASYNC_IRQ judge before lookup eint pinctrl
> - replace spin_lock_irqsave() variant with spin_lock() in eint irq handler
>
> Changes in v3:
> - correct abbreviations with capital letters in commit message
> - replace copyright year with 2022 in mtk-sd.c
> - remove unnessary pointer casting
> - adjust variable order to reversed xmas tree
> - remove a redundant blank line
> - refine if statement, following standard pattern
>
> Changes in v2:
> - change flag name from 'cap-sdio-async-int' to 'cap-sdio-async-irq'
> - change corresponding macro names from xxx_INT to xxx_IRQ
> - resort new member in msdc_host structure
> - refine function msdc_request_dat1_eint_irq()
> - rename msdc_{suspend,resume} function names, add suffix '_noirq'
> - add MMC_CAP2_NO_SDIO judgement before parse eint related pin setting
>
> Axe Yang (3):
>   dt-bindings: mmc: mtk-sd: extend interrupts and pinctrls properties
>   mmc: core: Add support for SDIO wakeup interrupt
>   mmc: mediatek: add support for SDIO eint wakup IRQ
>
>  .../devicetree/bindings/mmc/mtk-sd.yaml       | 50 ++++++++++-
>  drivers/mmc/core/sdio.c                       | 14 +++
>  drivers/mmc/host/mtk-sd.c                     | 86 +++++++++++++++++--
>  include/linux/mmc/card.h                      |  8 +-
>  include/linux/mmc/sdio.h                      |  5 ++
>  5 files changed, 155 insertions(+), 8 deletions(-)
>
> --
> 2.25.1
>
>