diff options
Diffstat (limited to 'drivers/platform/x86/thinkpad_acpi.c')
| -rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 61 | 
1 files changed, 46 insertions, 15 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 448c8aeb166b..eb603f1d55ca 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -5771,7 +5771,7 @@ static void thermal_exit(void)  	case TPACPI_THERMAL_ACPI_TMP07:  	case TPACPI_THERMAL_ACPI_UPDT:  		sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj, -				   &thermal_temp_input16_group); +				   &thermal_temp_input8_group);  		break;  	case TPACPI_THERMAL_NONE:  	default: @@ -6384,11 +6384,13 @@ static struct ibm_struct brightness_driver_data = {   * and we leave them unchanged.   */ +#ifdef CONFIG_THINKPAD_ACPI_ALSA_SUPPORT +  #define TPACPI_ALSA_DRVNAME  "ThinkPad EC"  #define TPACPI_ALSA_SHRTNAME "ThinkPad Console Audio Control"  #define TPACPI_ALSA_MIXERNAME TPACPI_ALSA_SHRTNAME -static int alsa_index = SNDRV_DEFAULT_IDX1; +static int alsa_index = ~((1 << (SNDRV_CARDS - 3)) - 1); /* last three slots */  static char *alsa_id = "ThinkPadEC";  static int alsa_enable = SNDRV_DEFAULT_ENABLE1; @@ -6705,10 +6707,11 @@ static int __init volume_create_alsa_mixer(void)  	rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE,  			    sizeof(struct tpacpi_alsa_data), &card); -	if (rc < 0) -		return rc; -	if (!card) -		return -ENOMEM; +	if (rc < 0 || !card) { +		printk(TPACPI_ERR +			"Failed to create ALSA card structures: %d\n", rc); +		return 1; +	}  	BUG_ON(!card->private_data);  	data = card->private_data; @@ -6741,8 +6744,9 @@ static int __init volume_create_alsa_mixer(void)  		rc = snd_ctl_add(card, ctl_vol);  		if (rc < 0) {  			printk(TPACPI_ERR -				"Failed to create ALSA volume control\n"); -			goto err_out; +				"Failed to create ALSA volume control: %d\n", +				rc); +			goto err_exit;  		}  		data->ctl_vol_id = &ctl_vol->id;  	} @@ -6750,22 +6754,25 @@ static int __init volume_create_alsa_mixer(void)  	ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL);  	rc = snd_ctl_add(card, ctl_mute);  	if (rc < 0) { -		printk(TPACPI_ERR "Failed to create ALSA mute control\n"); -		goto err_out; +		printk(TPACPI_ERR "Failed to create ALSA mute control: %d\n", +			rc); +		goto err_exit;  	}  	data->ctl_mute_id = &ctl_mute->id;  	snd_card_set_dev(card, &tpacpi_pdev->dev);  	rc = snd_card_register(card); - -err_out:  	if (rc < 0) { -		snd_card_free(card); -		card = NULL; +		printk(TPACPI_ERR "Failed to register ALSA card: %d\n", rc); +		goto err_exit;  	}  	alsa_card = card; -	return rc; +	return 0; + +err_exit: +	snd_card_free(card); +	return 1;  }  #define TPACPI_VOL_Q_MUTEONLY	0x0001	/* Mute-only control available */ @@ -7016,6 +7023,28 @@ static struct ibm_struct volume_driver_data = {  	.shutdown = volume_shutdown,  }; +#else /* !CONFIG_THINKPAD_ACPI_ALSA_SUPPORT */ + +#define alsa_card NULL + +static void inline volume_alsa_notify_change(void) +{ +} + +static int __init volume_init(struct ibm_init_struct *iibm) +{ +	printk(TPACPI_INFO +		"volume: disabled as there is no ALSA support in this kernel\n"); + +	return 1; +} + +static struct ibm_struct volume_driver_data = { +	.name = "volume", +}; + +#endif /* CONFIG_THINKPAD_ACPI_ALSA_SUPPORT */ +  /*************************************************************************   * Fan subdriver   */ @@ -8738,6 +8767,7 @@ MODULE_PARM_DESC(hotkey_report_mode,  		 "used for backwards compatibility with userspace, "  		 "see documentation"); +#ifdef CONFIG_THINKPAD_ACPI_ALSA_SUPPORT  module_param_named(volume_mode, volume_mode, uint, 0444);  MODULE_PARM_DESC(volume_mode,  		 "Selects volume control strategy: " @@ -8760,6 +8790,7 @@ module_param_named(id, alsa_id, charp, 0444);  MODULE_PARM_DESC(id, "ALSA id for the ACPI EC Mixer");  module_param_named(enable, alsa_enable, bool, 0444);  MODULE_PARM_DESC(enable, "Enable the ALSA interface for the ACPI EC Mixer"); +#endif /* CONFIG_THINKPAD_ACPI_ALSA_SUPPORT */  #define TPACPI_PARAM(feature) \  	module_param_call(feature, set_ibm_param, NULL, NULL, 0); \  | 
