Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05588601 authored by Karthikeyan Mani's avatar Karthikeyan Mani
Browse files

asoc: wcd938x: Add default cases for port mapping



Return error in case of wrong path being selected
for port mapping and port params functions.

Change-Id: I5d66a9cd32e9c8e6d8ebac0ea073b1a1762407b6
Signed-off-by: default avatarKarthikeyan Mani <kmani@codeaurora.org>
parent b1a49c6b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -22,6 +22,11 @@ static int wcd938x_slave_bind(struct device *dev,
	uint8_t devnum = 0;
	struct swr_device *pdev = to_swr_device(dev);

	if (!pdev) {
		pr_err("%s: invalid swr device handle\n", __func__);
		return -EINVAL;
	}

	ret = swr_get_logical_dev_num(pdev, pdev->addr, &devnum);
	if (ret) {
		dev_dbg(&pdev->dev,
+11 −3
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ static int wcd938x_set_port_params(struct snd_soc_component *component,
			u8 *port_type, u8 path)
{
	int i, j;
	u8 num_ports;
	u8 num_ports = 0;
	struct codec_port_info (*map)[MAX_PORT][MAX_CH_PER_PORT];
	struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);

@@ -190,6 +190,10 @@ static int wcd938x_set_port_params(struct snd_soc_component *component,
		map = &wcd938x->tx_port_mapping;
		num_ports = wcd938x->num_tx_ports;
		break;
	default:
		dev_err(component->dev, "%s Invalid path selected %u\n",
					__func__, path);
		return -EINVAL;
	}

	for (i = 0; i <= num_ports; i++) {
@@ -217,11 +221,11 @@ static int wcd938x_parse_port_mapping(struct device *dev,
			char *prop, u8 path)
{
	u32 *dt_array, map_size, map_length;
	u32 port_num, ch_mask, ch_rate, old_port_num = 0;
	u32 port_num = 0, ch_mask, ch_rate, old_port_num = 0;
	u32 slave_port_type, master_port_type;
	u32 i, ch_iter = 0;
	int ret = 0;
	u8 *num_ports;
	u8 *num_ports = NULL;
	struct codec_port_info (*map)[MAX_PORT][MAX_CH_PER_PORT];
	struct wcd938x_priv *wcd938x = dev_get_drvdata(dev);

@@ -234,6 +238,10 @@ static int wcd938x_parse_port_mapping(struct device *dev,
		map = &wcd938x->tx_port_mapping;
		num_ports = &wcd938x->num_tx_ports;
		break;
	default:
		dev_err(dev, "%s Invalid path selected %u\n",
			      __func__, path);
		return -EINVAL;
	}

	if (!of_find_property(dev->of_node, prop,