3535#define MIRA220_PIXEL_ARRAY_WIDTH 1600U
3636#define MIRA220_PIXEL_ARRAY_HEIGHT 1400U
3737
38+ /* mira220 does not support analog gain. */
3839#define MIRA220_ANALOG_GAIN_MIN 1
39- #define MIRA220_ANALOG_GAIN_MAX \
40- 1 /* Fixed analog gain to 1, to avoid unexpected behavior. */
40+ #define MIRA220_ANALOG_GAIN_MAX 1
4141#define MIRA220_ANALOG_GAIN_STEP 1
4242#define MIRA220_ANALOG_GAIN_DEFAULT MIRA220_ANALOG_GAIN_MIN
4343
9595#define MIRA220_XCLR_MIN_DELAY_US 100000
9696#define MIRA220_XCLR_DELAY_RANGE_US 30
9797
98- // Outdated. See below.
99- // pixel_rate = link_freq * 2 * nr_of_lanes / bits_per_sample
100- // 1.0Gb/s * 2 * 2 / 12 = 357913941
101- // #define MIRA220_PIXEL_RATE (357913941)
102-
10398// Mira220 PIXEL_RATE is derived from ROW_LENGTH. See datasheet Section 9.2.
10499// ROW_LENGTH is set by registers: 0x102B, 0x102C. Unit is number of CLK_IN cycles.
105100// PIXEL_RATE = 1000000000 * WIDTH / (ROW_LENGTH * CLK_IN_PERIOD_NS)
146141#define MIRA220_TEST_PATTERN_DISABLE 0x00
147142#define MIRA220_TEST_PATTERN_VERTICAL_GRADIENT 0x01
148143
149- /* Embedded metadata stream structure */
150- #define MIRA220_EMBEDDED_LINE_WIDTH 16384
151- #define MIRA220_NUM_EMBEDDED_LINES 1
152-
153144/* From Jetson driver */
154145#define MIRA220_DEFAULT_LINE_LENGTH (0xA80)
155146#define MIRA220_DEFAULT_PIXEL_CLOCK (160)
156147#define MIRA220_DEFAULT_FRAME_LENGTH (0x07C0) //TODO REMOVE THESE
157148
158- enum pad_types { IMAGE_PAD , METADATA_PAD , NUM_PADS };
149+ enum pad_types { IMAGE_PAD , NUM_PADS };
159150
160151struct mira220_reg {
161152 u16 address ;
@@ -1369,8 +1360,6 @@ static int mira220_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
13691360 struct mira220 * mira220 = to_mira220 (sd );
13701361 struct v4l2_mbus_framefmt * try_fmt_img =
13711362 v4l2_subdev_state_get_format (fh -> state , IMAGE_PAD );
1372- struct v4l2_mbus_framefmt * try_fmt_meta =
1373- v4l2_subdev_state_get_format (fh -> state , METADATA_PAD );
13741363 struct v4l2_rect * try_crop ;
13751364
13761365 mutex_lock (& mira220 -> mutex );
@@ -1382,12 +1371,6 @@ static int mira220_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
13821371 mira220 , supported_modes [0 ].code );
13831372 try_fmt_img -> field = V4L2_FIELD_NONE ;
13841373
1385- /* TODO(jalv): Initialize try_fmt for the embedded metadata pad */
1386- try_fmt_meta -> width = MIRA220_EMBEDDED_LINE_WIDTH ;
1387- try_fmt_meta -> height = MIRA220_NUM_EMBEDDED_LINES ;
1388- try_fmt_meta -> code = MEDIA_BUS_FMT_SENSOR_DATA ;
1389- try_fmt_meta -> field = V4L2_FIELD_NONE ;
1390-
13911374 /* Initialize try_crop rectangle. */
13921375 try_crop = v4l2_subdev_state_get_crop (fh -> state , 0 );
13931376 try_crop -> top = supported_modes [0 ].crop .top ;
@@ -1527,15 +1510,7 @@ static int mira220_enum_frame_size(struct v4l2_subdev *sd,
15271510 fse -> max_width = fse -> min_width ;
15281511 fse -> min_height = supported_modes [fse -> index ].height ;
15291512 fse -> max_height = fse -> min_height ;
1530- } else {
1531- if (fse -> code != MEDIA_BUS_FMT_SENSOR_DATA || fse -> index > 0 )
1532- return - EINVAL ;
1533-
1534- fse -> min_width = MIRA220_EMBEDDED_LINE_WIDTH ;
1535- fse -> max_width = fse -> min_width ;
1536- fse -> min_height = MIRA220_NUM_EMBEDDED_LINES ;
1537- fse -> max_height = fse -> min_height ;
1538- }
1513+ }
15391514
15401515 return 0 ;
15411516}
@@ -1559,13 +1534,6 @@ static void mira220_update_image_pad_format(struct mira220 *mira220,
15591534 mira220_reset_colorspace (& fmt -> format );
15601535}
15611536
1562- static void mira220_update_metadata_pad_format (struct v4l2_subdev_format * fmt )
1563- {
1564- fmt -> format .width = MIRA220_EMBEDDED_LINE_WIDTH ;
1565- fmt -> format .height = MIRA220_NUM_EMBEDDED_LINES ;
1566- fmt -> format .code = MEDIA_BUS_FMT_SENSOR_DATA ;
1567- fmt -> format .field = V4L2_FIELD_NONE ;
1568- }
15691537
15701538static int __mira220_get_pad_format (struct mira220 * mira220 ,
15711539 struct v4l2_subdev_state * sd_state ,
@@ -1590,9 +1558,7 @@ static int __mira220_get_pad_format(struct mira220 *mira220,
15901558 fmt -> format .code =
15911559 mira220_validate_format_code_or_default (
15921560 mira220 , mira220 -> fmt .code );
1593- } else {
1594- mira220_update_metadata_pad_format (fmt );
1595- }
1561+ }
15961562 }
15971563
15981564 return 0 ;
@@ -1686,10 +1652,7 @@ static int mira220_set_pad_format(struct v4l2_subdev *sd,
16861652 framefmt = v4l2_subdev_state_get_format (sd_state ,
16871653 fmt -> pad );
16881654 * framefmt = fmt -> format ;
1689- } else {
1690- /* Only one embedded data mode is supported */
1691- mira220_update_metadata_pad_format (fmt );
1692- }
1655+ }
16931656 }
16941657
16951658 mutex_unlock (& mira220 -> mutex );
@@ -2130,53 +2093,6 @@ static void mira220_free_controls(struct mira220 *mira220)
21302093 mutex_destroy (& mira220 -> mutex );
21312094}
21322095
2133- static int mira220_check_hwcfg (struct device * dev )
2134- {
2135- struct fwnode_handle * endpoint ;
2136- struct v4l2_fwnode_endpoint ep_cfg = { .bus_type =
2137- V4L2_MBUS_CSI2_DPHY };
2138- int ret = - EINVAL ;
2139-
2140- endpoint = fwnode_graph_get_next_endpoint (dev_fwnode (dev ), NULL );
2141- if (!endpoint ) {
2142- dev_err (dev , "endpoint node not found\n" );
2143- return - EINVAL ;
2144- }
2145-
2146- if (v4l2_fwnode_endpoint_alloc_parse (endpoint , & ep_cfg )) {
2147- dev_err (dev , "could not parse endpoint\n" );
2148- goto error_out ;
2149- }
2150-
2151- /* Check the number of MIPI CSI2 data lanes */
2152- if (ep_cfg .bus .mipi_csi2 .num_data_lanes != 2 ) {
2153- dev_err (dev , "only 2 data lanes are currently supported\n" );
2154- goto error_out ;
2155- }
2156-
2157- /* Check the link frequency set in device tree */
2158- if (!ep_cfg .nr_of_link_frequencies ) {
2159- dev_err (dev , "link-frequency property not found in DT\n" );
2160- goto error_out ;
2161- }
2162-
2163- if (ep_cfg .nr_of_link_frequencies != 1 ||
2164- ep_cfg .link_frequencies [0 ] != MIRA220_DEFAULT_LINK_FREQ ) {
2165- dev_err (dev , "Link frequency not supported: %lld\n" ,
2166- ep_cfg .link_frequencies [0 ]);
2167- goto error_out ;
2168- }
2169-
2170- // TODO(jalv): Check device tree configuration and make sure it is supported by the driver
2171- ret = 0 ;
2172-
2173- error_out :
2174- v4l2_fwnode_endpoint_free (& ep_cfg );
2175- fwnode_handle_put (endpoint );
2176-
2177- return ret ;
2178- }
2179-
21802096static int mira220_probe (struct i2c_client * client )
21812097{
21822098 struct device * dev = & client -> dev ;
@@ -2192,10 +2108,6 @@ static int mira220_probe(struct i2c_client *client)
21922108 v4l2_i2c_subdev_init (& mira220 -> sd , client , & mira220_subdev_ops );
21932109 mira220 -> regmap = devm_cci_regmap_init_i2c (client , 16 );
21942110
2195- /* Check the hardware configuration in device tree */
2196- if (mira220_check_hwcfg (dev ))
2197- return - EINVAL ;
2198-
21992111 /* Parse device tree to check if dtoverlay has param skip-reg-upload=1 */
22002112 /* Set default TBD I2C device address to LED I2C Address*/
22012113
@@ -2250,7 +2162,6 @@ static int mira220_probe(struct i2c_client *client)
22502162
22512163 /* Initialize source pads */
22522164 mira220 -> pad [IMAGE_PAD ].flags = MEDIA_PAD_FL_SOURCE ;
2253- mira220 -> pad [METADATA_PAD ].flags = MEDIA_PAD_FL_SOURCE ;
22542165
22552166
22562167 /* Initialize default format */
0 commit comments