158fddc28SImre Deak /* 258fddc28SImre Deak * Copyright © 2014 Intel Corporation 358fddc28SImre Deak * 458fddc28SImre Deak * Permission is hereby granted, free of charge, to any person obtaining a 558fddc28SImre Deak * copy of this software and associated documentation files (the "Software"), 658fddc28SImre Deak * to deal in the Software without restriction, including without limitation 758fddc28SImre Deak * the rights to use, copy, modify, merge, publish, distribute, sublicense, 858fddc28SImre Deak * and/or sell copies of the Software, and to permit persons to whom the 958fddc28SImre Deak * Software is furnished to do so, subject to the following conditions: 1058fddc28SImre Deak * 1158fddc28SImre Deak * The above copyright notice and this permission notice (including the next 1258fddc28SImre Deak * paragraph) shall be included in all copies or substantial portions of the 1358fddc28SImre Deak * Software. 1458fddc28SImre Deak * 1558fddc28SImre Deak * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1658fddc28SImre Deak * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1758fddc28SImre Deak * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1858fddc28SImre Deak * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1958fddc28SImre Deak * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 2058fddc28SImre Deak * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 2158fddc28SImre Deak * IN THE SOFTWARE. 2258fddc28SImre Deak */ 2358fddc28SImre Deak 2458fddc28SImre Deak #ifndef _I915_COMPONENT_H_ 2558fddc28SImre Deak #define _I915_COMPONENT_H_ 2658fddc28SImre Deak 277e8275c2SLibin Yang /* MAX_PORT is the number of port 287e8275c2SLibin Yang * It must be sync with I915_MAX_PORTS defined i915_drv.h 297e8275c2SLibin Yang * 5 should be enough as only HSW, BDW, SKL need such fix. 307e8275c2SLibin Yang */ 317e8275c2SLibin Yang #define MAX_PORTS 5 327e8275c2SLibin Yang 337e8275c2SLibin Yang /** 34be15aad6SDavid Henningsson * struct i915_audio_component_ops - Ops implemented by i915 driver, called by hda driver 357e8275c2SLibin Yang */ 363f4c90bdSLibin Yang struct i915_audio_component_ops { 37be15aad6SDavid Henningsson /** 38be15aad6SDavid Henningsson * @owner: i915 module 39be15aad6SDavid Henningsson */ 4058fddc28SImre Deak struct module *owner; 41be15aad6SDavid Henningsson /** 42be15aad6SDavid Henningsson * @get_power: get the POWER_DOMAIN_AUDIO power well 43be15aad6SDavid Henningsson * 44be15aad6SDavid Henningsson * Request the power well to be turned on. 45be15aad6SDavid Henningsson */ 4658fddc28SImre Deak void (*get_power)(struct device *); 47be15aad6SDavid Henningsson /** 48be15aad6SDavid Henningsson * @put_power: put the POWER_DOMAIN_AUDIO power well 49be15aad6SDavid Henningsson * 50be15aad6SDavid Henningsson * Allow the power well to be turned off. 51be15aad6SDavid Henningsson */ 5258fddc28SImre Deak void (*put_power)(struct device *); 53be15aad6SDavid Henningsson /** 54be15aad6SDavid Henningsson * @codec_wake_override: Enable/disable codec wake signal 55be15aad6SDavid Henningsson */ 56632f3ab9SLu, Han void (*codec_wake_override)(struct device *, bool enable); 57be15aad6SDavid Henningsson /** 58be15aad6SDavid Henningsson * @get_cdclk_freq: Get the Core Display Clock in kHz 59be15aad6SDavid Henningsson */ 6058fddc28SImre Deak int (*get_cdclk_freq)(struct device *); 61be15aad6SDavid Henningsson /** 62be15aad6SDavid Henningsson * @sync_audio_rate: set n/cts based on the sample rate 63be15aad6SDavid Henningsson * 64be15aad6SDavid Henningsson * Called from audio driver. After audio driver sets the 65be15aad6SDavid Henningsson * sample rate, it will call this function to set n/cts 66be15aad6SDavid Henningsson */ 675334240cSLibin Yang int (*sync_audio_rate)(struct device *, int port, int rate); 683f4c90bdSLibin Yang }; 692a8ceedfSDavid Henningsson 70be15aad6SDavid Henningsson /** 71be15aad6SDavid Henningsson * struct i915_audio_component_audio_ops - Ops implemented by hda driver, called by i915 driver 72be15aad6SDavid Henningsson */ 733f4c90bdSLibin Yang struct i915_audio_component_audio_ops { 74be15aad6SDavid Henningsson /** 75be15aad6SDavid Henningsson * @audio_ptr: Pointer to be used in call to pin_eld_notify 76be15aad6SDavid Henningsson */ 772a8ceedfSDavid Henningsson void *audio_ptr; 782a8ceedfSDavid Henningsson /** 79be15aad6SDavid Henningsson * @pin_eld_notify: Notify the HDA driver that pin sense and/or ELD information has changed 80be15aad6SDavid Henningsson * 81be15aad6SDavid Henningsson * Called when the i915 driver has set up audio pipeline or has just 82be15aad6SDavid Henningsson * begun to tear it down. This allows the HDA driver to update its 83be15aad6SDavid Henningsson * status accordingly (even when the HDA controller is in power save 84be15aad6SDavid Henningsson * mode). 852a8ceedfSDavid Henningsson */ 86f0675d4aSDavid Henningsson void (*pin_eld_notify)(void *audio_ptr, int port); 873f4c90bdSLibin Yang }; 883f4c90bdSLibin Yang 893f4c90bdSLibin Yang /** 90be15aad6SDavid Henningsson * struct i915_audio_component - Used for direct communication between i915 and hda drivers 913f4c90bdSLibin Yang */ 923f4c90bdSLibin Yang struct i915_audio_component { 93be15aad6SDavid Henningsson /** 94be15aad6SDavid Henningsson * @dev: i915 device, used as parameter for ops 95be15aad6SDavid Henningsson */ 963f4c90bdSLibin Yang struct device *dev; 97be15aad6SDavid Henningsson /** 98be15aad6SDavid Henningsson * @aud_sample_rate: the array of audio sample rate per port 99be15aad6SDavid Henningsson */ 1003f4c90bdSLibin Yang int aud_sample_rate[MAX_PORTS]; 101be15aad6SDavid Henningsson /** 102be15aad6SDavid Henningsson * @ops: Ops implemented by i915 driver, called by hda driver 103be15aad6SDavid Henningsson */ 1043f4c90bdSLibin Yang const struct i915_audio_component_ops *ops; 105be15aad6SDavid Henningsson /** 106be15aad6SDavid Henningsson * @audio_ops: Ops implemented by hda driver, called by i915 driver 107be15aad6SDavid Henningsson */ 1083f4c90bdSLibin Yang const struct i915_audio_component_audio_ops *audio_ops; 10958fddc28SImre Deak }; 11058fddc28SImre Deak 11158fddc28SImre Deak #endif /* _I915_COMPONENT_H_ */ 112