Subversion Repositories Kolibri OS

Rev

Rev 3764 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3764 Rev 5078
Line 55... Line 55...
55
/*
55
/*
56
 * check if the chipset is supported
56
 * check if the chipset is supported
57
 */
57
 */
58
static int r600_audio_chipset_supported(struct radeon_device *rdev)
58
static int r600_audio_chipset_supported(struct radeon_device *rdev)
59
{
59
{
60
	return ASIC_IS_DCE2(rdev) && !ASIC_IS_DCE6(rdev);
60
	return ASIC_IS_DCE2(rdev) && !ASIC_IS_NODCE(rdev);
61
}
61
}
Line 62... Line 62...
62
 
62
 
63
struct r600_audio r600_audio_status(struct radeon_device *rdev)
63
struct r600_audio_pin r600_audio_status(struct radeon_device *rdev)
64
{
64
{
65
	struct r600_audio status;
65
	struct r600_audio_pin status;
Line 66... Line 66...
66
	uint32_t value;
66
	uint32_t value;
Line 67... Line 67...
67
 
67
 
Line 118... Line 118...
118
void r600_audio_update_hdmi(struct work_struct *work)
118
void r600_audio_update_hdmi(struct work_struct *work)
119
{
119
{
120
	struct radeon_device *rdev = container_of(work, struct radeon_device,
120
	struct radeon_device *rdev = container_of(work, struct radeon_device,
121
						  audio_work);
121
						  audio_work);
122
	struct drm_device *dev = rdev->ddev;
122
	struct drm_device *dev = rdev->ddev;
123
	struct r600_audio audio_status = r600_audio_status(rdev);
123
	struct r600_audio_pin audio_status = r600_audio_status(rdev);
124
	struct drm_encoder *encoder;
124
	struct drm_encoder *encoder;
125
	bool changed = false;
125
	bool changed = false;
Line 126... Line 126...
126
 
126
 
127
	if (rdev->audio_status.channels != audio_status.channels ||
127
	if (rdev->audio.pin[0].channels != audio_status.channels ||
128
	    rdev->audio_status.rate != audio_status.rate ||
128
	    rdev->audio.pin[0].rate != audio_status.rate ||
129
	    rdev->audio_status.bits_per_sample != audio_status.bits_per_sample ||
129
	    rdev->audio.pin[0].bits_per_sample != audio_status.bits_per_sample ||
130
	    rdev->audio_status.status_bits != audio_status.status_bits ||
130
	    rdev->audio.pin[0].status_bits != audio_status.status_bits ||
131
	    rdev->audio_status.category_code != audio_status.category_code) {
131
	    rdev->audio.pin[0].category_code != audio_status.category_code) {
132
		rdev->audio_status = audio_status;
132
		rdev->audio.pin[0] = audio_status;
133
		changed = true;
133
		changed = true;
Line 134... Line 134...
134
	}
134
	}
135
 
135
 
Line 139... Line 139...
139
		if (changed || r600_hdmi_buffer_status_changed(encoder))
139
		if (changed || r600_hdmi_buffer_status_changed(encoder))
140
			r600_hdmi_update_audio_settings(encoder);
140
			r600_hdmi_update_audio_settings(encoder);
141
	}
141
	}
142
}
142
}
Line 143... Line -...
143
 
-
 
144
/*
143
 
145
 * turn on/off audio engine
-
 
146
 */
144
/* enable the audio stream */
-
 
145
void r600_audio_enable(struct radeon_device *rdev,
-
 
146
			      struct r600_audio_pin *pin,
147
static void r600_audio_engine_enable(struct radeon_device *rdev, bool enable)
147
			      bool enable)
148
{
148
{
-
 
149
	u32 value = 0;
149
	u32 value = 0;
150
 
-
 
151
	if (!pin)
-
 
152
		return;
150
	DRM_INFO("%s audio support\n", enable ? "Enabling" : "Disabling");
153
 
151
	if (ASIC_IS_DCE4(rdev)) {
154
	if (ASIC_IS_DCE4(rdev)) {
152
		if (enable) {
155
		if (enable) {
153
			value |= 0x81000000; /* Required to enable audio */
156
			value |= 0x81000000; /* Required to enable audio */
154
			value |= 0x0e1000f0; /* fglrx sets that too */
157
			value |= 0x0e1000f0; /* fglrx sets that too */
155
		}
158
		}
156
		WREG32(EVERGREEN_AUDIO_ENABLE, value);
159
		WREG32(EVERGREEN_AUDIO_ENABLE, value);
157
	} else {
160
	} else {
158
		WREG32_P(R600_AUDIO_ENABLE,
161
		WREG32_P(R600_AUDIO_ENABLE,
159
			 enable ? 0x81000000 : 0x0, ~0x81000000);
162
			 enable ? 0x81000000 : 0x0, ~0x81000000);
160
	}
-
 
161
	rdev->audio_enabled = enable;
163
	}
Line 162... Line 164...
162
}
164
}
163
 
165
 
164
/*
166
/*
165
 * initialize the audio vars
167
 * initialize the audio vars
166
 */
168
 */
167
int r600_audio_init(struct radeon_device *rdev)
169
int r600_audio_init(struct radeon_device *rdev)
168
{
170
{
Line 169... Line 171...
169
	if (!radeon_audio || !r600_audio_chipset_supported(rdev))
171
	if (!radeon_audio || !r600_audio_chipset_supported(rdev))
Line -... Line 172...
-
 
172
		return 0;
170
		return 0;
173
 
171
 
174
	rdev->audio.enabled = true;
172
	r600_audio_engine_enable(rdev, true);
175
 
173
 
176
	rdev->audio.num_pins = 1;
174
	rdev->audio_status.channels = -1;
177
	rdev->audio.pin[0].channels = -1;
-
 
178
	rdev->audio.pin[0].rate = -1;
-
 
179
	rdev->audio.pin[0].bits_per_sample = -1;
-
 
180
	rdev->audio.pin[0].status_bits = 0;
Line 175... Line 181...
175
	rdev->audio_status.rate = -1;
181
	rdev->audio.pin[0].category_code = 0;
176
	rdev->audio_status.bits_per_sample = -1;
182
	rdev->audio.pin[0].id = 0;
Line 177... Line 183...
177
	rdev->audio_status.status_bits = 0;
183
	/* disable audio.  it will be set up later */
178
	rdev->audio_status.category_code = 0;
184
	r600_audio_enable(rdev, &rdev->audio.pin[0], false);
179
 
185
 
180
	return 0;
186
	return 0;
181
}
187
}
182
 
188
 
183
/*
189
/*
184
 * release the audio timer
190
 * release the audio timer
Line 185... Line 191...
185
 * TODO: How to do this correctly on SMP systems?
191
 * TODO: How to do this correctly on SMP systems?
-
 
192
 */
-
 
193
void r600_audio_fini(struct radeon_device *rdev)
-
 
194
{
-
 
195
	if (!rdev->audio.enabled)
-
 
196
		return;
-
 
197
 
-
 
198
	r600_audio_enable(rdev, &rdev->audio.pin[0], false);
-
 
199
 
186
 */
200
	rdev->audio.enabled = false;