Soundwire: Fix soundwire master port configuration

Existing soundwire master controller driver uses static tables
directly for soundwire port configuration. But, this is not
scalable to add support for new targets. So, define platform
specific soundwire master port configuration from machine driver.

Change-Id: I37d499c77914b413e6e16ab2689dbaae8fcd194c
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
This commit is contained in:
Sudheer Papothi 2018-10-31 06:34:01 +05:30 committed by Karthikeyan Mani
parent a3e969d6f0
commit 4c322b1c80
2 changed files with 9 additions and 70 deletions

View file

@ -24,11 +24,12 @@
#include <dsp/msm-audio-event-notify.h>
#include "swrm_registers.h"
#include "swr-mstr-ctrl.h"
#include "swrm_port_config.h"
#define SWRM_SYSTEM_RESUME_TIMEOUT_MS 700
#define SWRM_SYS_SUSPEND_WAIT 1
#define SWRM_DSD_PARAMS_PORT 4
#define SWR_BROADCAST_CMD_ID 0x0F
#define SWR_AUTO_SUSPEND_DELAY 3 /* delay in sec */
#define SWR_DEV_ID_MASK 0xFFFFFFFFFFFF
@ -378,27 +379,16 @@ static void copy_port_tables(struct swr_mstr_ctrl *swrm,
static int swrm_get_port_config(struct swr_mstr_ctrl *swrm)
{
struct port_params *params;
u32 usecase = 0;
switch (swrm->master_id) {
case MASTER_ID_WSA:
params = wsa_frame_superset;
break;
case MASTER_ID_RX:
/* Two RX tables for dsd and without dsd enabled */
if (swrm->mport_cfg[4].port_en)
params = rx_frame_params_dsd;
else
params = rx_frame_params;
break;
case MASTER_ID_TX:
params = tx_frame_params_superset;
break;
default: /* MASTER_GENERIC*/
/* computer generic frame parameters */
return -EINVAL;
}
/* TODO - Send usecase information to avoid checking for master_id */
if (swrm->mport_cfg[SWRM_DSD_PARAMS_PORT].port_en &&
(swrm->master_id == MASTER_ID_RX))
usecase = 1;
params = swrm->port_param[usecase];
copy_port_tables(swrm, params);
return 0;
}

View file

@ -1,51 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*/
#ifndef _SWRM_PORT_CONFIG
#define _SWRM_PORT_CONFIG
#define WSA_MSTR_PORT_MASK 0xFF
/*
* Add port configuration in the format
*{ si, off1, off2, hstart, hstop, wd_len, bp_mode, bgp_ctrl, lane_ctrl}
*/
struct port_params wsa_frame_superset[SWR_MSTR_PORT_LEN] = {
{7, 1, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
{31, 2, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
{63, 12, 31, 0xFF, 0xFF, 0xFF, 0x1, 0xFF, 0xFF},
{7, 6, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
{31, 18, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
{63, 13, 31, 0xFF, 0xFF, 0xFF, 0x1, 0xFF, 0xFF},
{15, 7, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
{15, 10, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
};
struct port_params rx_frame_params[SWR_MSTR_PORT_LEN] = {
{3, 0, 0, 0xFF, 0xFF, 1, 0xFF, 0xFF, 1},
{31, 0, 0, 3, 6, 7, 0, 0xFF, 0},
{31, 11, 11, 0xFF, 0xFF, 4, 1, 0xFF, 0},
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0},
{0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0},
};
struct port_params rx_frame_params_dsd[SWR_MSTR_PORT_LEN] = {
{3, 0, 0, 0xFF, 0xFF, 1, 0xFF, 0xFF, 1},
{31, 0, 0, 3, 6, 7, 0, 0xFF, 0},
{31, 11, 11, 0xFF, 0xFF, 4, 1, 0xFF, 0},
{7, 9, 0, 0xFF, 0xFF, 0xFF, 0xFF, 1, 0},
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 3, 0},
};
struct port_params tx_frame_params_superset[SWR_MSTR_PORT_LEN] = {
{1, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},
{1, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1},
{3, 1, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0},
{3, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 1},
};
#endif /* _SWRM_REGISTERS_H */