Commit 4e6bedd3 authored by Matt Flax's avatar Matt Flax Committed by Mark Brown

ASoC: codecs: add support for the TI SRC4392 codec

The src4xxx keyword is used for	future capability to integrate
other codecs similar to the src4392 to the same	code base.
Signed-off-by: default avatarMatt Flax <flatmax@flatmax.com>
Link: https://lore.kernel.org/r/20220810013213.1544645-1-flatmax@flatmax.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 98c17a01
......@@ -205,6 +205,7 @@ config SND_SOC_ALL_CODECS
imply SND_SOC_SIMPLE_AMPLIFIER
imply SND_SOC_SIMPLE_MUX
imply SND_SOC_SPDIF
imply SND_SOC_SRC4XXX_I2C
imply SND_SOC_SSM2305
imply SND_SOC_SSM2518
imply SND_SOC_SSM2602_SPI
......@@ -1471,6 +1472,18 @@ config SND_SOC_SIMPLE_MUX
config SND_SOC_SPDIF
tristate "S/PDIF CODEC"
config SND_SOC_SRC4XXX_I2C
tristate "Texas Instruments SRC4XXX DIR/DIT and SRC codecs"
depends on I2C
select SND_SOC_SRC4XXX
help
Enable support for the TI SRC4XXX family of codecs. These include the
scr4392 which has digital receivers, transmitters, and
a sample rate converter, including numerous ports.
config SND_SOC_SRC4XXX
tristate
config SND_SOC_SSM2305
tristate "Analog Devices SSM2305 Class-D Amplifier"
help
......
......@@ -231,6 +231,8 @@ snd-soc-sigmadsp-regmap-objs := sigmadsp-regmap.o
snd-soc-si476x-objs := si476x.o
snd-soc-spdif-tx-objs := spdif_transmitter.o
snd-soc-spdif-rx-objs := spdif_receiver.o
snd-soc-src4xxx-objs := src4xxx.o
snd-soc-src4xxx-i2c-objs := src4xxx-i2c.o
snd-soc-ssm2305-objs := ssm2305.o
snd-soc-ssm2518-objs := ssm2518.o
snd-soc-ssm2602-objs := ssm2602.o
......@@ -579,6 +581,8 @@ obj-$(CONFIG_SND_SOC_SIGMADSP_I2C) += snd-soc-sigmadsp-i2c.o
obj-$(CONFIG_SND_SOC_SIGMADSP_REGMAP) += snd-soc-sigmadsp-regmap.o
obj-$(CONFIG_SND_SOC_SI476X) += snd-soc-si476x.o
obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif-rx.o snd-soc-spdif-tx.o
obj-$(CONFIG_SND_SOC_SRC4XXX) += snd-soc-src4xxx.o
obj-$(CONFIG_SND_SOC_SRC4XXX_I2C) += snd-soc-src4xxx-i2c.o
obj-$(CONFIG_SND_SOC_SSM2305) += snd-soc-ssm2305.o
obj-$(CONFIG_SND_SOC_SSM2518) += snd-soc-ssm2518.o
obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o
......
// SPDX-License-Identifier: GPL-2.0
//
// Driver for SRC4XXX codecs
//
// Copyright 2021-2022 Deqx Pty Ltd
// Author: Matt Flax <flatmax@flatmax.com>
#include <linux/i2c.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include "src4xxx.h"
static int src4xxx_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
return src4xxx_probe(&i2c->dev,
devm_regmap_init_i2c(i2c, &src4xxx_regmap_config), NULL);
}
static const struct i2c_device_id src4xxx_i2c_ids[] = {
{ "src4392", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, src4xxx_i2c_ids);
static const struct of_device_id src4xxx_of_match[] = {
{ .compatible = "ti,src4392", },
{ }
};
MODULE_DEVICE_TABLE(of, src4xxx_of_match);
static struct i2c_driver src4xxx_i2c_driver = {
.driver = {
.name = "src4xxx",
.of_match_table = of_match_ptr(src4xxx_of_match),
},
.probe = src4xxx_i2c_probe,
.id_table = src4xxx_i2c_ids,
};
module_i2c_driver(src4xxx_i2c_driver);
MODULE_DESCRIPTION("ASoC SRC4392 CODEC I2C driver");
MODULE_AUTHOR("Matt Flax <flatmax@flatmax.com>");
MODULE_LICENSE("GPL");
This diff is collapsed.
// SPDX-License-Identifier: GPL-2.0
//
// src4xxx.h -- SRC4XXX ALSA SoC audio driver
//
// Copyright 2021-2022 Deqx Pty Ltd
// Author: Matt R Flax <flatmax@flatmax.com>
#ifndef __SRC4XXX_H__
#define __SRC4XXX_H__
#define SRC4XXX_RES_00 0x00
#define SRC4XXX_PWR_RST_01 0x01
#define SRC4XXX_RESET 0x80
#define SRC4XXX_POWER_DOWN 0x00
#define SRC4XXX_POWER_ENABLE 0x20
#define SRC4XXX_ENABLE_SRC 0x1
#define SRC4XXX_ENABLE_SRC_SHIFT 0
#define SRC4XXX_ENABLE_DIR 0x2
#define SRC4XXX_ENABLE_DIR_SHIFT 1
#define SRC4XXX_ENABLE_DIT 0x4
#define SRC4XXX_ENABLE_DIT_SHIFT 2
#define SRC4XXX_ENABLE_PORT_B 0x8
#define SRC4XXX_ENABLE_PORT_B_SHIFT 3
#define SRC4XXX_ENABLE_PORT_A 0x10
#define SRC4XXX_ENABLE_PORT_A_SHIFT 4
#define SRC4XXX_PORTA_CTL_03 0x03
#define SRC4XXX_BUS_MASTER 0x8
#define SRC4XXX_BUS_LEFT_J 0x0
#define SRC4XXX_BUS_I2S 0x1
#define SRC4XXX_BUS_RIGHT_J_16 0x4
#define SRC4XXX_BUS_RIGHT_J_18 0x5
#define SRC4XXX_BUS_RIGHT_J_20 0x6
#define SRC4XXX_BUS_RIGHT_J_24 0x7
#define SRC4XXX_BUS_FMT_MS_MASK 0xf
#define SRC4XXX_PORTA_CTL_04 0x04
#define SRC4XXX_MCLK_DIV_MASK 0x3
#define SRC4XXX_BUS_FMT(id) (SRC4XXX_PORTA_CTL_03+2*id)
#define SRC4XXX_BUS_CLK(id) (SRC4XXX_PORTA_CTL_04+2*id)
#define SRC4XXX_PORTB_CTL_05 0x05
#define SRC4XXX_PORTB_CTL_06 0x06
#define SRC4XXX_TX_CTL_07 0x07
#define SRC4XXX_TX_MCLK_DIV_MASK 0x60
#define SRC4XXX_TX_MCLK_DIV_SHIFT 5
#define SRC4XXX_TX_CTL_08 0x08
#define SRC4XXX_TX_CTL_09 0x09
#define SRC4XXX_SRC_DIT_IRQ_MSK_0B 0x0B
#define SRC4XXX_SRC_BTI_EN 0x01
#define SRC4XXX_SRC_TSLIP_EN 0x02
#define SRC4XXX_SRC_DIT_IRQ_MODE_0C 0x0C
#define SRC4XXX_RCV_CTL_0D 0x0D
#define SRC4XXX_RXCLK_RXCKI 0x0
#define SRC4XXX_RXCLK_MCLK 0x8
#define SRC4XXX_RCV_CTL_0E 0x0E
#define SRC4XXX_REC_MCLK_EN 0x1
#define SRC4XXX_PLL2_DIV_0 (0x0<<1)
#define SRC4XXX_PLL2_DIV_2 (0x1<<1)
#define SRC4XXX_PLL2_DIV_4 (0x2<<1)
#define SRC4XXX_PLL2_DIV_8 (0x3<<1)
#define SRC4XXX_PLL2_LOL 0x8
#define SRC4XXX_RCV_PLL_0F 0x0F
#define SRC4XXX_RCV_PLL_10 0x10
#define SRC4XXX_RCV_PLL_11 0x11
#define SRC4XXX_RVC_IRQ_MSK_16 0x16
#define SRC4XXX_RVC_IRQ_MSK_17 0x17
#define SRC4XXX_RVC_IRQ_MODE_18 0x18
#define SRC4XXX_RVC_IRQ_MODE_19 0x19
#define SRC4XXX_RVC_IRQ_MODE_1A 0x1A
#define SRC4XXX_GPIO_1_1B 0x1B
#define SRC4XXX_GPIO_2_1C 0x1C
#define SRC4XXX_GPIO_3_1D 0x1D
#define SRC4XXX_GPIO_4_1E 0x1E
#define SRC4XXX_SCR_CTL_2D 0x2D
#define SRC4XXX_SCR_CTL_2E 0x2E
#define SRC4XXX_SCR_CTL_2F 0x2F
#define SRC4XXX_SCR_CTL_30 0x30
#define SRC4XXX_SCR_CTL_31 0x31
#define SRC4XXX_PAGE_SEL_7F 0x7F
// read only registers
#define SRC4XXX_GLOBAL_ITR_STS_02 0x02
#define SRC4XXX_SRC_DIT_STS_0A 0x0A
#define SRC4XXX_NON_AUDIO_D_12 0x12
#define SRC4XXX_RVC_STS_13 0x13
#define SRC4XXX_RVC_STS_14 0x14
#define SRC4XXX_RVC_STS_15 0x15
#define SRC4XXX_SUB_CODE_1F 0x1F
#define SRC4XXX_SUB_CODE_20 0x20
#define SRC4XXX_SUB_CODE_21 0x21
#define SRC4XXX_SUB_CODE_22 0x22
#define SRC4XXX_SUB_CODE_23 0x23
#define SRC4XXX_SUB_CODE_24 0x24
#define SRC4XXX_SUB_CODE_25 0x25
#define SRC4XXX_SUB_CODE_26 0x26
#define SRC4XXX_SUB_CODE_27 0x27
#define SRC4XXX_SUB_CODE_28 0x28
#define SRC4XXX_PC_PREAMBLE_HI_29 0x29
#define SRC4XXX_PC_PREAMBLE_LO_2A 0x2A
#define SRC4XXX_PD_PREAMBLE_HI_2B 0x2B
#define SRC4XXX_PC_PREAMBLE_LO_2C 0x2C
#define SRC4XXX_IO_RATIO_32 0x32
#define SRC4XXX_IO_RATIO_33 0x33
int src4xxx_probe(struct device *dev, struct regmap *regmap,
void (*switch_mode)(struct device *dev));
extern const struct regmap_config src4xxx_regmap_config;
#endif /* __SRC4XXX_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment