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

Commit fec691e7 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown
Browse files

ASoC: fsi: PortA/B information was controlled by sh_fsi_port_info



Current FSI got each PortA/B parameter by porta_flags/portb_flags from platform.
And .set_rate function was shared for PortA/B.
This structure was not readable and not flexible.
This patch adds sh_fsi_port_info, and its own settings was added on each platform.
it is preparation for DMAEngine support

Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 97df8187
Loading
Loading
Loading
Loading
+11 −19
Original line number Diff line number Diff line
@@ -745,26 +745,18 @@ static int fsi_hdmi_set_rate(struct device *dev, int rate, int enable)
	return ret;
}

static int fsi_set_rate(struct device *dev, int is_porta, int rate, int enable)
{
	int ret;

	if (is_porta)
		ret = fsi_ak4642_set_rate(dev, rate, enable);
	else
		ret = fsi_hdmi_set_rate(dev, rate, enable);

	return ret;
}

static struct sh_fsi_platform_info fsi_info = {
	.porta_flags = SH_FSI_BRS_INV,

	.portb_flags = SH_FSI_BRS_INV |
	.port_a = {
		.flags		= SH_FSI_BRS_INV,
		.set_rate	= fsi_ak4642_set_rate,
	},
	.port_b = {
		.flags		= SH_FSI_BRS_INV |
				  SH_FSI_BRM_INV |
				  SH_FSI_LRS_INV |
				  SH_FSI_FMT_SPDIF,
	.set_rate = fsi_set_rate,
		.set_rate	= fsi_hdmi_set_rate,
	},
};

static struct resource fsi_resources[] = {
+8 −10
Original line number Diff line number Diff line
@@ -901,7 +901,7 @@ static int __fsi_set_round_rate(struct clk *clk, long rate, int enable)
	return clk_enable(clk);
}

static int fsi_set_rate(struct device *dev, int is_porta, int rate, int enable)
static int fsi_b_set_rate(struct device *dev, int rate, int enable)
{
	struct clk *fsib_clk;
	struct clk *fdiv_clk = &sh7372_fsidivb_clk;
@@ -910,10 +910,6 @@ static int fsi_set_rate(struct device *dev, int is_porta, int rate, int enable)
	int ackmd_bpfmd;
	int ret;

	/* FSIA is slave mode. nothing to do here */
	if (is_porta)
		return 0;

	/* clock start */
	switch (rate) {
	case 44100:
@@ -957,14 +953,16 @@ static int fsi_set_rate(struct device *dev, int is_porta, int rate, int enable)
}

static struct sh_fsi_platform_info fsi_info = {
	.porta_flags =	SH_FSI_BRS_INV,

	.portb_flags =	SH_FSI_BRS_INV	|
	.port_a = {
		.flags = SH_FSI_BRS_INV,
	},
	.port_b = {
		.flags = SH_FSI_BRS_INV	|
			SH_FSI_BRM_INV	|
			SH_FSI_LRS_INV	|
			SH_FSI_FMT_SPDIF,

	.set_rate = fsi_set_rate,
		.set_rate = fsi_b_set_rate,
	}
};

static struct resource fsi_resources[] = {
+3 −1
Original line number Diff line number Diff line
@@ -767,7 +767,9 @@ static struct platform_device camera_devices[] = {

/* FSI */
static struct sh_fsi_platform_info fsi_info = {
	.portb_flags = SH_FSI_BRS_INV,
	.port_b = {
		.flags = SH_FSI_BRS_INV,
	},
};

static struct resource fsi_resources[] = {
+3 −1
Original line number Diff line number Diff line
@@ -277,7 +277,9 @@ static struct platform_device ceu1_device = {
/* FSI */
/* change J20, J21, J22 pin to 1-2 connection to use slave mode */
static struct sh_fsi_platform_info fsi_info = {
	.porta_flags = SH_FSI_BRS_INV,
	.port_a = {
		.flags = SH_FSI_BRS_INV,
	},
};

static struct resource fsi_resources[] = {
+7 −3
Original line number Diff line number Diff line
@@ -72,10 +72,14 @@
#define SH_FSI_BPFMD_32		(5 << 4)
#define SH_FSI_BPFMD_16		(6 << 4)

struct sh_fsi_port_info {
	unsigned long flags;
	int (*set_rate)(struct device *dev, int rate, int enable);
};

struct sh_fsi_platform_info {
	unsigned long porta_flags;
	unsigned long portb_flags;
	int (*set_rate)(struct device *dev, int is_porta, int rate, int enable);
	struct sh_fsi_port_info port_a;
	struct sh_fsi_port_info port_b;
};

/*
Loading