Commit 0445126f authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

media: atomisp: Remove struct atomisp_platform_data

struct atomisp_platform_data only has a single subdevs member. Remove
this struct and replace atomisp_get_platform_data() with
atomisp_platform_get_subdevs().

Note atomisp_get_platform_data() and now atomisp_platform_get_subdevs()
always succeed, so while at it also remove unnecessary error checking.
Reviewed-by: default avatarAndy Shevchenko <andy@kernel.org>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 74350ed0
......@@ -115,10 +115,6 @@ struct intel_v4l2_subdev_table {
struct v4l2_subdev *subdev;
};
struct atomisp_platform_data {
struct intel_v4l2_subdev_table *subdevs;
};
/*
* Sensor of external ISP can send multiple steams with different mipi data
* type in the same virtual channel. This information needs to come from the
......@@ -173,7 +169,7 @@ struct camera_mipi_info {
const u32 *metadata_effective_width;
};
const struct atomisp_platform_data *atomisp_get_platform_data(void);
const struct intel_v4l2_subdev_table *atomisp_platform_get_subdevs(void);
int atomisp_register_sensor_no_gmin(struct v4l2_subdev *subdev, u32 lanes,
enum atomisp_input_format format,
enum atomisp_bayer_order bayer_order);
......
......@@ -127,17 +127,13 @@ static int gmin_v2p8_enable_count;
/* The atomisp uses subdev==NULL for the end-of-list marker, so leave space. */
static struct intel_v4l2_subdev_table pdata_subdevs[MAX_SUBDEVS + 1];
static const struct atomisp_platform_data pdata = {
.subdevs = pdata_subdevs,
};
static struct gmin_subdev *find_gmin_subdev(struct v4l2_subdev *subdev);
const struct atomisp_platform_data *atomisp_get_platform_data(void)
const struct intel_v4l2_subdev_table *atomisp_platform_get_subdevs(void)
{
return &pdata;
return pdata_subdevs;
}
EXPORT_SYMBOL_GPL(atomisp_get_platform_data);
EXPORT_SYMBOL_GPL(atomisp_platform_get_subdevs);
int atomisp_register_i2c_module(struct v4l2_subdev *subdev,
struct camera_sensor_platform_data *plat_data)
......@@ -164,7 +160,7 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev,
adev->power.flags.power_resources = 0;
for (i = 0; i < MAX_SUBDEVS; i++)
if (!pdata.subdevs[i].subdev)
if (!pdata_subdevs[i].subdev)
break;
if (i == MAX_SUBDEVS)
......@@ -179,9 +175,9 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev,
if (!gs)
return -ENODEV;
pdata.subdevs[i].port = gs->csi_port;
pdata.subdevs[i].lanes = gs->csi_lanes;
pdata.subdevs[i].subdev = subdev;
pdata_subdevs[i].port = gs->csi_port;
pdata_subdevs[i].lanes = gs->csi_lanes;
pdata_subdevs[i].subdev = subdev;
return 0;
}
EXPORT_SYMBOL_GPL(atomisp_register_i2c_module);
......@@ -194,9 +190,9 @@ int atomisp_gmin_remove_subdev(struct v4l2_subdev *sd)
return 0;
for (i = 0; i < MAX_SUBDEVS; i++) {
if (pdata.subdevs[i].subdev == sd) {
if (pdata_subdevs[i].subdev == sd) {
for (j = i + 1; j <= MAX_SUBDEVS; j++)
pdata.subdevs[j - 1] = pdata.subdevs[j];
pdata_subdevs[j - 1] = pdata_subdevs[j];
}
if (gmin_subdevs[i].subdev == sd) {
if (gmin_subdevs[i].gpio0)
......@@ -1125,7 +1121,7 @@ int atomisp_register_sensor_no_gmin(struct v4l2_subdev *subdev, u32 lanes,
}
for (i = 0; i < MAX_SUBDEVS; i++)
if (!pdata.subdevs[i].subdev)
if (!pdata_subdevs[i].subdev)
break;
if (i >= MAX_SUBDEVS) {
......@@ -1137,9 +1133,9 @@ int atomisp_register_sensor_no_gmin(struct v4l2_subdev *subdev, u32 lanes,
if (ret)
return ret;
pdata.subdevs[i].port = port;
pdata.subdevs[i].lanes = lanes;
pdata.subdevs[i].subdev = subdev;
pdata_subdevs[i].port = port;
pdata_subdevs[i].lanes = lanes;
pdata_subdevs[i].subdev = subdev;
return 0;
}
EXPORT_SYMBOL_GPL(atomisp_register_sensor_no_gmin);
......@@ -1149,12 +1145,12 @@ void atomisp_unregister_subdev(struct v4l2_subdev *subdev)
int i;
for (i = 0; i < MAX_SUBDEVS; i++) {
if (pdata.subdevs[i].subdev != subdev)
if (pdata_subdevs[i].subdev != subdev)
continue;
camera_sensor_csi_free(subdev);
pdata.subdevs[i].subdev = NULL;
pdata.subdevs[i].port = 0;
pdata_subdevs[i].subdev = NULL;
pdata_subdevs[i].port = 0;
break;
}
}
......
......@@ -175,7 +175,6 @@ struct atomisp_device {
struct media_device media_dev;
struct atomisp_sub_device asd;
struct v4l2_async_notifier notifier;
struct atomisp_platform_data *pdata;
void *mmu_l1_base;
void __iomem *base;
const struct firmware *firmware;
......
......@@ -783,27 +783,20 @@ int atomisp_csi_lane_config(struct atomisp_device *isp)
static int atomisp_subdev_probe(struct atomisp_device *isp)
{
const struct atomisp_platform_data *pdata;
struct intel_v4l2_subdev_table *subdevs;
const struct intel_v4l2_subdev_table *subdevs;
int ret, mipi_port;
ret = atomisp_csi2_bridge_parse_firmware(isp);
if (ret)
return ret;
pdata = atomisp_get_platform_data();
if (!pdata) {
dev_err(isp->dev, "no platform data available\n");
return 0;
}
/*
* TODO: this is left here for now to allow testing atomisp-sensor
* drivers which are still using the atomisp_gmin_platform infra before
* converting them to standard v4l2 sensor drivers using runtime-pm +
* ACPI for pm and v4l2_async_register_subdev_sensor() registration.
*/
for (subdevs = pdata->subdevs; subdevs->subdev; subdevs++) {
for (subdevs = atomisp_platform_get_subdevs(); subdevs->subdev; subdevs++) {
ret = v4l2_device_register_subdev(&isp->v4l2_dev, subdevs->subdev);
if (ret)
continue;
......@@ -1186,7 +1179,6 @@ static void atomisp_pm_uninit(struct atomisp_device *isp)
static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
const struct atomisp_platform_data *pdata;
struct atomisp_device *isp;
unsigned int start;
u32 val;
......@@ -1195,10 +1187,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
/* Pointer to struct device. */
atomisp_dev = &pdev->dev;
pdata = atomisp_get_platform_data();
if (!pdata)
dev_warn(&pdev->dev, "no platform data available\n");
start = pci_resource_start(pdev, ATOM_ISP_PCI_BAR);
dev_dbg(&pdev->dev, "start: 0x%x\n", start);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment