提交 697a521f 编写于 作者: S Sakari Ailus 提交者: Mauro Carvalho Chehab

[media] smiapp: Rename smiapp_platform_data as smiapp_hwconfig

This is really configuration to the driver originating from DT or
elsewhere. Do not call it platform data.
Signed-off-by: NSakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: NSebastian Reichel <sre@kernel.org>
Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
上级 073fe635
...@@ -625,12 +625,12 @@ static int smiapp_init_late_controls(struct smiapp_sensor *sensor) ...@@ -625,12 +625,12 @@ static int smiapp_init_late_controls(struct smiapp_sensor *sensor)
0, max_value, 1, max_value); 0, max_value, 1, max_value);
} }
for (max = 0; sensor->platform_data->op_sys_clock[max + 1]; max++); for (max = 0; sensor->hwcfg->op_sys_clock[max + 1]; max++);
sensor->link_freq = v4l2_ctrl_new_int_menu( sensor->link_freq = v4l2_ctrl_new_int_menu(
&sensor->src->ctrl_handler, &smiapp_ctrl_ops, &sensor->src->ctrl_handler, &smiapp_ctrl_ops,
V4L2_CID_LINK_FREQ, __fls(*valid_link_freqs), V4L2_CID_LINK_FREQ, __fls(*valid_link_freqs),
__ffs(*valid_link_freqs), sensor->platform_data->op_sys_clock); __ffs(*valid_link_freqs), sensor->hwcfg->op_sys_clock);
return sensor->src->ctrl_handler.error; return sensor->src->ctrl_handler.error;
} }
...@@ -833,8 +833,8 @@ static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor) ...@@ -833,8 +833,8 @@ static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor)
pll->bits_per_pixel = f->compressed; pll->bits_per_pixel = f->compressed;
for (j = 0; sensor->platform_data->op_sys_clock[j]; j++) { for (j = 0; sensor->hwcfg->op_sys_clock[j]; j++) {
pll->link_freq = sensor->platform_data->op_sys_clock[j]; pll->link_freq = sensor->hwcfg->op_sys_clock[j];
rval = smiapp_pll_try(sensor, pll); rval = smiapp_pll_try(sensor, pll);
dev_dbg(&client->dev, "link freq %u Hz, bpp %u %s\n", dev_dbg(&client->dev, "link freq %u Hz, bpp %u %s\n",
...@@ -1032,22 +1032,22 @@ static int smiapp_change_cci_addr(struct smiapp_sensor *sensor) ...@@ -1032,22 +1032,22 @@ static int smiapp_change_cci_addr(struct smiapp_sensor *sensor)
int rval; int rval;
u32 val; u32 val;
client->addr = sensor->platform_data->i2c_addr_dfl; client->addr = sensor->hwcfg->i2c_addr_dfl;
rval = smiapp_write(sensor, rval = smiapp_write(sensor,
SMIAPP_REG_U8_CCI_ADDRESS_CONTROL, SMIAPP_REG_U8_CCI_ADDRESS_CONTROL,
sensor->platform_data->i2c_addr_alt << 1); sensor->hwcfg->i2c_addr_alt << 1);
if (rval) if (rval)
return rval; return rval;
client->addr = sensor->platform_data->i2c_addr_alt; client->addr = sensor->hwcfg->i2c_addr_alt;
/* verify addr change went ok */ /* verify addr change went ok */
rval = smiapp_read(sensor, SMIAPP_REG_U8_CCI_ADDRESS_CONTROL, &val); rval = smiapp_read(sensor, SMIAPP_REG_U8_CCI_ADDRESS_CONTROL, &val);
if (rval) if (rval)
return rval; return rval;
if (val != sensor->platform_data->i2c_addr_alt << 1) if (val != sensor->hwcfg->i2c_addr_alt << 1)
return -ENODEV; return -ENODEV;
return 0; return 0;
...@@ -1061,13 +1061,13 @@ static int smiapp_change_cci_addr(struct smiapp_sensor *sensor) ...@@ -1061,13 +1061,13 @@ static int smiapp_change_cci_addr(struct smiapp_sensor *sensor)
static int smiapp_setup_flash_strobe(struct smiapp_sensor *sensor) static int smiapp_setup_flash_strobe(struct smiapp_sensor *sensor)
{ {
struct smiapp_flash_strobe_parms *strobe_setup; struct smiapp_flash_strobe_parms *strobe_setup;
unsigned int ext_freq = sensor->platform_data->ext_clk; unsigned int ext_freq = sensor->hwcfg->ext_clk;
u32 tmp; u32 tmp;
u32 strobe_adjustment; u32 strobe_adjustment;
u32 strobe_width_high_rs; u32 strobe_width_high_rs;
int rval; int rval;
strobe_setup = sensor->platform_data->strobe_setup; strobe_setup = sensor->hwcfg->strobe_setup;
/* /*
* How to calculate registers related to strobe length. Please * How to calculate registers related to strobe length. Please
...@@ -1179,7 +1179,7 @@ static int smiapp_setup_flash_strobe(struct smiapp_sensor *sensor) ...@@ -1179,7 +1179,7 @@ static int smiapp_setup_flash_strobe(struct smiapp_sensor *sensor)
strobe_setup->trigger); strobe_setup->trigger);
out: out:
sensor->platform_data->strobe_setup->trigger = 0; sensor->hwcfg->strobe_setup->trigger = 0;
return rval; return rval;
} }
...@@ -1201,9 +1201,9 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) ...@@ -1201,9 +1201,9 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
} }
usleep_range(1000, 1000); usleep_range(1000, 1000);
if (sensor->platform_data->set_xclk) if (sensor->hwcfg->set_xclk)
rval = sensor->platform_data->set_xclk( rval = sensor->hwcfg->set_xclk(
&sensor->src->sd, sensor->platform_data->ext_clk); &sensor->src->sd, sensor->hwcfg->ext_clk);
else else
rval = clk_prepare_enable(sensor->ext_clk); rval = clk_prepare_enable(sensor->ext_clk);
if (rval < 0) { if (rval < 0) {
...@@ -1212,10 +1212,10 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) ...@@ -1212,10 +1212,10 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
} }
usleep_range(1000, 1000); usleep_range(1000, 1000);
if (gpio_is_valid(sensor->platform_data->xshutdown)) if (gpio_is_valid(sensor->hwcfg->xshutdown))
gpio_set_value(sensor->platform_data->xshutdown, 1); gpio_set_value(sensor->hwcfg->xshutdown, 1);
sleep = SMIAPP_RESET_DELAY(sensor->platform_data->ext_clk); sleep = SMIAPP_RESET_DELAY(sensor->hwcfg->ext_clk);
usleep_range(sleep, sleep); usleep_range(sleep, sleep);
/* /*
...@@ -1229,7 +1229,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) ...@@ -1229,7 +1229,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
* is found. * is found.
*/ */
if (sensor->platform_data->i2c_addr_alt) { if (sensor->hwcfg->i2c_addr_alt) {
rval = smiapp_change_cci_addr(sensor); rval = smiapp_change_cci_addr(sensor);
if (rval) { if (rval) {
dev_err(&client->dev, "cci address change error\n"); dev_err(&client->dev, "cci address change error\n");
...@@ -1244,7 +1244,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) ...@@ -1244,7 +1244,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
goto out_cci_addr_fail; goto out_cci_addr_fail;
} }
if (sensor->platform_data->i2c_addr_alt) { if (sensor->hwcfg->i2c_addr_alt) {
rval = smiapp_change_cci_addr(sensor); rval = smiapp_change_cci_addr(sensor);
if (rval) { if (rval) {
dev_err(&client->dev, "cci address change error\n"); dev_err(&client->dev, "cci address change error\n");
...@@ -1261,14 +1261,14 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) ...@@ -1261,14 +1261,14 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
rval = smiapp_write( rval = smiapp_write(
sensor, SMIAPP_REG_U16_EXTCLK_FREQUENCY_MHZ, sensor, SMIAPP_REG_U16_EXTCLK_FREQUENCY_MHZ,
sensor->platform_data->ext_clk / (1000000 / (1 << 8))); sensor->hwcfg->ext_clk / (1000000 / (1 << 8)));
if (rval) { if (rval) {
dev_err(&client->dev, "extclk frequency set failed\n"); dev_err(&client->dev, "extclk frequency set failed\n");
goto out_cci_addr_fail; goto out_cci_addr_fail;
} }
rval = smiapp_write(sensor, SMIAPP_REG_U8_CSI_LANE_MODE, rval = smiapp_write(sensor, SMIAPP_REG_U8_CSI_LANE_MODE,
sensor->platform_data->lanes - 1); sensor->hwcfg->lanes - 1);
if (rval) { if (rval) {
dev_err(&client->dev, "csi lane mode set failed\n"); dev_err(&client->dev, "csi lane mode set failed\n");
goto out_cci_addr_fail; goto out_cci_addr_fail;
...@@ -1282,7 +1282,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) ...@@ -1282,7 +1282,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
} }
rval = smiapp_write(sensor, SMIAPP_REG_U8_CSI_SIGNALLING_MODE, rval = smiapp_write(sensor, SMIAPP_REG_U8_CSI_SIGNALLING_MODE,
sensor->platform_data->csi_signalling_mode); sensor->hwcfg->csi_signalling_mode);
if (rval) { if (rval) {
dev_err(&client->dev, "csi signalling mode set failed\n"); dev_err(&client->dev, "csi signalling mode set failed\n");
goto out_cci_addr_fail; goto out_cci_addr_fail;
...@@ -1322,10 +1322,10 @@ static int smiapp_power_on(struct smiapp_sensor *sensor) ...@@ -1322,10 +1322,10 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
return 0; return 0;
out_cci_addr_fail: out_cci_addr_fail:
if (gpio_is_valid(sensor->platform_data->xshutdown)) if (gpio_is_valid(sensor->hwcfg->xshutdown))
gpio_set_value(sensor->platform_data->xshutdown, 0); gpio_set_value(sensor->hwcfg->xshutdown, 0);
if (sensor->platform_data->set_xclk) if (sensor->hwcfg->set_xclk)
sensor->platform_data->set_xclk(&sensor->src->sd, 0); sensor->hwcfg->set_xclk(&sensor->src->sd, 0);
else else
clk_disable_unprepare(sensor->ext_clk); clk_disable_unprepare(sensor->ext_clk);
...@@ -1343,15 +1343,15 @@ static void smiapp_power_off(struct smiapp_sensor *sensor) ...@@ -1343,15 +1343,15 @@ static void smiapp_power_off(struct smiapp_sensor *sensor)
* really see a power off and next time the cci address change * really see a power off and next time the cci address change
* will fail. So do a soft reset explicitly here. * will fail. So do a soft reset explicitly here.
*/ */
if (sensor->platform_data->i2c_addr_alt) if (sensor->hwcfg->i2c_addr_alt)
smiapp_write(sensor, smiapp_write(sensor,
SMIAPP_REG_U8_SOFTWARE_RESET, SMIAPP_REG_U8_SOFTWARE_RESET,
SMIAPP_SOFTWARE_RESET); SMIAPP_SOFTWARE_RESET);
if (gpio_is_valid(sensor->platform_data->xshutdown)) if (gpio_is_valid(sensor->hwcfg->xshutdown))
gpio_set_value(sensor->platform_data->xshutdown, 0); gpio_set_value(sensor->hwcfg->xshutdown, 0);
if (sensor->platform_data->set_xclk) if (sensor->hwcfg->set_xclk)
sensor->platform_data->set_xclk(&sensor->src->sd, 0); sensor->hwcfg->set_xclk(&sensor->src->sd, 0);
else else
clk_disable_unprepare(sensor->ext_clk); clk_disable_unprepare(sensor->ext_clk);
usleep_range(5000, 5000); usleep_range(5000, 5000);
...@@ -1491,8 +1491,8 @@ static int smiapp_start_streaming(struct smiapp_sensor *sensor) ...@@ -1491,8 +1491,8 @@ static int smiapp_start_streaming(struct smiapp_sensor *sensor)
if ((sensor->limits[SMIAPP_LIMIT_FLASH_MODE_CAPABILITY] & if ((sensor->limits[SMIAPP_LIMIT_FLASH_MODE_CAPABILITY] &
(SMIAPP_FLASH_MODE_CAPABILITY_SINGLE_STROBE | (SMIAPP_FLASH_MODE_CAPABILITY_SINGLE_STROBE |
SMIAPP_FLASH_MODE_CAPABILITY_MULTIPLE_STROBE)) && SMIAPP_FLASH_MODE_CAPABILITY_MULTIPLE_STROBE)) &&
sensor->platform_data->strobe_setup != NULL && sensor->hwcfg->strobe_setup != NULL &&
sensor->platform_data->strobe_setup->trigger != 0) { sensor->hwcfg->strobe_setup->trigger != 0) {
rval = smiapp_setup_flash_strobe(sensor); rval = smiapp_setup_flash_strobe(sensor);
if (rval) if (rval)
goto out; goto out;
...@@ -2309,7 +2309,7 @@ smiapp_sysfs_nvm_read(struct device *dev, struct device_attribute *attr, ...@@ -2309,7 +2309,7 @@ smiapp_sysfs_nvm_read(struct device *dev, struct device_attribute *attr,
if (!sensor->nvm_size) { if (!sensor->nvm_size) {
/* NVM not read yet - read it now */ /* NVM not read yet - read it now */
sensor->nvm_size = sensor->platform_data->nvm_size; sensor->nvm_size = sensor->hwcfg->nvm_size;
if (smiapp_set_power(subdev, 1) < 0) if (smiapp_set_power(subdev, 1) < 0)
return -ENODEV; return -ENODEV;
if (smiapp_read_nvm(sensor, sensor->nvm)) { if (smiapp_read_nvm(sensor, sensor->nvm)) {
...@@ -2554,7 +2554,7 @@ static int smiapp_init(struct smiapp_sensor *sensor) ...@@ -2554,7 +2554,7 @@ static int smiapp_init(struct smiapp_sensor *sensor)
return PTR_ERR(sensor->vana); return PTR_ERR(sensor->vana);
} }
if (!sensor->platform_data->set_xclk) { if (!sensor->hwcfg->set_xclk) {
sensor->ext_clk = devm_clk_get(&client->dev, NULL); sensor->ext_clk = devm_clk_get(&client->dev, NULL);
if (IS_ERR(sensor->ext_clk)) { if (IS_ERR(sensor->ext_clk)) {
dev_err(&client->dev, "could not get clock\n"); dev_err(&client->dev, "could not get clock\n");
...@@ -2562,23 +2562,23 @@ static int smiapp_init(struct smiapp_sensor *sensor) ...@@ -2562,23 +2562,23 @@ static int smiapp_init(struct smiapp_sensor *sensor)
} }
rval = clk_set_rate(sensor->ext_clk, rval = clk_set_rate(sensor->ext_clk,
sensor->platform_data->ext_clk); sensor->hwcfg->ext_clk);
if (rval < 0) { if (rval < 0) {
dev_err(&client->dev, dev_err(&client->dev,
"unable to set clock freq to %u\n", "unable to set clock freq to %u\n",
sensor->platform_data->ext_clk); sensor->hwcfg->ext_clk);
return rval; return rval;
} }
} }
if (gpio_is_valid(sensor->platform_data->xshutdown)) { if (gpio_is_valid(sensor->hwcfg->xshutdown)) {
rval = devm_gpio_request_one( rval = devm_gpio_request_one(
&client->dev, sensor->platform_data->xshutdown, 0, &client->dev, sensor->hwcfg->xshutdown, 0,
"SMIA++ xshutdown"); "SMIA++ xshutdown");
if (rval < 0) { if (rval < 0) {
dev_err(&client->dev, dev_err(&client->dev,
"unable to acquire reset gpio %d\n", "unable to acquire reset gpio %d\n",
sensor->platform_data->xshutdown); sensor->hwcfg->xshutdown);
return rval; return rval;
} }
} }
...@@ -2612,7 +2612,7 @@ static int smiapp_init(struct smiapp_sensor *sensor) ...@@ -2612,7 +2612,7 @@ static int smiapp_init(struct smiapp_sensor *sensor)
* *
* Rotation also changes the bayer pattern. * Rotation also changes the bayer pattern.
*/ */
if (sensor->platform_data->module_board_orient == if (sensor->hwcfg->module_board_orient ==
SMIAPP_MODULE_BOARD_ORIENT_180) SMIAPP_MODULE_BOARD_ORIENT_180)
sensor->hvflip_inv_mask = SMIAPP_IMAGE_ORIENTATION_HFLIP | sensor->hvflip_inv_mask = SMIAPP_IMAGE_ORIENTATION_HFLIP |
SMIAPP_IMAGE_ORIENTATION_VFLIP; SMIAPP_IMAGE_ORIENTATION_VFLIP;
...@@ -2661,9 +2661,9 @@ static int smiapp_init(struct smiapp_sensor *sensor) ...@@ -2661,9 +2661,9 @@ static int smiapp_init(struct smiapp_sensor *sensor)
/* SMIA++ NVM initialization - it will be read from the sensor /* SMIA++ NVM initialization - it will be read from the sensor
* when it is first requested by userspace. * when it is first requested by userspace.
*/ */
if (sensor->minfo.smiapp_version && sensor->platform_data->nvm_size) { if (sensor->minfo.smiapp_version && sensor->hwcfg->nvm_size) {
sensor->nvm = devm_kzalloc(&client->dev, sensor->nvm = devm_kzalloc(&client->dev,
sensor->platform_data->nvm_size, GFP_KERNEL); sensor->hwcfg->nvm_size, GFP_KERNEL);
if (sensor->nvm == NULL) { if (sensor->nvm == NULL) {
dev_err(&client->dev, "nvm buf allocation failed\n"); dev_err(&client->dev, "nvm buf allocation failed\n");
rval = -ENOMEM; rval = -ENOMEM;
...@@ -2706,8 +2706,8 @@ static int smiapp_init(struct smiapp_sensor *sensor) ...@@ -2706,8 +2706,8 @@ static int smiapp_init(struct smiapp_sensor *sensor)
/* prepare PLL configuration input values */ /* prepare PLL configuration input values */
pll->bus_type = SMIAPP_PLL_BUS_TYPE_CSI2; pll->bus_type = SMIAPP_PLL_BUS_TYPE_CSI2;
pll->csi2.lanes = sensor->platform_data->lanes; pll->csi2.lanes = sensor->hwcfg->lanes;
pll->ext_clk_freq_hz = sensor->platform_data->ext_clk; pll->ext_clk_freq_hz = sensor->hwcfg->ext_clk;
pll->scale_n = sensor->limits[SMIAPP_LIMIT_SCALER_N_MIN]; pll->scale_n = sensor->limits[SMIAPP_LIMIT_SCALER_N_MIN];
/* Profile 0 sensors have no separate OP clock branch. */ /* Profile 0 sensors have no separate OP clock branch. */
if (sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0) if (sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0)
...@@ -2984,9 +2984,9 @@ static int smiapp_resume(struct device *dev) ...@@ -2984,9 +2984,9 @@ static int smiapp_resume(struct device *dev)
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
static struct smiapp_platform_data *smiapp_get_pdata(struct device *dev) static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
{ {
struct smiapp_platform_data *pdata; struct smiapp_hwconfig *hwcfg;
struct v4l2_of_endpoint *bus_cfg; struct v4l2_of_endpoint *bus_cfg;
struct device_node *ep; struct device_node *ep;
int i; int i;
...@@ -3003,58 +3003,58 @@ static struct smiapp_platform_data *smiapp_get_pdata(struct device *dev) ...@@ -3003,58 +3003,58 @@ static struct smiapp_platform_data *smiapp_get_pdata(struct device *dev)
if (IS_ERR(bus_cfg)) if (IS_ERR(bus_cfg))
goto out_err; goto out_err;
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); hwcfg = devm_kzalloc(dev, sizeof(*hwcfg), GFP_KERNEL);
if (!pdata) if (!hwcfg)
goto out_err; goto out_err;
switch (bus_cfg->bus_type) { switch (bus_cfg->bus_type) {
case V4L2_MBUS_CSI2: case V4L2_MBUS_CSI2:
pdata->csi_signalling_mode = SMIAPP_CSI_SIGNALLING_MODE_CSI2; hwcfg->csi_signalling_mode = SMIAPP_CSI_SIGNALLING_MODE_CSI2;
break; break;
/* FIXME: add CCP2 support. */ /* FIXME: add CCP2 support. */
default: default:
goto out_err; goto out_err;
} }
pdata->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes; hwcfg->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes;
dev_dbg(dev, "lanes %u\n", pdata->lanes); dev_dbg(dev, "lanes %u\n", hwcfg->lanes);
/* xshutdown GPIO is optional */ /* xshutdown GPIO is optional */
pdata->xshutdown = of_get_named_gpio(dev->of_node, "reset-gpios", 0); hwcfg->xshutdown = of_get_named_gpio(dev->of_node, "reset-gpios", 0);
/* NVM size is not mandatory */ /* NVM size is not mandatory */
of_property_read_u32(dev->of_node, "nokia,nvm-size", of_property_read_u32(dev->of_node, "nokia,nvm-size",
&pdata->nvm_size); &hwcfg->nvm_size);
rval = of_property_read_u32(dev->of_node, "clock-frequency", rval = of_property_read_u32(dev->of_node, "clock-frequency",
&pdata->ext_clk); &hwcfg->ext_clk);
if (rval) { if (rval) {
dev_warn(dev, "can't get clock-frequency\n"); dev_warn(dev, "can't get clock-frequency\n");
goto out_err; goto out_err;
} }
dev_dbg(dev, "reset %d, nvm %d, clk %d, csi %d\n", pdata->xshutdown, dev_dbg(dev, "reset %d, nvm %d, clk %d, csi %d\n", hwcfg->xshutdown,
pdata->nvm_size, pdata->ext_clk, pdata->csi_signalling_mode); hwcfg->nvm_size, hwcfg->ext_clk, hwcfg->csi_signalling_mode);
if (!bus_cfg->nr_of_link_frequencies) { if (!bus_cfg->nr_of_link_frequencies) {
dev_warn(dev, "no link frequencies defined\n"); dev_warn(dev, "no link frequencies defined\n");
goto out_err; goto out_err;
} }
pdata->op_sys_clock = devm_kcalloc( hwcfg->op_sys_clock = devm_kcalloc(
dev, bus_cfg->nr_of_link_frequencies + 1 /* guardian */, dev, bus_cfg->nr_of_link_frequencies + 1 /* guardian */,
sizeof(*pdata->op_sys_clock), GFP_KERNEL); sizeof(*hwcfg->op_sys_clock), GFP_KERNEL);
if (!pdata->op_sys_clock) if (!hwcfg->op_sys_clock)
goto out_err; goto out_err;
for (i = 0; i < bus_cfg->nr_of_link_frequencies; i++) { for (i = 0; i < bus_cfg->nr_of_link_frequencies; i++) {
pdata->op_sys_clock[i] = bus_cfg->link_frequencies[i]; hwcfg->op_sys_clock[i] = bus_cfg->link_frequencies[i];
dev_dbg(dev, "freq %d: %lld\n", i, pdata->op_sys_clock[i]); dev_dbg(dev, "freq %d: %lld\n", i, hwcfg->op_sys_clock[i]);
} }
v4l2_of_free_endpoint(bus_cfg); v4l2_of_free_endpoint(bus_cfg);
of_node_put(ep); of_node_put(ep);
return pdata; return hwcfg;
out_err: out_err:
v4l2_of_free_endpoint(bus_cfg); v4l2_of_free_endpoint(bus_cfg);
...@@ -3066,17 +3066,17 @@ static int smiapp_probe(struct i2c_client *client, ...@@ -3066,17 +3066,17 @@ static int smiapp_probe(struct i2c_client *client,
const struct i2c_device_id *devid) const struct i2c_device_id *devid)
{ {
struct smiapp_sensor *sensor; struct smiapp_sensor *sensor;
struct smiapp_platform_data *pdata = smiapp_get_pdata(&client->dev); struct smiapp_hwconfig *hwcfg = smiapp_get_hwconfig(&client->dev);
int rval; int rval;
if (pdata == NULL) if (hwcfg == NULL)
return -ENODEV; return -ENODEV;
sensor = devm_kzalloc(&client->dev, sizeof(*sensor), GFP_KERNEL); sensor = devm_kzalloc(&client->dev, sizeof(*sensor), GFP_KERNEL);
if (sensor == NULL) if (sensor == NULL)
return -ENOMEM; return -ENOMEM;
sensor->platform_data = pdata; sensor->hwcfg = hwcfg;
mutex_init(&sensor->mutex); mutex_init(&sensor->mutex);
mutex_init(&sensor->power_mutex); mutex_init(&sensor->power_mutex);
sensor->src = &sensor->ssds[sensor->ssds_used]; sensor->src = &sensor->ssds[sensor->ssds_used];
...@@ -3119,10 +3119,10 @@ static int smiapp_remove(struct i2c_client *client) ...@@ -3119,10 +3119,10 @@ static int smiapp_remove(struct i2c_client *client)
v4l2_async_unregister_subdev(subdev); v4l2_async_unregister_subdev(subdev);
if (sensor->power_count) { if (sensor->power_count) {
if (gpio_is_valid(sensor->platform_data->xshutdown)) if (gpio_is_valid(sensor->hwcfg->xshutdown))
gpio_set_value(sensor->platform_data->xshutdown, 0); gpio_set_value(sensor->hwcfg->xshutdown, 0);
if (sensor->platform_data->set_xclk) if (sensor->hwcfg->set_xclk)
sensor->platform_data->set_xclk(&sensor->src->sd, 0); sensor->hwcfg->set_xclk(&sensor->src->sd, 0);
else else
clk_disable_unprepare(sensor->ext_clk); clk_disable_unprepare(sensor->ext_clk);
sensor->power_count = 0; sensor->power_count = 0;
......
...@@ -178,13 +178,13 @@ static int jt8ev1_post_poweron(struct smiapp_sensor *sensor) ...@@ -178,13 +178,13 @@ static int jt8ev1_post_poweron(struct smiapp_sensor *sensor)
if (rval < 0) if (rval < 0)
return rval; return rval;
switch (sensor->platform_data->ext_clk) { switch (sensor->hwcfg->ext_clk) {
case 9600000: case 9600000:
return smiapp_write_8s(sensor, regs_96, return smiapp_write_8s(sensor, regs_96,
ARRAY_SIZE(regs_96)); ARRAY_SIZE(regs_96));
default: default:
dev_warn(&client->dev, "no MSRs for %d Hz ext_clk\n", dev_warn(&client->dev, "no MSRs for %d Hz ext_clk\n",
sensor->platform_data->ext_clk); sensor->hwcfg->ext_clk);
return 0; return 0;
} }
} }
......
...@@ -197,7 +197,7 @@ struct smiapp_sensor { ...@@ -197,7 +197,7 @@ struct smiapp_sensor {
struct smiapp_subdev *binner; struct smiapp_subdev *binner;
struct smiapp_subdev *scaler; struct smiapp_subdev *scaler;
struct smiapp_subdev *pixel_array; struct smiapp_subdev *pixel_array;
struct smiapp_platform_data *platform_data; struct smiapp_hwconfig *hwcfg;
struct regulator *vana; struct regulator *vana;
struct clk *ext_clk; struct clk *ext_clk;
u32 limits[SMIAPP_LIMIT_LAST]; u32 limits[SMIAPP_LIMIT_LAST];
......
...@@ -57,7 +57,7 @@ struct smiapp_flash_strobe_parms { ...@@ -57,7 +57,7 @@ struct smiapp_flash_strobe_parms {
u8 trigger; u8 trigger;
}; };
struct smiapp_platform_data { struct smiapp_hwconfig {
/* /*
* Change the cci address if i2c_addr_alt is set. * Change the cci address if i2c_addr_alt is set.
* Both default and alternate cci addr need to be present * Both default and alternate cci addr need to be present
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册