Merge commit '6e85806bc9b570448a51a4bb11ad0338c7ad2765'

* commit '6e85806bc9b570448a51a4bb11ad0338c7ad2765':
  media: i2c: lt6911uxc: create hdmirx_class devices
  media: i2c: rk628: add hdmirx device attribute
  media: rockchip: hdmirx: do not create hdmirx_class

Change-Id: I6f08bb23e8ed527d1fbedf89256e1aaad1d2c8c0
This commit is contained in:
Tao Huang
2023-09-26 19:58:53 +08:00
5 changed files with 82 additions and 6 deletions

View File

@@ -2389,6 +2389,7 @@ config VIDEO_LT6911UXC
select MEDIA_CONTROLLER
select VIDEO_V4L2_SUBDEV_API
select V4L2_FWNODE
select VIDEO_ROCKCHIP_HDMIRX_CLASS
help
Support for the Lontium LT6911UXC series HDMI to MIPI CSI-2 bridge.

View File

@@ -18,6 +18,7 @@
#include <linux/module.h>
#include <linux/of_graph.h>
#include <linux/rk-camera-module.h>
#include <linux/rk_hdmirx_class.h>
#include <linux/slab.h>
#include <linux/timer.h>
#include <linux/v4l2-dv-timings.h>
@@ -89,6 +90,7 @@ struct lt6911uxc {
u32 module_index;
u32 csi_lanes_in_use;
u32 audio_sampling_rate;
struct device *classdev;
};
struct lt6911uxc_mode {
@@ -1261,6 +1263,34 @@ static inline int lt6911uxc_parse_of(struct lt6911uxc *lt6911uxc)
}
#endif
static ssize_t audio_rate_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct lt6911uxc *lt6911uxc = dev_get_drvdata(dev);
return snprintf(buf, PAGE_SIZE, "%d", lt6911uxc->audio_sampling_rate);
}
static ssize_t audio_present_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct lt6911uxc *lt6911uxc = dev_get_drvdata(dev);
return snprintf(buf, PAGE_SIZE, "%d",
tx_5v_power_present(&lt6911uxc->sd) ?
lt6911uxc->is_audio_present : 0);
}
static DEVICE_ATTR_RO(audio_rate);
static DEVICE_ATTR_RO(audio_present);
static struct attribute *lt6911_attrs[] = {
&dev_attr_audio_rate.attr,
&dev_attr_audio_present.attr,
NULL
};
ATTRIBUTE_GROUPS(lt6911);
static int lt6911uxc_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
@@ -1337,6 +1367,14 @@ static int lt6911uxc_probe(struct i2c_client *client,
goto err_clean_entity;
}
lt6911uxc->classdev = device_create_with_groups(rk_hdmirx_class(),
dev, MKDEV(0, 0),
lt6911uxc,
lt6911_groups,
"lt6911");
if (IS_ERR(lt6911uxc->classdev))
goto err_clean_entity;
INIT_DELAYED_WORK(&lt6911uxc->delayed_work_enable_hotplug,
lt6911uxc_delayed_work_enable_hotplug);
INIT_DELAYED_WORK(&lt6911uxc->delayed_work_res_change,

View File

@@ -14,6 +14,7 @@ config VIDEO_RK628_CSI
select V4L2_FWNODE
select VIDEO_V4L2_SUBDEV_API
select VIDEO_RK628
select VIDEO_ROCKCHIP_HDMIRX_CLASS
help
Support for the Rockchip RK628 HDMI to MIPI CSI-2 bridge.

View File

@@ -26,6 +26,7 @@
#include <linux/version.h>
#include <linux/videodev2.h>
#include <linux/workqueue.h>
#include <linux/rk_hdmirx_class.h>
#include <media/v4l2-controls_rockchip.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
@@ -132,6 +133,7 @@ struct rk628_csi {
struct rk628_combtxphy *txphy;
struct rk628_dsi dsi;
const struct rk628_plat_data *plat_data;
struct device *classdev;
};
struct rk628_csi_mode {
@@ -2095,6 +2097,36 @@ static const struct of_device_id rk628_csi_of_match[] = {
};
MODULE_DEVICE_TABLE(of, rk628_csi_of_match);
static bool tx_5v_power_present(struct v4l2_subdev *sd);
static ssize_t audio_rate_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct rk628_csi *csi = dev_get_drvdata(dev);
return snprintf(buf, PAGE_SIZE, "%d", rk628_hdmirx_audio_fs(csi->audio_info));
}
static ssize_t audio_present_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct rk628_csi *csi = dev_get_drvdata(dev);
return snprintf(buf, PAGE_SIZE, "%d",
tx_5v_power_present(&csi->sd) ?
rk628_hdmirx_audio_present(csi->audio_info) : 0);
}
static DEVICE_ATTR_RO(audio_rate);
static DEVICE_ATTR_RO(audio_present);
static struct attribute *rk628_attrs[] = {
&dev_attr_audio_rate.attr,
&dev_attr_audio_present.attr,
NULL
};
ATTRIBUTE_GROUPS(rk628);
static int rk628_csi_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
@@ -2239,6 +2271,14 @@ static int rk628_csi_probe(struct i2c_client *client,
goto err_hdl;
}
csi->classdev = device_create_with_groups(rk_hdmirx_class(),
dev, MKDEV(0, 0),
csi,
rk628_groups,
"rk628");
if (IS_ERR(csi->classdev))
goto err_hdl;
INIT_DELAYED_WORK(&csi->delayed_work_enable_hotplug,
rk628_csi_delayed_work_enable_hotplug);
INIT_DELAYED_WORK(&csi->delayed_work_res_change,

View File

@@ -45,11 +45,11 @@
#include <media/videobuf2-v4l2.h>
#include <soc/rockchip/rockchip-system-status.h>
#include <sound/hdmi-codec.h>
#include <linux/rk_hdmirx_class.h>
#include "rk_hdmirx.h"
#include "rk_hdmirx_cec.h"
#include "rk_hdmirx_hdcp.h"
static struct class *hdmirx_class;
static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "debug level (0-3)");
@@ -4297,7 +4297,7 @@ static int hdmirx_probe(struct platform_device *pdev)
if (ret)
goto err_unreg_video_dev;
hdmirx_dev->classdev = device_create_with_groups(hdmirx_class,
hdmirx_dev->classdev = device_create_with_groups(rk_hdmirx_class(),
dev, MKDEV(0, 0),
hdmirx_dev,
hdmirx_groups,
@@ -4455,9 +4455,6 @@ static struct platform_driver hdmirx_driver = {
static int __init hdmirx_init(void)
{
hdmirx_class = class_create(THIS_MODULE, "hdmirx");
if (IS_ERR(hdmirx_class))
return PTR_ERR(hdmirx_class);
return platform_driver_register(&hdmirx_driver);
}
module_init(hdmirx_init);
@@ -4465,7 +4462,6 @@ module_init(hdmirx_init);
static void __exit hdmirx_exit(void)
{
platform_driver_unregister(&hdmirx_driver);
class_destroy(hdmirx_class);
}
module_exit(hdmirx_exit);