Define power domain which needs to be enabled in order for audio to work on the PXA1908-based samsung,coreprimevelte smartphone. In the downstream code, this power-on method is marked as specific to the ULCx series which is allegedly a codename of sorts with ULC1 corresponding to the PXA1908.
No other audio components needed for sound to work on this phone are currently available mainline but some successful testing was performed with the vendor variants of the respective drivers and with the domain forced always-on. Signed-off-by: Karel Balej <[email protected]> --- Notes: v2: - APMU_AUD_CLK -> APMU_AUDIO_CLK and group it with other register definitions. (Duje) - Move default function exit path inside the switch. (Duje) - Modify the commit message with information provided by Duje (thanks!). .../marvell/pxa1908-power-controller.c | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/drivers/pmdomain/marvell/pxa1908-power-controller.c b/drivers/pmdomain/marvell/pxa1908-power-controller.c index ff5e6e82d3f8..543e8d33ac0c 100644 --- a/drivers/pmdomain/marvell/pxa1908-power-controller.c +++ b/drivers/pmdomain/marvell/pxa1908-power-controller.c @@ -24,12 +24,15 @@ #define APMU_DEBUG 0x88 #define DSI_PHY_DVM_MASK BIT(31) +#define APMU_AUDIO_CLK 0x80 +#define AUDIO_ULCX_ENABLE 0x0d + #define POWER_ON_LATENCY_US 300 #define POWER_OFF_LATENCY_US 20 #define POWER_POLL_TIMEOUT_US (25 * USEC_PER_MSEC) #define POWER_POLL_SLEEP_US 6 -#define NR_DOMAINS 5 +#define NR_DOMAINS 6 #define to_pxa1908_pd(_genpd) container_of(_genpd, struct pxa1908_pd, genpd) @@ -59,9 +62,14 @@ static inline bool pxa1908_pd_is_on(struct pxa1908_pd *pd) { struct pxa1908_pd_ctrl *ctrl = pd->ctrl; - return pd->data.id != PXA1908_POWER_DOMAIN_DSI - ? regmap_test_bits(ctrl->base, APMU_PWR_STATUS_REG, pd->data.pwr_state) - : regmap_test_bits(ctrl->base, APMU_DEBUG, DSI_PHY_DVM_MASK); + switch (pd->data.id) { + case PXA1908_POWER_DOMAIN_AUDIO: + return regmap_test_bits(ctrl->base, APMU_AUDIO_CLK, AUDIO_ULCX_ENABLE); + case PXA1908_POWER_DOMAIN_DSI: + return regmap_test_bits(ctrl->base, APMU_DEBUG, DSI_PHY_DVM_MASK); + default: + return regmap_test_bits(ctrl->base, APMU_PWR_STATUS_REG, pd->data.pwr_state); + } } static int pxa1908_pd_power_on(struct generic_pm_domain *genpd) @@ -123,6 +131,22 @@ static inline int pxa1908_dsi_power_off(struct generic_pm_domain *genpd) return regmap_clear_bits(ctrl->base, APMU_DEBUG, DSI_PHY_DVM_MASK); } +static inline int pxa1908_audio_power_on(struct generic_pm_domain *genpd) +{ + struct pxa1908_pd *pd = to_pxa1908_pd(genpd); + struct pxa1908_pd_ctrl *ctrl = pd->ctrl; + + return regmap_set_bits(ctrl->base, APMU_AUDIO_CLK, AUDIO_ULCX_ENABLE); +} + +static inline int pxa1908_audio_power_off(struct generic_pm_domain *genpd) +{ + struct pxa1908_pd *pd = to_pxa1908_pd(genpd); + struct pxa1908_pd_ctrl *ctrl = pd->ctrl; + + return regmap_clear_bits(ctrl->base, APMU_AUDIO_CLK, AUDIO_ULCX_ENABLE); +} + #define DOMAIN(_id, _name, ctrl, mode, state) \ [_id] = { \ .data = { \ @@ -159,6 +183,13 @@ static struct pxa1908_pd domains[NR_DOMAINS] = { .keep_on = true, }, }, + [PXA1908_POWER_DOMAIN_AUDIO] = { + .genpd = { + .name = "audio", + .power_on = pxa1908_audio_power_on, + .power_off = pxa1908_audio_power_off, + }, + }, }; static void pxa1908_pd_remove(struct auxiliary_device *auxdev) -- 2.51.2

