2009-08-07 13:43:20 +03:00
/*
* Copyright ( C ) 2009 Nokia Corporation
2018-05-24 14:46:19 +03:00
* Author : Tomi Valkeinen < tomi . valkeinen @ ti . com >
2009-08-07 13:43:20 +03:00
*
* Some code and ideas taken from drivers / video / omap / driver
* by Imre Deak .
*
* This program is free software ; you can redistribute it and / or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation .
*
* This program is distributed in the hope that it will be useful , but WITHOUT
* ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE . See the GNU General Public License for
* more details .
*
* You should have received a copy of the GNU General Public License along with
* this program . If not , see < http : //www.gnu.org/licenses/>.
*/
# define DSS_SUBSYS_NAME "DISPLAY"
# include <linux/kernel.h>
2013-08-06 09:41:32 +03:00
# include <linux/of.h>
2009-08-07 13:43:20 +03:00
2016-05-27 14:40:49 +03:00
# include "omapdss.h"
2009-08-07 13:43:20 +03:00
2012-11-16 15:45:26 +02:00
static int disp_num_counter ;
2018-03-02 02:15:36 +02:00
void omapdss_display_init ( struct omap_dss_device * dssdev )
2012-11-16 15:45:26 +02:00
{
2013-08-06 09:50:22 +03:00
int id ;
2012-11-16 15:45:26 +02:00
2013-08-06 09:50:22 +03:00
/*
2017-05-07 00:42:26 +03:00
* Note : this presumes that all displays either have an DT alias , or
* none has .
2013-08-06 09:50:22 +03:00
*/
2017-05-07 00:42:26 +03:00
id = of_alias_get_id ( dssdev - > dev - > of_node , " display " ) ;
if ( id < 0 )
2013-08-06 09:50:22 +03:00
id = disp_num_counter + + ;
2018-02-12 11:44:39 +02:00
dssdev - > alias_id = id ;
2013-08-06 09:41:32 +03:00
/* Use 'label' property for name, if it exists */
2017-05-07 00:42:26 +03:00
of_property_read_string ( dssdev - > dev - > of_node , " label " , & dssdev - > name ) ;
2013-08-06 09:41:32 +03:00
if ( dssdev - > name = = NULL )
2018-02-12 11:44:40 +02:00
dssdev - > name = devm_kasprintf ( dssdev - > dev , GFP_KERNEL ,
" display%u " , id ) ;
2018-03-02 02:15:36 +02:00
}
EXPORT_SYMBOL_GPL ( omapdss_display_init ) ;
2018-03-05 14:28:06 +02:00
struct omap_dss_device * omapdss_display_get ( struct omap_dss_device * output )
{
while ( output - > next )
output = output - > next ;
return omapdss_device_get ( output ) ;
}
EXPORT_SYMBOL_GPL ( omapdss_display_get ) ;