mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 00:51:35 +00:00
pcmcia: introduce autoconfiguration feature
Introduce an autoconfiguration feature to set certain values in pcmcia_loop_config(), instead of copying the same code over and over in each PCMCIA driver. At first, introduce the following options: CONF_AUTO_CHECK_VCC check or matching Vcc entry CONF_AUTO_SET_VPP set Vpp CONF_AUTO_AUDIO enable the speaker line CC: netdev@vger.kernel.org CC: linux-wireless@vger.kernel.org CC: linux-ide@vger.kernel.org CC: linux-usb@vger.kernel.org CC: laforge@gnumonks.org CC: linux-mtd@lists.infradead.org CC: alsa-devel@alsa-project.org CC: linux-serial@vger.kernel.org CC: Jiri Kosina <jkosina@suse.cz> CC: linux-scsi@vger.kernel.org Acked-by: Gustavo F. Padovan <padovan@profusion.mobi> (for drivers/bluetooth) Tested-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
parent
9485ee14e1
commit
440eed43e2
43 changed files with 122 additions and 331 deletions
|
@ -472,7 +472,6 @@ static void prism2_detach(struct pcmcia_device *link)
|
|||
static int prism2_config_check(struct pcmcia_device *p_dev,
|
||||
cistpl_cftable_entry_t *cfg,
|
||||
cistpl_cftable_entry_t *dflt,
|
||||
unsigned int vcc,
|
||||
void *priv_data)
|
||||
{
|
||||
if (cfg->index == 0)
|
||||
|
@ -481,28 +480,6 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
|
|||
PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X "
|
||||
"(default 0x%02X)\n", cfg->index, dflt->index);
|
||||
|
||||
/* Does this card need audio output? */
|
||||
if (cfg->flags & CISTPL_CFTABLE_AUDIO)
|
||||
p_dev->config_flags |= CONF_ENABLE_SPKR;
|
||||
|
||||
/* Use power settings for Vcc and Vpp if present */
|
||||
/* Note that the CIS values need to be rescaled */
|
||||
if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
||||
if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] /
|
||||
10000 && !ignore_cis_vcc) {
|
||||
PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping"
|
||||
" this entry\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
} else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
|
||||
if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] /
|
||||
10000 && !ignore_cis_vcc) {
|
||||
PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch "
|
||||
"- skipping this entry\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
|
||||
p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
|
||||
else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
|
||||
|
@ -553,6 +530,10 @@ static int prism2_config(struct pcmcia_device *link)
|
|||
}
|
||||
|
||||
/* Look for an appropriate configuration table entry in the CIS */
|
||||
link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO |
|
||||
CONF_AUTO_CHECK_VCC;
|
||||
if (ignore_cis_vcc)
|
||||
link->config_flags &= ~CONF_AUTO_CHECK_VCC;
|
||||
ret = pcmcia_loop_config(link, prism2_config_check, NULL);
|
||||
if (ret) {
|
||||
if (!ignore_cis_vcc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue