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
nexedi
linux
Commits
8d085d3c
Commit
8d085d3c
authored
Feb 23, 2015
by
Takashi Iwai
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'topic/hda-cleanup' into for-next
parents
88cacc57
781c7b96
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
493 additions
and
568 deletions
+493
-568
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.c
+21
-66
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_codec.h
+10
-12
sound/pci/hda/hda_controller.c
sound/pci/hda/hda_controller.c
+51
-45
sound/pci/hda/hda_controller.h
sound/pci/hda/hda_controller.h
+392
-5
sound/pci/hda/hda_i915.c
sound/pci/hda/hda_i915.c
+1
-1
sound/pci/hda/hda_intel.c
sound/pci/hda/hda_intel.c
+11
-12
sound/pci/hda/hda_intel.h
sound/pci/hda/hda_intel.h
+1
-1
sound/pci/hda/hda_local.h
sound/pci/hda/hda_local.h
+0
-17
sound/pci/hda/hda_priv.h
sound/pci/hda/hda_priv.h
+0
-406
sound/pci/hda/hda_tegra.c
sound/pci/hda/hda_tegra.c
+6
-3
No files found.
sound/pci/hda/hda_codec.c
View file @
8d085d3c
...
@@ -762,10 +762,7 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex)
...
@@ -762,10 +762,7 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex)
return
0
;
return
0
;
trace_hda_unsol_event
(
bus
,
res
,
res_ex
);
trace_hda_unsol_event
(
bus
,
res
,
res_ex
);
unsol
=
bus
->
unsol
;
unsol
=
&
bus
->
unsol
;
if
(
!
unsol
)
return
0
;
wp
=
(
unsol
->
wp
+
1
)
%
HDA_UNSOL_QUEUE_SIZE
;
wp
=
(
unsol
->
wp
+
1
)
%
HDA_UNSOL_QUEUE_SIZE
;
unsol
->
wp
=
wp
;
unsol
->
wp
=
wp
;
...
@@ -784,9 +781,8 @@ EXPORT_SYMBOL_GPL(snd_hda_queue_unsol_event);
...
@@ -784,9 +781,8 @@ EXPORT_SYMBOL_GPL(snd_hda_queue_unsol_event);
*/
*/
static
void
process_unsol_events
(
struct
work_struct
*
work
)
static
void
process_unsol_events
(
struct
work_struct
*
work
)
{
{
struct
hda_bus_unsolicited
*
unsol
=
struct
hda_bus
*
bus
=
container_of
(
work
,
struct
hda_bus
,
unsol
.
work
);
container_of
(
work
,
struct
hda_bus_unsolicited
,
work
);
struct
hda_bus_unsolicited
*
unsol
=
&
bus
->
unsol
;
struct
hda_bus
*
bus
=
unsol
->
bus
;
struct
hda_codec
*
codec
;
struct
hda_codec
*
codec
;
unsigned
int
rp
,
caddr
,
res
;
unsigned
int
rp
,
caddr
,
res
;
...
@@ -804,27 +800,6 @@ static void process_unsol_events(struct work_struct *work)
...
@@ -804,27 +800,6 @@ static void process_unsol_events(struct work_struct *work)
}
}
}
}
/*
* initialize unsolicited queue
*/
static
int
init_unsol_queue
(
struct
hda_bus
*
bus
)
{
struct
hda_bus_unsolicited
*
unsol
;
if
(
bus
->
unsol
)
/* already initialized */
return
0
;
unsol
=
kzalloc
(
sizeof
(
*
unsol
),
GFP_KERNEL
);
if
(
!
unsol
)
{
dev_err
(
bus
->
card
->
dev
,
"can't allocate unsolicited queue
\n
"
);
return
-
ENOMEM
;
}
INIT_WORK
(
&
unsol
->
work
,
process_unsol_events
);
unsol
->
bus
=
bus
;
bus
->
unsol
=
unsol
;
return
0
;
}
/*
/*
* destructor
* destructor
*/
*/
...
@@ -836,7 +811,6 @@ static void snd_hda_bus_free(struct hda_bus *bus)
...
@@ -836,7 +811,6 @@ static void snd_hda_bus_free(struct hda_bus *bus)
WARN_ON
(
!
list_empty
(
&
bus
->
codec_list
));
WARN_ON
(
!
list_empty
(
&
bus
->
codec_list
));
if
(
bus
->
workq
)
if
(
bus
->
workq
)
flush_workqueue
(
bus
->
workq
);
flush_workqueue
(
bus
->
workq
);
kfree
(
bus
->
unsol
);
if
(
bus
->
ops
.
private_free
)
if
(
bus
->
ops
.
private_free
)
bus
->
ops
.
private_free
(
bus
);
bus
->
ops
.
private_free
(
bus
);
if
(
bus
->
workq
)
if
(
bus
->
workq
)
...
@@ -861,14 +835,12 @@ static int snd_hda_bus_dev_disconnect(struct snd_device *device)
...
@@ -861,14 +835,12 @@ static int snd_hda_bus_dev_disconnect(struct snd_device *device)
/**
/**
* snd_hda_bus_new - create a HDA bus
* snd_hda_bus_new - create a HDA bus
* @card: the card entry
* @card: the card entry
* @temp: the template for hda_bus information
* @busp: the pointer to store the created bus instance
* @busp: the pointer to store the created bus instance
*
*
* Returns 0 if successful, or a negative error code.
* Returns 0 if successful, or a negative error code.
*/
*/
int
snd_hda_bus_new
(
struct
snd_card
*
card
,
int
snd_hda_bus_new
(
struct
snd_card
*
card
,
const
struct
hda_bus_template
*
temp
,
struct
hda_bus
**
busp
)
struct
hda_bus
**
busp
)
{
{
struct
hda_bus
*
bus
;
struct
hda_bus
*
bus
;
int
err
;
int
err
;
...
@@ -877,11 +849,6 @@ int snd_hda_bus_new(struct snd_card *card,
...
@@ -877,11 +849,6 @@ int snd_hda_bus_new(struct snd_card *card,
.
dev_free
=
snd_hda_bus_dev_free
,
.
dev_free
=
snd_hda_bus_dev_free
,
};
};
if
(
snd_BUG_ON
(
!
temp
))
return
-
EINVAL
;
if
(
snd_BUG_ON
(
!
temp
->
ops
.
command
||
!
temp
->
ops
.
get_response
))
return
-
EINVAL
;
if
(
busp
)
if
(
busp
)
*
busp
=
NULL
;
*
busp
=
NULL
;
...
@@ -892,15 +859,10 @@ int snd_hda_bus_new(struct snd_card *card,
...
@@ -892,15 +859,10 @@ int snd_hda_bus_new(struct snd_card *card,
}
}
bus
->
card
=
card
;
bus
->
card
=
card
;
bus
->
private_data
=
temp
->
private_data
;
bus
->
pci
=
temp
->
pci
;
bus
->
modelname
=
temp
->
modelname
;
bus
->
power_save
=
temp
->
power_save
;
bus
->
ops
=
temp
->
ops
;
mutex_init
(
&
bus
->
cmd_mutex
);
mutex_init
(
&
bus
->
cmd_mutex
);
mutex_init
(
&
bus
->
prepare_mutex
);
mutex_init
(
&
bus
->
prepare_mutex
);
INIT_LIST_HEAD
(
&
bus
->
codec_list
);
INIT_LIST_HEAD
(
&
bus
->
codec_list
);
INIT_WORK
(
&
bus
->
unsol
.
work
,
process_unsol_events
);
snprintf
(
bus
->
workq_name
,
sizeof
(
bus
->
workq_name
),
snprintf
(
bus
->
workq_name
,
sizeof
(
bus
->
workq_name
),
"hd-audio%d"
,
card
->
number
);
"hd-audio%d"
,
card
->
number
);
...
@@ -1702,12 +1664,6 @@ int snd_hda_codec_configure(struct hda_codec *codec)
...
@@ -1702,12 +1664,6 @@ int snd_hda_codec_configure(struct hda_codec *codec)
return
err
;
return
err
;
}
}
if
(
codec
->
patch_ops
.
unsol_event
)
{
err
=
init_unsol_queue
(
codec
->
bus
);
if
(
err
<
0
)
return
err
;
}
/* audio codec should override the mixer name */
/* audio codec should override the mixer name */
if
(
codec
->
afg
||
!*
codec
->
bus
->
card
->
mixername
)
if
(
codec
->
afg
||
!*
codec
->
bus
->
card
->
mixername
)
snprintf
(
codec
->
bus
->
card
->
mixername
,
snprintf
(
codec
->
bus
->
card
->
mixername
,
...
@@ -2192,11 +2148,10 @@ EXPORT_SYMBOL_GPL(snd_hda_codec_amp_read);
...
@@ -2192,11 +2148,10 @@ EXPORT_SYMBOL_GPL(snd_hda_codec_amp_read);
static
int
codec_amp_update
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
,
int
ch
,
static
int
codec_amp_update
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
,
int
ch
,
int
direction
,
int
idx
,
int
mask
,
int
val
,
int
direction
,
int
idx
,
int
mask
,
int
val
,
bool
init_only
)
bool
init_only
,
bool
cache_only
)
{
{
struct
hda_amp_info
*
info
;
struct
hda_amp_info
*
info
;
unsigned
int
caps
;
unsigned
int
caps
;
unsigned
int
cache_only
;
if
(
snd_BUG_ON
(
mask
&
~
0xff
))
if
(
snd_BUG_ON
(
mask
&
~
0xff
))
mask
&=
0xff
;
mask
&=
0xff
;
...
@@ -2214,7 +2169,7 @@ static int codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch,
...
@@ -2214,7 +2169,7 @@ static int codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch,
return
0
;
return
0
;
}
}
info
->
vol
[
ch
]
=
val
;
info
->
vol
[
ch
]
=
val
;
cache_only
=
info
->
head
.
dirty
=
codec
->
cached_write
;
info
->
head
.
dirty
|=
cache_only
;
caps
=
info
->
amp_caps
;
caps
=
info
->
amp_caps
;
mutex_unlock
(
&
codec
->
hash_mutex
);
mutex_unlock
(
&
codec
->
hash_mutex
);
if
(
!
cache_only
)
if
(
!
cache_only
)
...
@@ -2238,7 +2193,8 @@ static int codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch,
...
@@ -2238,7 +2193,8 @@ static int codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch,
int
snd_hda_codec_amp_update
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
,
int
ch
,
int
snd_hda_codec_amp_update
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
,
int
ch
,
int
direction
,
int
idx
,
int
mask
,
int
val
)
int
direction
,
int
idx
,
int
mask
,
int
val
)
{
{
return
codec_amp_update
(
codec
,
nid
,
ch
,
direction
,
idx
,
mask
,
val
,
false
);
return
codec_amp_update
(
codec
,
nid
,
ch
,
direction
,
idx
,
mask
,
val
,
false
,
codec
->
cached_write
);
}
}
EXPORT_SYMBOL_GPL
(
snd_hda_codec_amp_update
);
EXPORT_SYMBOL_GPL
(
snd_hda_codec_amp_update
);
...
@@ -2285,7 +2241,8 @@ EXPORT_SYMBOL_GPL(snd_hda_codec_amp_stereo);
...
@@ -2285,7 +2241,8 @@ EXPORT_SYMBOL_GPL(snd_hda_codec_amp_stereo);
int
snd_hda_codec_amp_init
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
,
int
ch
,
int
snd_hda_codec_amp_init
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
,
int
ch
,
int
dir
,
int
idx
,
int
mask
,
int
val
)
int
dir
,
int
idx
,
int
mask
,
int
val
)
{
{
return
codec_amp_update
(
codec
,
nid
,
ch
,
dir
,
idx
,
mask
,
val
,
true
);
return
codec_amp_update
(
codec
,
nid
,
ch
,
dir
,
idx
,
mask
,
val
,
true
,
codec
->
cached_write
);
}
}
EXPORT_SYMBOL_GPL
(
snd_hda_codec_amp_init
);
EXPORT_SYMBOL_GPL
(
snd_hda_codec_amp_init
);
...
@@ -2427,8 +2384,8 @@ update_amp_value(struct hda_codec *codec, hda_nid_t nid,
...
@@ -2427,8 +2384,8 @@ update_amp_value(struct hda_codec *codec, hda_nid_t nid,
maxval
=
get_amp_max_value
(
codec
,
nid
,
dir
,
0
);
maxval
=
get_amp_max_value
(
codec
,
nid
,
dir
,
0
);
if
(
val
>
maxval
)
if
(
val
>
maxval
)
val
=
maxval
;
val
=
maxval
;
return
snd_hda_codec_amp_update
(
codec
,
nid
,
ch
,
dir
,
idx
,
return
codec_amp_update
(
codec
,
nid
,
ch
,
dir
,
idx
,
HDA_AMP_VOLMASK
,
val
,
HDA_AMP_VOLMASK
,
val
);
false
,
!
hda_codec_is_power_on
(
codec
)
);
}
}
/**
/**
...
@@ -2478,14 +2435,12 @@ int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol,
...
@@ -2478,14 +2435,12 @@ int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol,
long
*
valp
=
ucontrol
->
value
.
integer
.
value
;
long
*
valp
=
ucontrol
->
value
.
integer
.
value
;
int
change
=
0
;
int
change
=
0
;
snd_hda_power_up
(
codec
);
if
(
chs
&
1
)
{
if
(
chs
&
1
)
{
change
=
update_amp_value
(
codec
,
nid
,
0
,
dir
,
idx
,
ofs
,
*
valp
);
change
=
update_amp_value
(
codec
,
nid
,
0
,
dir
,
idx
,
ofs
,
*
valp
);
valp
++
;
valp
++
;
}
}
if
(
chs
&
2
)
if
(
chs
&
2
)
change
|=
update_amp_value
(
codec
,
nid
,
1
,
dir
,
idx
,
ofs
,
*
valp
);
change
|=
update_amp_value
(
codec
,
nid
,
1
,
dir
,
idx
,
ofs
,
*
valp
);
snd_hda_power_down
(
codec
);
return
change
;
return
change
;
}
}
EXPORT_SYMBOL_GPL
(
snd_hda_mixer_amp_volume_put
);
EXPORT_SYMBOL_GPL
(
snd_hda_mixer_amp_volume_put
);
...
@@ -3153,19 +3108,19 @@ int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol,
...
@@ -3153,19 +3108,19 @@ int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol,
long
*
valp
=
ucontrol
->
value
.
integer
.
value
;
long
*
valp
=
ucontrol
->
value
.
integer
.
value
;
int
change
=
0
;
int
change
=
0
;
snd_hda_power_up
(
codec
);
if
(
chs
&
1
)
{
if
(
chs
&
1
)
{
change
=
snd_hda_codec_amp_update
(
codec
,
nid
,
0
,
dir
,
idx
,
change
=
codec_amp_update
(
codec
,
nid
,
0
,
dir
,
idx
,
HDA_AMP_MUTE
,
HDA_AMP_MUTE
,
*
valp
?
0
:
HDA_AMP_MUTE
);
*
valp
?
0
:
HDA_AMP_MUTE
,
false
,
!
hda_codec_is_power_on
(
codec
));
valp
++
;
valp
++
;
}
}
if
(
chs
&
2
)
if
(
chs
&
2
)
change
|=
snd_hda_codec_amp_update
(
codec
,
nid
,
1
,
dir
,
idx
,
change
|=
codec_amp_update
(
codec
,
nid
,
1
,
dir
,
idx
,
HDA_AMP_MUTE
,
HDA_AMP_MUTE
,
*
valp
?
0
:
HDA_AMP_MUTE
);
*
valp
?
0
:
HDA_AMP_MUTE
,
false
,
!
hda_codec_is_power_on
(
codec
));
hda_call_check_power_status
(
codec
,
nid
);
hda_call_check_power_status
(
codec
,
nid
);
snd_hda_power_down
(
codec
);
return
change
;
return
change
;
}
}
EXPORT_SYMBOL_GPL
(
snd_hda_mixer_amp_switch_put
);
EXPORT_SYMBOL_GPL
(
snd_hda_mixer_amp_switch_put
);
...
...
sound/pci/hda/hda_codec.h
View file @
8d085d3c
...
@@ -66,7 +66,6 @@ struct hda_beep;
...
@@ -66,7 +66,6 @@ struct hda_beep;
struct
hda_codec
;
struct
hda_codec
;
struct
hda_pcm
;
struct
hda_pcm
;
struct
hda_pcm_stream
;
struct
hda_pcm_stream
;
struct
hda_bus_unsolicited
;
/* NID type */
/* NID type */
typedef
u16
hda_nid_t
;
typedef
u16
hda_nid_t
;
...
@@ -101,13 +100,14 @@ struct hda_bus_ops {
...
@@ -101,13 +100,14 @@ struct hda_bus_ops {
#endif
#endif
};
};
/* template to pass to the bus constructor */
/* unsolicited event handler */
struct
hda_bus_template
{
#define HDA_UNSOL_QUEUE_SIZE 64
void
*
private_data
;
struct
hda_bus_unsolicited
{
struct
pci_dev
*
pci
;
/* ring buffer */
const
char
*
modelname
;
u32
queue
[
HDA_UNSOL_QUEUE_SIZE
*
2
];
int
*
power_save
;
unsigned
int
rp
,
wp
;
struct
hda_bus_ops
ops
;
/* workqueue */
struct
work_struct
work
;
};
};
/*
/*
...
@@ -119,7 +119,6 @@ struct hda_bus_template {
...
@@ -119,7 +119,6 @@ struct hda_bus_template {
struct
hda_bus
{
struct
hda_bus
{
struct
snd_card
*
card
;
struct
snd_card
*
card
;
/* copied from template */
void
*
private_data
;
void
*
private_data
;
struct
pci_dev
*
pci
;
struct
pci_dev
*
pci
;
const
char
*
modelname
;
const
char
*
modelname
;
...
@@ -136,7 +135,7 @@ struct hda_bus {
...
@@ -136,7 +135,7 @@ struct hda_bus {
struct
mutex
prepare_mutex
;
struct
mutex
prepare_mutex
;
/* unsolicited event queue */
/* unsolicited event queue */
struct
hda_bus_unsolicited
*
unsol
;
struct
hda_bus_unsolicited
unsol
;
char
workq_name
[
16
];
char
workq_name
[
16
];
struct
workqueue_struct
*
workq
;
/* common workqueue for codecs */
struct
workqueue_struct
*
workq
;
/* common workqueue for codecs */
...
@@ -420,8 +419,7 @@ enum {
...
@@ -420,8 +419,7 @@ enum {
/*
/*
* constructors
* constructors
*/
*/
int
snd_hda_bus_new
(
struct
snd_card
*
card
,
const
struct
hda_bus_template
*
temp
,
int
snd_hda_bus_new
(
struct
snd_card
*
card
,
struct
hda_bus
**
busp
);
struct
hda_bus
**
busp
);
int
snd_hda_codec_new
(
struct
hda_bus
*
bus
,
unsigned
int
codec_addr
,
int
snd_hda_codec_new
(
struct
hda_bus
*
bus
,
unsigned
int
codec_addr
,
struct
hda_codec
**
codecp
);
struct
hda_codec
**
codecp
);
int
snd_hda_codec_configure
(
struct
hda_codec
*
codec
);
int
snd_hda_codec_configure
(
struct
hda_codec
*
codec
);
...
...
sound/pci/hda/hda_controller.c
View file @
8d085d3c
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
#include <linux/reboot.h>
#include <linux/reboot.h>
#include <sound/core.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/initval.h>
#include "hda_priv.h"
#include "hda_controller.h"
#include "hda_controller.h"
#define CREATE_TRACE_POINTS
#define CREATE_TRACE_POINTS
...
@@ -1681,7 +1680,7 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
...
@@ -1681,7 +1680,7 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
int
i
;
int
i
;
#ifdef CONFIG_PM
#ifdef CONFIG_PM
if
(
chip
->
driver_caps
&
AZX_DCAPS_PM_RUNTIME
)
if
(
azx_has_pm_runtime
(
chip
)
)
if
(
!
pm_runtime_active
(
chip
->
card
->
dev
))
if
(
!
pm_runtime_active
(
chip
->
card
->
dev
))
return
IRQ_NONE
;
return
IRQ_NONE
;
#endif
#endif
...
@@ -1784,7 +1783,7 @@ static void azx_power_notify(struct hda_bus *bus, bool power_up)
...
@@ -1784,7 +1783,7 @@ static void azx_power_notify(struct hda_bus *bus, bool power_up)
{
{
struct
azx
*
chip
=
bus
->
private_data
;
struct
azx
*
chip
=
bus
->
private_data
;
if
(
!
(
chip
->
driver_caps
&
AZX_DCAPS_PM_RUNTIME
))
if
(
!
azx_has_pm_runtime
(
chip
))
return
;
return
;
if
(
power_up
)
if
(
power_up
)
...
@@ -1815,41 +1814,65 @@ static int get_jackpoll_interval(struct azx *chip)
...
@@ -1815,41 +1814,65 @@ static int get_jackpoll_interval(struct azx *chip)
return
j
;
return
j
;
}
}
/* Codec initialization */
static
struct
hda_bus_ops
bus_ops
=
{
int
azx_codec_create
(
struct
azx
*
chip
,
const
char
*
model
,
.
command
=
azx_send_cmd
,
unsigned
int
max_slots
,
.
get_response
=
azx_get_response
,
int
*
power_save_to
)
.
attach_pcm
=
azx_attach_pcm_stream
,
{
.
bus_reset
=
azx_bus_reset
,
struct
hda_bus_template
bus_temp
;
int
c
,
codecs
,
err
;
memset
(
&
bus_temp
,
0
,
sizeof
(
bus_temp
));
bus_temp
.
private_data
=
chip
;
bus_temp
.
modelname
=
model
;
bus_temp
.
pci
=
chip
->
pci
;
bus_temp
.
ops
.
command
=
azx_send_cmd
;
bus_temp
.
ops
.
get_response
=
azx_get_response
;
bus_temp
.
ops
.
attach_pcm
=
azx_attach_pcm_stream
;
bus_temp
.
ops
.
bus_reset
=
azx_bus_reset
;
#ifdef CONFIG_PM
#ifdef CONFIG_PM
bus_temp
.
power_save
=
power_save_to
;
.
pm_notify
=
azx_power_notify
,
bus_temp
.
ops
.
pm_notify
=
azx_power_notify
;
#endif
#endif
#ifdef CONFIG_SND_HDA_DSP_LOADER
#ifdef CONFIG_SND_HDA_DSP_LOADER
bus_temp
.
ops
.
load_dsp_prepare
=
azx_load_dsp_prepare
;
.
load_dsp_prepare
=
azx_load_dsp_prepare
,
bus_temp
.
ops
.
load_dsp_trigger
=
azx_load_dsp_trigger
;
.
load_dsp_trigger
=
azx_load_dsp_trigger
,
bus_temp
.
ops
.
load_dsp_cleanup
=
azx_load_dsp_cleanup
;
.
load_dsp_cleanup
=
azx_load_dsp_cleanup
,
#endif
#endif
};
err
=
snd_hda_bus_new
(
chip
->
card
,
&
bus_temp
,
&
chip
->
bus
);
/* HD-audio bus initialization */
int
azx_bus_create
(
struct
azx
*
chip
,
const
char
*
model
,
int
*
power_save_to
)
{
struct
hda_bus
*
bus
;
int
err
;
err
=
snd_hda_bus_new
(
chip
->
card
,
&
bus
);
if
(
err
<
0
)
if
(
err
<
0
)
return
err
;
return
err
;
chip
->
bus
=
bus
;
bus
->
private_data
=
chip
;
bus
->
pci
=
chip
->
pci
;
bus
->
modelname
=
model
;
bus
->
ops
=
bus_ops
;
#ifdef CONFIG_PM
bus
->
power_save
=
power_save_to
;
#endif
if
(
chip
->
driver_caps
&
AZX_DCAPS_RIRB_DELAY
)
{
if
(
chip
->
driver_caps
&
AZX_DCAPS_RIRB_DELAY
)
{
dev_dbg
(
chip
->
card
->
dev
,
"Enable delay in RIRB handling
\n
"
);
dev_dbg
(
chip
->
card
->
dev
,
"Enable delay in RIRB handling
\n
"
);
chip
->
bus
->
needs_damn_long_delay
=
1
;
bus
->
needs_damn_long_delay
=
1
;
}
/* AMD chipsets often cause the communication stalls upon certain
* sequence like the pin-detection. It seems that forcing the synced
* access works around the stall. Grrr...
*/
if
(
chip
->
driver_caps
&
AZX_DCAPS_SYNC_WRITE
)
{
dev_dbg
(
chip
->
card
->
dev
,
"Enable sync_write for stable communication
\n
"
);
bus
->
sync_write
=
1
;
bus
->
allow_bus_reset
=
1
;
}
}
return
0
;
}
EXPORT_SYMBOL_GPL
(
azx_bus_create
);
/* Probe codecs */
int
azx_probe_codecs
(
struct
azx
*
chip
,
unsigned
int
max_slots
)
{
struct
hda_bus
*
bus
=
chip
->
bus
;
int
c
,
codecs
,
err
;
codecs
=
0
;
codecs
=
0
;
if
(
!
max_slots
)
if
(
!
max_slots
)
max_slots
=
AZX_DEFAULT_CODECS
;
max_slots
=
AZX_DEFAULT_CODECS
;
...
@@ -1877,21 +1900,11 @@ int azx_codec_create(struct azx *chip, const char *model,
...
@@ -1877,21 +1900,11 @@ int azx_codec_create(struct azx *chip, const char *model,
}
}
}
}
/* AMD chipsets often cause the communication stalls upon certain
* sequence like the pin-detection. It seems that forcing the synced
* access works around the stall. Grrr...
*/
if
(
chip
->
driver_caps
&
AZX_DCAPS_SYNC_WRITE
)
{
dev_dbg
(
chip
->
card
->
dev
,
"Enable sync_write for stable communication
\n
"
);
chip
->
bus
->
sync_write
=
1
;
chip
->
bus
->
allow_bus_reset
=
1
;
}
/* Then create codec instances */
/* Then create codec instances */
for
(
c
=
0
;
c
<
max_slots
;
c
++
)
{
for
(
c
=
0
;
c
<
max_slots
;
c
++
)
{
if
((
chip
->
codec_mask
&
(
1
<<
c
))
&
chip
->
codec_probe_mask
)
{
if
((
chip
->
codec_mask
&
(
1
<<
c
))
&
chip
->
codec_probe_mask
)
{
struct
hda_codec
*
codec
;
struct
hda_codec
*
codec
;
err
=
snd_hda_codec_new
(
chip
->
bus
,
c
,
&
codec
);
err
=
snd_hda_codec_new
(
bus
,
c
,
&
codec
);
if
(
err
<
0
)
if
(
err
<
0
)
continue
;
continue
;
codec
->
jackpoll_interval
=
get_jackpoll_interval
(
chip
);
codec
->
jackpoll_interval
=
get_jackpoll_interval
(
chip
);
...
@@ -1905,7 +1918,7 @@ int azx_codec_create(struct azx *chip, const char *model,
...
@@ -1905,7 +1918,7 @@ int azx_codec_create(struct azx *chip, const char *model,
}
}
return
0
;
return
0
;
}
}
EXPORT_SYMBOL_GPL
(
azx_
codec_create
);
EXPORT_SYMBOL_GPL
(
azx_
probe_codecs
);
/* configure each codec instance */
/* configure each codec instance */
int
azx_codec_configure
(
struct
azx
*
chip
)
int
azx_codec_configure
(
struct
azx
*
chip
)
...
@@ -1918,13 +1931,6 @@ int azx_codec_configure(struct azx *chip)
...
@@ -1918,13 +1931,6 @@ int azx_codec_configure(struct azx *chip)
}
}
EXPORT_SYMBOL_GPL
(
azx_codec_configure
);
EXPORT_SYMBOL_GPL
(
azx_codec_configure
);
/* mixer creation - all stuff is implemented in hda module */
int
azx_mixer_create
(
struct
azx
*
chip
)
{
return
snd_hda_build_controls
(
chip
->
bus
);
}
EXPORT_SYMBOL_GPL
(
azx_mixer_create
);
static
bool
is_input_stream
(
struct
azx
*
chip
,
unsigned
char
index
)
static
bool
is_input_stream
(
struct
azx
*
chip
,
unsigned
char
index
)
{
{
...
...
sound/pci/hda/hda_controller.h
View file @
8d085d3c
This diff is collapsed.
Click to expand it.
sound/pci/hda/hda_i915.c
View file @
8d085d3c
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
#include <linux/component.h>
#include <linux/component.h>
#include <drm/i915_component.h>
#include <drm/i915_component.h>
#include <sound/core.h>
#include <sound/core.h>
#include "hda_
priv
.h"
#include "hda_
controller
.h"
#include "hda_intel.h"
#include "hda_intel.h"
/* Intel HSW/BDW display HDA controller Extended Mode registers.
/* Intel HSW/BDW display HDA controller Extended Mode registers.
...
...
sound/pci/hda/hda_intel.c
View file @
8d085d3c
...
@@ -62,7 +62,6 @@
...
@@ -62,7 +62,6 @@
#include <linux/firmware.h>
#include <linux/firmware.h>
#include "hda_codec.h"
#include "hda_codec.h"
#include "hda_controller.h"
#include "hda_controller.h"
#include "hda_priv.h"
#include "hda_intel.h"
#include "hda_intel.h"
/* position fix mode */
/* position fix mode */
...
@@ -852,7 +851,7 @@ static int azx_runtime_suspend(struct device *dev)
...
@@ -852,7 +851,7 @@ static int azx_runtime_suspend(struct device *dev)
if
(
chip
->
disabled
||
hda
->
init_failed
)
if
(
chip
->
disabled
||
hda
->
init_failed
)
return
0
;
return
0
;
if
(
!
(
chip
->
driver_caps
&
AZX_DCAPS_PM_RUNTIME
))
if
(
!
azx_has_pm_runtime
(
chip
))
return
0
;
return
0
;
/* enable controller wake up event */
/* enable controller wake up event */
...
@@ -885,7 +884,7 @@ static int azx_runtime_resume(struct device *dev)
...
@@ -885,7 +884,7 @@ static int azx_runtime_resume(struct device *dev)
if
(
chip
->
disabled
||
hda
->
init_failed
)
if
(
chip
->
disabled
||
hda
->
init_failed
)
return
0
;
return
0
;
if
(
!
(
chip
->
driver_caps
&
AZX_DCAPS_PM_RUNTIME
))
if
(
!
azx_has_pm_runtime
(
chip
))
return
0
;
return
0
;
if
(
chip
->
driver_caps
&
AZX_DCAPS_I915_POWERWELL
)
{
if
(
chip
->
driver_caps
&
AZX_DCAPS_I915_POWERWELL
)
{
...
@@ -928,8 +927,7 @@ static int azx_runtime_idle(struct device *dev)
...
@@ -928,8 +927,7 @@ static int azx_runtime_idle(struct device *dev)
if
(
chip
->
disabled
||
hda
->
init_failed
)
if
(
chip
->
disabled
||
hda
->
init_failed
)
return
0
;
return
0
;
if
(
!
power_save_controller
||
if
(
!
power_save_controller
||
!
azx_has_pm_runtime
(
chip
))
!
(
chip
->
driver_caps
&
AZX_DCAPS_PM_RUNTIME
))
return
-
EBUSY
;
return
-
EBUSY
;
return
0
;
return
0
;
...
@@ -1071,8 +1069,7 @@ static int azx_free(struct azx *chip)
...
@@ -1071,8 +1069,7 @@ static int azx_free(struct azx *chip)
struct
hda_intel
*
hda
=
container_of
(
chip
,
struct
hda_intel
,
chip
);
struct
hda_intel
*
hda
=
container_of
(
chip
,
struct
hda_intel
,
chip
);
int
i
;
int
i
;
if
((
chip
->
driver_caps
&
AZX_DCAPS_PM_RUNTIME
)
if
(
azx_has_pm_runtime
(
chip
)
&&
chip
->
running
)
&&
chip
->
running
)
pm_runtime_get_noresume
(
&
pci
->
dev
);
pm_runtime_get_noresume
(
&
pci
->
dev
);
azx_del_card_list
(
chip
);
azx_del_card_list
(
chip
);
...
@@ -1896,12 +1893,14 @@ static int azx_probe_continue(struct azx *chip)
...
@@ -1896,12 +1893,14 @@ static int azx_probe_continue(struct azx *chip)
#endif
#endif
/* create codec instances */
/* create codec instances */
err
=
azx_
codec_create
(
chip
,
model
[
dev
],
err
=
azx_
bus_create
(
chip
,
model
[
dev
],
power_save_addr
);
azx_max_codecs
[
chip
->
driver_type
],
if
(
err
<
0
)
power_save_addr
)
;
goto
out_free
;
err
=
azx_probe_codecs
(
chip
,
azx_max_codecs
[
chip
->
driver_type
]);
if
(
err
<
0
)
if
(
err
<
0
)
goto
out_free
;
goto
out_free
;
#ifdef CONFIG_SND_HDA_PATCH_LOADER
#ifdef CONFIG_SND_HDA_PATCH_LOADER
if
(
chip
->
fw
)
{
if
(
chip
->
fw
)
{
err
=
snd_hda_load_patch
(
chip
->
bus
,
chip
->
fw
->
size
,
err
=
snd_hda_load_patch
(
chip
->
bus
,
chip
->
fw
->
size
,
...
@@ -1926,7 +1925,7 @@ static int azx_probe_continue(struct azx *chip)
...
@@ -1926,7 +1925,7 @@ static int azx_probe_continue(struct azx *chip)
goto
out_free
;
goto
out_free
;
/* create mixer controls */
/* create mixer controls */
err
=
azx_mixer_create
(
chip
);
err
=
snd_hda_build_controls
(
chip
->
bus
);
if
(
err
<
0
)
if
(
err
<
0
)
goto
out_free
;
goto
out_free
;
...
@@ -1938,7 +1937,7 @@ static int azx_probe_continue(struct azx *chip)
...
@@ -1938,7 +1937,7 @@ static int azx_probe_continue(struct azx *chip)
power_down_all_codecs
(
chip
);
power_down_all_codecs
(
chip
);
azx_notifier_register
(
chip
);
azx_notifier_register
(
chip
);
azx_add_card_list
(
chip
);
azx_add_card_list
(
chip
);
if
(
(
chip
->
driver_caps
&
AZX_DCAPS_PM_RUNTIME
)
||
hda
->
use_vga_switcheroo
)
if
(
azx_has_pm_runtime
(
chip
)
||
hda
->
use_vga_switcheroo
)
pm_runtime_put_noidle
(
&
pci
->
dev
);
pm_runtime_put_noidle
(
&
pci
->
dev
);
out_free:
out_free:
...
...
sound/pci/hda/hda_intel.h
View file @
8d085d3c
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
#define __SOUND_HDA_INTEL_H
#define __SOUND_HDA_INTEL_H
#include <drm/i915_component.h>
#include <drm/i915_component.h>
#include "hda_
priv
.h"
#include "hda_
controller
.h"
struct
hda_intel
{
struct
hda_intel
{
struct
azx
chip
;
struct
azx
chip
;
...
...
sound/pci/hda/hda_local.h
View file @
8d085d3c
...
@@ -466,23 +466,6 @@ void snd_hda_pick_pin_fixup(struct hda_codec *codec,
...
@@ -466,23 +466,6 @@ void snd_hda_pick_pin_fixup(struct hda_codec *codec,
const
struct
snd_hda_pin_quirk
*
pin_quirk
,
const
struct
snd_hda_pin_quirk
*
pin_quirk
,
const
struct
hda_fixup
*
fixlist
);
const
struct
hda_fixup
*
fixlist
);
/*
* unsolicited event handler
*/
#define HDA_UNSOL_QUEUE_SIZE 64
struct
hda_bus_unsolicited
{
/* ring buffer */
u32
queue
[
HDA_UNSOL_QUEUE_SIZE
*
2
];
unsigned
int
rp
,
wp
;
/* workqueue */
struct
work_struct
work
;
struct
hda_bus
*
bus
;
};
/* helper macros to retrieve pin default-config values */
/* helper macros to retrieve pin default-config values */
#define get_defcfg_connect(cfg) \
#define get_defcfg_connect(cfg) \
((cfg & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT)
((cfg & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT)
...
...
sound/pci/hda/hda_priv.h
deleted
100644 → 0
View file @
88cacc57
This diff is collapsed.
Click to expand it.
sound/pci/hda/hda_tegra.c
View file @
8d085d3c
...
@@ -37,7 +37,6 @@
...
@@ -37,7 +37,6 @@
#include "hda_codec.h"
#include "hda_codec.h"
#include "hda_controller.h"
#include "hda_controller.h"
#include "hda_priv.h"
/* Defines for Nvidia Tegra HDA support */
/* Defines for Nvidia Tegra HDA support */
#define HDA_BAR0 0x8000
#define HDA_BAR0 0x8000
...
@@ -503,7 +502,11 @@ static int hda_tegra_probe(struct platform_device *pdev)
...
@@ -503,7 +502,11 @@ static int hda_tegra_probe(struct platform_device *pdev)
goto
out_free
;
goto
out_free
;
/* create codec instances */
/* create codec instances */
err
=
azx_codec_create
(
chip
,
NULL
,
0
,
&
power_save
);
err
=
azx_bus_create
(
chip
,
NULL
,
&
power_save
);
if
(
err
<
0
)
goto
out_free
;
err
=
azx_probe_codecs
(
chip
,
0
);
if
(
err
<
0
)
if
(
err
<
0
)
goto
out_free
;
goto
out_free
;
...
@@ -517,7 +520,7 @@ static int hda_tegra_probe(struct platform_device *pdev)
...
@@ -517,7 +520,7 @@ static int hda_tegra_probe(struct platform_device *pdev)
goto
out_free
;
goto
out_free
;
/* create mixer controls */
/* create mixer controls */
err
=
azx_mixer_create
(
chip
);
err
=
snd_hda_build_controls
(
chip
->
bus
);
if
(
err
<
0
)
if
(
err
<
0
)
goto
out_free
;
goto
out_free
;
...
...
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