Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
51a545a3
Commit
51a545a3
authored
Jan 11, 2016
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'asoc/topic/pcm1792a' into asoc-next
parents
a1916ff3
0471cd93
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
280 additions
and
9 deletions
+280
-9
Documentation/devicetree/bindings/sound/pcm179x.txt
Documentation/devicetree/bindings/sound/pcm179x.txt
+1
-1
sound/soc/codecs/Kconfig
sound/soc/codecs/Kconfig
+3
-3
sound/soc/codecs/Makefile
sound/soc/codecs/Makefile
+2
-2
sound/soc/codecs/pcm179x.c
sound/soc/codecs/pcm179x.c
+271
-0
sound/soc/codecs/pcm179x.h
sound/soc/codecs/pcm179x.h
+3
-3
No files found.
Documentation/devicetree/bindings/sound/pcm179
2a
.txt
→
Documentation/devicetree/bindings/sound/pcm179
x
.txt
View file @
51a545a3
Texas Instruments pcm179
2a
DT bindings
Texas Instruments pcm179
x
DT bindings
This driver supports the SPI bus.
...
...
sound/soc/codecs/Kconfig
View file @
51a545a3
...
...
@@ -87,7 +87,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_ML26124 if I2C
select SND_SOC_NAU8825 if I2C
select SND_SOC_PCM1681 if I2C
select SND_SOC_PCM179
2A
if SPI_MASTER
select SND_SOC_PCM179
X
if SPI_MASTER
select SND_SOC_PCM3008
select SND_SOC_PCM3168A_I2C if I2C
select SND_SOC_PCM3168A_SPI if SPI_MASTER
...
...
@@ -526,8 +526,8 @@ config SND_SOC_PCM1681
tristate "Texas Instruments PCM1681 CODEC"
depends on I2C
config SND_SOC_PCM179
2A
tristate "Texas Instruments PCM179
2A
CODEC"
config SND_SOC_PCM179
X
tristate "Texas Instruments PCM179
X
CODEC"
depends on SPI_MASTER
config SND_SOC_PCM3008
...
...
sound/soc/codecs/Makefile
View file @
51a545a3
...
...
@@ -80,7 +80,7 @@ snd-soc-mc13783-objs := mc13783.o
snd-soc-ml26124-objs
:=
ml26124.o
snd-soc-nau8825-objs
:=
nau8825.o
snd-soc-pcm1681-objs
:=
pcm1681.o
snd-soc-pcm179
2a-codec-objs
:=
pcm1792a
.o
snd-soc-pcm179
x-codec-objs
:=
pcm179x
.o
snd-soc-pcm3008-objs
:=
pcm3008.o
snd-soc-pcm3168a-objs
:=
pcm3168a.o
snd-soc-pcm3168a-i2c-objs
:=
pcm3168a-i2c.o
...
...
@@ -284,7 +284,7 @@ obj-$(CONFIG_SND_SOC_MC13783) += snd-soc-mc13783.o
obj-$(CONFIG_SND_SOC_ML26124)
+=
snd-soc-ml26124.o
obj-$(CONFIG_SND_SOC_NAU8825)
+=
snd-soc-nau8825.o
obj-$(CONFIG_SND_SOC_PCM1681)
+=
snd-soc-pcm1681.o
obj-$(CONFIG_SND_SOC_PCM179
2A)
+=
snd-soc-pcm1792a
-codec.o
obj-$(CONFIG_SND_SOC_PCM179
X)
+=
snd-soc-pcm179x
-codec.o
obj-$(CONFIG_SND_SOC_PCM3008)
+=
snd-soc-pcm3008.o
obj-$(CONFIG_SND_SOC_PCM3168A)
+=
snd-soc-pcm3168a.o
obj-$(CONFIG_SND_SOC_PCM3168A_I2C)
+=
snd-soc-pcm3168a-i2c.o
...
...
sound/soc/codecs/pcm179
2a
.c
→
sound/soc/codecs/pcm179
x
.c
View file @
51a545a3
/*
* PCM179
2A
ASoC codec driver
* PCM179
X
ASoC codec driver
*
* Copyright (c) Amarula Solutions B.V. 2013
*
...
...
@@ -31,21 +31,21 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include "pcm179
2a
.h"
#include "pcm179
x
.h"
#define PCM179
2A
_DAC_VOL_LEFT 0x10
#define PCM179
2A
_DAC_VOL_RIGHT 0x11
#define PCM179
2A
_FMT_CONTROL 0x12
#define PCM179
2A
_MODE_CONTROL 0x13
#define PCM179
2A_SOFT_MUTE PCM1792A
_FMT_CONTROL
#define PCM179
X
_DAC_VOL_LEFT 0x10
#define PCM179
X
_DAC_VOL_RIGHT 0x11
#define PCM179
X
_FMT_CONTROL 0x12
#define PCM179
X
_MODE_CONTROL 0x13
#define PCM179
X_SOFT_MUTE PCM179X
_FMT_CONTROL
#define PCM179
2A
_FMT_MASK 0x70
#define PCM179
2A
_FMT_SHIFT 4
#define PCM179
2A
_MUTE_MASK 0x01
#define PCM179
2A
_MUTE_SHIFT 0
#define PCM179
2A
_ATLD_ENABLE (1 << 7)
#define PCM179
X
_FMT_MASK 0x70
#define PCM179
X
_FMT_SHIFT 4
#define PCM179
X
_MUTE_MASK 0x01
#define PCM179
X
_MUTE_SHIFT 0
#define PCM179
X
_ATLD_ENABLE (1 << 7)
static
const
struct
reg_default
pcm179
2a
_reg_defaults
[]
=
{
static
const
struct
reg_default
pcm179
x
_reg_defaults
[]
=
{
{
0x10
,
0xff
},
{
0x11
,
0xff
},
{
0x12
,
0x50
},
...
...
@@ -56,57 +56,57 @@ static const struct reg_default pcm1792a_reg_defaults[] = {
{
0x17
,
0x00
},
};
static
bool
pcm179
2a
_accessible_reg
(
struct
device
*
dev
,
unsigned
int
reg
)
static
bool
pcm179
x
_accessible_reg
(
struct
device
*
dev
,
unsigned
int
reg
)
{
return
reg
>=
0x10
&&
reg
<=
0x17
;
}
static
bool
pcm179
2a
_writeable_reg
(
struct
device
*
dev
,
unsigned
register
reg
)
static
bool
pcm179
x
_writeable_reg
(
struct
device
*
dev
,
unsigned
register
reg
)
{
bool
accessible
;
accessible
=
pcm179
2a
_accessible_reg
(
dev
,
reg
);
accessible
=
pcm179
x
_accessible_reg
(
dev
,
reg
);
return
accessible
&&
reg
!=
0x16
&&
reg
!=
0x17
;
}
struct
pcm179
2a
_private
{
struct
pcm179
x
_private
{
struct
regmap
*
regmap
;
unsigned
int
format
;
unsigned
int
rate
;
};
static
int
pcm179
2a
_set_dai_fmt
(
struct
snd_soc_dai
*
codec_dai
,
static
int
pcm179
x
_set_dai_fmt
(
struct
snd_soc_dai
*
codec_dai
,
unsigned
int
format
)
{
struct
snd_soc_codec
*
codec
=
codec_dai
->
codec
;
struct
pcm179
2a
_private
*
priv
=
snd_soc_codec_get_drvdata
(
codec
);
struct
pcm179
x
_private
*
priv
=
snd_soc_codec_get_drvdata
(
codec
);
priv
->
format
=
format
;
return
0
;
}
static
int
pcm179
2a
_digital_mute
(
struct
snd_soc_dai
*
dai
,
int
mute
)
static
int
pcm179
x
_digital_mute
(
struct
snd_soc_dai
*
dai
,
int
mute
)
{
struct
snd_soc_codec
*
codec
=
dai
->
codec
;
struct
pcm179
2a
_private
*
priv
=
snd_soc_codec_get_drvdata
(
codec
);
struct
pcm179
x
_private
*
priv
=
snd_soc_codec_get_drvdata
(
codec
);
int
ret
;
ret
=
regmap_update_bits
(
priv
->
regmap
,
PCM179
2A
_SOFT_MUTE
,
PCM179
2A
_MUTE_MASK
,
!!
mute
);
ret
=
regmap_update_bits
(
priv
->
regmap
,
PCM179
X
_SOFT_MUTE
,
PCM179
X
_MUTE_MASK
,
!!
mute
);
if
(
ret
<
0
)
return
ret
;
return
0
;
}
static
int
pcm179
2a
_hw_params
(
struct
snd_pcm_substream
*
substream
,
static
int
pcm179
x
_hw_params
(
struct
snd_pcm_substream
*
substream
,
struct
snd_pcm_hw_params
*
params
,
struct
snd_soc_dai
*
dai
)
{
struct
snd_soc_codec
*
codec
=
dai
->
codec
;
struct
pcm179
2a
_private
*
priv
=
snd_soc_codec_get_drvdata
(
codec
);
struct
pcm179
x
_private
*
priv
=
snd_soc_codec_get_drvdata
(
codec
);
int
val
=
0
,
ret
;
priv
->
rate
=
params_rate
(
params
);
...
...
@@ -143,129 +143,129 @@ static int pcm1792a_hw_params(struct snd_pcm_substream *substream,
return
-
EINVAL
;
}
val
=
val
<<
PCM179
2A_FMT_SHIFT
|
PCM1792A
_ATLD_ENABLE
;
val
=
val
<<
PCM179
X_FMT_SHIFT
|
PCM179X
_ATLD_ENABLE
;
ret
=
regmap_update_bits
(
priv
->
regmap
,
PCM179
2A
_FMT_CONTROL
,
PCM179
2A_FMT_MASK
|
PCM1792A
_ATLD_ENABLE
,
val
);
ret
=
regmap_update_bits
(
priv
->
regmap
,
PCM179
X
_FMT_CONTROL
,
PCM179
X_FMT_MASK
|
PCM179X
_ATLD_ENABLE
,
val
);
if
(
ret
<
0
)
return
ret
;
return
0
;
}
static
const
struct
snd_soc_dai_ops
pcm179
2a
_dai_ops
=
{
.
set_fmt
=
pcm179
2a
_set_dai_fmt
,
.
hw_params
=
pcm179
2a
_hw_params
,
.
digital_mute
=
pcm179
2a
_digital_mute
,
static
const
struct
snd_soc_dai_ops
pcm179
x
_dai_ops
=
{
.
set_fmt
=
pcm179
x
_set_dai_fmt
,
.
hw_params
=
pcm179
x
_hw_params
,
.
digital_mute
=
pcm179
x
_digital_mute
,
};
static
const
DECLARE_TLV_DB_SCALE
(
pcm179
2a
_dac_tlv
,
-
12000
,
50
,
1
);
static
const
DECLARE_TLV_DB_SCALE
(
pcm179
x
_dac_tlv
,
-
12000
,
50
,
1
);
static
const
struct
snd_kcontrol_new
pcm179
2a
_controls
[]
=
{
SOC_DOUBLE_R_RANGE_TLV
(
"DAC Playback Volume"
,
PCM179
2A
_DAC_VOL_LEFT
,
PCM179
2A
_DAC_VOL_RIGHT
,
0
,
0xf
,
0xff
,
0
,
pcm179
2a
_dac_tlv
),
SOC_SINGLE
(
"DAC Invert Output Switch"
,
PCM179
2A
_MODE_CONTROL
,
7
,
1
,
0
),
SOC_SINGLE
(
"DAC Rolloff Filter Switch"
,
PCM179
2A
_MODE_CONTROL
,
1
,
1
,
0
),
static
const
struct
snd_kcontrol_new
pcm179
x
_controls
[]
=
{
SOC_DOUBLE_R_RANGE_TLV
(
"DAC Playback Volume"
,
PCM179
X
_DAC_VOL_LEFT
,
PCM179
X
_DAC_VOL_RIGHT
,
0
,
0xf
,
0xff
,
0
,
pcm179
x
_dac_tlv
),
SOC_SINGLE
(
"DAC Invert Output Switch"
,
PCM179
X
_MODE_CONTROL
,
7
,
1
,
0
),
SOC_SINGLE
(
"DAC Rolloff Filter Switch"
,
PCM179
X
_MODE_CONTROL
,
1
,
1
,
0
),
};
static
const
struct
snd_soc_dapm_widget
pcm179
2a
_dapm_widgets
[]
=
{
static
const
struct
snd_soc_dapm_widget
pcm179
x
_dapm_widgets
[]
=
{
SND_SOC_DAPM_OUTPUT
(
"IOUTL+"
),
SND_SOC_DAPM_OUTPUT
(
"IOUTL-"
),
SND_SOC_DAPM_OUTPUT
(
"IOUTR+"
),
SND_SOC_DAPM_OUTPUT
(
"IOUTR-"
),
};
static
const
struct
snd_soc_dapm_route
pcm179
2a
_dapm_routes
[]
=
{
static
const
struct
snd_soc_dapm_route
pcm179
x
_dapm_routes
[]
=
{
{
"IOUTL+"
,
NULL
,
"Playback"
},
{
"IOUTL-"
,
NULL
,
"Playback"
},
{
"IOUTR+"
,
NULL
,
"Playback"
},
{
"IOUTR-"
,
NULL
,
"Playback"
},
};
static
struct
snd_soc_dai_driver
pcm179
2a
_dai
=
{
.
name
=
"pcm179
2a
-hifi"
,
static
struct
snd_soc_dai_driver
pcm179
x
_dai
=
{
.
name
=
"pcm179
x
-hifi"
,
.
playback
=
{
.
stream_name
=
"Playback"
,
.
channels_min
=
2
,
.
channels_max
=
2
,
.
rates
=
PCM1792A_RATES
,
.
formats
=
PCM1792A_FORMATS
,
},
.
ops
=
&
pcm179
2a
_dai_ops
,
.
ops
=
&
pcm179
x
_dai_ops
,
};
static
const
struct
of_device_id
pcm179
2a
_of_match
[]
=
{
static
const
struct
of_device_id
pcm179
x
_of_match
[]
=
{
{
.
compatible
=
"ti,pcm1792a"
,
},
{
}
};
MODULE_DEVICE_TABLE
(
of
,
pcm179
2a
_of_match
);
MODULE_DEVICE_TABLE
(
of
,
pcm179
x
_of_match
);
static
const
struct
regmap_config
pcm179
2a
_regmap
=
{
static
const
struct
regmap_config
pcm179
x
_regmap
=
{
.
reg_bits
=
8
,
.
val_bits
=
8
,
.
max_register
=
23
,
.
reg_defaults
=
pcm179
2a
_reg_defaults
,
.
num_reg_defaults
=
ARRAY_SIZE
(
pcm179
2a
_reg_defaults
),
.
writeable_reg
=
pcm179
2a
_writeable_reg
,
.
readable_reg
=
pcm179
2a
_accessible_reg
,
.
reg_defaults
=
pcm179
x
_reg_defaults
,
.
num_reg_defaults
=
ARRAY_SIZE
(
pcm179
x
_reg_defaults
),
.
writeable_reg
=
pcm179
x
_writeable_reg
,
.
readable_reg
=
pcm179
x
_accessible_reg
,
};
static
struct
snd_soc_codec_driver
soc_codec_dev_pcm179
2a
=
{
.
controls
=
pcm179
2a
_controls
,
.
num_controls
=
ARRAY_SIZE
(
pcm179
2a
_controls
),
.
dapm_widgets
=
pcm179
2a
_dapm_widgets
,
.
num_dapm_widgets
=
ARRAY_SIZE
(
pcm179
2a
_dapm_widgets
),
.
dapm_routes
=
pcm179
2a
_dapm_routes
,
.
num_dapm_routes
=
ARRAY_SIZE
(
pcm179
2a
_dapm_routes
),
static
struct
snd_soc_codec_driver
soc_codec_dev_pcm179
x
=
{
.
controls
=
pcm179
x
_controls
,
.
num_controls
=
ARRAY_SIZE
(
pcm179
x
_controls
),
.
dapm_widgets
=
pcm179
x
_dapm_widgets
,
.
num_dapm_widgets
=
ARRAY_SIZE
(
pcm179
x
_dapm_widgets
),
.
dapm_routes
=
pcm179
x
_dapm_routes
,
.
num_dapm_routes
=
ARRAY_SIZE
(
pcm179
x
_dapm_routes
),
};
static
int
pcm179
2a
_spi_probe
(
struct
spi_device
*
spi
)
static
int
pcm179
x
_spi_probe
(
struct
spi_device
*
spi
)
{
struct
pcm179
2a_private
*
pcm1792a
;
struct
pcm179
x_private
*
pcm179x
;
int
ret
;
pcm179
2a
=
devm_kzalloc
(
&
spi
->
dev
,
sizeof
(
struct
pcm1792a
_private
),
pcm179
x
=
devm_kzalloc
(
&
spi
->
dev
,
sizeof
(
struct
pcm179x
_private
),
GFP_KERNEL
);
if
(
!
pcm179
2a
)
if
(
!
pcm179
x
)
return
-
ENOMEM
;
spi_set_drvdata
(
spi
,
pcm179
2a
);
spi_set_drvdata
(
spi
,
pcm179
x
);
pcm179
2a
->
regmap
=
devm_regmap_init_spi
(
spi
,
&
pcm1792a
_regmap
);
if
(
IS_ERR
(
pcm179
2a
->
regmap
))
{
ret
=
PTR_ERR
(
pcm179
2a
->
regmap
);
pcm179
x
->
regmap
=
devm_regmap_init_spi
(
spi
,
&
pcm179x
_regmap
);
if
(
IS_ERR
(
pcm179
x
->
regmap
))
{
ret
=
PTR_ERR
(
pcm179
x
->
regmap
);
dev_err
(
&
spi
->
dev
,
"Failed to register regmap: %d
\n
"
,
ret
);
return
ret
;
}
return
snd_soc_register_codec
(
&
spi
->
dev
,
&
soc_codec_dev_pcm179
2a
,
&
pcm1792a
_dai
,
1
);
&
soc_codec_dev_pcm179
x
,
&
pcm179x
_dai
,
1
);
}
static
int
pcm179
2a
_spi_remove
(
struct
spi_device
*
spi
)
static
int
pcm179
x
_spi_remove
(
struct
spi_device
*
spi
)
{
snd_soc_unregister_codec
(
&
spi
->
dev
);
return
0
;
}
static
const
struct
spi_device_id
pcm179
2a
_spi_ids
[]
=
{
{
"pcm179
2a
"
,
0
},
static
const
struct
spi_device_id
pcm179
x
_spi_ids
[]
=
{
{
"pcm179
x
"
,
0
},
{
},
};
MODULE_DEVICE_TABLE
(
spi
,
pcm179
2a
_spi_ids
);
MODULE_DEVICE_TABLE
(
spi
,
pcm179
x
_spi_ids
);
static
struct
spi_driver
pcm179
2a
_codec_driver
=
{
static
struct
spi_driver
pcm179
x
_codec_driver
=
{
.
driver
=
{
.
name
=
"pcm179
2a
"
,
.
of_match_table
=
of_match_ptr
(
pcm179
2a
_of_match
),
.
name
=
"pcm179
x
"
,
.
of_match_table
=
of_match_ptr
(
pcm179
x
_of_match
),
},
.
id_table
=
pcm179
2a
_spi_ids
,
.
probe
=
pcm179
2a
_spi_probe
,
.
remove
=
pcm179
2a
_spi_remove
,
.
id_table
=
pcm179
x
_spi_ids
,
.
probe
=
pcm179
x
_spi_probe
,
.
remove
=
pcm179
x
_spi_remove
,
};
module_spi_driver
(
pcm179
2a
_codec_driver
);
module_spi_driver
(
pcm179
x
_codec_driver
);
MODULE_DESCRIPTION
(
"ASoC PCM179
2A
driver"
);
MODULE_DESCRIPTION
(
"ASoC PCM179
X
driver"
);
MODULE_AUTHOR
(
"Michael Trimarchi <michael@amarulasolutions.com>"
);
MODULE_LICENSE
(
"GPL"
);
sound/soc/codecs/pcm179
2a
.h
→
sound/soc/codecs/pcm179
x
.h
View file @
51a545a3
/*
* definitions for PCM179
2A
* definitions for PCM179
X
*
* Copyright 2013 Amarula Solutions
*
...
...
@@ -14,8 +14,8 @@
* GNU General Public License for more details.
*/
#ifndef __PCM179
2A
_H__
#define __PCM179
2A
_H__
#ifndef __PCM179
X
_H__
#define __PCM179
X
_H__
#define PCM1792A_RATES (SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_8000_48000 | \
SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment