Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3eab2a4f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cec: add cec_s_phys_addr_from_edid helper function"

parents 7bdd5980 e5a66cf5
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -294,6 +294,14 @@ then the CEC adapter will be disabled. If you change a valid physical address
to another valid physical address, then this function will first set the
address to CEC_PHYS_ADDR_INVALID before enabling the new physical address.

.. c:function::
	void cec_s_phys_addr_from_edid(struct cec_adapter *adap,
				       const struct edid *edid);

A helper function that extracts the physical address from the edid struct
and calls cec_s_phys_addr() with that address, or CEC_PHYS_ADDR_INVALID
if the EDID did not contain a physical address or edid was a NULL pointer.

.. c:function::
	int cec_s_log_addrs(struct cec_adapter *adap,
			    struct cec_log_addrs *log_addrs, bool block);
+14 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@
#include <linux/string.h>
#include <linux/types.h>

#include <drm/drm_edid.h>

#include "cec-priv.h"

static int cec_report_features(struct cec_adapter *adap, unsigned int la_idx);
@@ -1169,6 +1171,18 @@ void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block)
}
EXPORT_SYMBOL_GPL(cec_s_phys_addr);

void cec_s_phys_addr_from_edid(struct cec_adapter *adap,
			       const struct edid *edid)
{
	u16 pa = CEC_PHYS_ADDR_INVALID;

	if (edid && edid->extensions)
		pa = cec_get_edid_phys_addr((const u8 *)edid,
				EDID_LENGTH * (edid->extensions + 1), NULL);
	cec_s_phys_addr(adap, pa, false);
}
EXPORT_SYMBOL_GPL(cec_s_phys_addr_from_edid);

/*
 * Called from either the ioctl or a driver to set the logical addresses.
 *
+9 −0
Original line number Diff line number Diff line
@@ -201,6 +201,8 @@ static inline bool cec_is_sink(const struct cec_adapter *adap)
	return adap->phys_addr == 0;
}

struct edid;

#if IS_ENABLED(CONFIG_MEDIA_CEC)
struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
		void *priv, const char *name, u32 caps, u8 available_las,
@@ -213,6 +215,8 @@ int cec_s_log_addrs(struct cec_adapter *adap, struct cec_log_addrs *log_addrs,
		    bool block);
void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr,
		     bool block);
void cec_s_phys_addr_from_edid(struct cec_adapter *adap,
			       const struct edid *edid);
int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg,
		     bool block);

@@ -241,6 +245,11 @@ static inline void cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr,
{
}

static inline void cec_s_phys_addr_from_edid(struct cec_adapter *adap,
					     const struct edid *edid)
{
}

#endif

#endif /* _MEDIA_CEC_H */