12c9916cdSFrançois Tigeot /* 22c9916cdSFrançois Tigeot * Copyright © 2014 Intel Corporation 32c9916cdSFrançois Tigeot * 42c9916cdSFrançois Tigeot * Permission is hereby granted, free of charge, to any person obtaining a 52c9916cdSFrançois Tigeot * copy of this software and associated documentation files (the "Software"), 62c9916cdSFrançois Tigeot * to deal in the Software without restriction, including without limitation 72c9916cdSFrançois Tigeot * the rights to use, copy, modify, merge, publish, distribute, sublicense, 82c9916cdSFrançois Tigeot * and/or sell copies of the Software, and to permit persons to whom the 92c9916cdSFrançois Tigeot * Software is furnished to do so, subject to the following conditions: 102c9916cdSFrançois Tigeot * 112c9916cdSFrançois Tigeot * The above copyright notice and this permission notice (including the next 122c9916cdSFrançois Tigeot * paragraph) shall be included in all copies or substantial portions of the 132c9916cdSFrançois Tigeot * Software. 142c9916cdSFrançois Tigeot * 152c9916cdSFrançois Tigeot * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 162c9916cdSFrançois Tigeot * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 172c9916cdSFrançois Tigeot * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 182c9916cdSFrançois Tigeot * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 192c9916cdSFrançois Tigeot * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 202c9916cdSFrançois Tigeot * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 212c9916cdSFrançois Tigeot * IN THE SOFTWARE. 222c9916cdSFrançois Tigeot */ 232c9916cdSFrançois Tigeot 242c9916cdSFrançois Tigeot #ifndef _I915_COMPONENT_H_ 252c9916cdSFrançois Tigeot #define _I915_COMPONENT_H_ 262c9916cdSFrançois Tigeot 27352ff8bdSFrançois Tigeot /* MAX_PORT is the number of port 28352ff8bdSFrançois Tigeot * It must be sync with I915_MAX_PORTS defined i915_drv.h 29352ff8bdSFrançois Tigeot * 5 should be enough as only HSW, BDW, SKL need such fix. 30352ff8bdSFrançois Tigeot */ 31352ff8bdSFrançois Tigeot #define MAX_PORTS 5 32352ff8bdSFrançois Tigeot 33352ff8bdSFrançois Tigeot /** 34aee94f86SFrançois Tigeot * struct i915_audio_component_ops - Ops implemented by i915 driver, called by hda driver 35352ff8bdSFrançois Tigeot */ 36aee94f86SFrançois Tigeot struct i915_audio_component_ops { 37aee94f86SFrançois Tigeot /** 38aee94f86SFrançois Tigeot * @owner: i915 module 39aee94f86SFrançois Tigeot */ 402c9916cdSFrançois Tigeot struct module *owner; 41aee94f86SFrançois Tigeot /** 42aee94f86SFrançois Tigeot * @get_power: get the POWER_DOMAIN_AUDIO power well 43aee94f86SFrançois Tigeot * 44aee94f86SFrançois Tigeot * Request the power well to be turned on. 45aee94f86SFrançois Tigeot */ 462c9916cdSFrançois Tigeot void (*get_power)(struct device *); 47aee94f86SFrançois Tigeot /** 48aee94f86SFrançois Tigeot * @put_power: put the POWER_DOMAIN_AUDIO power well 49aee94f86SFrançois Tigeot * 50aee94f86SFrançois Tigeot * Allow the power well to be turned off. 51aee94f86SFrançois Tigeot */ 522c9916cdSFrançois Tigeot void (*put_power)(struct device *); 53aee94f86SFrançois Tigeot /** 54aee94f86SFrançois Tigeot * @codec_wake_override: Enable/disable codec wake signal 55aee94f86SFrançois Tigeot */ 5619c468b4SFrançois Tigeot void (*codec_wake_override)(struct device *, bool enable); 57aee94f86SFrançois Tigeot /** 58aee94f86SFrançois Tigeot * @get_cdclk_freq: Get the Core Display Clock in kHz 59aee94f86SFrançois Tigeot */ 602c9916cdSFrançois Tigeot int (*get_cdclk_freq)(struct device *); 61352ff8bdSFrançois Tigeot /** 62352ff8bdSFrançois Tigeot * @sync_audio_rate: set n/cts based on the sample rate 63352ff8bdSFrançois Tigeot * 64352ff8bdSFrançois Tigeot * Called from audio driver. After audio driver sets the 65352ff8bdSFrançois Tigeot * sample rate, it will call this function to set n/cts 66352ff8bdSFrançois Tigeot */ 67*1e12ee3bSFrançois Tigeot int (*sync_audio_rate)(struct device *, int port, int pipe, int rate); 68aee94f86SFrançois Tigeot /** 69aee94f86SFrançois Tigeot * @get_eld: fill the audio state and ELD bytes for the given port 70aee94f86SFrançois Tigeot * 71aee94f86SFrançois Tigeot * Called from audio driver to get the HDMI/DP audio state of the given 72aee94f86SFrançois Tigeot * digital port, and also fetch ELD bytes to the given pointer. 73aee94f86SFrançois Tigeot * 74aee94f86SFrançois Tigeot * It returns the byte size of the original ELD (not the actually 75aee94f86SFrançois Tigeot * copied size), zero for an invalid ELD, or a negative error code. 76aee94f86SFrançois Tigeot * 77aee94f86SFrançois Tigeot * Note that the returned size may be over @max_bytes. Then it 78aee94f86SFrançois Tigeot * implies that only a part of ELD has been copied to the buffer. 79aee94f86SFrançois Tigeot */ 80*1e12ee3bSFrançois Tigeot int (*get_eld)(struct device *, int port, int pipe, bool *enabled, 81aee94f86SFrançois Tigeot unsigned char *buf, int max_bytes); 82aee94f86SFrançois Tigeot }; 83a05eeebfSFrançois Tigeot 84aee94f86SFrançois Tigeot /** 85aee94f86SFrançois Tigeot * struct i915_audio_component_audio_ops - Ops implemented by hda driver, called by i915 driver 86aee94f86SFrançois Tigeot */ 87aee94f86SFrançois Tigeot struct i915_audio_component_audio_ops { 88aee94f86SFrançois Tigeot /** 89aee94f86SFrançois Tigeot * @audio_ptr: Pointer to be used in call to pin_eld_notify 90aee94f86SFrançois Tigeot */ 91a05eeebfSFrançois Tigeot void *audio_ptr; 92a05eeebfSFrançois Tigeot /** 93aee94f86SFrançois Tigeot * @pin_eld_notify: Notify the HDA driver that pin sense and/or ELD information has changed 94aee94f86SFrançois Tigeot * 95aee94f86SFrançois Tigeot * Called when the i915 driver has set up audio pipeline or has just 96aee94f86SFrançois Tigeot * begun to tear it down. This allows the HDA driver to update its 97aee94f86SFrançois Tigeot * status accordingly (even when the HDA controller is in power save 98aee94f86SFrançois Tigeot * mode). 99a05eeebfSFrançois Tigeot */ 100*1e12ee3bSFrançois Tigeot void (*pin_eld_notify)(void *audio_ptr, int port, int pipe); 101aee94f86SFrançois Tigeot }; 102aee94f86SFrançois Tigeot 103aee94f86SFrançois Tigeot /** 104aee94f86SFrançois Tigeot * struct i915_audio_component - Used for direct communication between i915 and hda drivers 105aee94f86SFrançois Tigeot */ 106aee94f86SFrançois Tigeot struct i915_audio_component { 107aee94f86SFrançois Tigeot /** 108aee94f86SFrançois Tigeot * @dev: i915 device, used as parameter for ops 109aee94f86SFrançois Tigeot */ 110aee94f86SFrançois Tigeot struct device *dev; 111aee94f86SFrançois Tigeot /** 112aee94f86SFrançois Tigeot * @aud_sample_rate: the array of audio sample rate per port 113aee94f86SFrançois Tigeot */ 114aee94f86SFrançois Tigeot int aud_sample_rate[MAX_PORTS]; 115aee94f86SFrançois Tigeot /** 116aee94f86SFrançois Tigeot * @ops: Ops implemented by i915 driver, called by hda driver 117aee94f86SFrançois Tigeot */ 118aee94f86SFrançois Tigeot const struct i915_audio_component_ops *ops; 119aee94f86SFrançois Tigeot /** 120aee94f86SFrançois Tigeot * @audio_ops: Ops implemented by hda driver, called by i915 driver 121aee94f86SFrançois Tigeot */ 122aee94f86SFrançois Tigeot const struct i915_audio_component_audio_ops *audio_ops; 1232c9916cdSFrançois Tigeot }; 1242c9916cdSFrançois Tigeot 1252c9916cdSFrançois Tigeot #endif /* _I915_COMPONENT_H_ */ 126