mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
phy: rockchip: fix build warning
Change-Id: Ibc3998b3b624e51463dd5e0746839bbd31cb0158 Signed-off-by: Cai YiWei <cyw@rock-chips.com>
This commit is contained in:
@@ -681,7 +681,7 @@ static int csi2_dphy_hw_stream_on(struct csi2_dphy *dphy,
|
||||
struct v4l2_subdev *sd)
|
||||
{
|
||||
struct v4l2_subdev *sensor_sd = get_remote_sensor(sd);
|
||||
struct csi2_sensor *sensor = sd_to_sensor(dphy, sensor_sd);
|
||||
struct csi2_sensor *sensor;
|
||||
struct csi2_dphy_hw *hw = dphy->dphy_hw;
|
||||
const struct dphy_hw_drv_data *drv_data = hw->drv_data;
|
||||
const struct hsfreq_range *hsfreq_ranges = drv_data->hsfreq_ranges;
|
||||
@@ -690,6 +690,12 @@ static int csi2_dphy_hw_stream_on(struct csi2_dphy *dphy,
|
||||
u32 val = 0, pre_val;
|
||||
u8 lvds_width = 0;
|
||||
|
||||
if (!sensor_sd)
|
||||
return -ENODEV;
|
||||
sensor = sd_to_sensor(dphy, sensor_sd);
|
||||
if (!sensor)
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&hw->mutex);
|
||||
|
||||
/* set data lane num and enable clock lane */
|
||||
|
||||
@@ -74,6 +74,9 @@ static int csi2_dphy_get_sensor_data_rate(struct v4l2_subdev *sd)
|
||||
struct v4l2_querymenu qm = { .id = V4L2_CID_LINK_FREQ, };
|
||||
int ret;
|
||||
|
||||
if (!sensor_sd)
|
||||
return -ENODEV;
|
||||
|
||||
link_freq = v4l2_ctrl_find(sensor_sd->ctrl_handler, V4L2_CID_LINK_FREQ);
|
||||
if (!link_freq) {
|
||||
v4l2_warn(sd, "No pixel rate control in subdev\n");
|
||||
@@ -102,11 +105,17 @@ static int csi2_dphy_update_sensor_mbus(struct v4l2_subdev *sd)
|
||||
{
|
||||
struct csi2_dphy *dphy = to_csi2_dphy(sd);
|
||||
struct v4l2_subdev *sensor_sd = get_remote_sensor(sd);
|
||||
struct csi2_sensor *sensor = sd_to_sensor(dphy, sensor_sd);
|
||||
struct csi2_sensor *sensor;
|
||||
struct v4l2_mbus_config mbus;
|
||||
struct rkmodule_bus_config bus_config;
|
||||
int ret;
|
||||
|
||||
if (!sensor_sd)
|
||||
return -ENODEV;
|
||||
sensor = sd_to_sensor(dphy, sensor_sd);
|
||||
if (!sensor)
|
||||
return -ENODEV;
|
||||
|
||||
ret = v4l2_subdev_call(sensor_sd, pad, get_mbus_config, 0, &mbus);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -280,6 +289,8 @@ static int csi2_dphy_g_mbus_config(struct v4l2_subdev *sd,
|
||||
if (!sensor_sd)
|
||||
return -ENODEV;
|
||||
sensor = sd_to_sensor(dphy, sensor_sd);
|
||||
if (!sensor)
|
||||
return -ENODEV;
|
||||
csi2_dphy_update_sensor_mbus(sd);
|
||||
*config = sensor->mbus;
|
||||
|
||||
@@ -347,7 +358,7 @@ static int csi2_dphy_get_set_fmt(struct v4l2_subdev *sd,
|
||||
{
|
||||
struct csi2_dphy *dphy = to_csi2_dphy(sd);
|
||||
struct v4l2_subdev *sensor_sd = get_remote_sensor(sd);
|
||||
struct csi2_sensor *sensor = sd_to_sensor(dphy, sensor_sd);
|
||||
struct csi2_sensor *sensor;
|
||||
int ret;
|
||||
/*
|
||||
* Do not allow format changes and just relay whatever
|
||||
@@ -355,6 +366,9 @@ static int csi2_dphy_get_set_fmt(struct v4l2_subdev *sd,
|
||||
*/
|
||||
if (!sensor_sd)
|
||||
return -ENODEV;
|
||||
sensor = sd_to_sensor(dphy, sensor_sd);
|
||||
if (!sensor)
|
||||
return -ENODEV;
|
||||
ret = v4l2_subdev_call(sensor_sd, pad, get_fmt, NULL, fmt);
|
||||
if (!ret && fmt->pad == 0 && fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE)
|
||||
sensor->format = fmt->format;
|
||||
@@ -454,7 +468,8 @@ rockchip_csi2_dphy_notifier_unbind(struct v4l2_async_notifier *notifier,
|
||||
notifier);
|
||||
struct csi2_sensor *sensor = sd_to_sensor(dphy, sd);
|
||||
|
||||
sensor->sd = NULL;
|
||||
if (sensor)
|
||||
sensor->sd = NULL;
|
||||
}
|
||||
|
||||
static const struct
|
||||
|
||||
@@ -750,6 +750,9 @@ static int mipidphy_get_sensor_data_rate(struct v4l2_subdev *sd)
|
||||
struct v4l2_querymenu qm = { .id = V4L2_CID_LINK_FREQ, };
|
||||
int ret;
|
||||
|
||||
if (!sensor_sd)
|
||||
return -ENODEV;
|
||||
|
||||
link_freq = v4l2_ctrl_find(sensor_sd->ctrl_handler, V4L2_CID_LINK_FREQ);
|
||||
if (!link_freq) {
|
||||
v4l2_warn(sd, "No pixel rate control in subdev\n");
|
||||
@@ -777,10 +780,15 @@ static int mipidphy_update_sensor_mbus(struct v4l2_subdev *sd)
|
||||
{
|
||||
struct mipidphy_priv *priv = to_dphy_priv(sd);
|
||||
struct v4l2_subdev *sensor_sd = get_remote_sensor(sd);
|
||||
struct mipidphy_sensor *sensor = sd_to_sensor(priv, sensor_sd);
|
||||
struct mipidphy_sensor *sensor;
|
||||
struct v4l2_mbus_config mbus;
|
||||
int ret;
|
||||
|
||||
if (!sensor_sd)
|
||||
return -ENODEV;
|
||||
sensor = sd_to_sensor(priv, sensor_sd);
|
||||
if (!sensor)
|
||||
return -ENODEV;
|
||||
ret = v4l2_subdev_call(sensor_sd, pad, get_mbus_config, 0, &mbus);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -909,6 +917,8 @@ static int mipidphy_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id,
|
||||
if (!sensor_sd)
|
||||
return -ENODEV;
|
||||
sensor = sd_to_sensor(priv, sensor_sd);
|
||||
if (!sensor)
|
||||
return -ENODEV;
|
||||
mipidphy_update_sensor_mbus(sd);
|
||||
*config = sensor->mbus;
|
||||
|
||||
@@ -970,7 +980,7 @@ static int mipidphy_get_set_fmt(struct v4l2_subdev *sd,
|
||||
{
|
||||
struct mipidphy_priv *priv = to_dphy_priv(sd);
|
||||
struct v4l2_subdev *sensor_sd = get_remote_sensor(sd);
|
||||
struct mipidphy_sensor *sensor = sd_to_sensor(priv, sensor_sd);
|
||||
struct mipidphy_sensor *sensor;
|
||||
int ret;
|
||||
/*
|
||||
* Do not allow format changes and just relay whatever
|
||||
@@ -978,6 +988,9 @@ static int mipidphy_get_set_fmt(struct v4l2_subdev *sd,
|
||||
*/
|
||||
if (!sensor_sd)
|
||||
return -ENODEV;
|
||||
sensor = sd_to_sensor(priv, sensor_sd);
|
||||
if (!sensor)
|
||||
return -ENODEV;
|
||||
ret = v4l2_subdev_call(sensor_sd, pad, get_fmt, NULL, fmt);
|
||||
if (!ret && fmt->pad == 0)
|
||||
sensor->format = fmt->format;
|
||||
@@ -1146,12 +1159,18 @@ static int mipidphy_rx_stream_on(struct mipidphy_priv *priv,
|
||||
struct v4l2_subdev *sd)
|
||||
{
|
||||
struct v4l2_subdev *sensor_sd = get_remote_sensor(sd);
|
||||
struct mipidphy_sensor *sensor = sd_to_sensor(priv, sensor_sd);
|
||||
struct mipidphy_sensor *sensor;
|
||||
const struct dphy_drv_data *drv_data = priv->drv_data;
|
||||
const struct hsfreq_range *hsfreq_ranges = drv_data->hsfreq_ranges;
|
||||
int num_hsfreq_ranges = drv_data->num_hsfreq_ranges;
|
||||
int i, hsfreq = 0;
|
||||
|
||||
if (!sensor_sd)
|
||||
return -ENODEV;
|
||||
sensor = sd_to_sensor(priv, sensor_sd);
|
||||
if (!sensor)
|
||||
return -ENODEV;
|
||||
|
||||
for (i = 0; i < num_hsfreq_ranges; i++) {
|
||||
if (hsfreq_ranges[i].range_h >= priv->data_rate_mbps) {
|
||||
hsfreq = hsfreq_ranges[i].cfg_bit;
|
||||
@@ -1237,12 +1256,18 @@ static int mipidphy_txrx_stream_on(struct mipidphy_priv *priv,
|
||||
struct v4l2_subdev *sd)
|
||||
{
|
||||
struct v4l2_subdev *sensor_sd = get_remote_sensor(sd);
|
||||
struct mipidphy_sensor *sensor = sd_to_sensor(priv, sensor_sd);
|
||||
struct mipidphy_sensor *sensor;
|
||||
const struct dphy_drv_data *drv_data = priv->drv_data;
|
||||
const struct hsfreq_range *hsfreq_ranges = drv_data->hsfreq_ranges;
|
||||
int num_hsfreq_ranges = drv_data->num_hsfreq_ranges;
|
||||
int i, hsfreq = 0;
|
||||
|
||||
if (!sensor_sd)
|
||||
return -ENODEV;
|
||||
sensor = sd_to_sensor(priv, sensor_sd);
|
||||
if (!sensor)
|
||||
return -ENODEV;
|
||||
|
||||
for (i = 0; i < num_hsfreq_ranges; i++) {
|
||||
if (hsfreq_ranges[i].range_h >= priv->data_rate_mbps) {
|
||||
hsfreq = hsfreq_ranges[i].cfg_bit;
|
||||
@@ -1356,7 +1381,7 @@ static int csi_mipidphy_stream_on(struct mipidphy_priv *priv,
|
||||
struct v4l2_subdev *sd)
|
||||
{
|
||||
struct v4l2_subdev *sensor_sd = get_remote_sensor(sd);
|
||||
struct mipidphy_sensor *sensor = sd_to_sensor(priv, sensor_sd);
|
||||
struct mipidphy_sensor *sensor;
|
||||
const struct dphy_drv_data *drv_data = priv->drv_data;
|
||||
const struct hsfreq_range *hsfreq_ranges = drv_data->hsfreq_ranges;
|
||||
int num_hsfreq_ranges = drv_data->num_hsfreq_ranges;
|
||||
@@ -1364,6 +1389,12 @@ static int csi_mipidphy_stream_on(struct mipidphy_priv *priv,
|
||||
u32 val = 0;
|
||||
u32 clk_mode = 0x03;
|
||||
|
||||
if (!sensor_sd)
|
||||
return -ENODEV;
|
||||
sensor = sd_to_sensor(priv, sensor_sd);
|
||||
if (!sensor)
|
||||
return -ENODEV;
|
||||
|
||||
write_grf_reg(priv, GRF_DVP_V18SEL, 0x1);
|
||||
|
||||
/* phy start */
|
||||
@@ -1652,7 +1683,8 @@ rockchip_mipidphy_notifier_unbind(struct v4l2_async_notifier *notifier,
|
||||
notifier);
|
||||
struct mipidphy_sensor *sensor = sd_to_sensor(priv, sd);
|
||||
|
||||
sensor->sd = NULL;
|
||||
if (sensor)
|
||||
sensor->sd = NULL;
|
||||
}
|
||||
|
||||
static const struct
|
||||
|
||||
@@ -2174,10 +2174,16 @@ static int samsung_dcphy_rx_stream_on(struct csi2_dphy *dphy,
|
||||
struct v4l2_subdev *sd)
|
||||
{
|
||||
struct v4l2_subdev *sensor_sd = get_remote_sensor(sd);
|
||||
struct csi2_sensor *sensor = sd_to_sensor(dphy, sensor_sd);
|
||||
struct csi2_sensor *sensor;
|
||||
struct samsung_mipi_dcphy *samsung = dphy->samsung_phy;
|
||||
int ret = 0;
|
||||
|
||||
if (!sensor_sd)
|
||||
return -ENODEV;
|
||||
sensor = sd_to_sensor(dphy, sensor_sd);
|
||||
if (!sensor)
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&samsung->mutex);
|
||||
if (sensor->mbus.type == V4L2_MBUS_CSI2_CPHY)
|
||||
regmap_write(samsung->grf_regmap, MIPI_DCPHY_GRF_CON0, S_CPHY_MODE);
|
||||
@@ -2216,7 +2222,13 @@ static int samsung_dcphy_rx_stream_off(struct csi2_dphy *dphy,
|
||||
{
|
||||
struct samsung_mipi_dcphy *samsung = dphy->samsung_phy;
|
||||
struct v4l2_subdev *sensor_sd = get_remote_sensor(sd);
|
||||
struct csi2_sensor *sensor = sd_to_sensor(dphy, sensor_sd);
|
||||
struct csi2_sensor *sensor;
|
||||
|
||||
if (!sensor_sd)
|
||||
return -ENODEV;
|
||||
sensor = sd_to_sensor(dphy, sensor_sd);
|
||||
if (!sensor)
|
||||
return -ENODEV;
|
||||
|
||||
if (atomic_dec_return(&samsung->stream_cnt))
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user