ALSA: hda: pass intel_hda to all i915 interface functions

chip is already passed to most of the i915 interface functions. Unify
the interface by passing intel_hda instead of chip and passing it to all
functions. Passing intel_hda instead of chip makes more sense since this
is an intel specific interface. Also in an upcoming patch we will use
intel_hda in all of these functions so by passing intel_hda we can save
on some pointer casts from chip to intel_hda.

This will be needed by an upcoming patch adding component support.

No functional change.

v2-3: unchanged
v4:
- pass intel_hda instead of chip

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Imre Deak 2015-01-08 17:54:16 +02:00 committed by Daniel Vetter
parent 347de1f862
commit 926981ae33
3 changed files with 33 additions and 26 deletions

View File

@ -35,7 +35,7 @@ static int (*get_power)(void);
static int (*put_power)(void); static int (*put_power)(void);
static int (*get_cdclk)(void); static int (*get_cdclk)(void);
int hda_display_power(bool enable) int hda_display_power(struct hda_intel *hda, bool enable)
{ {
if (!get_power || !put_power) if (!get_power || !put_power)
return -ENODEV; return -ENODEV;
@ -48,7 +48,7 @@ int hda_display_power(bool enable)
return put_power(); return put_power();
} }
void haswell_set_bclk(struct azx *chip) void haswell_set_bclk(struct hda_intel *hda)
{ {
int cdclk_freq; int cdclk_freq;
unsigned int bclk_m, bclk_n; unsigned int bclk_m, bclk_n;
@ -80,12 +80,12 @@ void haswell_set_bclk(struct azx *chip)
break; break;
} }
azx_writew(chip, EM4, bclk_m); azx_writew(&hda->chip, EM4, bclk_m);
azx_writew(chip, EM5, bclk_n); azx_writew(&hda->chip, EM5, bclk_n);
} }
int hda_i915_init(void) int hda_i915_init(struct hda_intel *hda)
{ {
int err = 0; int err = 0;
@ -111,7 +111,7 @@ int hda_i915_init(void)
return err; return err;
} }
int hda_i915_exit(void) int hda_i915_exit(struct hda_intel *hda)
{ {
if (get_power) { if (get_power) {
symbol_put(i915_request_power_well); symbol_put(i915_request_power_well);

View File

@ -803,7 +803,7 @@ static int azx_suspend(struct device *dev)
pci_save_state(pci); pci_save_state(pci);
pci_set_power_state(pci, PCI_D3hot); pci_set_power_state(pci, PCI_D3hot);
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
hda_display_power(false); hda_display_power(hda, false);
return 0; return 0;
} }
@ -823,8 +823,8 @@ static int azx_resume(struct device *dev)
return 0; return 0;
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
hda_display_power(true); hda_display_power(hda, true);
haswell_set_bclk(chip); haswell_set_bclk(hda);
} }
pci_set_power_state(pci, PCI_D0); pci_set_power_state(pci, PCI_D0);
pci_restore_state(pci); pci_restore_state(pci);
@ -876,7 +876,7 @@ static int azx_runtime_suspend(struct device *dev)
azx_enter_link_reset(chip); azx_enter_link_reset(chip);
azx_clear_irq_pending(chip); azx_clear_irq_pending(chip);
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
hda_display_power(false); hda_display_power(hda, false);
return 0; return 0;
} }
@ -902,8 +902,8 @@ static int azx_runtime_resume(struct device *dev)
return 0; return 0;
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
hda_display_power(true); hda_display_power(hda, true);
haswell_set_bclk(chip); haswell_set_bclk(hda);
} }
/* Read STATESTS before controller reset */ /* Read STATESTS before controller reset */
@ -1125,8 +1125,8 @@ static int azx_free(struct azx *chip)
release_firmware(chip->fw); release_firmware(chip->fw);
#endif #endif
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
hda_display_power(false); hda_display_power(hda, false);
hda_i915_exit(); hda_i915_exit(hda);
} }
kfree(hda); kfree(hda);
@ -1604,8 +1604,12 @@ static int azx_first_init(struct azx *chip)
/* initialize chip */ /* initialize chip */
azx_init_pci(chip); azx_init_pci(chip);
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
haswell_set_bclk(chip); struct hda_intel *hda;
hda = container_of(chip, struct hda_intel, chip);
haswell_set_bclk(hda);
}
azx_init_chip(chip, (probe_only[dev] & 2) == 0); azx_init_chip(chip, (probe_only[dev] & 2) == 0);
@ -1885,13 +1889,13 @@ static int azx_probe_continue(struct azx *chip)
/* Request power well for Haswell HDA controller and codec */ /* Request power well for Haswell HDA controller and codec */
if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
#ifdef CONFIG_SND_HDA_I915 #ifdef CONFIG_SND_HDA_I915
err = hda_i915_init(); err = hda_i915_init(hda);
if (err < 0) { if (err < 0) {
dev_err(chip->card->dev, dev_err(chip->card->dev,
"Error request power-well from i915\n"); "Error request power-well from i915\n");
goto out_free; goto out_free;
} }
err = hda_display_power(true); err = hda_display_power(hda, true);
if (err < 0) { if (err < 0) {
dev_err(chip->card->dev, dev_err(chip->card->dev,
"Cannot turn on display power on i915\n"); "Cannot turn on display power on i915\n");

View File

@ -44,18 +44,21 @@ struct hda_intel {
}; };
#ifdef CONFIG_SND_HDA_I915 #ifdef CONFIG_SND_HDA_I915
int hda_display_power(bool enable); int hda_display_power(struct hda_intel *hda, bool enable);
void haswell_set_bclk(struct azx *chip); void haswell_set_bclk(struct hda_intel *hda);
int hda_i915_init(void); int hda_i915_init(struct hda_intel *hda);
int hda_i915_exit(void); int hda_i915_exit(struct hda_intel *hda);
#else #else
static inline int hda_display_power(bool enable) { return 0; } static inline int hda_display_power(struct hda_intel *hda, bool enable)
static inline void haswell_set_bclk(struct azx *chip) { return; } {
static inline int hda_i915_init(void) return 0;
}
static inline void haswell_set_bclk(struct hda_intel *hda) { return; }
static inline int hda_i915_init(struct hda_intel *hda)
{ {
return -ENODEV; return -ENODEV;
} }
static inline int hda_i915_exit(void) static inline int hda_i915_exit(struct hda_intel *hda)
{ {
return 0; return 0;
} }