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
9a9b13dd
Commit
9a9b13dd
authored
Jul 12, 2018
by
Takashi Iwai
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'topic/hda-core-intel' into topic/hda-acomp
parents
c5a59d24
cb04ba33
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
605 additions
and
674 deletions
+605
-674
include/sound/hdaudio.h
include/sound/hdaudio.h
+29
-0
include/sound/hdaudio_ext.h
include/sound/hdaudio_ext.h
+29
-94
sound/hda/ext/hdac_ext_bus.c
sound/hda/ext/hdac_ext_bus.c
+35
-45
sound/hda/ext/hdac_ext_controller.c
sound/hda/ext/hdac_ext_controller.c
+35
-29
sound/hda/ext/hdac_ext_stream.c
sound/hda/ext/hdac_ext_stream.c
+45
-59
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.c
+51
-17
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_codec.h
+2
-0
sound/soc/codecs/hdac_hdmi.c
sound/soc/codecs/hdac_hdmi.c
+197
-219
sound/soc/intel/skylake/skl-messages.c
sound/soc/intel/skylake/skl-messages.c
+22
-28
sound/soc/intel/skylake/skl-nhlt.c
sound/soc/intel/skylake/skl-nhlt.c
+4
-4
sound/soc/intel/skylake/skl-pcm.c
sound/soc/intel/skylake/skl-pcm.c
+54
-58
sound/soc/intel/skylake/skl-topology.c
sound/soc/intel/skylake/skl-topology.c
+8
-12
sound/soc/intel/skylake/skl-topology.h
sound/soc/intel/skylake/skl-topology.h
+3
-3
sound/soc/intel/skylake/skl.c
sound/soc/intel/skylake/skl.c
+88
-102
sound/soc/intel/skylake/skl.h
sound/soc/intel/skylake/skl.h
+3
-4
No files found.
include/sound/hdaudio.h
View file @
9a9b13dd
...
@@ -188,6 +188,11 @@ struct hdac_driver {
...
@@ -188,6 +188,11 @@ struct hdac_driver {
const
struct
hda_device_id
*
id_table
;
const
struct
hda_device_id
*
id_table
;
int
(
*
match
)(
struct
hdac_device
*
dev
,
struct
hdac_driver
*
drv
);
int
(
*
match
)(
struct
hdac_device
*
dev
,
struct
hdac_driver
*
drv
);
void
(
*
unsol_event
)(
struct
hdac_device
*
dev
,
unsigned
int
event
);
void
(
*
unsol_event
)(
struct
hdac_device
*
dev
,
unsigned
int
event
);
/* fields used by ext bus APIs */
int
(
*
probe
)(
struct
hdac_device
*
dev
);
int
(
*
remove
)(
struct
hdac_device
*
dev
);
void
(
*
shutdown
)(
struct
hdac_device
*
dev
);
};
};
#define drv_to_hdac_driver(_drv) container_of(_drv, struct hdac_driver, driver)
#define drv_to_hdac_driver(_drv) container_of(_drv, struct hdac_driver, driver)
...
@@ -208,6 +213,14 @@ struct hdac_bus_ops {
...
@@ -208,6 +213,14 @@ struct hdac_bus_ops {
int
(
*
link_power
)(
struct
hdac_bus
*
bus
,
bool
enable
);
int
(
*
link_power
)(
struct
hdac_bus
*
bus
,
bool
enable
);
};
};
/*
* ops used for ASoC HDA codec drivers
*/
struct
hdac_ext_bus_ops
{
int
(
*
hdev_attach
)(
struct
hdac_device
*
hdev
);
int
(
*
hdev_detach
)(
struct
hdac_device
*
hdev
);
};
/*
/*
* Lowlevel I/O operators
* Lowlevel I/O operators
*/
*/
...
@@ -250,11 +263,17 @@ struct hdac_rb {
...
@@ -250,11 +263,17 @@ struct hdac_rb {
* @mlcap: MultiLink capabilities pointer
* @mlcap: MultiLink capabilities pointer
* @gtscap: gts capabilities pointer
* @gtscap: gts capabilities pointer
* @drsmcap: dma resume capabilities pointer
* @drsmcap: dma resume capabilities pointer
* @num_streams: streams supported
* @idx: HDA link index
* @hlink_list: link list of HDA links
* @lock: lock for link mgmt
* @cmd_dma_state: state of cmd DMAs: CORB and RIRB
*/
*/
struct
hdac_bus
{
struct
hdac_bus
{
struct
device
*
dev
;
struct
device
*
dev
;
const
struct
hdac_bus_ops
*
ops
;
const
struct
hdac_bus_ops
*
ops
;
const
struct
hdac_io_ops
*
io_ops
;
const
struct
hdac_io_ops
*
io_ops
;
const
struct
hdac_ext_bus_ops
*
ext_ops
;
/* h/w resources */
/* h/w resources */
unsigned
long
addr
;
unsigned
long
addr
;
...
@@ -317,6 +336,16 @@ struct hdac_bus {
...
@@ -317,6 +336,16 @@ struct hdac_bus {
/* i915 component interface */
/* i915 component interface */
struct
i915_audio_component
*
audio_component
;
struct
i915_audio_component
*
audio_component
;
int
i915_power_refcount
;
int
i915_power_refcount
;
/* parameters required for enhanced capabilities */
int
num_streams
;
int
idx
;
struct
list_head
hlink_list
;
struct
mutex
lock
;
bool
cmd_dma_state
;
};
};
int
snd_hdac_bus_init
(
struct
hdac_bus
*
bus
,
struct
device
*
dev
,
int
snd_hdac_bus_init
(
struct
hdac_bus
*
bus
,
struct
device
*
dev
,
...
...
include/sound/hdaudio_ext.h
View file @
9a9b13dd
...
@@ -4,38 +4,16 @@
...
@@ -4,38 +4,16 @@
#include <sound/hdaudio.h>
#include <sound/hdaudio.h>
/**
int
snd_hdac_ext_bus_init
(
struct
hdac_bus
*
bus
,
struct
device
*
dev
,
* hdac_ext_bus: HDAC extended bus for extended HDA caps
*
* @bus: hdac bus
* @num_streams: streams supported
* @hlink_list: link list of HDA links
* @lock: lock for link mgmt
* @cmd_dma_state: state of cmd DMAs: CORB and RIRB
*/
struct
hdac_ext_bus
{
struct
hdac_bus
bus
;
int
num_streams
;
int
idx
;
struct
list_head
hlink_list
;
struct
mutex
lock
;
bool
cmd_dma_state
;
};
int
snd_hdac_ext_bus_init
(
struct
hdac_ext_bus
*
sbus
,
struct
device
*
dev
,
const
struct
hdac_bus_ops
*
ops
,
const
struct
hdac_bus_ops
*
ops
,
const
struct
hdac_io_ops
*
io_ops
);
const
struct
hdac_io_ops
*
io_ops
,
const
struct
hdac_ext_bus_ops
*
ext_ops
);
void
snd_hdac_ext_bus_exit
(
struct
hdac_ext_bus
*
sbus
);
void
snd_hdac_ext_bus_exit
(
struct
hdac_bus
*
bus
);
int
snd_hdac_ext_bus_device_init
(
struct
hdac_ext_bus
*
sbus
,
int
addr
);
int
snd_hdac_ext_bus_device_init
(
struct
hdac_bus
*
bus
,
int
addr
,
struct
hdac_device
*
hdev
);
void
snd_hdac_ext_bus_device_exit
(
struct
hdac_device
*
hdev
);
void
snd_hdac_ext_bus_device_exit
(
struct
hdac_device
*
hdev
);
void
snd_hdac_ext_bus_device_remove
(
struct
hdac_ext_bus
*
ebus
);
void
snd_hdac_ext_bus_device_remove
(
struct
hdac_bus
*
bus
);
#define ebus_to_hbus(ebus) (&(ebus)->bus)
#define hbus_to_ebus(_bus) \
container_of(_bus, struct hdac_ext_bus, bus)
#define HDA_CODEC_REV_EXT_ENTRY(_vid, _rev, _name, drv_data) \
#define HDA_CODEC_REV_EXT_ENTRY(_vid, _rev, _name, drv_data) \
{ .vendor_id = (_vid), .rev_id = (_rev), .name = (_name), \
{ .vendor_id = (_vid), .rev_id = (_rev), .name = (_name), \
...
@@ -44,14 +22,14 @@ void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus);
...
@@ -44,14 +22,14 @@ void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus);
#define HDA_CODEC_EXT_ENTRY(_vid, _revid, _name, _drv_data) \
#define HDA_CODEC_EXT_ENTRY(_vid, _revid, _name, _drv_data) \
HDA_CODEC_REV_EXT_ENTRY(_vid, _revid, _name, _drv_data)
HDA_CODEC_REV_EXT_ENTRY(_vid, _revid, _name, _drv_data)
void
snd_hdac_ext_bus_ppcap_enable
(
struct
hdac_
ext_
bus
*
chip
,
bool
enable
);
void
snd_hdac_ext_bus_ppcap_enable
(
struct
hdac_bus
*
chip
,
bool
enable
);
void
snd_hdac_ext_bus_ppcap_int_enable
(
struct
hdac_
ext_
bus
*
chip
,
bool
enable
);
void
snd_hdac_ext_bus_ppcap_int_enable
(
struct
hdac_bus
*
chip
,
bool
enable
);
void
snd_hdac_ext_stream_spbcap_enable
(
struct
hdac_
ext_
bus
*
chip
,
void
snd_hdac_ext_stream_spbcap_enable
(
struct
hdac_bus
*
chip
,
bool
enable
,
int
index
);
bool
enable
,
int
index
);
int
snd_hdac_ext_bus_get_ml_capabilities
(
struct
hdac_
ext_
bus
*
bus
);
int
snd_hdac_ext_bus_get_ml_capabilities
(
struct
hdac_bus
*
bus
);
struct
hdac_ext_link
*
snd_hdac_ext_bus_get_link
(
struct
hdac_
ext_
bus
*
bus
,
struct
hdac_ext_link
*
snd_hdac_ext_bus_get_link
(
struct
hdac_bus
*
bus
,
const
char
*
codec_name
);
const
char
*
codec_name
);
enum
hdac_ext_stream_type
{
enum
hdac_ext_stream_type
{
...
@@ -100,28 +78,28 @@ struct hdac_ext_stream {
...
@@ -100,28 +78,28 @@ struct hdac_ext_stream {
#define stream_to_hdac_ext_stream(s) \
#define stream_to_hdac_ext_stream(s) \
container_of(s, struct hdac_ext_stream, hstream)
container_of(s, struct hdac_ext_stream, hstream)
void
snd_hdac_ext_stream_init
(
struct
hdac_
ext_
bus
*
bus
,
void
snd_hdac_ext_stream_init
(
struct
hdac_bus
*
bus
,
struct
hdac_ext_stream
*
stream
,
int
idx
,
struct
hdac_ext_stream
*
stream
,
int
idx
,
int
direction
,
int
tag
);
int
direction
,
int
tag
);
int
snd_hdac_ext_stream_init_all
(
struct
hdac_
ext_bus
*
e
bus
,
int
start_idx
,
int
snd_hdac_ext_stream_init_all
(
struct
hdac_
bus
*
bus
,
int
start_idx
,
int
num_stream
,
int
dir
);
int
num_stream
,
int
dir
);
void
snd_hdac_stream_free_all
(
struct
hdac_
ext_bus
*
e
bus
);
void
snd_hdac_stream_free_all
(
struct
hdac_
bus
*
bus
);
void
snd_hdac_link_free_all
(
struct
hdac_
ext_bus
*
e
bus
);
void
snd_hdac_link_free_all
(
struct
hdac_
bus
*
bus
);
struct
hdac_ext_stream
*
snd_hdac_ext_stream_assign
(
struct
hdac_
ext_
bus
*
bus
,
struct
hdac_ext_stream
*
snd_hdac_ext_stream_assign
(
struct
hdac_bus
*
bus
,
struct
snd_pcm_substream
*
substream
,
struct
snd_pcm_substream
*
substream
,
int
type
);
int
type
);
void
snd_hdac_ext_stream_release
(
struct
hdac_ext_stream
*
azx_dev
,
int
type
);
void
snd_hdac_ext_stream_release
(
struct
hdac_ext_stream
*
azx_dev
,
int
type
);
void
snd_hdac_ext_stream_decouple
(
struct
hdac_
ext_
bus
*
bus
,
void
snd_hdac_ext_stream_decouple
(
struct
hdac_bus
*
bus
,
struct
hdac_ext_stream
*
azx_dev
,
bool
decouple
);
struct
hdac_ext_stream
*
azx_dev
,
bool
decouple
);
void
snd_hdac_ext_stop_streams
(
struct
hdac_
ext_bus
*
s
bus
);
void
snd_hdac_ext_stop_streams
(
struct
hdac_
bus
*
bus
);
int
snd_hdac_ext_stream_set_spib
(
struct
hdac_
ext_bus
*
e
bus
,
int
snd_hdac_ext_stream_set_spib
(
struct
hdac_
bus
*
bus
,
struct
hdac_ext_stream
*
stream
,
u32
value
);
struct
hdac_ext_stream
*
stream
,
u32
value
);
int
snd_hdac_ext_stream_get_spbmaxfifo
(
struct
hdac_
ext_bus
*
e
bus
,
int
snd_hdac_ext_stream_get_spbmaxfifo
(
struct
hdac_
bus
*
bus
,
struct
hdac_ext_stream
*
stream
);
struct
hdac_ext_stream
*
stream
);
void
snd_hdac_ext_stream_drsm_enable
(
struct
hdac_
ext_bus
*
e
bus
,
void
snd_hdac_ext_stream_drsm_enable
(
struct
hdac_
bus
*
bus
,
bool
enable
,
int
index
);
bool
enable
,
int
index
);
int
snd_hdac_ext_stream_set_dpibr
(
struct
hdac_
ext_bus
*
e
bus
,
int
snd_hdac_ext_stream_set_dpibr
(
struct
hdac_
bus
*
bus
,
struct
hdac_ext_stream
*
stream
,
u32
value
);
struct
hdac_ext_stream
*
stream
,
u32
value
);
int
snd_hdac_ext_stream_set_lpib
(
struct
hdac_ext_stream
*
stream
,
u32
value
);
int
snd_hdac_ext_stream_set_lpib
(
struct
hdac_ext_stream
*
stream
,
u32
value
);
...
@@ -144,17 +122,15 @@ struct hdac_ext_link {
...
@@ -144,17 +122,15 @@ struct hdac_ext_link {
int
snd_hdac_ext_bus_link_power_up
(
struct
hdac_ext_link
*
link
);
int
snd_hdac_ext_bus_link_power_up
(
struct
hdac_ext_link
*
link
);
int
snd_hdac_ext_bus_link_power_down
(
struct
hdac_ext_link
*
link
);
int
snd_hdac_ext_bus_link_power_down
(
struct
hdac_ext_link
*
link
);
int
snd_hdac_ext_bus_link_power_up_all
(
struct
hdac_
ext_bus
*
e
bus
);
int
snd_hdac_ext_bus_link_power_up_all
(
struct
hdac_
bus
*
bus
);
int
snd_hdac_ext_bus_link_power_down_all
(
struct
hdac_
ext_bus
*
e
bus
);
int
snd_hdac_ext_bus_link_power_down_all
(
struct
hdac_
bus
*
bus
);
void
snd_hdac_ext_link_set_stream_id
(
struct
hdac_ext_link
*
link
,
void
snd_hdac_ext_link_set_stream_id
(
struct
hdac_ext_link
*
link
,
int
stream
);
int
stream
);
void
snd_hdac_ext_link_clear_stream_id
(
struct
hdac_ext_link
*
link
,
void
snd_hdac_ext_link_clear_stream_id
(
struct
hdac_ext_link
*
link
,
int
stream
);
int
stream
);
int
snd_hdac_ext_bus_link_get
(
struct
hdac_ext_bus
*
ebus
,
int
snd_hdac_ext_bus_link_get
(
struct
hdac_bus
*
bus
,
struct
hdac_ext_link
*
link
);
struct
hdac_ext_link
*
link
);
int
snd_hdac_ext_bus_link_put
(
struct
hdac_bus
*
bus
,
struct
hdac_ext_link
*
link
);
int
snd_hdac_ext_bus_link_put
(
struct
hdac_ext_bus
*
ebus
,
struct
hdac_ext_link
*
link
);
/* update register macro */
/* update register macro */
#define snd_hdac_updatel(addr, reg, mask, val) \
#define snd_hdac_updatel(addr, reg, mask, val) \
...
@@ -181,53 +157,12 @@ struct hda_dai_map {
...
@@ -181,53 +157,12 @@ struct hda_dai_map {
u32
maxbps
;
u32
maxbps
;
};
};
#define HDA_MAX_NIDS 16
/**
* struct hdac_ext_device - HDAC Ext device
*
* @hdac: hdac core device
* @nid_list - the dai map which matches the dai-name with the nid
* @map_cur_idx - the idx in use in dai_map
* @ops - the hda codec ops common to all codec drivers
* @pvt_data - private data, for asoc contains asoc codec object
*/
struct
hdac_ext_device
{
struct
hdac_device
hdev
;
struct
hdac_ext_bus
*
ebus
;
/* soc-dai to nid map */
struct
hda_dai_map
nid_list
[
HDA_MAX_NIDS
];
unsigned
int
map_cur_idx
;
/* codec ops */
struct
hdac_ext_codec_ops
ops
;
struct
snd_card
*
card
;
void
*
scodec
;
void
*
private_data
;
};
struct
hdac_ext_dma_params
{
struct
hdac_ext_dma_params
{
u32
format
;
u32
format
;
u8
stream_tag
;
u8
stream_tag
;
};
};
#define to_ehdac_device(dev) (container_of((dev), \
struct hdac_ext_device, hdev))
/*
* HD-audio codec base driver
*/
struct
hdac_ext_driver
{
struct
hdac_driver
hdac
;
int
(
*
probe
)(
struct
hdac_ext_device
*
dev
);
int
(
*
remove
)(
struct
hdac_ext_device
*
dev
);
void
(
*
shutdown
)(
struct
hdac_ext_device
*
dev
);
};
int
snd_hda_ext_driver_register
(
struct
hdac_ext_driver
*
drv
);
void
snd_hda_ext_driver_unregister
(
struct
hdac_ext_driver
*
drv
);
#define to_ehdac_driver(_drv) container_of(_drv, struct hdac_ext_driver, hdac)
int
snd_hda_ext_driver_register
(
struct
hdac_driver
*
drv
);
void
snd_hda_ext_driver_unregister
(
struct
hdac_driver
*
drv
);
#endif
/* __SOUND_HDAUDIO_EXT_H */
#endif
/* __SOUND_HDAUDIO_EXT_H */
sound/hda/ext/hdac_ext_bus.c
View file @
9a9b13dd
...
@@ -87,9 +87,10 @@ static const struct hdac_io_ops hdac_ext_default_io = {
...
@@ -87,9 +87,10 @@ static const struct hdac_io_ops hdac_ext_default_io = {
*
*
* Returns 0 if successful, or a negative error code.
* Returns 0 if successful, or a negative error code.
*/
*/
int
snd_hdac_ext_bus_init
(
struct
hdac_
ext_bus
*
e
bus
,
struct
device
*
dev
,
int
snd_hdac_ext_bus_init
(
struct
hdac_
bus
*
bus
,
struct
device
*
dev
,
const
struct
hdac_bus_ops
*
ops
,
const
struct
hdac_bus_ops
*
ops
,
const
struct
hdac_io_ops
*
io_ops
)
const
struct
hdac_io_ops
*
io_ops
,
const
struct
hdac_ext_bus_ops
*
ext_ops
)
{
{
int
ret
;
int
ret
;
static
int
idx
;
static
int
idx
;
...
@@ -98,15 +99,16 @@ int snd_hdac_ext_bus_init(struct hdac_ext_bus *ebus, struct device *dev,
...
@@ -98,15 +99,16 @@ int snd_hdac_ext_bus_init(struct hdac_ext_bus *ebus, struct device *dev,
if
(
io_ops
==
NULL
)
if
(
io_ops
==
NULL
)
io_ops
=
&
hdac_ext_default_io
;
io_ops
=
&
hdac_ext_default_io
;
ret
=
snd_hdac_bus_init
(
&
ebus
->
bus
,
dev
,
ops
,
io_ops
);
ret
=
snd_hdac_bus_init
(
bus
,
dev
,
ops
,
io_ops
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
INIT_LIST_HEAD
(
&
ebus
->
hlink_list
);
bus
->
ext_ops
=
ext_ops
;
ebus
->
idx
=
idx
++
;
INIT_LIST_HEAD
(
&
bus
->
hlink_list
);
bus
->
idx
=
idx
++
;
mutex_init
(
&
e
bus
->
lock
);
mutex_init
(
&
bus
->
lock
);
e
bus
->
cmd_dma_state
=
true
;
bus
->
cmd_dma_state
=
true
;
return
0
;
return
0
;
}
}
...
@@ -116,10 +118,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_init);
...
@@ -116,10 +118,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_init);
* snd_hdac_ext_bus_exit - clean up a HD-audio extended bus
* snd_hdac_ext_bus_exit - clean up a HD-audio extended bus
* @ebus: the pointer to extended bus object
* @ebus: the pointer to extended bus object
*/
*/
void
snd_hdac_ext_bus_exit
(
struct
hdac_
ext_bus
*
e
bus
)
void
snd_hdac_ext_bus_exit
(
struct
hdac_
bus
*
bus
)
{
{
snd_hdac_bus_exit
(
&
ebus
->
bus
);
snd_hdac_bus_exit
(
bus
);
WARN_ON
(
!
list_empty
(
&
e
bus
->
hlink_list
));
WARN_ON
(
!
list_empty
(
&
bus
->
hlink_list
));
}
}
EXPORT_SYMBOL_GPL
(
snd_hdac_ext_bus_exit
);
EXPORT_SYMBOL_GPL
(
snd_hdac_ext_bus_exit
);
...
@@ -135,21 +137,15 @@ static void default_release(struct device *dev)
...
@@ -135,21 +137,15 @@ static void default_release(struct device *dev)
*
*
* Returns zero for success or a negative error code.
* Returns zero for success or a negative error code.
*/
*/
int
snd_hdac_ext_bus_device_init
(
struct
hdac_ext_bus
*
ebus
,
int
addr
)
int
snd_hdac_ext_bus_device_init
(
struct
hdac_bus
*
bus
,
int
addr
,
struct
hdac_device
*
hdev
)
{
{
struct
hdac_ext_device
*
edev
;
struct
hdac_device
*
hdev
=
NULL
;
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
char
name
[
15
];
char
name
[
15
];
int
ret
;
int
ret
;
edev
=
kzalloc
(
sizeof
(
*
edev
),
GFP_KERNEL
);
hdev
->
bus
=
bus
;
if
(
!
edev
)
return
-
ENOMEM
;
hdev
=
&
edev
->
hdev
;
edev
->
ebus
=
ebus
;
snprintf
(
name
,
sizeof
(
name
),
"ehdaudio%dD%d"
,
e
bus
->
idx
,
addr
);
snprintf
(
name
,
sizeof
(
name
),
"ehdaudio%dD%d"
,
bus
->
idx
,
addr
);
ret
=
snd_hdac_device_init
(
hdev
,
bus
,
name
,
addr
);
ret
=
snd_hdac_device_init
(
hdev
,
bus
,
name
,
addr
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
...
@@ -176,10 +172,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_init);
...
@@ -176,10 +172,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_init);
*/
*/
void
snd_hdac_ext_bus_device_exit
(
struct
hdac_device
*
hdev
)
void
snd_hdac_ext_bus_device_exit
(
struct
hdac_device
*
hdev
)
{
{
struct
hdac_ext_device
*
edev
=
to_ehdac_device
(
hdev
);
snd_hdac_device_exit
(
hdev
);
snd_hdac_device_exit
(
hdev
);
kfree
(
e
dev
);
kfree
(
h
dev
);
}
}
EXPORT_SYMBOL_GPL
(
snd_hdac_ext_bus_device_exit
);
EXPORT_SYMBOL_GPL
(
snd_hdac_ext_bus_device_exit
);
...
@@ -188,14 +182,14 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_exit);
...
@@ -188,14 +182,14 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_exit);
*
*
* @ebus: HD-audio extended bus
* @ebus: HD-audio extended bus
*/
*/
void
snd_hdac_ext_bus_device_remove
(
struct
hdac_
ext_bus
*
e
bus
)
void
snd_hdac_ext_bus_device_remove
(
struct
hdac_
bus
*
bus
)
{
{
struct
hdac_device
*
codec
,
*
__codec
;
struct
hdac_device
*
codec
,
*
__codec
;
/*
/*
* we need to remove all the codec devices objects created in the
* we need to remove all the codec devices objects created in the
* snd_hdac_ext_bus_device_init
* snd_hdac_ext_bus_device_init
*/
*/
list_for_each_entry_safe
(
codec
,
__codec
,
&
ebus
->
bus
.
codec_list
,
list
)
{
list_for_each_entry_safe
(
codec
,
__codec
,
&
bus
->
codec_list
,
list
)
{
snd_hdac_device_unregister
(
codec
);
snd_hdac_device_unregister
(
codec
);
put_device
(
&
codec
->
dev
);
put_device
(
&
codec
->
dev
);
}
}
...
@@ -204,35 +198,31 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_remove);
...
@@ -204,35 +198,31 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_remove);
#define dev_to_hdac(dev) (container_of((dev), \
#define dev_to_hdac(dev) (container_of((dev), \
struct hdac_device, dev))
struct hdac_device, dev))
static
inline
struct
hdac_
ext_driver
*
get_e
drv
(
struct
device
*
dev
)
static
inline
struct
hdac_
driver
*
get_h
drv
(
struct
device
*
dev
)
{
{
struct
hdac_driver
*
hdrv
=
drv_to_hdac_driver
(
dev
->
driver
);
struct
hdac_driver
*
hdrv
=
drv_to_hdac_driver
(
dev
->
driver
);
struct
hdac_ext_driver
*
edrv
=
to_ehdac_driver
(
hdrv
);
return
hdrv
;
return
edrv
;
}
}
static
inline
struct
hdac_
ext_device
*
get_e
dev
(
struct
device
*
dev
)
static
inline
struct
hdac_
device
*
get_h
dev
(
struct
device
*
dev
)
{
{
struct
hdac_device
*
hdev
=
dev_to_hdac_dev
(
dev
);
struct
hdac_device
*
hdev
=
dev_to_hdac_dev
(
dev
);
struct
hdac_ext_device
*
edev
=
to_ehdac_device
(
hdev
);
return
hdev
;
return
edev
;
}
}
static
int
hda_ext_drv_probe
(
struct
device
*
dev
)
static
int
hda_ext_drv_probe
(
struct
device
*
dev
)
{
{
return
(
get_
edrv
(
dev
))
->
probe
(
get_e
dev
(
dev
));
return
(
get_
hdrv
(
dev
))
->
probe
(
get_h
dev
(
dev
));
}
}
static
int
hdac_ext_drv_remove
(
struct
device
*
dev
)
static
int
hdac_ext_drv_remove
(
struct
device
*
dev
)
{
{
return
(
get_
edrv
(
dev
))
->
remove
(
get_e
dev
(
dev
));
return
(
get_
hdrv
(
dev
))
->
remove
(
get_h
dev
(
dev
));
}
}
static
void
hdac_ext_drv_shutdown
(
struct
device
*
dev
)
static
void
hdac_ext_drv_shutdown
(
struct
device
*
dev
)
{
{
return
(
get_
edrv
(
dev
))
->
shutdown
(
get_e
dev
(
dev
));
return
(
get_
hdrv
(
dev
))
->
shutdown
(
get_h
dev
(
dev
));
}
}
/**
/**
...
@@ -240,20 +230,20 @@ static void hdac_ext_drv_shutdown(struct device *dev)
...
@@ -240,20 +230,20 @@ static void hdac_ext_drv_shutdown(struct device *dev)
*
*
* @drv: ext hda driver structure
* @drv: ext hda driver structure
*/
*/
int
snd_hda_ext_driver_register
(
struct
hdac_
ext_
driver
*
drv
)
int
snd_hda_ext_driver_register
(
struct
hdac_driver
*
drv
)
{
{
drv
->
hdac
.
type
=
HDA_DEV_ASOC
;
drv
->
type
=
HDA_DEV_ASOC
;
drv
->
hdac
.
driver
.
bus
=
&
snd_hda_bus_type
;
drv
->
driver
.
bus
=
&
snd_hda_bus_type
;
/* we use default match */
/* we use default match */
if
(
drv
->
probe
)
if
(
drv
->
probe
)
drv
->
hdac
.
driver
.
probe
=
hda_ext_drv_probe
;
drv
->
driver
.
probe
=
hda_ext_drv_probe
;
if
(
drv
->
remove
)
if
(
drv
->
remove
)
drv
->
hdac
.
driver
.
remove
=
hdac_ext_drv_remove
;
drv
->
driver
.
remove
=
hdac_ext_drv_remove
;
if
(
drv
->
shutdown
)
if
(
drv
->
shutdown
)
drv
->
hdac
.
driver
.
shutdown
=
hdac_ext_drv_shutdown
;
drv
->
driver
.
shutdown
=
hdac_ext_drv_shutdown
;
return
driver_register
(
&
drv
->
hdac
.
driver
);
return
driver_register
(
&
drv
->
driver
);
}
}
EXPORT_SYMBOL_GPL
(
snd_hda_ext_driver_register
);
EXPORT_SYMBOL_GPL
(
snd_hda_ext_driver_register
);
...
@@ -262,8 +252,8 @@ EXPORT_SYMBOL_GPL(snd_hda_ext_driver_register);
...
@@ -262,8 +252,8 @@ EXPORT_SYMBOL_GPL(snd_hda_ext_driver_register);
*
*
* @drv: ext hda driver structure
* @drv: ext hda driver structure
*/
*/
void
snd_hda_ext_driver_unregister
(
struct
hdac_
ext_
driver
*
drv
)
void
snd_hda_ext_driver_unregister
(
struct
hdac_driver
*
drv
)
{
{
driver_unregister
(
&
drv
->
hdac
.
driver
);
driver_unregister
(
&
drv
->
driver
);
}
}
EXPORT_SYMBOL_GPL
(
snd_hda_ext_driver_unregister
);
EXPORT_SYMBOL_GPL
(
snd_hda_ext_driver_unregister
);
sound/hda/ext/hdac_ext_controller.c
View file @
9a9b13dd
...
@@ -39,9 +39,8 @@
...
@@ -39,9 +39,8 @@
* @ebus: HD-audio extended core bus
* @ebus: HD-audio extended core bus
* @enable: flag to turn on/off the capability
* @enable: flag to turn on/off the capability
*/
*/
void
snd_hdac_ext_bus_ppcap_enable
(
struct
hdac_
ext_bus
*
e
bus
,
bool
enable
)
void
snd_hdac_ext_bus_ppcap_enable
(
struct
hdac_
bus
*
bus
,
bool
enable
)
{
{
struct
hdac_bus
*
bus
=
&
ebus
->
bus
;
if
(
!
bus
->
ppcap
)
{
if
(
!
bus
->
ppcap
)
{
dev_err
(
bus
->
dev
,
"Address of PP capability is NULL"
);
dev_err
(
bus
->
dev
,
"Address of PP capability is NULL"
);
...
@@ -60,9 +59,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_ppcap_enable);
...
@@ -60,9 +59,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_ppcap_enable);
* @ebus: HD-audio extended core bus
* @ebus: HD-audio extended core bus
* @enable: flag to enable/disable interrupt
* @enable: flag to enable/disable interrupt
*/
*/
void
snd_hdac_ext_bus_ppcap_int_enable
(
struct
hdac_
ext_bus
*
e
bus
,
bool
enable
)
void
snd_hdac_ext_bus_ppcap_int_enable
(
struct
hdac_
bus
*
bus
,
bool
enable
)
{
{
struct
hdac_bus
*
bus
=
&
ebus
->
bus
;
if
(
!
bus
->
ppcap
)
{
if
(
!
bus
->
ppcap
)
{
dev_err
(
bus
->
dev
,
"Address of PP capability is NULL
\n
"
);
dev_err
(
bus
->
dev
,
"Address of PP capability is NULL
\n
"
);
...
@@ -89,12 +87,11 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_ppcap_int_enable);
...
@@ -89,12 +87,11 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_ppcap_int_enable);
* in hlink_list of extended hdac bus
* in hlink_list of extended hdac bus
* Note: this will be freed on bus exit by driver
* Note: this will be freed on bus exit by driver
*/
*/
int
snd_hdac_ext_bus_get_ml_capabilities
(
struct
hdac_
ext_bus
*
e
bus
)
int
snd_hdac_ext_bus_get_ml_capabilities
(
struct
hdac_
bus
*
bus
)
{
{
int
idx
;
int
idx
;
u32
link_count
;
u32
link_count
;
struct
hdac_ext_link
*
hlink
;
struct
hdac_ext_link
*
hlink
;
struct
hdac_bus
*
bus
=
&
ebus
->
bus
;
link_count
=
readl
(
bus
->
mlcap
+
AZX_REG_ML_MLCD
)
+
1
;
link_count
=
readl
(
bus
->
mlcap
+
AZX_REG_ML_MLCD
)
+
1
;
...
@@ -114,7 +111,7 @@ int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_ext_bus *ebus)
...
@@ -114,7 +111,7 @@ int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_ext_bus *ebus)
/* since link in On, update the ref */
/* since link in On, update the ref */
hlink
->
ref_count
=
1
;
hlink
->
ref_count
=
1
;
list_add_tail
(
&
hlink
->
list
,
&
e
bus
->
hlink_list
);
list_add_tail
(
&
hlink
->
list
,
&
bus
->
hlink_list
);
}
}
return
0
;
return
0
;
...
@@ -127,12 +124,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_get_ml_capabilities);
...
@@ -127,12 +124,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_get_ml_capabilities);
* @ebus: HD-audio ext core bus
* @ebus: HD-audio ext core bus
*/
*/
void
snd_hdac_link_free_all
(
struct
hdac_
ext_bus
*
e
bus
)
void
snd_hdac_link_free_all
(
struct
hdac_
bus
*
bus
)
{
{
struct
hdac_ext_link
*
l
;
struct
hdac_ext_link
*
l
;
while
(
!
list_empty
(
&
e
bus
->
hlink_list
))
{
while
(
!
list_empty
(
&
bus
->
hlink_list
))
{
l
=
list_first_entry
(
&
e
bus
->
hlink_list
,
struct
hdac_ext_link
,
list
);
l
=
list_first_entry
(
&
bus
->
hlink_list
,
struct
hdac_ext_link
,
list
);
list_del
(
&
l
->
list
);
list_del
(
&
l
->
list
);
kfree
(
l
);
kfree
(
l
);
}
}
...
@@ -144,7 +141,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_link_free_all);
...
@@ -144,7 +141,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_link_free_all);
* @ebus: HD-audio extended core bus
* @ebus: HD-audio extended core bus
* @codec_name: codec name
* @codec_name: codec name
*/
*/
struct
hdac_ext_link
*
snd_hdac_ext_bus_get_link
(
struct
hdac_
ext_bus
*
e
bus
,
struct
hdac_ext_link
*
snd_hdac_ext_bus_get_link
(
struct
hdac_
bus
*
bus
,
const
char
*
codec_name
)
const
char
*
codec_name
)
{
{
int
i
;
int
i
;
...
@@ -153,10 +150,10 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_ext_bus *ebus,
...
@@ -153,10 +150,10 @@ struct hdac_ext_link *snd_hdac_ext_bus_get_link(struct hdac_ext_bus *ebus,
if
(
sscanf
(
codec_name
,
"ehdaudio%dD%d"
,
&
bus_idx
,
&
addr
)
!=
2
)
if
(
sscanf
(
codec_name
,
"ehdaudio%dD%d"
,
&
bus_idx
,
&
addr
)
!=
2
)
return
NULL
;
return
NULL
;
if
(
e
bus
->
idx
!=
bus_idx
)
if
(
bus
->
idx
!=
bus_idx
)
return
NULL
;
return
NULL
;
list_for_each_entry
(
hlink
,
&
e
bus
->
hlink_list
,
list
)
{
list_for_each_entry
(
hlink
,
&
bus
->
hlink_list
,
list
)
{
for
(
i
=
0
;
i
<
HDA_MAX_CODECS
;
i
++
)
{
for
(
i
=
0
;
i
<
HDA_MAX_CODECS
;
i
++
)
{
if
(
hlink
->
lsdiid
&
(
0x1
<<
addr
))
if
(
hlink
->
lsdiid
&
(
0x1
<<
addr
))
return
hlink
;
return
hlink
;
...
@@ -219,12 +216,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down);
...
@@ -219,12 +216,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_down);
* snd_hdac_ext_bus_link_power_up_all -power up all hda link
* snd_hdac_ext_bus_link_power_up_all -power up all hda link
* @ebus: HD-audio extended bus
* @ebus: HD-audio extended bus
*/
*/
int
snd_hdac_ext_bus_link_power_up_all
(
struct
hdac_
ext_bus
*
e
bus
)
int
snd_hdac_ext_bus_link_power_up_all
(
struct
hdac_
bus
*
bus
)
{
{
struct
hdac_ext_link
*
hlink
=
NULL
;
struct
hdac_ext_link
*
hlink
=
NULL
;
int
ret
;
int
ret
;
list_for_each_entry
(
hlink
,
&
e
bus
->
hlink_list
,
list
)
{
list_for_each_entry
(
hlink
,
&
bus
->
hlink_list
,
list
)
{
snd_hdac_updatel
(
hlink
->
ml_addr
,
snd_hdac_updatel
(
hlink
->
ml_addr
,
AZX_REG_ML_LCTL
,
0
,
AZX_MLCTL_SPA
);
AZX_REG_ML_LCTL
,
0
,
AZX_MLCTL_SPA
);
ret
=
check_hdac_link_power_active
(
hlink
,
true
);
ret
=
check_hdac_link_power_active
(
hlink
,
true
);
...
@@ -240,12 +237,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_up_all);
...
@@ -240,12 +237,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_link_power_up_all);
* snd_hdac_ext_bus_link_power_down_all -power down all hda link
* snd_hdac_ext_bus_link_power_down_all -power down all hda link
* @ebus: HD-audio extended bus
* @ebus: HD-audio extended bus
*/
*/
int
snd_hdac_ext_bus_link_power_down_all
(
struct
hdac_
ext_bus
*
e
bus
)
int
snd_hdac_ext_bus_link_power_down_all
(
struct
hdac_
bus
*
bus
)
{
{
struct
hdac_ext_link
*
hlink
=
NULL
;
struct
hdac_ext_link
*
hlink
=
NULL
;
int
ret
;
int
ret
;
list_for_each_entry
(
hlink
,
&
e
bus
->
hlink_list
,
list
)
{
list_for_each_entry
(
hlink
,
&
bus
->
hlink_list
,
list
)
{
snd_hdac_updatel
(
hlink
->
ml_addr
,
AZX_REG_ML_LCTL
,
AZX_MLCTL_SPA
,
0
);
snd_hdac_updatel
(
hlink
->
ml_addr
,
AZX_REG_ML_LCTL
,
AZX_MLCTL_SPA
,
0
);
ret
=
check_hdac_link_power_active
(
hlink
,
false
);
ret
=
check_hdac_link_power_active
(
hlink
,
false
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
@@ -256,39 +253,48 @@ int snd_hdac_ext_bus_link_power_down_all(struct hdac_ext_bus *ebus)
...
@@ -256,39 +253,48 @@ int snd_hdac_ext_bus_link_power_down_all(struct hdac_ext_bus *ebus)
}
}
EXPORT_SYMBOL_GPL
(
snd_hdac_ext_bus_link_power_down_all
);
EXPORT_SYMBOL_GPL
(
snd_hdac_ext_bus_link_power_down_all
);
int
snd_hdac_ext_bus_link_get
(
struct
hdac_
ext_bus
*
e
bus
,
int
snd_hdac_ext_bus_link_get
(
struct
hdac_
bus
*
bus
,
struct
hdac_ext_link
*
link
)
struct
hdac_ext_link
*
link
)
{
{
int
ret
=
0
;
int
ret
=
0
;
mutex_lock
(
&
e
bus
->
lock
);
mutex_lock
(
&
bus
->
lock
);
/*
/*
* if we move from 0 to 1, count will be 1 so power up this link
* if we move from 0 to 1, count will be 1 so power up this link
* as well, also check the dma status and trigger that
* as well, also check the dma status and trigger that
*/
*/
if
(
++
link
->
ref_count
==
1
)
{
if
(
++
link
->
ref_count
==
1
)
{
if
(
!
e
bus
->
cmd_dma_state
)
{
if
(
!
bus
->
cmd_dma_state
)
{
snd_hdac_bus_init_cmd_io
(
&
ebus
->
bus
);
snd_hdac_bus_init_cmd_io
(
bus
);
e
bus
->
cmd_dma_state
=
true
;
bus
->
cmd_dma_state
=
true
;
}
}
ret
=
snd_hdac_ext_bus_link_power_up
(
link
);
ret
=
snd_hdac_ext_bus_link_power_up
(
link
);
/*
* wait for 521usec for codec to report status
* HDA spec section 4.3 - Codec Discovery
*/
udelay
(
521
);
bus
->
codec_mask
=
snd_hdac_chip_readw
(
bus
,
STATESTS
);
dev_dbg
(
bus
->
dev
,
"codec_mask = 0x%lx
\n
"
,
bus
->
codec_mask
);
snd_hdac_chip_writew
(
bus
,
STATESTS
,
bus
->
codec_mask
);
}
}
mutex_unlock
(
&
e
bus
->
lock
);
mutex_unlock
(
&
bus
->
lock
);
return
ret
;
return
ret
;
}
}
EXPORT_SYMBOL_GPL
(
snd_hdac_ext_bus_link_get
);
EXPORT_SYMBOL_GPL
(
snd_hdac_ext_bus_link_get
);
int
snd_hdac_ext_bus_link_put
(
struct
hdac_
ext_bus
*
e
bus
,
int
snd_hdac_ext_bus_link_put
(
struct
hdac_
bus
*
bus
,
struct
hdac_ext_link
*
link
)
struct
hdac_ext_link
*
link
)
{
{
int
ret
=
0
;
int
ret
=
0
;
struct
hdac_ext_link
*
hlink
;
struct
hdac_ext_link
*
hlink
;
bool
link_up
=
false
;
bool
link_up
=
false
;
mutex_lock
(
&
e
bus
->
lock
);
mutex_lock
(
&
bus
->
lock
);
/*
/*
* if we move from 1 to 0, count will be 0
* if we move from 1 to 0, count will be 0
...
@@ -301,7 +307,7 @@ int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus,
...
@@ -301,7 +307,7 @@ int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus,
* now check if all links are off, if so turn off
* now check if all links are off, if so turn off
* cmd dma as well
* cmd dma as well
*/
*/
list_for_each_entry
(
hlink
,
&
e
bus
->
hlink_list
,
list
)
{
list_for_each_entry
(
hlink
,
&
bus
->
hlink_list
,
list
)
{
if
(
hlink
->
ref_count
)
{
if
(
hlink
->
ref_count
)
{
link_up
=
true
;
link_up
=
true
;
break
;
break
;
...
@@ -309,12 +315,12 @@ int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus,
...
@@ -309,12 +315,12 @@ int snd_hdac_ext_bus_link_put(struct hdac_ext_bus *ebus,
}
}
if
(
!
link_up
)
{
if
(
!
link_up
)
{
snd_hdac_bus_stop_cmd_io
(
&
ebus
->
bus
);
snd_hdac_bus_stop_cmd_io
(
bus
);
e
bus
->
cmd_dma_state
=
false
;
bus
->
cmd_dma_state
=
false
;
}
}
}
}
mutex_unlock
(
&
e
bus
->
lock
);
mutex_unlock
(
&
bus
->
lock
);
return
ret
;
return
ret
;
}
}
EXPORT_SYMBOL_GPL
(
snd_hdac_ext_bus_link_put
);
EXPORT_SYMBOL_GPL
(
snd_hdac_ext_bus_link_put
);
sound/hda/ext/hdac_ext_stream.c
View file @
9a9b13dd
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
/**
/**
* snd_hdac_ext_stream_init - initialize each stream (aka device)
* snd_hdac_ext_stream_init - initialize each stream (aka device)
* @
ebus: HD-audio ext
core bus
* @
bus: HD-audio
core bus
* @stream: HD-audio ext core stream object to initialize
* @stream: HD-audio ext core stream object to initialize
* @idx: stream index number
* @idx: stream index number
* @direction: stream direction (SNDRV_PCM_STREAM_PLAYBACK or SNDRV_PCM_STREAM_CAPTURE)
* @direction: stream direction (SNDRV_PCM_STREAM_PLAYBACK or SNDRV_PCM_STREAM_CAPTURE)
...
@@ -34,18 +34,16 @@
...
@@ -34,18 +34,16 @@
* initialize the stream, if ppcap is enabled then init those and then
* initialize the stream, if ppcap is enabled then init those and then
* invoke hdac stream initialization routine
* invoke hdac stream initialization routine
*/
*/
void
snd_hdac_ext_stream_init
(
struct
hdac_
ext_bus
*
e
bus
,
void
snd_hdac_ext_stream_init
(
struct
hdac_
bus
*
bus
,
struct
hdac_ext_stream
*
stream
,
struct
hdac_ext_stream
*
stream
,
int
idx
,
int
direction
,
int
tag
)
int
idx
,
int
direction
,
int
tag
)
{
{
struct
hdac_bus
*
bus
=
&
ebus
->
bus
;
if
(
bus
->
ppcap
)
{
if
(
bus
->
ppcap
)
{
stream
->
pphc_addr
=
bus
->
ppcap
+
AZX_PPHC_BASE
+
stream
->
pphc_addr
=
bus
->
ppcap
+
AZX_PPHC_BASE
+
AZX_PPHC_INTERVAL
*
idx
;
AZX_PPHC_INTERVAL
*
idx
;
stream
->
pplc_addr
=
bus
->
ppcap
+
AZX_PPLC_BASE
+
stream
->
pplc_addr
=
bus
->
ppcap
+
AZX_PPLC_BASE
+
AZX_PPLC_MULTI
*
e
bus
->
num_streams
+
AZX_PPLC_MULTI
*
bus
->
num_streams
+
AZX_PPLC_INTERVAL
*
idx
;
AZX_PPLC_INTERVAL
*
idx
;
}
}
...
@@ -71,12 +69,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_init);
...
@@ -71,12 +69,12 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_init);
/**
/**
* snd_hdac_ext_stream_init_all - create and initialize the stream objects
* snd_hdac_ext_stream_init_all - create and initialize the stream objects
* for an extended hda bus
* for an extended hda bus
* @
ebus: HD-audio ext
core bus
* @
bus: HD-audio
core bus
* @start_idx: start index for streams
* @start_idx: start index for streams
* @num_stream: number of streams to initialize
* @num_stream: number of streams to initialize
* @dir: direction of streams
* @dir: direction of streams
*/
*/
int
snd_hdac_ext_stream_init_all
(
struct
hdac_
ext_bus
*
e
bus
,
int
start_idx
,
int
snd_hdac_ext_stream_init_all
(
struct
hdac_
bus
*
bus
,
int
start_idx
,
int
num_stream
,
int
dir
)
int
num_stream
,
int
dir
)
{
{
int
stream_tag
=
0
;
int
stream_tag
=
0
;
...
@@ -88,7 +86,7 @@ int snd_hdac_ext_stream_init_all(struct hdac_ext_bus *ebus, int start_idx,
...
@@ -88,7 +86,7 @@ int snd_hdac_ext_stream_init_all(struct hdac_ext_bus *ebus, int start_idx,
if
(
!
stream
)
if
(
!
stream
)
return
-
ENOMEM
;
return
-
ENOMEM
;
tag
=
++
stream_tag
;
tag
=
++
stream_tag
;
snd_hdac_ext_stream_init
(
e
bus
,
stream
,
idx
,
dir
,
tag
);
snd_hdac_ext_stream_init
(
bus
,
stream
,
idx
,
dir
,
tag
);
idx
++
;
idx
++
;
}
}
...
@@ -100,17 +98,16 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_init_all);
...
@@ -100,17 +98,16 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_init_all);
/**
/**
* snd_hdac_stream_free_all - free hdac extended stream objects
* snd_hdac_stream_free_all - free hdac extended stream objects
*
*
* @
ebus: HD-audio ext
core bus
* @
bus: HD-audio
core bus
*/
*/
void
snd_hdac_stream_free_all
(
struct
hdac_
ext_bus
*
e
bus
)
void
snd_hdac_stream_free_all
(
struct
hdac_
bus
*
bus
)
{
{
struct
hdac_stream
*
s
,
*
_s
;
struct
hdac_stream
*
s
,
*
_s
;
struct
hdac_ext_stream
*
stream
;
struct
hdac_ext_stream
*
stream
;
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
list_for_each_entry_safe
(
s
,
_s
,
&
bus
->
stream_list
,
list
)
{
list_for_each_entry_safe
(
s
,
_s
,
&
bus
->
stream_list
,
list
)
{
stream
=
stream_to_hdac_ext_stream
(
s
);
stream
=
stream_to_hdac_ext_stream
(
s
);
snd_hdac_ext_stream_decouple
(
e
bus
,
stream
,
false
);
snd_hdac_ext_stream_decouple
(
bus
,
stream
,
false
);
list_del
(
&
s
->
list
);
list_del
(
&
s
->
list
);
kfree
(
stream
);
kfree
(
stream
);
}
}
...
@@ -119,15 +116,14 @@ EXPORT_SYMBOL_GPL(snd_hdac_stream_free_all);
...
@@ -119,15 +116,14 @@ EXPORT_SYMBOL_GPL(snd_hdac_stream_free_all);
/**
/**
* snd_hdac_ext_stream_decouple - decouple the hdac stream
* snd_hdac_ext_stream_decouple - decouple the hdac stream
* @
ebus: HD-audio ext
core bus
* @
bus: HD-audio
core bus
* @stream: HD-audio ext core stream object to initialize
* @stream: HD-audio ext core stream object to initialize
* @decouple: flag to decouple
* @decouple: flag to decouple
*/
*/
void
snd_hdac_ext_stream_decouple
(
struct
hdac_
ext_bus
*
e
bus
,
void
snd_hdac_ext_stream_decouple
(
struct
hdac_
bus
*
bus
,
struct
hdac_ext_stream
*
stream
,
bool
decouple
)
struct
hdac_ext_stream
*
stream
,
bool
decouple
)
{
{
struct
hdac_stream
*
hstream
=
&
stream
->
hstream
;
struct
hdac_stream
*
hstream
=
&
stream
->
hstream
;
struct
hdac_bus
*
bus
=
&
ebus
->
bus
;
u32
val
;
u32
val
;
int
mask
=
AZX_PPCTL_PROCEN
(
hstream
->
index
);
int
mask
=
AZX_PPCTL_PROCEN
(
hstream
->
index
);
...
@@ -251,19 +247,18 @@ void snd_hdac_ext_link_clear_stream_id(struct hdac_ext_link *link,
...
@@ -251,19 +247,18 @@ void snd_hdac_ext_link_clear_stream_id(struct hdac_ext_link *link,
EXPORT_SYMBOL_GPL
(
snd_hdac_ext_link_clear_stream_id
);
EXPORT_SYMBOL_GPL
(
snd_hdac_ext_link_clear_stream_id
);
static
struct
hdac_ext_stream
*
static
struct
hdac_ext_stream
*
hdac_ext_link_stream_assign
(
struct
hdac_
ext_bus
*
e
bus
,
hdac_ext_link_stream_assign
(
struct
hdac_
bus
*
bus
,
struct
snd_pcm_substream
*
substream
)
struct
snd_pcm_substream
*
substream
)
{
{
struct
hdac_ext_stream
*
res
=
NULL
;
struct
hdac_ext_stream
*
res
=
NULL
;
struct
hdac_stream
*
stream
=
NULL
;
struct
hdac_stream
*
stream
=
NULL
;
struct
hdac_bus
*
hbus
=
&
ebus
->
bus
;
if
(
!
h
bus
->
ppcap
)
{
if
(
!
bus
->
ppcap
)
{
dev_err
(
h
bus
->
dev
,
"stream type not supported
\n
"
);
dev_err
(
bus
->
dev
,
"stream type not supported
\n
"
);
return
NULL
;
return
NULL
;
}
}
list_for_each_entry
(
stream
,
&
h
bus
->
stream_list
,
list
)
{
list_for_each_entry
(
stream
,
&
bus
->
stream_list
,
list
)
{
struct
hdac_ext_stream
*
hstream
=
container_of
(
stream
,
struct
hdac_ext_stream
*
hstream
=
container_of
(
stream
,
struct
hdac_ext_stream
,
struct
hdac_ext_stream
,
hstream
);
hstream
);
...
@@ -277,34 +272,33 @@ hdac_ext_link_stream_assign(struct hdac_ext_bus *ebus,
...
@@ -277,34 +272,33 @@ hdac_ext_link_stream_assign(struct hdac_ext_bus *ebus,
}
}
if
(
!
hstream
->
link_locked
)
{
if
(
!
hstream
->
link_locked
)
{
snd_hdac_ext_stream_decouple
(
e
bus
,
hstream
,
true
);
snd_hdac_ext_stream_decouple
(
bus
,
hstream
,
true
);
res
=
hstream
;
res
=
hstream
;
break
;
break
;
}
}
}
}
if
(
res
)
{
if
(
res
)
{
spin_lock_irq
(
&
h
bus
->
reg_lock
);
spin_lock_irq
(
&
bus
->
reg_lock
);
res
->
link_locked
=
1
;
res
->
link_locked
=
1
;
res
->
link_substream
=
substream
;
res
->
link_substream
=
substream
;
spin_unlock_irq
(
&
h
bus
->
reg_lock
);
spin_unlock_irq
(
&
bus
->
reg_lock
);
}
}
return
res
;
return
res
;
}
}
static
struct
hdac_ext_stream
*
static
struct
hdac_ext_stream
*
hdac_ext_host_stream_assign
(
struct
hdac_
ext_bus
*
e
bus
,
hdac_ext_host_stream_assign
(
struct
hdac_
bus
*
bus
,
struct
snd_pcm_substream
*
substream
)
struct
snd_pcm_substream
*
substream
)
{
{
struct
hdac_ext_stream
*
res
=
NULL
;
struct
hdac_ext_stream
*
res
=
NULL
;
struct
hdac_stream
*
stream
=
NULL
;
struct
hdac_stream
*
stream
=
NULL
;
struct
hdac_bus
*
hbus
=
&
ebus
->
bus
;
if
(
!
h
bus
->
ppcap
)
{
if
(
!
bus
->
ppcap
)
{
dev_err
(
h
bus
->
dev
,
"stream type not supported
\n
"
);
dev_err
(
bus
->
dev
,
"stream type not supported
\n
"
);
return
NULL
;
return
NULL
;
}
}
list_for_each_entry
(
stream
,
&
h
bus
->
stream_list
,
list
)
{
list_for_each_entry
(
stream
,
&
bus
->
stream_list
,
list
)
{
struct
hdac_ext_stream
*
hstream
=
container_of
(
stream
,
struct
hdac_ext_stream
*
hstream
=
container_of
(
stream
,
struct
hdac_ext_stream
,
struct
hdac_ext_stream
,
hstream
);
hstream
);
...
@@ -313,17 +307,17 @@ hdac_ext_host_stream_assign(struct hdac_ext_bus *ebus,
...
@@ -313,17 +307,17 @@ hdac_ext_host_stream_assign(struct hdac_ext_bus *ebus,
if
(
!
stream
->
opened
)
{
if
(
!
stream
->
opened
)
{
if
(
!
hstream
->
decoupled
)
if
(
!
hstream
->
decoupled
)
snd_hdac_ext_stream_decouple
(
e
bus
,
hstream
,
true
);
snd_hdac_ext_stream_decouple
(
bus
,
hstream
,
true
);
res
=
hstream
;
res
=
hstream
;
break
;
break
;
}
}
}
}
if
(
res
)
{
if
(
res
)
{
spin_lock_irq
(
&
h
bus
->
reg_lock
);
spin_lock_irq
(
&
bus
->
reg_lock
);
res
->
hstream
.
opened
=
1
;
res
->
hstream
.
opened
=
1
;
res
->
hstream
.
running
=
0
;
res
->
hstream
.
running
=
0
;
res
->
hstream
.
substream
=
substream
;
res
->
hstream
.
substream
=
substream
;
spin_unlock_irq
(
&
h
bus
->
reg_lock
);
spin_unlock_irq
(
&
bus
->
reg_lock
);
}
}
return
res
;
return
res
;
...
@@ -331,7 +325,7 @@ hdac_ext_host_stream_assign(struct hdac_ext_bus *ebus,
...
@@ -331,7 +325,7 @@ hdac_ext_host_stream_assign(struct hdac_ext_bus *ebus,
/**
/**
* snd_hdac_ext_stream_assign - assign a stream for the PCM
* snd_hdac_ext_stream_assign - assign a stream for the PCM
* @
ebus: HD-audio ext
core bus
* @
bus: HD-audio
core bus
* @substream: PCM substream to assign
* @substream: PCM substream to assign
* @type: type of stream (coupled, host or link stream)
* @type: type of stream (coupled, host or link stream)
*
*
...
@@ -346,27 +340,26 @@ hdac_ext_host_stream_assign(struct hdac_ext_bus *ebus,
...
@@ -346,27 +340,26 @@ hdac_ext_host_stream_assign(struct hdac_ext_bus *ebus,
* the same stream object when it's used beforehand. when a stream is
* the same stream object when it's used beforehand. when a stream is
* decoupled, it becomes a host stream and link stream.
* decoupled, it becomes a host stream and link stream.
*/
*/
struct
hdac_ext_stream
*
snd_hdac_ext_stream_assign
(
struct
hdac_
ext_bus
*
e
bus
,
struct
hdac_ext_stream
*
snd_hdac_ext_stream_assign
(
struct
hdac_
bus
*
bus
,
struct
snd_pcm_substream
*
substream
,
struct
snd_pcm_substream
*
substream
,
int
type
)
int
type
)
{
{
struct
hdac_ext_stream
*
hstream
=
NULL
;
struct
hdac_ext_stream
*
hstream
=
NULL
;
struct
hdac_stream
*
stream
=
NULL
;
struct
hdac_stream
*
stream
=
NULL
;
struct
hdac_bus
*
hbus
=
&
ebus
->
bus
;
switch
(
type
)
{
switch
(
type
)
{
case
HDAC_EXT_STREAM_TYPE_COUPLED
:
case
HDAC_EXT_STREAM_TYPE_COUPLED
:
stream
=
snd_hdac_stream_assign
(
h
bus
,
substream
);
stream
=
snd_hdac_stream_assign
(
bus
,
substream
);
if
(
stream
)
if
(
stream
)
hstream
=
container_of
(
stream
,
hstream
=
container_of
(
stream
,
struct
hdac_ext_stream
,
hstream
);
struct
hdac_ext_stream
,
hstream
);
return
hstream
;
return
hstream
;
case
HDAC_EXT_STREAM_TYPE_HOST
:
case
HDAC_EXT_STREAM_TYPE_HOST
:
return
hdac_ext_host_stream_assign
(
e
bus
,
substream
);
return
hdac_ext_host_stream_assign
(
bus
,
substream
);
case
HDAC_EXT_STREAM_TYPE_LINK
:
case
HDAC_EXT_STREAM_TYPE_LINK
:
return
hdac_ext_link_stream_assign
(
e
bus
,
substream
);
return
hdac_ext_link_stream_assign
(
bus
,
substream
);
default:
default:
return
NULL
;
return
NULL
;
...
@@ -384,7 +377,6 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_assign);
...
@@ -384,7 +377,6 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_assign);
void
snd_hdac_ext_stream_release
(
struct
hdac_ext_stream
*
stream
,
int
type
)
void
snd_hdac_ext_stream_release
(
struct
hdac_ext_stream
*
stream
,
int
type
)
{
{
struct
hdac_bus
*
bus
=
stream
->
hstream
.
bus
;
struct
hdac_bus
*
bus
=
stream
->
hstream
.
bus
;
struct
hdac_ext_bus
*
ebus
=
hbus_to_ebus
(
bus
);
switch
(
type
)
{
switch
(
type
)
{
case
HDAC_EXT_STREAM_TYPE_COUPLED
:
case
HDAC_EXT_STREAM_TYPE_COUPLED
:
...
@@ -393,13 +385,13 @@ void snd_hdac_ext_stream_release(struct hdac_ext_stream *stream, int type)
...
@@ -393,13 +385,13 @@ void snd_hdac_ext_stream_release(struct hdac_ext_stream *stream, int type)
case
HDAC_EXT_STREAM_TYPE_HOST
:
case
HDAC_EXT_STREAM_TYPE_HOST
:
if
(
stream
->
decoupled
&&
!
stream
->
link_locked
)
if
(
stream
->
decoupled
&&
!
stream
->
link_locked
)
snd_hdac_ext_stream_decouple
(
e
bus
,
stream
,
false
);
snd_hdac_ext_stream_decouple
(
bus
,
stream
,
false
);
snd_hdac_stream_release
(
&
stream
->
hstream
);
snd_hdac_stream_release
(
&
stream
->
hstream
);
break
;
break
;
case
HDAC_EXT_STREAM_TYPE_LINK
:
case
HDAC_EXT_STREAM_TYPE_LINK
:
if
(
stream
->
decoupled
&&
!
stream
->
hstream
.
opened
)
if
(
stream
->
decoupled
&&
!
stream
->
hstream
.
opened
)
snd_hdac_ext_stream_decouple
(
e
bus
,
stream
,
false
);
snd_hdac_ext_stream_decouple
(
bus
,
stream
,
false
);
spin_lock_irq
(
&
bus
->
reg_lock
);
spin_lock_irq
(
&
bus
->
reg_lock
);
stream
->
link_locked
=
0
;
stream
->
link_locked
=
0
;
stream
->
link_substream
=
NULL
;
stream
->
link_substream
=
NULL
;
...
@@ -415,16 +407,15 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_release);
...
@@ -415,16 +407,15 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_release);
/**
/**
* snd_hdac_ext_stream_spbcap_enable - enable SPIB for a stream
* snd_hdac_ext_stream_spbcap_enable - enable SPIB for a stream
* @
ebus: HD-audio ext
core bus
* @
bus: HD-audio
core bus
* @enable: flag to enable/disable SPIB
* @enable: flag to enable/disable SPIB
* @index: stream index for which SPIB need to be enabled
* @index: stream index for which SPIB need to be enabled
*/
*/
void
snd_hdac_ext_stream_spbcap_enable
(
struct
hdac_
ext_bus
*
e
bus
,
void
snd_hdac_ext_stream_spbcap_enable
(
struct
hdac_
bus
*
bus
,
bool
enable
,
int
index
)
bool
enable
,
int
index
)
{
{
u32
mask
=
0
;
u32
mask
=
0
;
u32
register_mask
=
0
;
u32
register_mask
=
0
;
struct
hdac_bus
*
bus
=
&
ebus
->
bus
;
if
(
!
bus
->
spbcap
)
{
if
(
!
bus
->
spbcap
)
{
dev_err
(
bus
->
dev
,
"Address of SPB capability is NULL
\n
"
);
dev_err
(
bus
->
dev
,
"Address of SPB capability is NULL
\n
"
);
...
@@ -446,14 +437,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_spbcap_enable);
...
@@ -446,14 +437,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_spbcap_enable);
/**
/**
* snd_hdac_ext_stream_set_spib - sets the spib value of a stream
* snd_hdac_ext_stream_set_spib - sets the spib value of a stream
* @
ebus: HD-audio ext
core bus
* @
bus: HD-audio
core bus
* @stream: hdac_ext_stream
* @stream: hdac_ext_stream
* @value: spib value to set
* @value: spib value to set
*/
*/
int
snd_hdac_ext_stream_set_spib
(
struct
hdac_
ext_bus
*
e
bus
,
int
snd_hdac_ext_stream_set_spib
(
struct
hdac_
bus
*
bus
,
struct
hdac_ext_stream
*
stream
,
u32
value
)
struct
hdac_ext_stream
*
stream
,
u32
value
)
{
{
struct
hdac_bus
*
bus
=
&
ebus
->
bus
;
if
(
!
bus
->
spbcap
)
{
if
(
!
bus
->
spbcap
)
{
dev_err
(
bus
->
dev
,
"Address of SPB capability is NULL
\n
"
);
dev_err
(
bus
->
dev
,
"Address of SPB capability is NULL
\n
"
);
...
@@ -468,15 +458,14 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_set_spib);
...
@@ -468,15 +458,14 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_set_spib);
/**
/**
* snd_hdac_ext_stream_get_spbmaxfifo - gets the spib value of a stream
* snd_hdac_ext_stream_get_spbmaxfifo - gets the spib value of a stream
* @
ebus: HD-audio ext
core bus
* @
bus: HD-audio
core bus
* @stream: hdac_ext_stream
* @stream: hdac_ext_stream
*
*
* Return maxfifo for the stream
* Return maxfifo for the stream
*/
*/
int
snd_hdac_ext_stream_get_spbmaxfifo
(
struct
hdac_
ext_bus
*
e
bus
,
int
snd_hdac_ext_stream_get_spbmaxfifo
(
struct
hdac_
bus
*
bus
,
struct
hdac_ext_stream
*
stream
)
struct
hdac_ext_stream
*
stream
)
{
{
struct
hdac_bus
*
bus
=
&
ebus
->
bus
;
if
(
!
bus
->
spbcap
)
{
if
(
!
bus
->
spbcap
)
{
dev_err
(
bus
->
dev
,
"Address of SPB capability is NULL
\n
"
);
dev_err
(
bus
->
dev
,
"Address of SPB capability is NULL
\n
"
);
...
@@ -490,11 +479,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_get_spbmaxfifo);
...
@@ -490,11 +479,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_get_spbmaxfifo);
/**
/**
* snd_hdac_ext_stop_streams - stop all stream if running
* snd_hdac_ext_stop_streams - stop all stream if running
* @
ebus: HD-audio ext
core bus
* @
bus: HD-audio
core bus
*/
*/
void
snd_hdac_ext_stop_streams
(
struct
hdac_
ext_bus
*
e
bus
)
void
snd_hdac_ext_stop_streams
(
struct
hdac_
bus
*
bus
)
{
{
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
hdac_stream
*
stream
;
struct
hdac_stream
*
stream
;
if
(
bus
->
chip_init
)
{
if
(
bus
->
chip_init
)
{
...
@@ -507,16 +495,15 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stop_streams);
...
@@ -507,16 +495,15 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stop_streams);
/**
/**
* snd_hdac_ext_stream_drsm_enable - enable DMA resume for a stream
* snd_hdac_ext_stream_drsm_enable - enable DMA resume for a stream
* @
ebus: HD-audio ext
core bus
* @
bus: HD-audio
core bus
* @enable: flag to enable/disable DRSM
* @enable: flag to enable/disable DRSM
* @index: stream index for which DRSM need to be enabled
* @index: stream index for which DRSM need to be enabled
*/
*/
void
snd_hdac_ext_stream_drsm_enable
(
struct
hdac_
ext_bus
*
e
bus
,
void
snd_hdac_ext_stream_drsm_enable
(
struct
hdac_
bus
*
bus
,
bool
enable
,
int
index
)
bool
enable
,
int
index
)
{
{
u32
mask
=
0
;
u32
mask
=
0
;
u32
register_mask
=
0
;
u32
register_mask
=
0
;
struct
hdac_bus
*
bus
=
&
ebus
->
bus
;
if
(
!
bus
->
drsmcap
)
{
if
(
!
bus
->
drsmcap
)
{
dev_err
(
bus
->
dev
,
"Address of DRSM capability is NULL
\n
"
);
dev_err
(
bus
->
dev
,
"Address of DRSM capability is NULL
\n
"
);
...
@@ -538,14 +525,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_drsm_enable);
...
@@ -538,14 +525,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_drsm_enable);
/**
/**
* snd_hdac_ext_stream_set_dpibr - sets the dpibr value of a stream
* snd_hdac_ext_stream_set_dpibr - sets the dpibr value of a stream
* @
ebus: HD-audio ext
core bus
* @
bus: HD-audio
core bus
* @stream: hdac_ext_stream
* @stream: hdac_ext_stream
* @value: dpib value to set
* @value: dpib value to set
*/
*/
int
snd_hdac_ext_stream_set_dpibr
(
struct
hdac_
ext_bus
*
e
bus
,
int
snd_hdac_ext_stream_set_dpibr
(
struct
hdac_
bus
*
bus
,
struct
hdac_ext_stream
*
stream
,
u32
value
)
struct
hdac_ext_stream
*
stream
,
u32
value
)
{
{
struct
hdac_bus
*
bus
=
&
ebus
->
bus
;
if
(
!
bus
->
drsmcap
)
{
if
(
!
bus
->
drsmcap
)
{
dev_err
(
bus
->
dev
,
"Address of DRSM capability is NULL
\n
"
);
dev_err
(
bus
->
dev
,
"Address of DRSM capability is NULL
\n
"
);
...
@@ -560,7 +546,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_set_dpibr);
...
@@ -560,7 +546,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_set_dpibr);
/**
/**
* snd_hdac_ext_stream_set_lpib - sets the lpib value of a stream
* snd_hdac_ext_stream_set_lpib - sets the lpib value of a stream
* @
ebus: HD-audio ext
core bus
* @
bus: HD-audio
core bus
* @stream: hdac_ext_stream
* @stream: hdac_ext_stream
* @value: lpib value to set
* @value: lpib value to set
*/
*/
...
...
sound/pci/hda/hda_codec.c
View file @
9a9b13dd
...
@@ -858,6 +858,39 @@ static void snd_hda_codec_dev_release(struct device *dev)
...
@@ -858,6 +858,39 @@ static void snd_hda_codec_dev_release(struct device *dev)
kfree
(
codec
);
kfree
(
codec
);
}
}
#define DEV_NAME_LEN 31
static
int
snd_hda_codec_device_init
(
struct
hda_bus
*
bus
,
struct
snd_card
*
card
,
unsigned
int
codec_addr
,
struct
hda_codec
**
codecp
)
{
char
name
[
DEV_NAME_LEN
];
struct
hda_codec
*
codec
;
int
err
;
dev_dbg
(
card
->
dev
,
"%s: entry
\n
"
,
__func__
);
if
(
snd_BUG_ON
(
!
bus
))
return
-
EINVAL
;
if
(
snd_BUG_ON
(
codec_addr
>
HDA_MAX_CODEC_ADDRESS
))
return
-
EINVAL
;
codec
=
kzalloc
(
sizeof
(
*
codec
),
GFP_KERNEL
);
if
(
!
codec
)
return
-
ENOMEM
;
sprintf
(
name
,
"hdaudioC%dD%d"
,
card
->
number
,
codec_addr
);
err
=
snd_hdac_device_init
(
&
codec
->
core
,
&
bus
->
core
,
name
,
codec_addr
);
if
(
err
<
0
)
{
kfree
(
codec
);
return
err
;
}
codec
->
core
.
type
=
HDA_DEV_LEGACY
;
*
codecp
=
codec
;
return
err
;
}
/**
/**
* snd_hda_codec_new - create a HDA codec
* snd_hda_codec_new - create a HDA codec
* @bus: the bus to assign
* @bus: the bus to assign
...
@@ -869,7 +902,19 @@ static void snd_hda_codec_dev_release(struct device *dev)
...
@@ -869,7 +902,19 @@ static void snd_hda_codec_dev_release(struct device *dev)
int
snd_hda_codec_new
(
struct
hda_bus
*
bus
,
struct
snd_card
*
card
,
int
snd_hda_codec_new
(
struct
hda_bus
*
bus
,
struct
snd_card
*
card
,
unsigned
int
codec_addr
,
struct
hda_codec
**
codecp
)
unsigned
int
codec_addr
,
struct
hda_codec
**
codecp
)
{
{
struct
hda_codec
*
codec
;
int
ret
;
ret
=
snd_hda_codec_device_init
(
bus
,
card
,
codec_addr
,
codecp
);
if
(
ret
<
0
)
return
ret
;
return
snd_hda_codec_device_new
(
bus
,
card
,
codec_addr
,
*
codecp
);
}
EXPORT_SYMBOL_GPL
(
snd_hda_codec_new
);
int
snd_hda_codec_device_new
(
struct
hda_bus
*
bus
,
struct
snd_card
*
card
,
unsigned
int
codec_addr
,
struct
hda_codec
*
codec
)
{
char
component
[
31
];
char
component
[
31
];
hda_nid_t
fg
;
hda_nid_t
fg
;
int
err
;
int
err
;
...
@@ -879,25 +924,14 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
...
@@ -879,25 +924,14 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
.
dev_free
=
snd_hda_codec_dev_free
,
.
dev_free
=
snd_hda_codec_dev_free
,
};
};
dev_dbg
(
card
->
dev
,
"%s: entry
\n
"
,
__func__
);
if
(
snd_BUG_ON
(
!
bus
))
if
(
snd_BUG_ON
(
!
bus
))
return
-
EINVAL
;
return
-
EINVAL
;
if
(
snd_BUG_ON
(
codec_addr
>
HDA_MAX_CODEC_ADDRESS
))
if
(
snd_BUG_ON
(
codec_addr
>
HDA_MAX_CODEC_ADDRESS
))
return
-
EINVAL
;
return
-
EINVAL
;
codec
=
kzalloc
(
sizeof
(
*
codec
),
GFP_KERNEL
);
if
(
!
codec
)
return
-
ENOMEM
;
sprintf
(
component
,
"hdaudioC%dD%d"
,
card
->
number
,
codec_addr
);
err
=
snd_hdac_device_init
(
&
codec
->
core
,
&
bus
->
core
,
component
,
codec_addr
);
if
(
err
<
0
)
{
kfree
(
codec
);
return
err
;
}
codec
->
core
.
dev
.
release
=
snd_hda_codec_dev_release
;
codec
->
core
.
dev
.
release
=
snd_hda_codec_dev_release
;
codec
->
core
.
type
=
HDA_DEV_LEGACY
;
codec
->
core
.
exec_verb
=
codec_exec_verb
;
codec
->
core
.
exec_verb
=
codec_exec_verb
;
codec
->
bus
=
bus
;
codec
->
bus
=
bus
;
...
@@ -957,15 +991,13 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
...
@@ -957,15 +991,13 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
if
(
err
<
0
)
if
(
err
<
0
)
goto
error
;
goto
error
;
if
(
codecp
)
*
codecp
=
codec
;
return
0
;
return
0
;
error:
error:
put_device
(
hda_codec_dev
(
codec
));
put_device
(
hda_codec_dev
(
codec
));
return
err
;
return
err
;
}
}
EXPORT_SYMBOL_GPL
(
snd_hda_codec_new
);
EXPORT_SYMBOL_GPL
(
snd_hda_codec_
device_
new
);
/**
/**
* snd_hda_codec_update_widgets - Refresh widget caps and pin defaults
* snd_hda_codec_update_widgets - Refresh widget caps and pin defaults
...
@@ -2992,6 +3024,7 @@ int snd_hda_codec_build_controls(struct hda_codec *codec)
...
@@ -2992,6 +3024,7 @@ int snd_hda_codec_build_controls(struct hda_codec *codec)
sync_power_up_states
(
codec
);
sync_power_up_states
(
codec
);
return
0
;
return
0
;
}
}
EXPORT_SYMBOL_GPL
(
snd_hda_codec_build_controls
);
/*
/*
* PCM stuff
* PCM stuff
...
@@ -3197,6 +3230,7 @@ int snd_hda_codec_parse_pcms(struct hda_codec *codec)
...
@@ -3197,6 +3230,7 @@ int snd_hda_codec_parse_pcms(struct hda_codec *codec)
return
0
;
return
0
;
}
}
EXPORT_SYMBOL_GPL
(
snd_hda_codec_parse_pcms
);
/* assign all PCMs of the given codec */
/* assign all PCMs of the given codec */
int
snd_hda_codec_build_pcms
(
struct
hda_codec
*
codec
)
int
snd_hda_codec_build_pcms
(
struct
hda_codec
*
codec
)
...
...
sound/pci/hda/hda_codec.h
View file @
9a9b13dd
...
@@ -308,6 +308,8 @@ struct hda_codec {
...
@@ -308,6 +308,8 @@ struct hda_codec {
*/
*/
int
snd_hda_codec_new
(
struct
hda_bus
*
bus
,
struct
snd_card
*
card
,
int
snd_hda_codec_new
(
struct
hda_bus
*
bus
,
struct
snd_card
*
card
,
unsigned
int
codec_addr
,
struct
hda_codec
**
codecp
);
unsigned
int
codec_addr
,
struct
hda_codec
**
codecp
);
int
snd_hda_codec_device_new
(
struct
hda_bus
*
bus
,
struct
snd_card
*
card
,
unsigned
int
codec_addr
,
struct
hda_codec
*
codec
);
int
snd_hda_codec_configure
(
struct
hda_codec
*
codec
);
int
snd_hda_codec_configure
(
struct
hda_codec
*
codec
);
int
snd_hda_codec_update_widgets
(
struct
hda_codec
*
codec
);
int
snd_hda_codec_update_widgets
(
struct
hda_codec
*
codec
);
...
...
sound/soc/codecs/hdac_hdmi.c
View file @
9a9b13dd
...
@@ -85,7 +85,7 @@ struct hdac_hdmi_pin {
...
@@ -85,7 +85,7 @@ struct hdac_hdmi_pin {
bool
mst_capable
;
bool
mst_capable
;
struct
hdac_hdmi_port
*
ports
;
struct
hdac_hdmi_port
*
ports
;
int
num_ports
;
int
num_ports
;
struct
hdac_
ext_device
*
e
dev
;
struct
hdac_
device
*
h
dev
;
};
};
struct
hdac_hdmi_port
{
struct
hdac_hdmi_port
{
...
@@ -126,6 +126,9 @@ struct hdac_hdmi_drv_data {
...
@@ -126,6 +126,9 @@ struct hdac_hdmi_drv_data {
};
};
struct
hdac_hdmi_priv
{
struct
hdac_hdmi_priv
{
struct
hdac_device
*
hdev
;
struct
snd_soc_component
*
component
;
struct
snd_card
*
card
;
struct
hdac_hdmi_dai_port_map
dai_map
[
HDA_MAX_CVTS
];
struct
hdac_hdmi_dai_port_map
dai_map
[
HDA_MAX_CVTS
];
struct
list_head
pin_list
;
struct
list_head
pin_list
;
struct
list_head
cvt_list
;
struct
list_head
cvt_list
;
...
@@ -139,7 +142,7 @@ struct hdac_hdmi_priv {
...
@@ -139,7 +142,7 @@ struct hdac_hdmi_priv {
struct
snd_soc_dai_driver
*
dai_drv
;
struct
snd_soc_dai_driver
*
dai_drv
;
};
};
#define hdev_to_hdmi_priv(_hdev)
((to_ehdac_device(_hdev))->private_data
)
#define hdev_to_hdmi_priv(_hdev)
dev_get_drvdata(&(_hdev)->dev
)
static
struct
hdac_hdmi_pcm
*
static
struct
hdac_hdmi_pcm
*
hdac_hdmi_get_pcm_from_cvt
(
struct
hdac_hdmi_priv
*
hdmi
,
hdac_hdmi_get_pcm_from_cvt
(
struct
hdac_hdmi_priv
*
hdmi
,
...
@@ -158,7 +161,7 @@ hdac_hdmi_get_pcm_from_cvt(struct hdac_hdmi_priv *hdmi,
...
@@ -158,7 +161,7 @@ hdac_hdmi_get_pcm_from_cvt(struct hdac_hdmi_priv *hdmi,
static
void
hdac_hdmi_jack_report
(
struct
hdac_hdmi_pcm
*
pcm
,
static
void
hdac_hdmi_jack_report
(
struct
hdac_hdmi_pcm
*
pcm
,
struct
hdac_hdmi_port
*
port
,
bool
is_connect
)
struct
hdac_hdmi_port
*
port
,
bool
is_connect
)
{
{
struct
hdac_
ext_device
*
edev
=
port
->
pin
->
e
dev
;
struct
hdac_
device
*
hdev
=
port
->
pin
->
h
dev
;
if
(
is_connect
)
if
(
is_connect
)
snd_soc_dapm_enable_pin
(
port
->
dapm
,
port
->
jack_pin
);
snd_soc_dapm_enable_pin
(
port
->
dapm
,
port
->
jack_pin
);
...
@@ -172,7 +175,7 @@ static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
...
@@ -172,7 +175,7 @@ static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
* ports.
* ports.
*/
*/
if
(
pcm
->
jack_event
==
0
)
{
if
(
pcm
->
jack_event
==
0
)
{
dev_dbg
(
&
edev
->
hdev
.
dev
,
dev_dbg
(
&
hdev
->
dev
,
"jack report for pcm=%d
\n
"
,
"jack report for pcm=%d
\n
"
,
pcm
->
pcm_id
);
pcm
->
pcm_id
);
snd_soc_jack_report
(
pcm
->
jack
,
SND_JACK_AVOUT
,
snd_soc_jack_report
(
pcm
->
jack
,
SND_JACK_AVOUT
,
...
@@ -198,19 +201,18 @@ static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
...
@@ -198,19 +201,18 @@ static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
/*
/*
* Get the no devices that can be connected to a port on the Pin widget.
* Get the no devices that can be connected to a port on the Pin widget.
*/
*/
static
int
hdac_hdmi_get_port_len
(
struct
hdac_
ext_device
*
e
dev
,
hda_nid_t
nid
)
static
int
hdac_hdmi_get_port_len
(
struct
hdac_
device
*
h
dev
,
hda_nid_t
nid
)
{
{
unsigned
int
caps
;
unsigned
int
caps
;
unsigned
int
type
,
param
;
unsigned
int
type
,
param
;
caps
=
get_wcaps
(
&
edev
->
hdev
,
nid
);
caps
=
get_wcaps
(
hdev
,
nid
);
type
=
get_wcaps_type
(
caps
);
type
=
get_wcaps_type
(
caps
);
if
(
!
(
caps
&
AC_WCAP_DIGITAL
)
||
(
type
!=
AC_WID_PIN
))
if
(
!
(
caps
&
AC_WCAP_DIGITAL
)
||
(
type
!=
AC_WID_PIN
))
return
0
;
return
0
;
param
=
snd_hdac_read_parm_uncached
(
&
edev
->
hdev
,
nid
,
param
=
snd_hdac_read_parm_uncached
(
hdev
,
nid
,
AC_PAR_DEVLIST_LEN
);
AC_PAR_DEVLIST_LEN
);
if
(
param
==
-
1
)
if
(
param
==
-
1
)
return
param
;
return
param
;
...
@@ -222,10 +224,10 @@ static int hdac_hdmi_get_port_len(struct hdac_ext_device *edev, hda_nid_t nid)
...
@@ -222,10 +224,10 @@ static int hdac_hdmi_get_port_len(struct hdac_ext_device *edev, hda_nid_t nid)
* id selected on the pin. Return 0 means the first port entry
* id selected on the pin. Return 0 means the first port entry
* is selected or MST is not supported.
* is selected or MST is not supported.
*/
*/
static
int
hdac_hdmi_port_select_get
(
struct
hdac_
ext_device
*
e
dev
,
static
int
hdac_hdmi_port_select_get
(
struct
hdac_
device
*
h
dev
,
struct
hdac_hdmi_port
*
port
)
struct
hdac_hdmi_port
*
port
)
{
{
return
snd_hdac_codec_read
(
&
edev
->
hdev
,
port
->
pin
->
nid
,
return
snd_hdac_codec_read
(
hdev
,
port
->
pin
->
nid
,
0
,
AC_VERB_GET_DEVICE_SEL
,
0
);
0
,
AC_VERB_GET_DEVICE_SEL
,
0
);
}
}
...
@@ -233,7 +235,7 @@ static int hdac_hdmi_port_select_get(struct hdac_ext_device *edev,
...
@@ -233,7 +235,7 @@ static int hdac_hdmi_port_select_get(struct hdac_ext_device *edev,
* Sets the selected port entry for the configuring Pin widget verb.
* Sets the selected port entry for the configuring Pin widget verb.
* returns error if port set is not equal to port get otherwise success
* returns error if port set is not equal to port get otherwise success
*/
*/
static
int
hdac_hdmi_port_select_set
(
struct
hdac_
ext_device
*
e
dev
,
static
int
hdac_hdmi_port_select_set
(
struct
hdac_
device
*
h
dev
,
struct
hdac_hdmi_port
*
port
)
struct
hdac_hdmi_port
*
port
)
{
{
int
num_ports
;
int
num_ports
;
...
@@ -242,8 +244,7 @@ static int hdac_hdmi_port_select_set(struct hdac_ext_device *edev,
...
@@ -242,8 +244,7 @@ static int hdac_hdmi_port_select_set(struct hdac_ext_device *edev,
return
0
;
return
0
;
/* AC_PAR_DEVLIST_LEN is 0 based. */
/* AC_PAR_DEVLIST_LEN is 0 based. */
num_ports
=
hdac_hdmi_get_port_len
(
edev
,
port
->
pin
->
nid
);
num_ports
=
hdac_hdmi_get_port_len
(
hdev
,
port
->
pin
->
nid
);
if
(
num_ports
<
0
)
if
(
num_ports
<
0
)
return
-
EIO
;
return
-
EIO
;
/*
/*
...
@@ -253,13 +254,13 @@ static int hdac_hdmi_port_select_set(struct hdac_ext_device *edev,
...
@@ -253,13 +254,13 @@ static int hdac_hdmi_port_select_set(struct hdac_ext_device *edev,
if
(
num_ports
+
1
<
port
->
id
)
if
(
num_ports
+
1
<
port
->
id
)
return
0
;
return
0
;
snd_hdac_codec_write
(
&
edev
->
hdev
,
port
->
pin
->
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
port
->
pin
->
nid
,
0
,
AC_VERB_SET_DEVICE_SEL
,
port
->
id
);
AC_VERB_SET_DEVICE_SEL
,
port
->
id
);
if
(
port
->
id
!=
hdac_hdmi_port_select_get
(
e
dev
,
port
))
if
(
port
->
id
!=
hdac_hdmi_port_select_get
(
h
dev
,
port
))
return
-
EIO
;
return
-
EIO
;
dev_dbg
(
&
edev
->
hdev
.
dev
,
"Selected the port=%d
\n
"
,
port
->
id
);
dev_dbg
(
&
hdev
->
dev
,
"Selected the port=%d
\n
"
,
port
->
id
);
return
0
;
return
0
;
}
}
...
@@ -277,13 +278,6 @@ static struct hdac_hdmi_pcm *get_hdmi_pcm_from_id(struct hdac_hdmi_priv *hdmi,
...
@@ -277,13 +278,6 @@ static struct hdac_hdmi_pcm *get_hdmi_pcm_from_id(struct hdac_hdmi_priv *hdmi,
return
NULL
;
return
NULL
;
}
}
static
inline
struct
hdac_ext_device
*
to_hda_ext_device
(
struct
device
*
dev
)
{
struct
hdac_device
*
hdev
=
dev_to_hdac_dev
(
dev
);
return
to_ehdac_device
(
hdev
);
}
static
unsigned
int
sad_format
(
const
u8
*
sad
)
static
unsigned
int
sad_format
(
const
u8
*
sad
)
{
{
return
((
sad
[
0
]
>>
0x3
)
&
0x1f
);
return
((
sad
[
0
]
>>
0x3
)
&
0x1f
);
...
@@ -324,15 +318,13 @@ static int hdac_hdmi_eld_limit_formats(struct snd_pcm_runtime *runtime,
...
@@ -324,15 +318,13 @@ static int hdac_hdmi_eld_limit_formats(struct snd_pcm_runtime *runtime,
}
}
static
void
static
void
hdac_hdmi_set_dip_index
(
struct
hdac_
ext_device
*
e
dev
,
hda_nid_t
pin_nid
,
hdac_hdmi_set_dip_index
(
struct
hdac_
device
*
h
dev
,
hda_nid_t
pin_nid
,
int
packet_index
,
int
byte_index
)
int
packet_index
,
int
byte_index
)
{
{
int
val
;
int
val
;
val
=
(
packet_index
<<
5
)
|
(
byte_index
&
0x1f
);
val
=
(
packet_index
<<
5
)
|
(
byte_index
&
0x1f
);
snd_hdac_codec_write
(
hdev
,
pin_nid
,
0
,
AC_VERB_SET_HDMI_DIP_INDEX
,
val
);
snd_hdac_codec_write
(
&
edev
->
hdev
,
pin_nid
,
0
,
AC_VERB_SET_HDMI_DIP_INDEX
,
val
);
}
}
struct
dp_audio_infoframe
{
struct
dp_audio_infoframe
{
...
@@ -347,14 +339,14 @@ struct dp_audio_infoframe {
...
@@ -347,14 +339,14 @@ struct dp_audio_infoframe {
u8
LFEPBL01_LSV36_DM_INH7
;
u8
LFEPBL01_LSV36_DM_INH7
;
};
};
static
int
hdac_hdmi_setup_audio_infoframe
(
struct
hdac_
ext_device
*
e
dev
,
static
int
hdac_hdmi_setup_audio_infoframe
(
struct
hdac_
device
*
h
dev
,
struct
hdac_hdmi_pcm
*
pcm
,
struct
hdac_hdmi_port
*
port
)
struct
hdac_hdmi_pcm
*
pcm
,
struct
hdac_hdmi_port
*
port
)
{
{
uint8_t
buffer
[
HDMI_INFOFRAME_HEADER_SIZE
+
HDMI_AUDIO_INFOFRAME_SIZE
];
uint8_t
buffer
[
HDMI_INFOFRAME_HEADER_SIZE
+
HDMI_AUDIO_INFOFRAME_SIZE
];
struct
hdmi_audio_infoframe
frame
;
struct
hdmi_audio_infoframe
frame
;
struct
hdac_hdmi_pin
*
pin
=
port
->
pin
;
struct
hdac_hdmi_pin
*
pin
=
port
->
pin
;
struct
dp_audio_infoframe
dp_ai
;
struct
dp_audio_infoframe
dp_ai
;
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_hdmi_cvt
*
cvt
=
pcm
->
cvt
;
struct
hdac_hdmi_cvt
*
cvt
=
pcm
->
cvt
;
u8
*
dip
;
u8
*
dip
;
int
ret
;
int
ret
;
...
@@ -363,11 +355,11 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *edev,
...
@@ -363,11 +355,11 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *edev,
u8
conn_type
;
u8
conn_type
;
int
channels
,
ca
;
int
channels
,
ca
;
ca
=
snd_hdac_channel_allocation
(
&
edev
->
hdev
,
port
->
eld
.
info
.
spk_alloc
,
ca
=
snd_hdac_channel_allocation
(
hdev
,
port
->
eld
.
info
.
spk_alloc
,
pcm
->
channels
,
pcm
->
chmap_set
,
true
,
pcm
->
chmap
);
pcm
->
channels
,
pcm
->
chmap_set
,
true
,
pcm
->
chmap
);
channels
=
snd_hdac_get_active_channels
(
ca
);
channels
=
snd_hdac_get_active_channels
(
ca
);
hdmi
->
chmap
.
ops
.
set_channel_count
(
&
edev
->
hdev
,
cvt
->
nid
,
channels
);
hdmi
->
chmap
.
ops
.
set_channel_count
(
hdev
,
cvt
->
nid
,
channels
);
snd_hdac_setup_channel_mapping
(
&
hdmi
->
chmap
,
pin
->
nid
,
false
,
ca
,
snd_hdac_setup_channel_mapping
(
&
hdmi
->
chmap
,
pin
->
nid
,
false
,
ca
,
pcm
->
channels
,
pcm
->
chmap
,
pcm
->
chmap_set
);
pcm
->
channels
,
pcm
->
chmap
,
pcm
->
chmap_set
);
...
@@ -400,32 +392,31 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *edev,
...
@@ -400,32 +392,31 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *edev,
break
;
break
;
default:
default:
dev_err
(
&
edev
->
hdev
.
dev
,
"Invalid connection type: %d
\n
"
,
dev_err
(
&
hdev
->
dev
,
"Invalid connection type: %d
\n
"
,
conn_type
);
conn_type
);
return
-
EIO
;
return
-
EIO
;
}
}
/* stop infoframe transmission */
/* stop infoframe transmission */
hdac_hdmi_set_dip_index
(
e
dev
,
pin
->
nid
,
0x0
,
0x0
);
hdac_hdmi_set_dip_index
(
h
dev
,
pin
->
nid
,
0x0
,
0x0
);
snd_hdac_codec_write
(
&
edev
->
hdev
,
pin
->
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
pin
->
nid
,
0
,
AC_VERB_SET_HDMI_DIP_XMIT
,
AC_DIPXMIT_DISABLE
);
AC_VERB_SET_HDMI_DIP_XMIT
,
AC_DIPXMIT_DISABLE
);
/* Fill infoframe. Index auto-incremented */
/* Fill infoframe. Index auto-incremented */
hdac_hdmi_set_dip_index
(
e
dev
,
pin
->
nid
,
0x0
,
0x0
);
hdac_hdmi_set_dip_index
(
h
dev
,
pin
->
nid
,
0x0
,
0x0
);
if
(
conn_type
==
DRM_ELD_CONN_TYPE_HDMI
)
{
if
(
conn_type
==
DRM_ELD_CONN_TYPE_HDMI
)
{
for
(
i
=
0
;
i
<
sizeof
(
buffer
);
i
++
)
for
(
i
=
0
;
i
<
sizeof
(
buffer
);
i
++
)
snd_hdac_codec_write
(
&
edev
->
hdev
,
pin
->
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
pin
->
nid
,
0
,
AC_VERB_SET_HDMI_DIP_DATA
,
buffer
[
i
]);
AC_VERB_SET_HDMI_DIP_DATA
,
buffer
[
i
]);
}
else
{
}
else
{
for
(
i
=
0
;
i
<
sizeof
(
dp_ai
);
i
++
)
for
(
i
=
0
;
i
<
sizeof
(
dp_ai
);
i
++
)
snd_hdac_codec_write
(
&
edev
->
hdev
,
pin
->
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
pin
->
nid
,
0
,
AC_VERB_SET_HDMI_DIP_DATA
,
dip
[
i
]);
AC_VERB_SET_HDMI_DIP_DATA
,
dip
[
i
]);
}
}
/* Start infoframe */
/* Start infoframe */
hdac_hdmi_set_dip_index
(
e
dev
,
pin
->
nid
,
0x0
,
0x0
);
hdac_hdmi_set_dip_index
(
h
dev
,
pin
->
nid
,
0x0
,
0x0
);
snd_hdac_codec_write
(
&
edev
->
hdev
,
pin
->
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
pin
->
nid
,
0
,
AC_VERB_SET_HDMI_DIP_XMIT
,
AC_DIPXMIT_BEST
);
AC_VERB_SET_HDMI_DIP_XMIT
,
AC_DIPXMIT_BEST
);
return
0
;
return
0
;
...
@@ -435,12 +426,12 @@ static int hdac_hdmi_set_tdm_slot(struct snd_soc_dai *dai,
...
@@ -435,12 +426,12 @@ static int hdac_hdmi_set_tdm_slot(struct snd_soc_dai *dai,
unsigned
int
tx_mask
,
unsigned
int
rx_mask
,
unsigned
int
tx_mask
,
unsigned
int
rx_mask
,
int
slots
,
int
slot_width
)
int
slots
,
int
slot_width
)
{
{
struct
hdac_
ext_device
*
edev
=
snd_soc_dai_get_drvdata
(
dai
);
struct
hdac_
hdmi_priv
*
hdmi
=
snd_soc_dai_get_drvdata
(
dai
);
struct
hdac_
hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
)
;
struct
hdac_
device
*
hdev
=
hdmi
->
hdev
;
struct
hdac_hdmi_dai_port_map
*
dai_map
;
struct
hdac_hdmi_dai_port_map
*
dai_map
;
struct
hdac_hdmi_pcm
*
pcm
;
struct
hdac_hdmi_pcm
*
pcm
;
dev_dbg
(
&
edev
->
hdev
.
dev
,
"%s: strm_tag: %d
\n
"
,
__func__
,
tx_mask
);
dev_dbg
(
&
hdev
->
dev
,
"%s: strm_tag: %d
\n
"
,
__func__
,
tx_mask
);
dai_map
=
&
hdmi
->
dai_map
[
dai
->
id
];
dai_map
=
&
hdmi
->
dai_map
[
dai
->
id
];
...
@@ -455,8 +446,8 @@ static int hdac_hdmi_set_tdm_slot(struct snd_soc_dai *dai,
...
@@ -455,8 +446,8 @@ static int hdac_hdmi_set_tdm_slot(struct snd_soc_dai *dai,
static
int
hdac_hdmi_set_hw_params
(
struct
snd_pcm_substream
*
substream
,
static
int
hdac_hdmi_set_hw_params
(
struct
snd_pcm_substream
*
substream
,
struct
snd_pcm_hw_params
*
hparams
,
struct
snd_soc_dai
*
dai
)
struct
snd_pcm_hw_params
*
hparams
,
struct
snd_soc_dai
*
dai
)
{
{
struct
hdac_
ext_device
*
edev
=
snd_soc_dai_get_drvdata
(
dai
);
struct
hdac_
hdmi_priv
*
hdmi
=
snd_soc_dai_get_drvdata
(
dai
);
struct
hdac_
hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
)
;
struct
hdac_
device
*
hdev
=
hdmi
->
hdev
;
struct
hdac_hdmi_dai_port_map
*
dai_map
;
struct
hdac_hdmi_dai_port_map
*
dai_map
;
struct
hdac_hdmi_port
*
port
;
struct
hdac_hdmi_port
*
port
;
struct
hdac_hdmi_pcm
*
pcm
;
struct
hdac_hdmi_pcm
*
pcm
;
...
@@ -469,7 +460,7 @@ static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream,
...
@@ -469,7 +460,7 @@ static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream,
return
-
ENODEV
;
return
-
ENODEV
;
if
((
!
port
->
eld
.
monitor_present
)
||
(
!
port
->
eld
.
eld_valid
))
{
if
((
!
port
->
eld
.
monitor_present
)
||
(
!
port
->
eld
.
eld_valid
))
{
dev_err
(
&
edev
->
hdev
.
dev
,
dev_err
(
&
hdev
->
dev
,
"device is not configured for this pin:port%d:%d
\n
"
,
"device is not configured for this pin:port%d:%d
\n
"
,
port
->
pin
->
nid
,
port
->
id
);
port
->
pin
->
nid
,
port
->
id
);
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -489,28 +480,28 @@ static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream,
...
@@ -489,28 +480,28 @@ static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream,
return
0
;
return
0
;
}
}
static
int
hdac_hdmi_query_port_connlist
(
struct
hdac_
ext_device
*
e
dev
,
static
int
hdac_hdmi_query_port_connlist
(
struct
hdac_
device
*
h
dev
,
struct
hdac_hdmi_pin
*
pin
,
struct
hdac_hdmi_pin
*
pin
,
struct
hdac_hdmi_port
*
port
)
struct
hdac_hdmi_port
*
port
)
{
{
if
(
!
(
get_wcaps
(
&
edev
->
hdev
,
pin
->
nid
)
&
AC_WCAP_CONN_LIST
))
{
if
(
!
(
get_wcaps
(
hdev
,
pin
->
nid
)
&
AC_WCAP_CONN_LIST
))
{
dev_warn
(
&
edev
->
hdev
.
dev
,
dev_warn
(
&
hdev
->
dev
,
"HDMI: pin %d wcaps %#x does not support connection list
\n
"
,
"HDMI: pin %d wcaps %#x does not support connection list
\n
"
,
pin
->
nid
,
get_wcaps
(
&
edev
->
hdev
,
pin
->
nid
));
pin
->
nid
,
get_wcaps
(
hdev
,
pin
->
nid
));
return
-
EINVAL
;
return
-
EINVAL
;
}
}
if
(
hdac_hdmi_port_select_set
(
e
dev
,
port
)
<
0
)
if
(
hdac_hdmi_port_select_set
(
h
dev
,
port
)
<
0
)
return
-
EIO
;
return
-
EIO
;
port
->
num_mux_nids
=
snd_hdac_get_connections
(
&
edev
->
hdev
,
pin
->
nid
,
port
->
num_mux_nids
=
snd_hdac_get_connections
(
hdev
,
pin
->
nid
,
port
->
mux_nids
,
HDA_MAX_CONNECTIONS
);
port
->
mux_nids
,
HDA_MAX_CONNECTIONS
);
if
(
port
->
num_mux_nids
==
0
)
if
(
port
->
num_mux_nids
==
0
)
dev_warn
(
&
edev
->
hdev
.
dev
,
dev_warn
(
&
hdev
->
dev
,
"No connections found for pin:port %d:%d
\n
"
,
"No connections found for pin:port %d:%d
\n
"
,
pin
->
nid
,
port
->
id
);
pin
->
nid
,
port
->
id
);
dev_dbg
(
&
edev
->
hdev
.
dev
,
"num_mux_nids %d for pin:port %d:%d
\n
"
,
dev_dbg
(
&
hdev
->
dev
,
"num_mux_nids %d for pin:port %d:%d
\n
"
,
port
->
num_mux_nids
,
pin
->
nid
,
port
->
id
);
port
->
num_mux_nids
,
pin
->
nid
,
port
->
id
);
return
port
->
num_mux_nids
;
return
port
->
num_mux_nids
;
...
@@ -526,7 +517,7 @@ static int hdac_hdmi_query_port_connlist(struct hdac_ext_device *edev,
...
@@ -526,7 +517,7 @@ static int hdac_hdmi_query_port_connlist(struct hdac_ext_device *edev,
* connected.
* connected.
*/
*/
static
struct
hdac_hdmi_port
*
hdac_hdmi_get_port_from_cvt
(
static
struct
hdac_hdmi_port
*
hdac_hdmi_get_port_from_cvt
(
struct
hdac_
ext_device
*
e
dev
,
struct
hdac_
device
*
h
dev
,
struct
hdac_hdmi_priv
*
hdmi
,
struct
hdac_hdmi_priv
*
hdmi
,
struct
hdac_hdmi_cvt
*
cvt
)
struct
hdac_hdmi_cvt
*
cvt
)
{
{
...
@@ -541,7 +532,7 @@ static struct hdac_hdmi_port *hdac_hdmi_get_port_from_cvt(
...
@@ -541,7 +532,7 @@ static struct hdac_hdmi_port *hdac_hdmi_get_port_from_cvt(
list_for_each_entry
(
port
,
&
pcm
->
port_list
,
head
)
{
list_for_each_entry
(
port
,
&
pcm
->
port_list
,
head
)
{
mutex_lock
(
&
pcm
->
lock
);
mutex_lock
(
&
pcm
->
lock
);
ret
=
hdac_hdmi_query_port_connlist
(
e
dev
,
ret
=
hdac_hdmi_query_port_connlist
(
h
dev
,
port
->
pin
,
port
);
port
->
pin
,
port
);
mutex_unlock
(
&
pcm
->
lock
);
mutex_unlock
(
&
pcm
->
lock
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
@@ -568,8 +559,8 @@ static struct hdac_hdmi_port *hdac_hdmi_get_port_from_cvt(
...
@@ -568,8 +559,8 @@ static struct hdac_hdmi_port *hdac_hdmi_get_port_from_cvt(
static
int
hdac_hdmi_pcm_open
(
struct
snd_pcm_substream
*
substream
,
static
int
hdac_hdmi_pcm_open
(
struct
snd_pcm_substream
*
substream
,
struct
snd_soc_dai
*
dai
)
struct
snd_soc_dai
*
dai
)
{
{
struct
hdac_
ext_device
*
edev
=
snd_soc_dai_get_drvdata
(
dai
);
struct
hdac_
hdmi_priv
*
hdmi
=
snd_soc_dai_get_drvdata
(
dai
);
struct
hdac_
hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
)
;
struct
hdac_
device
*
hdev
=
hdmi
->
hdev
;
struct
hdac_hdmi_dai_port_map
*
dai_map
;
struct
hdac_hdmi_dai_port_map
*
dai_map
;
struct
hdac_hdmi_cvt
*
cvt
;
struct
hdac_hdmi_cvt
*
cvt
;
struct
hdac_hdmi_port
*
port
;
struct
hdac_hdmi_port
*
port
;
...
@@ -578,7 +569,7 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
...
@@ -578,7 +569,7 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
dai_map
=
&
hdmi
->
dai_map
[
dai
->
id
];
dai_map
=
&
hdmi
->
dai_map
[
dai
->
id
];
cvt
=
dai_map
->
cvt
;
cvt
=
dai_map
->
cvt
;
port
=
hdac_hdmi_get_port_from_cvt
(
e
dev
,
hdmi
,
cvt
);
port
=
hdac_hdmi_get_port_from_cvt
(
h
dev
,
hdmi
,
cvt
);
/*
/*
* To make PA and other userland happy.
* To make PA and other userland happy.
...
@@ -589,7 +580,7 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
...
@@ -589,7 +580,7 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
if
((
!
port
->
eld
.
monitor_present
)
||
if
((
!
port
->
eld
.
monitor_present
)
||
(
!
port
->
eld
.
eld_valid
))
{
(
!
port
->
eld
.
eld_valid
))
{
dev_warn
(
&
edev
->
hdev
.
dev
,
dev_warn
(
&
hdev
->
dev
,
"Failed: present?:%d ELD valid?:%d pin:port: %d:%d
\n
"
,
"Failed: present?:%d ELD valid?:%d pin:port: %d:%d
\n
"
,
port
->
eld
.
monitor_present
,
port
->
eld
.
eld_valid
,
port
->
eld
.
monitor_present
,
port
->
eld
.
eld_valid
,
port
->
pin
->
nid
,
port
->
id
);
port
->
pin
->
nid
,
port
->
id
);
...
@@ -611,8 +602,7 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
...
@@ -611,8 +602,7 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
static
void
hdac_hdmi_pcm_close
(
struct
snd_pcm_substream
*
substream
,
static
void
hdac_hdmi_pcm_close
(
struct
snd_pcm_substream
*
substream
,
struct
snd_soc_dai
*
dai
)
struct
snd_soc_dai
*
dai
)
{
{
struct
hdac_ext_device
*
edev
=
snd_soc_dai_get_drvdata
(
dai
);
struct
hdac_hdmi_priv
*
hdmi
=
snd_soc_dai_get_drvdata
(
dai
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_dai_port_map
*
dai_map
;
struct
hdac_hdmi_dai_port_map
*
dai_map
;
struct
hdac_hdmi_pcm
*
pcm
;
struct
hdac_hdmi_pcm
*
pcm
;
...
@@ -695,10 +685,10 @@ static void hdac_hdmi_fill_route(struct snd_soc_dapm_route *route,
...
@@ -695,10 +685,10 @@ static void hdac_hdmi_fill_route(struct snd_soc_dapm_route *route,
route
->
connected
=
handler
;
route
->
connected
=
handler
;
}
}
static
struct
hdac_hdmi_pcm
*
hdac_hdmi_get_pcm
(
struct
hdac_
ext_device
*
e
dev
,
static
struct
hdac_hdmi_pcm
*
hdac_hdmi_get_pcm
(
struct
hdac_
device
*
h
dev
,
struct
hdac_hdmi_port
*
port
)
struct
hdac_hdmi_port
*
port
)
{
{
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_hdmi_pcm
*
pcm
=
NULL
;
struct
hdac_hdmi_pcm
*
pcm
=
NULL
;
struct
hdac_hdmi_port
*
p
;
struct
hdac_hdmi_port
*
p
;
...
@@ -715,33 +705,32 @@ static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(struct hdac_ext_device *edev,
...
@@ -715,33 +705,32 @@ static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(struct hdac_ext_device *edev,
return
NULL
;
return
NULL
;
}
}
static
void
hdac_hdmi_set_power_state
(
struct
hdac_
ext_device
*
e
dev
,
static
void
hdac_hdmi_set_power_state
(
struct
hdac_
device
*
h
dev
,
hda_nid_t
nid
,
unsigned
int
pwr_state
)
hda_nid_t
nid
,
unsigned
int
pwr_state
)
{
{
int
count
;
int
count
;
unsigned
int
state
;
unsigned
int
state
;
if
(
get_wcaps
(
&
edev
->
hdev
,
nid
)
&
AC_WCAP_POWER
)
{
if
(
get_wcaps
(
hdev
,
nid
)
&
AC_WCAP_POWER
)
{
if
(
!
snd_hdac_check_power_state
(
&
edev
->
hdev
,
nid
,
pwr_state
))
{
if
(
!
snd_hdac_check_power_state
(
hdev
,
nid
,
pwr_state
))
{
for
(
count
=
0
;
count
<
10
;
count
++
)
{
for
(
count
=
0
;
count
<
10
;
count
++
)
{
snd_hdac_codec_read
(
&
edev
->
hdev
,
nid
,
0
,
snd_hdac_codec_read
(
hdev
,
nid
,
0
,
AC_VERB_SET_POWER_STATE
,
AC_VERB_SET_POWER_STATE
,
pwr_state
);
pwr_state
);
state
=
snd_hdac_sync_power_state
(
&
edev
->
hdev
,
state
=
snd_hdac_sync_power_state
(
hdev
,
nid
,
pwr_state
);
nid
,
pwr_state
);
if
(
!
(
state
&
AC_PWRST_ERROR
))
if
(
!
(
state
&
AC_PWRST_ERROR
))
break
;
break
;
}
}
}
}
}
}
}
}
static
void
hdac_hdmi_set_amp
(
struct
hdac_
ext_device
*
e
dev
,
static
void
hdac_hdmi_set_amp
(
struct
hdac_
device
*
h
dev
,
hda_nid_t
nid
,
int
val
)
hda_nid_t
nid
,
int
val
)
{
{
if
(
get_wcaps
(
&
edev
->
hdev
,
nid
)
&
AC_WCAP_OUT_AMP
)
if
(
get_wcaps
(
hdev
,
nid
)
&
AC_WCAP_OUT_AMP
)
snd_hdac_codec_write
(
&
edev
->
hdev
,
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
nid
,
0
,
AC_VERB_SET_AMP_GAIN_MUTE
,
val
);
AC_VERB_SET_AMP_GAIN_MUTE
,
val
);
}
}
...
@@ -750,40 +739,40 @@ static int hdac_hdmi_pin_output_widget_event(struct snd_soc_dapm_widget *w,
...
@@ -750,40 +739,40 @@ static int hdac_hdmi_pin_output_widget_event(struct snd_soc_dapm_widget *w,
struct
snd_kcontrol
*
kc
,
int
event
)
struct
snd_kcontrol
*
kc
,
int
event
)
{
{
struct
hdac_hdmi_port
*
port
=
w
->
priv
;
struct
hdac_hdmi_port
*
port
=
w
->
priv
;
struct
hdac_
ext_device
*
edev
=
to_hda_ext_device
(
w
->
dapm
->
dev
);
struct
hdac_
device
*
hdev
=
dev_to_hdac_dev
(
w
->
dapm
->
dev
);
struct
hdac_hdmi_pcm
*
pcm
;
struct
hdac_hdmi_pcm
*
pcm
;
dev_dbg
(
&
edev
->
hdev
.
dev
,
"%s: widget: %s event: %x
\n
"
,
dev_dbg
(
&
hdev
->
dev
,
"%s: widget: %s event: %x
\n
"
,
__func__
,
w
->
name
,
event
);
__func__
,
w
->
name
,
event
);
pcm
=
hdac_hdmi_get_pcm
(
e
dev
,
port
);
pcm
=
hdac_hdmi_get_pcm
(
h
dev
,
port
);
if
(
!
pcm
)
if
(
!
pcm
)
return
-
EIO
;
return
-
EIO
;
/* set the device if pin is mst_capable */
/* set the device if pin is mst_capable */
if
(
hdac_hdmi_port_select_set
(
e
dev
,
port
)
<
0
)
if
(
hdac_hdmi_port_select_set
(
h
dev
,
port
)
<
0
)
return
-
EIO
;
return
-
EIO
;
switch
(
event
)
{
switch
(
event
)
{
case
SND_SOC_DAPM_PRE_PMU
:
case
SND_SOC_DAPM_PRE_PMU
:
hdac_hdmi_set_power_state
(
e
dev
,
port
->
pin
->
nid
,
AC_PWRST_D0
);
hdac_hdmi_set_power_state
(
h
dev
,
port
->
pin
->
nid
,
AC_PWRST_D0
);
/* Enable out path for this pin widget */
/* Enable out path for this pin widget */
snd_hdac_codec_write
(
&
edev
->
hdev
,
port
->
pin
->
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
port
->
pin
->
nid
,
0
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
PIN_OUT
);
AC_VERB_SET_PIN_WIDGET_CONTROL
,
PIN_OUT
);
hdac_hdmi_set_amp
(
e
dev
,
port
->
pin
->
nid
,
AMP_OUT_UNMUTE
);
hdac_hdmi_set_amp
(
h
dev
,
port
->
pin
->
nid
,
AMP_OUT_UNMUTE
);
return
hdac_hdmi_setup_audio_infoframe
(
e
dev
,
pcm
,
port
);
return
hdac_hdmi_setup_audio_infoframe
(
h
dev
,
pcm
,
port
);
case
SND_SOC_DAPM_POST_PMD
:
case
SND_SOC_DAPM_POST_PMD
:
hdac_hdmi_set_amp
(
e
dev
,
port
->
pin
->
nid
,
AMP_OUT_MUTE
);
hdac_hdmi_set_amp
(
h
dev
,
port
->
pin
->
nid
,
AMP_OUT_MUTE
);
/* Disable out path for this pin widget */
/* Disable out path for this pin widget */
snd_hdac_codec_write
(
&
edev
->
hdev
,
port
->
pin
->
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
port
->
pin
->
nid
,
0
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
0
);
AC_VERB_SET_PIN_WIDGET_CONTROL
,
0
);
hdac_hdmi_set_power_state
(
e
dev
,
port
->
pin
->
nid
,
AC_PWRST_D3
);
hdac_hdmi_set_power_state
(
h
dev
,
port
->
pin
->
nid
,
AC_PWRST_D3
);
break
;
break
;
}
}
...
@@ -795,11 +784,11 @@ static int hdac_hdmi_cvt_output_widget_event(struct snd_soc_dapm_widget *w,
...
@@ -795,11 +784,11 @@ static int hdac_hdmi_cvt_output_widget_event(struct snd_soc_dapm_widget *w,
struct
snd_kcontrol
*
kc
,
int
event
)
struct
snd_kcontrol
*
kc
,
int
event
)
{
{
struct
hdac_hdmi_cvt
*
cvt
=
w
->
priv
;
struct
hdac_hdmi_cvt
*
cvt
=
w
->
priv
;
struct
hdac_
ext_device
*
edev
=
to_hda_ext_device
(
w
->
dapm
->
dev
);
struct
hdac_
device
*
hdev
=
dev_to_hdac_dev
(
w
->
dapm
->
dev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_hdmi_pcm
*
pcm
;
struct
hdac_hdmi_pcm
*
pcm
;
dev_dbg
(
&
edev
->
hdev
.
dev
,
"%s: widget: %s event: %x
\n
"
,
dev_dbg
(
&
hdev
->
dev
,
"%s: widget: %s event: %x
\n
"
,
__func__
,
w
->
name
,
event
);
__func__
,
w
->
name
,
event
);
pcm
=
hdac_hdmi_get_pcm_from_cvt
(
hdmi
,
cvt
);
pcm
=
hdac_hdmi_get_pcm_from_cvt
(
hdmi
,
cvt
);
...
@@ -808,29 +797,29 @@ static int hdac_hdmi_cvt_output_widget_event(struct snd_soc_dapm_widget *w,
...
@@ -808,29 +797,29 @@ static int hdac_hdmi_cvt_output_widget_event(struct snd_soc_dapm_widget *w,
switch
(
event
)
{
switch
(
event
)
{
case
SND_SOC_DAPM_PRE_PMU
:
case
SND_SOC_DAPM_PRE_PMU
:
hdac_hdmi_set_power_state
(
e
dev
,
cvt
->
nid
,
AC_PWRST_D0
);
hdac_hdmi_set_power_state
(
h
dev
,
cvt
->
nid
,
AC_PWRST_D0
);
/* Enable transmission */
/* Enable transmission */
snd_hdac_codec_write
(
&
edev
->
hdev
,
cvt
->
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
cvt
->
nid
,
0
,
AC_VERB_SET_DIGI_CONVERT_1
,
1
);
AC_VERB_SET_DIGI_CONVERT_1
,
1
);
/* Category Code (CC) to zero */
/* Category Code (CC) to zero */
snd_hdac_codec_write
(
&
edev
->
hdev
,
cvt
->
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
cvt
->
nid
,
0
,
AC_VERB_SET_DIGI_CONVERT_2
,
0
);
AC_VERB_SET_DIGI_CONVERT_2
,
0
);
snd_hdac_codec_write
(
&
edev
->
hdev
,
cvt
->
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
cvt
->
nid
,
0
,
AC_VERB_SET_CHANNEL_STREAMID
,
pcm
->
stream_tag
);
AC_VERB_SET_CHANNEL_STREAMID
,
pcm
->
stream_tag
);
snd_hdac_codec_write
(
&
edev
->
hdev
,
cvt
->
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
cvt
->
nid
,
0
,
AC_VERB_SET_STREAM_FORMAT
,
pcm
->
format
);
AC_VERB_SET_STREAM_FORMAT
,
pcm
->
format
);
break
;
break
;
case
SND_SOC_DAPM_POST_PMD
:
case
SND_SOC_DAPM_POST_PMD
:
snd_hdac_codec_write
(
&
edev
->
hdev
,
cvt
->
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
cvt
->
nid
,
0
,
AC_VERB_SET_CHANNEL_STREAMID
,
0
);
AC_VERB_SET_CHANNEL_STREAMID
,
0
);
snd_hdac_codec_write
(
&
edev
->
hdev
,
cvt
->
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
cvt
->
nid
,
0
,
AC_VERB_SET_STREAM_FORMAT
,
0
);
AC_VERB_SET_STREAM_FORMAT
,
0
);
hdac_hdmi_set_power_state
(
e
dev
,
cvt
->
nid
,
AC_PWRST_D3
);
hdac_hdmi_set_power_state
(
h
dev
,
cvt
->
nid
,
AC_PWRST_D3
);
break
;
break
;
}
}
...
@@ -842,10 +831,10 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w,
...
@@ -842,10 +831,10 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w,
struct
snd_kcontrol
*
kc
,
int
event
)
struct
snd_kcontrol
*
kc
,
int
event
)
{
{
struct
hdac_hdmi_port
*
port
=
w
->
priv
;
struct
hdac_hdmi_port
*
port
=
w
->
priv
;
struct
hdac_
ext_device
*
edev
=
to_hda_ext_device
(
w
->
dapm
->
dev
);
struct
hdac_
device
*
hdev
=
dev_to_hdac_dev
(
w
->
dapm
->
dev
);
int
mux_idx
;
int
mux_idx
;
dev_dbg
(
&
edev
->
hdev
.
dev
,
"%s: widget: %s event: %x
\n
"
,
dev_dbg
(
&
hdev
->
dev
,
"%s: widget: %s event: %x
\n
"
,
__func__
,
w
->
name
,
event
);
__func__
,
w
->
name
,
event
);
if
(
!
kc
)
if
(
!
kc
)
...
@@ -854,11 +843,11 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w,
...
@@ -854,11 +843,11 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w,
mux_idx
=
dapm_kcontrol_get_value
(
kc
);
mux_idx
=
dapm_kcontrol_get_value
(
kc
);
/* set the device if pin is mst_capable */
/* set the device if pin is mst_capable */
if
(
hdac_hdmi_port_select_set
(
e
dev
,
port
)
<
0
)
if
(
hdac_hdmi_port_select_set
(
h
dev
,
port
)
<
0
)
return
-
EIO
;
return
-
EIO
;
if
(
mux_idx
>
0
)
{
if
(
mux_idx
>
0
)
{
snd_hdac_codec_write
(
&
edev
->
hdev
,
port
->
pin
->
nid
,
0
,
snd_hdac_codec_write
(
hdev
,
port
->
pin
->
nid
,
0
,
AC_VERB_SET_CONNECT_SEL
,
(
mux_idx
-
1
));
AC_VERB_SET_CONNECT_SEL
,
(
mux_idx
-
1
));
}
}
...
@@ -877,8 +866,8 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
...
@@ -877,8 +866,8 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
struct
snd_soc_dapm_widget
*
w
=
snd_soc_dapm_kcontrol_widget
(
kcontrol
);
struct
snd_soc_dapm_widget
*
w
=
snd_soc_dapm_kcontrol_widget
(
kcontrol
);
struct
snd_soc_dapm_context
*
dapm
=
w
->
dapm
;
struct
snd_soc_dapm_context
*
dapm
=
w
->
dapm
;
struct
hdac_hdmi_port
*
port
=
w
->
priv
;
struct
hdac_hdmi_port
*
port
=
w
->
priv
;
struct
hdac_
ext_device
*
edev
=
to_hda_ext_device
(
dapm
->
dev
);
struct
hdac_
device
*
hdev
=
dev_to_hdac_dev
(
dapm
->
dev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_hdmi_pcm
*
pcm
=
NULL
;
struct
hdac_hdmi_pcm
*
pcm
=
NULL
;
const
char
*
cvt_name
=
e
->
texts
[
ucontrol
->
value
.
enumerated
.
item
[
0
]];
const
char
*
cvt_name
=
e
->
texts
[
ucontrol
->
value
.
enumerated
.
item
[
0
]];
...
@@ -931,12 +920,12 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
...
@@ -931,12 +920,12 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
* care of selecting the right one and leaving all other inputs selected to
* care of selecting the right one and leaving all other inputs selected to
* "NONE"
* "NONE"
*/
*/
static
int
hdac_hdmi_create_pin_port_muxs
(
struct
hdac_
ext_device
*
e
dev
,
static
int
hdac_hdmi_create_pin_port_muxs
(
struct
hdac_
device
*
h
dev
,
struct
hdac_hdmi_port
*
port
,
struct
hdac_hdmi_port
*
port
,
struct
snd_soc_dapm_widget
*
widget
,
struct
snd_soc_dapm_widget
*
widget
,
const
char
*
widget_name
)
const
char
*
widget_name
)
{
{
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_hdmi_pin
*
pin
=
port
->
pin
;
struct
hdac_hdmi_pin
*
pin
=
port
->
pin
;
struct
snd_kcontrol_new
*
kc
;
struct
snd_kcontrol_new
*
kc
;
struct
hdac_hdmi_cvt
*
cvt
;
struct
hdac_hdmi_cvt
*
cvt
;
...
@@ -948,17 +937,17 @@ static int hdac_hdmi_create_pin_port_muxs(struct hdac_ext_device *edev,
...
@@ -948,17 +937,17 @@ static int hdac_hdmi_create_pin_port_muxs(struct hdac_ext_device *edev,
int
i
=
0
;
int
i
=
0
;
int
num_items
=
hdmi
->
num_cvt
+
1
;
int
num_items
=
hdmi
->
num_cvt
+
1
;
kc
=
devm_kzalloc
(
&
edev
->
hdev
.
dev
,
sizeof
(
*
kc
),
GFP_KERNEL
);
kc
=
devm_kzalloc
(
&
hdev
->
dev
,
sizeof
(
*
kc
),
GFP_KERNEL
);
if
(
!
kc
)
if
(
!
kc
)
return
-
ENOMEM
;
return
-
ENOMEM
;
se
=
devm_kzalloc
(
&
edev
->
hdev
.
dev
,
sizeof
(
*
se
),
GFP_KERNEL
);
se
=
devm_kzalloc
(
&
hdev
->
dev
,
sizeof
(
*
se
),
GFP_KERNEL
);
if
(
!
se
)
if
(
!
se
)
return
-
ENOMEM
;
return
-
ENOMEM
;
snprintf
(
kc_name
,
NAME_SIZE
,
"Pin %d port %d Input"
,
snprintf
(
kc_name
,
NAME_SIZE
,
"Pin %d port %d Input"
,
pin
->
nid
,
port
->
id
);
pin
->
nid
,
port
->
id
);
kc
->
name
=
devm_kstrdup
(
&
edev
->
hdev
.
dev
,
kc_name
,
GFP_KERNEL
);
kc
->
name
=
devm_kstrdup
(
&
hdev
->
dev
,
kc_name
,
GFP_KERNEL
);
if
(
!
kc
->
name
)
if
(
!
kc
->
name
)
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -976,35 +965,35 @@ static int hdac_hdmi_create_pin_port_muxs(struct hdac_ext_device *edev,
...
@@ -976,35 +965,35 @@ static int hdac_hdmi_create_pin_port_muxs(struct hdac_ext_device *edev,
se
->
mask
=
roundup_pow_of_two
(
se
->
items
)
-
1
;
se
->
mask
=
roundup_pow_of_two
(
se
->
items
)
-
1
;
sprintf
(
mux_items
,
"NONE"
);
sprintf
(
mux_items
,
"NONE"
);
items
[
i
]
=
devm_kstrdup
(
&
edev
->
hdev
.
dev
,
mux_items
,
GFP_KERNEL
);
items
[
i
]
=
devm_kstrdup
(
&
hdev
->
dev
,
mux_items
,
GFP_KERNEL
);
if
(
!
items
[
i
])
if
(
!
items
[
i
])
return
-
ENOMEM
;
return
-
ENOMEM
;
list_for_each_entry
(
cvt
,
&
hdmi
->
cvt_list
,
head
)
{
list_for_each_entry
(
cvt
,
&
hdmi
->
cvt_list
,
head
)
{
i
++
;
i
++
;
sprintf
(
mux_items
,
"cvt %d"
,
cvt
->
nid
);
sprintf
(
mux_items
,
"cvt %d"
,
cvt
->
nid
);
items
[
i
]
=
devm_kstrdup
(
&
edev
->
hdev
.
dev
,
mux_items
,
GFP_KERNEL
);
items
[
i
]
=
devm_kstrdup
(
&
hdev
->
dev
,
mux_items
,
GFP_KERNEL
);
if
(
!
items
[
i
])
if
(
!
items
[
i
])
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
se
->
texts
=
devm_kmemdup
(
&
edev
->
hdev
.
dev
,
items
,
se
->
texts
=
devm_kmemdup
(
&
hdev
->
dev
,
items
,
(
num_items
*
sizeof
(
char
*
)),
GFP_KERNEL
);
(
num_items
*
sizeof
(
char
*
)),
GFP_KERNEL
);
if
(
!
se
->
texts
)
if
(
!
se
->
texts
)
return
-
ENOMEM
;
return
-
ENOMEM
;
return
hdac_hdmi_fill_widget_info
(
&
edev
->
hdev
.
dev
,
widget
,
return
hdac_hdmi_fill_widget_info
(
&
hdev
->
dev
,
widget
,
snd_soc_dapm_mux
,
port
,
widget_name
,
NULL
,
kc
,
1
,
snd_soc_dapm_mux
,
port
,
widget_name
,
NULL
,
kc
,
1
,
hdac_hdmi_pin_mux_widget_event
,
hdac_hdmi_pin_mux_widget_event
,
SND_SOC_DAPM_PRE_PMU
|
SND_SOC_DAPM_POST_REG
);
SND_SOC_DAPM_PRE_PMU
|
SND_SOC_DAPM_POST_REG
);
}
}
/* Add cvt <- input <- mux route map */
/* Add cvt <- input <- mux route map */
static
void
hdac_hdmi_add_pinmux_cvt_route
(
struct
hdac_
ext_device
*
e
dev
,
static
void
hdac_hdmi_add_pinmux_cvt_route
(
struct
hdac_
device
*
h
dev
,
struct
snd_soc_dapm_widget
*
widgets
,
struct
snd_soc_dapm_widget
*
widgets
,
struct
snd_soc_dapm_route
*
route
,
int
rindex
)
struct
snd_soc_dapm_route
*
route
,
int
rindex
)
{
{
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
const
struct
snd_kcontrol_new
*
kc
;
const
struct
snd_kcontrol_new
*
kc
;
struct
soc_enum
*
se
;
struct
soc_enum
*
se
;
int
mux_index
=
hdmi
->
num_cvt
+
hdmi
->
num_ports
;
int
mux_index
=
hdmi
->
num_cvt
+
hdmi
->
num_ports
;
...
@@ -1046,8 +1035,8 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm)
...
@@ -1046,8 +1035,8 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm)
{
{
struct
snd_soc_dapm_widget
*
widgets
;
struct
snd_soc_dapm_widget
*
widgets
;
struct
snd_soc_dapm_route
*
route
;
struct
snd_soc_dapm_route
*
route
;
struct
hdac_
ext_device
*
edev
=
to_hda_ext_device
(
dapm
->
dev
);
struct
hdac_
device
*
hdev
=
dev_to_hdac_dev
(
dapm
->
dev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
snd_soc_dai_driver
*
dai_drv
=
hdmi
->
dai_drv
;
struct
snd_soc_dai_driver
*
dai_drv
=
hdmi
->
dai_drv
;
char
widget_name
[
NAME_SIZE
];
char
widget_name
[
NAME_SIZE
];
struct
hdac_hdmi_cvt
*
cvt
;
struct
hdac_hdmi_cvt
*
cvt
;
...
@@ -1099,7 +1088,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm)
...
@@ -1099,7 +1088,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm)
for
(
j
=
0
;
j
<
pin
->
num_ports
;
j
++
)
{
for
(
j
=
0
;
j
<
pin
->
num_ports
;
j
++
)
{
sprintf
(
widget_name
,
"Pin%d-Port%d Mux"
,
sprintf
(
widget_name
,
"Pin%d-Port%d Mux"
,
pin
->
nid
,
pin
->
ports
[
j
].
id
);
pin
->
nid
,
pin
->
ports
[
j
].
id
);
ret
=
hdac_hdmi_create_pin_port_muxs
(
e
dev
,
ret
=
hdac_hdmi_create_pin_port_muxs
(
h
dev
,
&
pin
->
ports
[
j
],
&
widgets
[
i
],
&
pin
->
ports
[
j
],
&
widgets
[
i
],
widget_name
);
widget_name
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
@@ -1134,7 +1123,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm)
...
@@ -1134,7 +1123,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm)
}
}
}
}
hdac_hdmi_add_pinmux_cvt_route
(
e
dev
,
widgets
,
route
,
i
);
hdac_hdmi_add_pinmux_cvt_route
(
h
dev
,
widgets
,
route
,
i
);
snd_soc_dapm_new_controls
(
dapm
,
widgets
,
snd_soc_dapm_new_controls
(
dapm
,
widgets
,
((
2
*
hdmi
->
num_ports
)
+
hdmi
->
num_cvt
));
((
2
*
hdmi
->
num_ports
)
+
hdmi
->
num_cvt
));
...
@@ -1146,9 +1135,9 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm)
...
@@ -1146,9 +1135,9 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm)
}
}
static
int
hdac_hdmi_init_dai_map
(
struct
hdac_
ext_device
*
e
dev
)
static
int
hdac_hdmi_init_dai_map
(
struct
hdac_
device
*
h
dev
)
{
{
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_hdmi_dai_port_map
*
dai_map
;
struct
hdac_hdmi_dai_port_map
*
dai_map
;
struct
hdac_hdmi_cvt
*
cvt
;
struct
hdac_hdmi_cvt
*
cvt
;
int
dai_id
=
0
;
int
dai_id
=
0
;
...
@@ -1164,7 +1153,7 @@ static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev)
...
@@ -1164,7 +1153,7 @@ static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev)
dai_id
++
;
dai_id
++
;
if
(
dai_id
==
HDA_MAX_CVTS
)
{
if
(
dai_id
==
HDA_MAX_CVTS
)
{
dev_warn
(
&
edev
->
hdev
.
dev
,
dev_warn
(
&
hdev
->
dev
,
"Max dais supported: %d
\n
"
,
dai_id
);
"Max dais supported: %d
\n
"
,
dai_id
);
break
;
break
;
}
}
...
@@ -1173,9 +1162,9 @@ static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev)
...
@@ -1173,9 +1162,9 @@ static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev)
return
0
;
return
0
;
}
}
static
int
hdac_hdmi_add_cvt
(
struct
hdac_
ext_device
*
e
dev
,
hda_nid_t
nid
)
static
int
hdac_hdmi_add_cvt
(
struct
hdac_
device
*
h
dev
,
hda_nid_t
nid
)
{
{
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_hdmi_cvt
*
cvt
;
struct
hdac_hdmi_cvt
*
cvt
;
char
name
[
NAME_SIZE
];
char
name
[
NAME_SIZE
];
...
@@ -1190,10 +1179,10 @@ static int hdac_hdmi_add_cvt(struct hdac_ext_device *edev, hda_nid_t nid)
...
@@ -1190,10 +1179,10 @@ static int hdac_hdmi_add_cvt(struct hdac_ext_device *edev, hda_nid_t nid)
list_add_tail
(
&
cvt
->
head
,
&
hdmi
->
cvt_list
);
list_add_tail
(
&
cvt
->
head
,
&
hdmi
->
cvt_list
);
hdmi
->
num_cvt
++
;
hdmi
->
num_cvt
++
;
return
hdac_hdmi_query_cvt_params
(
&
edev
->
hdev
,
cvt
);
return
hdac_hdmi_query_cvt_params
(
hdev
,
cvt
);
}
}
static
int
hdac_hdmi_parse_eld
(
struct
hdac_
ext_device
*
e
dev
,
static
int
hdac_hdmi_parse_eld
(
struct
hdac_
device
*
h
dev
,
struct
hdac_hdmi_port
*
port
)
struct
hdac_hdmi_port
*
port
)
{
{
unsigned
int
ver
,
mnl
;
unsigned
int
ver
,
mnl
;
...
@@ -1202,7 +1191,7 @@ static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev,
...
@@ -1202,7 +1191,7 @@ static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev,
>>
DRM_ELD_VER_SHIFT
;
>>
DRM_ELD_VER_SHIFT
;
if
(
ver
!=
ELD_VER_CEA_861D
&&
ver
!=
ELD_VER_PARTIAL
)
{
if
(
ver
!=
ELD_VER_CEA_861D
&&
ver
!=
ELD_VER_PARTIAL
)
{
dev_err
(
&
edev
->
hdev
.
dev
,
"HDMI: Unknown ELD version %d
\n
"
,
ver
);
dev_err
(
&
hdev
->
dev
,
"HDMI: Unknown ELD version %d
\n
"
,
ver
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -1210,7 +1199,7 @@ static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev,
...
@@ -1210,7 +1199,7 @@ static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev,
DRM_ELD_MNL_MASK
)
>>
DRM_ELD_MNL_SHIFT
;
DRM_ELD_MNL_MASK
)
>>
DRM_ELD_MNL_SHIFT
;
if
(
mnl
>
ELD_MAX_MNL
)
{
if
(
mnl
>
ELD_MAX_MNL
)
{
dev_err
(
&
edev
->
hdev
.
dev
,
"HDMI: MNL Invalid %d
\n
"
,
mnl
);
dev_err
(
&
hdev
->
dev
,
"HDMI: MNL Invalid %d
\n
"
,
mnl
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -1222,8 +1211,8 @@ static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev,
...
@@ -1222,8 +1211,8 @@ static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev,
static
void
hdac_hdmi_present_sense
(
struct
hdac_hdmi_pin
*
pin
,
static
void
hdac_hdmi_present_sense
(
struct
hdac_hdmi_pin
*
pin
,
struct
hdac_hdmi_port
*
port
)
struct
hdac_hdmi_port
*
port
)
{
{
struct
hdac_
ext_device
*
edev
=
pin
->
e
dev
;
struct
hdac_
device
*
hdev
=
pin
->
h
dev
;
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_hdmi_pcm
*
pcm
;
struct
hdac_hdmi_pcm
*
pcm
;
int
size
=
0
;
int
size
=
0
;
int
port_id
=
-
1
;
int
port_id
=
-
1
;
...
@@ -1241,14 +1230,14 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin,
...
@@ -1241,14 +1230,14 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin,
if
(
pin
->
mst_capable
)
if
(
pin
->
mst_capable
)
port_id
=
port
->
id
;
port_id
=
port
->
id
;
size
=
snd_hdac_acomp_get_eld
(
&
edev
->
hdev
,
pin
->
nid
,
port_id
,
size
=
snd_hdac_acomp_get_eld
(
hdev
,
pin
->
nid
,
port_id
,
&
port
->
eld
.
monitor_present
,
&
port
->
eld
.
monitor_present
,
port
->
eld
.
eld_buffer
,
port
->
eld
.
eld_buffer
,
ELD_MAX_SIZE
);
ELD_MAX_SIZE
);
if
(
size
>
0
)
{
if
(
size
>
0
)
{
size
=
min
(
size
,
ELD_MAX_SIZE
);
size
=
min
(
size
,
ELD_MAX_SIZE
);
if
(
hdac_hdmi_parse_eld
(
e
dev
,
port
)
<
0
)
if
(
hdac_hdmi_parse_eld
(
h
dev
,
port
)
<
0
)
size
=
-
EINVAL
;
size
=
-
EINVAL
;
}
}
...
@@ -1260,11 +1249,11 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin,
...
@@ -1260,11 +1249,11 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin,
port
->
eld
.
eld_size
=
0
;
port
->
eld
.
eld_size
=
0
;
}
}
pcm
=
hdac_hdmi_get_pcm
(
e
dev
,
port
);
pcm
=
hdac_hdmi_get_pcm
(
h
dev
,
port
);
if
(
!
port
->
eld
.
monitor_present
||
!
port
->
eld
.
eld_valid
)
{
if
(
!
port
->
eld
.
monitor_present
||
!
port
->
eld
.
eld_valid
)
{
dev_err
(
&
edev
->
hdev
.
dev
,
"%s: disconnect for pin:port %d:%d
\n
"
,
dev_err
(
&
hdev
->
dev
,
"%s: disconnect for pin:port %d:%d
\n
"
,
__func__
,
pin
->
nid
,
port
->
id
);
__func__
,
pin
->
nid
,
port
->
id
);
/*
/*
...
@@ -1316,9 +1305,9 @@ static int hdac_hdmi_add_ports(struct hdac_hdmi_priv *hdmi,
...
@@ -1316,9 +1305,9 @@ static int hdac_hdmi_add_ports(struct hdac_hdmi_priv *hdmi,
return
0
;
return
0
;
}
}
static
int
hdac_hdmi_add_pin
(
struct
hdac_
ext_device
*
e
dev
,
hda_nid_t
nid
)
static
int
hdac_hdmi_add_pin
(
struct
hdac_
device
*
h
dev
,
hda_nid_t
nid
)
{
{
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_hdmi_pin
*
pin
;
struct
hdac_hdmi_pin
*
pin
;
int
ret
;
int
ret
;
...
@@ -1328,7 +1317,7 @@ static int hdac_hdmi_add_pin(struct hdac_ext_device *edev, hda_nid_t nid)
...
@@ -1328,7 +1317,7 @@ static int hdac_hdmi_add_pin(struct hdac_ext_device *edev, hda_nid_t nid)
pin
->
nid
=
nid
;
pin
->
nid
=
nid
;
pin
->
mst_capable
=
false
;
pin
->
mst_capable
=
false
;
pin
->
edev
=
e
dev
;
pin
->
hdev
=
h
dev
;
ret
=
hdac_hdmi_add_ports
(
hdmi
,
pin
);
ret
=
hdac_hdmi_add_ports
(
hdmi
,
pin
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
...
@@ -1459,15 +1448,14 @@ static int hdac_hdmi_create_dais(struct hdac_device *hdev,
...
@@ -1459,15 +1448,14 @@ static int hdac_hdmi_create_dais(struct hdac_device *hdev,
* Parse all nodes and store the cvt/pin nids in array
* Parse all nodes and store the cvt/pin nids in array
* Add one time initialization for pin and cvt widgets
* Add one time initialization for pin and cvt widgets
*/
*/
static
int
hdac_hdmi_parse_and_map_nid
(
struct
hdac_
ext_device
*
e
dev
,
static
int
hdac_hdmi_parse_and_map_nid
(
struct
hdac_
device
*
h
dev
,
struct
snd_soc_dai_driver
**
dais
,
int
*
num_dais
)
struct
snd_soc_dai_driver
**
dais
,
int
*
num_dais
)
{
{
hda_nid_t
nid
;
hda_nid_t
nid
;
int
i
,
num_nodes
;
int
i
,
num_nodes
;
struct
hdac_hdmi_cvt
*
temp_cvt
,
*
cvt_next
;
struct
hdac_hdmi_cvt
*
temp_cvt
,
*
cvt_next
;
struct
hdac_hdmi_pin
*
temp_pin
,
*
pin_next
;
struct
hdac_hdmi_pin
*
temp_pin
,
*
pin_next
;
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_device
*
hdev
=
&
edev
->
hdev
;
int
ret
;
int
ret
;
hdac_hdmi_skl_enable_all_pins
(
hdev
);
hdac_hdmi_skl_enable_all_pins
(
hdev
);
...
@@ -1492,13 +1480,13 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
...
@@ -1492,13 +1480,13 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
switch
(
type
)
{
switch
(
type
)
{
case
AC_WID_AUD_OUT
:
case
AC_WID_AUD_OUT
:
ret
=
hdac_hdmi_add_cvt
(
e
dev
,
nid
);
ret
=
hdac_hdmi_add_cvt
(
h
dev
,
nid
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
free_widgets
;
goto
free_widgets
;
break
;
break
;
case
AC_WID_PIN
:
case
AC_WID_PIN
:
ret
=
hdac_hdmi_add_pin
(
e
dev
,
nid
);
ret
=
hdac_hdmi_add_pin
(
h
dev
,
nid
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
free_widgets
;
goto
free_widgets
;
break
;
break
;
...
@@ -1518,7 +1506,7 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
...
@@ -1518,7 +1506,7 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
}
}
*
num_dais
=
hdmi
->
num_cvt
;
*
num_dais
=
hdmi
->
num_cvt
;
ret
=
hdac_hdmi_init_dai_map
(
e
dev
);
ret
=
hdac_hdmi_init_dai_map
(
h
dev
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
free_widgets
;
goto
free_widgets
;
...
@@ -1544,17 +1532,17 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
...
@@ -1544,17 +1532,17 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
static
void
hdac_hdmi_eld_notify_cb
(
void
*
aptr
,
int
port
,
int
pipe
)
static
void
hdac_hdmi_eld_notify_cb
(
void
*
aptr
,
int
port
,
int
pipe
)
{
{
struct
hdac_
ext_device
*
e
dev
=
aptr
;
struct
hdac_
device
*
h
dev
=
aptr
;
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_hdmi_pin
*
pin
=
NULL
;
struct
hdac_hdmi_pin
*
pin
=
NULL
;
struct
hdac_hdmi_port
*
hport
=
NULL
;
struct
hdac_hdmi_port
*
hport
=
NULL
;
struct
snd_soc_component
*
component
=
edev
->
scodec
;
struct
snd_soc_component
*
component
=
hdmi
->
component
;
int
i
;
int
i
;
/* Don't know how this mapping is derived */
/* Don't know how this mapping is derived */
hda_nid_t
pin_nid
=
port
+
0x04
;
hda_nid_t
pin_nid
=
port
+
0x04
;
dev_dbg
(
&
edev
->
hdev
.
dev
,
"%s: for pin:%d port=%d
\n
"
,
__func__
,
dev_dbg
(
&
hdev
->
dev
,
"%s: for pin:%d port=%d
\n
"
,
__func__
,
pin_nid
,
pipe
);
pin_nid
,
pipe
);
/*
/*
...
@@ -1567,7 +1555,7 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe)
...
@@ -1567,7 +1555,7 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe)
SNDRV_CTL_POWER_D0
)
SNDRV_CTL_POWER_D0
)
return
;
return
;
if
(
atomic_read
(
&
edev
->
hdev
.
in_pm
))
if
(
atomic_read
(
&
hdev
->
in_pm
))
return
;
return
;
list_for_each_entry
(
pin
,
&
hdmi
->
pin_list
,
head
)
{
list_for_each_entry
(
pin
,
&
hdmi
->
pin_list
,
head
)
{
...
@@ -1614,15 +1602,15 @@ static struct snd_pcm *hdac_hdmi_get_pcm_from_id(struct snd_soc_card *card,
...
@@ -1614,15 +1602,15 @@ static struct snd_pcm *hdac_hdmi_get_pcm_from_id(struct snd_soc_card *card,
/* create jack pin kcontrols */
/* create jack pin kcontrols */
static
int
create_fill_jack_kcontrols
(
struct
snd_soc_card
*
card
,
static
int
create_fill_jack_kcontrols
(
struct
snd_soc_card
*
card
,
struct
hdac_
ext_device
*
e
dev
)
struct
hdac_
device
*
h
dev
)
{
{
struct
hdac_hdmi_pin
*
pin
;
struct
hdac_hdmi_pin
*
pin
;
struct
snd_kcontrol_new
*
kc
;
struct
snd_kcontrol_new
*
kc
;
char
kc_name
[
NAME_SIZE
],
xname
[
NAME_SIZE
];
char
kc_name
[
NAME_SIZE
],
xname
[
NAME_SIZE
];
char
*
name
;
char
*
name
;
int
i
=
0
,
j
;
int
i
=
0
,
j
;
struct
snd_soc_component
*
component
=
edev
->
scodec
;
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
)
;
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
)
;
struct
snd_soc_component
*
component
=
hdmi
->
component
;
kc
=
devm_kcalloc
(
component
->
dev
,
hdmi
->
num_ports
,
kc
=
devm_kcalloc
(
component
->
dev
,
hdmi
->
num_ports
,
sizeof
(
*
kc
),
GFP_KERNEL
);
sizeof
(
*
kc
),
GFP_KERNEL
);
...
@@ -1659,8 +1647,8 @@ static int create_fill_jack_kcontrols(struct snd_soc_card *card,
...
@@ -1659,8 +1647,8 @@ static int create_fill_jack_kcontrols(struct snd_soc_card *card,
int
hdac_hdmi_jack_port_init
(
struct
snd_soc_component
*
component
,
int
hdac_hdmi_jack_port_init
(
struct
snd_soc_component
*
component
,
struct
snd_soc_dapm_context
*
dapm
)
struct
snd_soc_dapm_context
*
dapm
)
{
{
struct
hdac_
ext_device
*
edev
=
snd_soc_component_get_drvdata
(
component
);
struct
hdac_
hdmi_priv
*
hdmi
=
snd_soc_component_get_drvdata
(
component
);
struct
hdac_
hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
)
;
struct
hdac_
device
*
hdev
=
hdmi
->
hdev
;
struct
hdac_hdmi_pin
*
pin
;
struct
hdac_hdmi_pin
*
pin
;
struct
snd_soc_dapm_widget
*
widgets
;
struct
snd_soc_dapm_widget
*
widgets
;
struct
snd_soc_dapm_route
*
route
;
struct
snd_soc_dapm_route
*
route
;
...
@@ -1715,7 +1703,7 @@ int hdac_hdmi_jack_port_init(struct snd_soc_component *component,
...
@@ -1715,7 +1703,7 @@ int hdac_hdmi_jack_port_init(struct snd_soc_component *component,
return
ret
;
return
ret
;
/* Add Jack Pin switch Kcontrol */
/* Add Jack Pin switch Kcontrol */
ret
=
create_fill_jack_kcontrols
(
dapm
->
card
,
e
dev
);
ret
=
create_fill_jack_kcontrols
(
dapm
->
card
,
h
dev
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
...
@@ -1735,8 +1723,8 @@ int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device,
...
@@ -1735,8 +1723,8 @@ int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device,
struct
snd_soc_jack
*
jack
)
struct
snd_soc_jack
*
jack
)
{
{
struct
snd_soc_component
*
component
=
dai
->
component
;
struct
snd_soc_component
*
component
=
dai
->
component
;
struct
hdac_
ext_device
*
edev
=
snd_soc_component_get_drvdata
(
component
);
struct
hdac_
hdmi_priv
*
hdmi
=
snd_soc_component_get_drvdata
(
component
);
struct
hdac_
hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
)
;
struct
hdac_
device
*
hdev
=
hdmi
->
hdev
;
struct
hdac_hdmi_pcm
*
pcm
;
struct
hdac_hdmi_pcm
*
pcm
;
struct
snd_pcm
*
snd_pcm
;
struct
snd_pcm
*
snd_pcm
;
int
err
;
int
err
;
...
@@ -1758,7 +1746,7 @@ int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device,
...
@@ -1758,7 +1746,7 @@ int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device,
if
(
snd_pcm
)
{
if
(
snd_pcm
)
{
err
=
snd_hdac_add_chmap_ctls
(
snd_pcm
,
device
,
&
hdmi
->
chmap
);
err
=
snd_hdac_add_chmap_ctls
(
snd_pcm
,
device
,
&
hdmi
->
chmap
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
dev_err
(
&
edev
->
hdev
.
dev
,
dev_err
(
&
hdev
->
dev
,
"chmap control add failed with err: %d for pcm: %d
\n
"
,
"chmap control add failed with err: %d for pcm: %d
\n
"
,
err
,
device
);
err
,
device
);
kfree
(
pcm
);
kfree
(
pcm
);
...
@@ -1772,7 +1760,7 @@ int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device,
...
@@ -1772,7 +1760,7 @@ int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device,
}
}
EXPORT_SYMBOL_GPL
(
hdac_hdmi_jack_init
);
EXPORT_SYMBOL_GPL
(
hdac_hdmi_jack_init
);
static
void
hdac_hdmi_present_sense_all_pins
(
struct
hdac_
ext_device
*
e
dev
,
static
void
hdac_hdmi_present_sense_all_pins
(
struct
hdac_
device
*
h
dev
,
struct
hdac_hdmi_priv
*
hdmi
,
bool
detect_pin_caps
)
struct
hdac_hdmi_priv
*
hdmi
,
bool
detect_pin_caps
)
{
{
int
i
;
int
i
;
...
@@ -1781,7 +1769,7 @@ static void hdac_hdmi_present_sense_all_pins(struct hdac_ext_device *edev,
...
@@ -1781,7 +1769,7 @@ static void hdac_hdmi_present_sense_all_pins(struct hdac_ext_device *edev,
list_for_each_entry
(
pin
,
&
hdmi
->
pin_list
,
head
)
{
list_for_each_entry
(
pin
,
&
hdmi
->
pin_list
,
head
)
{
if
(
detect_pin_caps
)
{
if
(
detect_pin_caps
)
{
if
(
hdac_hdmi_get_port_len
(
e
dev
,
pin
->
nid
)
==
0
)
if
(
hdac_hdmi_get_port_len
(
h
dev
,
pin
->
nid
)
==
0
)
pin
->
mst_capable
=
false
;
pin
->
mst_capable
=
false
;
else
else
pin
->
mst_capable
=
true
;
pin
->
mst_capable
=
true
;
...
@@ -1798,68 +1786,67 @@ static void hdac_hdmi_present_sense_all_pins(struct hdac_ext_device *edev,
...
@@ -1798,68 +1786,67 @@ static void hdac_hdmi_present_sense_all_pins(struct hdac_ext_device *edev,
static
int
hdmi_codec_probe
(
struct
snd_soc_component
*
component
)
static
int
hdmi_codec_probe
(
struct
snd_soc_component
*
component
)
{
{
struct
hdac_
ext_device
*
edev
=
snd_soc_component_get_drvdata
(
component
);
struct
hdac_
hdmi_priv
*
hdmi
=
snd_soc_component_get_drvdata
(
component
);
struct
hdac_
hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
)
;
struct
hdac_
device
*
hdev
=
hdmi
->
hdev
;
struct
snd_soc_dapm_context
*
dapm
=
struct
snd_soc_dapm_context
*
dapm
=
snd_soc_component_get_dapm
(
component
);
snd_soc_component_get_dapm
(
component
);
struct
hdac_ext_link
*
hlink
=
NULL
;
struct
hdac_ext_link
*
hlink
=
NULL
;
int
ret
;
int
ret
;
edev
->
scodec
=
component
;
hdmi
->
component
=
component
;
/*
/*
* hold the ref while we probe, also no need to drop the ref on
* hold the ref while we probe, also no need to drop the ref on
* exit, we call pm_runtime_suspend() so that will do for us
* exit, we call pm_runtime_suspend() so that will do for us
*/
*/
hlink
=
snd_hdac_ext_bus_get_link
(
edev
->
ebus
,
dev_name
(
&
edev
->
hdev
.
dev
));
hlink
=
snd_hdac_ext_bus_get_link
(
hdev
->
bus
,
dev_name
(
&
hdev
->
dev
));
if
(
!
hlink
)
{
if
(
!
hlink
)
{
dev_err
(
&
edev
->
hdev
.
dev
,
"hdac link not found
\n
"
);
dev_err
(
&
hdev
->
dev
,
"hdac link not found
\n
"
);
return
-
EIO
;
return
-
EIO
;
}
}
snd_hdac_ext_bus_link_get
(
edev
->
e
bus
,
hlink
);
snd_hdac_ext_bus_link_get
(
hdev
->
bus
,
hlink
);
ret
=
create_fill_widget_route_map
(
dapm
);
ret
=
create_fill_widget_route_map
(
dapm
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
aops
.
audio_ptr
=
e
dev
;
aops
.
audio_ptr
=
h
dev
;
ret
=
snd_hdac_i915_register_notifier
(
&
aops
);
ret
=
snd_hdac_i915_register_notifier
(
&
aops
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
&
edev
->
hdev
.
dev
,
"notifier register failed: err: %d
\n
"
,
dev_err
(
&
hdev
->
dev
,
"notifier register failed: err: %d
\n
"
,
ret
);
ret
);
return
ret
;
return
ret
;
}
}
hdac_hdmi_present_sense_all_pins
(
e
dev
,
hdmi
,
true
);
hdac_hdmi_present_sense_all_pins
(
h
dev
,
hdmi
,
true
);
/* Imp: Store the card pointer in hda_codec */
/* Imp: Store the card pointer in hda_codec */
edev
->
card
=
dapm
->
card
->
snd_card
;
hdmi
->
card
=
dapm
->
card
->
snd_card
;
/*
/*
* hdac_device core already sets the state to active and calls
* hdac_device core already sets the state to active and calls
* get_noresume. So enable runtime and set the device to suspend.
* get_noresume. So enable runtime and set the device to suspend.
*/
*/
pm_runtime_enable
(
&
edev
->
hdev
.
dev
);
pm_runtime_enable
(
&
hdev
->
dev
);
pm_runtime_put
(
&
edev
->
hdev
.
dev
);
pm_runtime_put
(
&
hdev
->
dev
);
pm_runtime_suspend
(
&
edev
->
hdev
.
dev
);
pm_runtime_suspend
(
&
hdev
->
dev
);
return
0
;
return
0
;
}
}
static
void
hdmi_codec_remove
(
struct
snd_soc_component
*
component
)
static
void
hdmi_codec_remove
(
struct
snd_soc_component
*
component
)
{
{
struct
hdac_ext_device
*
edev
=
snd_soc_component_get_drvdata
(
component
);
struct
hdac_hdmi_priv
*
hdmi
=
snd_soc_component_get_drvdata
(
component
);
struct
hdac_device
*
hdev
=
hdmi
->
hdev
;
pm_runtime_disable
(
&
edev
->
hdev
.
dev
);
pm_runtime_disable
(
&
hdev
->
dev
);
}
}
#ifdef CONFIG_PM
#ifdef CONFIG_PM
static
int
hdmi_codec_prepare
(
struct
device
*
dev
)
static
int
hdmi_codec_prepare
(
struct
device
*
dev
)
{
{
struct
hdac_ext_device
*
edev
=
to_hda_ext_device
(
dev
);
struct
hdac_device
*
hdev
=
dev_to_hdac_dev
(
dev
);
struct
hdac_device
*
hdev
=
&
edev
->
hdev
;
pm_runtime_get_sync
(
&
edev
->
hdev
.
dev
);
pm_runtime_get_sync
(
&
hdev
->
dev
);
/*
/*
* Power down afg.
* Power down afg.
...
@@ -1876,16 +1863,15 @@ static int hdmi_codec_prepare(struct device *dev)
...
@@ -1876,16 +1863,15 @@ static int hdmi_codec_prepare(struct device *dev)
static
void
hdmi_codec_complete
(
struct
device
*
dev
)
static
void
hdmi_codec_complete
(
struct
device
*
dev
)
{
{
struct
hdac_ext_device
*
edev
=
to_hda_ext_device
(
dev
);
struct
hdac_device
*
hdev
=
dev_to_hdac_dev
(
dev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_device
*
hdev
=
&
edev
->
hdev
;
/* Power up afg */
/* Power up afg */
snd_hdac_codec_read
(
hdev
,
hdev
->
afg
,
0
,
AC_VERB_SET_POWER_STATE
,
snd_hdac_codec_read
(
hdev
,
hdev
->
afg
,
0
,
AC_VERB_SET_POWER_STATE
,
AC_PWRST_D0
);
AC_PWRST_D0
);
hdac_hdmi_skl_enable_all_pins
(
&
edev
->
hdev
);
hdac_hdmi_skl_enable_all_pins
(
hdev
);
hdac_hdmi_skl_enable_dp12
(
&
edev
->
hdev
);
hdac_hdmi_skl_enable_dp12
(
hdev
);
/*
/*
* As the ELD notify callback request is not entertained while the
* As the ELD notify callback request is not entertained while the
...
@@ -1893,9 +1879,9 @@ static void hdmi_codec_complete(struct device *dev)
...
@@ -1893,9 +1879,9 @@ static void hdmi_codec_complete(struct device *dev)
* all pins here. pin capablity change is not support, so use the
* all pins here. pin capablity change is not support, so use the
* already set pin caps.
* already set pin caps.
*/
*/
hdac_hdmi_present_sense_all_pins
(
e
dev
,
hdmi
,
false
);
hdac_hdmi_present_sense_all_pins
(
h
dev
,
hdmi
,
false
);
pm_runtime_put_sync
(
&
edev
->
hdev
.
dev
);
pm_runtime_put_sync
(
&
hdev
->
dev
);
}
}
#else
#else
#define hdmi_codec_prepare NULL
#define hdmi_codec_prepare NULL
...
@@ -1922,7 +1908,6 @@ static void hdac_hdmi_get_chmap(struct hdac_device *hdev, int pcm_idx,
...
@@ -1922,7 +1908,6 @@ static void hdac_hdmi_get_chmap(struct hdac_device *hdev, int pcm_idx,
static
void
hdac_hdmi_set_chmap
(
struct
hdac_device
*
hdev
,
int
pcm_idx
,
static
void
hdac_hdmi_set_chmap
(
struct
hdac_device
*
hdev
,
int
pcm_idx
,
unsigned
char
*
chmap
,
int
prepared
)
unsigned
char
*
chmap
,
int
prepared
)
{
{
struct
hdac_ext_device
*
edev
=
to_ehdac_device
(
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_hdmi_pcm
*
pcm
=
get_hdmi_pcm_from_id
(
hdmi
,
pcm_idx
);
struct
hdac_hdmi_pcm
*
pcm
=
get_hdmi_pcm_from_id
(
hdmi
,
pcm_idx
);
struct
hdac_hdmi_port
*
port
;
struct
hdac_hdmi_port
*
port
;
...
@@ -1938,7 +1923,7 @@ static void hdac_hdmi_set_chmap(struct hdac_device *hdev, int pcm_idx,
...
@@ -1938,7 +1923,7 @@ static void hdac_hdmi_set_chmap(struct hdac_device *hdev, int pcm_idx,
memcpy
(
pcm
->
chmap
,
chmap
,
ARRAY_SIZE
(
pcm
->
chmap
));
memcpy
(
pcm
->
chmap
,
chmap
,
ARRAY_SIZE
(
pcm
->
chmap
));
list_for_each_entry
(
port
,
&
pcm
->
port_list
,
head
)
list_for_each_entry
(
port
,
&
pcm
->
port_list
,
head
)
if
(
prepared
)
if
(
prepared
)
hdac_hdmi_setup_audio_infoframe
(
e
dev
,
pcm
,
port
);
hdac_hdmi_setup_audio_infoframe
(
h
dev
,
pcm
,
port
);
mutex_unlock
(
&
pcm
->
lock
);
mutex_unlock
(
&
pcm
->
lock
);
}
}
...
@@ -1987,10 +1972,9 @@ static struct hdac_hdmi_drv_data intel_drv_data = {
...
@@ -1987,10 +1972,9 @@ static struct hdac_hdmi_drv_data intel_drv_data = {
.
vendor_nid
=
INTEL_VENDOR_NID
,
.
vendor_nid
=
INTEL_VENDOR_NID
,
};
};
static
int
hdac_hdmi_dev_probe
(
struct
hdac_
ext_device
*
e
dev
)
static
int
hdac_hdmi_dev_probe
(
struct
hdac_
device
*
h
dev
)
{
{
struct
hdac_device
*
hdev
=
&
edev
->
hdev
;
struct
hdac_hdmi_priv
*
hdmi_priv
=
NULL
;
struct
hdac_hdmi_priv
*
hdmi_priv
;
struct
snd_soc_dai_driver
*
hdmi_dais
=
NULL
;
struct
snd_soc_dai_driver
*
hdmi_dais
=
NULL
;
struct
hdac_ext_link
*
hlink
=
NULL
;
struct
hdac_ext_link
*
hlink
=
NULL
;
int
num_dais
=
0
;
int
num_dais
=
0
;
...
@@ -1999,24 +1983,24 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
...
@@ -1999,24 +1983,24 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
const
struct
hda_device_id
*
hdac_id
=
hdac_get_device_id
(
hdev
,
hdrv
);
const
struct
hda_device_id
*
hdac_id
=
hdac_get_device_id
(
hdev
,
hdrv
);
/* hold the ref while we probe */
/* hold the ref while we probe */
hlink
=
snd_hdac_ext_bus_get_link
(
edev
->
ebus
,
dev_name
(
&
edev
->
hdev
.
dev
));
hlink
=
snd_hdac_ext_bus_get_link
(
hdev
->
bus
,
dev_name
(
&
hdev
->
dev
));
if
(
!
hlink
)
{
if
(
!
hlink
)
{
dev_err
(
&
edev
->
hdev
.
dev
,
"hdac link not found
\n
"
);
dev_err
(
&
hdev
->
dev
,
"hdac link not found
\n
"
);
return
-
EIO
;
return
-
EIO
;
}
}
snd_hdac_ext_bus_link_get
(
edev
->
e
bus
,
hlink
);
snd_hdac_ext_bus_link_get
(
hdev
->
bus
,
hlink
);
hdmi_priv
=
devm_kzalloc
(
&
hdev
->
dev
,
sizeof
(
*
hdmi_priv
),
GFP_KERNEL
);
hdmi_priv
=
devm_kzalloc
(
&
hdev
->
dev
,
sizeof
(
*
hdmi_priv
),
GFP_KERNEL
);
if
(
hdmi_priv
==
NULL
)
if
(
hdmi_priv
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
edev
->
private_data
=
hdmi_priv
;
snd_hdac_register_chmap_ops
(
hdev
,
&
hdmi_priv
->
chmap
);
snd_hdac_register_chmap_ops
(
hdev
,
&
hdmi_priv
->
chmap
);
hdmi_priv
->
chmap
.
ops
.
get_chmap
=
hdac_hdmi_get_chmap
;
hdmi_priv
->
chmap
.
ops
.
get_chmap
=
hdac_hdmi_get_chmap
;
hdmi_priv
->
chmap
.
ops
.
set_chmap
=
hdac_hdmi_set_chmap
;
hdmi_priv
->
chmap
.
ops
.
set_chmap
=
hdac_hdmi_set_chmap
;
hdmi_priv
->
chmap
.
ops
.
is_pcm_attached
=
is_hdac_hdmi_pcm_attached
;
hdmi_priv
->
chmap
.
ops
.
is_pcm_attached
=
is_hdac_hdmi_pcm_attached
;
hdmi_priv
->
chmap
.
ops
.
get_spk_alloc
=
hdac_hdmi_get_spk_alloc
;
hdmi_priv
->
chmap
.
ops
.
get_spk_alloc
=
hdac_hdmi_get_spk_alloc
;
hdmi_priv
->
hdev
=
hdev
;
if
(
!
hdac_id
)
if
(
!
hdac_id
)
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -2027,7 +2011,7 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
...
@@ -2027,7 +2011,7 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
else
else
hdmi_priv
->
drv_data
=
&
intel_drv_data
;
hdmi_priv
->
drv_data
=
&
intel_drv_data
;
dev_set_drvdata
(
&
hdev
->
dev
,
ede
v
);
dev_set_drvdata
(
&
hdev
->
dev
,
hdmi_pri
v
);
INIT_LIST_HEAD
(
&
hdmi_priv
->
pin_list
);
INIT_LIST_HEAD
(
&
hdmi_priv
->
pin_list
);
INIT_LIST_HEAD
(
&
hdmi_priv
->
cvt_list
);
INIT_LIST_HEAD
(
&
hdmi_priv
->
cvt_list
);
...
@@ -2038,15 +2022,15 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
...
@@ -2038,15 +2022,15 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
* Turned off in the runtime_suspend during the first explicit
* Turned off in the runtime_suspend during the first explicit
* pm_runtime_suspend call.
* pm_runtime_suspend call.
*/
*/
ret
=
snd_hdac_display_power
(
edev
->
hdev
.
bus
,
true
);
ret
=
snd_hdac_display_power
(
hdev
->
bus
,
true
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
&
edev
->
hdev
.
dev
,
dev_err
(
&
hdev
->
dev
,
"Cannot turn on display power on i915 err: %d
\n
"
,
"Cannot turn on display power on i915 err: %d
\n
"
,
ret
);
ret
);
return
ret
;
return
ret
;
}
}
ret
=
hdac_hdmi_parse_and_map_nid
(
e
dev
,
&
hdmi_dais
,
&
num_dais
);
ret
=
hdac_hdmi_parse_and_map_nid
(
h
dev
,
&
hdmi_dais
,
&
num_dais
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
&
hdev
->
dev
,
dev_err
(
&
hdev
->
dev
,
"Failed in parse and map nid with err: %d
\n
"
,
ret
);
"Failed in parse and map nid with err: %d
\n
"
,
ret
);
...
@@ -2058,14 +2042,14 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
...
@@ -2058,14 +2042,14 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
ret
=
devm_snd_soc_register_component
(
&
hdev
->
dev
,
&
hdmi_hda_codec
,
ret
=
devm_snd_soc_register_component
(
&
hdev
->
dev
,
&
hdmi_hda_codec
,
hdmi_dais
,
num_dais
);
hdmi_dais
,
num_dais
);
snd_hdac_ext_bus_link_put
(
edev
->
e
bus
,
hlink
);
snd_hdac_ext_bus_link_put
(
hdev
->
bus
,
hlink
);
return
ret
;
return
ret
;
}
}
static
int
hdac_hdmi_dev_remove
(
struct
hdac_
ext_device
*
e
dev
)
static
int
hdac_hdmi_dev_remove
(
struct
hdac_
device
*
h
dev
)
{
{
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
&
edev
->
hdev
);
struct
hdac_hdmi_priv
*
hdmi
=
hdev_to_hdmi_priv
(
hdev
);
struct
hdac_hdmi_pin
*
pin
,
*
pin_next
;
struct
hdac_hdmi_pin
*
pin
,
*
pin_next
;
struct
hdac_hdmi_cvt
*
cvt
,
*
cvt_next
;
struct
hdac_hdmi_cvt
*
cvt
,
*
cvt_next
;
struct
hdac_hdmi_pcm
*
pcm
,
*
pcm_next
;
struct
hdac_hdmi_pcm
*
pcm
,
*
pcm_next
;
...
@@ -2105,10 +2089,8 @@ static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev)
...
@@ -2105,10 +2089,8 @@ static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev)
#ifdef CONFIG_PM
#ifdef CONFIG_PM
static
int
hdac_hdmi_runtime_suspend
(
struct
device
*
dev
)
static
int
hdac_hdmi_runtime_suspend
(
struct
device
*
dev
)
{
{
struct
hdac_ext_device
*
edev
=
to_hda_ext_device
(
dev
);
struct
hdac_device
*
hdev
=
dev_to_hdac_dev
(
dev
);
struct
hdac_device
*
hdev
=
&
edev
->
hdev
;
struct
hdac_bus
*
bus
=
hdev
->
bus
;
struct
hdac_bus
*
bus
=
hdev
->
bus
;
struct
hdac_ext_bus
*
ebus
=
hbus_to_ebus
(
bus
);
struct
hdac_ext_link
*
hlink
=
NULL
;
struct
hdac_ext_link
*
hlink
=
NULL
;
int
err
;
int
err
;
...
@@ -2129,27 +2111,25 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
...
@@ -2129,27 +2111,25 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
AC_PWRST_D3
);
AC_PWRST_D3
);
err
=
snd_hdac_display_power
(
bus
,
false
);
err
=
snd_hdac_display_power
(
bus
,
false
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
dev_err
(
bus
->
dev
,
"Cannot turn on display power on i915
\n
"
);
dev_err
(
dev
,
"Cannot turn on display power on i915
\n
"
);
return
err
;
return
err
;
}
}
hlink
=
snd_hdac_ext_bus_get_link
(
e
bus
,
dev_name
(
dev
));
hlink
=
snd_hdac_ext_bus_get_link
(
bus
,
dev_name
(
dev
));
if
(
!
hlink
)
{
if
(
!
hlink
)
{
dev_err
(
dev
,
"hdac link not found
\n
"
);
dev_err
(
dev
,
"hdac link not found
\n
"
);
return
-
EIO
;
return
-
EIO
;
}
}
snd_hdac_ext_bus_link_put
(
e
bus
,
hlink
);
snd_hdac_ext_bus_link_put
(
bus
,
hlink
);
return
0
;
return
0
;
}
}
static
int
hdac_hdmi_runtime_resume
(
struct
device
*
dev
)
static
int
hdac_hdmi_runtime_resume
(
struct
device
*
dev
)
{
{
struct
hdac_ext_device
*
edev
=
to_hda_ext_device
(
dev
);
struct
hdac_device
*
hdev
=
dev_to_hdac_dev
(
dev
);
struct
hdac_device
*
hdev
=
&
edev
->
hdev
;
struct
hdac_bus
*
bus
=
hdev
->
bus
;
struct
hdac_bus
*
bus
=
hdev
->
bus
;
struct
hdac_ext_bus
*
ebus
=
hbus_to_ebus
(
bus
);
struct
hdac_ext_link
*
hlink
=
NULL
;
struct
hdac_ext_link
*
hlink
=
NULL
;
int
err
;
int
err
;
...
@@ -2159,22 +2139,22 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
...
@@ -2159,22 +2139,22 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
if
(
!
bus
)
if
(
!
bus
)
return
0
;
return
0
;
hlink
=
snd_hdac_ext_bus_get_link
(
e
bus
,
dev_name
(
dev
));
hlink
=
snd_hdac_ext_bus_get_link
(
bus
,
dev_name
(
dev
));
if
(
!
hlink
)
{
if
(
!
hlink
)
{
dev_err
(
dev
,
"hdac link not found
\n
"
);
dev_err
(
dev
,
"hdac link not found
\n
"
);
return
-
EIO
;
return
-
EIO
;
}
}
snd_hdac_ext_bus_link_get
(
e
bus
,
hlink
);
snd_hdac_ext_bus_link_get
(
bus
,
hlink
);
err
=
snd_hdac_display_power
(
bus
,
true
);
err
=
snd_hdac_display_power
(
bus
,
true
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
dev_err
(
bus
->
dev
,
"Cannot turn on display power on i915
\n
"
);
dev_err
(
dev
,
"Cannot turn on display power on i915
\n
"
);
return
err
;
return
err
;
}
}
hdac_hdmi_skl_enable_all_pins
(
&
edev
->
hdev
);
hdac_hdmi_skl_enable_all_pins
(
hdev
);
hdac_hdmi_skl_enable_dp12
(
&
edev
->
hdev
);
hdac_hdmi_skl_enable_dp12
(
hdev
);
/* Power up afg */
/* Power up afg */
snd_hdac_codec_read
(
hdev
,
hdev
->
afg
,
0
,
AC_VERB_SET_POWER_STATE
,
snd_hdac_codec_read
(
hdev
,
hdev
->
afg
,
0
,
AC_VERB_SET_POWER_STATE
,
...
@@ -2206,14 +2186,12 @@ static const struct hda_device_id hdmi_list[] = {
...
@@ -2206,14 +2186,12 @@ static const struct hda_device_id hdmi_list[] = {
MODULE_DEVICE_TABLE
(
hdaudio
,
hdmi_list
);
MODULE_DEVICE_TABLE
(
hdaudio
,
hdmi_list
);
static
struct
hdac_ext_driver
hdmi_driver
=
{
static
struct
hdac_driver
hdmi_driver
=
{
.
hdac
=
{
.
driver
=
{
.
driver
=
{
.
name
=
"HDMI HDA Codec"
,
.
name
=
"HDMI HDA Codec"
,
.
pm
=
&
hdac_hdmi_pm
,
.
pm
=
&
hdac_hdmi_pm
,
},
.
id_table
=
hdmi_list
,
},
},
.
id_table
=
hdmi_list
,
.
probe
=
hdac_hdmi_dev_probe
,
.
probe
=
hdac_hdmi_dev_probe
,
.
remove
=
hdac_hdmi_dev_remove
,
.
remove
=
hdac_hdmi_dev_remove
,
};
};
...
...
sound/soc/intel/skylake/skl-messages.c
View file @
9a9b13dd
...
@@ -33,8 +33,7 @@
...
@@ -33,8 +33,7 @@
static
int
skl_alloc_dma_buf
(
struct
device
*
dev
,
static
int
skl_alloc_dma_buf
(
struct
device
*
dev
,
struct
snd_dma_buffer
*
dmab
,
size_t
size
)
struct
snd_dma_buffer
*
dmab
,
size_t
size
)
{
{
struct
hdac_ext_bus
*
ebus
=
dev_get_drvdata
(
dev
);
struct
hdac_bus
*
bus
=
dev_get_drvdata
(
dev
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
if
(
!
bus
)
if
(
!
bus
)
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -44,8 +43,7 @@ static int skl_alloc_dma_buf(struct device *dev,
...
@@ -44,8 +43,7 @@ static int skl_alloc_dma_buf(struct device *dev,
static
int
skl_free_dma_buf
(
struct
device
*
dev
,
struct
snd_dma_buffer
*
dmab
)
static
int
skl_free_dma_buf
(
struct
device
*
dev
,
struct
snd_dma_buffer
*
dmab
)
{
{
struct
hdac_ext_bus
*
ebus
=
dev_get_drvdata
(
dev
);
struct
hdac_bus
*
bus
=
dev_get_drvdata
(
dev
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
if
(
!
bus
)
if
(
!
bus
)
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -89,8 +87,7 @@ void skl_dsp_enable_notification(struct skl_sst *ctx, bool enable)
...
@@ -89,8 +87,7 @@ void skl_dsp_enable_notification(struct skl_sst *ctx, bool enable)
static
int
skl_dsp_setup_spib
(
struct
device
*
dev
,
unsigned
int
size
,
static
int
skl_dsp_setup_spib
(
struct
device
*
dev
,
unsigned
int
size
,
int
stream_tag
,
int
enable
)
int
stream_tag
,
int
enable
)
{
{
struct
hdac_ext_bus
*
ebus
=
dev_get_drvdata
(
dev
);
struct
hdac_bus
*
bus
=
dev_get_drvdata
(
dev
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
hdac_stream
*
stream
=
snd_hdac_get_stream
(
bus
,
struct
hdac_stream
*
stream
=
snd_hdac_get_stream
(
bus
,
SNDRV_PCM_STREAM_PLAYBACK
,
stream_tag
);
SNDRV_PCM_STREAM_PLAYBACK
,
stream_tag
);
struct
hdac_ext_stream
*
estream
;
struct
hdac_ext_stream
*
estream
;
...
@@ -100,10 +97,10 @@ static int skl_dsp_setup_spib(struct device *dev, unsigned int size,
...
@@ -100,10 +97,10 @@ static int skl_dsp_setup_spib(struct device *dev, unsigned int size,
estream
=
stream_to_hdac_ext_stream
(
stream
);
estream
=
stream_to_hdac_ext_stream
(
stream
);
/* enable/disable SPIB for this hdac stream */
/* enable/disable SPIB for this hdac stream */
snd_hdac_ext_stream_spbcap_enable
(
e
bus
,
enable
,
stream
->
index
);
snd_hdac_ext_stream_spbcap_enable
(
bus
,
enable
,
stream
->
index
);
/* set the spib value */
/* set the spib value */
snd_hdac_ext_stream_set_spib
(
e
bus
,
estream
,
size
);
snd_hdac_ext_stream_set_spib
(
bus
,
estream
,
size
);
return
0
;
return
0
;
}
}
...
@@ -111,8 +108,7 @@ static int skl_dsp_setup_spib(struct device *dev, unsigned int size,
...
@@ -111,8 +108,7 @@ static int skl_dsp_setup_spib(struct device *dev, unsigned int size,
static
int
skl_dsp_prepare
(
struct
device
*
dev
,
unsigned
int
format
,
static
int
skl_dsp_prepare
(
struct
device
*
dev
,
unsigned
int
format
,
unsigned
int
size
,
struct
snd_dma_buffer
*
dmab
)
unsigned
int
size
,
struct
snd_dma_buffer
*
dmab
)
{
{
struct
hdac_ext_bus
*
ebus
=
dev_get_drvdata
(
dev
);
struct
hdac_bus
*
bus
=
dev_get_drvdata
(
dev
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
hdac_ext_stream
*
estream
;
struct
hdac_ext_stream
*
estream
;
struct
hdac_stream
*
stream
;
struct
hdac_stream
*
stream
;
struct
snd_pcm_substream
substream
;
struct
snd_pcm_substream
substream
;
...
@@ -124,7 +120,7 @@ static int skl_dsp_prepare(struct device *dev, unsigned int format,
...
@@ -124,7 +120,7 @@ static int skl_dsp_prepare(struct device *dev, unsigned int format,
memset
(
&
substream
,
0
,
sizeof
(
substream
));
memset
(
&
substream
,
0
,
sizeof
(
substream
));
substream
.
stream
=
SNDRV_PCM_STREAM_PLAYBACK
;
substream
.
stream
=
SNDRV_PCM_STREAM_PLAYBACK
;
estream
=
snd_hdac_ext_stream_assign
(
e
bus
,
&
substream
,
estream
=
snd_hdac_ext_stream_assign
(
bus
,
&
substream
,
HDAC_EXT_STREAM_TYPE_HOST
);
HDAC_EXT_STREAM_TYPE_HOST
);
if
(
!
estream
)
if
(
!
estream
)
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -143,9 +139,8 @@ static int skl_dsp_prepare(struct device *dev, unsigned int format,
...
@@ -143,9 +139,8 @@ static int skl_dsp_prepare(struct device *dev, unsigned int format,
static
int
skl_dsp_trigger
(
struct
device
*
dev
,
bool
start
,
int
stream_tag
)
static
int
skl_dsp_trigger
(
struct
device
*
dev
,
bool
start
,
int
stream_tag
)
{
{
struct
hdac_
ext_bus
*
e
bus
=
dev_get_drvdata
(
dev
);
struct
hdac_
bus
*
bus
=
dev_get_drvdata
(
dev
);
struct
hdac_stream
*
stream
;
struct
hdac_stream
*
stream
;
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
if
(
!
bus
)
if
(
!
bus
)
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -163,10 +158,9 @@ static int skl_dsp_trigger(struct device *dev, bool start, int stream_tag)
...
@@ -163,10 +158,9 @@ static int skl_dsp_trigger(struct device *dev, bool start, int stream_tag)
static
int
skl_dsp_cleanup
(
struct
device
*
dev
,
static
int
skl_dsp_cleanup
(
struct
device
*
dev
,
struct
snd_dma_buffer
*
dmab
,
int
stream_tag
)
struct
snd_dma_buffer
*
dmab
,
int
stream_tag
)
{
{
struct
hdac_
ext_bus
*
e
bus
=
dev_get_drvdata
(
dev
);
struct
hdac_
bus
*
bus
=
dev_get_drvdata
(
dev
);
struct
hdac_stream
*
stream
;
struct
hdac_stream
*
stream
;
struct
hdac_ext_stream
*
estream
;
struct
hdac_ext_stream
*
estream
;
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
if
(
!
bus
)
if
(
!
bus
)
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -270,8 +264,7 @@ const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id)
...
@@ -270,8 +264,7 @@ const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id)
int
skl_init_dsp
(
struct
skl
*
skl
)
int
skl_init_dsp
(
struct
skl
*
skl
)
{
{
void
__iomem
*
mmio_base
;
void
__iomem
*
mmio_base
;
struct
hdac_ext_bus
*
ebus
=
&
skl
->
ebus
;
struct
hdac_bus
*
bus
=
skl_to_bus
(
skl
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
skl_dsp_loader_ops
loader_ops
;
struct
skl_dsp_loader_ops
loader_ops
;
int
irq
=
bus
->
irq
;
int
irq
=
bus
->
irq
;
const
struct
skl_dsp_ops
*
ops
;
const
struct
skl_dsp_ops
*
ops
;
...
@@ -279,8 +272,8 @@ int skl_init_dsp(struct skl *skl)
...
@@ -279,8 +272,8 @@ int skl_init_dsp(struct skl *skl)
int
ret
;
int
ret
;
/* enable ppcap interrupt */
/* enable ppcap interrupt */
snd_hdac_ext_bus_ppcap_enable
(
&
skl
->
e
bus
,
true
);
snd_hdac_ext_bus_ppcap_enable
(
bus
,
true
);
snd_hdac_ext_bus_ppcap_int_enable
(
&
skl
->
e
bus
,
true
);
snd_hdac_ext_bus_ppcap_int_enable
(
bus
,
true
);
/* read the BAR of the ADSP MMIO */
/* read the BAR of the ADSP MMIO */
mmio_base
=
pci_ioremap_bar
(
skl
->
pci
,
4
);
mmio_base
=
pci_ioremap_bar
(
skl
->
pci
,
4
);
...
@@ -335,12 +328,11 @@ int skl_init_dsp(struct skl *skl)
...
@@ -335,12 +328,11 @@ int skl_init_dsp(struct skl *skl)
int
skl_free_dsp
(
struct
skl
*
skl
)
int
skl_free_dsp
(
struct
skl
*
skl
)
{
{
struct
hdac_ext_bus
*
ebus
=
&
skl
->
ebus
;
struct
hdac_bus
*
bus
=
skl_to_bus
(
skl
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
skl_sst
*
ctx
=
skl
->
skl_sst
;
struct
skl_sst
*
ctx
=
skl
->
skl_sst
;
/* disable ppcap interrupt */
/* disable ppcap interrupt */
snd_hdac_ext_bus_ppcap_int_enable
(
&
skl
->
e
bus
,
false
);
snd_hdac_ext_bus_ppcap_int_enable
(
bus
,
false
);
ctx
->
dsp_ops
->
cleanup
(
bus
->
dev
,
ctx
);
ctx
->
dsp_ops
->
cleanup
(
bus
->
dev
,
ctx
);
...
@@ -383,10 +375,11 @@ int skl_suspend_late_dsp(struct skl *skl)
...
@@ -383,10 +375,11 @@ int skl_suspend_late_dsp(struct skl *skl)
int
skl_suspend_dsp
(
struct
skl
*
skl
)
int
skl_suspend_dsp
(
struct
skl
*
skl
)
{
{
struct
skl_sst
*
ctx
=
skl
->
skl_sst
;
struct
skl_sst
*
ctx
=
skl
->
skl_sst
;
struct
hdac_bus
*
bus
=
skl_to_bus
(
skl
);
int
ret
;
int
ret
;
/* if ppcap is not supported return 0 */
/* if ppcap is not supported return 0 */
if
(
!
skl
->
ebus
.
bus
.
ppcap
)
if
(
!
bus
->
ppcap
)
return
0
;
return
0
;
ret
=
skl_dsp_sleep
(
ctx
->
dsp
);
ret
=
skl_dsp_sleep
(
ctx
->
dsp
);
...
@@ -394,8 +387,8 @@ int skl_suspend_dsp(struct skl *skl)
...
@@ -394,8 +387,8 @@ int skl_suspend_dsp(struct skl *skl)
return
ret
;
return
ret
;
/* disable ppcap interrupt */
/* disable ppcap interrupt */
snd_hdac_ext_bus_ppcap_int_enable
(
&
skl
->
e
bus
,
false
);
snd_hdac_ext_bus_ppcap_int_enable
(
bus
,
false
);
snd_hdac_ext_bus_ppcap_enable
(
&
skl
->
e
bus
,
false
);
snd_hdac_ext_bus_ppcap_enable
(
bus
,
false
);
return
0
;
return
0
;
}
}
...
@@ -403,15 +396,16 @@ int skl_suspend_dsp(struct skl *skl)
...
@@ -403,15 +396,16 @@ int skl_suspend_dsp(struct skl *skl)
int
skl_resume_dsp
(
struct
skl
*
skl
)
int
skl_resume_dsp
(
struct
skl
*
skl
)
{
{
struct
skl_sst
*
ctx
=
skl
->
skl_sst
;
struct
skl_sst
*
ctx
=
skl
->
skl_sst
;
struct
hdac_bus
*
bus
=
skl_to_bus
(
skl
);
int
ret
;
int
ret
;
/* if ppcap is not supported return 0 */
/* if ppcap is not supported return 0 */
if
(
!
skl
->
ebus
.
bus
.
ppcap
)
if
(
!
bus
->
ppcap
)
return
0
;
return
0
;
/* enable ppcap interrupt */
/* enable ppcap interrupt */
snd_hdac_ext_bus_ppcap_enable
(
&
skl
->
e
bus
,
true
);
snd_hdac_ext_bus_ppcap_enable
(
bus
,
true
);
snd_hdac_ext_bus_ppcap_int_enable
(
&
skl
->
e
bus
,
true
);
snd_hdac_ext_bus_ppcap_int_enable
(
bus
,
true
);
/* check if DSP 1st boot is done */
/* check if DSP 1st boot is done */
if
(
skl
->
skl_sst
->
is_first_boot
==
true
)
if
(
skl
->
skl_sst
->
is_first_boot
==
true
)
...
...
sound/soc/intel/skylake/skl-nhlt.c
View file @
9a9b13dd
...
@@ -141,7 +141,7 @@ struct nhlt_specific_cfg
...
@@ -141,7 +141,7 @@ struct nhlt_specific_cfg
{
{
struct
nhlt_fmt
*
fmt
;
struct
nhlt_fmt
*
fmt
;
struct
nhlt_endpoint
*
epnt
;
struct
nhlt_endpoint
*
epnt
;
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
&
skl
->
ebus
);
struct
hdac_bus
*
bus
=
skl_to_bus
(
skl
);
struct
device
*
dev
=
bus
->
dev
;
struct
device
*
dev
=
bus
->
dev
;
struct
nhlt_specific_cfg
*
sp_config
;
struct
nhlt_specific_cfg
*
sp_config
;
struct
nhlt_acpi_table
*
nhlt
=
skl
->
nhlt
;
struct
nhlt_acpi_table
*
nhlt
=
skl
->
nhlt
;
...
@@ -228,7 +228,7 @@ static void skl_nhlt_trim_space(char *trim)
...
@@ -228,7 +228,7 @@ static void skl_nhlt_trim_space(char *trim)
int
skl_nhlt_update_topology_bin
(
struct
skl
*
skl
)
int
skl_nhlt_update_topology_bin
(
struct
skl
*
skl
)
{
{
struct
nhlt_acpi_table
*
nhlt
=
(
struct
nhlt_acpi_table
*
)
skl
->
nhlt
;
struct
nhlt_acpi_table
*
nhlt
=
(
struct
nhlt_acpi_table
*
)
skl
->
nhlt
;
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
&
skl
->
ebus
);
struct
hdac_bus
*
bus
=
skl_to_bus
(
skl
);
struct
device
*
dev
=
bus
->
dev
;
struct
device
*
dev
=
bus
->
dev
;
dev_dbg
(
dev
,
"oem_id %.6s, oem_table_id %8s oem_revision %d
\n
"
,
dev_dbg
(
dev
,
"oem_id %.6s, oem_table_id %8s oem_revision %d
\n
"
,
...
@@ -248,8 +248,8 @@ static ssize_t skl_nhlt_platform_id_show(struct device *dev,
...
@@ -248,8 +248,8 @@ static ssize_t skl_nhlt_platform_id_show(struct device *dev,
struct
device_attribute
*
attr
,
char
*
buf
)
struct
device_attribute
*
attr
,
char
*
buf
)
{
{
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
hdac_
ext_bus
*
e
bus
=
pci_get_drvdata
(
pci
);
struct
hdac_
bus
*
bus
=
pci_get_drvdata
(
pci
);
struct
skl
*
skl
=
ebus_to_skl
(
e
bus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
struct
nhlt_acpi_table
*
nhlt
=
(
struct
nhlt_acpi_table
*
)
skl
->
nhlt
;
struct
nhlt_acpi_table
*
nhlt
=
(
struct
nhlt_acpi_table
*
)
skl
->
nhlt
;
char
platform_id
[
32
];
char
platform_id
[
32
];
...
...
sound/soc/intel/skylake/skl-pcm.c
View file @
9a9b13dd
...
@@ -67,16 +67,15 @@ struct hdac_ext_stream *get_hdac_ext_stream(struct snd_pcm_substream *substream)
...
@@ -67,16 +67,15 @@ struct hdac_ext_stream *get_hdac_ext_stream(struct snd_pcm_substream *substream)
return
substream
->
runtime
->
private_data
;
return
substream
->
runtime
->
private_data
;
}
}
static
struct
hdac_
ext_
bus
*
get_bus_ctx
(
struct
snd_pcm_substream
*
substream
)
static
struct
hdac_bus
*
get_bus_ctx
(
struct
snd_pcm_substream
*
substream
)
{
{
struct
hdac_ext_stream
*
stream
=
get_hdac_ext_stream
(
substream
);
struct
hdac_ext_stream
*
stream
=
get_hdac_ext_stream
(
substream
);
struct
hdac_stream
*
hstream
=
hdac_stream
(
stream
);
struct
hdac_stream
*
hstream
=
hdac_stream
(
stream
);
struct
hdac_bus
*
bus
=
hstream
->
bus
;
struct
hdac_bus
*
bus
=
hstream
->
bus
;
return
bus
;
return
hbus_to_ebus
(
bus
);
}
}
static
int
skl_substream_alloc_pages
(
struct
hdac_
ext_bus
*
e
bus
,
static
int
skl_substream_alloc_pages
(
struct
hdac_
bus
*
bus
,
struct
snd_pcm_substream
*
substream
,
struct
snd_pcm_substream
*
substream
,
size_t
size
)
size_t
size
)
{
{
...
@@ -95,7 +94,7 @@ static int skl_substream_free_pages(struct hdac_bus *bus,
...
@@ -95,7 +94,7 @@ static int skl_substream_free_pages(struct hdac_bus *bus,
return
snd_pcm_lib_free_pages
(
substream
);
return
snd_pcm_lib_free_pages
(
substream
);
}
}
static
void
skl_set_pcm_constrains
(
struct
hdac_
ext_bus
*
e
bus
,
static
void
skl_set_pcm_constrains
(
struct
hdac_
bus
*
bus
,
struct
snd_pcm_runtime
*
runtime
)
struct
snd_pcm_runtime
*
runtime
)
{
{
snd_pcm_hw_constraint_integer
(
runtime
,
SNDRV_PCM_HW_PARAM_PERIODS
);
snd_pcm_hw_constraint_integer
(
runtime
,
SNDRV_PCM_HW_PARAM_PERIODS
);
...
@@ -105,9 +104,9 @@ static void skl_set_pcm_constrains(struct hdac_ext_bus *ebus,
...
@@ -105,9 +104,9 @@ static void skl_set_pcm_constrains(struct hdac_ext_bus *ebus,
20
,
178000000
);
20
,
178000000
);
}
}
static
enum
hdac_ext_stream_type
skl_get_host_stream_type
(
struct
hdac_
ext_bus
*
e
bus
)
static
enum
hdac_ext_stream_type
skl_get_host_stream_type
(
struct
hdac_
bus
*
bus
)
{
{
if
(
(
ebus_to_hbus
(
ebus
))
->
ppcap
)
if
(
bus
->
ppcap
)
return
HDAC_EXT_STREAM_TYPE_HOST
;
return
HDAC_EXT_STREAM_TYPE_HOST
;
else
else
return
HDAC_EXT_STREAM_TYPE_COUPLED
;
return
HDAC_EXT_STREAM_TYPE_COUPLED
;
...
@@ -123,9 +122,9 @@ static enum hdac_ext_stream_type skl_get_host_stream_type(struct hdac_ext_bus *e
...
@@ -123,9 +122,9 @@ static enum hdac_ext_stream_type skl_get_host_stream_type(struct hdac_ext_bus *e
static
void
skl_set_suspend_active
(
struct
snd_pcm_substream
*
substream
,
static
void
skl_set_suspend_active
(
struct
snd_pcm_substream
*
substream
,
struct
snd_soc_dai
*
dai
,
bool
enable
)
struct
snd_soc_dai
*
dai
,
bool
enable
)
{
{
struct
hdac_
ext_bus
*
e
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
hdac_
bus
*
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
snd_soc_dapm_widget
*
w
;
struct
snd_soc_dapm_widget
*
w
;
struct
skl
*
skl
=
ebus_to_skl
(
e
bus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
if
(
substream
->
stream
==
SNDRV_PCM_STREAM_PLAYBACK
)
if
(
substream
->
stream
==
SNDRV_PCM_STREAM_PLAYBACK
)
w
=
dai
->
playback_widget
;
w
=
dai
->
playback_widget
;
...
@@ -140,8 +139,7 @@ static void skl_set_suspend_active(struct snd_pcm_substream *substream,
...
@@ -140,8 +139,7 @@ static void skl_set_suspend_active(struct snd_pcm_substream *substream,
int
skl_pcm_host_dma_prepare
(
struct
device
*
dev
,
struct
skl_pipe_params
*
params
)
int
skl_pcm_host_dma_prepare
(
struct
device
*
dev
,
struct
skl_pipe_params
*
params
)
{
{
struct
hdac_ext_bus
*
ebus
=
dev_get_drvdata
(
dev
);
struct
hdac_bus
*
bus
=
dev_get_drvdata
(
dev
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
unsigned
int
format_val
;
unsigned
int
format_val
;
struct
hdac_stream
*
hstream
;
struct
hdac_stream
*
hstream
;
struct
hdac_ext_stream
*
stream
;
struct
hdac_ext_stream
*
stream
;
...
@@ -153,7 +151,7 @@ int skl_pcm_host_dma_prepare(struct device *dev, struct skl_pipe_params *params)
...
@@ -153,7 +151,7 @@ int skl_pcm_host_dma_prepare(struct device *dev, struct skl_pipe_params *params)
return
-
EINVAL
;
return
-
EINVAL
;
stream
=
stream_to_hdac_ext_stream
(
hstream
);
stream
=
stream_to_hdac_ext_stream
(
hstream
);
snd_hdac_ext_stream_decouple
(
e
bus
,
stream
,
true
);
snd_hdac_ext_stream_decouple
(
bus
,
stream
,
true
);
format_val
=
snd_hdac_calc_stream_format
(
params
->
s_freq
,
format_val
=
snd_hdac_calc_stream_format
(
params
->
s_freq
,
params
->
ch
,
params
->
format
,
params
->
host_bps
,
0
);
params
->
ch
,
params
->
format
,
params
->
host_bps
,
0
);
...
@@ -177,8 +175,7 @@ int skl_pcm_host_dma_prepare(struct device *dev, struct skl_pipe_params *params)
...
@@ -177,8 +175,7 @@ int skl_pcm_host_dma_prepare(struct device *dev, struct skl_pipe_params *params)
int
skl_pcm_link_dma_prepare
(
struct
device
*
dev
,
struct
skl_pipe_params
*
params
)
int
skl_pcm_link_dma_prepare
(
struct
device
*
dev
,
struct
skl_pipe_params
*
params
)
{
{
struct
hdac_ext_bus
*
ebus
=
dev_get_drvdata
(
dev
);
struct
hdac_bus
*
bus
=
dev_get_drvdata
(
dev
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
unsigned
int
format_val
;
unsigned
int
format_val
;
struct
hdac_stream
*
hstream
;
struct
hdac_stream
*
hstream
;
struct
hdac_ext_stream
*
stream
;
struct
hdac_ext_stream
*
stream
;
...
@@ -190,7 +187,7 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params)
...
@@ -190,7 +187,7 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params)
return
-
EINVAL
;
return
-
EINVAL
;
stream
=
stream_to_hdac_ext_stream
(
hstream
);
stream
=
stream_to_hdac_ext_stream
(
hstream
);
snd_hdac_ext_stream_decouple
(
e
bus
,
stream
,
true
);
snd_hdac_ext_stream_decouple
(
bus
,
stream
,
true
);
format_val
=
snd_hdac_calc_stream_format
(
params
->
s_freq
,
params
->
ch
,
format_val
=
snd_hdac_calc_stream_format
(
params
->
s_freq
,
params
->
ch
,
params
->
format
,
params
->
link_bps
,
0
);
params
->
format
,
params
->
link_bps
,
0
);
...
@@ -201,7 +198,7 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params)
...
@@ -201,7 +198,7 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params)
snd_hdac_ext_link_stream_setup
(
stream
,
format_val
);
snd_hdac_ext_link_stream_setup
(
stream
,
format_val
);
list_for_each_entry
(
link
,
&
e
bus
->
hlink_list
,
list
)
{
list_for_each_entry
(
link
,
&
bus
->
hlink_list
,
list
)
{
if
(
link
->
index
==
params
->
link_index
)
if
(
link
->
index
==
params
->
link_index
)
snd_hdac_ext_link_set_stream_id
(
link
,
snd_hdac_ext_link_set_stream_id
(
link
,
hstream
->
stream_tag
);
hstream
->
stream_tag
);
...
@@ -215,7 +212,7 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params)
...
@@ -215,7 +212,7 @@ int skl_pcm_link_dma_prepare(struct device *dev, struct skl_pipe_params *params)
static
int
skl_pcm_open
(
struct
snd_pcm_substream
*
substream
,
static
int
skl_pcm_open
(
struct
snd_pcm_substream
*
substream
,
struct
snd_soc_dai
*
dai
)
struct
snd_soc_dai
*
dai
)
{
{
struct
hdac_
ext_bus
*
e
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
hdac_
bus
*
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
hdac_ext_stream
*
stream
;
struct
hdac_ext_stream
*
stream
;
struct
snd_pcm_runtime
*
runtime
=
substream
->
runtime
;
struct
snd_pcm_runtime
*
runtime
=
substream
->
runtime
;
struct
skl_dma_params
*
dma_params
;
struct
skl_dma_params
*
dma_params
;
...
@@ -224,12 +221,12 @@ static int skl_pcm_open(struct snd_pcm_substream *substream,
...
@@ -224,12 +221,12 @@ static int skl_pcm_open(struct snd_pcm_substream *substream,
dev_dbg
(
dai
->
dev
,
"%s: %s
\n
"
,
__func__
,
dai
->
name
);
dev_dbg
(
dai
->
dev
,
"%s: %s
\n
"
,
__func__
,
dai
->
name
);
stream
=
snd_hdac_ext_stream_assign
(
e
bus
,
substream
,
stream
=
snd_hdac_ext_stream_assign
(
bus
,
substream
,
skl_get_host_stream_type
(
e
bus
));
skl_get_host_stream_type
(
bus
));
if
(
stream
==
NULL
)
if
(
stream
==
NULL
)
return
-
EBUSY
;
return
-
EBUSY
;
skl_set_pcm_constrains
(
e
bus
,
runtime
);
skl_set_pcm_constrains
(
bus
,
runtime
);
/*
/*
* disable WALLCLOCK timestamps for capture streams
* disable WALLCLOCK timestamps for capture streams
...
@@ -301,7 +298,7 @@ static int skl_pcm_hw_params(struct snd_pcm_substream *substream,
...
@@ -301,7 +298,7 @@ static int skl_pcm_hw_params(struct snd_pcm_substream *substream,
struct
snd_pcm_hw_params
*
params
,
struct
snd_pcm_hw_params
*
params
,
struct
snd_soc_dai
*
dai
)
struct
snd_soc_dai
*
dai
)
{
{
struct
hdac_
ext_bus
*
e
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
hdac_
bus
*
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
hdac_ext_stream
*
stream
=
get_hdac_ext_stream
(
substream
);
struct
hdac_ext_stream
*
stream
=
get_hdac_ext_stream
(
substream
);
struct
snd_pcm_runtime
*
runtime
=
substream
->
runtime
;
struct
snd_pcm_runtime
*
runtime
=
substream
->
runtime
;
struct
skl_pipe_params
p_params
=
{
0
};
struct
skl_pipe_params
p_params
=
{
0
};
...
@@ -309,7 +306,7 @@ static int skl_pcm_hw_params(struct snd_pcm_substream *substream,
...
@@ -309,7 +306,7 @@ static int skl_pcm_hw_params(struct snd_pcm_substream *substream,
int
ret
,
dma_id
;
int
ret
,
dma_id
;
dev_dbg
(
dai
->
dev
,
"%s: %s
\n
"
,
__func__
,
dai
->
name
);
dev_dbg
(
dai
->
dev
,
"%s: %s
\n
"
,
__func__
,
dai
->
name
);
ret
=
skl_substream_alloc_pages
(
e
bus
,
substream
,
ret
=
skl_substream_alloc_pages
(
bus
,
substream
,
params_buffer_bytes
(
params
));
params_buffer_bytes
(
params
));
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
...
@@ -343,14 +340,14 @@ static void skl_pcm_close(struct snd_pcm_substream *substream,
...
@@ -343,14 +340,14 @@ static void skl_pcm_close(struct snd_pcm_substream *substream,
struct
snd_soc_dai
*
dai
)
struct
snd_soc_dai
*
dai
)
{
{
struct
hdac_ext_stream
*
stream
=
get_hdac_ext_stream
(
substream
);
struct
hdac_ext_stream
*
stream
=
get_hdac_ext_stream
(
substream
);
struct
hdac_
ext_bus
*
e
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
hdac_
bus
*
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
skl_dma_params
*
dma_params
=
NULL
;
struct
skl_dma_params
*
dma_params
=
NULL
;
struct
skl
*
skl
=
ebus_to_skl
(
e
bus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
struct
skl_module_cfg
*
mconfig
;
struct
skl_module_cfg
*
mconfig
;
dev_dbg
(
dai
->
dev
,
"%s: %s
\n
"
,
__func__
,
dai
->
name
);
dev_dbg
(
dai
->
dev
,
"%s: %s
\n
"
,
__func__
,
dai
->
name
);
snd_hdac_ext_stream_release
(
stream
,
skl_get_host_stream_type
(
e
bus
));
snd_hdac_ext_stream_release
(
stream
,
skl_get_host_stream_type
(
bus
));
dma_params
=
snd_soc_dai_get_dma_data
(
dai
,
substream
);
dma_params
=
snd_soc_dai_get_dma_data
(
dai
,
substream
);
/*
/*
...
@@ -380,7 +377,7 @@ static void skl_pcm_close(struct snd_pcm_substream *substream,
...
@@ -380,7 +377,7 @@ static void skl_pcm_close(struct snd_pcm_substream *substream,
static
int
skl_pcm_hw_free
(
struct
snd_pcm_substream
*
substream
,
static
int
skl_pcm_hw_free
(
struct
snd_pcm_substream
*
substream
,
struct
snd_soc_dai
*
dai
)
struct
snd_soc_dai
*
dai
)
{
{
struct
hdac_
ext_bus
*
e
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
hdac_
bus
*
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
hdac_ext_stream
*
stream
=
get_hdac_ext_stream
(
substream
);
struct
hdac_ext_stream
*
stream
=
get_hdac_ext_stream
(
substream
);
struct
skl
*
skl
=
get_skl_ctx
(
dai
->
dev
);
struct
skl
*
skl
=
get_skl_ctx
(
dai
->
dev
);
struct
skl_module_cfg
*
mconfig
;
struct
skl_module_cfg
*
mconfig
;
...
@@ -400,7 +397,7 @@ static int skl_pcm_hw_free(struct snd_pcm_substream *substream,
...
@@ -400,7 +397,7 @@ static int skl_pcm_hw_free(struct snd_pcm_substream *substream,
snd_hdac_stream_cleanup
(
hdac_stream
(
stream
));
snd_hdac_stream_cleanup
(
hdac_stream
(
stream
));
hdac_stream
(
stream
)
->
prepared
=
0
;
hdac_stream
(
stream
)
->
prepared
=
0
;
return
skl_substream_free_pages
(
ebus_to_hbus
(
ebus
)
,
substream
);
return
skl_substream_free_pages
(
bus
,
substream
);
}
}
static
int
skl_be_hw_params
(
struct
snd_pcm_substream
*
substream
,
static
int
skl_be_hw_params
(
struct
snd_pcm_substream
*
substream
,
...
@@ -420,8 +417,7 @@ static int skl_be_hw_params(struct snd_pcm_substream *substream,
...
@@ -420,8 +417,7 @@ static int skl_be_hw_params(struct snd_pcm_substream *substream,
static
int
skl_decoupled_trigger
(
struct
snd_pcm_substream
*
substream
,
static
int
skl_decoupled_trigger
(
struct
snd_pcm_substream
*
substream
,
int
cmd
)
int
cmd
)
{
{
struct
hdac_ext_bus
*
ebus
=
get_bus_ctx
(
substream
);
struct
hdac_bus
*
bus
=
get_bus_ctx
(
substream
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
hdac_ext_stream
*
stream
;
struct
hdac_ext_stream
*
stream
;
int
start
;
int
start
;
unsigned
long
cookie
;
unsigned
long
cookie
;
...
@@ -470,7 +466,7 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
...
@@ -470,7 +466,7 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
struct
skl
*
skl
=
get_skl_ctx
(
dai
->
dev
);
struct
skl
*
skl
=
get_skl_ctx
(
dai
->
dev
);
struct
skl_sst
*
ctx
=
skl
->
skl_sst
;
struct
skl_sst
*
ctx
=
skl
->
skl_sst
;
struct
skl_module_cfg
*
mconfig
;
struct
skl_module_cfg
*
mconfig
;
struct
hdac_
ext_bus
*
e
bus
=
get_bus_ctx
(
substream
);
struct
hdac_
bus
*
bus
=
get_bus_ctx
(
substream
);
struct
hdac_ext_stream
*
stream
=
get_hdac_ext_stream
(
substream
);
struct
hdac_ext_stream
*
stream
=
get_hdac_ext_stream
(
substream
);
struct
snd_soc_dapm_widget
*
w
;
struct
snd_soc_dapm_widget
*
w
;
int
ret
;
int
ret
;
...
@@ -492,9 +488,9 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
...
@@ -492,9 +488,9 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
* dpib & lpib position to resume before starting the
* dpib & lpib position to resume before starting the
* DMA
* DMA
*/
*/
snd_hdac_ext_stream_drsm_enable
(
e
bus
,
true
,
snd_hdac_ext_stream_drsm_enable
(
bus
,
true
,
hdac_stream
(
stream
)
->
index
);
hdac_stream
(
stream
)
->
index
);
snd_hdac_ext_stream_set_dpibr
(
e
bus
,
stream
,
snd_hdac_ext_stream_set_dpibr
(
bus
,
stream
,
stream
->
lpib
);
stream
->
lpib
);
snd_hdac_ext_stream_set_lpib
(
stream
,
stream
->
lpib
);
snd_hdac_ext_stream_set_lpib
(
stream
,
stream
->
lpib
);
}
}
...
@@ -528,14 +524,14 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
...
@@ -528,14 +524,14 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
ret
=
skl_decoupled_trigger
(
substream
,
cmd
);
ret
=
skl_decoupled_trigger
(
substream
,
cmd
);
if
((
cmd
==
SNDRV_PCM_TRIGGER_SUSPEND
)
&&
!
w
->
ignore_suspend
)
{
if
((
cmd
==
SNDRV_PCM_TRIGGER_SUSPEND
)
&&
!
w
->
ignore_suspend
)
{
/* save the dpib and lpib positions */
/* save the dpib and lpib positions */
stream
->
dpib
=
readl
(
ebus
->
bus
.
remap_addr
+
stream
->
dpib
=
readl
(
bus
->
remap_addr
+
AZX_REG_VS_SDXDPIB_XBASE
+
AZX_REG_VS_SDXDPIB_XBASE
+
(
AZX_REG_VS_SDXDPIB_XINTERVAL
*
(
AZX_REG_VS_SDXDPIB_XINTERVAL
*
hdac_stream
(
stream
)
->
index
));
hdac_stream
(
stream
)
->
index
));
stream
->
lpib
=
snd_hdac_stream_get_pos_lpib
(
stream
->
lpib
=
snd_hdac_stream_get_pos_lpib
(
hdac_stream
(
stream
));
hdac_stream
(
stream
));
snd_hdac_ext_stream_decouple
(
e
bus
,
stream
,
false
);
snd_hdac_ext_stream_decouple
(
bus
,
stream
,
false
);
}
}
break
;
break
;
...
@@ -546,11 +542,12 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
...
@@ -546,11 +542,12 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
return
0
;
return
0
;
}
}
static
int
skl_link_hw_params
(
struct
snd_pcm_substream
*
substream
,
static
int
skl_link_hw_params
(
struct
snd_pcm_substream
*
substream
,
struct
snd_pcm_hw_params
*
params
,
struct
snd_pcm_hw_params
*
params
,
struct
snd_soc_dai
*
dai
)
struct
snd_soc_dai
*
dai
)
{
{
struct
hdac_
ext_bus
*
e
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
hdac_
bus
*
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
hdac_ext_stream
*
link_dev
;
struct
hdac_ext_stream
*
link_dev
;
struct
snd_soc_pcm_runtime
*
rtd
=
snd_pcm_substream_chip
(
substream
);
struct
snd_soc_pcm_runtime
*
rtd
=
snd_pcm_substream_chip
(
substream
);
struct
snd_soc_dai
*
codec_dai
=
rtd
->
codec_dai
;
struct
snd_soc_dai
*
codec_dai
=
rtd
->
codec_dai
;
...
@@ -558,14 +555,14 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,
...
@@ -558,14 +555,14 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,
struct
hdac_ext_link
*
link
;
struct
hdac_ext_link
*
link
;
int
stream_tag
;
int
stream_tag
;
link_dev
=
snd_hdac_ext_stream_assign
(
e
bus
,
substream
,
link_dev
=
snd_hdac_ext_stream_assign
(
bus
,
substream
,
HDAC_EXT_STREAM_TYPE_LINK
);
HDAC_EXT_STREAM_TYPE_LINK
);
if
(
!
link_dev
)
if
(
!
link_dev
)
return
-
EBUSY
;
return
-
EBUSY
;
snd_soc_dai_set_dma_data
(
dai
,
substream
,
(
void
*
)
link_dev
);
snd_soc_dai_set_dma_data
(
dai
,
substream
,
(
void
*
)
link_dev
);
link
=
snd_hdac_ext_bus_get_link
(
e
bus
,
codec_dai
->
component
->
name
);
link
=
snd_hdac_ext_bus_get_link
(
bus
,
codec_dai
->
component
->
name
);
if
(
!
link
)
if
(
!
link
)
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -610,7 +607,7 @@ static int skl_link_pcm_trigger(struct snd_pcm_substream *substream,
...
@@ -610,7 +607,7 @@ static int skl_link_pcm_trigger(struct snd_pcm_substream *substream,
{
{
struct
hdac_ext_stream
*
link_dev
=
struct
hdac_ext_stream
*
link_dev
=
snd_soc_dai_get_dma_data
(
dai
,
substream
);
snd_soc_dai_get_dma_data
(
dai
,
substream
);
struct
hdac_
ext_bus
*
e
bus
=
get_bus_ctx
(
substream
);
struct
hdac_
bus
*
bus
=
get_bus_ctx
(
substream
);
struct
hdac_ext_stream
*
stream
=
get_hdac_ext_stream
(
substream
);
struct
hdac_ext_stream
*
stream
=
get_hdac_ext_stream
(
substream
);
dev_dbg
(
dai
->
dev
,
"In %s cmd=%d
\n
"
,
__func__
,
cmd
);
dev_dbg
(
dai
->
dev
,
"In %s cmd=%d
\n
"
,
__func__
,
cmd
);
...
@@ -626,7 +623,7 @@ static int skl_link_pcm_trigger(struct snd_pcm_substream *substream,
...
@@ -626,7 +623,7 @@ static int skl_link_pcm_trigger(struct snd_pcm_substream *substream,
case
SNDRV_PCM_TRIGGER_STOP
:
case
SNDRV_PCM_TRIGGER_STOP
:
snd_hdac_ext_link_stream_clear
(
link_dev
);
snd_hdac_ext_link_stream_clear
(
link_dev
);
if
(
cmd
==
SNDRV_PCM_TRIGGER_SUSPEND
)
if
(
cmd
==
SNDRV_PCM_TRIGGER_SUSPEND
)
snd_hdac_ext_stream_decouple
(
e
bus
,
stream
,
false
);
snd_hdac_ext_stream_decouple
(
bus
,
stream
,
false
);
break
;
break
;
default:
default:
...
@@ -638,7 +635,7 @@ static int skl_link_pcm_trigger(struct snd_pcm_substream *substream,
...
@@ -638,7 +635,7 @@ static int skl_link_pcm_trigger(struct snd_pcm_substream *substream,
static
int
skl_link_hw_free
(
struct
snd_pcm_substream
*
substream
,
static
int
skl_link_hw_free
(
struct
snd_pcm_substream
*
substream
,
struct
snd_soc_dai
*
dai
)
struct
snd_soc_dai
*
dai
)
{
{
struct
hdac_
ext_bus
*
e
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
hdac_
bus
*
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
snd_soc_pcm_runtime
*
rtd
=
snd_pcm_substream_chip
(
substream
);
struct
snd_soc_pcm_runtime
*
rtd
=
snd_pcm_substream_chip
(
substream
);
struct
hdac_ext_stream
*
link_dev
=
struct
hdac_ext_stream
*
link_dev
=
snd_soc_dai_get_dma_data
(
dai
,
substream
);
snd_soc_dai_get_dma_data
(
dai
,
substream
);
...
@@ -648,7 +645,7 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream,
...
@@ -648,7 +645,7 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream,
link_dev
->
link_prepared
=
0
;
link_dev
->
link_prepared
=
0
;
link
=
snd_hdac_ext_bus_get_link
(
e
bus
,
rtd
->
codec_dai
->
component
->
name
);
link
=
snd_hdac_ext_bus_get_link
(
bus
,
rtd
->
codec_dai
->
component
->
name
);
if
(
!
link
)
if
(
!
link
)
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -1041,8 +1038,7 @@ static int skl_platform_open(struct snd_pcm_substream *substream)
...
@@ -1041,8 +1038,7 @@ static int skl_platform_open(struct snd_pcm_substream *substream)
static
int
skl_coupled_trigger
(
struct
snd_pcm_substream
*
substream
,
static
int
skl_coupled_trigger
(
struct
snd_pcm_substream
*
substream
,
int
cmd
)
int
cmd
)
{
{
struct
hdac_ext_bus
*
ebus
=
get_bus_ctx
(
substream
);
struct
hdac_bus
*
bus
=
get_bus_ctx
(
substream
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
hdac_ext_stream
*
stream
;
struct
hdac_ext_stream
*
stream
;
struct
snd_pcm_substream
*
s
;
struct
snd_pcm_substream
*
s
;
bool
start
;
bool
start
;
...
@@ -1115,9 +1111,9 @@ static int skl_coupled_trigger(struct snd_pcm_substream *substream,
...
@@ -1115,9 +1111,9 @@ static int skl_coupled_trigger(struct snd_pcm_substream *substream,
static
int
skl_platform_pcm_trigger
(
struct
snd_pcm_substream
*
substream
,
static
int
skl_platform_pcm_trigger
(
struct
snd_pcm_substream
*
substream
,
int
cmd
)
int
cmd
)
{
{
struct
hdac_
ext_bus
*
e
bus
=
get_bus_ctx
(
substream
);
struct
hdac_
bus
*
bus
=
get_bus_ctx
(
substream
);
if
(
!
(
ebus_to_hbus
(
ebus
))
->
ppcap
)
if
(
!
bus
->
ppcap
)
return
skl_coupled_trigger
(
substream
,
cmd
);
return
skl_coupled_trigger
(
substream
,
cmd
);
return
0
;
return
0
;
...
@@ -1127,7 +1123,7 @@ static snd_pcm_uframes_t skl_platform_pcm_pointer
...
@@ -1127,7 +1123,7 @@ static snd_pcm_uframes_t skl_platform_pcm_pointer
(
struct
snd_pcm_substream
*
substream
)
(
struct
snd_pcm_substream
*
substream
)
{
{
struct
hdac_ext_stream
*
hstream
=
get_hdac_ext_stream
(
substream
);
struct
hdac_ext_stream
*
hstream
=
get_hdac_ext_stream
(
substream
);
struct
hdac_
ext_bus
*
e
bus
=
get_bus_ctx
(
substream
);
struct
hdac_
bus
*
bus
=
get_bus_ctx
(
substream
);
unsigned
int
pos
;
unsigned
int
pos
;
/*
/*
...
@@ -1152,12 +1148,12 @@ static snd_pcm_uframes_t skl_platform_pcm_pointer
...
@@ -1152,12 +1148,12 @@ static snd_pcm_uframes_t skl_platform_pcm_pointer
*/
*/
if
(
substream
->
stream
==
SNDRV_PCM_STREAM_PLAYBACK
)
{
if
(
substream
->
stream
==
SNDRV_PCM_STREAM_PLAYBACK
)
{
pos
=
readl
(
ebus
->
bus
.
remap_addr
+
AZX_REG_VS_SDXDPIB_XBASE
+
pos
=
readl
(
bus
->
remap_addr
+
AZX_REG_VS_SDXDPIB_XBASE
+
(
AZX_REG_VS_SDXDPIB_XINTERVAL
*
(
AZX_REG_VS_SDXDPIB_XINTERVAL
*
hdac_stream
(
hstream
)
->
index
));
hdac_stream
(
hstream
)
->
index
));
}
else
{
}
else
{
udelay
(
20
);
udelay
(
20
);
readl
(
ebus
->
bus
.
remap_addr
+
readl
(
bus
->
remap_addr
+
AZX_REG_VS_SDXDPIB_XBASE
+
AZX_REG_VS_SDXDPIB_XBASE
+
(
AZX_REG_VS_SDXDPIB_XINTERVAL
*
(
AZX_REG_VS_SDXDPIB_XINTERVAL
*
hdac_stream
(
hstream
)
->
index
));
hdac_stream
(
hstream
)
->
index
));
...
@@ -1242,11 +1238,11 @@ static void skl_pcm_free(struct snd_pcm *pcm)
...
@@ -1242,11 +1238,11 @@ static void skl_pcm_free(struct snd_pcm *pcm)
static
int
skl_pcm_new
(
struct
snd_soc_pcm_runtime
*
rtd
)
static
int
skl_pcm_new
(
struct
snd_soc_pcm_runtime
*
rtd
)
{
{
struct
snd_soc_dai
*
dai
=
rtd
->
cpu_dai
;
struct
snd_soc_dai
*
dai
=
rtd
->
cpu_dai
;
struct
hdac_
ext_bus
*
e
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
hdac_
bus
*
bus
=
dev_get_drvdata
(
dai
->
dev
);
struct
snd_pcm
*
pcm
=
rtd
->
pcm
;
struct
snd_pcm
*
pcm
=
rtd
->
pcm
;
unsigned
int
size
;
unsigned
int
size
;
int
retval
=
0
;
int
retval
=
0
;
struct
skl
*
skl
=
ebus_to_skl
(
e
bus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
if
(
dai
->
driver
->
playback
.
channels_min
||
if
(
dai
->
driver
->
playback
.
channels_min
||
dai
->
driver
->
capture
.
channels_min
)
{
dai
->
driver
->
capture
.
channels_min
)
{
...
@@ -1356,19 +1352,19 @@ static int skl_populate_modules(struct skl *skl)
...
@@ -1356,19 +1352,19 @@ static int skl_populate_modules(struct skl *skl)
static
int
skl_platform_soc_probe
(
struct
snd_soc_component
*
component
)
static
int
skl_platform_soc_probe
(
struct
snd_soc_component
*
component
)
{
{
struct
hdac_
ext_bus
*
e
bus
=
dev_get_drvdata
(
component
->
dev
);
struct
hdac_
bus
*
bus
=
dev_get_drvdata
(
component
->
dev
);
struct
skl
*
skl
=
ebus_to_skl
(
e
bus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
const
struct
skl_dsp_ops
*
ops
;
const
struct
skl_dsp_ops
*
ops
;
int
ret
;
int
ret
;
pm_runtime_get_sync
(
component
->
dev
);
pm_runtime_get_sync
(
component
->
dev
);
if
(
(
ebus_to_hbus
(
ebus
))
->
ppcap
)
{
if
(
bus
->
ppcap
)
{
skl
->
component
=
component
;
skl
->
component
=
component
;
/* init debugfs */
/* init debugfs */
skl
->
debugfs
=
skl_debugfs_init
(
skl
);
skl
->
debugfs
=
skl_debugfs_init
(
skl
);
ret
=
skl_tplg_init
(
component
,
e
bus
);
ret
=
skl_tplg_init
(
component
,
bus
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
dev_err
(
component
->
dev
,
"Failed to init topology!
\n
"
);
dev_err
(
component
->
dev
,
"Failed to init topology!
\n
"
);
return
ret
;
return
ret
;
...
@@ -1425,10 +1421,10 @@ static const struct snd_soc_component_driver skl_component = {
...
@@ -1425,10 +1421,10 @@ static const struct snd_soc_component_driver skl_component = {
int
skl_platform_register
(
struct
device
*
dev
)
int
skl_platform_register
(
struct
device
*
dev
)
{
{
int
ret
;
int
ret
;
struct
hdac_ext_bus
*
ebus
=
dev_get_drvdata
(
dev
);
struct
skl
*
skl
=
ebus_to_skl
(
ebus
);
struct
snd_soc_dai_driver
*
dais
;
struct
snd_soc_dai_driver
*
dais
;
int
num_dais
=
ARRAY_SIZE
(
skl_platform_dai
);
int
num_dais
=
ARRAY_SIZE
(
skl_platform_dai
);
struct
hdac_bus
*
bus
=
dev_get_drvdata
(
dev
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
INIT_LIST_HEAD
(
&
skl
->
ppl_list
);
INIT_LIST_HEAD
(
&
skl
->
ppl_list
);
INIT_LIST_HEAD
(
&
skl
->
bind_list
);
INIT_LIST_HEAD
(
&
skl
->
bind_list
);
...
@@ -1464,8 +1460,8 @@ int skl_platform_register(struct device *dev)
...
@@ -1464,8 +1460,8 @@ int skl_platform_register(struct device *dev)
int
skl_platform_unregister
(
struct
device
*
dev
)
int
skl_platform_unregister
(
struct
device
*
dev
)
{
{
struct
hdac_
ext_bus
*
e
bus
=
dev_get_drvdata
(
dev
);
struct
hdac_
bus
*
bus
=
dev_get_drvdata
(
dev
);
struct
skl
*
skl
=
ebus_to_skl
(
e
bus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
struct
skl_module_deferred_bind
*
modules
,
*
tmp
;
struct
skl_module_deferred_bind
*
modules
,
*
tmp
;
if
(
!
list_empty
(
&
skl
->
bind_list
))
{
if
(
!
list_empty
(
&
skl
->
bind_list
))
{
...
...
sound/soc/intel/skylake/skl-topology.c
View file @
9a9b13dd
...
@@ -934,7 +934,7 @@ static int skl_tplg_find_moduleid_from_uuid(struct skl *skl,
...
@@ -934,7 +934,7 @@ static int skl_tplg_find_moduleid_from_uuid(struct skl *skl,
struct
soc_bytes_ext
*
sb
=
(
void
*
)
k
->
private_value
;
struct
soc_bytes_ext
*
sb
=
(
void
*
)
k
->
private_value
;
struct
skl_algo_data
*
bc
=
(
struct
skl_algo_data
*
)
sb
->
dobj
.
private
;
struct
skl_algo_data
*
bc
=
(
struct
skl_algo_data
*
)
sb
->
dobj
.
private
;
struct
skl_kpb_params
*
uuid_params
,
*
params
;
struct
skl_kpb_params
*
uuid_params
,
*
params
;
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
skl_to_ebus
(
skl
)
);
struct
hdac_bus
*
bus
=
skl_to_bus
(
skl
);
int
i
,
size
,
module_id
;
int
i
,
size
,
module_id
;
if
(
bc
->
set_params
==
SKL_PARAM_BIND
&&
bc
->
max
)
{
if
(
bc
->
set_params
==
SKL_PARAM_BIND
&&
bc
->
max
)
{
...
@@ -3029,9 +3029,8 @@ static int skl_tplg_widget_load(struct snd_soc_component *cmpnt,
...
@@ -3029,9 +3029,8 @@ static int skl_tplg_widget_load(struct snd_soc_component *cmpnt,
struct
snd_soc_tplg_dapm_widget
*
tplg_w
)
struct
snd_soc_tplg_dapm_widget
*
tplg_w
)
{
{
int
ret
;
int
ret
;
struct
hdac_ext_bus
*
ebus
=
snd_soc_component_get_drvdata
(
cmpnt
);
struct
hdac_bus
*
bus
=
snd_soc_component_get_drvdata
(
cmpnt
);
struct
skl
*
skl
=
ebus_to_skl
(
ebus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
skl_module_cfg
*
mconfig
;
struct
skl_module_cfg
*
mconfig
;
if
(
!
tplg_w
->
priv
.
size
)
if
(
!
tplg_w
->
priv
.
size
)
...
@@ -3137,8 +3136,7 @@ static int skl_tplg_control_load(struct snd_soc_component *cmpnt,
...
@@ -3137,8 +3136,7 @@ static int skl_tplg_control_load(struct snd_soc_component *cmpnt,
struct
soc_bytes_ext
*
sb
;
struct
soc_bytes_ext
*
sb
;
struct
snd_soc_tplg_bytes_control
*
tplg_bc
;
struct
snd_soc_tplg_bytes_control
*
tplg_bc
;
struct
snd_soc_tplg_enum_control
*
tplg_ec
;
struct
snd_soc_tplg_enum_control
*
tplg_ec
;
struct
hdac_ext_bus
*
ebus
=
snd_soc_component_get_drvdata
(
cmpnt
);
struct
hdac_bus
*
bus
=
snd_soc_component_get_drvdata
(
cmpnt
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
soc_enum
*
se
;
struct
soc_enum
*
se
;
switch
(
hdr
->
ops
.
info
)
{
switch
(
hdr
->
ops
.
info
)
{
...
@@ -3622,9 +3620,8 @@ static int skl_tplg_get_manifest_data(struct snd_soc_tplg_manifest *manifest,
...
@@ -3622,9 +3620,8 @@ static int skl_tplg_get_manifest_data(struct snd_soc_tplg_manifest *manifest,
static
int
skl_manifest_load
(
struct
snd_soc_component
*
cmpnt
,
static
int
skl_manifest_load
(
struct
snd_soc_component
*
cmpnt
,
struct
snd_soc_tplg_manifest
*
manifest
)
struct
snd_soc_tplg_manifest
*
manifest
)
{
{
struct
hdac_ext_bus
*
ebus
=
snd_soc_component_get_drvdata
(
cmpnt
);
struct
hdac_bus
*
bus
=
snd_soc_component_get_drvdata
(
cmpnt
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
struct
skl
*
skl
=
ebus_to_skl
(
ebus
);
/* proceed only if we have private data defined */
/* proceed only if we have private data defined */
if
(
manifest
->
priv
.
size
==
0
)
if
(
manifest
->
priv
.
size
==
0
)
...
@@ -3713,12 +3710,11 @@ static void skl_tplg_set_pipe_type(struct skl *skl, struct skl_pipe *pipe)
...
@@ -3713,12 +3710,11 @@ static void skl_tplg_set_pipe_type(struct skl *skl, struct skl_pipe *pipe)
/*
/*
* SKL topology init routine
* SKL topology init routine
*/
*/
int
skl_tplg_init
(
struct
snd_soc_component
*
component
,
struct
hdac_
ext_bus
*
e
bus
)
int
skl_tplg_init
(
struct
snd_soc_component
*
component
,
struct
hdac_
bus
*
bus
)
{
{
int
ret
;
int
ret
;
const
struct
firmware
*
fw
;
const
struct
firmware
*
fw
;
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
struct
skl
*
skl
=
ebus_to_skl
(
ebus
);
struct
skl_pipeline
*
ppl
;
struct
skl_pipeline
*
ppl
;
ret
=
request_firmware
(
&
fw
,
skl
->
tplg_name
,
bus
->
dev
);
ret
=
request_firmware
(
&
fw
,
skl
->
tplg_name
,
bus
->
dev
);
...
...
sound/soc/intel/skylake/skl-topology.h
View file @
9a9b13dd
...
@@ -458,9 +458,9 @@ enum skl_channel {
...
@@ -458,9 +458,9 @@ enum skl_channel {
static
inline
struct
skl
*
get_skl_ctx
(
struct
device
*
dev
)
static
inline
struct
skl
*
get_skl_ctx
(
struct
device
*
dev
)
{
{
struct
hdac_
ext_bus
*
e
bus
=
dev_get_drvdata
(
dev
);
struct
hdac_
bus
*
bus
=
dev_get_drvdata
(
dev
);
return
ebus_to_skl
(
e
bus
);
return
bus_to_skl
(
bus
);
}
}
int
skl_tplg_be_update_params
(
struct
snd_soc_dai
*
dai
,
int
skl_tplg_be_update_params
(
struct
snd_soc_dai
*
dai
,
...
@@ -470,7 +470,7 @@ int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps,
...
@@ -470,7 +470,7 @@ int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps,
void
skl_tplg_set_be_dmic_config
(
struct
snd_soc_dai
*
dai
,
void
skl_tplg_set_be_dmic_config
(
struct
snd_soc_dai
*
dai
,
struct
skl_pipe_params
*
params
,
int
stream
);
struct
skl_pipe_params
*
params
,
int
stream
);
int
skl_tplg_init
(
struct
snd_soc_component
*
component
,
int
skl_tplg_init
(
struct
snd_soc_component
*
component
,
struct
hdac_
ext_
bus
*
ebus
);
struct
hdac_bus
*
ebus
);
struct
skl_module_cfg
*
skl_tplg_fe_get_cpr_module
(
struct
skl_module_cfg
*
skl_tplg_fe_get_cpr_module
(
struct
snd_soc_dai
*
dai
,
int
stream
);
struct
snd_soc_dai
*
dai
,
int
stream
);
int
skl_tplg_update_pipe_params
(
struct
device
*
dev
,
int
skl_tplg_update_pipe_params
(
struct
device
*
dev
,
...
...
sound/soc/intel/skylake/skl.c
View file @
9a9b13dd
...
@@ -54,7 +54,7 @@ static void skl_update_pci_byte(struct pci_dev *pci, unsigned int reg,
...
@@ -54,7 +54,7 @@ static void skl_update_pci_byte(struct pci_dev *pci, unsigned int reg,
static
void
skl_init_pci
(
struct
skl
*
skl
)
static
void
skl_init_pci
(
struct
skl
*
skl
)
{
{
struct
hdac_
ext_bus
*
ebus
=
&
skl
->
ebus
;
struct
hdac_
bus
*
bus
=
skl_to_bus
(
skl
)
;
/*
/*
* Clear bits 0-2 of PCI register TCSEL (at offset 0x44)
* Clear bits 0-2 of PCI register TCSEL (at offset 0x44)
...
@@ -63,7 +63,7 @@ static void skl_init_pci(struct skl *skl)
...
@@ -63,7 +63,7 @@ static void skl_init_pci(struct skl *skl)
* codecs.
* codecs.
* The PCI register TCSEL is defined in the Intel manuals.
* The PCI register TCSEL is defined in the Intel manuals.
*/
*/
dev_dbg
(
ebus_to_hbus
(
ebus
)
->
dev
,
"Clearing TCSEL
\n
"
);
dev_dbg
(
bus
->
dev
,
"Clearing TCSEL
\n
"
);
skl_update_pci_byte
(
skl
->
pci
,
AZX_PCIREG_TCSEL
,
0x07
,
0
);
skl_update_pci_byte
(
skl
->
pci
,
AZX_PCIREG_TCSEL
,
0x07
,
0
);
}
}
...
@@ -103,8 +103,7 @@ static void skl_enable_miscbdcge(struct device *dev, bool enable)
...
@@ -103,8 +103,7 @@ static void skl_enable_miscbdcge(struct device *dev, bool enable)
static
void
skl_clock_power_gating
(
struct
device
*
dev
,
bool
enable
)
static
void
skl_clock_power_gating
(
struct
device
*
dev
,
bool
enable
)
{
{
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
hdac_ext_bus
*
ebus
=
pci_get_drvdata
(
pci
);
struct
hdac_bus
*
bus
=
pci_get_drvdata
(
pci
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
u32
val
;
u32
val
;
/* Update PDCGE bit of CGCTL register */
/* Update PDCGE bit of CGCTL register */
...
@@ -127,7 +126,6 @@ static void skl_clock_power_gating(struct device *dev, bool enable)
...
@@ -127,7 +126,6 @@ static void skl_clock_power_gating(struct device *dev, bool enable)
*/
*/
static
int
skl_init_chip
(
struct
hdac_bus
*
bus
,
bool
full_reset
)
static
int
skl_init_chip
(
struct
hdac_bus
*
bus
,
bool
full_reset
)
{
{
struct
hdac_ext_bus
*
ebus
=
hbus_to_ebus
(
bus
);
struct
hdac_ext_link
*
hlink
;
struct
hdac_ext_link
*
hlink
;
int
ret
;
int
ret
;
...
@@ -135,7 +133,7 @@ static int skl_init_chip(struct hdac_bus *bus, bool full_reset)
...
@@ -135,7 +133,7 @@ static int skl_init_chip(struct hdac_bus *bus, bool full_reset)
ret
=
snd_hdac_bus_init_chip
(
bus
,
full_reset
);
ret
=
snd_hdac_bus_init_chip
(
bus
,
full_reset
);
/* Reset stream-to-link mapping */
/* Reset stream-to-link mapping */
list_for_each_entry
(
hlink
,
&
e
bus
->
hlink_list
,
list
)
list_for_each_entry
(
hlink
,
&
bus
->
hlink_list
,
list
)
bus
->
io_ops
->
reg_writel
(
0
,
hlink
->
ml_addr
+
AZX_REG_ML_LOSIDV
);
bus
->
io_ops
->
reg_writel
(
0
,
hlink
->
ml_addr
+
AZX_REG_ML_LOSIDV
);
skl_enable_miscbdcge
(
bus
->
dev
,
true
);
skl_enable_miscbdcge
(
bus
->
dev
,
true
);
...
@@ -146,8 +144,7 @@ static int skl_init_chip(struct hdac_bus *bus, bool full_reset)
...
@@ -146,8 +144,7 @@ static int skl_init_chip(struct hdac_bus *bus, bool full_reset)
void
skl_update_d0i3c
(
struct
device
*
dev
,
bool
enable
)
void
skl_update_d0i3c
(
struct
device
*
dev
,
bool
enable
)
{
{
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
hdac_ext_bus
*
ebus
=
pci_get_drvdata
(
pci
);
struct
hdac_bus
*
bus
=
pci_get_drvdata
(
pci
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
u8
reg
;
u8
reg
;
int
timeout
=
50
;
int
timeout
=
50
;
...
@@ -197,8 +194,7 @@ static void skl_stream_update(struct hdac_bus *bus, struct hdac_stream *hstr)
...
@@ -197,8 +194,7 @@ static void skl_stream_update(struct hdac_bus *bus, struct hdac_stream *hstr)
static
irqreturn_t
skl_interrupt
(
int
irq
,
void
*
dev_id
)
static
irqreturn_t
skl_interrupt
(
int
irq
,
void
*
dev_id
)
{
{
struct
hdac_ext_bus
*
ebus
=
dev_id
;
struct
hdac_bus
*
bus
=
dev_id
;
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
u32
status
;
u32
status
;
if
(
!
pm_runtime_active
(
bus
->
dev
))
if
(
!
pm_runtime_active
(
bus
->
dev
))
...
@@ -227,8 +223,7 @@ static irqreturn_t skl_interrupt(int irq, void *dev_id)
...
@@ -227,8 +223,7 @@ static irqreturn_t skl_interrupt(int irq, void *dev_id)
static
irqreturn_t
skl_threaded_handler
(
int
irq
,
void
*
dev_id
)
static
irqreturn_t
skl_threaded_handler
(
int
irq
,
void
*
dev_id
)
{
{
struct
hdac_ext_bus
*
ebus
=
dev_id
;
struct
hdac_bus
*
bus
=
dev_id
;
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
u32
status
;
u32
status
;
status
=
snd_hdac_chip_readl
(
bus
,
INTSTS
);
status
=
snd_hdac_chip_readl
(
bus
,
INTSTS
);
...
@@ -238,16 +233,15 @@ static irqreturn_t skl_threaded_handler(int irq, void *dev_id)
...
@@ -238,16 +233,15 @@ static irqreturn_t skl_threaded_handler(int irq, void *dev_id)
return
IRQ_HANDLED
;
return
IRQ_HANDLED
;
}
}
static
int
skl_acquire_irq
(
struct
hdac_
ext_bus
*
e
bus
,
int
do_disconnect
)
static
int
skl_acquire_irq
(
struct
hdac_
bus
*
bus
,
int
do_disconnect
)
{
{
struct
skl
*
skl
=
ebus_to_skl
(
ebus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
int
ret
;
int
ret
;
ret
=
request_threaded_irq
(
skl
->
pci
->
irq
,
skl_interrupt
,
ret
=
request_threaded_irq
(
skl
->
pci
->
irq
,
skl_interrupt
,
skl_threaded_handler
,
skl_threaded_handler
,
IRQF_SHARED
,
IRQF_SHARED
,
KBUILD_MODNAME
,
e
bus
);
KBUILD_MODNAME
,
bus
);
if
(
ret
)
{
if
(
ret
)
{
dev_err
(
bus
->
dev
,
dev_err
(
bus
->
dev
,
"unable to grab IRQ %d, disabling device
\n
"
,
"unable to grab IRQ %d, disabling device
\n
"
,
...
@@ -264,21 +258,20 @@ static int skl_acquire_irq(struct hdac_ext_bus *ebus, int do_disconnect)
...
@@ -264,21 +258,20 @@ static int skl_acquire_irq(struct hdac_ext_bus *ebus, int do_disconnect)
static
int
skl_suspend_late
(
struct
device
*
dev
)
static
int
skl_suspend_late
(
struct
device
*
dev
)
{
{
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
hdac_
ext_bus
*
e
bus
=
pci_get_drvdata
(
pci
);
struct
hdac_
bus
*
bus
=
pci_get_drvdata
(
pci
);
struct
skl
*
skl
=
ebus_to_skl
(
e
bus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
return
skl_suspend_late_dsp
(
skl
);
return
skl_suspend_late_dsp
(
skl
);
}
}
#ifdef CONFIG_PM
#ifdef CONFIG_PM
static
int
_skl_suspend
(
struct
hdac_
ext_bus
*
e
bus
)
static
int
_skl_suspend
(
struct
hdac_
bus
*
bus
)
{
{
struct
skl
*
skl
=
ebus_to_skl
(
ebus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
pci_dev
*
pci
=
to_pci_dev
(
bus
->
dev
);
struct
pci_dev
*
pci
=
to_pci_dev
(
bus
->
dev
);
int
ret
;
int
ret
;
snd_hdac_ext_bus_link_power_down_all
(
e
bus
);
snd_hdac_ext_bus_link_power_down_all
(
bus
);
ret
=
skl_suspend_dsp
(
skl
);
ret
=
skl_suspend_dsp
(
skl
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
@@ -295,10 +288,9 @@ static int _skl_suspend(struct hdac_ext_bus *ebus)
...
@@ -295,10 +288,9 @@ static int _skl_suspend(struct hdac_ext_bus *ebus)
return
0
;
return
0
;
}
}
static
int
_skl_resume
(
struct
hdac_
ext_bus
*
e
bus
)
static
int
_skl_resume
(
struct
hdac_
bus
*
bus
)
{
{
struct
skl
*
skl
=
ebus_to_skl
(
ebus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
skl_init_pci
(
skl
);
skl_init_pci
(
skl
);
skl_init_chip
(
bus
,
true
);
skl_init_chip
(
bus
,
true
);
...
@@ -314,9 +306,8 @@ static int _skl_resume(struct hdac_ext_bus *ebus)
...
@@ -314,9 +306,8 @@ static int _skl_resume(struct hdac_ext_bus *ebus)
static
int
skl_suspend
(
struct
device
*
dev
)
static
int
skl_suspend
(
struct
device
*
dev
)
{
{
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
hdac_ext_bus
*
ebus
=
pci_get_drvdata
(
pci
);
struct
hdac_bus
*
bus
=
pci_get_drvdata
(
pci
);
struct
skl
*
skl
=
ebus_to_skl
(
ebus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
int
ret
=
0
;
int
ret
=
0
;
/*
/*
...
@@ -325,15 +316,15 @@ static int skl_suspend(struct device *dev)
...
@@ -325,15 +316,15 @@ static int skl_suspend(struct device *dev)
*/
*/
if
(
skl
->
supend_active
)
{
if
(
skl
->
supend_active
)
{
/* turn off the links and stop the CORB/RIRB DMA if it is On */
/* turn off the links and stop the CORB/RIRB DMA if it is On */
snd_hdac_ext_bus_link_power_down_all
(
e
bus
);
snd_hdac_ext_bus_link_power_down_all
(
bus
);
if
(
e
bus
->
cmd_dma_state
)
if
(
bus
->
cmd_dma_state
)
snd_hdac_bus_stop_cmd_io
(
&
ebus
->
bus
);
snd_hdac_bus_stop_cmd_io
(
bus
);
enable_irq_wake
(
bus
->
irq
);
enable_irq_wake
(
bus
->
irq
);
pci_save_state
(
pci
);
pci_save_state
(
pci
);
}
else
{
}
else
{
ret
=
_skl_suspend
(
e
bus
);
ret
=
_skl_suspend
(
bus
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
skl
->
skl_sst
->
fw_loaded
=
false
;
skl
->
skl_sst
->
fw_loaded
=
false
;
...
@@ -352,9 +343,8 @@ static int skl_suspend(struct device *dev)
...
@@ -352,9 +343,8 @@ static int skl_suspend(struct device *dev)
static
int
skl_resume
(
struct
device
*
dev
)
static
int
skl_resume
(
struct
device
*
dev
)
{
{
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
hdac_ext_bus
*
ebus
=
pci_get_drvdata
(
pci
);
struct
hdac_bus
*
bus
=
pci_get_drvdata
(
pci
);
struct
skl
*
skl
=
ebus_to_skl
(
ebus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
hdac_ext_link
*
hlink
=
NULL
;
struct
hdac_ext_link
*
hlink
=
NULL
;
int
ret
;
int
ret
;
...
@@ -374,32 +364,32 @@ static int skl_resume(struct device *dev)
...
@@ -374,32 +364,32 @@ static int skl_resume(struct device *dev)
*/
*/
if
(
skl
->
supend_active
)
{
if
(
skl
->
supend_active
)
{
pci_restore_state
(
pci
);
pci_restore_state
(
pci
);
snd_hdac_ext_bus_link_power_up_all
(
e
bus
);
snd_hdac_ext_bus_link_power_up_all
(
bus
);
disable_irq_wake
(
bus
->
irq
);
disable_irq_wake
(
bus
->
irq
);
/*
/*
* turn On the links which are On before active suspend
* turn On the links which are On before active suspend
* and start the CORB/RIRB DMA if On before
* and start the CORB/RIRB DMA if On before
* active suspend.
* active suspend.
*/
*/
list_for_each_entry
(
hlink
,
&
e
bus
->
hlink_list
,
list
)
{
list_for_each_entry
(
hlink
,
&
bus
->
hlink_list
,
list
)
{
if
(
hlink
->
ref_count
)
if
(
hlink
->
ref_count
)
snd_hdac_ext_bus_link_power_up
(
hlink
);
snd_hdac_ext_bus_link_power_up
(
hlink
);
}
}
if
(
ebus
->
cmd_dma_state
)
snd_hdac_bus_init_cmd_io
(
&
ebus
->
bus
);
ret
=
0
;
ret
=
0
;
if
(
bus
->
cmd_dma_state
)
snd_hdac_bus_init_cmd_io
(
bus
);
}
else
{
}
else
{
ret
=
_skl_resume
(
e
bus
);
ret
=
_skl_resume
(
bus
);
/* turn off the links which are off before suspend */
/* turn off the links which are off before suspend */
list_for_each_entry
(
hlink
,
&
e
bus
->
hlink_list
,
list
)
{
list_for_each_entry
(
hlink
,
&
bus
->
hlink_list
,
list
)
{
if
(
!
hlink
->
ref_count
)
if
(
!
hlink
->
ref_count
)
snd_hdac_ext_bus_link_power_down
(
hlink
);
snd_hdac_ext_bus_link_power_down
(
hlink
);
}
}
if
(
!
e
bus
->
cmd_dma_state
)
if
(
!
bus
->
cmd_dma_state
)
snd_hdac_bus_stop_cmd_io
(
&
ebus
->
bus
);
snd_hdac_bus_stop_cmd_io
(
bus
);
}
}
return
ret
;
return
ret
;
...
@@ -410,23 +400,21 @@ static int skl_resume(struct device *dev)
...
@@ -410,23 +400,21 @@ static int skl_resume(struct device *dev)
static
int
skl_runtime_suspend
(
struct
device
*
dev
)
static
int
skl_runtime_suspend
(
struct
device
*
dev
)
{
{
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
hdac_ext_bus
*
ebus
=
pci_get_drvdata
(
pci
);
struct
hdac_bus
*
bus
=
pci_get_drvdata
(
pci
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
dev_dbg
(
bus
->
dev
,
"in %s
\n
"
,
__func__
);
dev_dbg
(
bus
->
dev
,
"in %s
\n
"
,
__func__
);
return
_skl_suspend
(
e
bus
);
return
_skl_suspend
(
bus
);
}
}
static
int
skl_runtime_resume
(
struct
device
*
dev
)
static
int
skl_runtime_resume
(
struct
device
*
dev
)
{
{
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
pci_dev
*
pci
=
to_pci_dev
(
dev
);
struct
hdac_ext_bus
*
ebus
=
pci_get_drvdata
(
pci
);
struct
hdac_bus
*
bus
=
pci_get_drvdata
(
pci
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
dev_dbg
(
bus
->
dev
,
"in %s
\n
"
,
__func__
);
dev_dbg
(
bus
->
dev
,
"in %s
\n
"
,
__func__
);
return
_skl_resume
(
e
bus
);
return
_skl_resume
(
bus
);
}
}
#endif
/* CONFIG_PM */
#endif
/* CONFIG_PM */
...
@@ -439,20 +427,19 @@ static const struct dev_pm_ops skl_pm = {
...
@@ -439,20 +427,19 @@ static const struct dev_pm_ops skl_pm = {
/*
/*
* destructor
* destructor
*/
*/
static
int
skl_free
(
struct
hdac_
ext_bus
*
e
bus
)
static
int
skl_free
(
struct
hdac_
bus
*
bus
)
{
{
struct
skl
*
skl
=
ebus_to_skl
(
ebus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
skl
->
init_done
=
0
;
/* to be sure */
skl
->
init_done
=
0
;
/* to be sure */
snd_hdac_ext_stop_streams
(
e
bus
);
snd_hdac_ext_stop_streams
(
bus
);
if
(
bus
->
irq
>=
0
)
if
(
bus
->
irq
>=
0
)
free_irq
(
bus
->
irq
,
(
void
*
)
e
bus
);
free_irq
(
bus
->
irq
,
(
void
*
)
bus
);
snd_hdac_bus_free_stream_pages
(
bus
);
snd_hdac_bus_free_stream_pages
(
bus
);
snd_hdac_stream_free_all
(
e
bus
);
snd_hdac_stream_free_all
(
bus
);
snd_hdac_link_free_all
(
e
bus
);
snd_hdac_link_free_all
(
bus
);
if
(
bus
->
remap_addr
)
if
(
bus
->
remap_addr
)
iounmap
(
bus
->
remap_addr
);
iounmap
(
bus
->
remap_addr
);
...
@@ -460,11 +447,11 @@ static int skl_free(struct hdac_ext_bus *ebus)
...
@@ -460,11 +447,11 @@ static int skl_free(struct hdac_ext_bus *ebus)
pci_release_regions
(
skl
->
pci
);
pci_release_regions
(
skl
->
pci
);
pci_disable_device
(
skl
->
pci
);
pci_disable_device
(
skl
->
pci
);
snd_hdac_ext_bus_exit
(
e
bus
);
snd_hdac_ext_bus_exit
(
bus
);
cancel_work_sync
(
&
skl
->
probe_work
);
cancel_work_sync
(
&
skl
->
probe_work
);
if
(
IS_ENABLED
(
CONFIG_SND_SOC_HDAC_HDMI
))
if
(
IS_ENABLED
(
CONFIG_SND_SOC_HDAC_HDMI
))
snd_hdac_i915_exit
(
&
ebus
->
bus
);
snd_hdac_i915_exit
(
bus
);
return
0
;
return
0
;
}
}
...
@@ -488,8 +475,8 @@ static struct skl_ssp_clk skl_ssp_clks[] = {
...
@@ -488,8 +475,8 @@ static struct skl_ssp_clk skl_ssp_clks[] = {
static
int
skl_find_machine
(
struct
skl
*
skl
,
void
*
driver_data
)
static
int
skl_find_machine
(
struct
skl
*
skl
,
void
*
driver_data
)
{
{
struct
hdac_bus
*
bus
=
skl_to_bus
(
skl
);
struct
snd_soc_acpi_mach
*
mach
=
driver_data
;
struct
snd_soc_acpi_mach
*
mach
=
driver_data
;
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
&
skl
->
ebus
);
struct
skl_machine_pdata
*
pdata
;
struct
skl_machine_pdata
*
pdata
;
mach
=
snd_soc_acpi_find_machine
(
mach
);
mach
=
snd_soc_acpi_find_machine
(
mach
);
...
@@ -510,7 +497,7 @@ static int skl_find_machine(struct skl *skl, void *driver_data)
...
@@ -510,7 +497,7 @@ static int skl_find_machine(struct skl *skl, void *driver_data)
static
int
skl_machine_device_register
(
struct
skl
*
skl
)
static
int
skl_machine_device_register
(
struct
skl
*
skl
)
{
{
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
&
skl
->
ebus
);
struct
hdac_bus
*
bus
=
skl_to_bus
(
skl
);
struct
snd_soc_acpi_mach
*
mach
=
skl
->
mach
;
struct
snd_soc_acpi_mach
*
mach
=
skl
->
mach
;
struct
platform_device
*
pdev
;
struct
platform_device
*
pdev
;
int
ret
;
int
ret
;
...
@@ -544,7 +531,7 @@ static void skl_machine_device_unregister(struct skl *skl)
...
@@ -544,7 +531,7 @@ static void skl_machine_device_unregister(struct skl *skl)
static
int
skl_dmic_device_register
(
struct
skl
*
skl
)
static
int
skl_dmic_device_register
(
struct
skl
*
skl
)
{
{
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
&
skl
->
ebus
);
struct
hdac_bus
*
bus
=
skl_to_bus
(
skl
);
struct
platform_device
*
pdev
;
struct
platform_device
*
pdev
;
int
ret
;
int
ret
;
...
@@ -643,12 +630,13 @@ static void skl_clock_device_unregister(struct skl *skl)
...
@@ -643,12 +630,13 @@ static void skl_clock_device_unregister(struct skl *skl)
/*
/*
* Probe the given codec address
* Probe the given codec address
*/
*/
static
int
probe_codec
(
struct
hdac_
ext_bus
*
e
bus
,
int
addr
)
static
int
probe_codec
(
struct
hdac_
bus
*
bus
,
int
addr
)
{
{
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
unsigned
int
cmd
=
(
addr
<<
28
)
|
(
AC_NODE_ROOT
<<
20
)
|
unsigned
int
cmd
=
(
addr
<<
28
)
|
(
AC_NODE_ROOT
<<
20
)
|
(
AC_VERB_PARAMETERS
<<
8
)
|
AC_PAR_VENDOR_ID
;
(
AC_VERB_PARAMETERS
<<
8
)
|
AC_PAR_VENDOR_ID
;
unsigned
int
res
=
-
1
;
unsigned
int
res
=
-
1
;
struct
skl
*
skl
=
bus_to_skl
(
bus
);
struct
hdac_device
*
hdev
;
mutex_lock
(
&
bus
->
cmd_mutex
);
mutex_lock
(
&
bus
->
cmd_mutex
);
snd_hdac_bus_send_cmd
(
bus
,
cmd
);
snd_hdac_bus_send_cmd
(
bus
,
cmd
);
...
@@ -658,13 +646,16 @@ static int probe_codec(struct hdac_ext_bus *ebus, int addr)
...
@@ -658,13 +646,16 @@ static int probe_codec(struct hdac_ext_bus *ebus, int addr)
return
-
EIO
;
return
-
EIO
;
dev_dbg
(
bus
->
dev
,
"codec #%d probed OK
\n
"
,
addr
);
dev_dbg
(
bus
->
dev
,
"codec #%d probed OK
\n
"
,
addr
);
return
snd_hdac_ext_bus_device_init
(
ebus
,
addr
);
hdev
=
devm_kzalloc
(
&
skl
->
pci
->
dev
,
sizeof
(
*
hdev
),
GFP_KERNEL
);
if
(
!
hdev
)
return
-
ENOMEM
;
return
snd_hdac_ext_bus_device_init
(
bus
,
addr
,
hdev
);
}
}
/* Codec initialization */
/* Codec initialization */
static
void
skl_codec_create
(
struct
hdac_
ext_bus
*
e
bus
)
static
void
skl_codec_create
(
struct
hdac_
bus
*
bus
)
{
{
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
int
c
,
max_slots
;
int
c
,
max_slots
;
max_slots
=
HDA_MAX_CODECS
;
max_slots
=
HDA_MAX_CODECS
;
...
@@ -672,7 +663,7 @@ static void skl_codec_create(struct hdac_ext_bus *ebus)
...
@@ -672,7 +663,7 @@ static void skl_codec_create(struct hdac_ext_bus *ebus)
/* First try to probe all given codec slots */
/* First try to probe all given codec slots */
for
(
c
=
0
;
c
<
max_slots
;
c
++
)
{
for
(
c
=
0
;
c
<
max_slots
;
c
++
)
{
if
((
bus
->
codec_mask
&
(
1
<<
c
)))
{
if
((
bus
->
codec_mask
&
(
1
<<
c
)))
{
if
(
probe_codec
(
e
bus
,
c
)
<
0
)
{
if
(
probe_codec
(
bus
,
c
)
<
0
)
{
/*
/*
* Some BIOSen give you wrong codec addresses
* Some BIOSen give you wrong codec addresses
* that don't exist
* that don't exist
...
@@ -722,8 +713,7 @@ static int skl_i915_init(struct hdac_bus *bus)
...
@@ -722,8 +713,7 @@ static int skl_i915_init(struct hdac_bus *bus)
static
void
skl_probe_work
(
struct
work_struct
*
work
)
static
void
skl_probe_work
(
struct
work_struct
*
work
)
{
{
struct
skl
*
skl
=
container_of
(
work
,
struct
skl
,
probe_work
);
struct
skl
*
skl
=
container_of
(
work
,
struct
skl
,
probe_work
);
struct
hdac_ext_bus
*
ebus
=
&
skl
->
ebus
;
struct
hdac_bus
*
bus
=
skl_to_bus
(
skl
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
hdac_ext_link
*
hlink
=
NULL
;
struct
hdac_ext_link
*
hlink
=
NULL
;
int
err
;
int
err
;
...
@@ -744,7 +734,7 @@ static void skl_probe_work(struct work_struct *work)
...
@@ -744,7 +734,7 @@ static void skl_probe_work(struct work_struct *work)
dev_info
(
bus
->
dev
,
"no hda codecs found!
\n
"
);
dev_info
(
bus
->
dev
,
"no hda codecs found!
\n
"
);
/* create codec instances */
/* create codec instances */
skl_codec_create
(
e
bus
);
skl_codec_create
(
bus
);
/* register platform dai and controls */
/* register platform dai and controls */
err
=
skl_platform_register
(
bus
->
dev
);
err
=
skl_platform_register
(
bus
->
dev
);
...
@@ -773,8 +763,8 @@ static void skl_probe_work(struct work_struct *work)
...
@@ -773,8 +763,8 @@ static void skl_probe_work(struct work_struct *work)
/*
/*
* we are done probing so decrement link counts
* we are done probing so decrement link counts
*/
*/
list_for_each_entry
(
hlink
,
&
e
bus
->
hlink_list
,
list
)
list_for_each_entry
(
hlink
,
&
bus
->
hlink_list
,
list
)
snd_hdac_ext_bus_link_put
(
e
bus
,
hlink
);
snd_hdac_ext_bus_link_put
(
bus
,
hlink
);
/* configure PM */
/* configure PM */
pm_runtime_put_noidle
(
bus
->
dev
);
pm_runtime_put_noidle
(
bus
->
dev
);
...
@@ -796,7 +786,7 @@ static int skl_create(struct pci_dev *pci,
...
@@ -796,7 +786,7 @@ static int skl_create(struct pci_dev *pci,
struct
skl
**
rskl
)
struct
skl
**
rskl
)
{
{
struct
skl
*
skl
;
struct
skl
*
skl
;
struct
hdac_
ext_bus
*
e
bus
;
struct
hdac_
bus
*
bus
;
int
err
;
int
err
;
...
@@ -811,23 +801,22 @@ static int skl_create(struct pci_dev *pci,
...
@@ -811,23 +801,22 @@ static int skl_create(struct pci_dev *pci,
pci_disable_device
(
pci
);
pci_disable_device
(
pci
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
ebus
=
&
skl
->
ebus
;
snd_hdac_ext_bus_init
(
ebus
,
&
pci
->
dev
,
&
bus_core_ops
,
io_ops
);
bus
=
skl_to_bus
(
skl
);
ebus
->
bus
.
use_posbuf
=
1
;
snd_hdac_ext_bus_init
(
bus
,
&
pci
->
dev
,
&
bus_core_ops
,
io_ops
,
NULL
);
bus
->
use_posbuf
=
1
;
skl
->
pci
=
pci
;
skl
->
pci
=
pci
;
INIT_WORK
(
&
skl
->
probe_work
,
skl_probe_work
);
INIT_WORK
(
&
skl
->
probe_work
,
skl_probe_work
);
bus
->
bdl_pos_adj
=
0
;
ebus
->
bus
.
bdl_pos_adj
=
0
;
*
rskl
=
skl
;
*
rskl
=
skl
;
return
0
;
return
0
;
}
}
static
int
skl_first_init
(
struct
hdac_
ext_bus
*
e
bus
)
static
int
skl_first_init
(
struct
hdac_
bus
*
bus
)
{
{
struct
skl
*
skl
=
ebus_to_skl
(
ebus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
pci_dev
*
pci
=
skl
->
pci
;
struct
pci_dev
*
pci
=
skl
->
pci
;
int
err
;
int
err
;
unsigned
short
gcap
;
unsigned
short
gcap
;
...
@@ -848,7 +837,7 @@ static int skl_first_init(struct hdac_ext_bus *ebus)
...
@@ -848,7 +837,7 @@ static int skl_first_init(struct hdac_ext_bus *ebus)
snd_hdac_bus_parse_capabilities
(
bus
);
snd_hdac_bus_parse_capabilities
(
bus
);
if
(
skl_acquire_irq
(
e
bus
,
0
)
<
0
)
if
(
skl_acquire_irq
(
bus
,
0
)
<
0
)
return
-
EBUSY
;
return
-
EBUSY
;
pci_set_master
(
pci
);
pci_set_master
(
pci
);
...
@@ -872,14 +861,14 @@ static int skl_first_init(struct hdac_ext_bus *ebus)
...
@@ -872,14 +861,14 @@ static int skl_first_init(struct hdac_ext_bus *ebus)
if
(
!
pb_streams
&&
!
cp_streams
)
if
(
!
pb_streams
&&
!
cp_streams
)
return
-
EIO
;
return
-
EIO
;
e
bus
->
num_streams
=
cp_streams
+
pb_streams
;
bus
->
num_streams
=
cp_streams
+
pb_streams
;
/* initialize streams */
/* initialize streams */
snd_hdac_ext_stream_init_all
snd_hdac_ext_stream_init_all
(
e
bus
,
0
,
cp_streams
,
SNDRV_PCM_STREAM_CAPTURE
);
(
bus
,
0
,
cp_streams
,
SNDRV_PCM_STREAM_CAPTURE
);
start_idx
=
cp_streams
;
start_idx
=
cp_streams
;
snd_hdac_ext_stream_init_all
snd_hdac_ext_stream_init_all
(
e
bus
,
start_idx
,
pb_streams
,
SNDRV_PCM_STREAM_PLAYBACK
);
(
bus
,
start_idx
,
pb_streams
,
SNDRV_PCM_STREAM_PLAYBACK
);
err
=
snd_hdac_bus_alloc_stream_pages
(
bus
);
err
=
snd_hdac_bus_alloc_stream_pages
(
bus
);
if
(
err
<
0
)
if
(
err
<
0
)
...
@@ -895,7 +884,6 @@ static int skl_probe(struct pci_dev *pci,
...
@@ -895,7 +884,6 @@ static int skl_probe(struct pci_dev *pci,
const
struct
pci_device_id
*
pci_id
)
const
struct
pci_device_id
*
pci_id
)
{
{
struct
skl
*
skl
;
struct
skl
*
skl
;
struct
hdac_ext_bus
*
ebus
=
NULL
;
struct
hdac_bus
*
bus
=
NULL
;
struct
hdac_bus
*
bus
=
NULL
;
int
err
;
int
err
;
...
@@ -904,10 +892,9 @@ static int skl_probe(struct pci_dev *pci,
...
@@ -904,10 +892,9 @@ static int skl_probe(struct pci_dev *pci,
if
(
err
<
0
)
if
(
err
<
0
)
return
err
;
return
err
;
ebus
=
&
skl
->
ebus
;
bus
=
skl_to_bus
(
skl
);
bus
=
ebus_to_hbus
(
ebus
);
err
=
skl_first_init
(
e
bus
);
err
=
skl_first_init
(
bus
);
if
(
err
<
0
)
if
(
err
<
0
)
goto
out_free
;
goto
out_free
;
...
@@ -928,7 +915,7 @@ static int skl_probe(struct pci_dev *pci,
...
@@ -928,7 +915,7 @@ static int skl_probe(struct pci_dev *pci,
skl_nhlt_update_topology_bin
(
skl
);
skl_nhlt_update_topology_bin
(
skl
);
pci_set_drvdata
(
skl
->
pci
,
e
bus
);
pci_set_drvdata
(
skl
->
pci
,
bus
);
skl_dmic_data
.
dmic_num
=
skl_get_dmic_geo
(
skl
);
skl_dmic_data
.
dmic_num
=
skl_get_dmic_geo
(
skl
);
...
@@ -952,7 +939,7 @@ static int skl_probe(struct pci_dev *pci,
...
@@ -952,7 +939,7 @@ static int skl_probe(struct pci_dev *pci,
skl
->
skl_sst
->
clock_power_gating
=
skl_clock_power_gating
;
skl
->
skl_sst
->
clock_power_gating
=
skl_clock_power_gating
;
}
}
if
(
bus
->
mlcap
)
if
(
bus
->
mlcap
)
snd_hdac_ext_bus_get_ml_capabilities
(
e
bus
);
snd_hdac_ext_bus_get_ml_capabilities
(
bus
);
snd_hdac_bus_stop_chip
(
bus
);
snd_hdac_bus_stop_chip
(
bus
);
...
@@ -972,31 +959,30 @@ static int skl_probe(struct pci_dev *pci,
...
@@ -972,31 +959,30 @@ static int skl_probe(struct pci_dev *pci,
out_nhlt_free:
out_nhlt_free:
skl_nhlt_free
(
skl
->
nhlt
);
skl_nhlt_free
(
skl
->
nhlt
);
out_free:
out_free:
skl_free
(
e
bus
);
skl_free
(
bus
);
return
err
;
return
err
;
}
}
static
void
skl_shutdown
(
struct
pci_dev
*
pci
)
static
void
skl_shutdown
(
struct
pci_dev
*
pci
)
{
{
struct
hdac_ext_bus
*
ebus
=
pci_get_drvdata
(
pci
);
struct
hdac_bus
*
bus
=
pci_get_drvdata
(
pci
);
struct
hdac_bus
*
bus
=
ebus_to_hbus
(
ebus
);
struct
hdac_stream
*
s
;
struct
hdac_stream
*
s
;
struct
hdac_ext_stream
*
stream
;
struct
hdac_ext_stream
*
stream
;
struct
skl
*
skl
;
struct
skl
*
skl
;
if
(
ebus
==
NULL
)
if
(
!
bus
)
return
;
return
;
skl
=
ebus_to_skl
(
e
bus
);
skl
=
bus_to_skl
(
bus
);
if
(
!
skl
->
init_done
)
if
(
!
skl
->
init_done
)
return
;
return
;
snd_hdac_ext_stop_streams
(
e
bus
);
snd_hdac_ext_stop_streams
(
bus
);
list_for_each_entry
(
s
,
&
bus
->
stream_list
,
list
)
{
list_for_each_entry
(
s
,
&
bus
->
stream_list
,
list
)
{
stream
=
stream_to_hdac_ext_stream
(
s
);
stream
=
stream_to_hdac_ext_stream
(
s
);
snd_hdac_ext_stream_decouple
(
e
bus
,
stream
,
false
);
snd_hdac_ext_stream_decouple
(
bus
,
stream
,
false
);
}
}
snd_hdac_bus_stop_chip
(
bus
);
snd_hdac_bus_stop_chip
(
bus
);
...
@@ -1004,15 +990,15 @@ static void skl_shutdown(struct pci_dev *pci)
...
@@ -1004,15 +990,15 @@ static void skl_shutdown(struct pci_dev *pci)
static
void
skl_remove
(
struct
pci_dev
*
pci
)
static
void
skl_remove
(
struct
pci_dev
*
pci
)
{
{
struct
hdac_
ext_bus
*
e
bus
=
pci_get_drvdata
(
pci
);
struct
hdac_
bus
*
bus
=
pci_get_drvdata
(
pci
);
struct
skl
*
skl
=
ebus_to_skl
(
e
bus
);
struct
skl
*
skl
=
bus_to_skl
(
bus
);
release_firmware
(
skl
->
tplg
);
release_firmware
(
skl
->
tplg
);
pm_runtime_get_noresume
(
&
pci
->
dev
);
pm_runtime_get_noresume
(
&
pci
->
dev
);
/* codec removal, invoke bus_device_remove */
/* codec removal, invoke bus_device_remove */
snd_hdac_ext_bus_device_remove
(
e
bus
);
snd_hdac_ext_bus_device_remove
(
bus
);
skl
->
debugfs
=
NULL
;
skl
->
debugfs
=
NULL
;
skl_platform_unregister
(
&
pci
->
dev
);
skl_platform_unregister
(
&
pci
->
dev
);
...
@@ -1022,7 +1008,7 @@ static void skl_remove(struct pci_dev *pci)
...
@@ -1022,7 +1008,7 @@ static void skl_remove(struct pci_dev *pci)
skl_clock_device_unregister
(
skl
);
skl_clock_device_unregister
(
skl
);
skl_nhlt_remove_sysfs
(
skl
);
skl_nhlt_remove_sysfs
(
skl
);
skl_nhlt_free
(
skl
->
nhlt
);
skl_nhlt_free
(
skl
->
nhlt
);
skl_free
(
e
bus
);
skl_free
(
bus
);
dev_set_drvdata
(
&
pci
->
dev
,
NULL
);
dev_set_drvdata
(
&
pci
->
dev
,
NULL
);
}
}
...
...
sound/soc/intel/skylake/skl.h
View file @
9a9b13dd
...
@@ -71,7 +71,7 @@ struct skl_fw_config {
...
@@ -71,7 +71,7 @@ struct skl_fw_config {
};
};
struct
skl
{
struct
skl
{
struct
hdac_
ext_bus
e
bus
;
struct
hdac_
bus
h
bus
;
struct
pci_dev
*
pci
;
struct
pci_dev
*
pci
;
unsigned
int
init_done
:
1
;
/* delayed init status */
unsigned
int
init_done
:
1
;
/* delayed init status */
...
@@ -105,9 +105,8 @@ struct skl {
...
@@ -105,9 +105,8 @@ struct skl {
struct
snd_soc_acpi_mach
*
mach
;
struct
snd_soc_acpi_mach
*
mach
;
};
};
#define skl_to_ebus(s) (&(s)->ebus)
#define skl_to_bus(s) (&(s)->hbus)
#define ebus_to_skl(sbus) \
#define bus_to_skl(bus) container_of(bus, struct skl, hbus)
container_of(sbus, struct skl, sbus)
/* to pass dai dma data */
/* to pass dai dma data */
struct
skl_dma_params
{
struct
skl_dma_params
{
...
...
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