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