xref: /dflybsd-src/sys/dev/drm/include/drm/i915_component.h (revision 352ff8bd644eb2f17a1b01fa757342a01f012051)
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 
27*352ff8bdSFrançois Tigeot /* MAX_PORT is the number of port
28*352ff8bdSFrançois Tigeot  * It must be sync with I915_MAX_PORTS defined i915_drv.h
29*352ff8bdSFrançois Tigeot  * 5 should be enough as only HSW, BDW, SKL need such fix.
30*352ff8bdSFrançois Tigeot  */
31*352ff8bdSFrançois Tigeot #define MAX_PORTS 5
32*352ff8bdSFrançois Tigeot 
332c9916cdSFrançois Tigeot struct i915_audio_component {
342c9916cdSFrançois Tigeot 	struct device *dev;
35*352ff8bdSFrançois Tigeot 	/**
36*352ff8bdSFrançois Tigeot 	 * @aud_sample_rate: the array of audio sample rate per port
37*352ff8bdSFrançois Tigeot 	 */
38*352ff8bdSFrançois Tigeot 	int aud_sample_rate[MAX_PORTS];
392c9916cdSFrançois Tigeot 
402c9916cdSFrançois Tigeot 	const struct i915_audio_component_ops {
412c9916cdSFrançois Tigeot 		struct module *owner;
422c9916cdSFrançois Tigeot 		void (*get_power)(struct device *);
432c9916cdSFrançois Tigeot 		void (*put_power)(struct device *);
4419c468b4SFrançois Tigeot 		void (*codec_wake_override)(struct device *, bool enable);
452c9916cdSFrançois Tigeot 		int (*get_cdclk_freq)(struct device *);
46*352ff8bdSFrançois Tigeot 		/**
47*352ff8bdSFrançois Tigeot 		 * @sync_audio_rate: set n/cts based on the sample rate
48*352ff8bdSFrançois Tigeot 		 *
49*352ff8bdSFrançois Tigeot 		 * Called from audio driver. After audio driver sets the
50*352ff8bdSFrançois Tigeot 		 * sample rate, it will call this function to set n/cts
51*352ff8bdSFrançois Tigeot 		 */
52*352ff8bdSFrançois Tigeot 		int (*sync_audio_rate)(struct device *, int port, int rate);
532c9916cdSFrançois Tigeot 	} *ops;
54a05eeebfSFrançois Tigeot 
55a05eeebfSFrançois Tigeot 	const struct i915_audio_component_audio_ops {
56a05eeebfSFrançois Tigeot 		void *audio_ptr;
57a05eeebfSFrançois Tigeot 		/**
58a05eeebfSFrançois Tigeot 		 * Call from i915 driver, notifying the HDA driver that
59a05eeebfSFrançois Tigeot 		 * pin sense and/or ELD information has changed.
60a05eeebfSFrançois Tigeot 		 * @audio_ptr:		HDA driver object
61a05eeebfSFrançois Tigeot 		 * @port:		Which port has changed (PORTA / PORTB / PORTC etc)
62a05eeebfSFrançois Tigeot 		 */
63a05eeebfSFrançois Tigeot 		void (*pin_eld_notify)(void *audio_ptr, int port);
64a05eeebfSFrançois Tigeot 	} *audio_ops;
652c9916cdSFrançois Tigeot };
662c9916cdSFrançois Tigeot 
672c9916cdSFrançois Tigeot #endif /* _I915_COMPONENT_H_ */
68