aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2019-04-18 13:19:51 +0100
committerSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2019-05-15 16:57:11 +0100
commit28a43982372e8771c2feca0bdf72aba25cbe9c77 (patch)
treede6a6697fc062f39c5fd413390631ff589c171fe
parent593d5e0b2d7a4ba9b4b8f26decf09f64285d5ac5 (diff)
ASoC: wcd934x: add class H support
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
-rw-r--r--sound/soc/codecs/wcd934x.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c
index 2424a83c880fb..7dc4ac819bef2 100644
--- a/sound/soc/codecs/wcd934x.c
+++ b/sound/soc/codecs/wcd934x.c
@@ -1,5 +1,10 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2019, Linaro Limited
+/*
+TODO
+ 1> Move soundwire to a proper clock
+ 2> cleanup
+*/
#include <linux/module.h>
#include <linux/gpio.h>
@@ -18,6 +23,7 @@
#include <linux/slimbus.h>
#include <linux/mfd/wcd934x/wcd934x.h>
#include <linux/mfd/wcd934x/registers.h>
+#include "wcd-clsh-v2.h"
#define WCD934X_MCLK_CLK_12P288MHZ 12288000
#define WCD934X_MCLK_CLK_9P6MHZ 9600000
@@ -250,6 +256,8 @@ struct wcd934x_codec {
u32 num_tx_port;
struct snd_soc_component *component;
struct wcd_slim_codec_dai_data dai[NUM_CODEC_DAIS];
+ struct wcd_clsh_ctrl *clsh_ctrl;
+ u32 hph_mode;
};
static void wcd934x_update_reg_defaults(struct wcd934x_codec *wcd)
@@ -1411,6 +1419,14 @@ static int wcd934x_comp_probe(struct snd_soc_component *component)
wcd->component = component;
+ /* Class-H Init*/
+ wcd->clsh_ctrl = wcd_clsh_ctrl_alloc(component, 0 /*wcd->version*/);
+ if (IS_ERR(wcd->clsh_ctrl))
+ return PTR_ERR(wcd->clsh_ctrl);
+
+ /* Default HPH Mode to Class-H Low HiFi */
+ wcd->hph_mode = CLS_H_LOHIFI;
+
wcd934x_comp_init(component);
for (i = 0; i < NUM_CODEC_DAIS; i++)
@@ -1461,7 +1477,7 @@ static int wcd934x_codec_probe(struct platform_device *pdev)
struct wcd934x_codec *wcd;
struct device *dev = &pdev->dev;
int ret;
-pr_err("DEBUG: %s: %d \n", __func__, __LINE__);
+ pr_err("DEBUG: %s: %d \n", __func__, __LINE__);
wcd = devm_kzalloc(&pdev->dev, sizeof(*wcd), GFP_KERNEL);
if (!wcd)
@@ -1470,7 +1486,7 @@ pr_err("DEBUG: %s: %d \n", __func__, __LINE__);
wcd->regmap = data->regmap;
wcd->if_regmap = data->ifd_regmap;
wcd->slim = data->slim;
- wcd->slim_ifc_dev = data->slim_ifc_dev;
+ wcd->slim_ifc_dev = data->slim_ifc_dev;
/* rate 9P6MHz */
regmap_update_bits(data->regmap,
@@ -1517,7 +1533,9 @@ pr_err("DEBUG: %s: %d \n", __func__, __LINE__);
static int wcd934x_codec_remove(struct platform_device *pdev)
{
- //struct wcd934x_data *data = dev_get_drvdata(&pdev->dev);
+ struct wcd934x_codec *wcd = dev_get_drvdata(&pdev->dev);
+
+ wcd_clsh_ctrl_free(wcd->clsh_ctrl);
return 0;
}