mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
drm/sitronix/st7571-i2c: add 'struct device' to st7571_device
Keep a copy of the device structure instead of referring to i2c_client. This is a preparation step to separate the generic part from all i2c stuff. Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Link: https://patch.msgid.link/20251215-st7571-split-v3-2-d5f3205c3138@gmail.com Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
parent
c497e59790
commit
bc12f3e1a8
|
|
@ -113,6 +113,7 @@ struct st7571_panel_format {
|
|||
|
||||
struct st7571_device {
|
||||
struct drm_device drm;
|
||||
struct device *dev;
|
||||
|
||||
struct drm_plane primary_plane;
|
||||
struct drm_crtc crtc;
|
||||
|
|
@ -741,7 +742,7 @@ static const struct regmap_config st7571_regmap_config = {
|
|||
|
||||
static int st7571_validate_parameters(struct st7571_device *st7571)
|
||||
{
|
||||
struct device *dev = st7571->dev.dev;
|
||||
struct device *dev = st7571->dev;
|
||||
const struct st7571_panel_constraints *constraints = &st7571->pdata->constraints;
|
||||
|
||||
if (st7571->width_mm == 0) {
|
||||
|
|
@ -781,7 +782,7 @@ static int st7571_validate_parameters(struct st7571_device *st7571)
|
|||
|
||||
static int st7567_parse_dt(struct st7571_device *st7567)
|
||||
{
|
||||
struct device *dev = &st7567->client->dev;
|
||||
struct device *dev = st7567->dev;
|
||||
struct device_node *np = dev->of_node;
|
||||
struct display_timing dt;
|
||||
int ret;
|
||||
|
|
@ -808,7 +809,7 @@ static int st7567_parse_dt(struct st7571_device *st7567)
|
|||
|
||||
static int st7571_parse_dt(struct st7571_device *st7571)
|
||||
{
|
||||
struct device *dev = &st7571->client->dev;
|
||||
struct device *dev = st7571->dev;
|
||||
struct device_node *np = dev->of_node;
|
||||
struct display_timing dt;
|
||||
int ret;
|
||||
|
|
@ -943,9 +944,10 @@ static int st7571_probe(struct i2c_client *client)
|
|||
return PTR_ERR(st7571);
|
||||
|
||||
drm = &st7571->drm;
|
||||
st7571->dev = &client->dev;
|
||||
st7571->client = client;
|
||||
i2c_set_clientdata(client, st7571);
|
||||
st7571->pdata = device_get_match_data(&client->dev);
|
||||
st7571->pdata = device_get_match_data(st7571->dev);
|
||||
|
||||
ret = st7571->pdata->parse_dt(st7571);
|
||||
if (ret)
|
||||
|
|
@ -966,20 +968,20 @@ static int st7571_probe(struct i2c_client *client)
|
|||
if (i2c_check_functionality(client->adapter, I2C_FUNC_PROTOCOL_MANGLING))
|
||||
st7571->ignore_nak = true;
|
||||
|
||||
st7571->regmap = devm_regmap_init(&client->dev, &st7571_regmap_bus,
|
||||
st7571->regmap = devm_regmap_init(st7571->dev, &st7571_regmap_bus,
|
||||
client, &st7571_regmap_config);
|
||||
if (IS_ERR(st7571->regmap)) {
|
||||
return dev_err_probe(&client->dev, PTR_ERR(st7571->regmap),
|
||||
return dev_err_probe(st7571->dev, PTR_ERR(st7571->regmap),
|
||||
"Failed to initialize regmap\n");
|
||||
}
|
||||
|
||||
st7571->hwbuf = devm_kzalloc(&client->dev,
|
||||
st7571->hwbuf = devm_kzalloc(st7571->dev,
|
||||
(st7571->nlines * st7571->ncols * st7571->bpp) / 8,
|
||||
GFP_KERNEL);
|
||||
if (!st7571->hwbuf)
|
||||
return -ENOMEM;
|
||||
|
||||
st7571->row = devm_kzalloc(&client->dev,
|
||||
st7571->row = devm_kzalloc(st7571->dev,
|
||||
(st7571->ncols * st7571->bpp),
|
||||
GFP_KERNEL);
|
||||
if (!st7571->row)
|
||||
|
|
@ -987,34 +989,34 @@ static int st7571_probe(struct i2c_client *client)
|
|||
|
||||
ret = st7571_mode_config_init(st7571);
|
||||
if (ret)
|
||||
return dev_err_probe(&client->dev, ret,
|
||||
return dev_err_probe(st7571->dev, ret,
|
||||
"Failed to initialize mode config\n");
|
||||
|
||||
ret = st7571_plane_init(st7571, st7571->pformat);
|
||||
if (ret)
|
||||
return dev_err_probe(&client->dev, ret,
|
||||
return dev_err_probe(st7571->dev, ret,
|
||||
"Failed to initialize primary plane\n");
|
||||
|
||||
ret = st7571_crtc_init(st7571);
|
||||
if (ret < 0)
|
||||
return dev_err_probe(&client->dev, ret,
|
||||
return dev_err_probe(st7571->dev, ret,
|
||||
"Failed to initialize CRTC\n");
|
||||
|
||||
ret = st7571_encoder_init(st7571);
|
||||
if (ret < 0)
|
||||
return dev_err_probe(&client->dev, ret,
|
||||
return dev_err_probe(st7571->dev, ret,
|
||||
"Failed to initialize encoder\n");
|
||||
|
||||
ret = st7571_connector_init(st7571);
|
||||
if (ret < 0)
|
||||
return dev_err_probe(&client->dev, ret,
|
||||
return dev_err_probe(st7571->dev, ret,
|
||||
"Failed to initialize connector\n");
|
||||
|
||||
drm_mode_config_reset(drm);
|
||||
|
||||
ret = drm_dev_register(drm, 0);
|
||||
if (ret)
|
||||
return dev_err_probe(&client->dev, ret,
|
||||
return dev_err_probe(st7571->dev, ret,
|
||||
"Failed to register DRM device\n");
|
||||
|
||||
drm_client_setup(drm, NULL);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user