Loading drivers/soundwire/swr-wcd-ctrl.c +18 −6 Original line number Diff line number Diff line Loading @@ -397,11 +397,17 @@ static int swrm_clk_request(struct swr_mstr_ctrl *swrm, bool enable) return -EINVAL; if (enable) { swrm->clk_ref_count++; if (swrm->clk_ref_count == 1) { swrm->clk(swrm->handle, true); swrm->state = SWR_MSTR_UP; } else { } } else if (--swrm->clk_ref_count == 0) { swrm->clk(swrm->handle, false); swrm->state = SWR_MSTR_DOWN; } else if (swrm->clk_ref_count < 0) { pr_err("%s: swrm clk count mismatch\n", __func__); swrm->clk_ref_count = 0; } return 0; } Loading Loading @@ -1169,7 +1175,10 @@ static irqreturn_t swr_mstr_interrupt(int irq, void *dev) u8 devnum = 0; int ret = IRQ_HANDLED; pm_runtime_get_sync(&swrm->pdev->dev); mutex_lock(&swrm->reslock); swrm_clk_request(swrm, true); mutex_unlock(&swrm->reslock); intr_sts = swrm->read(swrm->handle, SWRM_INTERRUPT_STATUS); intr_sts &= SWRM_INTERRUPT_STATUS_RMSK; for (i = 0; i < SWRM_INTERRUPT_MAX; i++) { Loading Loading @@ -1257,8 +1266,10 @@ static irqreturn_t swr_mstr_interrupt(int irq, void *dev) break; } } pm_runtime_mark_last_busy(&swrm->pdev->dev); pm_runtime_put_autosuspend(&swrm->pdev->dev); mutex_lock(&swrm->reslock); swrm_clk_request(swrm, false); mutex_unlock(&swrm->reslock); return ret; } Loading Loading @@ -1448,6 +1459,7 @@ static int swrm_probe(struct platform_device *pdev) swrm->wcmd_id = 0; swrm->slave_status = 0; swrm->num_rx_chs = 0; swrm->clk_ref_count = 0; swrm->state = SWR_MSTR_RESUME; init_completion(&swrm->reset); init_completion(&swrm->broadcast); Loading drivers/soundwire/swr-wcd-ctrl.h +1 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ struct swr_mstr_ctrl { struct device *dev; struct resource *supplies; struct clk *mclk; int clk_ref_count; struct completion reset; struct completion broadcast; struct mutex mlock; Loading Loading
drivers/soundwire/swr-wcd-ctrl.c +18 −6 Original line number Diff line number Diff line Loading @@ -397,11 +397,17 @@ static int swrm_clk_request(struct swr_mstr_ctrl *swrm, bool enable) return -EINVAL; if (enable) { swrm->clk_ref_count++; if (swrm->clk_ref_count == 1) { swrm->clk(swrm->handle, true); swrm->state = SWR_MSTR_UP; } else { } } else if (--swrm->clk_ref_count == 0) { swrm->clk(swrm->handle, false); swrm->state = SWR_MSTR_DOWN; } else if (swrm->clk_ref_count < 0) { pr_err("%s: swrm clk count mismatch\n", __func__); swrm->clk_ref_count = 0; } return 0; } Loading Loading @@ -1169,7 +1175,10 @@ static irqreturn_t swr_mstr_interrupt(int irq, void *dev) u8 devnum = 0; int ret = IRQ_HANDLED; pm_runtime_get_sync(&swrm->pdev->dev); mutex_lock(&swrm->reslock); swrm_clk_request(swrm, true); mutex_unlock(&swrm->reslock); intr_sts = swrm->read(swrm->handle, SWRM_INTERRUPT_STATUS); intr_sts &= SWRM_INTERRUPT_STATUS_RMSK; for (i = 0; i < SWRM_INTERRUPT_MAX; i++) { Loading Loading @@ -1257,8 +1266,10 @@ static irqreturn_t swr_mstr_interrupt(int irq, void *dev) break; } } pm_runtime_mark_last_busy(&swrm->pdev->dev); pm_runtime_put_autosuspend(&swrm->pdev->dev); mutex_lock(&swrm->reslock); swrm_clk_request(swrm, false); mutex_unlock(&swrm->reslock); return ret; } Loading Loading @@ -1448,6 +1459,7 @@ static int swrm_probe(struct platform_device *pdev) swrm->wcmd_id = 0; swrm->slave_status = 0; swrm->num_rx_chs = 0; swrm->clk_ref_count = 0; swrm->state = SWR_MSTR_RESUME; init_completion(&swrm->reset); init_completion(&swrm->broadcast); Loading
drivers/soundwire/swr-wcd-ctrl.h +1 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,7 @@ struct swr_mstr_ctrl { struct device *dev; struct resource *supplies; struct clk *mclk; int clk_ref_count; struct completion reset; struct completion broadcast; struct mutex mlock; Loading