Home | History | Annotate | Line # | Download | only in radeon
      1  1.1  riastrad /*	$NetBSD: radeon_audio.h,v 1.3 2021/12/18 23:45:43 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad /*
      4  1.1  riastrad  * Copyright 2014 Advanced Micro Devices, Inc.
      5  1.1  riastrad  *
      6  1.1  riastrad  * Permission is hereby granted, free of charge, to any person obtaining a
      7  1.1  riastrad  * copy of this software and associated documentation files (the "Software"),
      8  1.1  riastrad  * to deal in the Software without restriction, including without limitation
      9  1.1  riastrad  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  1.1  riastrad  * and/or sell copies of the Software, and to permit persons to whom the
     11  1.1  riastrad  * Software is furnished to do so, subject to the following conditions:
     12  1.1  riastrad  *
     13  1.1  riastrad  * The above copyright notice and this permission notice shall be included in
     14  1.1  riastrad  * all copies or substantial portions of the Software.
     15  1.1  riastrad  *
     16  1.1  riastrad  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  1.1  riastrad  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  1.1  riastrad  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  1.1  riastrad  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  1.1  riastrad  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  1.1  riastrad  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  1.1  riastrad  * OTHER DEALINGS IN THE SOFTWARE.
     23  1.1  riastrad  *
     24  1.1  riastrad  * Authors: Slava Grigorev <slava.grigorev (at) amd.com>
     25  1.1  riastrad  */
     26  1.1  riastrad 
     27  1.1  riastrad #ifndef __RADEON_AUDIO_H__
     28  1.1  riastrad #define __RADEON_AUDIO_H__
     29  1.1  riastrad 
     30  1.1  riastrad #include <linux/types.h>
     31  1.1  riastrad 
     32  1.1  riastrad #define RREG32_ENDPOINT(block, reg)		\
     33  1.1  riastrad 	radeon_audio_endpoint_rreg(rdev, (block), (reg))
     34  1.1  riastrad #define WREG32_ENDPOINT(block, reg, v)	\
     35  1.1  riastrad 	radeon_audio_endpoint_wreg(rdev, (block), (reg), (v))
     36  1.1  riastrad 
     37  1.1  riastrad struct radeon_audio_basic_funcs
     38  1.1  riastrad {
     39  1.1  riastrad 	u32  (*endpoint_rreg)(struct radeon_device *rdev, u32 offset, u32 reg);
     40  1.1  riastrad 	void (*endpoint_wreg)(struct radeon_device *rdev,
     41  1.1  riastrad 		u32 offset, u32 reg, u32 v);
     42  1.1  riastrad 	void (*enable)(struct radeon_device *rdev,
     43  1.1  riastrad 		struct r600_audio_pin *pin, u8 enable_mask);
     44  1.1  riastrad };
     45  1.1  riastrad 
     46  1.1  riastrad struct radeon_audio_funcs
     47  1.1  riastrad {
     48  1.1  riastrad 	void (*select_pin)(struct drm_encoder *encoder);
     49  1.1  riastrad 	struct r600_audio_pin* (*get_pin)(struct radeon_device *rdev);
     50  1.1  riastrad 	void (*write_latency_fields)(struct drm_encoder *encoder,
     51  1.1  riastrad 		struct drm_connector *connector, struct drm_display_mode *mode);
     52  1.1  riastrad 	void (*write_sad_regs)(struct drm_encoder *encoder,
     53  1.1  riastrad 		struct cea_sad *sads, int sad_count);
     54  1.1  riastrad 	void (*write_speaker_allocation)(struct drm_encoder *encoder,
     55  1.1  riastrad 		u8 *sadb, int sad_count);
     56  1.1  riastrad 	void (*set_dto)(struct radeon_device *rdev,
     57  1.1  riastrad 		struct radeon_crtc *crtc, unsigned int clock);
     58  1.1  riastrad 	void (*update_acr)(struct drm_encoder *encoder, long offset,
     59  1.1  riastrad 		const struct radeon_hdmi_acr *acr);
     60  1.1  riastrad 	void (*set_vbi_packet)(struct drm_encoder *encoder, u32 offset);
     61  1.1  riastrad 	void (*set_color_depth)(struct drm_encoder *encoder, u32 offset, int bpc);
     62  1.1  riastrad 	void (*set_avi_packet)(struct radeon_device *rdev, u32 offset,
     63  1.1  riastrad 		unsigned char *buffer, size_t size);
     64  1.1  riastrad 	void (*set_audio_packet)(struct drm_encoder *encoder, u32 offset);
     65  1.1  riastrad 	void (*set_mute)(struct drm_encoder *encoder, u32 offset, bool mute);
     66  1.1  riastrad 	void (*mode_set)(struct drm_encoder *encoder,
     67  1.1  riastrad 		struct drm_display_mode *mode);
     68  1.1  riastrad 	void (*dpms)(struct drm_encoder *encoder, bool mode);
     69  1.1  riastrad };
     70  1.1  riastrad 
     71  1.1  riastrad int radeon_audio_init(struct radeon_device *rdev);
     72  1.1  riastrad void radeon_audio_detect(struct drm_connector *connector,
     73  1.1  riastrad 			 struct drm_encoder *encoder,
     74  1.1  riastrad 			 enum drm_connector_status status);
     75  1.1  riastrad u32 radeon_audio_endpoint_rreg(struct radeon_device *rdev,
     76  1.1  riastrad 	u32 offset, u32 reg);
     77  1.1  riastrad void radeon_audio_endpoint_wreg(struct radeon_device *rdev,
     78  1.1  riastrad 	u32 offset,	u32 reg, u32 v);
     79  1.1  riastrad struct r600_audio_pin *radeon_audio_get_pin(struct drm_encoder *encoder);
     80  1.1  riastrad void radeon_audio_fini(struct radeon_device *rdev);
     81  1.1  riastrad void radeon_audio_mode_set(struct drm_encoder *encoder,
     82  1.1  riastrad 	struct drm_display_mode *mode);
     83  1.1  riastrad void radeon_audio_dpms(struct drm_encoder *encoder, int mode);
     84  1.1  riastrad unsigned int radeon_audio_decode_dfs_div(unsigned int div);
     85  1.1  riastrad 
     86  1.1  riastrad #endif
     87