Commit fdf17f10 authored by Rodrigo Siqueira's avatar Rodrigo Siqueira Committed by Alex Deucher
Browse files

drm/amd/display: Add basic kernel doc to CRC code under DC

parent 60c93531
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -638,14 +638,17 @@ bool dc_stream_configure_crc(struct dc *dc, struct dc_stream_state *stream,

/**
 * dc_stream_get_crc() - Get CRC values for the given stream.
 * @dc: DC object
 *
 * @dc: DC object.
 * @stream: The DC stream state of the stream to get CRCs from.
 * @r_cr: CRC value for the first of the 3 channels stored here.
 * @g_y:  CRC value for the second of the 3 channels stored here.
 * @b_cb: CRC value for the third of the 3 channels stored here.
 * @r_cr: CRC value for the red component.
 * @g_y:  CRC value for the green component.
 * @b_cb: CRC value for the blue component.
 *
 * dc_stream_configure_crc needs to be called beforehand to enable CRCs.
 * Return false if stream is not found, or if CRCs are not enabled.
 *
 * Return:
 * false if stream is not found, or if CRCs are not enabled.
 */
bool dc_stream_get_crc(struct dc *dc, struct dc_stream_state *stream,
		       uint32_t *r_cr, uint32_t *g_y, uint32_t *b_cb)
+21 −4
Original line number Diff line number Diff line
@@ -1498,6 +1498,21 @@ bool optc1_configure_crc(struct timing_generator *optc,
	return true;
}

/**
 * optc1_get_crc - Capture CRC result per component
 *
 * @optc: timing_generator instance.
 * @r_cr: 16-bit primary CRC signature for red data.
 * @g_y: 16-bit primary CRC signature for green data.
 * @b_cb: 16-bit primary CRC signature for blue data.
 *
 * This function reads the CRC signature from the OPTC registers. Notice that
 * we have three registers to keep the CRC result per color component (RGB).
 *
 * Returns:
 * If CRC is disabled, return false; otherwise, return true, and the CRC
 * results in the parameters.
 */
bool optc1_get_crc(struct timing_generator *optc,
		   uint32_t *r_cr, uint32_t *g_y, uint32_t *b_cb)
{
@@ -1510,10 +1525,12 @@ bool optc1_get_crc(struct timing_generator *optc,
	if (!field)
		return false;

	/* OTG_CRC0_DATA_RG has the CRC16 results for the red and green component */
	REG_GET_2(OTG_CRC0_DATA_RG,
		  CRC0_R_CR, r_cr,
		  CRC0_G_Y, g_y);

	/* OTG_CRC0_DATA_B has the CRC16 results for the blue component */
	REG_GET(OTG_CRC0_DATA_B,
		CRC0_B_CB, b_cb);

+4 −0
Original line number Diff line number Diff line
@@ -399,6 +399,10 @@ struct pipe_ctx {
	struct dc_stream_state *stream;

	struct plane_resource plane_res;

	/**
	 * @stream_res: Reference to DCN resource components such OPP and DSC.
	 */
	struct stream_resource stream_res;
	struct link_resource link_res;

+11 −3
Original line number Diff line number Diff line
@@ -137,7 +137,13 @@ struct crc_params {
	bool enable;
};

/**
 * struct timing_generator - Entry point to Output Timing Generator feature.
 */
struct timing_generator {
	/**
	 * @funcs: Timing generator control functions
	 */
	const struct timing_generator_funcs *funcs;
	struct dc_bios *bp;
	struct dc_context *ctx;
@@ -148,7 +154,9 @@ struct dc_crtc_timing;

struct drr_params;


/**
 * struct timing_generator_funcs - Control timing generator on a given device.
 */
struct timing_generator_funcs {
	bool (*validate_timing)(struct timing_generator *tg,
							const struct dc_crtc_timing *timing);
@@ -273,8 +281,8 @@ struct timing_generator_funcs {
			       const struct crc_params *params);

	/**
	 * Get CRCs for the given timing generator. Return false if CRCs are
	 * not enabled (via configure_crc).
	 * @get_crc: Get CRCs for the given timing generator. Return false if
	 * CRCs are not enabled (via configure_crc).
	 */
	bool (*get_crc)(struct timing_generator *tg,
			uint32_t *r_cr, uint32_t *g_y, uint32_t *b_cb);