From a4962dc546453344290efc4caab3debfbe4e4ca0 Mon Sep 17 00:00:00 2001 From: Vignesh Kulothungan Date: Thu, 27 Feb 2020 14:21:21 -0800 Subject: [PATCH] soundwire: add support to disable dynamic port map Add support to disable dynamic port map via device tree property. Do not update master clock when dynamic port map is disabled for a sound wire master. Change-Id: I9f9344866faa4d1c342787e014102d9182ed56ae Signed-off-by: Vignesh Kulothungan --- include/soc/soundwire.h | 1 + soc/swr-mstr-ctrl.c | 16 ++++++++++++++-- soc/swr-mstr-ctrl.h | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/soc/soundwire.h b/include/soc/soundwire.h index 24a64d07d7..838961a103 100644 --- a/include/soc/soundwire.h +++ b/include/soc/soundwire.h @@ -11,6 +11,7 @@ #include #include "audio_mod_devicetable.h" +#define SWR_CLK_RATE_0P3MHZ 300000 #define SWR_CLK_RATE_0P6MHZ 600000 #define SWR_CLK_RATE_1P2MHZ 1200000 #define SWR_CLK_RATE_2P4MHZ 2400000 diff --git a/soc/swr-mstr-ctrl.c b/soc/swr-mstr-ctrl.c index 938ef0ff80..3c0e95d5a2 100644 --- a/soc/swr-mstr-ctrl.c +++ b/soc/swr-mstr-ctrl.c @@ -1567,7 +1567,8 @@ static int swrm_connect_port(struct swr_master *master, mport->req_ch |= mstr_ch_msk; master->port_en_mask |= (1 << mstr_port_id); if (swrm->clk_stop_mode0_supp && - (mport->ch_rate < portinfo->ch_rate[i])) { + swrm->dynamic_port_map_supported && + (mport->ch_rate < portinfo->ch_rate[i])) { mport->ch_rate = portinfo->ch_rate[i]; swrm_update_bus_clk(swrm); } @@ -1633,7 +1634,9 @@ static int swrm_disconnect_port(struct swr_master *master, } port_req->req_ch &= ~portinfo->ch_en[i]; mport->req_ch &= ~mstr_ch_mask; - if (swrm->clk_stop_mode0_supp && !mport->req_ch) { + if (swrm->clk_stop_mode0_supp && + swrm->dynamic_port_map_supported && + !mport->req_ch) { mport->ch_rate = 0; swrm_update_bus_clk(swrm); } @@ -2326,6 +2329,15 @@ static int swrm_probe(struct platform_device *pdev) dev_err(&pdev->dev, "%s: failed to get master id\n", __func__); goto err_pdata_fail; } + ret = of_property_read_u32(pdev->dev.of_node, "qcom,dynamic-port-map-supported", + &swrm->dynamic_port_map_supported); + if (ret) { + dev_dbg(&pdev->dev, + "%s: failed to get dynamic port map support, use default\n", + __func__); + swrm->dynamic_port_map_supported = 1; + } + if (!(of_property_read_u32(pdev->dev.of_node, "swrm-io-base", &swrm->swrm_base_reg))) ret = of_property_read_u32(pdev->dev.of_node, diff --git a/soc/swr-mstr-ctrl.h b/soc/swr-mstr-ctrl.h index 0d00a8a010..c2955f88d8 100644 --- a/soc/swr-mstr-ctrl.h +++ b/soc/swr-mstr-ctrl.h @@ -139,6 +139,7 @@ struct swr_mstr_ctrl { u8 rcmd_id; u8 wcmd_id; u32 master_id; + u32 dynamic_port_map_supported; void *handle; /* SWR Master handle from client for read and writes */ int (*read)(void *handle, int reg); int (*write)(void *handle, int reg, int val);