Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: ccs: Implement support for manual LP control

Use the pre_streamon callback to transition the transmitter to either
LP-11 or LP-111 mode if supported by the sensor.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Sakari Ailus and committed by
Mauro Carvalho Chehab
41a95d04 253171a0

+47
+47
drivers/media/i2c/ccs/ccs-core.c
··· 1943 1943 return rval; 1944 1944 } 1945 1945 1946 + static int ccs_pre_streamon(struct v4l2_subdev *subdev, u32 flags) 1947 + { 1948 + struct ccs_sensor *sensor = to_ccs_sensor(subdev); 1949 + struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); 1950 + int rval; 1951 + 1952 + if (flags & V4L2_SUBDEV_PRE_STREAMON_FL_MANUAL_LP) { 1953 + switch (sensor->hwcfg.csi_signalling_mode) { 1954 + case CCS_CSI_SIGNALING_MODE_CSI_2_DPHY: 1955 + if (!(CCS_LIM(sensor, PHY_CTRL_CAPABILITY_2) & 1956 + CCS_PHY_CTRL_CAPABILITY_2_MANUAL_LP_DPHY)) 1957 + return -EACCES; 1958 + break; 1959 + case CCS_CSI_SIGNALING_MODE_CSI_2_CPHY: 1960 + if (!(CCS_LIM(sensor, PHY_CTRL_CAPABILITY_2) & 1961 + CCS_PHY_CTRL_CAPABILITY_2_MANUAL_LP_CPHY)) 1962 + return -EACCES; 1963 + break; 1964 + default: 1965 + return -EACCES; 1966 + } 1967 + } 1968 + 1969 + rval = ccs_pm_get_init(sensor); 1970 + if (rval) 1971 + return rval; 1972 + 1973 + if (flags & V4L2_SUBDEV_PRE_STREAMON_FL_MANUAL_LP) { 1974 + rval = ccs_write(sensor, MANUAL_LP_CTRL, 1975 + CCS_MANUAL_LP_CTRL_ENABLE); 1976 + if (rval) 1977 + pm_runtime_put(&client->dev); 1978 + } 1979 + 1980 + return rval; 1981 + } 1982 + 1983 + static int ccs_post_streamoff(struct v4l2_subdev *subdev) 1984 + { 1985 + struct ccs_sensor *sensor = to_ccs_sensor(subdev); 1986 + struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); 1987 + 1988 + return pm_runtime_put(&client->dev); 1989 + } 1990 + 1946 1991 static int ccs_enum_mbus_code(struct v4l2_subdev *subdev, 1947 1992 struct v4l2_subdev_state *sd_state, 1948 1993 struct v4l2_subdev_mbus_code_enum *code) ··· 3100 3055 3101 3056 static const struct v4l2_subdev_video_ops ccs_video_ops = { 3102 3057 .s_stream = ccs_set_stream, 3058 + .pre_streamon = ccs_pre_streamon, 3059 + .post_streamoff = ccs_post_streamoff, 3103 3060 }; 3104 3061 3105 3062 static const struct v4l2_subdev_pad_ops ccs_pad_ops = {