| .. | .. |
|---|
| 24 | 24 | }; |
|---|
| 25 | 25 | |
|---|
| 26 | 26 | /** |
|---|
| 27 | | - * snd_soc_component_set_jack - configure component jack. |
|---|
| 28 | | - * @component: COMPONENTs |
|---|
| 29 | | - * @jack: structure to use for the jack |
|---|
| 30 | | - * @data: can be used if codec driver need extra data for configuring jack |
|---|
| 31 | | - * |
|---|
| 32 | | - * Configures and enables jack detection function. |
|---|
| 33 | | - */ |
|---|
| 34 | | -int snd_soc_component_set_jack(struct snd_soc_component *component, |
|---|
| 35 | | - struct snd_soc_jack *jack, void *data) |
|---|
| 36 | | -{ |
|---|
| 37 | | - if (component->driver->set_jack) |
|---|
| 38 | | - return component->driver->set_jack(component, jack, data); |
|---|
| 39 | | - |
|---|
| 40 | | - return -ENOTSUPP; |
|---|
| 41 | | -} |
|---|
| 42 | | -EXPORT_SYMBOL_GPL(snd_soc_component_set_jack); |
|---|
| 43 | | - |
|---|
| 44 | | -/** |
|---|
| 45 | | - * snd_soc_card_jack_new - Create a new jack |
|---|
| 46 | | - * @card: ASoC card |
|---|
| 47 | | - * @id: an identifying string for this jack |
|---|
| 48 | | - * @type: a bitmask of enum snd_jack_type values that can be detected by |
|---|
| 49 | | - * this jack |
|---|
| 50 | | - * @jack: structure to use for the jack |
|---|
| 51 | | - * @pins: Array of jack pins to be added to the jack or NULL |
|---|
| 52 | | - * @num_pins: Number of elements in the @pins array |
|---|
| 53 | | - * |
|---|
| 54 | | - * Creates a new jack object. |
|---|
| 55 | | - * |
|---|
| 56 | | - * Returns zero if successful, or a negative error code on failure. |
|---|
| 57 | | - * On success jack will be initialised. |
|---|
| 58 | | - */ |
|---|
| 59 | | -int snd_soc_card_jack_new(struct snd_soc_card *card, const char *id, int type, |
|---|
| 60 | | - struct snd_soc_jack *jack, struct snd_soc_jack_pin *pins, |
|---|
| 61 | | - unsigned int num_pins) |
|---|
| 62 | | -{ |
|---|
| 63 | | - int ret; |
|---|
| 64 | | - |
|---|
| 65 | | - mutex_init(&jack->mutex); |
|---|
| 66 | | - jack->card = card; |
|---|
| 67 | | - INIT_LIST_HEAD(&jack->pins); |
|---|
| 68 | | - INIT_LIST_HEAD(&jack->jack_zones); |
|---|
| 69 | | - BLOCKING_INIT_NOTIFIER_HEAD(&jack->notifier); |
|---|
| 70 | | - |
|---|
| 71 | | - ret = snd_jack_new(card->snd_card, id, type, &jack->jack, false, false); |
|---|
| 72 | | - if (ret) |
|---|
| 73 | | - return ret; |
|---|
| 74 | | - |
|---|
| 75 | | - if (num_pins) |
|---|
| 76 | | - return snd_soc_jack_add_pins(jack, num_pins, pins); |
|---|
| 77 | | - |
|---|
| 78 | | - return 0; |
|---|
| 79 | | -} |
|---|
| 80 | | -EXPORT_SYMBOL_GPL(snd_soc_card_jack_new); |
|---|
| 81 | | - |
|---|
| 82 | | -/** |
|---|
| 83 | 27 | * snd_soc_jack_report - Report the current status for a jack |
|---|
| 84 | 28 | * |
|---|
| 85 | 29 | * @jack: the jack |
|---|