mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
media: rockchip: hdmirx: Add extcon support
Signed-off-by: Shunhua Lan <lsh@rock-chips.com> Change-Id: Ia19b8f7230af515b8dbc7bb953d03e8e5dbb1f7a
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/interrupt.h>
|
||||
@@ -195,6 +196,7 @@ struct rk_hdmirx_dev {
|
||||
struct dentry *debugfs_dir;
|
||||
struct freq_qos_request min_sta_freq_req;
|
||||
struct hdmirx_audiostate audio_state;
|
||||
struct extcon_dev *extcon;
|
||||
struct hdmirx_cec *cec;
|
||||
struct mutex stream_lock;
|
||||
struct mutex work_lock;
|
||||
@@ -245,6 +247,11 @@ struct rk_hdmirx_dev {
|
||||
spinlock_t rst_lock;
|
||||
};
|
||||
|
||||
static const unsigned int hdmirx_extcon_cable[] = {
|
||||
EXTCON_JACK_VIDEO_IN,
|
||||
EXTCON_NONE,
|
||||
};
|
||||
|
||||
static bool tx_5v_power_present(struct rk_hdmirx_dev *hdmirx_dev);
|
||||
static void hdmirx_set_fmt(struct hdmirx_stream *stream,
|
||||
struct v4l2_pix_format_mplane *pixm, bool try);
|
||||
@@ -2672,12 +2679,14 @@ static void hdmirx_plugin(struct rk_hdmirx_dev *hdmirx_dev)
|
||||
}
|
||||
hdmirx_dma_config(hdmirx_dev);
|
||||
hdmirx_interrupts_setup(hdmirx_dev, true);
|
||||
extcon_set_state_sync(hdmirx_dev->extcon, EXTCON_JACK_VIDEO_IN, true);
|
||||
hdmirx_audio_handle_plugged_change(hdmirx_dev, 1);
|
||||
}
|
||||
|
||||
static void hdmirx_plugout(struct rk_hdmirx_dev *hdmirx_dev)
|
||||
{
|
||||
hdmirx_audio_handle_plugged_change(hdmirx_dev, 0);
|
||||
extcon_set_state_sync(hdmirx_dev->extcon, EXTCON_JACK_VIDEO_IN, false);
|
||||
hdmirx_update_bits(hdmirx_dev, SCDC_CONFIG, POWERPROVIDED, 0);
|
||||
hdmirx_interrupts_setup(hdmirx_dev, false);
|
||||
hdmirx_hpd_ctrl(hdmirx_dev, false);
|
||||
@@ -4102,6 +4111,19 @@ static int hdmirx_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
goto err_unreg_video_dev;
|
||||
|
||||
hdmirx_dev->extcon = devm_extcon_dev_allocate(dev, hdmirx_extcon_cable);
|
||||
if (IS_ERR(hdmirx_dev->extcon)) {
|
||||
ret = PTR_ERR(hdmirx_dev->extcon);
|
||||
dev_err(&pdev->dev, "allocate extcon failed\n");
|
||||
goto err_unreg_video_dev;
|
||||
}
|
||||
|
||||
ret = devm_extcon_dev_register(dev, hdmirx_dev->extcon);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "failed to register extcon: %d\n", ret);
|
||||
goto err_unreg_video_dev;
|
||||
}
|
||||
|
||||
irq = gpiod_to_irq(hdmirx_dev->hdmirx_det_gpio);
|
||||
if (irq < 0) {
|
||||
dev_err(dev, "failed to get hdmirx-det gpio irq\n");
|
||||
|
||||
Reference in New Issue
Block a user