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 /** 343f4c90bdSLibin Yang * struct i915_audio_component_ops - callbacks defined in gfx driver 353f4c90bdSLibin Yang * @owner: the module owner 363f4c90bdSLibin Yang * @get_power: get the POWER_DOMAIN_AUDIO power well 373f4c90bdSLibin Yang * @put_power: put the POWER_DOMAIN_AUDIO power well 383f4c90bdSLibin Yang * @codec_wake_override: Enable/Disable generating the codec wake signal 393f4c90bdSLibin Yang * @get_cdclk_freq: get the Core Display Clock in KHz 403f4c90bdSLibin Yang * @sync_audio_rate: set n/cts based on the sample rate 417e8275c2SLibin Yang */ 423f4c90bdSLibin Yang struct i915_audio_component_ops { 4358fddc28SImre Deak struct module *owner; 4458fddc28SImre Deak void (*get_power)(struct device *); 4558fddc28SImre Deak void (*put_power)(struct device *); 46632f3ab9SLu, Han void (*codec_wake_override)(struct device *, bool enable); 4758fddc28SImre Deak int (*get_cdclk_freq)(struct device *); 485334240cSLibin Yang int (*sync_audio_rate)(struct device *, int port, int rate); 493f4c90bdSLibin Yang }; 502a8ceedfSDavid Henningsson 513f4c90bdSLibin Yang struct i915_audio_component_audio_ops { 522a8ceedfSDavid Henningsson void *audio_ptr; 532a8ceedfSDavid Henningsson /** 542a8ceedfSDavid Henningsson * Call from i915 driver, notifying the HDA driver that 552a8ceedfSDavid Henningsson * pin sense and/or ELD information has changed. 562a8ceedfSDavid Henningsson * @audio_ptr: HDA driver object 572a8ceedfSDavid Henningsson * @port: Which port has changed (PORTA / PORTB / PORTC etc) 582a8ceedfSDavid Henningsson */ 59f0675d4aSDavid Henningsson void (*pin_eld_notify)(void *audio_ptr, int port); 603f4c90bdSLibin Yang }; 613f4c90bdSLibin Yang 623f4c90bdSLibin Yang /** 633f4c90bdSLibin Yang * struct i915_audio_component - used for audio video interaction 643f4c90bdSLibin Yang * @dev: the device from gfx driver 653f4c90bdSLibin Yang * @aud_sample_rate: the array of audio sample rate per port 663f4c90bdSLibin Yang * @ops: callback for audio driver calling 673f4c90bdSLibin Yang * @audio_ops: Call from i915 driver 683f4c90bdSLibin Yang */ 693f4c90bdSLibin Yang struct i915_audio_component { 703f4c90bdSLibin Yang struct device *dev; 713f4c90bdSLibin Yang int aud_sample_rate[MAX_PORTS]; 723f4c90bdSLibin Yang 733f4c90bdSLibin Yang const struct i915_audio_component_ops *ops; 743f4c90bdSLibin Yang 753f4c90bdSLibin Yang const struct i915_audio_component_audio_ops *audio_ops; 7658fddc28SImre Deak }; 7758fddc28SImre Deak 7858fddc28SImre Deak #endif /* _I915_COMPONENT_H_ */ 79