i915_component.h revision 1.1.1.1 1 /* $NetBSD: i915_component.h,v 1.1.1.1 2018/08/27 01:35:00 riastradh Exp $ */
2
3 /*
4 * Copyright 2014 Intel Corporation
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23 * IN THE SOFTWARE.
24 */
25
26 #ifndef _I915_COMPONENT_H_
27 #define _I915_COMPONENT_H_
28
29 /* MAX_PORT is the number of port
30 * It must be sync with I915_MAX_PORTS defined i915_drv.h
31 * 5 should be enough as only HSW, BDW, SKL need such fix.
32 */
33 #define MAX_PORTS 5
34
35 /**
36 * struct i915_audio_component_ops - callbacks defined in gfx driver
37 * @owner: the module owner
38 * @get_power: get the POWER_DOMAIN_AUDIO power well
39 * @put_power: put the POWER_DOMAIN_AUDIO power well
40 * @codec_wake_override: Enable/Disable generating the codec wake signal
41 * @get_cdclk_freq: get the Core Display Clock in KHz
42 * @sync_audio_rate: set n/cts based on the sample rate
43 */
44 struct i915_audio_component_ops {
45 struct module *owner;
46 void (*get_power)(struct device *);
47 void (*put_power)(struct device *);
48 void (*codec_wake_override)(struct device *, bool enable);
49 int (*get_cdclk_freq)(struct device *);
50 int (*sync_audio_rate)(struct device *, int port, int rate);
51 };
52
53 struct i915_audio_component_audio_ops {
54 void *audio_ptr;
55 /**
56 * Call from i915 driver, notifying the HDA driver that
57 * pin sense and/or ELD information has changed.
58 * @audio_ptr: HDA driver object
59 * @port: Which port has changed (PORTA / PORTB / PORTC etc)
60 */
61 void (*pin_eld_notify)(void *audio_ptr, int port);
62 };
63
64 /**
65 * struct i915_audio_component - used for audio video interaction
66 * @dev: the device from gfx driver
67 * @aud_sample_rate: the array of audio sample rate per port
68 * @ops: callback for audio driver calling
69 * @audio_ops: Call from i915 driver
70 */
71 struct i915_audio_component {
72 struct device *dev;
73 int aud_sample_rate[MAX_PORTS];
74
75 const struct i915_audio_component_ops *ops;
76
77 const struct i915_audio_component_audio_ops *audio_ops;
78 };
79
80 #endif /* _I915_COMPONENT_H_ */
81